Merge m-c to autoland

This commit is contained in:
Phil Ringnalda 2016-12-18 20:24:15 -08:00
commit 5b605a1320
107 changed files with 14554 additions and 14644 deletions

View File

@ -61,7 +61,7 @@
#include "nsIObserverService.h"
#include "nsLayoutUtils.h"
#include "nsPluginFrame.h"
#include "nsSVGPathGeometryFrame.h"
#include "SVGGeometryFrame.h"
#include "nsTreeBodyFrame.h"
#include "nsTreeColumns.h"
#include "nsTreeUtils.h"
@ -1173,8 +1173,8 @@ nsAccessibilityService::CreateAccessible(nsINode* aNode,
if (!newAcc) {
if (content->IsSVGElement()) {
nsSVGPathGeometryFrame* pathGeometryFrame = do_QueryFrame(frame);
if (pathGeometryFrame) {
SVGGeometryFrame* geometryFrame = do_QueryFrame(frame);
if (geometryFrame) {
// A graphic elements: rect, circle, ellipse, line, path, polygon,
// polyline and image. A 'use' and 'text' graphic elements require
// special support.

View File

@ -881,10 +881,8 @@ var SessionStoreInternal = {
if (activePageData) {
if (activePageData.title) {
tab.label = activePageData.title;
tab.crop = "end";
} else if (activePageData.url != "about:blank") {
tab.label = activePageData.url;
tab.crop = "center";
}
} else if (tab.hasAttribute("customizemode")) {
win.gCustomizeMode.setTab(tab);

View File

@ -160,20 +160,15 @@ function loadJSONAsync(file, options) {
// Returns a promise that is resolved with the AddonInstall for that URL.
function addonInstallForURL(url, hash) {
let deferred = Promise.defer();
AddonManager.getInstallForURL(url, install => deferred.resolve(install),
"application/x-xpinstall", hash);
return deferred.promise;
return AddonManager.getInstallForURL(url, null, "application/x-xpinstall", hash);
}
// Returns a promise that is resolved with an Array<Addon> of the installed
// experiment addons.
function installedExperimentAddons() {
let deferred = Promise.defer();
AddonManager.getAddonsByTypes(["experiment"], (addons) => {
deferred.resolve(addons.filter(a => !a.appDisabled));
return AddonManager.getAddonsByTypes(["experiment"]).then(addons => {
return addons.filter(a => !a.appDisabled);
});
return deferred.promise;
}
// Takes an Array<Addon> and returns a promise that is resolved when the
@ -2025,18 +2020,14 @@ Experiments.ExperimentEntry.prototype = {
return Promise.resolve(null);
}
let deferred = Promise.defer();
AddonManager.getAddonByID(this._addonId, (addon) => {
return AddonManager.getAddonByID(this._addonId).then(addon => {
if (addon && addon.appDisabled) {
// Don't return PreviousExperiments.
addon = null;
return null;
}
deferred.resolve(addon);
return addon;
});
return deferred.promise;
},
_logTermination: function(terminationKind, terminationReason) {

View File

@ -2051,6 +2051,7 @@ GK_ATOM(svgFEUnstyledLeafFrame, "SVGFEUnstyledLeafFrame")
GK_ATOM(svgFilterFrame, "SVGFilterFrame")
GK_ATOM(svgForeignObjectFrame, "SVGForeignObjectFrame")
GK_ATOM(svgGenericContainerFrame, "SVGGenericContainerFrame")
GK_ATOM(svgGeometryFrame, "SVGGeometryFrame")
GK_ATOM(svgGFrame, "SVGGFrame")
GK_ATOM(svgGradientFrame, "SVGGradientFrame")
GK_ATOM(svgImageFrame, "SVGImageFrame")
@ -2061,7 +2062,6 @@ GK_ATOM(svgMarkerAnonChildFrame, "SVGMarkerAnonChildFrame")
GK_ATOM(svgMaskFrame, "SVGMaskFrame")
GK_ATOM(svgOuterSVGFrame, "SVGOuterSVGFrame")
GK_ATOM(svgOuterSVGAnonChildFrame, "SVGOuterSVGAnonChildFrame")
GK_ATOM(svgPathGeometryFrame, "SVGPathGeometryFrame")
GK_ATOM(svgPatternFrame, "SVGPatternFrame")
GK_ATOM(svgRadialGradientFrame, "SVGRadialGradientFrame")
GK_ATOM(svgStopFrame, "SVGStopFrame")

View File

@ -128,8 +128,6 @@ MediaWidevineNoWMF=Trying to play Widevine with no Windows Media Foundation. See
# LOCALIZATION NOTE: %S is a comma-separated list of codecs (e.g. 'video/mp4, video/webm')
MediaWMFNeeded=To play video formats %S, you need to install extra Microsoft software, see https://support.mozilla.org/kb/fix-video-audio-problems-firefox-windows
# LOCALIZATION NOTE: %S is a comma-separated list of codecs (e.g. 'video/mp4, video/webm')
MediaUnsupportedBeforeWindowsVista=Video formats %S unsupported by Microsoft before Windows Vista
# LOCALIZATION NOTE: %S is a comma-separated list of codecs (e.g. 'video/mp4, video/webm')
MediaPlatformDecoderNotFound=The video on this page cant be played. Your system may not have the required video codecs for: %S
MediaUnsupportedLibavcodec=The video on this page cant be played. Your system has an unsupported version of libavcodec
# LOCALIZATION NOTE: %S is a comma-separated list of codecs (e.g. 'video/mp4, video/webm')

View File

@ -24,10 +24,6 @@
#include "FFmpegRuntimeLinker.h"
#endif
#if defined(XP_WIN)
#include "mozilla/WindowsVersion.h"
#endif
static mozilla::LazyLogModule sDecoderDoctorLog("DecoderDoctor");
#define DD_LOG(level, arg, ...) MOZ_LOG(sDecoderDoctorLog, level, (arg, ##__VA_ARGS__))
#define DD_DEBUG(arg, ...) DD_LOG(mozilla::LogLevel::Debug, arg, ##__VA_ARGS__)
@ -256,9 +252,6 @@ static const NotificationAndReportStringId sMediaWidevineNoWMF=
static const NotificationAndReportStringId sMediaWMFNeeded =
{ dom::DecoderDoctorNotificationType::Platform_decoder_not_found,
"MediaWMFNeeded" };
static const NotificationAndReportStringId sMediaUnsupportedBeforeWindowsVista =
{ dom::DecoderDoctorNotificationType::Platform_decoder_not_found,
"MediaUnsupportedBeforeWindowsVista" };
static const NotificationAndReportStringId sMediaPlatformDecoderNotFound =
{ dom::DecoderDoctorNotificationType::Platform_decoder_not_found,
"MediaPlatformDecoderNotFound" };
@ -280,7 +273,6 @@ sAllNotificationsAndReportStringIds[] =
{
&sMediaWidevineNoWMF,
&sMediaWMFNeeded,
&sMediaUnsupportedBeforeWindowsVista,
&sMediaPlatformDecoderNotFound,
&sMediaCannotPlayNoDecoders,
&sMediaNoDecoders,
@ -545,16 +537,9 @@ DecoderDoctorDocumentWatcher::SynthesizeAnalysis()
// going through expected decoders from most to least desirable.
#if defined(XP_WIN)
if (!formatsRequiringWMF.IsEmpty()) {
if (IsVistaOrLater()) {
DD_INFO("DecoderDoctorDocumentWatcher[%p, doc=%p]::SynthesizeAnalysis() - unplayable formats: %s -> Cannot play media because WMF was not found",
this, mDocument, NS_ConvertUTF16toUTF8(formatsRequiringWMF).get());
ReportAnalysis(mDocument, sMediaWMFNeeded, false, formatsRequiringWMF);
} else {
DD_INFO("DecoderDoctorDocumentWatcher[%p, doc=%p]::SynthesizeAnalysis() - unplayable formats: %s -> Cannot play media before Windows Vista",
this, mDocument, NS_ConvertUTF16toUTF8(formatsRequiringWMF).get());
ReportAnalysis(mDocument, sMediaUnsupportedBeforeWindowsVista,
false, formatsRequiringWMF);
}
DD_INFO("DecoderDoctorDocumentWatcher[%p, doc=%p]::SynthesizeAnalysis() - unplayable formats: %s -> Cannot play media because WMF was not found",
this, mDocument, NS_ConvertUTF16toUTF8(formatsRequiringWMF).get());
ReportAnalysis(mDocument, sMediaWMFNeeded, false, formatsRequiringWMF);
return;
}
#endif

View File

@ -16,9 +16,6 @@
#include "nsMimeTypes.h"
#include "VideoUtils.h"
#ifdef XP_WIN
#include "mozilla/WindowsVersion.h"
#endif
#ifdef MOZ_WIDGET_ANDROID
#include "nsIGfxInfo.h"
#endif
@ -52,14 +49,6 @@ IsWhitelistedH264Codec(const nsAString& aCodec)
return false;
}
#ifdef XP_WIN
// Disable 4k video on windows vista since it performs poorly.
if (!IsWin7OrLater() &&
level >= H264_LEVEL_5) {
return false;
}
#endif
// Just assume what we can play on all platforms the codecs/formats that
// WMF can play, since we don't have documentation about what other
// platforms can play... According to the WMF documentation:

View File

@ -8,7 +8,6 @@
#include <stdint.h>
#include "mozilla/ArrayUtils.h"
#include "mozilla/RefPtr.h"
#include "mozilla/WindowsVersion.h"
#include "mozilla/Logging.h"
#include "nsThreadUtils.h"
#include "nsWindowsHelpers.h"
@ -202,30 +201,17 @@ LoadDLLs()
HRESULT
MFStartup()
{
if (!IsVistaOrLater()) {
// *Only* use WMF on Vista and later, as if Firefox is run in Windows 95
// compatibility mode on Windows 7 (it does happen!) we may crash trying
// to startup WMF. So we need to detect the OS version here, as in
// compatibility mode IsVistaOrLater() and friends behave as if we're on
// the emulated version of Windows. See bug 1279171.
return E_FAIL;
}
HRESULT hr = LoadDLLs();
if (FAILED(hr)) {
return hr;
}
const int MF_VISTA_VERSION = (0x0001 << 16 | MF_API_VERSION);
const int MF_WIN7_VERSION = (0x0002 << 16 | MF_API_VERSION);
// decltype is unusable for functions having default parameters
DECL_FUNCTION_PTR(MFStartup, ULONG, DWORD);
ENSURE_FUNCTION_PTR_(MFStartup, Mfplat.dll)
if (!IsWin7OrLater())
return MFStartupPtr(MF_VISTA_VERSION, MFSTARTUP_FULL);
else
return MFStartupPtr(MF_WIN7_VERSION, MFSTARTUP_FULL);
return MFStartupPtr(MF_WIN7_VERSION, MFSTARTUP_FULL);
}
HRESULT

View File

@ -19,7 +19,7 @@ PresentationNetworkHelper.prototype = {
QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationNetworkHelper]),
getWifiIPAddress: function(aListener) {
Messaging.sendRequestForResult({type: "Wifi:GetIPAddress"})
EventDispatcher.instance.sendRequestForResult({type: "Wifi:GetIPAddress"})
.then(result => aListener.onGetWifiIPAddress(result),
err => aListener.onError(err));
}

View File

@ -80,7 +80,7 @@ SVGCircleElement::GetLengthInfo()
}
//----------------------------------------------------------------------
// nsSVGPathGeometryElement methods
// SVGGeometryElement methods
bool
SVGCircleElement::GetGeometryBounds(Rect* aBounds,

View File

@ -7,17 +7,17 @@
#ifndef mozilla_dom_SVGCircleElement_h
#define mozilla_dom_SVGCircleElement_h
#include "nsSVGPathGeometryElement.h"
#include "SVGGeometryElement.h"
#include "nsSVGLength2.h"
nsresult NS_NewSVGCircleElement(nsIContent **aResult,
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
typedef nsSVGPathGeometryElement SVGCircleElementBase;
namespace mozilla {
namespace dom {
typedef SVGGeometryElement SVGCircleElementBase;
class SVGCircleElement final : public SVGCircleElementBase
{
protected:
@ -30,7 +30,7 @@ public:
// nsSVGSVGElement methods:
virtual bool HasValidDimensions() const override;
// nsSVGPathGeometryElement methods:
// SVGGeometryElement methods:
virtual bool GetGeometryBounds(Rect* aBounds, const StrokeOptions& aStrokeOptions,
const Matrix& aToBoundsSpace,
const Matrix* aToNonScalingStrokeSpace = nullptr) override;

View File

@ -91,7 +91,7 @@ SVGEllipseElement::GetLengthInfo()
}
//----------------------------------------------------------------------
// nsSVGPathGeometryElement methods
// SVGGeometryElement methods
bool
SVGEllipseElement::GetGeometryBounds(Rect* aBounds,

View File

@ -7,7 +7,7 @@
#ifndef mozilla_dom_SVGEllipseElement_h
#define mozilla_dom_SVGEllipseElement_h
#include "nsSVGPathGeometryElement.h"
#include "SVGGeometryElement.h"
#include "nsSVGLength2.h"
nsresult NS_NewSVGEllipseElement(nsIContent **aResult,
@ -16,7 +16,7 @@ nsresult NS_NewSVGEllipseElement(nsIContent **aResult,
namespace mozilla {
namespace dom {
typedef nsSVGPathGeometryElement SVGEllipseElementBase;
typedef SVGGeometryElement SVGEllipseElementBase;
class SVGEllipseElement final : public SVGEllipseElementBase
{
@ -30,7 +30,7 @@ public:
// nsSVGSVGElement methods:
virtual bool HasValidDimensions() const override;
// nsSVGPathGeometryElement methods:
// SVGGeometryElement methods:
virtual bool GetGeometryBounds(Rect* aBounds, const StrokeOptions& aStrokeOptions,
const Matrix& aToBoundsSpace,
const Matrix* aToNonScalingStrokeSpace = nullptr) override;

View File

@ -4,8 +4,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsSVGPathGeometryElement.h"
#include "SVGGeometryElement.h"
#include "DOMSVGPoint.h"
#include "gfxPlatform.h"
#include "mozilla/gfx/2D.h"
#include "nsComputedDOMStyle.h"
@ -16,30 +17,43 @@
using namespace mozilla;
using namespace mozilla::gfx;
nsSVGElement::NumberInfo SVGGeometryElement::sNumberInfo =
{ &nsGkAtoms::pathLength, 0, false };
//----------------------------------------------------------------------
// Implementation
nsSVGPathGeometryElement::nsSVGPathGeometryElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
: nsSVGPathGeometryElementBase(aNodeInfo)
SVGGeometryElement::SVGGeometryElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
: SVGGeometryElementBase(aNodeInfo)
{
}
nsSVGElement::NumberAttributesInfo
SVGGeometryElement::GetNumberInfo()
{
return NumberAttributesInfo(&mPathLength, &sNumberInfo, 1);
}
nsresult
nsSVGPathGeometryElement::AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName,
const nsAttrValue* aValue, bool aNotify)
SVGGeometryElement::AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName,
const nsAttrValue* aValue, bool aNotify)
{
if (mCachedPath &&
aNamespaceID == kNameSpaceID_None &&
AttributeDefinesGeometry(aName)) {
mCachedPath = nullptr;
}
return nsSVGPathGeometryElementBase::AfterSetAttr(aNamespaceID, aName,
aValue, aNotify);
return SVGGeometryElementBase::AfterSetAttr(aNamespaceID, aName,
aValue, aNotify);
}
bool
nsSVGPathGeometryElement::AttributeDefinesGeometry(const nsIAtom *aName)
SVGGeometryElement::AttributeDefinesGeometry(const nsIAtom *aName)
{
if (aName == nsGkAtoms::pathLength) {
return true;
}
// Check for nsSVGLength2 attribute
LengthAttributesInfo info = GetLengthInfo();
for (uint32_t i = 0; i < info.mLengthCount; i++) {
@ -52,10 +66,10 @@ nsSVGPathGeometryElement::AttributeDefinesGeometry(const nsIAtom *aName)
}
bool
nsSVGPathGeometryElement::GeometryDependsOnCoordCtx()
SVGGeometryElement::GeometryDependsOnCoordCtx()
{
// Check the nsSVGLength2 attribute
LengthAttributesInfo info = const_cast<nsSVGPathGeometryElement*>(this)->GetLengthInfo();
LengthAttributesInfo info = const_cast<SVGGeometryElement*>(this)->GetLengthInfo();
for (uint32_t i = 0; i < info.mLengthCount; i++) {
if (info.mLengths[i].GetSpecifiedUnitType() == nsIDOMSVGLength::SVG_LENGTHTYPE_PERCENTAGE) {
return true;
@ -65,19 +79,19 @@ nsSVGPathGeometryElement::GeometryDependsOnCoordCtx()
}
bool
nsSVGPathGeometryElement::IsMarkable()
SVGGeometryElement::IsMarkable()
{
return false;
}
void
nsSVGPathGeometryElement::GetMarkPoints(nsTArray<nsSVGMark> *aMarks)
SVGGeometryElement::GetMarkPoints(nsTArray<nsSVGMark> *aMarks)
{
}
already_AddRefed<Path>
nsSVGPathGeometryElement::GetOrBuildPath(const DrawTarget& aDrawTarget,
FillRule aFillRule)
SVGGeometryElement::GetOrBuildPath(const DrawTarget& aDrawTarget,
FillRule aFillRule)
{
// We only cache the path if it matches the backend used for screen painting:
bool cacheable = aDrawTarget.GetBackendType() ==
@ -102,13 +116,13 @@ nsSVGPathGeometryElement::GetOrBuildPath(const DrawTarget& aDrawTarget,
}
already_AddRefed<Path>
nsSVGPathGeometryElement::GetOrBuildPathForMeasuring()
SVGGeometryElement::GetOrBuildPathForMeasuring()
{
return nullptr;
}
FillRule
nsSVGPathGeometryElement::GetFillRule()
SVGGeometryElement::GetFillRule()
{
FillRule fillRule = FillRule::FILL_WINDING; // Equivalent to StyleFillRule::Nonzero
@ -130,3 +144,42 @@ nsSVGPathGeometryElement::GetFillRule()
return fillRule;
}
float
SVGGeometryElement::GetTotalLength()
{
RefPtr<Path> flat = GetOrBuildPathForMeasuring();
return flat ? flat->ComputeLength() : 0.f;
}
already_AddRefed<nsISVGPoint>
SVGGeometryElement::GetPointAtLength(float distance, ErrorResult& rv)
{
RefPtr<Path> path = GetOrBuildPathForMeasuring();
if (!path) {
rv.Throw(NS_ERROR_FAILURE);
return nullptr;
}
float totalLength = path->ComputeLength();
if (mPathLength.IsExplicitlySet()) {
float pathLength = mPathLength.GetAnimValue();
if (pathLength <= 0) {
rv.Throw(NS_ERROR_FAILURE);
return nullptr;
}
distance *= totalLength / pathLength;
}
distance = std::max(0.f, distance);
distance = std::min(totalLength, distance);
nsCOMPtr<nsISVGPoint> point =
new DOMSVGPoint(path->ComputePointAtLength(distance));
return point.forget();
}
already_AddRefed<SVGAnimatedNumber>
SVGGeometryElement::PathLength()
{
return mPathLength.ToDOMAnimatedNumber(this);
}

View File

@ -4,11 +4,13 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef __NS_SVGPATHGEOMETRYELEMENT_H__
#define __NS_SVGPATHGEOMETRYELEMENT_H__
#ifndef mozilla_dom_SVGGeometryElement_h
#define mozilla_dom_SVGGeometryElement_h
#include "mozilla/gfx/2D.h"
#include "SVGGraphicsElement.h"
#include "nsISVGPoint.h"
#include "nsSVGNumber2.h"
struct nsSVGMark {
enum Type {
@ -25,9 +27,14 @@ struct nsSVGMark {
x(aX), y(aY), angle(aAngle), type(aType) {}
};
typedef mozilla::dom::SVGGraphicsElement nsSVGPathGeometryElementBase;
namespace mozilla {
namespace dom {
class nsSVGPathGeometryElement : public nsSVGPathGeometryElementBase
class SVGAnimatedNumber;
typedef mozilla::dom::SVGGraphicsElement SVGGeometryElementBase;
class SVGGeometryElement : public SVGGeometryElementBase
{
protected:
typedef mozilla::gfx::CapStyle CapStyle;
@ -42,7 +49,7 @@ protected:
typedef mozilla::gfx::StrokeOptions StrokeOptions;
public:
explicit nsSVGPathGeometryElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
explicit SVGGeometryElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
virtual nsresult AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName,
const nsAttrValue* aValue, bool aNotify) override;
@ -159,7 +166,7 @@ public:
* that is created may be cached and returned on subsequent calls.
*/
virtual already_AddRefed<Path> GetOrBuildPath(const DrawTarget& aDrawTarget,
FillRule fillRule);
FillRule fillRule);
/**
* The same as GetOrBuildPath, but bypasses the cache (neither returns any
@ -191,8 +198,22 @@ public:
*/
FillRule GetFillRule();
// WebIDL
already_AddRefed<SVGAnimatedNumber> PathLength();
float GetTotalLength();
already_AddRefed<nsISVGPoint>
GetPointAtLength(float distance, ErrorResult& rv);
protected:
// nsSVGElement method
virtual NumberAttributesInfo GetNumberInfo() override;
nsSVGNumber2 mPathLength;
static NumberInfo sNumberInfo;
mutable RefPtr<Path> mCachedPath;
};
#endif
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_SVGGeometryElement_h

View File

@ -235,7 +235,7 @@ SVGImageElement::IsAttributeMapped(const nsIAtom* name) const
}
//----------------------------------------------------------------------
// nsSVGPathGeometryElement methods
// SVGGeometryElement methods
/* For the purposes of the update/invalidation logic pretend to
be a rectangle. */

View File

@ -9,21 +9,21 @@
#include "nsImageLoadingContent.h"
#include "nsSVGLength2.h"
#include "nsSVGPathGeometryElement.h"
#include "nsSVGString.h"
#include "SVGGeometryElement.h"
#include "SVGAnimatedPreserveAspectRatio.h"
nsresult NS_NewSVGImageElement(nsIContent **aResult,
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
typedef nsSVGPathGeometryElement SVGImageElementBase;
class nsSVGImageFrame;
namespace mozilla {
namespace dom {
class DOMSVGAnimatedPreserveAspectRatio;
typedef SVGGeometryElement SVGImageElementBase;
class SVGImageElement : public SVGImageElementBase,
public nsImageLoadingContent
{
@ -56,7 +56,7 @@ public:
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* name) const override;
// nsSVGPathGeometryElement methods:
// SVGGeometryElement methods:
virtual bool GetGeometryBounds(Rect* aBounds, const StrokeOptions& aStrokeOptions,
const Matrix& aToBoundsSpace,
const Matrix* aToNonScalingStrokeSpace = nullptr) override;

View File

@ -110,7 +110,7 @@ SVGLineElement::GetLengthInfo()
}
//----------------------------------------------------------------------
// nsSVGPathGeometryElement methods
// SVGGeometryElement methods
void
SVGLineElement::GetMarkPoints(nsTArray<nsSVGMark> *aMarks) {

View File

@ -7,7 +7,7 @@
#ifndef mozilla_dom_SVGLineElement_h
#define mozilla_dom_SVGLineElement_h
#include "nsSVGPathGeometryElement.h"
#include "SVGGeometryElement.h"
#include "nsSVGLength2.h"
nsresult NS_NewSVGLineElement(nsIContent **aResult,
@ -16,7 +16,7 @@ nsresult NS_NewSVGLineElement(nsIContent **aResult,
namespace mozilla {
namespace dom {
typedef nsSVGPathGeometryElement SVGLineElementBase;
typedef SVGGeometryElement SVGLineElementBase;
class SVGLineElement final : public SVGLineElementBase
{
@ -34,7 +34,7 @@ public:
// nsIContent interface
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* name) const override;
// nsSVGPathGeometryElement methods:
// SVGGeometryElement methods:
virtual bool IsMarkable() override { return true; }
virtual void GetMarkPoints(nsTArray<nsSVGMark> *aMarks) override;
virtual void GetAsSimplePath(SimplePath* aSimplePath) override;

View File

@ -15,10 +15,10 @@
#include "nsError.h"
#include "nsString.h"
#include "nsSVGPathDataParser.h"
#include "nsSVGPathGeometryElement.h" // for nsSVGMark
#include <stdarg.h>
#include "nsStyleConsts.h"
#include "SVGContentUtils.h"
#include "SVGGeometryElement.h" // for nsSVGMark
#include "SVGPathSegUtils.h"
#include <algorithm>

View File

@ -1,4 +1,3 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
@ -10,7 +9,6 @@
#include "DOMSVGPathSeg.h"
#include "DOMSVGPathSegList.h"
#include "DOMSVGPoint.h"
#include "gfx2DGlue.h"
#include "gfxPlatform.h"
#include "mozilla/dom/SVGPathElementBinding.h"
@ -36,9 +34,6 @@ SVGPathElement::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto)
return SVGPathElementBinding::Wrap(aCx, this, aGivenProto);
}
nsSVGElement::NumberInfo SVGPathElement::sNumberInfo =
{ &nsGkAtoms::pathLength, 0, false };
//----------------------------------------------------------------------
// Implementation
@ -62,45 +57,6 @@ SVGPathElement::SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGPathElement)
already_AddRefed<SVGAnimatedNumber>
SVGPathElement::PathLength()
{
return mPathLength.ToDOMAnimatedNumber(this);
}
float
SVGPathElement::GetTotalLength()
{
RefPtr<Path> flat = GetOrBuildPathForMeasuring();
return flat ? flat->ComputeLength() : 0.f;
}
already_AddRefed<nsISVGPoint>
SVGPathElement::GetPointAtLength(float distance, ErrorResult& rv)
{
RefPtr<Path> path = GetOrBuildPathForMeasuring();
if (!path) {
rv.Throw(NS_ERROR_FAILURE);
return nullptr;
}
float totalLength = path->ComputeLength();
if (mPathLength.IsExplicitlySet()) {
float pathLength = mPathLength.GetAnimValue();
if (pathLength <= 0) {
rv.Throw(NS_ERROR_FAILURE);
return nullptr;
}
distance *= totalLength / pathLength;
}
distance = std::max(0.f, distance);
distance = std::min(totalLength, distance);
nsCOMPtr<nsISVGPoint> point =
new DOMSVGPoint(path->ComputePointAtLength(distance));
return point.forget();
}
uint32_t
SVGPathElement::GetPathSegAtLength(float distance)
{
@ -285,12 +241,6 @@ SVGPathElement::HasValidDimensions() const
return !mD.GetAnimValue().IsEmpty();
}
nsSVGElement::NumberAttributesInfo
SVGPathElement::GetNumberInfo()
{
return NumberAttributesInfo(&mPathLength, &sNumberInfo, 1);
}
//----------------------------------------------------------------------
// nsIContent methods
@ -312,7 +262,7 @@ SVGPathElement::GetOrBuildPathForMeasuring()
}
//----------------------------------------------------------------------
// nsSVGPathGeometryElement methods
// SVGGeometryElement methods
bool
SVGPathElement::AttributeDefinesGeometry(const nsIAtom *aName)

View File

@ -9,22 +9,21 @@
#include "mozilla/gfx/2D.h"
#include "mozilla/RefPtr.h"
#include "nsSVGNumber2.h"
#include "nsSVGPathGeometryElement.h"
#include "SVGAnimatedPathSegList.h"
#include "SVGGeometryElement.h"
#include "DOMSVGPathSeg.h"
nsresult NS_NewSVGPathElement(nsIContent **aResult,
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
typedef nsSVGPathGeometryElement SVGPathElementBase;
namespace mozilla {
class nsISVGPoint;
namespace dom {
typedef SVGGeometryElement SVGPathElementBase;
class SVGPathElement final : public SVGPathElementBase
{
typedef mozilla::gfx::Path Path;
@ -45,7 +44,7 @@ public:
// nsSVGSVGElement methods:
virtual bool HasValidDimensions() const override;
// nsSVGPathGeometryElement methods:
// SVGGeometryElement methods:
virtual bool AttributeDefinesGeometry(const nsIAtom *aName) override;
virtual bool IsMarkable() override;
virtual void GetMarkPoints(nsTArray<nsSVGMark> *aMarks) override;
@ -82,9 +81,6 @@ public:
float GetPathLengthScale(PathLengthScaleForType aFor);
// WebIDL
already_AddRefed<SVGAnimatedNumber> PathLength();
float GetTotalLength();
already_AddRefed<nsISVGPoint> GetPointAtLength(float distance, ErrorResult& rv);
uint32_t GetPathSegAtLength(float distance);
already_AddRefed<DOMSVGPathSegClosePath> CreateSVGPathSegClosePath();
already_AddRefed<DOMSVGPathSegMovetoAbs> CreateSVGPathSegMovetoAbs(float x, float y);
@ -120,12 +116,7 @@ public:
protected:
// nsSVGElement method
virtual NumberAttributesInfo GetNumberInfo() override;
SVGAnimatedPathSegList mD;
nsSVGNumber2 mPathLength;
static NumberInfo sNumberInfo;
};
} // namespace dom

View File

@ -4,7 +4,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsSVGPolyElement.h"
#include "SVGPolyElement.h"
#include "DOMSVGPointList.h"
#include "mozilla/gfx/2D.h"
#include "SVGContentUtils.h"
@ -15,26 +15,26 @@ using namespace mozilla::gfx;
//----------------------------------------------------------------------
// nsISupports methods
NS_IMPL_ADDREF_INHERITED(nsSVGPolyElement,nsSVGPolyElementBase)
NS_IMPL_RELEASE_INHERITED(nsSVGPolyElement,nsSVGPolyElementBase)
NS_IMPL_ADDREF_INHERITED(SVGPolyElement,SVGPolyElementBase)
NS_IMPL_RELEASE_INHERITED(SVGPolyElement,SVGPolyElementBase)
NS_INTERFACE_MAP_BEGIN(nsSVGPolyElement)
NS_INTERFACE_MAP_END_INHERITING(nsSVGPolyElementBase)
NS_INTERFACE_MAP_BEGIN(SVGPolyElement)
NS_INTERFACE_MAP_END_INHERITING(SVGPolyElementBase)
//----------------------------------------------------------------------
// Implementation
nsSVGPolyElement::nsSVGPolyElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
: nsSVGPolyElementBase(aNodeInfo)
SVGPolyElement::SVGPolyElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
: SVGPolyElementBase(aNodeInfo)
{
}
nsSVGPolyElement::~nsSVGPolyElement()
SVGPolyElement::~SVGPolyElement()
{
}
already_AddRefed<DOMSVGPointList>
nsSVGPolyElement::Points()
SVGPolyElement::Points()
{
void *key = mPoints.GetBaseValKey();
RefPtr<DOMSVGPointList> points = DOMSVGPointList::GetDOMWrapper(key, this, false);
@ -42,7 +42,7 @@ nsSVGPolyElement::Points()
}
already_AddRefed<DOMSVGPointList>
nsSVGPolyElement::AnimatedPoints()
SVGPolyElement::AnimatedPoints()
{
void *key = mPoints.GetAnimValKey();
RefPtr<DOMSVGPointList> points = DOMSVGPointList::GetDOMWrapper(key, this, true);
@ -54,30 +54,30 @@ nsSVGPolyElement::AnimatedPoints()
// nsIContent methods
NS_IMETHODIMP_(bool)
nsSVGPolyElement::IsAttributeMapped(const nsIAtom* name) const
SVGPolyElement::IsAttributeMapped(const nsIAtom* name) const
{
static const MappedAttributeEntry* const map[] = {
sMarkersMap
};
return FindAttributeDependence(name, map) ||
nsSVGPolyElementBase::IsAttributeMapped(name);
SVGPolyElementBase::IsAttributeMapped(name);
}
//----------------------------------------------------------------------
// nsSVGElement methods
/* virtual */ bool
nsSVGPolyElement::HasValidDimensions() const
SVGPolyElement::HasValidDimensions() const
{
return !mPoints.GetAnimValue().IsEmpty();
}
//----------------------------------------------------------------------
// nsSVGPathGeometryElement methods
// SVGGeometryElement methods
bool
nsSVGPolyElement::AttributeDefinesGeometry(const nsIAtom *aName)
SVGPolyElement::AttributeDefinesGeometry(const nsIAtom *aName)
{
if (aName == nsGkAtoms::points)
return true;
@ -86,7 +86,7 @@ nsSVGPolyElement::AttributeDefinesGeometry(const nsIAtom *aName)
}
void
nsSVGPolyElement::GetMarkPoints(nsTArray<nsSVGMark> *aMarks)
SVGPolyElement::GetMarkPoints(nsTArray<nsSVGMark> *aMarks)
{
const SVGPointList &points = mPoints.GetAnimValue();
@ -122,10 +122,10 @@ nsSVGPolyElement::GetMarkPoints(nsTArray<nsSVGMark> *aMarks)
}
bool
nsSVGPolyElement::GetGeometryBounds(Rect* aBounds,
const StrokeOptions& aStrokeOptions,
const Matrix& aToBoundsSpace,
const Matrix* aToNonScalingStrokeSpace)
SVGPolyElement::GetGeometryBounds(Rect* aBounds,
const StrokeOptions& aStrokeOptions,
const Matrix& aToBoundsSpace,
const Matrix* aToNonScalingStrokeSpace)
{
const SVGPointList &points = mPoints.GetAnimValue();

View File

@ -8,21 +8,22 @@
#define NS_SVGPOLYELEMENT_H_
#include "mozilla/Attributes.h"
#include "nsSVGPathGeometryElement.h"
#include "SVGAnimatedPointList.h"
typedef nsSVGPathGeometryElement nsSVGPolyElementBase;
#include "SVGGeometryElement.h"
namespace mozilla {
class DOMSVGPointList;
} // namespace mozilla
class nsSVGPolyElement : public nsSVGPolyElementBase
namespace dom {
typedef SVGGeometryElement SVGPolyElementBase;
class SVGPolyElement : public SVGPolyElementBase
{
protected:
explicit nsSVGPolyElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
explicit SVGPolyElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
virtual ~nsSVGPolyElement();
virtual ~SVGPolyElement();
public:
//interfaces
@ -42,7 +43,7 @@ public:
// nsSVGElement methods:
virtual bool HasValidDimensions() const override;
// nsSVGPathGeometryElement methods:
// SVGGeometryElement methods:
virtual bool AttributeDefinesGeometry(const nsIAtom *aName) override;
virtual bool IsMarkable() override { return true; }
virtual void GetMarkPoints(nsTArray<nsSVGMark> *aMarks) override;
@ -58,4 +59,7 @@ protected:
SVGAnimatedPointList mPoints;
};
} // namespace dom
} // namespace mozilla
#endif //NS_SVGPOLYELEMENT_H_

View File

@ -37,12 +37,12 @@ SVGPolygonElement::SVGPolygonElement(already_AddRefed<mozilla::dom::NodeInfo>& a
NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGPolygonElement)
//----------------------------------------------------------------------
// nsSVGPathGeometryElement methods
// SVGGeometryElement methods
void
SVGPolygonElement::GetMarkPoints(nsTArray<nsSVGMark> *aMarks)
{
nsSVGPolyElement::GetMarkPoints(aMarks);
SVGPolyElement::GetMarkPoints(aMarks);
if (aMarks->IsEmpty() || aMarks->LastElement().type != nsSVGMark::eEnd) {
return;
@ -56,7 +56,7 @@ SVGPolygonElement::GetMarkPoints(nsTArray<nsSVGMark> *aMarks)
endMark->angle = SVGContentUtils::AngleBisect(angle, endMark->angle);
startMark->angle = SVGContentUtils::AngleBisect(angle, startMark->angle);
// for a polygon (as opposed to a polyline) there's an implicit extra point
// co-located with the start point that nsSVGPolyElement::GetMarkPoints
// co-located with the start point that SVGPolyElement::GetMarkPoints
// doesn't return
aMarks->AppendElement(nsSVGMark(startMark->x, startMark->y, startMark->angle,
nsSVGMark::eEnd));

View File

@ -8,16 +8,16 @@
#define mozilla_dom_SVGPolygonElement_h
#include "mozilla/Attributes.h"
#include "nsSVGPolyElement.h"
#include "SVGPolyElement.h"
nsresult NS_NewSVGPolygonElement(nsIContent **aResult,
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
typedef nsSVGPolyElement SVGPolygonElementBase;
namespace mozilla {
namespace dom {
typedef SVGPolyElement SVGPolygonElementBase;
class SVGPolygonElement final : public SVGPolygonElementBase
{
protected:
@ -27,7 +27,7 @@ protected:
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
public:
// nsSVGPathGeometryElement methods:
// SVGGeometryElement methods:
virtual void GetMarkPoints(nsTArray<nsSVGMark> *aMarks) override;
virtual already_AddRefed<Path> BuildPath(PathBuilder* aBuilder) override;

View File

@ -36,7 +36,7 @@ SVGPolylineElement::SVGPolylineElement(already_AddRefed<mozilla::dom::NodeInfo>&
NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGPolylineElement)
//----------------------------------------------------------------------
// nsSVGPathGeometryElement methods
// SVGGeometryElement methods
already_AddRefed<Path>
SVGPolylineElement::BuildPath(PathBuilder* aBuilder)

View File

@ -7,16 +7,16 @@
#ifndef mozilla_dom_SVGPolylineElement_h
#define mozilla_dom_SVGPolylineElement_h
#include "nsSVGPolyElement.h"
#include "SVGPolyElement.h"
nsresult NS_NewSVGPolylineElement(nsIContent **aResult,
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
typedef nsSVGPolyElement SVGPolylineElementBase;
namespace mozilla {
namespace dom {
typedef SVGPolyElement SVGPolylineElementBase;
class SVGPolylineElement final : public SVGPolylineElementBase
{
protected:
@ -25,7 +25,7 @@ protected:
friend nsresult (::NS_NewSVGPolylineElement(nsIContent **aResult,
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
// nsSVGPathGeometryElement methods:
// SVGGeometryElement methods:
virtual already_AddRefed<Path> BuildPath(PathBuilder* aBuilder) override;
public:

View File

@ -109,7 +109,7 @@ SVGRectElement::GetLengthInfo()
}
//----------------------------------------------------------------------
// nsSVGPathGeometryElement methods
// SVGGeometryElement methods
bool
SVGRectElement::GetGeometryBounds(Rect* aBounds,

View File

@ -7,17 +7,17 @@
#ifndef mozilla_dom_SVGRectElement_h
#define mozilla_dom_SVGRectElement_h
#include "nsSVGPathGeometryElement.h"
#include "nsSVGLength2.h"
#include "SVGGeometryElement.h"
nsresult NS_NewSVGRectElement(nsIContent **aResult,
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
typedef nsSVGPathGeometryElement SVGRectElementBase;
namespace mozilla {
namespace dom {
typedef SVGGeometryElement SVGRectElementBase;
class SVGRectElement final : public SVGRectElementBase
{
protected:
@ -30,7 +30,7 @@ public:
// nsSVGSVGElement methods:
virtual bool HasValidDimensions() const override;
// nsSVGPathGeometryElement methods:
// SVGGeometryElement methods:
virtual bool GetGeometryBounds(Rect* aBounds, const StrokeOptions& aStrokeOptions,
const Matrix& aToBoundsSpace,
const Matrix* aToNonScalingStrokeSpace = nullptr) override;

View File

@ -64,6 +64,7 @@ EXPORTS.mozilla.dom += [
'SVGFilterElement.h',
'SVGForeignObjectElement.h',
'SVGGElement.h',
'SVGGeometryElement.h',
'SVGGradientElement.h',
'SVGGraphicsElement.h',
'SVGImageElement.h',
@ -130,8 +131,6 @@ UNIFIED_SOURCES += [
'nsSVGNumber2.cpp',
'nsSVGNumberPair.cpp',
'nsSVGPathDataParser.cpp',
'nsSVGPathGeometryElement.cpp',
'nsSVGPolyElement.cpp',
'nsSVGString.cpp',
'nsSVGTransform.cpp',
'nsSVGViewBox.cpp',
@ -189,6 +188,7 @@ UNIFIED_SOURCES += [
'SVGForeignObjectElement.cpp',
'SVGFragmentIdentifier.cpp',
'SVGGElement.cpp',
'SVGGeometryElement.cpp',
'SVGGradientElement.cpp',
'SVGGraphicsElement.cpp',
'SVGImageElement.cpp',
@ -217,6 +217,7 @@ UNIFIED_SOURCES += [
'SVGPatternElement.cpp',
'SVGPointList.cpp',
'SVGPointListSMILType.cpp',
'SVGPolyElement.cpp',
'SVGPolygonElement.cpp',
'SVGPolylineElement.cpp',
'SVGPreserveAspectRatio.cpp',

View File

@ -16,7 +16,6 @@
#include "nsICSSDeclaration.h"
#include "nsIDocument.h"
#include "nsIDOMMutationEvent.h"
#include "nsSVGPathGeometryElement.h"
#include "mozilla/InternalMutationEvent.h"
#include "nsError.h"
#include "nsIPresShell.h"
@ -45,6 +44,7 @@
#include "SVGAnimatedPointList.h"
#include "SVGAnimatedPathSegList.h"
#include "SVGContentUtils.h"
#include "SVGGeometryElement.h"
#include "nsIFrame.h"
#include "nsQueryObject.h"
#include <stdarg.h>

View File

@ -1007,6 +1007,8 @@ var interfaceNamesInGlobalScope =
"SVGForeignObjectElement",
// IMPORTANT: Do not change this list without review from a DOM peer!
"SVGGElement",
// IMPORTANT: Do not change this list without review from a DOM peer!
"SVGGeometryElement",
// IMPORTANT: Do not change this list without review from a DOM peer!
"SVGGradientElement",
// IMPORTANT: Do not change this list without review from a DOM peer!

View File

@ -0,0 +1,20 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*
* The origin of this IDL file is
* http://www.w3.org/TR/SVG2/
*
* Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
* liability, trademark and document use rules apply.
*/
interface SVGGeometryElement : SVGGraphicsElement {
[SameObject]
readonly attribute SVGAnimatedNumber pathLength;
float getTotalLength();
[NewObject, Throws]
SVGPoint getPointAtLength(float distance);
};

View File

@ -9,14 +9,8 @@
* Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
* liability, trademark and document use rules apply.
*/
interface SVGPathElement : SVGGraphicsElement {
interface SVGPathElement : SVGGeometryElement {
[Constant]
readonly attribute SVGAnimatedNumber pathLength;
float getTotalLength();
[NewObject, Throws]
SVGPoint getPointAtLength(float distance);
unsigned long getPathSegAtLength(float distance);
[NewObject]
SVGPathSegClosePath createSVGPathSegClosePath();

View File

@ -473,6 +473,7 @@ WEBIDL_FILES = [
'SVGFitToViewBox.webidl',
'SVGForeignObjectElement.webidl',
'SVGGElement.webidl',
'SVGGeometryElement.webidl',
'SVGGradientElement.webidl',
'SVGGraphicsElement.webidl',
'SVGImageElement.webidl',

View File

@ -1931,26 +1931,23 @@ PerformPromiseRace(JSContext *cx, JS::ForOfIterator& iterator, HandleObject C,
}
// ES2016, Sub-steps of 25.4.4.4 and 25.4.4.5.
static MOZ_MUST_USE bool
CommonStaticResolveRejectImpl(JSContext* cx, unsigned argc, Value* vp, ResolutionMode mode)
static MOZ_MUST_USE JSObject*
CommonStaticResolveRejectImpl(JSContext* cx, HandleValue thisVal, HandleValue argVal,
ResolutionMode mode)
{
CallArgs args = CallArgsFromVp(argc, vp);
RootedValue x(cx, args.get(0));
// Steps 1-2.
if (!args.thisv().isObject()) {
if (!thisVal.isObject()) {
const char* msg = mode == ResolveMode
? "Receiver of Promise.resolve call"
: "Receiver of Promise.reject call";
JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, JSMSG_NOT_NONNULL_OBJECT, msg);
return false;
return nullptr;
}
RootedValue cVal(cx, args.thisv());
RootedObject C(cx, &cVal.toObject());
RootedObject C(cx, &thisVal.toObject());
// Step 3 of Resolve.
if (mode == ResolveMode && x.isObject()) {
RootedObject xObj(cx, &x.toObject());
if (mode == ResolveMode && argVal.isObject()) {
RootedObject xObj(cx, &argVal.toObject());
bool isPromise = false;
if (xObj->is<PromiseObject>()) {
isPromise = true;
@ -1969,11 +1966,9 @@ CommonStaticResolveRejectImpl(JSContext* cx, unsigned argc, Value* vp, Resolutio
if (isPromise) {
RootedValue ctorVal(cx);
if (!GetProperty(cx, xObj, xObj, cx->names().constructor, &ctorVal))
return false;
if (ctorVal == cVal) {
args.rval().set(x);
return true;
}
return nullptr;
if (ctorVal == thisVal)
return xObj;
}
}
@ -1982,15 +1977,17 @@ CommonStaticResolveRejectImpl(JSContext* cx, unsigned argc, Value* vp, Resolutio
RootedObject resolveFun(cx);
RootedObject rejectFun(cx);
if (!NewPromiseCapability(cx, C, &promise, &resolveFun, &rejectFun, true))
return false;
return nullptr;
// Step 5 of Resolve, 4 of Reject.
if (!RunResolutionFunction(cx, mode == ResolveMode ? resolveFun : rejectFun, x, mode, promise))
return false;
if (!RunResolutionFunction(cx, mode == ResolveMode ? resolveFun : rejectFun, argVal, mode,
promise))
{
return nullptr;
}
// Step 6 of Resolve, 4 of Reject.
args.rval().setObject(*promise);
return true;
return promise;
}
/**
@ -1999,7 +1996,14 @@ CommonStaticResolveRejectImpl(JSContext* cx, unsigned argc, Value* vp, Resolutio
bool
js::Promise_reject(JSContext* cx, unsigned argc, Value* vp)
{
return CommonStaticResolveRejectImpl(cx, argc, vp, RejectMode);
CallArgs args = CallArgsFromVp(argc, vp);
RootedValue thisVal(cx, args.thisv());
RootedValue argVal(cx, args.get(0));
JSObject* result = CommonStaticResolveRejectImpl(cx, thisVal, argVal, RejectMode);
if (!result)
return false;
args.rval().setObject(*result);
return true;
}
/**
@ -2008,19 +2012,11 @@ js::Promise_reject(JSContext* cx, unsigned argc, Value* vp)
/* static */ JSObject*
PromiseObject::unforgeableReject(JSContext* cx, HandleValue value)
{
// Steps 1-2 (omitted).
// Roughly step 3.
Rooted<PromiseObject*> promise(cx, CreatePromiseObjectInternal(cx));
if (!promise)
RootedObject promiseCtor(cx, JS::GetPromiseConstructor(cx));
if (!promiseCtor)
return nullptr;
// Roughly step 4.
if (!ResolvePromise(cx, promise, value, JS::PromiseState::Rejected))
return nullptr;
// Step 5.
return promise;
RootedValue cVal(cx, ObjectValue(*promiseCtor));
return CommonStaticResolveRejectImpl(cx, cVal, value, RejectMode);
}
/**
@ -2029,7 +2025,14 @@ PromiseObject::unforgeableReject(JSContext* cx, HandleValue value)
bool
js::Promise_static_resolve(JSContext* cx, unsigned argc, Value* vp)
{
return CommonStaticResolveRejectImpl(cx, argc, vp, ResolveMode);
CallArgs args = CallArgsFromVp(argc, vp);
RootedValue thisVal(cx, args.thisv());
RootedValue argVal(cx, args.get(0));
JSObject* result = CommonStaticResolveRejectImpl(cx, thisVal, argVal, ResolveMode);
if (!result)
return false;
args.rval().setObject(*result);
return true;
}
/**
@ -2038,30 +2041,11 @@ js::Promise_static_resolve(JSContext* cx, unsigned argc, Value* vp)
/* static */ JSObject*
PromiseObject::unforgeableResolve(JSContext* cx, HandleValue value)
{
// Steps 1-2 (omitted).
// Step 3.
if (value.isObject()) {
JSObject* obj = &value.toObject();
if (IsWrapper(obj))
obj = CheckedUnwrap(obj);
// Instead of getting the `constructor` property, do an unforgeable
// check.
if (obj && obj->is<PromiseObject>())
return obj;
}
// Step 4.
Rooted<PromiseObject*> promise(cx, CreatePromiseObjectInternal(cx));
if (!promise)
RootedObject promiseCtor(cx, JS::GetPromiseConstructor(cx));
if (!promiseCtor)
return nullptr;
// Steps 5.
if (!ResolvePromiseInternal(cx, promise, value))
return nullptr;
// Step 6.
return promise;
RootedValue cVal(cx, ObjectValue(*promiseCtor));
return CommonStaticResolveRejectImpl(cx, cVal, value, ResolveMode);
}
// ES2016, 25.4.4.6, implemented in Promise.js.

View File

@ -1605,7 +1605,7 @@ js::RegExpPrototypeOptimizableRaw(JSContext* cx, JSObject* proto, uint8_t* resul
}
JSFunction* flagsGetter;
if (!GetGetterPure(cx, proto, NameToId(cx->names().flags), &flagsGetter))
if (!GetOwnGetterPure(cx, proto, NameToId(cx->names().flags), &flagsGetter))
return false;
if (!flagsGetter) {

View File

@ -4835,7 +4835,7 @@ JS::CallOriginalPromiseResolve(JSContext* cx, JS::HandleValue resolutionValue)
assertSameCompartment(cx, resolutionValue);
RootedObject promise(cx, PromiseObject::unforgeableResolve(cx, resolutionValue));
MOZ_ASSERT_IF(promise, promise->is<PromiseObject>());
MOZ_ASSERT_IF(promise, CheckedUnwrap(promise)->is<PromiseObject>());
return promise;
}
@ -4847,7 +4847,7 @@ JS::CallOriginalPromiseReject(JSContext* cx, JS::HandleValue rejectionValue)
assertSameCompartment(cx, rejectionValue);
RootedObject promise(cx, PromiseObject::unforgeableReject(cx, rejectionValue));
MOZ_ASSERT_IF(promise, promise->is<PromiseObject>());
MOZ_ASSERT_IF(promise, CheckedUnwrap(promise)->is<PromiseObject>());
return promise;
}

View File

@ -2387,7 +2387,7 @@ js::GetPropertyPure(ExclusiveContext* cx, JSObject* obj, jsid id, Value* vp)
}
static inline bool
NativeGetGetterPureInline(NativeObject* pobj, Shape* shape, JSFunction** fp)
NativeGetGetterPureInline(Shape* shape, JSFunction** fp)
{
if (shape->hasGetterObject()) {
if (shape->getterObject()->is<JSFunction>()) {
@ -2415,8 +2415,23 @@ js::GetGetterPure(ExclusiveContext* cx, JSObject* obj, jsid id, JSFunction** fp)
return true;
}
return pobj->isNative() &&
NativeGetGetterPureInline(&pobj->as<NativeObject>(), shape, fp);
return pobj->isNative() && NativeGetGetterPureInline(shape, fp);
}
bool
js::GetOwnGetterPure(ExclusiveContext* cx, JSObject* obj, jsid id, JSFunction** fp)
{
JS::AutoCheckCannotGC nogc;
Shape* shape;
if (!LookupOwnPropertyPure(cx, obj, id, &shape))
return false;
if (!shape) {
*fp = nullptr;
return true;
}
return NativeGetGetterPureInline(shape, fp);
}
bool

View File

@ -1261,6 +1261,9 @@ GetPropertyPure(ExclusiveContext* cx, JSObject* obj, jsid id, Value* vp);
bool
GetGetterPure(ExclusiveContext* cx, JSObject* obj, jsid id, JSFunction** fp);
bool
GetOwnGetterPure(ExclusiveContext* cx, JSObject* obj, jsid id, JSFunction** fp);
bool
GetOwnNativeGetterPure(JSContext* cx, JSObject* obj, jsid id, JSNative* native);

View File

@ -0,0 +1,21 @@
var BUGNUMBER = 0;
var summary = "RegExp.prototype.split should reflect the change to Object.prototype.flags.";
print(BUGNUMBER + ": " + summary);
Object.defineProperty(Object.prototype, "flags", Object.getOwnPropertyDescriptor(RegExp.prototype, "flags"));
delete RegExp.prototype.flags;
let re = /a/i;
let a = re[Symbol.split]("1a2A3a4A5");
assertDeepEq(a, ["1", "2", "3", "4", "5"]);
delete Object.prototype.flags;
Object.prototype.flags = "";
a = re[Symbol.split]("1a2A3a4A5");
assertDeepEq(a, ["1", "2A3", "4A5"]);
if (typeof reportCompare === "function")
reportCompare(true, true);

View File

@ -136,7 +136,7 @@ NS_NewSVGOuterSVGAnonChildFrame(nsIPresShell* aPresShell, nsStyleContext* aConte
nsIFrame*
NS_NewSVGInnerSVGFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
nsIFrame*
NS_NewSVGPathGeometryFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
NS_NewSVGGeometryFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
nsIFrame*
NS_NewSVGGFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
nsIFrame*
@ -5493,13 +5493,13 @@ nsCSSFrameConstructor::FindSVGData(Element* aElement,
SIMPLE_SVG_CREATE(svg, NS_NewSVGInnerSVGFrame),
SIMPLE_SVG_CREATE(g, NS_NewSVGGFrame),
SIMPLE_SVG_CREATE(svgSwitch, NS_NewSVGSwitchFrame),
SIMPLE_SVG_CREATE(polygon, NS_NewSVGPathGeometryFrame),
SIMPLE_SVG_CREATE(polyline, NS_NewSVGPathGeometryFrame),
SIMPLE_SVG_CREATE(circle, NS_NewSVGPathGeometryFrame),
SIMPLE_SVG_CREATE(ellipse, NS_NewSVGPathGeometryFrame),
SIMPLE_SVG_CREATE(line, NS_NewSVGPathGeometryFrame),
SIMPLE_SVG_CREATE(rect, NS_NewSVGPathGeometryFrame),
SIMPLE_SVG_CREATE(path, NS_NewSVGPathGeometryFrame),
SIMPLE_SVG_CREATE(polygon, NS_NewSVGGeometryFrame),
SIMPLE_SVG_CREATE(polyline, NS_NewSVGGeometryFrame),
SIMPLE_SVG_CREATE(circle, NS_NewSVGGeometryFrame),
SIMPLE_SVG_CREATE(ellipse, NS_NewSVGGeometryFrame),
SIMPLE_SVG_CREATE(line, NS_NewSVGGeometryFrame),
SIMPLE_SVG_CREATE(rect, NS_NewSVGGeometryFrame),
SIMPLE_SVG_CREATE(path, NS_NewSVGGeometryFrame),
SIMPLE_SVG_CREATE(defs, NS_NewSVGContainerFrame),
SIMPLE_SVG_CREATE(generic_, NS_NewSVGGenericContainerFrame),
{ &nsGkAtoms::foreignObject,

View File

@ -153,7 +153,7 @@ FRAME_ID(nsSVGMaskFrame)
FRAME_ID(nsSVGOuterSVGFrame)
FRAME_ID(nsSVGOuterSVGAnonChildFrame)
FRAME_ID(nsSVGPaintServerFrame)
FRAME_ID(nsSVGPathGeometryFrame)
FRAME_ID(SVGGeometryFrame)
FRAME_ID(nsSVGPatternFrame)
FRAME_ID(nsSVGRadialGradientFrame)
FRAME_ID(nsSVGStopFrame)

View File

@ -52,7 +52,7 @@ DECLARE_DISPLAY_ITEM_TYPE(SUBDOCUMENT)
DECLARE_DISPLAY_ITEM_TYPE(MASK)
DECLARE_DISPLAY_ITEM_TYPE(FILTER)
DECLARE_DISPLAY_ITEM_TYPE(SVG_OUTER_SVG)
DECLARE_DISPLAY_ITEM_TYPE(SVG_PATH_GEOMETRY)
DECLARE_DISPLAY_ITEM_TYPE(SVG_GEOMETRY)
DECLARE_DISPLAY_ITEM_TYPE(SVG_TEXT)
DECLARE_DISPLAY_ITEM_TYPE(TABLE_CELL_BACKGROUND)
DECLARE_DISPLAY_ITEM_TYPE(TABLE_CELL_SELECTION)

View File

@ -918,7 +918,7 @@ nsStyleSVG::CalcDifference(const nsStyleSVG& aNewData) const
if (!DefinitelyEqualURIs(mMarkerEnd, aNewData.mMarkerEnd) ||
!DefinitelyEqualURIs(mMarkerMid, aNewData.mMarkerMid) ||
!DefinitelyEqualURIs(mMarkerStart, aNewData.mMarkerStart)) {
// Markers currently contribute to nsSVGPathGeometryFrame::mRect,
// Markers currently contribute to SVGGeometryFrame::mRect,
// so we need a reflow as well as a repaint. No intrinsic sizes need
// to change, so nsChangeHint_NeedReflow is sufficient.
return nsChangeHint_UpdateEffects |
@ -939,7 +939,7 @@ nsStyleSVG::CalcDifference(const nsStyleSVG& aNewData) const
// stroke (in which case whether we have fill or not is significant to frame
// bounds) and whether we have fill or not just changed. In either case we
// need to reflow so the frame rect is updated.
// XXXperf this is a waste on non nsSVGPathGeometryFrames.
// XXXperf this is a waste on non SVGGeometryFrames.
hint |= nsChangeHint_NeedReflow |
nsChangeHint_NeedDirtyReflow; // XXX remove me: bug 876085
}
@ -949,10 +949,10 @@ nsStyleSVG::CalcDifference(const nsStyleSVG& aNewData) const
}
}
// Stroke currently contributes to nsSVGPathGeometryFrame::mRect, so
// Stroke currently contributes to SVGGeometryFrame::mRect, so
// we need a reflow here. No intrinsic sizes need to change, so
// nsChangeHint_NeedReflow is sufficient.
// Note that stroke-dashoffset does not affect nsSVGPathGeometryFrame::mRect.
// Note that stroke-dashoffset does not affect SVGGeometryFrame::mRect.
// text-anchor changes also require a reflow since it changes frames' rects.
if (mStrokeWidth != aNewData.mStrokeWidth ||
mStrokeMiterlimit != aNewData.mStrokeMiterlimit ||
@ -1186,9 +1186,9 @@ nsStyleSVGReset::CalcDifference(const nsStyleSVGReset& aNewData) const
// XXXjwatt: why NS_STYLE_HINT_REFLOW? Isn't that excessive?
hint |= NS_STYLE_HINT_REFLOW;
} else if (mVectorEffect != aNewData.mVectorEffect) {
// Stroke currently affects nsSVGPathGeometryFrame::mRect, and
// Stroke currently affects SVGGeometryFrame::mRect, and
// vector-effect affect stroke. As a result we need to reflow if
// vector-effect changes in order to have nsSVGPathGeometryFrame::
// vector-effect changes in order to have SVGGeometryFrame::
// ReflowSVG called to update its mRect. No intrinsic sizes need
// to change so nsChangeHint_NeedReflow is sufficient.
hint |= nsChangeHint_NeedReflow |
@ -4021,8 +4021,8 @@ nsStyleUserInterface::CalcDifference(const nsStyleUserInterface& aNewData) const
}
if (mPointerEvents != aNewData.mPointerEvents) {
// nsSVGPathGeometryFrame's mRect depends on stroke _and_ on the value
// of pointer-events. See nsSVGPathGeometryFrame::ReflowSVG's use of
// SVGGeometryFrame's mRect depends on stroke _and_ on the value
// of pointer-events. See SVGGeometryFrame::ReflowSVG's use of
// GetHitTestFlags. (Only a reflow, no visual change.)
hint |= nsChangeHint_NeedReflow |
nsChangeHint_NeedDirtyReflow; // XXX remove me: bug 876085

View File

@ -4,7 +4,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// Main header first:
#include "nsSVGPathGeometryFrame.h"
#include "SVGGeometryFrame.h"
// Keep others in (case-insensitive) order:
#include "gfx2DGlue.h"
@ -22,7 +22,7 @@
#include "nsSVGEffects.h"
#include "nsSVGIntegrationUtils.h"
#include "nsSVGMarkerFrame.h"
#include "nsSVGPathGeometryElement.h"
#include "SVGGeometryElement.h"
#include "nsSVGUtils.h"
#include "mozilla/ArrayUtils.h"
#include "SVGAnimatedTransformList.h"
@ -37,41 +37,41 @@ using namespace mozilla::image;
// Implementation
nsIFrame*
NS_NewSVGPathGeometryFrame(nsIPresShell* aPresShell,
nsStyleContext* aContext)
NS_NewSVGGeometryFrame(nsIPresShell* aPresShell,
nsStyleContext* aContext)
{
return new (aPresShell) nsSVGPathGeometryFrame(aContext);
return new (aPresShell) SVGGeometryFrame(aContext);
}
NS_IMPL_FRAMEARENA_HELPERS(nsSVGPathGeometryFrame)
NS_IMPL_FRAMEARENA_HELPERS(SVGGeometryFrame)
//----------------------------------------------------------------------
// nsQueryFrame methods
NS_QUERYFRAME_HEAD(nsSVGPathGeometryFrame)
NS_QUERYFRAME_HEAD(SVGGeometryFrame)
NS_QUERYFRAME_ENTRY(nsISVGChildFrame)
NS_QUERYFRAME_ENTRY(nsSVGPathGeometryFrame)
NS_QUERYFRAME_ENTRY(SVGGeometryFrame)
NS_QUERYFRAME_TAIL_INHERITING(nsFrame)
//----------------------------------------------------------------------
// Display list item:
class nsDisplaySVGPathGeometry : public nsDisplayItem {
class nsDisplaySVGGeometry : public nsDisplayItem {
public:
nsDisplaySVGPathGeometry(nsDisplayListBuilder* aBuilder,
nsSVGPathGeometryFrame* aFrame)
nsDisplaySVGGeometry(nsDisplayListBuilder* aBuilder,
SVGGeometryFrame* aFrame)
: nsDisplayItem(aBuilder, aFrame)
{
MOZ_COUNT_CTOR(nsDisplaySVGPathGeometry);
MOZ_COUNT_CTOR(nsDisplaySVGGeometry);
MOZ_ASSERT(aFrame, "Must have a frame!");
}
#ifdef NS_BUILD_REFCNT_LOGGING
virtual ~nsDisplaySVGPathGeometry() {
MOZ_COUNT_DTOR(nsDisplaySVGPathGeometry);
virtual ~nsDisplaySVGGeometry() {
MOZ_COUNT_DTOR(nsDisplaySVGGeometry);
}
#endif
NS_DISPLAY_DECL_NAME("nsDisplaySVGPathGeometry", TYPE_SVG_PATH_GEOMETRY)
NS_DISPLAY_DECL_NAME("nsDisplaySVGGeometry", TYPE_SVG_GEOMETRY)
virtual void HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
HitTestState* aState, nsTArray<nsIFrame*> *aOutFrames) override;
@ -89,10 +89,10 @@ public:
};
void
nsDisplaySVGPathGeometry::HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
HitTestState* aState, nsTArray<nsIFrame*> *aOutFrames)
nsDisplaySVGGeometry::HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
HitTestState* aState, nsTArray<nsIFrame*> *aOutFrames)
{
nsSVGPathGeometryFrame *frame = static_cast<nsSVGPathGeometryFrame*>(mFrame);
SVGGeometryFrame *frame = static_cast<SVGGeometryFrame*>(mFrame);
nsPoint pointRelativeToReferenceFrame = aRect.Center();
// ToReferenceFrame() includes frame->GetPosition(), our user space position.
nsPoint userSpacePtInAppUnits = pointRelativeToReferenceFrame -
@ -106,8 +106,8 @@ nsDisplaySVGPathGeometry::HitTest(nsDisplayListBuilder* aBuilder, const nsRect&
}
void
nsDisplaySVGPathGeometry::Paint(nsDisplayListBuilder* aBuilder,
nsRenderingContext* aCtx)
nsDisplaySVGGeometry::Paint(nsDisplayListBuilder* aBuilder,
nsRenderingContext* aCtx)
{
uint32_t appUnitsPerDevPixel = mFrame->PresContext()->AppUnitsPerDevPixel();
@ -122,13 +122,13 @@ nsDisplaySVGPathGeometry::Paint(nsDisplayListBuilder* aBuilder,
gfxMatrix tm = nsSVGIntegrationUtils::GetCSSPxToDevPxMatrix(mFrame) *
gfxMatrix::Translation(devPixelOffset);
DrawResult result =
static_cast<nsSVGPathGeometryFrame*>(mFrame)->PaintSVG(*aCtx->ThebesContext(), tm);
static_cast<SVGGeometryFrame*>(mFrame)->PaintSVG(*aCtx->ThebesContext(), tm);
nsDisplayItemGenericImageGeometry::UpdateDrawResult(this, result);
}
void
nsDisplaySVGPathGeometry::ComputeInvalidationRegion(
nsDisplaySVGGeometry::ComputeInvalidationRegion(
nsDisplayListBuilder* aBuilder,
const nsDisplayItemGeometry* aGeometry,
nsRegion* aInvalidRegion)
@ -145,22 +145,24 @@ nsDisplaySVGPathGeometry::ComputeInvalidationRegion(
nsDisplayItem::ComputeInvalidationRegion(aBuilder, aGeometry, aInvalidRegion);
}
namespace mozilla {
//----------------------------------------------------------------------
// nsIFrame methods
void
nsSVGPathGeometryFrame::Init(nsIContent* aContent,
nsContainerFrame* aParent,
nsIFrame* aPrevInFlow)
SVGGeometryFrame::Init(nsIContent* aContent,
nsContainerFrame* aParent,
nsIFrame* aPrevInFlow)
{
AddStateBits(aParent->GetStateBits() & NS_STATE_SVG_CLIPPATH_CHILD);
nsFrame::Init(aContent, aParent, aPrevInFlow);
}
nsresult
nsSVGPathGeometryFrame::AttributeChanged(int32_t aNameSpaceID,
nsIAtom* aAttribute,
int32_t aModType)
SVGGeometryFrame::AttributeChanged(int32_t aNameSpaceID,
nsIAtom* aAttribute,
int32_t aModType)
{
// We don't invalidate for transform changes (the layers code does that).
// Also note that SVGTransformableElement::GetAttributeChangeHint will
@ -168,7 +170,7 @@ nsSVGPathGeometryFrame::AttributeChanged(int32_t aNameSpaceID,
// and cause DoApplyRenderingChangeToTree to make the SchedulePaint call.
if (aNameSpaceID == kNameSpaceID_None &&
(static_cast<nsSVGPathGeometryElement*>
(static_cast<SVGGeometryElement*>
(mContent)->AttributeDefinesGeometry(aAttribute))) {
nsLayoutUtils::PostRestyleEvent(
mContent->AsElement(), nsRestyleHint(0),
@ -179,7 +181,7 @@ nsSVGPathGeometryFrame::AttributeChanged(int32_t aNameSpaceID,
}
/* virtual */ void
nsSVGPathGeometryFrame::DidSetStyleContext(nsStyleContext* aOldStyleContext)
SVGGeometryFrame::DidSetStyleContext(nsStyleContext* aOldStyleContext)
{
nsFrame::DidSetStyleContext(aOldStyleContext);
@ -193,8 +195,8 @@ nsSVGPathGeometryFrame::DidSetStyleContext(nsStyleContext* aOldStyleContext)
InvalidateFrame();
}
nsSVGPathGeometryElement* element =
static_cast<nsSVGPathGeometryElement*>(mContent);
SVGGeometryElement* element =
static_cast<SVGGeometryElement*>(mContent);
auto oldStyleSVG = aOldStyleContext->PeekStyleSVG();
if (oldStyleSVG && !SVGContentUtils::ShapeTypeHasNoCorners(mContent)) {
@ -222,14 +224,14 @@ nsSVGPathGeometryFrame::DidSetStyleContext(nsStyleContext* aOldStyleContext)
}
nsIAtom *
nsSVGPathGeometryFrame::GetType() const
SVGGeometryFrame::GetType() const
{
return nsGkAtoms::svgPathGeometryFrame;
return nsGkAtoms::svgGeometryFrame;
}
bool
nsSVGPathGeometryFrame::IsSVGTransformed(gfx::Matrix *aOwnTransform,
gfx::Matrix *aFromParentTransform) const
SVGGeometryFrame::IsSVGTransformed(gfx::Matrix *aOwnTransform,
gfx::Matrix *aFromParentTransform) const
{
bool foundTransform = false;
@ -258,9 +260,9 @@ nsSVGPathGeometryFrame::IsSVGTransformed(gfx::Matrix *aOwnTransform,
}
void
nsSVGPathGeometryFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists)
SVGGeometryFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists)
{
if (!static_cast<const nsSVGElement*>(mContent)->HasValidDimensions() ||
(!IsVisibleForPainting(aBuilder) && aBuilder->IsForPainting())) {
@ -268,16 +270,16 @@ nsSVGPathGeometryFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
}
DisplayOutline(aBuilder, aLists);
aLists.Content()->AppendNewToTop(
new (aBuilder) nsDisplaySVGPathGeometry(aBuilder, this));
new (aBuilder) nsDisplaySVGGeometry(aBuilder, this));
}
//----------------------------------------------------------------------
// nsISVGChildFrame methods
DrawResult
nsSVGPathGeometryFrame::PaintSVG(gfxContext& aContext,
const gfxMatrix& aTransform,
const nsIntRect* aDirtyRect)
SVGGeometryFrame::PaintSVG(gfxContext& aContext,
const gfxMatrix& aTransform,
const nsIntRect* aDirtyRect)
{
if (!StyleVisibility()->IsVisible())
return DrawResult::SUCCESS;
@ -316,7 +318,7 @@ nsSVGPathGeometryFrame::PaintSVG(gfxContext& aContext,
}
nsIFrame*
nsSVGPathGeometryFrame::GetFrameForPoint(const gfxPoint& aPoint)
SVGGeometryFrame::GetFrameForPoint(const gfxPoint& aPoint)
{
FillRule fillRule;
uint16_t hitTestFlags;
@ -340,8 +342,8 @@ nsSVGPathGeometryFrame::GetFrameForPoint(const gfxPoint& aPoint)
bool isHit = false;
nsSVGPathGeometryElement* content =
static_cast<nsSVGPathGeometryElement*>(mContent);
SVGGeometryElement* content =
static_cast<SVGGeometryElement*>(mContent);
// Using ScreenReferenceDrawTarget() opens us to Moz2D backend specific hit-
// testing bugs. Maybe we should use a BackendType::CAIRO DT for hit-testing
@ -381,7 +383,7 @@ nsSVGPathGeometryFrame::GetFrameForPoint(const gfxPoint& aPoint)
}
nsRect
nsSVGPathGeometryFrame::GetCoveredRegion()
SVGGeometryFrame::GetCoveredRegion()
{
gfxMatrix canvasTM = GetCanvasTM();
if (canvasTM.PreservesAxisAlignedRectangles()) {
@ -403,7 +405,7 @@ nsSVGPathGeometryFrame::GetCoveredRegion()
}
void
nsSVGPathGeometryFrame::ReflowSVG()
SVGGeometryFrame::ReflowSVG()
{
NS_ASSERTION(nsSVGUtils::OuterSVGIsCallingReflowSVG(this),
"This call is probably a wasteful mistake");
@ -457,7 +459,7 @@ nsSVGPathGeometryFrame::ReflowSVG()
}
void
nsSVGPathGeometryFrame::NotifySVGChanged(uint32_t aFlags)
SVGGeometryFrame::NotifySVGChanged(uint32_t aFlags)
{
MOZ_ASSERT(aFlags & (TRANSFORM_CHANGED | COORD_CONTEXT_CHANGED),
"Invalidation logic may need adjusting");
@ -481,9 +483,9 @@ nsSVGPathGeometryFrame::NotifySVGChanged(uint32_t aFlags)
// of stroke-dashoffset since, although that can have a percentage value
// that is resolved against our coordinate context, it does not affect our
// mRect.
if (static_cast<nsSVGPathGeometryElement*>(mContent)->GeometryDependsOnCoordCtx() ||
if (static_cast<SVGGeometryElement*>(mContent)->GeometryDependsOnCoordCtx() ||
StyleSVG()->mStrokeWidth.HasPercent()) {
static_cast<nsSVGPathGeometryElement*>(mContent)->ClearAnyCachedPath();
static_cast<SVGGeometryElement*>(mContent)->ClearAnyCachedPath();
nsSVGUtils::ScheduleReflowSVG(this);
}
}
@ -496,8 +498,8 @@ nsSVGPathGeometryFrame::NotifySVGChanged(uint32_t aFlags)
}
SVGBBox
nsSVGPathGeometryFrame::GetBBoxContribution(const Matrix &aToBBoxUserspace,
uint32_t aFlags)
SVGGeometryFrame::GetBBoxContribution(const Matrix &aToBBoxUserspace,
uint32_t aFlags)
{
SVGBBox bbox;
@ -506,8 +508,8 @@ nsSVGPathGeometryFrame::GetBBoxContribution(const Matrix &aToBBoxUserspace,
return bbox;
}
nsSVGPathGeometryElement* element =
static_cast<nsSVGPathGeometryElement*>(mContent);
SVGGeometryElement* element =
static_cast<SVGGeometryElement*>(mContent);
bool getFill = (aFlags & nsSVGUtils::eBBoxIncludeFillGeometry) ||
((aFlags & nsSVGUtils::eBBoxIncludeFill) &&
@ -623,7 +625,7 @@ nsSVGPathGeometryFrame::GetBBoxContribution(const Matrix &aToBBoxUserspace,
//
// Second, the way we account for non-scaling-stroke by transforming the
// path using the transform to the outer-<svg> element is not compatible
// with the way that nsSVGPathGeometryFrame::Reflow() inserts a scale
// with the way that SVGGeometryFrame::Reflow() inserts a scale
// into aToBBoxUserspace and then scales the bounds that we return.
SVGContentUtils::AutoStrokeOptions strokeOptions;
SVGContentUtils::GetStrokeOptions(&strokeOptions, element,
@ -660,14 +662,14 @@ nsSVGPathGeometryFrame::GetBBoxContribution(const Matrix &aToBBoxUserspace,
// Account for markers:
if ((aFlags & nsSVGUtils::eBBoxIncludeMarkers) != 0 &&
static_cast<nsSVGPathGeometryElement*>(mContent)->IsMarkable()) {
static_cast<SVGGeometryElement*>(mContent)->IsMarkable()) {
float strokeWidth = nsSVGUtils::GetStrokeWidth(this);
MarkerProperties properties = GetMarkerProperties(this);
if (properties.MarkersExist()) {
nsTArray<nsSVGMark> marks;
static_cast<nsSVGPathGeometryElement*>(mContent)->GetMarkPoints(&marks);
static_cast<SVGGeometryElement*>(mContent)->GetMarkPoints(&marks);
uint32_t num = marks.Length();
// These are in the same order as the nsSVGMark::Type constants.
@ -697,10 +699,10 @@ nsSVGPathGeometryFrame::GetBBoxContribution(const Matrix &aToBBoxUserspace,
}
//----------------------------------------------------------------------
// nsSVGPathGeometryFrame methods:
// SVGGeometryFrame methods:
gfxMatrix
nsSVGPathGeometryFrame::GetCanvasTM()
SVGGeometryFrame::GetCanvasTM()
{
NS_ASSERTION(GetParent(), "null parent");
@ -710,8 +712,8 @@ nsSVGPathGeometryFrame::GetCanvasTM()
return content->PrependLocalTransformsTo(parent->GetCanvasTM());
}
nsSVGPathGeometryFrame::MarkerProperties
nsSVGPathGeometryFrame::GetMarkerProperties(nsSVGPathGeometryFrame *aFrame)
SVGGeometryFrame::MarkerProperties
SVGGeometryFrame::GetMarkerProperties(SVGGeometryFrame *aFrame)
{
NS_ASSERTION(!aFrame->GetPrevContinuation(), "aFrame should be first continuation");
@ -735,7 +737,7 @@ nsSVGPathGeometryFrame::GetMarkerProperties(nsSVGPathGeometryFrame *aFrame)
}
nsSVGMarkerFrame *
nsSVGPathGeometryFrame::MarkerProperties::GetMarkerStartFrame()
SVGGeometryFrame::MarkerProperties::GetMarkerStartFrame()
{
if (!mMarkerStart)
return nullptr;
@ -744,7 +746,7 @@ nsSVGPathGeometryFrame::MarkerProperties::GetMarkerStartFrame()
}
nsSVGMarkerFrame *
nsSVGPathGeometryFrame::MarkerProperties::GetMarkerMidFrame()
SVGGeometryFrame::MarkerProperties::GetMarkerMidFrame()
{
if (!mMarkerMid)
return nullptr;
@ -753,7 +755,7 @@ nsSVGPathGeometryFrame::MarkerProperties::GetMarkerMidFrame()
}
nsSVGMarkerFrame *
nsSVGPathGeometryFrame::MarkerProperties::GetMarkerEndFrame()
SVGGeometryFrame::MarkerProperties::GetMarkerEndFrame()
{
if (!mMarkerEnd)
return nullptr;
@ -762,9 +764,9 @@ nsSVGPathGeometryFrame::MarkerProperties::GetMarkerEndFrame()
}
void
nsSVGPathGeometryFrame::Render(gfxContext* aContext,
uint32_t aRenderComponents,
const gfxMatrix& aNewTransform)
SVGGeometryFrame::Render(gfxContext* aContext,
uint32_t aRenderComponents,
const gfxMatrix& aNewTransform)
{
MOZ_ASSERT(!aNewTransform.IsSingular());
@ -774,8 +776,8 @@ nsSVGPathGeometryFrame::Render(gfxContext* aContext,
nsSVGUtils::ToFillRule((GetStateBits() & NS_STATE_SVG_CLIPPATH_CHILD) ?
StyleSVG()->mClipRule : StyleSVG()->mFillRule);
nsSVGPathGeometryElement* element =
static_cast<nsSVGPathGeometryElement*>(mContent);
SVGGeometryElement* element =
static_cast<SVGGeometryElement*>(mContent);
AntialiasMode aaMode =
(StyleSVG()->mShapeRendering == NS_STYLE_SHAPE_RENDERING_OPTIMIZESPEED ||
@ -800,7 +802,7 @@ nsSVGPathGeometryFrame::Render(gfxContext* aContext,
return;
}
nsSVGPathGeometryElement::SimplePath simplePath;
SVGGeometryElement::SimplePath simplePath;
RefPtr<Path> path;
element->GetAsSimplePath(&simplePath);
@ -876,19 +878,19 @@ nsSVGPathGeometryFrame::Render(gfxContext* aContext,
}
void
nsSVGPathGeometryFrame::PaintMarkers(gfxContext& aContext,
const gfxMatrix& aTransform)
SVGGeometryFrame::PaintMarkers(gfxContext& aContext,
const gfxMatrix& aTransform)
{
SVGContextPaint* contextPaint = SVGContextPaint::GetContextPaint(mContent);
if (static_cast<nsSVGPathGeometryElement*>(mContent)->IsMarkable()) {
if (static_cast<SVGGeometryElement*>(mContent)->IsMarkable()) {
MarkerProperties properties = GetMarkerProperties(this);
if (properties.MarkersExist()) {
float strokeWidth = nsSVGUtils::GetStrokeWidth(this, contextPaint);
nsTArray<nsSVGMark> marks;
static_cast<nsSVGPathGeometryElement*>
static_cast<SVGGeometryElement*>
(mContent)->GetMarkPoints(&marks);
uint32_t num = marks.Length();
@ -915,7 +917,8 @@ nsSVGPathGeometryFrame::PaintMarkers(gfxContext& aContext,
}
uint16_t
nsSVGPathGeometryFrame::GetHitTestFlags()
SVGGeometryFrame::GetHitTestFlags()
{
return nsSVGUtils::GetGeometryHitTestFlags(this);
}
} // namespace mozilla

View File

@ -3,8 +3,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef __NS_SVGPATHGEOMETRYFRAME_H__
#define __NS_SVGPATHGEOMETRYFRAME_H__
#ifndef __SVGGEOMETRYFRAME_H__
#define __SVGGEOMETRYFRAME_H__
#include "mozilla/Attributes.h"
#include "gfxMatrix.h"
@ -16,13 +16,14 @@
#include "nsSVGUtils.h"
namespace mozilla {
class SVGGeometryFrame;
namespace gfx {
class DrawTarget;
} // namespace gfx
} // namespace mozilla
class gfxContext;
class nsDisplaySVGPathGeometry;
class nsDisplaySVGGeometry;
class nsIAtom;
class nsIFrame;
class nsIPresShell;
@ -32,25 +33,30 @@ class nsSVGMarkerProperty;
struct nsRect;
class nsSVGPathGeometryFrame : public nsFrame
, public nsISVGChildFrame
nsIFrame*
NS_NewSVGGeometryFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
namespace mozilla {
class SVGGeometryFrame : public nsFrame
, public nsISVGChildFrame
{
typedef mozilla::gfx::DrawTarget DrawTarget;
friend nsIFrame*
NS_NewSVGPathGeometryFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
::NS_NewSVGGeometryFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
friend class nsDisplaySVGPathGeometry;
friend class ::nsDisplaySVGGeometry;
protected:
explicit nsSVGPathGeometryFrame(nsStyleContext* aContext)
explicit SVGGeometryFrame(nsStyleContext* aContext)
: nsFrame(aContext)
{
AddStateBits(NS_FRAME_SVG_LAYOUT | NS_FRAME_MAY_BE_TRANSFORMED);
}
public:
NS_DECL_QUERYFRAME_TARGET(nsSVGPathGeometryFrame)
NS_DECL_QUERYFRAME_TARGET(SVGGeometryFrame)
NS_DECL_QUERYFRAME
NS_DECL_FRAMEARENA_HELPERS
@ -73,7 +79,7 @@ public:
/**
* Get the "type" of the frame
*
* @see nsGkAtoms::svgPathGeometryFrame
* @see nsGkAtoms::svgGeometryFrame
*/
virtual nsIAtom* GetType() const override;
@ -83,7 +89,7 @@ public:
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const override
{
return MakeFrameName(NS_LITERAL_STRING("SVGPathGeometry"), aResult);
return MakeFrameName(NS_LITERAL_STRING("SVGGeometry"), aResult);
}
#endif
@ -91,7 +97,7 @@ public:
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists) override;
// nsSVGPathGeometryFrame methods
// SVGGeometryFrame methods
gfxMatrix GetCanvasTM();
protected:
// nsISVGChildFrame interface:
@ -141,7 +147,8 @@ private:
/**
* @param aFrame should be the first continuation
*/
static MarkerProperties GetMarkerProperties(nsSVGPathGeometryFrame *aFrame);
static MarkerProperties GetMarkerProperties(SVGGeometryFrame *aFrame);
};
} // namespace mozilla
#endif // __NS_SVGPATHGEOMETRYFRAME_H__
#endif // __SVGGEOMETRYFRAME_H__

View File

@ -41,7 +41,6 @@ UNIFIED_SOURCES += [
'nsSVGMarkerFrame.cpp',
'nsSVGMaskFrame.cpp',
'nsSVGOuterSVGFrame.cpp',
'nsSVGPathGeometryFrame.cpp',
'nsSVGPatternFrame.cpp',
'nsSVGStopFrame.cpp',
'nsSVGSwitchFrame.cpp',
@ -52,6 +51,7 @@ UNIFIED_SOURCES += [
'SVGFEImageFrame.cpp',
'SVGFELeafFrame.cpp',
'SVGFEUnstyledLeafFrame.cpp',
'SVGGeometryFrame.cpp',
'SVGTextFrame.cpp',
'SVGViewFrame.cpp',
]

View File

@ -12,8 +12,8 @@
#include "mozilla/dom/SVGClipPathElement.h"
#include "nsGkAtoms.h"
#include "nsSVGEffects.h"
#include "nsSVGPathGeometryElement.h"
#include "nsSVGPathGeometryFrame.h"
#include "SVGGeometryElement.h"
#include "SVGGeometryFrame.h"
#include "nsSVGUtils.h"
using namespace mozilla;
@ -56,10 +56,10 @@ nsSVGClipPathFrame::ApplyClipPath(gfxContext& aContext,
IsTrivial(&singleClipPathChild);
if (singleClipPathChild) {
nsSVGPathGeometryFrame* pathFrame = do_QueryFrame(singleClipPathChild);
SVGGeometryFrame* pathFrame = do_QueryFrame(singleClipPathChild);
if (pathFrame) {
nsSVGPathGeometryElement* pathElement =
static_cast<nsSVGPathGeometryElement*>(pathFrame->GetContent());
SVGGeometryElement* pathElement =
static_cast<SVGGeometryElement*>(pathFrame->GetContent());
gfxMatrix toChildsUserSpace = pathElement->
PrependLocalTransformsTo(GetClipPathTransform(aClippedFrame) * aMatrix,
eUserSpaceToParent);
@ -251,7 +251,7 @@ nsSVGClipPathFrame::PaintFrameIntoMask(nsIFrame *aFrame,
}
// Our children have NS_STATE_SVG_CLIPPATH_CHILD set on them, and
// nsSVGPathGeometryFrame::Render checks for that state bit and paints
// SVGGeometryFrame::Render checks for that state bit and paints
// only the geometry (opaque black) if set.
result &= frame->PaintSVG(aTarget, toChildsUserSpace);
@ -426,7 +426,7 @@ nsSVGClipPathFrame::IsValid()
nsIAtom* grandKidType = grandKid->GetType();
if (grandKidType != nsGkAtoms::svgPathGeometryFrame &&
if (grandKidType != nsGkAtoms::svgGeometryFrame &&
grandKidType != nsGkAtoms::svgTextFrame) {
return false;
}
@ -434,7 +434,7 @@ nsSVGClipPathFrame::IsValid()
continue;
}
if (kidType != nsGkAtoms::svgPathGeometryFrame &&
if (kidType != nsGkAtoms::svgGeometryFrame &&
kidType != nsGkAtoms::svgTextFrame) {
return false;
}

View File

@ -13,11 +13,11 @@
#include "nsISupportsImpl.h"
#include "nsSVGClipPathFrame.h"
#include "nsSVGPaintServerFrame.h"
#include "nsSVGPathGeometryElement.h"
#include "nsSVGFilterFrame.h"
#include "nsSVGMaskFrame.h"
#include "nsIReflowCallback.h"
#include "nsCycleCollectionParticipant.h"
#include "SVGGeometryElement.h"
#include "SVGUseElement.h"
using namespace mozilla;
@ -526,8 +526,8 @@ nsSVGMarkerProperty*
nsSVGEffects::GetMarkerProperty(nsIURI* aURI, nsIFrame* aFrame,
const mozilla::FramePropertyDescriptor<nsSVGMarkerProperty>* aProperty)
{
MOZ_ASSERT(aFrame->GetType() == nsGkAtoms::svgPathGeometryFrame &&
static_cast<nsSVGPathGeometryElement*>(aFrame->GetContent())->IsMarkable(),
MOZ_ASSERT(aFrame->GetType() == nsGkAtoms::svgGeometryFrame &&
static_cast<SVGGeometryElement*>(aFrame->GetContent())->IsMarkable(),
"Bad frame");
return GetEffectProperty(aURI, aFrame, aProperty);
}
@ -743,8 +743,8 @@ nsSVGEffects::UpdateEffects(nsIFrame* aFrame)
// We can't do that in DoUpdate as the referenced frame may not be valid
GetOrCreateFilterProperty(aFrame);
if (aFrame->GetType() == nsGkAtoms::svgPathGeometryFrame &&
static_cast<nsSVGPathGeometryElement*>(aFrame->GetContent())->IsMarkable()) {
if (aFrame->GetType() == nsGkAtoms::svgGeometryFrame &&
static_cast<SVGGeometryElement*>(aFrame->GetContent())->IsMarkable()) {
// Set marker properties here to avoid reference loops
nsCOMPtr<nsIURI> markerURL =
GetMarkerURI(aFrame, &nsStyleSVG::mMarkerStart);

View File

@ -13,10 +13,10 @@
#include "nsLayoutUtils.h"
#include "imgINotificationObserver.h"
#include "nsSVGEffects.h"
#include "nsSVGPathGeometryFrame.h"
#include "mozilla/dom/SVGSVGElement.h"
#include "nsSVGUtils.h"
#include "SVGContentUtils.h"
#include "SVGGeometryFrame.h"
#include "SVGImageContext.h"
#include "mozilla/dom/SVGImageElement.h"
#include "nsContentUtils.h"
@ -46,7 +46,7 @@ private:
nsSVGImageFrame *mFrame;
};
class nsSVGImageFrame : public nsSVGPathGeometryFrame
class nsSVGImageFrame : public SVGGeometryFrame
, public nsIReflowCallback
{
friend nsIFrame*
@ -54,7 +54,7 @@ class nsSVGImageFrame : public nsSVGPathGeometryFrame
protected:
explicit nsSVGImageFrame(nsStyleContext* aContext)
: nsSVGPathGeometryFrame(aContext)
: SVGGeometryFrame(aContext)
, mReflowCallbackPosted(false)
{
EnableVisibilityTracking();
@ -72,7 +72,7 @@ public:
virtual nsIFrame* GetFrameForPoint(const gfxPoint& aPoint) override;
virtual void ReflowSVG() override;
// nsSVGPathGeometryFrame methods:
// SVGGeometryFrame methods:
virtual uint16_t GetHitTestFlags() override;
// nsIFrame interface:
@ -154,7 +154,7 @@ nsSVGImageFrame::Init(nsIContent* aContent,
NS_ASSERTION(aContent->IsSVGElement(nsGkAtoms::image),
"Content is not an SVG image!");
nsSVGPathGeometryFrame::Init(aContent, aParent, aPrevInFlow);
SVGGeometryFrame::Init(aContent, aParent, aPrevInFlow);
if (GetStateBits() & NS_FRAME_IS_NONDISPLAY) {
// Non-display frames are likely to be patterns, masks or the like.
@ -240,8 +240,8 @@ nsSVGImageFrame::AttributeChanged(int32_t aNameSpaceID,
}
}
return nsSVGPathGeometryFrame::AttributeChanged(aNameSpaceID,
aAttribute, aModType);
return SVGGeometryFrame::AttributeChanged(aNameSpaceID,
aAttribute, aModType);
}
void
@ -250,13 +250,13 @@ nsSVGImageFrame::OnVisibilityChange(Visibility aNewVisibility,
{
nsCOMPtr<nsIImageLoadingContent> imageLoader = do_QueryInterface(mContent);
if (!imageLoader) {
nsSVGPathGeometryFrame::OnVisibilityChange(aNewVisibility, aNonvisibleAction);
SVGGeometryFrame::OnVisibilityChange(aNewVisibility, aNonvisibleAction);
return;
}
imageLoader->OnVisibilityChange(aNewVisibility, aNonvisibleAction);
nsSVGPathGeometryFrame::OnVisibilityChange(aNewVisibility, aNonvisibleAction);
SVGGeometryFrame::OnVisibilityChange(aNewVisibility, aNonvisibleAction);
}
gfx::Matrix
@ -499,7 +499,7 @@ nsSVGImageFrame::GetType() const
}
//----------------------------------------------------------------------
// nsSVGPathGeometryFrame methods:
// SVGGeometryFrame methods:
// Lie about our fill/stroke so that covered region and hit detection work properly

View File

@ -10,8 +10,8 @@
#include "gfxContext.h"
#include "nsSVGEffects.h"
#include "mozilla/dom/SVGMarkerElement.h"
#include "nsSVGPathGeometryElement.h"
#include "nsSVGPathGeometryFrame.h"
#include "SVGGeometryElement.h"
#include "SVGGeometryFrame.h"
using namespace mozilla::dom;
using namespace mozilla::gfx;
@ -72,7 +72,7 @@ nsSVGMarkerFrame::GetType() const
gfxMatrix
nsSVGMarkerFrame::GetCanvasTM()
{
NS_ASSERTION(mMarkedFrame, "null nsSVGPathGeometry frame");
NS_ASSERTION(mMarkedFrame, "null SVGGeometry frame");
if (mInUse2) {
// We're going to be bailing drawing the marker, so return an identity.
@ -104,7 +104,7 @@ GetAnonymousChildFrame(nsIFrame* aFrame)
nsresult
nsSVGMarkerFrame::PaintMark(gfxContext& aContext,
const gfxMatrix& aToMarkedFrameUserSpace,
nsSVGPathGeometryFrame *aMarkedFrame,
SVGGeometryFrame *aMarkedFrame,
nsSVGMark *aMark, float aStrokeWidth)
{
// If the flag is set when we get here, it means this marker frame
@ -165,7 +165,7 @@ nsSVGMarkerFrame::PaintMark(gfxContext& aContext,
SVGBBox
nsSVGMarkerFrame::GetMarkBBoxContribution(const Matrix &aToBBoxUserspace,
uint32_t aFlags,
nsSVGPathGeometryFrame *aMarkedFrame,
SVGGeometryFrame *aMarkedFrame,
const nsSVGMark *aMark,
float aStrokeWidth)
{
@ -226,7 +226,7 @@ nsSVGMarkerFrame::SetParentCoordCtxProvider(SVGSVGElement *aContext)
nsSVGMarkerFrame::AutoMarkerReferencer::AutoMarkerReferencer(
nsSVGMarkerFrame *aFrame,
nsSVGPathGeometryFrame *aMarkedFrame
SVGGeometryFrame *aMarkedFrame
MOZ_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL)
: mFrame(aFrame)
{

View File

@ -16,9 +16,9 @@
#include "nsSVGUtils.h"
class gfxContext;
class nsSVGPathGeometryFrame;
namespace mozilla {
class SVGGeometryFrame;
namespace dom {
class SVGSVGElement;
} // namespace dom
@ -84,19 +84,19 @@ public:
// nsSVGMarkerFrame methods:
nsresult PaintMark(gfxContext& aContext,
const gfxMatrix& aToMarkedFrameUserSpace,
nsSVGPathGeometryFrame *aMarkedFrame,
SVGGeometryFrame *aMarkedFrame,
nsSVGMark *aMark,
float aStrokeWidth);
SVGBBox GetMarkBBoxContribution(const Matrix &aToBBoxUserspace,
uint32_t aFlags,
nsSVGPathGeometryFrame *aMarkedFrame,
SVGGeometryFrame *aMarkedFrame,
const nsSVGMark *aMark,
float aStrokeWidth);
private:
// stuff needed for callback
nsSVGPathGeometryFrame *mMarkedFrame;
SVGGeometryFrame *mMarkedFrame;
float mStrokeWidth, mX, mY, mAutoAngle;
bool mIsStart; // whether the callback is for a marker-start marker
@ -112,7 +112,7 @@ private:
{
public:
AutoMarkerReferencer(nsSVGMarkerFrame *aFrame,
nsSVGPathGeometryFrame *aMarkedFrame
SVGGeometryFrame *aMarkedFrame
MOZ_GUARD_OBJECT_NOTIFIER_PARAM);
~AutoMarkerReferencer();
private:

View File

@ -18,7 +18,7 @@
#include "nsISVGChildFrame.h"
#include "nsStyleContext.h"
#include "nsSVGEffects.h"
#include "nsSVGPathGeometryFrame.h"
#include "SVGGeometryFrame.h"
#include "mozilla/dom/SVGPatternElement.h"
#include "nsSVGUtils.h"
#include "nsSVGAnimatedTransformList.h"
@ -392,7 +392,7 @@ nsSVGPatternFrame::PaintPattern(const DrawTarget* aDrawTarget,
if (aSource->IsFrameOfType(nsIFrame::eSVGGeometry)) {
// Set the geometrical parent of the pattern we are rendering
patternWithChildren->mSource = static_cast<nsSVGPathGeometryFrame*>(aSource);
patternWithChildren->mSource = static_cast<SVGGeometryFrame*>(aSource);
}
// Delay checking NS_FRAME_DRAWING_AS_PAINTSERVER bit until here so we can

View File

@ -15,11 +15,11 @@
class nsIFrame;
class nsSVGLength2;
class nsSVGPathGeometryFrame;
class nsSVGViewBox;
namespace mozilla {
class SVGAnimatedPreserveAspectRatio;
class SVGGeometryFrame;
class nsSVGAnimatedTransformList;
} // namespace mozilla
@ -142,7 +142,7 @@ private:
// this is a *temporary* reference to the frame of the element currently
// referencing our pattern. This must be temporary because different
// referencing frames will all reference this one frame
nsSVGPathGeometryFrame *mSource;
SVGGeometryFrame *mSource;
nsAutoPtr<gfxMatrix> mCTM;
protected:

View File

@ -46,8 +46,8 @@
#include "nsSVGOuterSVGFrame.h"
#include "mozilla/dom/SVGClipPathElement.h"
#include "mozilla/dom/SVGPathElement.h"
#include "nsSVGPathGeometryElement.h"
#include "nsSVGPathGeometryFrame.h"
#include "SVGGeometryElement.h"
#include "SVGGeometryFrame.h"
#include "nsSVGPaintServerFrame.h"
#include "mozilla/dom/SVGSVGElement.h"
#include "nsTextFrame.h"
@ -414,7 +414,7 @@ nsSVGUtils::GetCanvasTM(nsIFrame *aFrame)
return containerFrame->GetCanvasTM();
}
return static_cast<nsSVGPathGeometryFrame*>(aFrame)->GetCanvasTM();
return static_cast<SVGGeometryFrame*>(aFrame)->GetCanvasTM();
}
gfxMatrix
@ -1277,7 +1277,7 @@ nsSVGUtils::CanOptimizeOpacity(nsIFrame *aFrame)
}
nsIAtom *type = aFrame->GetType();
if (type != nsGkAtoms::svgImageFrame &&
type != nsGkAtoms::svgPathGeometryFrame) {
type != nsGkAtoms::svgGeometryFrame) {
return false;
}
if (aFrame->StyleEffects()->HasFilters()) {
@ -1383,7 +1383,7 @@ nsSVGUtils::PathExtentsToMaxStrokeExtents(const gfxRect& aPathExtents,
/*static*/ gfxRect
nsSVGUtils::PathExtentsToMaxStrokeExtents(const gfxRect& aPathExtents,
nsSVGPathGeometryFrame* aFrame,
SVGGeometryFrame* aFrame,
const gfxMatrix& aMatrix)
{
bool strokeMayHaveCorners =

View File

@ -39,7 +39,6 @@ class nsSVGElement;
class nsSVGEnum;
class nsSVGLength2;
class nsSVGOuterSVGFrame;
class nsSVGPathGeometryFrame;
class nsTextFrame;
struct nsStyleSVG;
@ -48,6 +47,7 @@ struct nsRect;
namespace mozilla {
class SVGContextPaint;
struct SVGContextPaintImpl;
class SVGGeometryFrame;
namespace dom {
class Element;
class UserSpaceMetrics;
@ -186,6 +186,7 @@ public:
typedef mozilla::gfx::Size Size;
typedef mozilla::SVGContextPaint SVGContextPaint;
typedef mozilla::SVGContextPaintImpl SVGContextPaintImpl;
typedef mozilla::SVGGeometryFrame SVGGeometryFrame;
typedef mozilla::image::DrawResult DrawResult;
static void Init();
@ -482,7 +483,7 @@ public:
nsTextFrame* aFrame,
const gfxMatrix& aMatrix);
static gfxRect PathExtentsToMaxStrokeExtents(const gfxRect& aPathExtents,
nsSVGPathGeometryFrame* aFrame,
SVGGeometryFrame* aFrame,
const gfxMatrix& aMatrix);
/**

View File

@ -16,9 +16,6 @@ import java.util.List;
import java.util.Locale;
import android.content.SharedPreferences;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.mozilla.gecko.EventDispatcher;
import org.mozilla.gecko.GeckoAppShell;
@ -38,7 +35,9 @@ import org.mozilla.gecko.home.HomePager.OnUrlOpenListener;
import org.mozilla.gecko.home.SearchLoader.SearchCursorLoader;
import org.mozilla.gecko.preferences.GeckoPreferences;
import org.mozilla.gecko.toolbar.AutocompleteHandler;
import org.mozilla.gecko.util.GeckoEventListener;
import org.mozilla.gecko.util.BundleEventListener;
import org.mozilla.gecko.util.EventCallback;
import org.mozilla.gecko.util.GeckoBundle;
import org.mozilla.gecko.util.StringUtils;
import org.mozilla.gecko.util.ThreadUtils;
@ -77,7 +76,7 @@ import android.widget.TextView;
* Fragment that displays frecency search results in a ListView.
*/
public class BrowserSearch extends HomeFragment
implements GeckoEventListener,
implements BundleEventListener,
SearchEngineBar.OnSearchBarClickListener {
@RobocopTarget
@ -308,7 +307,7 @@ public class BrowserSearch extends HomeFragment
public void onDestroyView() {
super.onDestroyView();
EventDispatcher.getInstance().unregisterGeckoThreadListener(this,
EventDispatcher.getInstance().unregisterUiThreadListener(this,
"SearchEngines:Data");
mSearchEngineBar.setAdapter(null);
@ -408,7 +407,7 @@ public class BrowserSearch extends HomeFragment
});
registerForContextMenu(mList);
EventDispatcher.getInstance().registerGeckoThreadListener(this,
EventDispatcher.getInstance().registerUiThreadListener(this,
"SearchEngines:Data");
mSearchEngineBar.setOnSearchBarClickListener(this);
@ -468,15 +467,11 @@ public class BrowserSearch extends HomeFragment
loadIfVisible();
}
@Override
public void handleMessage(String event, final JSONObject message) {
@Override // BundleEventListener
public void handleMessage(final String event, final GeckoBundle message,
final EventCallback callback) {
if (event.equals("SearchEngines:Data")) {
ThreadUtils.postToUiThread(new Runnable() {
@Override
public void run() {
setSearchEngines(message);
}
});
setSearchEngines(message);
}
}
@ -718,7 +713,7 @@ public class BrowserSearch extends HomeFragment
return false;
}
private void setSearchEngines(JSONObject data) {
private void setSearchEngines(final GeckoBundle data) {
ThreadUtils.assertOnUiThread();
// This method is called via a Runnable posted from the Gecko thread, so
@ -728,59 +723,55 @@ public class BrowserSearch extends HomeFragment
return;
}
try {
final JSONObject suggest = data.getJSONObject("suggest");
final String suggestEngine = suggest.optString("engine", null);
final String suggestTemplate = suggest.optString("template", null);
final boolean suggestionsPrompted = suggest.getBoolean("prompted");
final JSONArray engines = data.getJSONArray("searchEngines");
final GeckoBundle suggest = data.getBundle("suggest");
final String suggestEngine = suggest.getString("engine", null);
final String suggestTemplate = suggest.getString("template", null);
final boolean suggestionsPrompted = suggest.getBoolean("prompted");
final GeckoBundle[] engines = data.getBundleArray("searchEngines");
mSuggestionsEnabled = suggest.getBoolean("enabled");
mSuggestionsEnabled = suggest.getBoolean("enabled");
ArrayList<SearchEngine> searchEngines = new ArrayList<SearchEngine>();
for (int i = 0; i < engines.length(); i++) {
final JSONObject engineJSON = engines.getJSONObject(i);
final SearchEngine engine = new SearchEngine((Context) getActivity(), engineJSON);
ArrayList<SearchEngine> searchEngines = new ArrayList<SearchEngine>();
for (int i = 0; i < engines.length; i++) {
final GeckoBundle engineBundle = engines[i];
final SearchEngine engine = new SearchEngine((Context) getActivity(), engineBundle);
if (engine.name.equals(suggestEngine) && suggestTemplate != null) {
// Suggest engine should be at the front of the list.
// We're baking in an assumption here that the suggest engine
// is also the default engine.
searchEngines.add(0, engine);
if (engine.name.equals(suggestEngine) && suggestTemplate != null) {
// Suggest engine should be at the front of the list.
// We're baking in an assumption here that the suggest engine
// is also the default engine.
searchEngines.add(0, engine);
ensureSuggestClientIsSet(suggestTemplate);
} else {
searchEngines.add(engine);
}
}
// checking if the new searchEngine is different from mSearchEngine, will have to re-layout if yes
boolean change = shouldUpdateSearchEngine(searchEngines);
if (mAdapter != null && change) {
mSearchEngines = Collections.unmodifiableList(searchEngines);
mLastLocale = Locale.getDefault();
updateSearchEngineBar();
mAdapter.notifyDataSetChanged();
}
final Tab tab = Tabs.getInstance().getSelectedTab();
final boolean isPrivate = (tab != null && tab.isPrivate());
// Show suggestions opt-in prompt only if suggestions are not enabled yet,
// user hasn't been prompted and we're not on a private browsing tab.
// The prompt might have been inflated already when this view was previously called.
// Remove the opt-in prompt if it has been inflated in the view and dealt with by the user,
// or if we're on a private browsing tab
if (!mSuggestionsEnabled && !suggestionsPrompted && !isPrivate) {
showSuggestionsOptIn();
ensureSuggestClientIsSet(suggestTemplate);
} else {
removeSuggestionsOptIn();
searchEngines.add(engine);
}
}
} catch (JSONException e) {
Log.e(LOGTAG, "Error getting search engine JSON", e);
// checking if the new searchEngine is different from mSearchEngine, will have to
// re-layout if yes
boolean change = shouldUpdateSearchEngine(searchEngines);
if (mAdapter != null && change) {
mSearchEngines = Collections.unmodifiableList(searchEngines);
mLastLocale = Locale.getDefault();
updateSearchEngineBar();
mAdapter.notifyDataSetChanged();
}
final Tab tab = Tabs.getInstance().getSelectedTab();
final boolean isPrivate = (tab != null && tab.isPrivate());
// Show suggestions opt-in prompt only if suggestions are not enabled yet,
// user hasn't been prompted and we're not on a private browsing tab.
// The prompt might have been inflated already when this view was previously called.
// Remove the opt-in prompt if it has been inflated in the view and dealt with by the user,
// or if we're on a private browsing tab
if (!mSuggestionsEnabled && !suggestionsPrompted && !isPrivate) {
showSuggestionsOptIn();
} else {
removeSuggestionsOptIn();
}
filterSuggestions();

View File

@ -7,11 +7,9 @@ package org.mozilla.gecko.home;
import android.support.annotation.NonNull;
import org.mozilla.gecko.gfx.BitmapUtils;
import org.mozilla.gecko.util.GeckoBundle;
import org.mozilla.gecko.R;
import org.json.JSONException;
import org.json.JSONObject;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
@ -29,19 +27,19 @@ public class SearchEngine {
private final Bitmap icon;
private volatile List<String> suggestions = new ArrayList<String>(); // Never null.
public SearchEngine(final Context context, final JSONObject engineJSON) throws JSONException {
if (engineJSON == null) {
throw new IllegalArgumentException("Can't instantiate SearchEngine from null JSON.");
public SearchEngine(final Context context, final GeckoBundle engine) {
if (engine == null) {
throw new IllegalArgumentException("Can't instantiate SearchEngine from null bundle.");
}
this.name = getString(engineJSON, "name");
this.name = engine.getString("name");
if (this.name == null) {
throw new IllegalArgumentException("Cannot have an unnamed search engine.");
}
this.identifier = getString(engineJSON, "identifier");
this.identifier = engine.getString("identifier");
final String iconURI = getString(engineJSON, "iconURI");
final String iconURI = engine.getString("iconURI");
if (iconURI == null) {
Log.w(LOG_TAG, "iconURI is null for search engine " + this.name);
}
@ -54,13 +52,6 @@ public class SearchEngine {
return BitmapFactory.decodeResource(context.getResources(), R.drawable.search_icon_inactive);
}
private static String getString(JSONObject data, String key) throws JSONException {
if (data.isNull(key)) {
return null;
}
return data.getString(key);
}
/**
* @return a non-null string suitable for use by FHR.
*/

View File

@ -4,14 +4,13 @@
package org.mozilla.gecko.preferences;
import org.json.JSONException;
import org.json.JSONObject;
import org.mozilla.gecko.R;
import org.mozilla.gecko.SnackbarBuilder;
import org.mozilla.gecko.icons.IconCallback;
import org.mozilla.gecko.icons.IconDescriptor;
import org.mozilla.gecko.icons.IconResponse;
import org.mozilla.gecko.icons.Icons;
import org.mozilla.gecko.util.GeckoBundle;
import org.mozilla.gecko.widget.FaviconView;
import android.app.Activity;
@ -60,7 +59,7 @@ public class SearchEnginePreference extends CustomListPreference {
super.onBindView(view);
// We synchronise to avoid a race condition between this and the favicon loading callback in
// setSearchEngineFromJSON.
// setSearchEngineFromBundle.
synchronized (bitmapLock) {
// Set the icon in the FaviconView.
mFaviconView = ((FaviconView) view.findViewById(R.id.search_engine_icon));
@ -139,24 +138,23 @@ public class SearchEnginePreference extends CustomListPreference {
}
/**
* Configure this Preference object from the Gecko search engine JSON object.
* @param geckoEngineJSON The Gecko-formatted JSON object representing the search engine.
* @throws JSONException If the JSONObject is invalid.
* Configure this Preference object from the Gecko search engine object.
* @param geckoEngine The Gecko-formatted object representing the search engine.
*/
public void setSearchEngineFromJSON(JSONObject geckoEngineJSON) throws JSONException {
mIdentifier = geckoEngineJSON.getString("identifier");
public void setSearchEngineFromBundle(GeckoBundle geckoEngine) {
mIdentifier = geckoEngine.getString("identifier");
// A null JS value gets converted into a string.
if (mIdentifier.equals("null")) {
mIdentifier = "other";
}
final String engineName = geckoEngineJSON.getString("name");
final String engineName = geckoEngine.getString("name");
final SpannableString titleSpannable = new SpannableString(engineName);
setTitle(titleSpannable);
final String iconURI = geckoEngineJSON.getString("iconURI");
final String iconURI = geckoEngine.getString("iconURI");
// Keep a reference to the bitmap - we'll need it later in onBindView.
try {
Icons.with(getContext())

View File

@ -9,7 +9,6 @@ import android.preference.Preference;
import android.util.AttributeSet;
import android.util.Log;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
@ -18,10 +17,12 @@ import org.mozilla.gecko.GeckoAppShell;
import org.mozilla.gecko.Telemetry;
import org.mozilla.gecko.TelemetryContract;
import org.mozilla.gecko.TelemetryContract.Method;
import org.mozilla.gecko.util.GeckoEventListener;
import org.mozilla.gecko.util.BundleEventListener;
import org.mozilla.gecko.util.EventCallback;
import org.mozilla.gecko.util.GeckoBundle;
import org.mozilla.gecko.util.ThreadUtils;
public class SearchPreferenceCategory extends CustomListCategory implements GeckoEventListener {
public class SearchPreferenceCategory extends CustomListCategory implements BundleEventListener {
public static final String LOGTAG = "SearchPrefCategory";
public SearchPreferenceCategory(Context context) {
@ -41,7 +42,7 @@ public class SearchPreferenceCategory extends CustomListCategory implements Geck
super.onAttachedToActivity();
// Register for SearchEngines messages and request list of search engines from Gecko.
EventDispatcher.getInstance().registerGeckoThreadListener(this, "SearchEngines:Data");
EventDispatcher.getInstance().registerUiThreadListener(this, "SearchEngines:Data");
GeckoAppShell.notifyObservers("SearchEngines:GetVisible", null);
}
@ -49,7 +50,7 @@ public class SearchPreferenceCategory extends CustomListCategory implements Geck
protected void onPrepareForRemoval() {
super.onPrepareForRemoval();
EventDispatcher.getInstance().unregisterGeckoThreadListener(this, "SearchEngines:Data");
EventDispatcher.getInstance().unregisterUiThreadListener(this, "SearchEngines:Data");
}
@Override
@ -72,56 +73,44 @@ public class SearchPreferenceCategory extends CustomListCategory implements Geck
Telemetry.sendUIEvent(TelemetryContract.Event.SEARCH_REMOVE, Method.DIALOG, identifier);
}
@Override
public void handleMessage(String event, final JSONObject data) {
@Override // BundleEventListener
public void handleMessage(final String event, final GeckoBundle data,
final EventCallback callback) {
if (event.equals("SearchEngines:Data")) {
// Parse engines array from JSON.
JSONArray engines;
try {
engines = data.getJSONArray("searchEngines");
} catch (JSONException e) {
Log.e(LOGTAG, "Unable to decode search engine data from Gecko.", e);
return;
}
// Parse engines array from bundle.
final GeckoBundle[] engines = data.getBundleArray("searchEngines");
// Clear the preferences category from this thread.
this.removeAll();
// Create an element in this PreferenceCategory for each engine.
for (int i = 0; i < engines.length(); i++) {
try {
final JSONObject engineJSON = engines.getJSONObject(i);
final SearchEnginePreference enginePreference = new SearchEnginePreference(getContext(), this);
enginePreference.setSearchEngineFromJSON(engineJSON);
enginePreference.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
SearchEnginePreference sPref = (SearchEnginePreference) preference;
// Display the configuration dialog associated with the tapped engine.
sPref.showDialog();
return true;
}
});
addPreference(enginePreference);
// The first element in the array is the default engine.
if (i == 0) {
// We set this here, not in setSearchEngineFromJSON, because it allows us to
// keep a reference to the default engine to use when the AlertDialog
// callbacks are used.
ThreadUtils.postToUiThread(new Runnable() {
@Override
public void run() {
enginePreference.setIsDefault(true);
}
});
mDefaultReference = enginePreference;
for (int i = 0; i < engines.length; i++) {
final GeckoBundle engine = engines[i];
final SearchEnginePreference enginePreference =
new SearchEnginePreference(getContext(), this);
enginePreference.setSearchEngineFromBundle(engine);
enginePreference.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
SearchEnginePreference sPref = (SearchEnginePreference) preference;
// Display the configuration dialog associated with the tapped engine.
sPref.showDialog();
return true;
}
} catch (JSONException e) {
Log.e(LOGTAG, "JSONException parsing engine at index " + i, e);
});
addPreference(enginePreference);
if (i != 0) {
continue;
}
// The first element in the array is the default engine.
// We set this here, not in setSearchEngineFromBundle, because it allows us to
// keep a reference to the default engine to use when the AlertDialog
// callbacks are used.
enginePreference.setIsDefault(true);
mDefaultReference = enginePreference;
}
}
}

View File

@ -6005,7 +6005,7 @@ var SearchEngines = {
}
// By convention, the currently configured default engine is at position zero in searchEngines.
Messaging.sendRequest({
GlobalEventDispatcher.sendRequest({
type: "SearchEngines:Data",
searchEngines: searchEngines,
suggest: {
@ -6723,9 +6723,7 @@ var Distribution = {
return;
}
new Promise((resolve, reject) => {
AddonManager.getInstallForFile(new FileUtils.File(entry.path), resolve);
}).then(install => {
AddonManager.getInstallForFile(new FileUtils.File(entry.path)).then(install => {
let id = entry.name.substring(0, entry.name.length - 4);
if (install.addon.id !== id) {
Cu.reportError("File entry " + entry.path + " contains an add-on with an incorrect ID");

View File

@ -7,9 +7,9 @@ package org.mozilla.gecko;
import org.mozilla.gecko.annotation.JNITarget;
import org.mozilla.gecko.annotation.WrapForJNI;
import org.mozilla.gecko.util.NativeEventListener;
import org.mozilla.gecko.util.NativeJSObject;
import org.mozilla.gecko.util.BundleEventListener;
import org.mozilla.gecko.util.EventCallback;
import org.mozilla.gecko.util.GeckoBundle;
import org.mozilla.gecko.util.NetworkUtils;
import org.mozilla.gecko.util.NetworkUtils.ConnectionSubType;
import org.mozilla.gecko.util.NetworkUtils.ConnectionType;
@ -42,7 +42,7 @@ import android.util.Log;
* Logic is implemented as a state machine, so see the transition matrix to figure out what happens when.
* This class depends on access to the context, so only use after GeckoAppShell has been initialized.
*/
public class GeckoNetworkManager extends BroadcastReceiver implements NativeEventListener {
public class GeckoNetworkManager extends BroadcastReceiver implements BundleEventListener {
private static final String LOGTAG = "GeckoNetworkManager";
private static final String LINK_DATA_CHANGED = "changed";
@ -89,14 +89,14 @@ public class GeckoNetworkManager extends BroadcastReceiver implements NativeEven
}
private GeckoNetworkManager() {
EventDispatcher.getInstance().registerGeckoThreadListener(this,
EventDispatcher.getInstance().registerUiThreadListener(this,
"Wifi:Enable",
"Wifi:GetIPAddress");
}
private void onDestroy() {
handleManagerEvent(ManagerEvent.stop);
EventDispatcher.getInstance().unregisterGeckoThreadListener(this,
EventDispatcher.getInstance().unregisterUiThreadListener(this,
"Wifi:Enable",
"Wifi:GetIPAddress");
}
@ -395,26 +395,29 @@ public class GeckoNetworkManager extends BroadcastReceiver implements NativeEven
}
}
@Override
@Override // BundleEventListener
/**
* Handles native messages, not part of the state machine flow.
*/
public void handleMessage(final String event, final NativeJSObject message,
public void handleMessage(final String event, final GeckoBundle message,
final EventCallback callback) {
final Context applicationContext = GeckoAppShell.getApplicationContext();
switch (event) {
case "Wifi:Enable":
final WifiManager mgr = (WifiManager) applicationContext.getSystemService(Context.WIFI_SERVICE);
final WifiManager mgr = (WifiManager)
applicationContext.getSystemService(Context.WIFI_SERVICE);
if (!mgr.isWifiEnabled()) {
mgr.setWifiEnabled(true);
} else {
// If Wifi is enabled, maybe you need to select a network
Intent intent = new Intent(android.provider.Settings.ACTION_WIFI_SETTINGS);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
applicationContext.startActivity(intent);
break;
}
// If Wifi is enabled, maybe you need to select a network
Intent intent = new Intent(android.provider.Settings.ACTION_WIFI_SETTINGS);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
applicationContext.startActivity(intent);
break;
case "Wifi:GetIPAddress":
getWifiIPAddress(callback);
break;

View File

@ -143,7 +143,7 @@ handlers.wifi = {
this.node = Cu.getWeakReference(node);
Services.obs.addObserver(this, "network:link-status-changed", true);
Messaging.sendRequest({
EventDispatcher.instance.sendRequest({
type: "Wifi:Enable"
});
},

View File

@ -7,13 +7,11 @@ package org.mozilla.gecko.tests;
import java.io.File;
import java.util.ArrayList;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.mozilla.gecko.Actions;
import org.mozilla.gecko.GeckoProfile;
import org.mozilla.gecko.home.HomePager;
import org.mozilla.gecko.home.SearchEngineBar;
import org.mozilla.gecko.util.GeckoBundle;
import org.mozilla.gecko.R;
import android.widget.ImageView;
@ -23,7 +21,7 @@ import com.robotium.solo.Condition;
/**
* Test adding a search engine from an input field context menu.
* 1. Get the number of existing search engines from the SearchEngine:Data event and as displayed in about:home.
* 1. Get the number of existing search engines from the SearchEngines:Data event and as displayed in about:home.
* 2. Load a page with a text field, open the context menu and add a search engine from the page.
* 3. Get the number of search engines after adding the new one and verify it has increased by 1.
*/
@ -43,26 +41,23 @@ public class testAddSearchEngine extends AboutHomeTest {
inputAndLoadUrl(blankPageURL);
waitForText(mStringHelper.ROBOCOP_BLANK_PAGE_01_TITLE);
// Get the searchengine data by clicking the awesomebar - this causes Gecko to send Java the list
// of search engines.
Actions.EventExpecter searchEngineDataEventExpector = mActions.expectGeckoEvent("SearchEngines:Data");
// Get the searchengine data by clicking the awesomebar - this causes Gecko to
// send Java the list of search engines.
Actions.EventExpecter searchEngineDataEventExpector =
mActions.expectGlobalEvent(Actions.EventType.UI, "SearchEngines:Data");
focusUrlBar();
mActions.sendKeys(SEARCH_TEXT);
String eventData = searchEngineDataEventExpector.blockForEventData();
GeckoBundle eventData = searchEngineDataEventExpector.blockForBundle();
searchEngineDataEventExpector.unregisterListener();
ArrayList<String> searchEngines;
try {
// Parse the data to get the number of searchengines.
searchEngines = getSearchEnginesNames(eventData);
} catch (JSONException e) {
mAsserter.ok(false, "Fatal exception in testAddSearchEngine while decoding JSON search engine string from Gecko prior to addition of new engine.", e.toString());
return;
}
// Parse the data to get the number of searchengines.
ArrayList<String> searchEngines = getSearchEnginesNames(eventData);
final int initialNumSearchEngines = searchEngines.size();
mAsserter.dumpLog("Search Engines list = " + searchEngines.toString());
// Verify that the number of displayed search engines is the same as the one received through the SearchEngines:Data event.
// Verify that the number of displayed search engines is the same as the one
// received through the SearchEngines:Data event.
verifyDisplayedSearchEnginesCount(initialNumSearchEngines);
// Load the page for the search engine to add.
@ -71,7 +66,8 @@ public class testAddSearchEngine extends AboutHomeTest {
// Used to long-tap on the search input box for the search engine to add.
getInstrumentation().waitForIdleSync();
mAsserter.dumpLog("Long Clicking at width = " + String.valueOf(width) + " and height = " + String.valueOf(height));
mAsserter.dumpLog("Long Clicking at width = " + String.valueOf(width) +
" and height = " + String.valueOf(height));
mSolo.clickLongOnScreen(width,height);
ImageView view = waitForViewWithDescription(ImageView.class, ADD_SEARCHENGINE_OPTION_TEXT);
@ -90,48 +86,46 @@ public class testAddSearchEngine extends AboutHomeTest {
waitForText(mStringHelper.ROBOCOP_BLANK_PAGE_01_TITLE);
// Load search engines again and check that the quantity of engines has increased by 1.
searchEngineDataEventExpector = mActions.expectGeckoEvent("SearchEngines:Data");
searchEngineDataEventExpector =
mActions.expectGlobalEvent(Actions.EventType.UI, "SearchEngines:Data");
focusUrlBar();
mActions.sendKeys(SEARCH_TEXT);
eventData = searchEngineDataEventExpector.blockForEventData();
try {
// Parse the data to get the number of searchengines
searchEngines = getSearchEnginesNames(eventData);
} catch (JSONException e) {
mAsserter.ok(false, "Fatal exception in testAddSearchEngine while decoding JSON search engine string from Gecko after adding of new engine.", e.toString());
return;
}
eventData = searchEngineDataEventExpector.blockForBundle();
// Parse the data to get the number of searchengines
searchEngines = getSearchEnginesNames(eventData);
mAsserter.dumpLog("Search Engines list = " + searchEngines.toString());
mAsserter.is(searchEngines.size(), initialNumSearchEngines + 1, "Checking the number of Search Engines has increased");
mAsserter.is(searchEngines.size(), initialNumSearchEngines + 1,
"Checking the number of Search Engines has increased");
// Verify that the number of displayed searchengines is the same as the one received through the SearchEngines:Data event.
// Verify that the number of displayed searchengines is the same as the one
// received through the SearchEngines:Data event.
verifyDisplayedSearchEnginesCount(initialNumSearchEngines + 1);
searchEngineDataEventExpector.unregisterListener();
// Verify that the search plugin XML file for the new engine ended up where we expected it to.
// This file name is created in nsSearchService.js based on the name of the new engine.
final File f = GeckoProfile.get(getActivity()).getFile("searchplugins/robocop-search-engine.xml");
// Verify that the search plugin XML file for the new engine ended up where we
// expected it to. This file name is created in nsSearchService.js based on the
// name of the new engine.
final File f = GeckoProfile.get(getActivity())
.getFile("searchplugins/robocop-search-engine.xml");
mAsserter.ok(f.exists(), "Checking that new search plugin file exists", "");
}
/**
* Helper method to decode a list of search engine names from the provided search engine information
* JSON string sent from Gecko.
* @param searchEngineData The JSON string representing the search engine array to process
* @return An ArrayList<String> containing the names of all the search engines represented in
* the provided JSON message.
* @throws JSONException In the event that the JSON provided cannot be decoded.
* Helper method to decode a list of search engine names from the provided search
* engine information object sent from Gecko.
* @param searchEngineData The object representing the search engine array to process
* @return An ArrayList<String> containing the names of all the search engines
* represented in the provided bundle message.
*/
public ArrayList<String> getSearchEnginesNames(String searchEngineData) throws JSONException {
JSONObject data = new JSONObject(searchEngineData);
JSONArray engines = data.getJSONArray("searchEngines");
public ArrayList<String> getSearchEnginesNames(final GeckoBundle data) {
final GeckoBundle[] engines = data.getBundleArray("searchEngines");
ArrayList<String> searchEngineNames = new ArrayList<String>();
for (int i = 0; i < engines.length(); i++) {
JSONObject engineJSON = engines.getJSONObject(i);
searchEngineNames.add(engineJSON.getString("name"));
for (int i = 0; i < engines.length; i++) {
final GeckoBundle engine = engines[i];
searchEngineNames.add(engine.getString("name"));
}
return searchEngineNames;
}

View File

@ -30,6 +30,7 @@ import org.mozilla.gecko.distribution.ReferrerDescriptor;
import org.mozilla.gecko.distribution.ReferrerReceiver;
import org.mozilla.gecko.preferences.DistroSharedPrefsImport;
import org.mozilla.gecko.preferences.GeckoPreferences;
import org.mozilla.gecko.util.GeckoBundle;
import org.mozilla.gecko.util.ThreadUtils;
import android.app.Activity;
@ -363,26 +364,24 @@ public class testDistribution extends ContentProviderTest {
}
private void checkSearchPlugin() {
Actions.RepeatedEventExpecter eventExpecter = mActions.expectGeckoEvent("SearchEngines:Data");
Actions.RepeatedEventExpecter eventExpecter =
mActions.expectGlobalEvent(Actions.EventType.UI, "SearchEngines:Data");
mActions.sendGeckoEvent("SearchEngines:GetVisible", null);
try {
JSONObject data = new JSONObject(eventExpecter.blockForEventData());
eventExpecter.unregisterListener();
JSONArray searchEngines = data.getJSONArray("searchEngines");
boolean foundEngine = false;
for (int i = 0; i < searchEngines.length(); i++) {
JSONObject engine = (JSONObject) searchEngines.get(i);
String name = engine.getString("name");
if (name.equals("Test search engine")) {
foundEngine = true;
break;
}
final GeckoBundle data = eventExpecter.blockForBundle();
eventExpecter.unregisterListener();
final GeckoBundle[] searchEngines = data.getBundleArray("searchEngines");
boolean foundEngine = false;
for (int i = 0; i < searchEngines.length; i++) {
final GeckoBundle engine = searchEngines[i];
final String name = engine.getString("name");
if (name.equals("Test search engine")) {
foundEngine = true;
break;
}
mAsserter.ok(foundEngine, "check search plugin", "found test search plugin");
} catch (JSONException e) {
mAsserter.ok(false, "exception getting search plugins", e.toString());
}
mAsserter.ok(foundEngine, "check search plugin", "found test search plugin");
}
private void checkAddon() {

View File

@ -1900,7 +1900,6 @@ nsHttpChannel::ProcessAltService()
nsresult
nsHttpChannel::ProcessResponse()
{
nsresult rv;
uint32_t httpStatus = mResponseHead->Status();
LOG(("nsHttpChannel::ProcessResponse [this=%p httpStatus=%u]\n",
@ -1993,7 +1992,7 @@ nsHttpChannel::ProcessResponse()
} else {
// Given a successful connection, process any STS or PKP data that's
// relevant.
rv = ProcessSecurityHeaders();
DebugOnly<nsresult> rv = ProcessSecurityHeaders();
MOZ_ASSERT(NS_SUCCEEDED(rv), "ProcessSTSHeader failed, continuing load.");
}
@ -2004,6 +2003,37 @@ nsHttpChannel::ProcessResponse()
// notify "http-on-examine-response" observers
gHttpHandler->OnExamineResponse(this);
return ContinueProcessResponse1();
}
void
nsHttpChannel::AsyncContinueProcessResponse()
{
nsresult rv;
rv = ContinueProcessResponse1();
if (NS_FAILED(rv)) {
// A synchronous failure here would normally be passed as the return
// value from OnStartRequest, which would in turn cancel the request.
// If we're continuing asynchronously, we need to cancel the request
// ourselves.
Unused << Cancel(rv);
}
}
nsresult
nsHttpChannel::ContinueProcessResponse1()
{
NS_PRECONDITION(!mCallOnResume, "How did that happen?");
nsresult rv;
if (mSuspendCount) {
LOG(("Waiting until resume to finish processing response [this=%p]\n", this));
mCallOnResume = &nsHttpChannel::AsyncContinueProcessResponse;
return NS_OK;
}
uint32_t httpStatus = mResponseHead->Status();
// Cookies and Alt-Service should not be handled on proxy failure either.
// This would be consolidated with ProcessSecurityHeaders but it should
// happen after OnExamineResponse.
@ -2042,22 +2072,22 @@ nsHttpChannel::ProcessResponse()
nsCOMPtr<nsIURI> redirectTo;
mAPIRedirectToURI.swap(redirectTo);
PushRedirectAsyncFunc(&nsHttpChannel::ContinueProcessResponse1);
PushRedirectAsyncFunc(&nsHttpChannel::ContinueProcessResponse2);
rv = StartRedirectChannelToURI(redirectTo, nsIChannelEventSink::REDIRECT_TEMPORARY);
if (NS_SUCCEEDED(rv)) {
return NS_OK;
}
PopRedirectAsyncFunc(&nsHttpChannel::ContinueProcessResponse1);
PopRedirectAsyncFunc(&nsHttpChannel::ContinueProcessResponse2);
}
// Hack: ContinueProcessResponse1 uses NS_OK to detect successful
// Hack: ContinueProcessResponse2 uses NS_OK to detect successful
// redirects, so we distinguish this codepath (a non-redirect that's
// processing normally) by passing in a bogus error code.
return ContinueProcessResponse1(NS_BINDING_FAILED);
return ContinueProcessResponse2(NS_BINDING_FAILED);
}
nsresult
nsHttpChannel::ContinueProcessResponse1(nsresult rv)
nsHttpChannel::ContinueProcessResponse2(nsresult rv)
{
if (NS_SUCCEEDED(rv)) {
// redirectTo() has passed through, we don't want to go on with
@ -2112,10 +2142,10 @@ nsHttpChannel::ContinueProcessResponse1(nsresult rv)
#endif
// don't store the response body for redirects
MaybeInvalidateCacheEntryForSubsequentGet();
PushRedirectAsyncFunc(&nsHttpChannel::ContinueProcessResponse2);
PushRedirectAsyncFunc(&nsHttpChannel::ContinueProcessResponse3);
rv = AsyncProcessRedirection(httpStatus);
if (NS_FAILED(rv)) {
PopRedirectAsyncFunc(&nsHttpChannel::ContinueProcessResponse2);
PopRedirectAsyncFunc(&nsHttpChannel::ContinueProcessResponse3);
LOG(("AsyncProcessRedirection failed [rv=%x]\n", rv));
// don't cache failed redirect responses.
if (mCacheEntry)
@ -2124,7 +2154,7 @@ nsHttpChannel::ContinueProcessResponse1(nsresult rv)
mStatus = rv;
DoNotifyListener();
} else {
rv = ContinueProcessResponse2(rv);
rv = ContinueProcessResponse3(rv);
}
}
break;
@ -2232,7 +2262,7 @@ nsHttpChannel::ContinueProcessResponse1(nsresult rv)
}
nsresult
nsHttpChannel::ContinueProcessResponse2(nsresult rv)
nsHttpChannel::ContinueProcessResponse3(nsresult rv)
{
bool doNotRender = DoNotRender3xxBody(rv);
@ -2248,7 +2278,7 @@ nsHttpChannel::ContinueProcessResponse2(nsresult rv)
// redirecting to another protocol (perhaps javascript:)
// In that case we want to throw an error instead of displaying the
// non-redirected response body.
LOG(("ContinueProcessResponse2 detected rejected Non-HTTP Redirection"));
LOG(("ContinueProcessResponse3 detected rejected Non-HTTP Redirection"));
doNotRender = true;
rv = NS_ERROR_CORRUPTED_CONTENT;
}
@ -2274,7 +2304,7 @@ nsHttpChannel::ContinueProcessResponse2(nsresult rv)
return NS_OK;
}
LOG(("ContinueProcessResponse2 got failure result [rv=%x]\n", rv));
LOG(("ContinueProcessResponse3 got failure result [rv=%x]\n", rv));
if (mTransaction->ProxyConnectFailed()) {
return ProcessFailedProxyConnect(mRedirectType);
}

View File

@ -290,8 +290,10 @@ private:
void SetupTransactionRequestContext();
nsresult CallOnStartRequest();
nsresult ProcessResponse();
nsresult ContinueProcessResponse1(nsresult);
void AsyncContinueProcessResponse();
nsresult ContinueProcessResponse1();
nsresult ContinueProcessResponse2(nsresult);
nsresult ContinueProcessResponse3(nsresult);
nsresult ProcessNormal();
nsresult ContinueProcessNormal(nsresult);
void ProcessAltService();

View File

@ -1149,4 +1149,4 @@ static const TransportSecurityPreload kPublicKeyPinningPreloadList[] = {
static const int32_t kUnknownId = -1;
static const PRTime kPreloadPKPinsExpirationTime = INT64_C(1490451711119000);
static const PRTime kPreloadPKPinsExpirationTime = INT64_C(1490539149398000);

View File

@ -1,6 +1,5 @@
020wifi.nl: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsISiteSecurityService.processHeader]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: /builds/slave/m-cen-l64-periodicupdate-00000/getHSTSPreloadList.js :: processStsHeader :: line 121" data: no]
0p.no: did not receive HSTS header
0x.cx: could not connect to host
0x.sk: could not connect to host
0x1337.eu: could not connect to host
0x44.net: did not receive HSTS header
@ -37,7 +36,6 @@
47ronin.com: did not receive HSTS header
491mhz.net: could not connect to host
4elements.com: did not receive HSTS header
4miners.net: could not connect to host
4mm.org: could not connect to host
4sqsu.eu: could not connect to host
50millionablaze.org: did not receive HSTS header
@ -59,7 +57,7 @@ aaeblog.net: did not receive HSTS header
aaeblog.org: did not receive HSTS header
aapp.space: could not connect to host
abearofsoap.com: did not receive HSTS header
abecodes.net: did not receive HSTS header
abecodes.net: could not connect to host
abeestrada.com: did not receive HSTS header
abilitylist.org: did not receive HSTS header
abioniere.de: could not connect to host
@ -111,14 +109,13 @@ aerialmediapro.net: could not connect to host
aes256.ru: could not connect to host
aether.pw: could not connect to host
aevpn.net: could not connect to host
affinitysync.com: could not connect to host
aficotroceni.ro: did not receive HSTS header
afp548.tk: could not connect to host
agalaxyfarfaraway.co.uk: could not connect to host
agbremen.de: did not receive HSTS header
agevio.com: could not connect to host
agilebits.net: could not connect to host
agonswim.com: could not connect to host
agowa338.de: could not connect to host
agrimap.com: did not receive HSTS header
agrios.de: did not receive HSTS header
agro-id.gov.ua: could not connect to host
@ -189,6 +186,7 @@ anarchistischegroepnijmegen.nl: [Exception... "Component returned failure code:
anassiriphotography.com: could not connect to host
ancientkarma.com: could not connect to host
andere-gedanken.net: max-age too low: 10
andiplusben.com: could not connect to host
andreasbreitenlohner.de: did not receive HSTS header
andreaskrasa.com: could not connect to host
andreasolsson.se: could not connect to host
@ -265,6 +263,7 @@ arrayify.com: could not connect to host
ars-design.net: could not connect to host
ars.toscana.it: max-age too low: 0
artistnetwork.nl: did not receive HSTS header
arubasunsetbeach.com: could not connect to host
arvamus.eu: could not connect to host
as.se: could not connect to host
as9178.net: could not connect to host
@ -272,7 +271,7 @@ asasuou.pw: could not connect to host
asc16.com: could not connect to host
ascii.moe: could not connect to host
asdpress.cn: could not connect to host
ashutoshmishra.org: could not connect to host
ashutoshmishra.org: did not receive HSTS header
askfit.cz: did not receive HSTS header
asm-x.com: did not receive HSTS header
asmui.ga: could not connect to host
@ -285,7 +284,6 @@ asset-alive.net: did not receive HSTS header
astrath.net: could not connect to host
astrolpost.com: could not connect to host
astromelody.com: did not receive HSTS header
asuhe.cc: did not receive HSTS header
atavio.at: could not connect to host
atavio.ch: could not connect to host
atavio.de: did not receive HSTS header
@ -302,7 +300,6 @@ aubiosales.com: did not receive HSTS header
aucubin.moe: could not connect to host
aufmerksamkeitsstudie.com: could not connect to host
aujapan.ru: could not connect to host
aur.rocks: could not connect to host
aurainfosec.com.au: could not connect to host
ausnah.me: could not connect to host
ausoptic.com.au: max-age too low: 2592000
@ -379,6 +376,7 @@ belairsewvac.com: did not receive HSTS header
belics.com: did not receive HSTS header
belliash.eu.org: could not connect to host
belltower.io: could not connect to host
bendemaree.com: could not connect to host
beneffy.com: did not receive HSTS header
benk.press: could not connect to host
benny003.de: did not receive HSTS header
@ -433,6 +431,8 @@ bitheus.com: could not connect to host
bithosting.io: did not receive HSTS header
bitnet.io: did not receive HSTS header
bitsafe.systems: could not connect to host
bitstorm.nl: could not connect to host
bitstorm.org: could not connect to host
bitvigor.com: could not connect to host
bivsi.com: could not connect to host
bizcms.com: did not receive HSTS header
@ -559,6 +559,7 @@ cajapopcorn.com: did not receive HSTS header
cake.care: could not connect to host
calgaryconstructionjobs.com: could not connect to host
calix.com: max-age too low: 0
call.me: did not receive HSTS header
calltrackingreports.com: could not connect to host
calvin.me: max-age too low: 2592000
calvinallen.net: did not receive HSTS header
@ -641,6 +642,7 @@ cheerflow.com: could not connect to host
cheesetart.my: could not connect to host
chejianer.cn: did not receive HSTS header
cherysunzhang.com: max-age too low: 7776000
chiaramail.com: could not connect to host
chic-leather.com: could not connect to host
chihiro.xyz: could not connect to host
chijiokeindustries.co.uk: did not receive HSTS header
@ -655,7 +657,7 @@ chrisandsarahinasia.com: did not receive HSTS header
chriskyrouac.com: could not connect to host
christiaandruif.nl: could not connect to host
christianbro.gq: could not connect to host
christophheich.me: could not connect to host
christophheich.me: did not receive HSTS header
chrisupjohn.com: could not connect to host
chrome-devtools-frontend.appspot.com: did not receive HSTS header (error ignored - included regardless)
chrome.google.com: did not receive HSTS header (error ignored - included regardless)
@ -667,6 +669,7 @@ cigi.site: could not connect to host
cim2b.de: could not connect to host
cip.md: did not receive HSTS header
ciplanutrition.com: did not receive HSTS header
circara.com: did not receive HSTS header
citiagent.cz: could not connect to host
cityoflaurel.org: did not receive HSTS header
clara-baumert.de: could not connect to host
@ -705,6 +708,7 @@ cmsbattle.com: could not connect to host
cmscafe.ru: did not receive HSTS header
cn.search.yahoo.com: did not receive HSTS header
co50.com: did not receive HSTS header
coam.co: could not connect to host
cocaine-import.agency: could not connect to host
codabix.com: did not receive HSTS header
codabix.de: could not connect to host
@ -719,6 +723,7 @@ coffeeetc.co.uk: did not receive HSTS header
coffeestrategies.com: max-age too low: 2592000
coiffeurschnittstelle.ch: did not receive HSTS header
coindam.com: could not connect to host
coldfff.com: could not connect to host
coldlostsick.net: could not connect to host
colisfrais.com: did not receive HSTS header
collies.eu: did not receive HSTS header
@ -817,6 +822,8 @@ curroapp.com: could not connect to host
custe.rs: could not connect to host
cuvva.insure: did not receive HSTS header
cyanogenmod.xxx: could not connect to host
cyberianhusky.com: could not connect to host
cyberpunk.ca: could not connect to host
cybersecuritychallenge.be: could not connect to host
cybershambles.com: could not connect to host
cycleluxembourg.lu: did not receive HSTS header
@ -887,7 +894,6 @@ decafu.co: could not connect to host
decibelios.li: could not connect to host
deco.me: could not connect to host
dedicatutiempo.es: could not connect to host
dee.pe: could not connect to host
deepcovelabs.net: could not connect to host
deepearth.uk: did not receive HSTS header
degroetenvanrosaline.nl: did not receive HSTS header
@ -995,6 +1001,7 @@ drishti.guru: could not connect to host
drive.google.com: did not receive HSTS header (error ignored - included regardless)
driving-lessons.co.uk: did not receive HSTS header
droidboss.com: could not connect to host
droncentrum.pl: could not connect to host
dropcam.com: did not receive HSTS header
drtroyhendrickson.com: could not connect to host
drumbandesperanto.nl: could not connect to host
@ -1007,8 +1014,6 @@ duesee.org: could not connect to host
dullsir.com: did not receive HSTS header
duria.de: max-age too low: 3600
dwhd.org: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsISiteSecurityService.processHeader]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: /builds/slave/m-cen-l64-periodicupdate-00000/getHSTSPreloadList.js :: processStsHeader :: line 121" data: no]
dwnld.me: could not connect to host
dworzak.ch: could not connect to host
dxa.io: could not connect to host
dycontrol.de: could not connect to host
dylanscott.com.au: did not receive HSTS header
@ -1017,6 +1022,7 @@ dzimejl.sk: did not receive HSTS header
dzlibs.io: could not connect to host
e-aut.net: could not connect to host
e-deca2.org: did not receive HSTS header
e-sa.com: did not receive HSTS header
earga.sm: could not connect to host
earlybirdsnacks.com: could not connect to host
earthrise16.com: could not connect to host
@ -1085,13 +1091,14 @@ emeldi-commerce.com: max-age too low: 0
emjainteractive.com: did not receive HSTS header
emmable.com: could not connect to host
emnitech.com: could not connect to host
empleosentorreon.mx: could not connect to host
empleostampico.com: did not receive HSTS header
enargia.jp: max-age too low: 0
encode.space: did not receive HSTS header
encoder.pw: could not connect to host
encrypted.google.com: did not receive HSTS header (error ignored - included regardless)
endzeit-architekten.com: did not receive HSTS header
engelwerbung.com: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsISiteSecurityService.processHeader]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: /builds/slave/m-cen-l64-periodicupdate-00000/getHSTSPreloadList.js :: processStsHeader :: line 121" data: no]
engelwerbung.com: did not receive HSTS header
enigmacpt.com: did not receive HSTS header
enigmail.net: did not receive HSTS header
enlatte.com: could not connect to host
@ -1134,6 +1141,7 @@ esquonic.com: could not connect to host
essexcosmeticdentists.co.uk: did not receive HSTS header
essexghosthunters.co.uk: did not receive HSTS header
estilosapeca.com: could not connect to host
estrietoit.com: could not connect to host
etdonline.co.uk: could not connect to host
eternitylove.us: could not connect to host
ethack.org: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsISiteSecurityService.processHeader]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: /builds/slave/m-cen-l64-periodicupdate-00000/getHSTSPreloadList.js :: processStsHeader :: line 121" data: no]
@ -1186,6 +1194,7 @@ fakeletters.org: did not receive HSTS header
falconfrag.com: could not connect to host
falkena.net: max-age too low: 5184000
falkp.no: did not receive HSTS header
fallenangelspirits.uk: could not connect to host
familie-zimmermann.at: could not connect to host
fanyl.cn: could not connect to host
fashioncare.cz: did not receive HSTS header
@ -1197,7 +1206,7 @@ fatherhood.gov: did not receive HSTS header
fatlossguide.xyz: could not connect to host
fatox.de: could not connect to host
fatwin.pw: could not connect to host
fawkex.me: did not receive HSTS header
fawkex.me: could not connect to host
fayolle.info: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsISiteSecurityService.processHeader]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: /builds/slave/m-cen-l64-periodicupdate-00000/getHSTSPreloadList.js :: processStsHeader :: line 121" data: no]
fbox.li: could not connect to host
fdj.im: could not connect to host
@ -1238,7 +1247,6 @@ first-time-offender.com: could not connect to host
firstforex.co.uk: did not receive HSTS header
fish2.me: did not receive HSTS header
fit4medien.de: did not receive HSTS header
fitbylo.com: could not connect to host
fitiapp.com: could not connect to host
fitnesswerk.de: could not connect to host
five.vn: did not receive HSTS header
@ -1290,13 +1298,11 @@ fr33d0m.link: could not connect to host
francescopalazzo.com: could not connect to host
francevpn.xyz: could not connect to host
frangor.info: did not receive HSTS header
frank.fyi: could not connect to host
franta.biz: did not receive HSTS header
franta.email: did not receive HSTS header
franzt.de: could not connect to host
frasys.io: max-age too low: 7776000
freeflow.tv: could not connect to host
freekdevries.nl: could not connect to host
freematthale.net: did not receive HSTS header
freemedforms.com: did not receive HSTS header
freesounding.com: could not connect to host
@ -1356,7 +1362,6 @@ gamers-life.fr: could not connect to host
gamerslair.org: did not receive HSTS header
gamesdepartment.co.uk: did not receive HSTS header
gamingmedia.eu: did not receive HSTS header
gamishou.fr: could not connect to host
gampenhof.de: did not receive HSTS header
gaptek.id: did not receive HSTS header
garciamartin.me: could not connect to host
@ -1437,7 +1442,6 @@ goggs.eu: could not connect to host
gogold-g.com: could not connect to host
gold24.in: did not receive HSTS header
goldendata.io: could not connect to host
goldminer.ga: could not connect to host
golocal-media.de: did not receive HSTS header
gonzalosanchez.mx: did not receive HSTS header
goodenough.nz: did not receive HSTS header
@ -1489,7 +1493,6 @@ gurusupe.com: could not connect to host
gussi.is: could not connect to host
gvt2.com: could not connect to host (error ignored - included regardless)
gvt3.com: could not connect to host (error ignored - included regardless)
gwerder.net: could not connect to host
gwijaya.com: could not connect to host
gwtest.us: could not connect to host
gxlrx.net: could not connect to host
@ -1525,7 +1528,6 @@ hanfu.la: could not connect to host
hannover-banditen.de: did not receive HSTS header
hao2taiwan.com: max-age too low: 0
haozi.me: did not receive HSTS header
happycoder.net: could not connect to host
happyfabric.me: did not receive HSTS header
happygadget.me: could not connect to host
harabuhouse.com: did not receive HSTS header
@ -1590,7 +1592,6 @@ hmm.nyc: could not connect to host
hn.search.yahoo.com: did not receive HSTS header
hoerbuecher-und-hoerspiele.de: could not connect to host
hogar123.es: could not connect to host
hohm.in: could not connect to host
hokieprivacy.org: could not connect to host
holifestival-freyung.de: could not connect to host
holymoly.lu: could not connect to host
@ -1632,6 +1633,7 @@ humpteedumptee.in: did not receive HSTS header
huntshomeinspections.com: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsISiteSecurityService.processHeader]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: /builds/slave/m-cen-l64-periodicupdate-00000/getHSTSPreloadList.js :: processStsHeader :: line 121" data: no]
hurricanelabs.com: did not receive HSTS header
huskybutt.dog: could not connect to host
huskyinc.us: could not connect to host
hycken.com: did not receive HSTS header
hydra.ws: could not connect to host
hyper69.com: did not receive HSTS header
@ -1662,7 +1664,6 @@ ies-italia.it: did not receive HSTS header
ies.id.lv: could not connect to host
ifad.org: did not receive HSTS header
ifleurs.com: could not connect to host
ifoss.me: could not connect to host
ignatisd.gr: did not receive HSTS header
ignitedmindz.in: could not connect to host
igule.net: could not connect to host
@ -1727,6 +1728,7 @@ intel.li: could not connect to host
intelldynamics.com: could not connect to host
interference.io: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsISiteSecurityService.processHeader]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: /builds/slave/m-cen-l64-periodicupdate-00000/getHSTSPreloadList.js :: processStsHeader :: line 121" data: no]
interlun.com: could not connect to host
internect.co.za: did not receive HSTS header
internetcasinos.de: did not receive HSTS header
internetcensus.org: could not connect to host
interserved.com: did not receive HSTS header
@ -1736,6 +1738,7 @@ intimtoy.com.ua: could not connect to host
inverselink-user-content.com: could not connect to host
inverselink.com: could not connect to host
inwesttitle.com: max-age too low: 0
iocheck.com: could not connect to host
ionx.co.uk: did not receive HSTS header
iop.intuit.com: max-age too low: 86400
iosmods.com: could not connect to host
@ -1856,7 +1859,7 @@ joedavison.me: could not connect to host
jogi-server.de: did not receive HSTS header
johners.me: could not connect to host
johners.tech: did not receive HSTS header
johnhgaunt.com: could not connect to host
johnhgaunt.com: did not receive HSTS header
johnrom.com: did not receive HSTS header
jonas-keidel.de: did not receive HSTS header
jonasgroth.se: max-age too low: 2592000
@ -1870,7 +1873,6 @@ josahrens.me: could not connect to host
joshstroup.me: could not connect to host
jottit.com: could not connect to host
jpbike.cz: could not connect to host
jpcdi.com: could not connect to host
jrc9.ca: did not receive HSTS header
jrgold.me: could not connect to host
jrvar.com: did not receive HSTS header
@ -1966,18 +1968,17 @@ klauwd.com: did not receive HSTS header
klaxn.org: could not connect to host
kleertjesvoordelig.nl: could not connect to host
kleinblogje.nl: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsISiteSecurityService.processHeader]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: /builds/slave/m-cen-l64-periodicupdate-00000/getHSTSPreloadList.js :: processStsHeader :: line 121" data: no]
kleppe.co: could not connect to host
kletterkater.com: did not receive HSTS header
klicktojob.de: could not connect to host
kmartin.io: did not receive HSTS header
knccloud.com: could not connect to host
knowledgesnap.com: did not receive HSTS header
kodokushi.fr: could not connect to host
koen.io: did not receive HSTS header
koenrouwhorst.nl: did not receive HSTS header
kollabria.com: max-age too low: 0
kollabria.com: could not connect to host
komikito.com: could not connect to host
kompetenzwerft.de: did not receive HSTS header
konsertoversikt.no: could not connect to host
kontaxis.network: could not connect to host
kontorhaus-schlachte.de: could not connect to host
koop-bremen.de: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsISiteSecurityService.processHeader]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: /builds/slave/m-cen-l64-periodicupdate-00000/getHSTSPreloadList.js :: processStsHeader :: line 121" data: no]
@ -2159,6 +2160,7 @@ lt.search.yahoo.com: did not receive HSTS header
ltbytes.com: could not connect to host
lu.search.yahoo.com: did not receive HSTS header
lucidlogs.com: could not connect to host
luelistan.net: could not connect to host
luine.xyz: could not connect to host
luis-checa.com: could not connect to host
lukas.im: did not receive HSTS header
@ -2174,6 +2176,7 @@ luoxiao.im: could not connect to host
lusis.fr: did not receive HSTS header
lusis.net: did not receive HSTS header
lustrumxi.nl: did not receive HSTS header
luukdebruincv.nl: could not connect to host
luxus-russen.de: did not receive HSTS header
luxwatch.com: could not connect to host
lv.search.yahoo.com: did not receive HSTS header
@ -2181,6 +2184,7 @@ lzkill.com: could not connect to host
m-ali.xyz: did not receive HSTS header
m.gparent.org: could not connect to host
m.nu: did not receive HSTS header
m2tc.fr: could not connect to host
m3-gmbh.de: did not receive HSTS header
m82labs.com: did not receive HSTS header
maarten.nyc: did not receive HSTS header
@ -2204,6 +2208,7 @@ maildragon.com: could not connect to host
makeitdynamic.com: could not connect to host
makerstuff.net: did not receive HSTS header
malerversand.de: did not receive HSTS header
malinator.net: could not connect to host
malwre.io: could not connect to host
mamaison.io: could not connect to host
mamaxi.org: did not receive HSTS header
@ -2261,7 +2266,7 @@ mclab.su: could not connect to host
mdewendt.de: could not connect to host
mdfnet.se: did not receive HSTS header
mdscomp.net: did not receive HSTS header
mea.in.ua: did not receive HSTS header
mea.in.ua: could not connect to host
mechanus.io: max-age too low: 2592000
medallia.io: could not connect to host
media-courses.com: did not receive HSTS header
@ -2314,7 +2319,6 @@ micro-dv.ru: could not connect to host
microme.ga: could not connect to host
micropple.net: could not connect to host
midwestwomenworkers.org: did not receive HSTS header
migeeks.de: could not connect to host
mightydicks.io: could not connect to host
mightydicks.tech: could not connect to host
mightysounds.cz: max-age too low: 0
@ -2335,7 +2339,7 @@ minecraftserverz.com: could not connect to host
minecraftvoter.com: could not connect to host
minikneet.nl: did not receive HSTS header
minnesotadata.com: could not connect to host
mipla.ch: could not connect to host
minora.io: could not connect to host
miragrow.com: could not connect to host
mirindadomo.ru: did not receive HSTS header
mironized.com: did not receive HSTS header
@ -2345,7 +2349,6 @@ mister.hosting: could not connect to host
misterl.net: did not receive HSTS header
mitchellrenouf.ca: could not connect to host
mittenhacks.com: could not connect to host
miui-germany.de: could not connect to host
mivcon.net: could not connect to host
miyoshi-kikaku.co.jp: did not receive HSTS header
miyoshi-kikaku.com: did not receive HSTS header
@ -2374,7 +2377,7 @@ monarca.systems: could not connect to host
monasterialis.eu: could not connect to host
mondar.io: could not connect to host
mondopoint.com: could not connect to host
moneycrownmedia.com: did not receive HSTS header
moneycrownmedia.com: could not connect to host
monitman.com: could not connect to host
montenero.pl: could not connect to host
moon.lc: could not connect to host
@ -2389,7 +2392,7 @@ morningcalculation.com: could not connect to host
morotech.com.br: max-age too low: 2592000
morpork.xyz: could not connect to host
mortgagecentersmo.com: did not receive HSTS header
morz.org: did not receive HSTS header
morz.org: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsISiteSecurityService.processHeader]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: /builds/slave/m-cen-l64-periodicupdate-00000/getHSTSPreloadList.js :: processStsHeader :: line 121" data: no]
mostwuat.com: could not connect to host
motherbase.io: could not connect to host
motionpicturesolutions.com: could not connect to host
@ -2468,14 +2471,11 @@ narada.com.ua: could not connect to host
nargileh.nl: could not connect to host
natalia.io: could not connect to host
natalt.org: did not receive HSTS header
nathan.io: could not connect to host
nathanmfarrugia.com: did not receive HSTS header
naturesystems.cz: max-age too low: 0
natuurbehangnederland.nl: could not connect to host
nauck.org: did not receive HSTS header
nav.jobs: could not connect to host
naval.tf: could not connect to host
navenlle.com: did not receive HSTS header
navigate-it-services.de: max-age too low: 0
navjobs.com: did not receive HSTS header
nbb.io: could not connect to host
@ -2530,7 +2530,6 @@ nibiisclaim.com: could not connect to host
nicestresser.fr: could not connect to host
nicky.io: did not receive HSTS header
nicoborghuis.nl: could not connect to host
nicocourts.com: did not receive HSTS header
nicolasbettag.me: could not connect to host
niconiconi.xyz: could not connect to host
niconode.com: could not connect to host
@ -2630,7 +2629,6 @@ oliver-pietsch.de: did not receive HSTS header
oliverdunk.com: did not receive HSTS header
ollehbizev.co.kr: could not connect to host
ollie.io: did not receive HSTS header
ollies.cloud: could not connect to host
omgaanmetidealen.com: could not connect to host
ominto.com: max-age too low: 0
omniasl.com: could not connect to host
@ -2689,6 +2687,7 @@ orionfcu.com: did not receive HSTS header
orleika.ml: could not connect to host
osaiyuwu.com: could not connect to host
oslfoundation.org: could not connect to host
oslinux.net: could not connect to host
osp.cx: could not connect to host
ossan-kobe-gourmet.com: did not receive HSTS header
ossbinaries.com: could not connect to host
@ -2730,7 +2729,6 @@ paisaone.com: did not receive HSTS header
paku.me: could not connect to host
pamsoft.pl: max-age too low: 0
panaceallc.net: could not connect to host
panamateakforestry.com: could not connect to host
pantsu.cat: did not receive HSTS header
papeda.net: did not receive HSTS header
papercard.co.uk: did not receive HSTS header
@ -2742,6 +2740,7 @@ parodybit.net: [Exception... "Component returned failure code: 0x80004005 (NS_ER
parpaing-paillette.net: could not connect to host
particonpsplus.it: could not connect to host
partijtjevoordevrijheid.nl: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsISiteSecurityService.processHeader]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: /builds/slave/m-cen-l64-periodicupdate-00000/getHSTSPreloadList.js :: processStsHeader :: line 121" data: no]
partou.de: did not receive HSTS header
partyvan.it: could not connect to host
partyvan.moe: could not connect to host
partyvan.nl: could not connect to host
@ -2757,6 +2756,7 @@ pastenib.com: could not connect to host
paster.li: did not receive HSTS header
pastie.se: could not connect to host
patientinsight.net: could not connect to host
patrz.eu: could not connect to host
patt.us: did not receive HSTS header
patterson.mp: could not connect to host
paul-kerebel.pro: did not receive HSTS header
@ -2772,6 +2772,7 @@ pbprint.ru: max-age too low: 0
pc-nf.de: did not receive HSTS header
pcfun.net: could not connect to host
pchax.net: could not connect to host
pdf.yt: could not connect to host
pebblesdemo.com: could not connect to host
peissen.com: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsISiteSecurityService.processHeader]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: /builds/slave/m-cen-l64-periodicupdate-00000/getHSTSPreloadList.js :: processStsHeader :: line 121" data: no]
pekkapikkarainen.fi: could not connect to host
@ -2800,7 +2801,6 @@ pettsy.com: could not connect to host
pewboards.com: could not connect to host
pgpm.io: could not connect to host
pharmgkb.org: could not connect to host
philadelphia.com.mx: could not connect to host
phonenumberinfo.co.uk: could not connect to host
phongmay24h.com: could not connect to host
phurl.de: could not connect to host
@ -2813,10 +2813,9 @@ piligrimname.com: could not connect to host
pillowandpepper.com: did not receive HSTS header
pinesandneedles.com: did not receive HSTS header
pippen.io: could not connect to host
pir9.com: max-age too low: 2592000
piratedb.com: could not connect to host
piratedot.com: could not connect to host
piratelist.online: could not connect to host
piratelist.online: did not receive HSTS header
piratenlogin.de: could not connect to host
pirati.cz: max-age too low: 604800
pirlitu.com: did not receive HSTS header
@ -2836,7 +2835,6 @@ placollection.org: could not connect to host
plaettliaktion.ch: did not receive HSTS header
plaintray.com: could not connect to host
platform.lookout.com: could not connect to host
plattner.club: could not connect to host
play.google.com: did not receive HSTS header (error ignored - included regardless)
playkh.com: did not receive HSTS header
playmaker.io: could not connect to host
@ -2866,6 +2864,8 @@ poolsandstuff.com: did not receive HSTS header
poon.tech: could not connect to host
poris.web.id: did not receive HSTS header
portalplatform.net: did not receive HSTS header
portalzine.de: did not receive HSTS header
positivesobrietyinstitute.com: did not receive HSTS header
postcodewise.co.uk: did not receive HSTS header
posterspy.com: did not receive HSTS header
postscheduler.org: could not connect to host
@ -2887,6 +2887,7 @@ prelist.org: did not receive HSTS header
pressfreedomfoundation.org: did not receive HSTS header
preworkout.me: could not connect to host
prezola.com: did not receive HSTS header
princesparktouch.com: could not connect to host
printfn.com: could not connect to host
priolkar.com: did not receive HSTS header
priva.si: could not connect to host
@ -2902,7 +2903,6 @@ profundr.com: could not connect to host
progblog.net: could not connect to host
progg.no: could not connect to host
prohostonline.fi: could not connect to host
prok.pw: could not connect to host
promecon-gmbh.de: did not receive HSTS header
prontolight.com: did not receive HSTS header
prontomovers.co.uk: could not connect to host
@ -2914,7 +2914,7 @@ proximato.com: could not connect to host
proxybay.al: could not connect to host
proxybay.club: could not connect to host
proxybay.info: did not receive HSTS header
prxio.site: did not receive HSTS header
prxio.site: could not connect to host
prytkov.com: did not receive HSTS header
psw.academy: did not receive HSTS header
psw.consulting: did not receive HSTS header
@ -2952,7 +2952,7 @@ queercoders.com: did not receive HSTS header
questsandrewards.com: could not connect to host
quotehex.com: could not connect to host
quranserver.net: could not connect to host
qvi.st: did not receive HSTS header
qvi.st: could not connect to host
qwaser.fr: could not connect to host
qwilink.me: did not receive HSTS header
r10n.com: did not receive HSTS header
@ -3014,7 +3014,6 @@ renrenss.com: did not receive HSTS header
rent-a-coder.de: did not receive HSTS header
rentcarassist.com: could not connect to host
renteater.com: could not connect to host
repaxan.com: could not connect to host
replacemychina.com: did not receive HSTS header
reprolife.co.uk: max-age too low: 0
res-rheingau.de: did not receive HSTS header
@ -3069,12 +3068,13 @@ roeper.party: could not connect to host
roesemann.email: could not connect to host
rolemaster.net: could not connect to host
romans-place.me.uk: did not receive HSTS header
ronvandordt.info: did not receive HSTS header
ronvandordt.info: could not connect to host
ronwo.de: max-age too low: 1
room-checkin24.de: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsISiteSecurityService.processHeader]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: /builds/slave/m-cen-l64-periodicupdate-00000/getHSTSPreloadList.js :: processStsHeader :: line 121" data: no]
rootforum.org: did not receive HSTS header
rootservice.org: did not receive HSTS header
rootwpn.com: could not connect to host
rosewoodranch.com: did not receive HSTS header
rotterdamjazz.info: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsISiteSecurityService.processHeader]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: /builds/slave/m-cen-l64-periodicupdate-00000/getHSTSPreloadList.js :: processStsHeader :: line 121" data: no]
roundtheme.com: did not receive HSTS header
rous.se: could not connect to host
@ -3116,6 +3116,7 @@ safematix.com: could not connect to host
safic.net: could not connect to host
sageth.com: max-age too low: 0
sah3.net: could not connect to host
sairai.bid: did not receive HSTS header
sakaki.anime.my: max-age too low: 5184000
sakaserver.com: did not receive HSTS header
salesmachine.io: did not receive HSTS header
@ -3166,6 +3167,7 @@ scrapings.net: could not connect to host
screencaster.io: did not receive HSTS header
screenresolution.space: could not connect to host
scribe.systems: could not connect to host
scrion.com: did not receive HSTS header
script.google.com: did not receive HSTS header (error ignored - included regardless)
scriptict.nl: could not connect to host
sdmoscow.ru: could not connect to host
@ -3173,8 +3175,10 @@ sdrobs.com: did not receive HSTS header
sdsl-speedtest.de: could not connect to host
search-one.de: did not receive HSTS header
sebastian-lutsch.de: could not connect to host
sebster.com: did not receive HSTS header
secandtech.com: could not connect to host
secondpay.nl: did not receive HSTS header
secpatrol.de: could not connect to host
sectia22.ro: could not connect to host
sectun.com: did not receive HSTS header
secure-games.us: could not connect to host
@ -3194,6 +3198,7 @@ sehenderson.com: did not receive HSTS header
seiko-dojo.com: could not connect to host
selecadm.name: could not connect to host
selectruckscalltrackingreports.com: could not connect to host
selent.me: did not receive HSTS header
selfcarecentral.com: did not receive HSTS header
selfie-france.fr: could not connect to host
selldorado.com: did not receive HSTS header
@ -3262,7 +3267,6 @@ silverpvp.com: could not connect to host
silverwind.io: did not receive HSTS header
simbast.com: could not connect to host
simod.org: could not connect to host
simon-hofmann.org: could not connect to host
simon.butcher.name: max-age too low: 2629743
simongong.net: did not receive HSTS header
simonkjellberg.se: could not connect to host
@ -3394,8 +3398,8 @@ sqzryang.com: did not receive HSTS header
srevilak.net: did not receive HSTS header
srna.sk: could not connect to host
srrr.ca: could not connect to host
ss.wtf: did not receive HSTS header
ssersay.com: max-age too low: 0
ss.wtf: could not connect to host
ssersay.com: could not connect to host
ssl.panoramio.com: did not receive HSTS header
ssl.rip: could not connect to host
ssmato.me: could not connect to host
@ -3447,6 +3451,7 @@ studentresearcher.org: did not receive HSTS header
studentrightsadvocate.org: could not connect to host
studentskydenik.cz: could not connect to host
studenttravel.cz: did not receive HSTS header
studienportal.eu: could not connect to host
studybay.com: did not receive HSTS header
studydrive.net: did not receive HSTS header
stugb.de: did not receive HSTS header
@ -3460,7 +3465,6 @@ succ.in: could not connect to host
sudo.li: did not receive HSTS header
suian.or.jp: max-age too low: 86400
suite73.org: could not connect to host
suki.moe: did not receive HSTS header
suksit.com: could not connect to host
sumoatm.com: did not receive HSTS header
sumoscout.de: did not receive HSTS header
@ -3510,6 +3514,7 @@ tadigitalstore.com: could not connect to host
tafoma.com: did not receive HSTS header
tageau.com: could not connect to host
taglondon.org: did not receive HSTS header
tahf.net: could not connect to host
tails.com.ar: did not receive HSTS header
taken.pl: could not connect to host
talk.google.com: did not receive HSTS header (error ignored - included regardless)
@ -3607,6 +3612,7 @@ thepiratebay.al: could not connect to host
thepiratebay.tech: could not connect to host
therapyportal.com: did not receive HSTS header
therewill.be: could not connect to host
theseoframework.com: did not receive HSTS header
thestack.xyz: could not connect to host
thestagchorleywood.co.uk: did not receive HSTS header
thetomharling.com: max-age too low: 86400
@ -3638,7 +3644,6 @@ tikutiku.pl: max-age too low: 0
tildebot.com: could not connect to host
tillcraft.com: could not connect to host
timbeilby.com: could not connect to host
timbuktutimber.com: could not connect to host
timcamara.com: did not receive HSTS header
time-river.xyz: could not connect to host
timestamp.io: did not receive HSTS header
@ -3673,10 +3678,10 @@ tomberek.info: could not connect to host
tomeara.net: could not connect to host
tomharling.co.uk: max-age too low: 86400
tomharling.uk: max-age too low: 86400
tomharris.tech: could not connect to host
tomlankhorst.nl: did not receive HSTS header
tomli.me: could not connect to host
tommsy.com: did not receive HSTS header
tommyads.com: could not connect to host
tonburi.jp: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsISiteSecurityService.processHeader]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: /builds/slave/m-cen-l64-periodicupdate-00000/getHSTSPreloadList.js :: processStsHeader :: line 121" data: no]
tonyfantjr.com: could not connect to host
toomanypillows.com: could not connect to host
@ -3717,7 +3722,6 @@ ts2.se: did not receive HSTS header
tsecy.com: did not receive HSTS header
tsgoc.com: did not receive HSTS header
tssouthernpower.com: max-age too low: 0
tucny.com: could not connect to host
tuingereedschappen.net: could not connect to host
tunai.id: could not connect to host
turnik-67.ru: could not connect to host
@ -3756,7 +3760,7 @@ ublox.com: did not receive HSTS header
ubuntuhot.com: did not receive HSTS header
uega.net: did not receive HSTS header
ufgaming.com: did not receive HSTS header
ufotable.uk: max-age too low: 0
ufotable.uk: could not connect to host
ui8.net: max-age too low: 86400
ukas.com: did not receive HSTS header
ukdropshipment.co.uk: did not receive HSTS header
@ -3809,7 +3813,6 @@ userify.com: did not receive HSTS header
ustr.gov: max-age too low: 86400
utleieplassen.no: could not connect to host
utopiagalaxy.space: did not receive HSTS header
utopianhomespa.com: could not connect to host
utumno.ch: could not connect to host
uvarov.pw: did not receive HSTS header
uy.search.yahoo.com: did not receive HSTS header
@ -3854,8 +3857,8 @@ videomuz.com: did not receive HSTS header
vidz.ga: could not connect to host
vieaw.com: could not connect to host
viewsea.com: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsISiteSecurityService.processHeader]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: /builds/slave/m-cen-l64-periodicupdate-00000/getHSTSPreloadList.js :: processStsHeader :: line 121" data: no]
vikings.net: could not connect to host
viktorsvantesson.net: did not receive HSTS header
villasenor.online: could not connect to host
vincentkooijman.at: did not receive HSTS header
vincentkooijman.nl: did not receive HSTS header
vintageheartcoffee.com: did not receive HSTS header
@ -3918,6 +3921,7 @@ weaverhairextensions.nl: could not connect to host
web4all.fr: max-age too low: 0
web4pro.fr: max-age too low: 0
webandwords.com.au: could not connect to host
webapps.directory: could not connect to host
webassadors.com: could not connect to host
webdesign-kronberg.de: did not receive HSTS header
webdev.mobi: could not connect to host
@ -4015,7 +4019,7 @@ wsscompany.com.ve: could not connect to host
wufu.org: did not receive HSTS header
wuhengmin.com: did not receive HSTS header
wurzelzwerg.net: could not connect to host
wvg.myds.me: could not connect to host
wv-n.de: did not receive HSTS header
www.apollo-auto.com: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsISiteSecurityService.processHeader]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: /builds/slave/m-cen-l64-periodicupdate-00000/getHSTSPreloadList.js :: processStsHeader :: line 121" data: no]
www.braintreepayments.com: did not receive HSTS header
www.calyxinstitute.org: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsISiteSecurityService.processHeader]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: /builds/slave/m-cen-l64-periodicupdate-00000/getHSTSPreloadList.js :: processStsHeader :: line 121" data: no]
@ -4060,6 +4064,7 @@ xichtsbuch.de: could not connect to host
ximens.me: did not receive HSTS header
xisa.it: could not connect to host
xiyu.moe: could not connect to host
xmonk.org: did not receive HSTS header
xn--4dbjwf8c.cf: could not connect to host
xn--4dbjwf8c.ga: could not connect to host
xn--4dbjwf8c.gq: could not connect to host
@ -4094,7 +4099,6 @@ xyndrac.net: did not receive HSTS header
y-o-w.com: did not receive HSTS header
y-s.pw: did not receive HSTS header
yabrt.cn: could not connect to host
yahvehyireh.com: did not receive HSTS header
yamaken.jp: did not receive HSTS header
yamamo10.com: could not connect to host
yaporn.tv: did not receive HSTS header

File diff suppressed because it is too large Load Diff

View File

@ -759,10 +759,8 @@ class AddonValidator extends CollectionValidator {
getClientItems() {
return Promise.all([
new Promise(resolve =>
AddonManager.getAllAddons(resolve)),
new Promise(resolve =>
AddonManager.getAddonsWithOperationsByTypes(["extension", "theme"], resolve)),
AddonManager.getAllAddons(),
AddonManager.getAddonsWithOperationsByTypes(["extension", "theme"]),
]).then(([installed, addonsWithPendingOperation]) => {
// Addons pending install won't be in the first list, but addons pending
// uninstall/enable/disable will be in both lists.

View File

@ -703,14 +703,12 @@ ErrorHandler.prototype = {
_dumpAddons: function _dumpAddons() {
// Just dump the items that sync may be concerned with. Specifically,
// active extensions that are not hidden.
let addonPromise = new Promise(resolve => {
try {
AddonManager.getAddonsByTypes(["extension"], resolve);
} catch (e) {
this._log.warn("Failed to dump addons", e)
resolve([])
}
});
let addonPromise = Promise.resolve([]);
try {
addonPromise = AddonManager.getAddonsByTypes(["extension"]);
} catch (e) {
this._log.warn("Failed to dump addons", e)
}
return addonPromise.then(addons => {
let relevantAddons = addons.filter(x => x.isActive && !x.hidden);

View File

@ -24,12 +24,3 @@
[SVGSVGElement.prototype.useCurrentView must be removed]
expected: FAIL
[SVGPathElement.prototype.getPointAtLength must be moved to SVGGeometryElement.prototype]
expected: FAIL
[SVGPathElement.prototype.getTotalLength must be moved to SVGGeometryElement.prototype]
expected: FAIL
[SVGPathElement.prototype.pathLength must be moved to SVGGeometryElement.prototype]
expected: FAIL

View File

@ -1,20 +1,5 @@
[interfaces.html]
type: testharness
[SVGGeometryElement interface: existence and properties of interface object]
expected: FAIL
[SVGGeometryElement interface object length]
expected: FAIL
[SVGGeometryElement interface object name]
expected: FAIL
[SVGGeometryElement interface: existence and properties of interface prototype object]
expected: FAIL
[SVGGeometryElement interface: existence and properties of interface prototype object's "constructor" property]
expected: FAIL
[SVGGeometryElement interface: operation isPointInFill(DOMPoint)]
expected: FAIL
@ -306,19 +291,13 @@
[SVGTransform interface: svg.createSVGTransform() must inherit property "matrix" with the proper type (8)]
expected: FAIL
[SVGPathElement interface: existence and properties of interface object]
expected: FAIL
[SVGPathElement interface: existence and properties of interface prototype object]
expected: FAIL
[SVGGeometryElement interface: path must inherit property "isPointInFill" with the proper type (0)]
[SVGGeometryElement interface: path must inherit property "isPointInFill" with the proper type (1)]
expected: FAIL
[SVGGeometryElement interface: calling isPointInFill(DOMPoint) on path with too few arguments must throw TypeError]
expected: FAIL
[SVGGeometryElement interface: path must inherit property "isPointInStroke" with the proper type (1)]
[SVGGeometryElement interface: path must inherit property "isPointInStroke" with the proper type (2)]
expected: FAIL
[SVGGeometryElement interface: calling isPointInStroke(DOMPoint) on path with too few arguments must throw TypeError]
@ -348,13 +327,25 @@
[SVGRectElement interface: existence and properties of interface prototype object]
expected: FAIL
[SVGGeometryElement interface: rect must inherit property "isPointInFill" with the proper type (0)]
[SVGGeometryElement interface: rect must inherit property "pathLength" with the proper type (0)]
expected: FAIL
[SVGGeometryElement interface: rect must inherit property "isPointInFill" with the proper type (1)]
expected: FAIL
[SVGGeometryElement interface: calling isPointInFill(DOMPoint) on rect with too few arguments must throw TypeError]
expected: FAIL
[SVGGeometryElement interface: rect must inherit property "isPointInStroke" with the proper type (1)]
[SVGGeometryElement interface: rect must inherit property "isPointInStroke" with the proper type (2)]
expected: FAIL
[SVGGeometryElement interface: rect must inherit property "getTotalLength" with the proper type (3)]
expected: FAIL
[SVGGeometryElement interface: rect must inherit property "getPointAtLength" with the proper type (4)]
expected: FAIL
[SVGGeometryElement interface: calling getPointAtLength(float) on rect with too few arguments must throw TypeError]
expected: FAIL
[SVGGeometryElement interface: calling isPointInStroke(DOMPoint) on rect with too few arguments must throw TypeError]
@ -384,18 +375,30 @@
[SVGCircleElement interface: existence and properties of interface prototype object]
expected: FAIL
[SVGGeometryElement interface: circle must inherit property "isPointInFill" with the proper type (0)]
[SVGGeometryElement interface: circle must inherit property "pathLength" with the proper type (0)]
expected: FAIL
[SVGGeometryElement interface: circle must inherit property "isPointInFill" with the proper type (1)]
expected: FAIL
[SVGGeometryElement interface: calling isPointInFill(DOMPoint) on circle with too few arguments must throw TypeError]
expected: FAIL
[SVGGeometryElement interface: circle must inherit property "isPointInStroke" with the proper type (1)]
[SVGGeometryElement interface: circle must inherit property "isPointInStroke" with the proper type (2)]
expected: FAIL
[SVGGeometryElement interface: calling isPointInStroke(DOMPoint) on circle with too few arguments must throw TypeError]
expected: FAIL
[SVGGeometryElement interface: circle must inherit property "getTotalLength" with the proper type (3)]
expected: FAIL
[SVGGeometryElement interface: circle must inherit property "getPointAtLength" with the proper type (4)]
expected: FAIL
[SVGGeometryElement interface: calling getPointAtLength(float) on circle with too few arguments must throw TypeError]
expected: FAIL
[SVGElement interface: circle must inherit property "onautocomplete" with the proper type (8)]
expected: FAIL
@ -420,18 +423,30 @@
[SVGEllipseElement interface: existence and properties of interface prototype object]
expected: FAIL
[SVGGeometryElement interface: ellipse must inherit property "isPointInFill" with the proper type (0)]
[SVGGeometryElement interface: ellipse must inherit property "pathLength" with the proper type (0)]
expected: FAIL
[SVGGeometryElement interface: ellipse must inherit property "isPointInFill" with the proper type (1)]
expected: FAIL
[SVGGeometryElement interface: calling isPointInFill(DOMPoint) on ellipse with too few arguments must throw TypeError]
expected: FAIL
[SVGGeometryElement interface: ellipse must inherit property "isPointInStroke" with the proper type (1)]
[SVGGeometryElement interface: ellipse must inherit property "isPointInStroke" with the proper type (2)]
expected: FAIL
[SVGGeometryElement interface: calling isPointInStroke(DOMPoint) on ellipse with too few arguments must throw TypeError]
expected: FAIL
[SVGGeometryElement interface: ellipse must inherit property "getTotalLength" with the proper type (3)]
expected: FAIL
[SVGGeometryElement interface: ellipse must inherit property "getPointAtLength" with the proper type (4)]
expected: FAIL
[SVGGeometryElement interface: calling getPointAtLength(float) on ellipse with too few arguments must throw TypeError]
expected: FAIL
[SVGElement interface: ellipse must inherit property "onautocomplete" with the proper type (8)]
expected: FAIL
@ -456,18 +471,30 @@
[SVGLineElement interface: existence and properties of interface prototype object]
expected: FAIL
[SVGGeometryElement interface: line must inherit property "isPointInFill" with the proper type (0)]
[SVGGeometryElement interface: line must inherit property "pathLength" with the proper type (0)]
expected: FAIL
[SVGGeometryElement interface: line must inherit property "isPointInFill" with the proper type (1)]
expected: FAIL
[SVGGeometryElement interface: calling isPointInFill(DOMPoint) on line with too few arguments must throw TypeError]
expected: FAIL
[SVGGeometryElement interface: line must inherit property "isPointInStroke" with the proper type (1)]
[SVGGeometryElement interface: line must inherit property "isPointInStroke" with the proper type (2)]
expected: FAIL
[SVGGeometryElement interface: calling isPointInStroke(DOMPoint) on line with too few arguments must throw TypeError]
expected: FAIL
[SVGGeometryElement interface: line must inherit property "getTotalLength" with the proper type (3)]
expected: FAIL
[SVGGeometryElement interface: line must inherit property "getPointAtLength" with the proper type (4)]
expected: FAIL
[SVGGeometryElement interface: calling getPointAtLength(float) on line with too few arguments must throw TypeError]
expected: FAIL
[SVGElement interface: line must inherit property "onautocomplete" with the proper type (8)]
expected: FAIL
@ -492,18 +519,30 @@
[SVGPolylineElement interface: existence and properties of interface prototype object]
expected: FAIL
[SVGGeometryElement interface: polyline must inherit property "isPointInFill" with the proper type (0)]
[SVGGeometryElement interface: polyline must inherit property "pathLength" with the proper type (0)]
expected: FAIL
[SVGGeometryElement interface: polyline must inherit property "isPointInFill" with the proper type (1)]
expected: FAIL
[SVGGeometryElement interface: calling isPointInFill(DOMPoint) on polyline with too few arguments must throw TypeError]
expected: FAIL
[SVGGeometryElement interface: polyline must inherit property "isPointInStroke" with the proper type (1)]
[SVGGeometryElement interface: polyline must inherit property "isPointInStroke" with the proper type (2)]
expected: FAIL
[SVGGeometryElement interface: calling isPointInStroke(DOMPoint) on polyline with too few arguments must throw TypeError]
expected: FAIL
[SVGGeometryElement interface: polyline must inherit property "getTotalLength" with the proper type (3)]
expected: FAIL
[SVGGeometryElement interface: polyline must inherit property "getPointAtLength" with the proper type (4)]
expected: FAIL
[SVGGeometryElement interface: calling getPointAtLength(float) on polyline with too few arguments must throw TypeError]
expected: FAIL
[SVGElement interface: polyline must inherit property "onautocomplete" with the proper type (8)]
expected: FAIL
@ -528,18 +567,30 @@
[SVGPolygonElement interface: existence and properties of interface prototype object]
expected: FAIL
[SVGGeometryElement interface: polygon must inherit property "isPointInFill" with the proper type (0)]
[SVGGeometryElement interface: polygon must inherit property "pathLength" with the proper type (0)]
expected: FAIL
[SVGGeometryElement interface: polygon must inherit property "isPointInFill" with the proper type (1)]
expected: FAIL
[SVGGeometryElement interface: calling isPointInFill(DOMPoint) on polygon with too few arguments must throw TypeError]
expected: FAIL
[SVGGeometryElement interface: polygon must inherit property "isPointInStroke" with the proper type (1)]
[SVGGeometryElement interface: polygon must inherit property "isPointInStroke" with the proper type (2)]
expected: FAIL
[SVGGeometryElement interface: calling isPointInStroke(DOMPoint) on polygon with too few arguments must throw TypeError]
expected: FAIL
[SVGGeometryElement interface: polygon must inherit property "getTotalLength" with the proper type (3)]
expected: FAIL
[SVGGeometryElement interface: polygon must inherit property "getPointAtLength" with the proper type (4)]
expected: FAIL
[SVGGeometryElement interface: calling getPointAtLength(float) on polygon with too few arguments must throw TypeError]
expected: FAIL
[SVGElement interface: polygon must inherit property "onautocomplete" with the proper type (8)]
expected: FAIL
@ -1557,15 +1608,6 @@
[SVGElement interface: feTurbulence must inherit property "onsort" with the proper type (62)]
expected: FAIL
[SVGGeometryElement interface: attribute pathLength]
expected: FAIL
[SVGGeometryElement interface: operation getTotalLength()]
expected: FAIL
[SVGGeometryElement interface: operation getPointAtLength(float)]
expected: FAIL
[SVGGeometryElement interface: path must inherit property "isPointInFill" with the proper type (1)]
expected: FAIL

View File

@ -134,6 +134,83 @@ add_task(function* test_error_resume() {
chromeScript.destroy();
});
// Test that response header modifications take effect before onStartRequest fires.
add_task(function* test_set_responseHeaders() {
let extension = ExtensionTestUtils.loadExtension({
manifest: {
permissions: [
"webRequest",
"webRequestBlocking",
"http://example.com/",
],
},
background() {
browser.webRequest.onHeadersReceived.addListener(
details => {
browser.test.log(`onHeadersReceived({url: ${details.url}})`);
details.responseHeaders.push({name: "foo", value: "bar"});
return {responseHeaders: details.responseHeaders};
},
{urls: ["http://example.com/?modify_headers"]},
["blocking", "responseHeaders"]);
},
});
yield extension.startup();
yield new Promise(resolve => setTimeout(resolve, 0));
let chromeScript = SpecialPowers.loadChromeScript(() => {
const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
Cu.import("resource://gre/modules/NetUtil.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
let ssm = Services.scriptSecurityManager;
let channel = NetUtil.newChannel({
uri: "http://example.com/?modify_headers",
loadingPrincipal: ssm.createCodebasePrincipalFromOrigin("http://example.com"),
contentPolicyType: Ci.nsIContentPolicy.TYPE_XMLHTTPREQUEST,
securityFlags: Ci.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL,
});
channel.asyncOpen2({
QueryInterface: XPCOMUtils.generateQI([Ci.nsIStreamListener]),
onStartRequest(request, context) {
request.QueryInterface(Ci.nsIHttpChannel);
try {
sendAsyncMessage("response-header-foo", request.getResponseHeader("foo"));
} catch (e) {
sendAsyncMessage("response-header-foo", null);
}
request.cancel(Cr.NS_BINDING_ABORTED);
},
onStopRequest() {
},
onDataAvailable() {
throw new Components.Exception("", Cr.NS_ERROR_FAILURE);
},
});
});
let headerValue = yield chromeScript.promiseOneMessage("response-header-foo");
is(headerValue, "bar", "Expected Foo header value");
yield extension.unload();
chromeScript.destroy();
});
</script>
</body>
</html>

View File

@ -6,7 +6,6 @@ Cu.import("resource://gre/modules/AddonManager.jsm");
Cu.import("resource://testing-common/AddonTestUtils.jsm");
Cu.import("resource://testing-common/MockRegistrar.jsm");
const {promiseAddonByID} = AddonTestUtils;
const id = "uninstall_self_test@tests.mozilla.com";
const manifest = {
@ -64,7 +63,7 @@ add_task(function* test_management_uninstall_no_prompt() {
});
yield extension.startup();
let addon = yield promiseAddonByID(id);
let addon = yield AddonManager.getAddonByID(id);
notEqual(addon, null, "Add-on is installed");
extension.sendMessage("uninstall");
yield waitForUninstalled();
@ -88,7 +87,7 @@ add_task(function* test_management_uninstall_prompt_uninstall() {
});
yield extension.startup();
let addon = yield promiseAddonByID(id);
let addon = yield AddonManager.getAddonByID(id);
notEqual(addon, null, "Add-on is installed");
extension.sendMessage("uninstall");
yield waitForUninstalled();
@ -124,11 +123,11 @@ add_task(function* test_management_uninstall_prompt_keep() {
});
yield extension.startup();
let addon = yield promiseAddonByID(id);
let addon = yield AddonManager.getAddonByID(id);
notEqual(addon, null, "Add-on is installed");
extension.sendMessage("uninstall");
yield extension.awaitMessage("uninstall-rejected");
addon = yield promiseAddonByID(id);
addon = yield AddonManager.getAddonByID(id);
notEqual(addon, null, "Add-on remains installed");
yield extension.unload();
Services.obs.notifyObservers(extension.extension.file, "flush-cache-entry", null);

View File

@ -7,10 +7,11 @@ XPCOMUtils.defineLazyGetter(this, "Management", () => {
return Management;
});
Cu.import("resource://gre/modules/AddonManager.jsm");
const {
createAppInfo,
createTempWebExtensionFile,
promiseAddonByID,
promiseAddonEvent,
promiseCompleteAllInstalls,
promiseFindAddonUpdates,
@ -146,7 +147,7 @@ add_task(function* test_should_fire_on_addon_update() {
onInstalledReason: "install",
});
let addon = yield promiseAddonByID(EXTENSION_ID);
let addon = yield AddonManager.getAddonByID(EXTENSION_ID);
equal(addon.version, "1.0", "The installed addon has the correct version");
let update = yield promiseFindAddonUpdates(addon);
@ -319,7 +320,7 @@ add_task(function* test_should_not_fire_on_restart() {
onInstalledReason: "install",
});
let addon = yield promiseAddonByID(EXTENSION_ID);
let addon = yield AddonManager.getAddonByID(EXTENSION_ID);
addon.userDisabled = true;
let startupPromise = awaitEvent("ready");

View File

@ -251,17 +251,6 @@ function getSystemLocale() {
}
}
/**
* Asynchronously get a list of addons of the specified type from the AddonManager.
* @param aTypes An array containing the types of addons to request.
* @return Promise<Array> resolved when AddonManager has finished, returning an
* array of addons.
*/
function promiseGetAddonsByTypes(aTypes) {
return new Promise((resolve) =>
AddonManager.getAddonsByTypes(aTypes, (addons) => resolve(addons)));
}
/**
* Safely get a sysinfo property and return its value. If the property is not
* available, return aDefault.
@ -567,7 +556,7 @@ EnvironmentAddonBuilder.prototype = {
*/
_getActiveAddons: Task.async(function* () {
// Request addons, asynchronously.
let allAddons = yield promiseGetAddonsByTypes(["extension", "service"]);
let allAddons = yield AddonManager.getAddonsByTypes(["extension", "service"]);
let activeAddons = {};
for (let addon of allAddons) {
@ -618,7 +607,7 @@ EnvironmentAddonBuilder.prototype = {
*/
_getActiveTheme: Task.async(function* () {
// Request themes, asynchronously.
let themes = yield promiseGetAddonsByTypes(["theme"]);
let themes = yield AddonManager.getAddonsByTypes(["theme"]);
let activeTheme = {};
// We only store information about the active theme.
@ -694,7 +683,7 @@ EnvironmentAddonBuilder.prototype = {
*/
_getActiveGMPlugins: Task.async(function* () {
// Request plugins, asynchronously.
let allPlugins = yield promiseGetAddonsByTypes(["plugin"]);
let allPlugins = yield AddonManager.getAddonsByTypes(["plugin"]);
let activeGMPlugins = {};
for (let plugin of allPlugins) {

View File

@ -204,6 +204,35 @@ function makeSafe(aCallback) {
}
}
/**
* Given a promise and an optional callback, either:
*
* 1) Returns the promise, if no callback was provided, or,
* 2) Calls the callback with the promise resolution value, and reports
* any errors.
*
* @param {Promise} promise
* The promise to return, or report to the callback function.
* @param {function | null} callback
* The optional callback function to call with the promise
* resolution.
* @returns {Promise?}
*/
function promiseOrCallback(promise, callback) {
if (!callback)
return promise;
if (typeof callback !== "function")
throw Components.Exception("Callback must be a function",
Cr.NS_ERROR_INVALID_ARG);
promise.then(makeSafe(callback)).catch(error => {
logger.error(error);
});
return undefined;
}
/**
* Report an exception thrown by a provider API method.
*/
@ -339,52 +368,6 @@ function webAPIForAddon(addon) {
return result;
}
/**
* A helper class to repeatedly call a listener with each object in an array
* optionally checking whether the object has a method in it.
*
* @param aObjects
* The array of objects to iterate through
* @param aMethod
* An optional method name, if not null any objects without this method
* will not be passed to the listener
* @param aListener
* A listener implementing nextObject and noMoreObjects methods. The
* former will be called with the AsyncObjectCaller as the first
* parameter and the object as the second. noMoreObjects will be passed
* just the AsyncObjectCaller
*/
function AsyncObjectCaller(aObjects, aMethod, aListener) {
this.objects = [...aObjects];
this.method = aMethod;
this.listener = aListener;
this.callNext();
}
AsyncObjectCaller.prototype = {
objects: null,
method: null,
listener: null,
/**
* Passes the next object to the listener or calls noMoreObjects if there
* are none left.
*/
callNext: function() {
if (this.objects.length == 0) {
this.listener.noMoreObjects(this);
return;
}
let object = this.objects.shift();
if (!this.method || this.method in object)
this.listener.nextObject(this, object);
else
this.callNext();
}
};
/**
* Listens for a browser changing origin and cancels the installs that were
* started by it.
@ -1446,7 +1429,7 @@ var AddonManagerInternal = {
Components.utils.import("resource://gre/modules/LightweightThemeManager.jsm", scope);
scope.LightweightThemeManager.updateCurrentTheme();
let allAddons = yield new Promise((resolve, reject) => this.getAllAddons(resolve));
let allAddons = yield this.getAllAddons();
// Repopulate repository cache first, to ensure compatibility overrides
// are up to date before checking for addon updates.
@ -1524,10 +1507,9 @@ var AddonManagerInternal = {
if (update) {
if (Services.vc.compare(hotfixVersion, update.version) < 0) {
logger.debug("Downloading hotfix version " + update.version);
let aInstall = yield new Promise((resolve, reject) =>
AddonManager.getInstallForURL(update.updateURL, resolve,
"application/x-xpinstall", update.updateHash, null,
null, update.version));
let aInstall = yield AddonManagerInternal.getInstallForURL(
update.updateURL, "application/x-xpinstall", update.updateHash,
null, null, update.version);
aInstall.addListener({
onDownloadEnded: function(aInstall) {
@ -1823,30 +1805,20 @@ var AddonManagerInternal = {
/**
* Notifies all providers that the repository has updated its data for
* installed add-ons.
*
* @param aCallback
* Function to call when operation is complete.
*/
updateAddonRepositoryData: function(aCallback) {
updateAddonRepositoryData: function() {
if (!gStarted)
throw Components.Exception("AddonManager is not initialized",
Cr.NS_ERROR_NOT_INITIALIZED);
if (typeof aCallback != "function")
throw Components.Exception("aCallback must be a function",
Cr.NS_ERROR_INVALID_ARG);
new AsyncObjectCaller(this.providers, "updateAddonRepositoryData", {
nextObject: function(aCaller, aProvider) {
callProviderAsync(aProvider, "updateAddonRepositoryData",
aCaller.callNext.bind(aCaller));
},
noMoreObjects: function(aCaller) {
safeCall(aCallback);
// only tests should care about this
Services.obs.notifyObservers(null, "TEST:addon-repository-data-updated", null);
return Task.spawn(function*() {
for (let provider of this.providers) {
yield promiseCallProvider(provider, "updateAddonRepositoryData");
}
});
// only tests should care about this
Services.obs.notifyObservers(null, "TEST:addon-repository-data-updated", null);
}.bind(this));
},
/**
@ -1854,8 +1826,6 @@ var AddonManagerInternal = {
*
* @param aUrl
* The string represenation of the URL the add-on is located at
* @param aCallback
* A callback to pass the AddonInstall to
* @param aMimetype
* The mimetype of the add-on
* @param aHash
@ -1870,7 +1840,7 @@ var AddonManagerInternal = {
* An optional <browser> element for download permissions prompts.
* @throws if the aUrl, aCallback or aMimetype arguments are not specified
*/
getInstallForURL: function(aUrl, aCallback, aMimetype, aHash, aName,
getInstallForURL: function(aUrl, aMimetype, aHash, aName,
aIcons, aVersion, aBrowser) {
if (!gStarted)
throw Components.Exception("AddonManager is not initialized",
@ -1880,10 +1850,6 @@ var AddonManagerInternal = {
throw Components.Exception("aURL must be a non-empty string",
Cr.NS_ERROR_INVALID_ARG);
if (typeof aCallback != "function")
throw Components.Exception("aCallback must be a function",
Cr.NS_ERROR_INVALID_ARG);
if (!aMimetype || typeof aMimetype != "string")
throw Components.Exception("aMimetype must be a non-empty string",
Cr.NS_ERROR_INVALID_ARG);
@ -1910,22 +1876,19 @@ var AddonManagerInternal = {
throw Components.Exception("aVersion must be a string or null",
Cr.NS_ERROR_INVALID_ARG);
if (aBrowser && (!(aBrowser instanceof Ci.nsIDOMElement)))
if (aBrowser && !(aBrowser instanceof Ci.nsIDOMElement))
throw Components.Exception("aBrowser must be a nsIDOMElement or null",
Cr.NS_ERROR_INVALID_ARG);
let providers = [...this.providers];
for (let provider of providers) {
for (let provider of this.providers) {
if (callProvider(provider, "supportsMimetype", false, aMimetype)) {
callProviderAsync(provider, "getInstallForURL",
aUrl, aHash, aName, aIcons, aVersion, aBrowser,
function getInstallForURL_safeCall(aInstall) {
safeCall(aCallback, aInstall);
});
return;
return promiseCallProvider(
provider, "getInstallForURL", aUrl, aHash, aName, aIcons,
aVersion, aBrowser);
}
}
safeCall(aCallback, null);
return Promise.resolve(null);
},
/**
@ -1933,13 +1896,11 @@ var AddonManagerInternal = {
*
* @param aFile
* The nsIFile where the add-on is located
* @param aCallback
* A callback to pass the AddonInstall to
* @param aMimetype
* An optional mimetype hint for the add-on
* @throws if the aFile or aCallback arguments are not specified
*/
getInstallForFile: function(aFile, aCallback, aMimetype) {
getInstallForFile: function(aFile, aMimetype) {
if (!gStarted)
throw Components.Exception("AddonManager is not initialized",
Cr.NS_ERROR_NOT_INITIALIZED);
@ -1948,29 +1909,21 @@ var AddonManagerInternal = {
throw Components.Exception("aFile must be a nsIFile",
Cr.NS_ERROR_INVALID_ARG);
if (typeof aCallback != "function")
throw Components.Exception("aCallback must be a function",
Cr.NS_ERROR_INVALID_ARG);
if (aMimetype && typeof aMimetype != "string")
throw Components.Exception("aMimetype must be a string or null",
Cr.NS_ERROR_INVALID_ARG);
new AsyncObjectCaller(this.providers, "getInstallForFile", {
nextObject: function(aCaller, aProvider) {
callProviderAsync(aProvider, "getInstallForFile", aFile,
function(aInstall) {
if (aInstall)
safeCall(aCallback, aInstall);
else
aCaller.callNext();
});
},
return Task.spawn(function*() {
for (let provider of this.providers) {
let install = yield promiseCallProvider(
provider, "getInstallForFile", aFile);
noMoreObjects: function(aCaller) {
safeCall(aCallback, null);
if (install)
return install;
}
});
return null;
}.bind(this));
},
/**
@ -1979,11 +1932,9 @@ var AddonManagerInternal = {
*
* @param aTypes
* An optional array of types to retrieve. Each type is a string name
* @param aCallback
* A callback which will be passed an array of AddonInstalls
* @throws If the aCallback argument is not specified
*/
getInstallsByTypes: function(aTypes, aCallback) {
getInstallsByTypes: function(aTypes) {
if (!gStarted)
throw Components.Exception("AddonManager is not initialized",
Cr.NS_ERROR_NOT_INITIALIZED);
@ -1992,41 +1943,30 @@ var AddonManagerInternal = {
throw Components.Exception("aTypes must be an array or null",
Cr.NS_ERROR_INVALID_ARG);
if (typeof aCallback != "function")
throw Components.Exception("aCallback must be a function",
Cr.NS_ERROR_INVALID_ARG);
return Task.spawn(function*() {
let installs = [];
let installs = [];
for (let provider of this.providers) {
let providerInstalls = yield promiseCallProvider(
provider, "getInstallsByTypes", aTypes);
new AsyncObjectCaller(this.providers, "getInstallsByTypes", {
nextObject: function(aCaller, aProvider) {
callProviderAsync(aProvider, "getInstallsByTypes", aTypes,
function(aProviderInstalls) {
if (aProviderInstalls) {
installs = installs.concat(aProviderInstalls);
}
aCaller.callNext();
});
},
noMoreObjects: function(aCaller) {
safeCall(aCallback, installs);
if (providerInstalls)
installs.push(...providerInstalls);
}
});
return installs;
}.bind(this));
},
/**
* Asynchronously gets all current AddonInstalls.
*
* @param aCallback
* A callback which will be passed an array of AddonInstalls
*/
getAllInstalls: function(aCallback) {
getAllInstalls: function() {
if (!gStarted)
throw Components.Exception("AddonManager is not initialized",
Cr.NS_ERROR_NOT_INITIALIZED);
this.getInstallsByTypes(null, aCallback);
return this.getInstallsByTypes(null);
},
/**
@ -2470,11 +2410,9 @@ var AddonManagerInternal = {
*
* @param aGUID
* String GUID of add-on to retrieve
* @param aCallback
* The callback to pass the retrieved add-on to.
* @throws if the aGUID or aCallback arguments are not specified
* @throws if the aGUID argument is not specified
*/
getAddonBySyncGUID: function(aGUID, aCallback) {
getAddonBySyncGUID: function(aGUID) {
if (!gStarted)
throw Components.Exception("AddonManager is not initialized",
Cr.NS_ERROR_NOT_INITIALIZED);
@ -2483,26 +2421,17 @@ var AddonManagerInternal = {
throw Components.Exception("aGUID must be a non-empty string",
Cr.NS_ERROR_INVALID_ARG);
if (typeof aCallback != "function")
throw Components.Exception("aCallback must be a function",
Cr.NS_ERROR_INVALID_ARG);
return Task.spawn(function*() {
for (let provider of this.providers) {
let addon = yield promiseCallProvider(
provider, "getAddonBySyncGUID", aGUID);
new AsyncObjectCaller(this.providers, "getAddonBySyncGUID", {
nextObject: function(aCaller, aProvider) {
callProviderAsync(aProvider, "getAddonBySyncGUID", aGUID,
function(aAddon) {
if (aAddon) {
safeCall(aCallback, aAddon);
} else {
aCaller.callNext();
}
});
},
noMoreObjects: function(aCaller) {
safeCall(aCallback, null);
if (addon)
return addon;
}
});
return null;
}.bind(this));
},
/**
@ -2533,11 +2462,8 @@ var AddonManagerInternal = {
*
* @param aTypes
* An optional array of types to retrieve. Each type is a string name
* @param aCallback
* The callback to pass an array of Addons to.
* @throws if the aCallback argument is not specified
*/
getAddonsByTypes: function(aTypes, aCallback) {
getAddonsByTypes: function(aTypes) {
if (!gStarted)
throw Components.Exception("AddonManager is not initialized",
Cr.NS_ERROR_NOT_INITIALIZED);
@ -2546,45 +2472,30 @@ var AddonManagerInternal = {
throw Components.Exception("aTypes must be an array or null",
Cr.NS_ERROR_INVALID_ARG);
if (typeof aCallback != "function")
throw Components.Exception("aCallback must be a function",
Cr.NS_ERROR_INVALID_ARG);
return Task.spawn(function*() {
let addons = [];
let addons = [];
for (let provider of this.providers) {
let providerAddons = yield promiseCallProvider(
provider, "getAddonsByTypes", aTypes);
new AsyncObjectCaller(this.providers, "getAddonsByTypes", {
nextObject: function(aCaller, aProvider) {
callProviderAsync(aProvider, "getAddonsByTypes", aTypes,
function(aProviderAddons) {
if (aProviderAddons) {
addons = addons.concat(aProviderAddons);
}
aCaller.callNext();
});
},
noMoreObjects: function(aCaller) {
safeCall(aCallback, addons);
if (providerAddons)
addons.push(...providerAddons);
}
});
return addons;
}.bind(this));
},
/**
* Asynchronously gets all installed add-ons.
*
* @param aCallback
* A callback which will be passed an array of Addons
*/
getAllAddons: function(aCallback) {
getAllAddons: function() {
if (!gStarted)
throw Components.Exception("AddonManager is not initialized",
Cr.NS_ERROR_NOT_INITIALIZED);
if (typeof aCallback != "function")
throw Components.Exception("aCallback must be a function",
Cr.NS_ERROR_INVALID_ARG);
this.getAddonsByTypes(null, aCallback);
return this.getAddonsByTypes(null);
},
/**
@ -2593,11 +2504,8 @@ var AddonManagerInternal = {
*
* @param aTypes
* An optional array of types to retrieve. Each type is a string name
* @param aCallback
* The callback to pass the array of Addons to
* @throws if the aCallback argument is not specified
*/
getAddonsWithOperationsByTypes: function(aTypes, aCallback) {
getAddonsWithOperationsByTypes: function(aTypes) {
if (!gStarted)
throw Components.Exception("AddonManager is not initialized",
Cr.NS_ERROR_NOT_INITIALIZED);
@ -2606,27 +2514,19 @@ var AddonManagerInternal = {
throw Components.Exception("aTypes must be an array or null",
Cr.NS_ERROR_INVALID_ARG);
if (typeof aCallback != "function")
throw Components.Exception("aCallback must be a function",
Cr.NS_ERROR_INVALID_ARG);
return Task.spawn(function*() {
let addons = [];
let addons = [];
for (let provider of this.providers) {
let providerAddons = yield promiseCallProvider(
provider, "getAddonsWithOperationsByTypes", aTypes);
new AsyncObjectCaller(this.providers, "getAddonsWithOperationsByTypes", {
nextObject: function(aCaller, aProvider) {
callProviderAsync(aProvider, "getAddonsWithOperationsByTypes", aTypes,
function(aProviderAddons) {
if (aProviderAddons) {
addons = addons.concat(aProviderAddons);
}
aCaller.callNext();
});
},
noMoreObjects: function(caller) {
safeCall(aCallback, addons);
if (providerAddons)
addons.push(...providerAddons);
}
});
return addons;
}.bind(this));
},
/**
@ -2930,26 +2830,23 @@ var AddonManagerInternal = {
throw new Error(`Install from ${host} not permitted`);
}
return new Promise((resolve, reject) => {
try {
checkInstallUrl(options.url);
} catch (err) {
reject({message: err.message});
return;
}
try {
checkInstallUrl(options.url);
} catch (err) {
return Promise.reject({message: err.message});
}
let newInstall = install => {
let id = this.nextInstall++;
let listener = this.makeListener(id, target.messageManager);
install.addListener(listener);
return AddonManagerInternal.getInstallForURL(options.url, "application/x-xpinstall",
options.hash).then(install => {
let id = this.nextInstall++;
let listener = this.makeListener(id, target.messageManager);
install.addListener(listener);
this.installs.set(id, {install, target, listener});
this.installs.set(id, {install, target, listener});
let result = {id};
this.copyProps(install, result);
resolve(result);
};
AddonManager.getInstallForURL(options.url, newInstall, "application/x-xpinstall", options.hash);
let result = {id};
this.copyProps(install, result);
return result;
});
},
@ -3073,7 +2970,9 @@ this.AddonManagerPrivate = {
},
updateAddonRepositoryData: function(aCallback) {
AddonManagerInternal.updateAddonRepositoryData(aCallback);
return promiseOrCallback(
AddonManagerInternal.updateAddonRepositoryData(),
aCallback);
},
callInstallListeners: function(...aArgs) {
@ -3434,12 +3333,16 @@ this.AddonManager = {
getInstallForURL: function(aUrl, aCallback, aMimetype,
aHash, aName, aIcons,
aVersion, aBrowser) {
AddonManagerInternal.getInstallForURL(aUrl, aCallback, aMimetype, aHash,
aName, aIcons, aVersion, aBrowser);
return promiseOrCallback(
AddonManagerInternal.getInstallForURL(aUrl, aMimetype, aHash,
aName, aIcons, aVersion, aBrowser),
aCallback);
},
getInstallForFile: function(aFile, aCallback, aMimetype) {
AddonManagerInternal.getInstallForFile(aFile, aCallback, aMimetype);
return promiseOrCallback(
AddonManagerInternal.getInstallForFile(aFile, aMimetype),
aCallback);
},
/**
@ -3456,47 +3359,51 @@ this.AddonManager = {
},
getAddonByID: function(aID, aCallback) {
if (typeof aCallback != "function")
throw Components.Exception("aCallback must be a function",
Cr.NS_ERROR_INVALID_ARG);
AddonManagerInternal.getAddonByID(aID)
.then(makeSafe(aCallback))
.catch(logger.error);
return promiseOrCallback(
AddonManagerInternal.getAddonByID(aID),
aCallback);
},
getAddonBySyncGUID: function(aGUID, aCallback) {
AddonManagerInternal.getAddonBySyncGUID(aGUID, aCallback);
return promiseOrCallback(
AddonManagerInternal.getAddonBySyncGUID(aGUID),
aCallback);
},
getAddonsByIDs: function(aIDs, aCallback) {
if (typeof aCallback != "function")
throw Components.Exception("aCallback must be a function",
Cr.NS_ERROR_INVALID_ARG);
AddonManagerInternal.getAddonsByIDs(aIDs)
.then(makeSafe(aCallback))
.catch(logger.error);
return promiseOrCallback(
AddonManagerInternal.getAddonsByIDs(aIDs),
aCallback);
},
getAddonsWithOperationsByTypes: function(aTypes, aCallback) {
AddonManagerInternal.getAddonsWithOperationsByTypes(aTypes, aCallback);
return promiseOrCallback(
AddonManagerInternal.getAddonsWithOperationsByTypes(aTypes),
aCallback);
},
getAddonsByTypes: function(aTypes, aCallback) {
AddonManagerInternal.getAddonsByTypes(aTypes, aCallback);
return promiseOrCallback(
AddonManagerInternal.getAddonsByTypes(aTypes),
aCallback);
},
getAllAddons: function(aCallback) {
AddonManagerInternal.getAllAddons(aCallback);
return promiseOrCallback(
AddonManagerInternal.getAllAddons(),
aCallback);
},
getInstallsByTypes: function(aTypes, aCallback) {
AddonManagerInternal.getInstallsByTypes(aTypes, aCallback);
return promiseOrCallback(
AddonManagerInternal.getInstallsByTypes(aTypes),
aCallback);
},
getAllInstalls: function(aCallback) {
AddonManagerInternal.getAllInstalls(aCallback);
return promiseOrCallback(
AddonManagerInternal.getAllInstalls(),
aCallback);
},
mapURIToAddonID: function(aURI) {

View File

@ -208,8 +208,7 @@ var gVersionInfoPage = {
}
logger.debug("Fetching affected addons " + idlist.toSource());
let fetchedAddons = yield new Promise((resolve, reject) =>
AddonManager.getAddonsByIDs(idlist, resolve));
let fetchedAddons = yield AddonManager.getAddonsByIDs(idlist);
// We shouldn't get nulls here, but let's be paranoid...
gUpdateWizard.addons = fetchedAddons.filter(a => a);
if (gUpdateWizard.addons.length < 1) {

View File

@ -22,6 +22,8 @@ XPCOMUtils.defineLazyModuleGetter(this, "DeferredSave",
"resource://gre/modules/DeferredSave.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "AddonRepository_SQLiteMigrator",
"resource://gre/modules/addons/AddonRepository_SQLiteMigrator.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Preferences",
"resource://gre/modules/Preferences.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Promise",
"resource://gre/modules/Promise.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Task",
@ -121,36 +123,26 @@ function convertHTMLToPlainText(html) {
return html;
}
function getAddonsToCache(aIds, aCallback) {
try {
var types = Services.prefs.getCharPref(PREF_GETADDONS_CACHE_TYPES);
}
catch (e) { }
if (!types)
types = DEFAULT_CACHE_TYPES;
function getAddonsToCache(aIds) {
let types = Preferences.get(PREF_GETADDONS_CACHE_TYPES) || DEFAULT_CACHE_TYPES;
types = types.split(",");
AddonManager.getAddonsByIDs(aIds, function(aAddons) {
return AddonManager.getAddonsByIDs(aIds).then(addons => {
let enabledIds = [];
for (var i = 0; i < aIds.length; i++) {
for (let [i, addon] of addons.entries()) {
var preference = PREF_GETADDONS_CACHE_ID_ENABLED.replace("%ID%", aIds[i]);
try {
if (!Services.prefs.getBoolPref(preference))
continue;
} catch (e) {
// If the preference doesn't exist caching is enabled by default
}
// If the preference doesn't exist caching is enabled by default
if (!Preferences.get(preference, true))
continue;
// The add-ons manager may not know about this ID yet if it is a pending
// install. In that case we'll just cache it regardless
if (aAddons[i] && (types.indexOf(aAddons[i].type) == -1))
continue;
enabledIds.push(aIds[i]);
if (!addon || types.includes(addon.type))
enabledIds.push(aIds[i]);
}
aCallback(enabledIds);
return enabledIds;
});
}
@ -609,14 +601,11 @@ this.AddonRepository = {
_clearCache: function() {
this._addons = null;
return AddonDatabase.delete().then(() =>
new Promise((resolve, reject) =>
AddonManagerPrivate.updateAddonRepositoryData(resolve))
);
AddonManagerPrivate.updateAddonRepositoryData());
},
_repopulateCacheInternal: Task.async(function*(aSendPerformance, aTimeout) {
let allAddons = yield new Promise((resolve, reject) =>
AddonManager.getAllAddons(resolve));
let allAddons = yield AddonManager.getAllAddons();
// Filter the hotfix out of our list of add-ons
allAddons = allAddons.filter(a => a.id != AddonManager.hotfixID);
@ -631,8 +620,7 @@ this.AddonRepository = {
let ids = allAddons.map(a => a.id);
logger.debug("Repopulate add-on cache with " + ids.toSource());
let addonsToCache = yield new Promise((resolve, reject) =>
getAddonsToCache(ids, resolve));
let addonsToCache = yield getAddonsToCache(ids);
// Completely remove cache if there are no add-ons to cache
if (addonsToCache.length == 0) {
@ -657,8 +645,7 @@ this.AddonRepository = {
}, aSendPerformance, aTimeout));
// Always call AddonManager updateAddonRepositoryData after we refill the cache
yield new Promise((resolve, reject) =>
AddonManagerPrivate.updateAddonRepositoryData(resolve));
yield AddonManagerPrivate.updateAddonRepositoryData();
}),
/**
@ -679,7 +666,7 @@ this.AddonRepository = {
return;
}
getAddonsToCache(aIds, aAddons => {
getAddonsToCache(aIds).then(aAddons => {
// If there are no add-ons to cache, act as if caching is disabled
if (aAddons.length == 0) {
if (aCallback)

View File

@ -1014,7 +1014,7 @@ var AddonTestUtils = {
*
* @param {AddonInstall} install
* The add-on to install.
* @returns {Promise}
* @returns {Promise<AddonInstall>}
* Resolves when the install completes, either successfully or
* in failure.
*/
@ -1034,6 +1034,7 @@ var AddonTestUtils = {
install.install();
}).then(() => {
install.removeListener(listener);
return install;
});
},
@ -1049,17 +1050,17 @@ var AddonTestUtils = {
* Resolves when the install has completed.
*/
promiseInstallFile(file, ignoreIncompatible = false) {
return new Promise((resolve, reject) => {
AddonManager.getInstallForFile(file, install => {
if (!install)
reject(new Error(`No AddonInstall created for ${file.path}`));
else if (install.state != AddonManager.STATE_DOWNLOADED)
reject(new Error(`Expected file to be downloaded for install of ${file.path}`));
else if (ignoreIncompatible && install.addon.appDisabled)
resolve();
else
resolve(this.promiseCompleteInstall(install));
});
return AddonManager.getInstallForFile(file).then(install => {
if (!install)
throw new Error(`No AddonInstall created for ${file.path}`);
if (install.state != AddonManager.STATE_DOWNLOADED)
throw new Error(`Expected file to be downloaded for install of ${file.path}`);
if (ignoreIncompatible && install.addon.appDisabled)
return null;
return this.promiseCompleteInstall(install);
});
},
@ -1084,30 +1085,6 @@ var AddonTestUtils = {
return Promise.all(Array.from(installs, this.promiseCompleteInstall));
},
/**
* A promise-based variant of AddonManager.getAddonsByIDs.
*
* @param {Array<string>} list
* As the first argument of AddonManager.getAddonsByIDs
* @return {Promise<Array<Addon>>}
* Resolves to the array of add-ons for the given IDs.
*/
promiseAddonsByIDs(list) {
return new Promise(resolve => AddonManager.getAddonsByIDs(list, resolve));
},
/**
* A promise-based variant of AddonManager.getAddonByID.
*
* @param {string} id
* The ID of the add-on.
* @return {Promise<Addon>}
* Resolves to the add-on with the given ID.
*/
promiseAddonByID(id) {
return new Promise(resolve => AddonManager.getAddonByID(id, resolve));
},
/**
* Returns a promise that will be resolved when an add-on update check is
* complete. The value resolved will be an AddonInstall if a new version was
@ -1167,19 +1144,6 @@ var AddonTestUtils = {
});
},
/**
* A promise-based variant of AddonManager.getAddonsWithOperationsByTypes
*
* @param {Array<string>} types
* The first argument to AddonManager.getAddonsWithOperationsByTypes
* @return {Promise<Array<Addon>>}
* Resolves to an array of add-ons with the given operations
* pending.
*/
promiseAddonsWithOperationsByTypes(types) {
return new Promise(resolve => AddonManager.getAddonsWithOperationsByTypes(types, resolve));
},
/**
* Monitors console output for the duration of a task, and returns a promise
* which resolves to a tuple containing a list of all console messages

View File

@ -53,8 +53,6 @@ function end_test() {
}
function install_test_addons(aCallback) {
var installs = [];
// Use a blank update URL
Services.prefs.setCharPref(PREF_UPDATEURL, TESTROOT + "missing.rdf");
@ -68,30 +66,31 @@ function install_test_addons(aCallback) {
"browser_bug557956_8_1",
"browser_bug557956_9_1",
"browser_bug557956_10"];
for (let name of names) {
AddonManager.getInstallForURL(TESTROOT + "addons/" + name + ".xpi", function(aInstall) {
installs.push(aInstall);
}, "application/x-xpinstall");
}
var listener = {
installCount: 0,
let installPromises = Promise.all(
names.map(name => AddonManager.getInstallForURL(`${TESTROOT}addons/${name}.xpi`,
null, "application/x-xpinstall")));
onInstallEnded: function() {
this.installCount++;
if (this.installCount == installs.length) {
// Switch to the test update URL
Services.prefs.setCharPref(PREF_UPDATEURL, TESTROOT + "browser_bug557956.rdf");
installPromises.then(installs => {
var listener = {
installCount: 0,
executeSoon(aCallback);
onInstallEnded: function() {
this.installCount++;
if (this.installCount == installs.length) {
// Switch to the test update URL
Services.prefs.setCharPref(PREF_UPDATEURL, TESTROOT + "browser_bug557956.rdf");
executeSoon(aCallback);
}
}
}
};
};
for (let install of installs) {
install.addListener(listener);
install.install();
}
for (let install of installs) {
install.addListener(listener);
install.install();
}
});
}
function uninstall_test_addons(aCallback) {

View File

@ -66,36 +66,35 @@ function promise_observer(aTopic) {
// @param aUpdateURL The real update URL to use after the add-ons are installed
function promise_install_test_addons(aAddonList, aUpdateURL) {
info("Starting add-on installs");
var installs = [];
let deferred = Promise.defer();
// Use a blank update URL
Services.prefs.setCharPref(PREF_UPDATEURL, TESTROOT + "missing.rdf");
for (let addon of aAddonList) {
AddonManager.getInstallForURL(TESTROOT + "addons/" + addon.file + ".xpi", function(aInstall) {
installs.push(aInstall);
}, "application/x-xpinstall");
}
let installPromises = Promise.all(
aAddonList.map(addon => AddonManager.getInstallForURL(`${TESTROOT}addons/${addon.file}.xpi`,
null, "application/x-xpinstall")));
var listener = {
installCount: 0,
installPromises.then(installs => {
var listener = {
installCount: 0,
onInstallEnded: function() {
this.installCount++;
if (this.installCount == installs.length) {
info("Done add-on installs");
// Switch to the test update URL
Services.prefs.setCharPref(PREF_UPDATEURL, aUpdateURL);
deferred.resolve();
onInstallEnded: function() {
this.installCount++;
if (this.installCount == installs.length) {
info("Done add-on installs");
// Switch to the test update URL
Services.prefs.setCharPref(PREF_UPDATEURL, aUpdateURL);
deferred.resolve();
}
}
}
};
};
for (let install of installs) {
install.addListener(listener);
install.install();
}
for (let install of installs) {
install.addListener(listener);
install.install();
}
});
return deferred.promise;
}

View File

@ -173,7 +173,7 @@ registerCleanupFunction(function() {
checkOpenWindows("Addons:Compatibility");
checkOpenWindows("Addons:Install");
return new Promise((resolve, reject) => AddonManager.getAllInstalls(resolve))
return AddonManager.getAllInstalls()
.then(aInstalls => {
for (let install of aInstalls) {
if (install instanceof MockInstall)

View File

@ -69,10 +69,7 @@ const {
getFileForAddon,
manuallyInstall,
manuallyUninstall,
promiseAddonByID,
promiseAddonEvent,
promiseAddonsByIDs,
promiseAddonsWithOperationsByTypes,
promiseCompleteAllInstalls,
promiseCompleteInstall,
promiseConsoleOutput,
@ -147,6 +144,10 @@ Object.defineProperty(this, "TEST_UNPACKED", {
var AMscope = Components.utils.import("resource://gre/modules/AddonManager.jsm", {});
var { AddonManager, AddonManagerInternal, AddonManagerPrivate } = AMscope;
const promiseAddonByID = AddonManager.getAddonByID;
const promiseAddonsByIDs = AddonManager.getAddonsByIDs;
const promiseAddonsWithOperationsByTypes = AddonManager.getAddonsWithOperationsByTypes;
var gPort = null;
var gUrlToFileMap = {};

View File

@ -198,19 +198,10 @@ add_task(function* uninstall_bootstrap() {
add_task(function* install_bootstrap() {
let XS = getXS();
let installer = yield new Promise((resolve, reject) =>
AddonManager.getInstallForFile(do_get_addon("test_bootstrap1_1"), resolve));
let installer = yield promiseInstallFile(
do_get_addon("test_bootstrap1_1"));
let promiseInstalled = new Promise((resolve, reject) => {
AddonManager.addInstallListener({
onInstallFailed: reject,
onInstallEnded: (install, newAddon) => resolve(newAddon)
});
});
installer.install();
let newAddon = yield promiseInstalled;
let newAddon = installer.addon;
let xState = XS.getAddon("app-profile", newAddon.id);
do_check_true(!!xState);
do_check_true(xState.enabled);
@ -228,19 +219,10 @@ add_task(function* install_bootstrap() {
add_task(function* install_restart() {
let XS = getXS();
let installer = yield new Promise((resolve, reject) =>
AddonManager.getInstallForFile(do_get_addon("test_bootstrap1_4"), resolve));
let installer = yield promiseInstallFile(
do_get_addon("test_bootstrap1_4"));
let promiseInstalled = new Promise((resolve, reject) => {
AddonManager.addInstallListener({
onInstallFailed: reject,
onInstallEnded: (install, newAddon) => resolve(newAddon)
});
});
installer.install();
let newAddon = yield promiseInstalled;
let newAddon = installer.addon;
let newID = newAddon.id;
let xState = XS.getAddon("app-profile", newID);
do_check_false(xState);

View File

@ -459,11 +459,10 @@ function Pbackground_update() {
function Pmanual_update(aVersion) {
let Pinstalls = [];
for (let name of ["soft1", "soft2", "soft3", "soft4", "soft5", "hard1", "regexp1"]) {
Pinstalls.push(new Promise((resolve, reject) => {
AddonManager.getInstallForURL("http://localhost:" + gPort + "/addons/blocklist_"
+ name + "_" + aVersion + ".xpi",
resolve, "application/x-xpinstall");
}));
Pinstalls.push(
AddonManager.getInstallForURL(
`http://localhost:${gPort}/addons/blocklist_${name}_${aVersion}.xpi`,
null, "application/x-xpinstall"));
}
return Promise.all(Pinstalls).then(installs => {
@ -1289,9 +1288,7 @@ add_task(function* run_local_install_test() {
do_get_file("addons/blocklist_regexp1_1.xpi")
]);
let aInstalls = yield new Promise((resolve, reject) => {
AddonManager.getAllInstalls(resolve)
});
let aInstalls = yield AddonManager.getAllInstalls();
// Should have finished all installs without needing to restart
do_check_eq(aInstalls.length, 0);

View File

@ -77,6 +77,6 @@ add_task(function*() {
// certificate database
overrideCertDB();
let install = yield new Promise(resolve => AddonManager.getInstallForFile(do_get_addon("test_bootstrap1_1"), resolve));
let install = yield AddonManager.getInstallForFile(do_get_addon("test_bootstrap1_1"));
do_check_eq(install.state, AddonManager.STATE_DOWNLOAD_FAILED);
});

View File

@ -20,8 +20,7 @@ createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2");
startupManager();
function* check_normal() {
let install = yield new Promise(resolve => AddonManager.getInstallForFile(do_get_addon("test_bootstrap1_1"), resolve));
yield promiseCompleteAllInstalls([install]);
let install = yield promiseInstallFile(do_get_addon("test_bootstrap1_1"));
do_check_eq(install.state, AddonManager.STATE_INSTALLED);
do_check_false(hasFlag(install.addon.pendingOperations, AddonManager.PENDING_INSTALL));
@ -80,8 +79,7 @@ add_task(function*() {
gAppInfo.browserTabsRemoteAutostart = true;
Services.prefs.setBoolPref("extensions.e10sBlocksEnabling", true);
let install = yield new Promise(resolve => AddonManager.getInstallForFile(do_get_addon("test_bootstrap1_1"), resolve));
yield promiseCompleteAllInstalls([install]);
let install = yield promiseInstallFile(do_get_addon("test_bootstrap1_1"));
do_check_eq(install.state, AddonManager.STATE_INSTALLED);
do_check_true(hasFlag(install.addon.pendingOperations, AddonManager.PENDING_INSTALL));
@ -129,8 +127,7 @@ add_task(function*() {
gAppInfo.browserTabsRemoteAutostart = true;
Services.prefs.setBoolPref("extensions.e10sBlocksEnabling", true);
let install = yield new Promise(resolve => AddonManager.getInstallForFile(do_get_addon("test_bootstrap1_1"), resolve));
yield promiseCompleteAllInstalls([install]);
let install = yield promiseInstallFile(do_get_addon("test_bootstrap1_1"));
do_check_eq(install.state, AddonManager.STATE_INSTALLED);
do_check_true(hasFlag(install.addon.pendingOperations, AddonManager.PENDING_INSTALL));
@ -202,9 +199,11 @@ add_task(function*() {
gAppInfo.browserTabsRemoteAutostart = true;
Services.prefs.setBoolPref("extensions.e10sBlocksEnabling", true);
let install1 = yield new Promise(resolve => AddonManager.getInstallForFile(do_get_addon("test_bootstrap1_1"), resolve));
let install2 = yield new Promise(resolve => AddonManager.getInstallForFile(do_get_addon("test_bootstrap2_1"), resolve));
yield promiseCompleteAllInstalls([install1, install2]);
let [install1, install2] = yield Promise.all([
promiseInstallFile(do_get_addon("test_bootstrap1_1")),
promiseInstallFile(do_get_addon("test_bootstrap2_1")),
]);
do_check_eq(install1.state, AddonManager.STATE_INSTALLED);
do_check_eq(install2.state, AddonManager.STATE_INSTALLED);
do_check_true(hasFlag(install1.addon.pendingOperations, AddonManager.PENDING_INSTALL));
@ -312,9 +311,10 @@ add_task(function*() {
// Check that the two add-ons can be installed together correctly as
// check_normal() only perform checks on bootstrap1.
let install1 = yield new Promise(resolve => AddonManager.getInstallForFile(do_get_addon("test_bootstrap1_1"), resolve));
let install2 = yield new Promise(resolve => AddonManager.getInstallForFile(do_get_addon("test_bootstrap2_1"), resolve));
yield promiseCompleteAllInstalls([install1, install2]);
let [install1, install2] = yield Promise.all([
promiseInstallFile(do_get_addon("test_bootstrap1_1")),
promiseInstallFile(do_get_addon("test_bootstrap2_1")),
]);
do_check_eq(install1.state, AddonManager.STATE_INSTALLED);
do_check_eq(install2.state, AddonManager.STATE_INSTALLED);
@ -374,9 +374,10 @@ add_task(function*() {
yield promiseRestartManager();
install1 = yield new Promise(resolve => AddonManager.getInstallForFile(do_get_addon("test_bootstrap1_1"), resolve));
install2 = yield new Promise(resolve => AddonManager.getInstallForFile(do_get_addon("test_bootstrap2_1"), resolve));
yield promiseCompleteAllInstalls([install1, install2]);
[install1, install2] = yield Promise.all([
promiseInstallFile(do_get_addon("test_bootstrap1_1")),
promiseInstallFile(do_get_addon("test_bootstrap2_1")),
]);
do_check_eq(install1.state, AddonManager.STATE_INSTALLED);
do_check_eq(install2.state, AddonManager.STATE_INSTALLED);

View File

@ -52,7 +52,7 @@ function build_test(multiprocessCompatible, bootstrap, updateMultiprocessCompati
updateMultiprocessCompatible;
let xpifile = createTempXPIFile(addonData);
let install = yield new Promise(resolve => AddonManager.getInstallForFile(xpifile, resolve));
let install = yield AddonManager.getInstallForFile(xpifile);
do_check_eq(install.addon.multiprocessCompatible, !!multiprocessCompatible);
do_check_eq(install.addon.mpcOptedOut, multiprocessCompatible === false)
yield promiseCompleteAllInstalls([install]);

View File

@ -47,11 +47,8 @@ add_task(function* unsafeProviderShutdown() {
let shutdownPromise = null;
yield new Promise(resolve => {
secondProvider.shutdownCallback = function() {
return new Promise(shutdownResolve => {
AddonManager.getAddonByID("does-not-exist", () => {
shutdownResolve();
resolve();
});
return AddonManager.getAddonByID("does-not-exist").then(() => {
resolve();
});
};

View File

@ -40,7 +40,7 @@ add_task(function* unsafeProviderStartup() {
yield new Promise(resolve => {
let firstProvider = mockAddonProvider("Mock1");
firstProvider.startupCallback = function() {
AddonManager.getAddonByID("does-not-exist", resolve);
resolve(AddonManager.getAddonByID("does-not-exist"));
};
AddonManagerPrivate.registerProvider(firstProvider);

View File

@ -118,9 +118,7 @@ function* run_proxy_tests() {
// add-ons have been removed at startup.
checkAddonsExist();
return new Promise(resolve => {
AddonManager.getAddonsByIDs(ADDONS.map(addon => addon.id), resolve);
}).then(addons => {
return AddonManager.getAddonsByIDs(ADDONS.map(addon => addon.id)).then(addons => {
try {
for (let [i, addon] of addons.entries()) {
// Ensure that valid proxied add-ons were installed properly on
@ -213,9 +211,7 @@ function* run_symlink_tests() {
startupManager();
return new Promise(resolve => {
AddonManager.getAddonByID(METADATA.id, resolve);
}).then(addon => {
return AddonManager.getAddonByID(METADATA.id).then(addon => {
do_check_neq(addon, null);
addon.uninstall();

View File

@ -15,8 +15,7 @@ Services.prefs.setIntPref("extensions.autoDisableScopes", AddonManager.SCOPE_PRO
// Installing an add-on through the API should mark it as seen
add_task(function*() {
let install = yield new Promise(resolve => AddonManager.getInstallForFile(do_get_addon("test_bootstrap1_1"), resolve));
yield promiseCompleteAllInstalls([install]);
let install = yield promiseInstallFile(do_get_addon("test_bootstrap1_1"));
do_check_eq(install.state, AddonManager.STATE_INSTALLED);
do_check_false(hasFlag(install.addon.pendingOperations, AddonManager.PENDING_INSTALL));
@ -32,8 +31,7 @@ add_task(function*() {
do_check_true(addon.seen);
// Installing an update should retain that
install = yield new Promise(resolve => AddonManager.getInstallForFile(do_get_addon("test_bootstrap1_2"), resolve));
yield promiseCompleteAllInstalls([install]);
install = yield promiseInstallFile(do_get_addon("test_bootstrap1_2"));
do_check_eq(install.state, AddonManager.STATE_INSTALLED);
do_check_false(hasFlag(install.addon.pendingOperations, AddonManager.PENDING_INSTALL));
@ -109,8 +107,7 @@ add_task(function*() {
do_check_false(addon.seen);
// Updating through the API shouldn't change the state
let install = yield new Promise(resolve => AddonManager.getInstallForFile(do_get_addon("test_bootstrap1_2"), resolve));
yield promiseCompleteAllInstalls([install]);
let install = yield promiseInstallFile(do_get_addon("test_bootstrap1_2"));
do_check_eq(install.state, AddonManager.STATE_INSTALLED);
do_check_false(hasFlag(install.addon.pendingOperations, AddonManager.PENDING_INSTALL));
@ -190,8 +187,7 @@ add_task(function*() {
do_check_true(addon.seen);
// Updating through the API shouldn't change the state
let install = yield new Promise(resolve => AddonManager.getInstallForFile(do_get_addon("test_bootstrap1_2"), resolve));
yield promiseCompleteAllInstalls([install]);
let install = yield promiseInstallFile(do_get_addon("test_bootstrap1_2"));
do_check_eq(install.state, AddonManager.STATE_INSTALLED);
do_check_false(hasFlag(install.addon.pendingOperations, AddonManager.PENDING_INSTALL));

View File

@ -75,9 +75,7 @@ function createBrokenAddonRemove(file) {
}
function createInstall(url) {
return new Promise(resolve => {
AddonManager.getInstallForURL(url, resolve, "application/x-xpinstall");
});
return AddonManager.getInstallForURL(url, null, "application/x-xpinstall");
}
function serveUpdateRDF(leafName) {

View File

@ -34,12 +34,8 @@ add_task(function* test_working() {
// Checks the cases that should be broken
add_task(function* test_broken() {
function promiseInstallForFile(file) {
return new Promise(resolve => AddonManager.getInstallForFile(file, resolve));
}
let promises = [promiseInstallForFile(do_get_file(DATA + "long_63_hash.xpi")),
promiseInstallForFile(do_get_file(DATA + "long_64_hash.xpi"))];
let promises = [AddonManager.getInstallForFile(do_get_file(DATA + "long_63_hash.xpi")),
AddonManager.getInstallForFile(do_get_file(DATA + "long_64_hash.xpi"))];
let installs = yield Promise.all(promises);
for (let install of installs) {

View File

@ -16,8 +16,7 @@ createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2");
add_task(function*() {
startupManager();
let install = yield new Promise(resolve => AddonManager.getInstallForFile(do_get_addon("test_bootstrap1_1"), resolve));
yield promiseCompleteAllInstalls([install]);
yield promiseInstallFile(do_get_addon("test_bootstrap1_1"));
let addon = yield promiseAddonByID(ID);
do_check_neq(addon, null);

Some files were not shown because too many files have changed in this diff Show More