diff --git a/browser/components/payments/test/browser/browser.ini b/browser/components/payments/test/browser/browser.ini index 878d3a74b839..502190f0e647 100644 --- a/browser/components/payments/test/browser/browser.ini +++ b/browser/components/payments/test/browser/browser.ini @@ -11,7 +11,7 @@ support-files = [browser_address_edit.js] skip-if = verify && debug && os == 'mac' [browser_card_edit.js] -skip-if = (verify && debug && os == 'mac') || (os == 'linux' && debug) # bug 1465673 +skip-if = debug && (os == 'mac' || os == 'linux') # bug 1465673 [browser_change_shipping.js] [browser_dropdowns.js] [browser_host_name.js] diff --git a/dom/base/DOMPrefsInternal.h b/dom/base/DOMPrefsInternal.h index ef3d52812753..11188e4a5139 100644 --- a/dom/base/DOMPrefsInternal.h +++ b/dom/base/DOMPrefsInternal.h @@ -14,7 +14,6 @@ // returns the value of StaticPrefs::foo_bar(). // This is allows the use of DOMPrefs in WebIDL files. -DOM_WEBIDL_PREF(canvas_imagebitmap_extensions_enabled) DOM_WEBIDL_PREF(dom_caches_enabled) DOM_WEBIDL_PREF(dom_webnotifications_serviceworker_enabled) DOM_WEBIDL_PREF(dom_webnotifications_requireinteraction_enabled) diff --git a/dom/base/nsGlobalWindowInner.cpp b/dom/base/nsGlobalWindowInner.cpp index a30ca3f3a78e..f702ee5da7aa 100644 --- a/dom/base/nsGlobalWindowInner.cpp +++ b/dom/base/nsGlobalWindowInner.cpp @@ -3095,7 +3095,8 @@ nsGlobalWindowInner::GetOwnPropertyNames(JSContext* aCx, JS::AutoIdVector& aName nsGlobalWindowInner::IsPrivilegedChromeWindow(JSContext* aCx, JSObject* aObj) { // For now, have to deal with XPConnect objects here. - return xpc::WindowOrNull(aObj)->IsChromeWindow() && + nsGlobalWindowInner* win = xpc::WindowOrNull(aObj); + return win && win->IsChromeWindow() && nsContentUtils::ObjectPrincipal(aObj) == nsContentUtils::GetSystemPrincipal(); } @@ -7715,11 +7716,6 @@ nsGlobalWindowInner::CreateImageBitmap(JSContext* aCx, const ImageBitmapSource& aImage, ErrorResult& aRv) { - if (aImage.IsArrayBuffer() || aImage.IsArrayBufferView()) { - aRv.Throw(NS_ERROR_NOT_IMPLEMENTED); - return nullptr; - } - return ImageBitmap::Create(this, aImage, Nothing(), aRv); } @@ -7729,34 +7725,9 @@ nsGlobalWindowInner::CreateImageBitmap(JSContext* aCx, int32_t aSx, int32_t aSy, int32_t aSw, int32_t aSh, ErrorResult& aRv) { - if (aImage.IsArrayBuffer() || aImage.IsArrayBufferView()) { - aRv.Throw(NS_ERROR_NOT_IMPLEMENTED); - return nullptr; - } - return ImageBitmap::Create(this, aImage, Some(gfx::IntRect(aSx, aSy, aSw, aSh)), aRv); } -already_AddRefed -nsGlobalWindowInner::CreateImageBitmap(JSContext* aCx, - const ImageBitmapSource& aImage, - int32_t aOffset, int32_t aLength, - ImageBitmapFormat aFormat, - const Sequence& aLayout, - ErrorResult& aRv) -{ - if (!StaticPrefs::canvas_imagebitmap_extensions_enabled()) { - aRv.Throw(NS_ERROR_TYPE_ERR); - return nullptr; - } - if (aImage.IsArrayBuffer() || aImage.IsArrayBufferView()) { - return ImageBitmap::Create(this, aImage, aOffset, aLength, aFormat, aLayout, - aRv); - } - aRv.Throw(NS_ERROR_TYPE_ERR); - return nullptr; -} - mozilla::dom::TabGroup* nsGlobalWindowInner::TabGroupInner() { diff --git a/dom/base/nsGlobalWindowInner.h b/dom/base/nsGlobalWindowInner.h index e342f167f700..e70e13da21da 100644 --- a/dom/base/nsGlobalWindowInner.h +++ b/dom/base/nsGlobalWindowInner.h @@ -924,15 +924,6 @@ public: int32_t aSx, int32_t aSy, int32_t aSw, int32_t aSh, mozilla::ErrorResult& aRv); - already_AddRefed - CreateImageBitmap(JSContext* aCx, - const mozilla::dom::ImageBitmapSource& aImage, - int32_t aOffset, int32_t aLength, - mozilla::dom::ImageBitmapFormat aFormat, - const mozilla::dom::Sequence& aLayout, - mozilla::ErrorResult& aRv); - - // ChromeWindow bits. Do NOT call these unless your window is in // fact chrome. uint16_t WindowState(); diff --git a/dom/base/test/chrome/file_bug1139964.xul b/dom/base/test/chrome/file_bug1139964.xul index 936d2f2c608e..c4c0ac138889 100644 --- a/dom/base/test/chrome/file_bug1139964.xul +++ b/dom/base/test/chrome/file_bug1139964.xul @@ -32,7 +32,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1139964 ppm.removeMessageListener(msgName, processListener); ok(m.data.hasPromise, "ProcessGlobal should have Promise object in the global scope!"); ok(m.data.hasTextEncoder, "ProcessGlobal should have TextEncoder object in the global scope!"); - ok(!m.data.hasWindow, "ProcessGlobal should not have Window object in the global scope!"); + ok(m.data.hasWindow, "ProcessGlobal should have Window object in the global scope!"); messageManager.addMessageListener(msgName, tabListener) messageManager.loadFrameScript("data:,(" + mmScriptForPromiseTest.toString() + ")()", true); @@ -42,7 +42,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1139964 messageManager.removeMessageListener(msgName, tabListener); ok(m.data.hasPromise, "TabChildGlobal should have Promise object in the global scope!"); ok(m.data.hasTextEncoder, "TabChildGlobal should have TextEncoder object in the global scope!"); - ok(!m.data.hasWindow, "TabChildGlobal should not have Window object in the global scope!"); + ok(m.data.hasWindow, "TabChildGlobal should have Window object in the global scope!"); opener.setTimeout("done()", 0); window.close(); diff --git a/dom/bindings/Bindings.conf b/dom/bindings/Bindings.conf index 52f9a072aabb..be4287f99133 100644 --- a/dom/bindings/Bindings.conf +++ b/dom/bindings/Bindings.conf @@ -464,10 +464,6 @@ DOMInterfaces = { 'headerFile': 'xpcjsid.h', }, -'ImageBitmap': { - 'implicitJSContext': [ 'mapDataInto' ], -}, - 'ImageCapture': { 'binaryNames': { 'videoStreamTrack': 'GetVideoStreamTrack' } }, diff --git a/dom/bindings/Codegen.py b/dom/bindings/Codegen.py index 0aa9ab7ef87b..b7aad0af9b7a 100644 --- a/dom/bindings/Codegen.py +++ b/dom/bindings/Codegen.py @@ -2973,13 +2973,20 @@ class CGCreateInterfaceObjectsMethod(CGAbstractMethod): # if we don't need to create anything, why are we generating this? assert needInterfaceObject or needInterfacePrototypeObject + def maybecrash(reason): + if self.descriptor.name == "Document": + return 'MOZ_CRASH("Bug 1405521/1488480: %s");\n' % reason + return "" + getParentProto = fill( """ JS::${type} parentProto(${getParentProto}); if (!parentProto) { + $*{maybeCrash} return; } """, + maybeCrash=maybecrash("Can't get Node.prototype"), type=parentProtoType, getParentProto=getParentProto) @@ -2987,9 +2994,11 @@ class CGCreateInterfaceObjectsMethod(CGAbstractMethod): """ JS::${type} constructorProto(${getConstructorProto}); if (!constructorProto) { + $*{maybeCrash} return; } """, + maybeCrash=maybecrash("Can't get Node"), type=constructorProtoType, getConstructorProto=getConstructorProto) @@ -3005,7 +3014,12 @@ class CGCreateInterfaceObjectsMethod(CGAbstractMethod): for properties in idsToInit] idsInitedFlag = CGGeneric("static bool sIdsInited = false;\n") setFlag = CGGeneric("sIdsInited = true;\n") - initIdConditionals = [CGIfWrapper(CGGeneric("return;\n"), call) + initIdConditionals = [CGIfWrapper(CGGeneric(fill( + """ + $*{maybeCrash} + return; + """, + maybeCrash=maybecrash("Can't init IDs"))), call) for call in initIdCalls] initIds = CGList([idsInitedFlag, CGIfWrapper(CGList(initIdConditionals + [setFlag]), @@ -3208,10 +3222,12 @@ class CGCreateInterfaceObjectsMethod(CGAbstractMethod): JS::Rooted holderProto(aCx, ${holderProto}); unforgeableHolder = JS_NewObjectWithoutMetadata(aCx, ${holderClass}, holderProto); if (!unforgeableHolder) { + $*{maybeCrash} $*{failureCode} } } """, + maybeCrash=maybecrash("Can't create unforgeable holder"), holderProto=holderProto, holderClass=holderClass, failureCode=failureCode)) @@ -3547,12 +3563,22 @@ def InitUnforgeablePropertiesOnHolder(descriptor, properties, failureCode, unforgeables = [] + if descriptor.name == "Document": + maybeCrash = dedent( + """ + MOZ_CRASH("Bug 1405521/1488480: Can't define unforgeable attributes"); + """); + else: + maybeCrash = ""; + defineUnforgeableAttrs = fill( """ if (!DefineUnforgeableAttributes(aCx, ${holderName}, %s)) { + $*{maybeCrash} $*{failureCode} } """, + maybeCrash=maybeCrash, failureCode=failureCode, holderName=holderName) defineUnforgeableMethods = fill( @@ -17199,7 +17225,7 @@ class GlobalGenRoots(): curr = CGList([], "\n") descriptors = config.getDescriptors(hasInterfaceObject=True, - isExposedInSystemGlobals=True, + isExposedInWindow=True, register=True) properties = [desc.name for desc in descriptors] @@ -17244,7 +17270,7 @@ class GlobalGenRoots(): defineIncludes = [CGHeaders.getDeclarationFilename(desc.interface) for desc in config.getDescriptors(hasInterfaceObject=True, register=True, - isExposedInSystemGlobals=True)] + isExposedInWindow=True)] defineIncludes.append("nsThreadUtils.h") # For NS_IsMainThread defineIncludes.append("js/Id.h") # For jsid defineIncludes.append("mozilla/dom/WebIDLGlobalNameHash.h") diff --git a/dom/bindings/Configuration.py b/dom/bindings/Configuration.py index 79056d62f289..ae088415f831 100644 --- a/dom/bindings/Configuration.py +++ b/dom/bindings/Configuration.py @@ -250,8 +250,6 @@ class Configuration(DescriptorProvider): getter = lambda x: x.interface.isExposedInWorkerDebugger() elif key == 'isExposedInAnyWorklet': getter = lambda x: x.interface.isExposedInAnyWorklet() - elif key == 'isExposedInSystemGlobals': - getter = lambda x: x.interface.isExposedInSystemGlobals() elif key == 'isExposedInWindow': getter = lambda x: x.interface.isExposedInWindow() else: diff --git a/dom/bindings/parser/WebIDL.py b/dom/bindings/parser/WebIDL.py index d484a4a3e63a..085a924a0ba6 100644 --- a/dom/bindings/parser/WebIDL.py +++ b/dom/bindings/parser/WebIDL.py @@ -327,6 +327,13 @@ class IDLScope(IDLObject): assert identifier.scope == self return self._lookupIdentifier(identifier) + def addIfaceGlobalNames(self, interfaceName, globalNames): + """Record the global names (from |globalNames|) that can be used in + [Exposed] to expose things in a global named |interfaceName|""" + self.globalNames.update(globalNames) + for name in globalNames: + self.globalNameMapping[name].add(interfaceName) + class IDLIdentifier(IDLObject): def __init__(self, location, scope, name): @@ -504,8 +511,10 @@ class IDLExposureMixins(): return 'Window' in self.exposureSet def isExposedOnMainThread(self): - return (self.isExposedInWindow() or - self.isExposedInSystemGlobals()) + return self.isExposedInWindow() + + def isExposedOffMainThread(self): + return len(self.exposureSet - {'Window', 'FakeTestPrimaryGlobal'}) > 0 def isExposedInAnyWorker(self): return len(self.getWorkerExposureSet()) > 0 @@ -516,9 +525,6 @@ class IDLExposureMixins(): def isExposedInAnyWorklet(self): return len(self.getWorkletExposureSet()) > 0 - def isExposedInSystemGlobals(self): - return 'BackstagePass' in self.exposureSet - def isExposedInSomeButNotAllWorkers(self): """ Returns true if the Exposed extended attribute for this interface @@ -1323,10 +1329,9 @@ class IDLInterfaceOrNamespace(IDLObjectWithScope, IDLExposureMixins): checkDuplicateNames(member, bindingAlias, "BindingAlias") - if (self.getExtendedAttribute("Pref") and - self._exposureGlobalNames != set([self.parentScope.primaryGlobalName])): - raise WebIDLError("[Pref] used on an interface that is not %s-only" % - self.parentScope.primaryGlobalName, + if self.getExtendedAttribute("Pref") and self.isExposedOffMainThread(): + raise WebIDLError("[Pref] used on an interface that is not " + "main-thread-only", [self.location]) # Conditional exposure makes no sense for interfaces with no @@ -1710,9 +1715,8 @@ class IDLInterface(IDLInterfaceOrNamespace): self.globalNames = attr.args() else: self.globalNames = [self.identifier.name] - self.parentScope.globalNames.update(self.globalNames) - for globalName in self.globalNames: - self.parentScope.globalNameMapping[globalName].add(self.identifier.name) + self.parentScope.addIfaceGlobalNames(self.identifier.name, + self.globalNames) self._isOnGlobalProtoChain = True elif identifier == "PrimaryGlobal": if not attr.noArguments(): @@ -1725,8 +1729,8 @@ class IDLInterface(IDLInterfaceOrNamespace): self.parentScope.primaryGlobalAttr.location]) self.parentScope.primaryGlobalAttr = attr self.parentScope.primaryGlobalName = self.identifier.name - self.parentScope.globalNames.add(self.identifier.name) - self.parentScope.globalNameMapping[self.identifier.name].add(self.identifier.name) + self.parentScope.addIfaceGlobalNames(self.identifier.name, + [self.identifier.name]) self._isOnGlobalProtoChain = True elif identifier == "SecureContext": if not attr.noArguments(): @@ -3572,10 +3576,9 @@ class IDLInterfaceMember(IDLObjectWithIdentifier, IDLExposureMixins): IDLExposureMixins.finish(self, scope) def validate(self): - if (self.getExtendedAttribute("Pref") and - self.exposureSet != set([self._globalScope.primaryGlobalName])): + if self.getExtendedAttribute("Pref") and self.isExposedOffMainThread(): raise WebIDLError("[Pref] used on an interface member that is not " - "%s-only" % self._globalScope.primaryGlobalName, + "main-thread-only", [self.location]) if self.isAttr() or self.isMethod(): @@ -6896,16 +6899,13 @@ class Parser(Tokenizer): logger.reportGrammarErrors() self._globalScope = IDLScope(BuiltinLocation(""), None, None) + # To make our test harness work, pretend like we have a primary global already. # Note that we _don't_ set _globalScope.primaryGlobalAttr, # so we'll still be able to detect multiple PrimaryGlobal extended attributes. self._globalScope.primaryGlobalName = "FakeTestPrimaryGlobal" - self._globalScope.globalNames.add("FakeTestPrimaryGlobal") - self._globalScope.globalNameMapping["FakeTestPrimaryGlobal"].add("FakeTestPrimaryGlobal") - # And we add the special-cased "System" global name, which - # doesn't have any corresponding interfaces. - self._globalScope.globalNames.add("System") - self._globalScope.globalNameMapping["System"].add("BackstagePass") + self._globalScope.addIfaceGlobalNames("FakeTestPrimaryGlobal", ["FakeTestPrimaryGlobal"]) + self._installBuiltins(self._globalScope) self._productions = [] diff --git a/dom/canvas/ImageBitmap.cpp b/dom/canvas/ImageBitmap.cpp index 79b0f22c77ee..15e1cf1a5c66 100644 --- a/dom/canvas/ImageBitmap.cpp +++ b/dom/canvas/ImageBitmap.cpp @@ -18,9 +18,12 @@ #include "mozilla/gfx/Swizzle.h" #include "mozilla/Mutex.h" #include "mozilla/ScopeExit.h" +#include "nsNetUtil.h" +#include "nsStreamUtils.h" #include "ImageBitmapColorUtils.h" #include "ImageBitmapUtils.h" #include "ImageUtils.h" +#include "imgLoader.h" #include "imgTools.h" using namespace mozilla::gfx; @@ -482,7 +485,7 @@ GetSurfaceFromElement(nsIGlobalObject* aGlobal, HTMLElementType& aElement, Error RefPtr surface = res.GetSourceSurface(); if (NS_WARN_IF(!surface)) { - aRv.Throw(NS_ERROR_NOT_AVAILABLE); + aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR); return nullptr; } @@ -522,7 +525,6 @@ ImageBitmap::ImageBitmap(nsIGlobalObject* aGlobal, layers::Image* aData, , mDataWrapper(new ImageUtils(mData)) , mPictureRect(0, 0, aData->GetSize().width, aData->GetSize().height) , mAlphaType(aAlphaType) - , mIsCroppingAreaOutSideOfSourceImage(false) , mAllocatedImageData(false) { MOZ_ASSERT(aData, "aData is null in ImageBitmap constructor."); @@ -569,23 +571,6 @@ ImageBitmap::SetPictureRect(const IntRect& aRect, ErrorResult& aRv) mPictureRect = FixUpNegativeDimension(aRect, aRv); } -void -ImageBitmap::SetIsCroppingAreaOutSideOfSourceImage(const IntSize& aSourceSize, - const Maybe& aCroppingRect) -{ - // No cropping at all. - if (aCroppingRect.isNothing()) { - mIsCroppingAreaOutSideOfSourceImage = false; - return; - } - - if (aCroppingRect->X() < 0 || aCroppingRect->Y() < 0 || - aCroppingRect->Width() > aSourceSize.width || - aCroppingRect->Height() > aSourceSize.height) { - mIsCroppingAreaOutSideOfSourceImage = true; - } -} - static already_AddRefed ConvertColorFormatIfNeeded(RefPtr aSurface) { @@ -800,7 +785,6 @@ ImageBitmap::ToCloneData() const UniquePtr result(new ImageBitmapCloneData()); result->mPictureRect = mPictureRect; result->mAlphaType = mAlphaType; - result->mIsCroppingAreaOutSideOfSourceImage = mIsCroppingAreaOutSideOfSourceImage; RefPtr surface = mData->GetAsSourceSurface(); result->mSurface = surface->GetDataSurface(); MOZ_ASSERT(result->mSurface); @@ -829,9 +813,6 @@ ImageBitmap::CreateFromCloneData(nsIGlobalObject* aGlobal, ret->mAllocatedImageData = true; - ret->mIsCroppingAreaOutSideOfSourceImage = - aData->mIsCroppingAreaOutSideOfSourceImage; - ErrorResult rv; ret->SetPictureRect(aData->mPictureRect, rv); return ret.forget(); @@ -908,9 +889,6 @@ ImageBitmap::CreateInternal(nsIGlobalObject* aGlobal, HTMLImageElement& aImageEl ret->SetPictureRect(aCropRect.ref(), aRv); } - // Set mIsCroppingAreaOutSideOfSourceImage. - ret->SetIsCroppingAreaOutSideOfSourceImage(surface->GetSize(), aCropRect); - return ret.forget(); } @@ -954,9 +932,6 @@ ImageBitmap::CreateInternal(nsIGlobalObject* aGlobal, HTMLVideoElement& aVideoEl ret->SetPictureRect(aCropRect.ref(), aRv); } - // Set mIsCroppingAreaOutSideOfSourceImage. - ret->SetIsCroppingAreaOutSideOfSourceImage(data->GetSize(), aCropRect); - return ret.forget(); } @@ -996,7 +971,7 @@ ImageBitmap::CreateInternal(nsIGlobalObject* aGlobal, HTMLCanvasElement& aCanvas } if (NS_WARN_IF(!croppedSurface)) { - aRv.Throw(NS_ERROR_NOT_AVAILABLE); + aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR); return nullptr; } @@ -1004,7 +979,7 @@ ImageBitmap::CreateInternal(nsIGlobalObject* aGlobal, HTMLCanvasElement& aCanvas RefPtr data = CreateImageFromSurface(croppedSurface); if (NS_WARN_IF(!data)) { - aRv.Throw(NS_ERROR_NOT_AVAILABLE); + aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR); return nullptr; } @@ -1019,9 +994,6 @@ ImageBitmap::CreateInternal(nsIGlobalObject* aGlobal, HTMLCanvasElement& aCanvas ret->SetPictureRect(cropRect, aRv); } - // Set mIsCroppingAreaOutSideOfSourceImage. - ret->SetIsCroppingAreaOutSideOfSourceImage(surface->GetSize(), aCropRect); - return ret.forget(); } @@ -1071,7 +1043,7 @@ ImageBitmap::CreateInternal(nsIGlobalObject* aGlobal, ImageData& aImageData, } if (NS_WARN_IF(!data)) { - aRv.Throw(NS_ERROR_NOT_AVAILABLE); + aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR); return nullptr; } @@ -1083,9 +1055,6 @@ ImageBitmap::CreateInternal(nsIGlobalObject* aGlobal, ImageData& aImageData, // The cropping information has been handled in the CreateImageFromRawData() // function. - // Set mIsCroppingAreaOutSideOfSourceImage. - ret->SetIsCroppingAreaOutSideOfSourceImage(imageSize, aCropRect); - return ret.forget(); } @@ -1128,9 +1097,6 @@ ImageBitmap::CreateInternal(nsIGlobalObject* aGlobal, CanvasRenderingContext2D& ret->SetPictureRect(aCropRect.ref(), aRv); } - // Set mIsCroppingAreaOutSideOfSourceImage. - ret->SetIsCroppingAreaOutSideOfSourceImage(surface->GetSize(), aCropRect); - return ret.forget(); } @@ -1139,7 +1105,7 @@ ImageBitmap::CreateInternal(nsIGlobalObject* aGlobal, ImageBitmap& aImageBitmap, const Maybe& aCropRect, ErrorResult& aRv) { if (!aImageBitmap.mData) { - aRv.Throw(NS_ERROR_NOT_AVAILABLE); + aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR); return nullptr; } @@ -1151,14 +1117,6 @@ ImageBitmap::CreateInternal(nsIGlobalObject* aGlobal, ImageBitmap& aImageBitmap, ret->SetPictureRect(aCropRect.ref(), aRv); } - // Set mIsCroppingAreaOutSideOfSourceImage. - if (aImageBitmap.mIsCroppingAreaOutSideOfSourceImage == true) { - ret->mIsCroppingAreaOutSideOfSourceImage = true; - } else { - ret->SetIsCroppingAreaOutSideOfSourceImage(aImageBitmap.mPictureRect.Size(), - aCropRect); - } - return ret.forget(); } @@ -1234,12 +1192,14 @@ class CreateImageBitmapFromBlobRunnable; class CreateImageBitmapFromBlob final : public CancelableRunnable , public imgIContainerCallback + , public nsIInputStreamCallback { friend class CreateImageBitmapFromBlobRunnable; public: NS_DECL_ISUPPORTS_INHERITED NS_DECL_IMGICONTAINERCALLBACK + NS_DECL_NSIINPUTSTREAMCALLBACK static already_AddRefed Create(Promise* aPromise, @@ -1252,9 +1212,9 @@ public: { MOZ_ASSERT(IsCurrentThread()); - nsresult rv = StartDecodeAndCropBlob(); + nsresult rv = StartMimeTypeAndDecodeAndCropBlob(); if (NS_WARN_IF(NS_FAILED(rv))) { - DecodeAndCropBlobCompletedMainThread(nullptr, rv); + MimeTypeAndDecodeAndCropBlobCompletedMainThread(nullptr, rv); } return NS_OK; @@ -1267,7 +1227,6 @@ private: CreateImageBitmapFromBlob(Promise* aPromise, nsIGlobalObject* aGlobal, already_AddRefed aInputStream, - const nsACString& aMimeType, const Maybe& aCropRect, nsIEventTarget* aMainThreadEventTarget) : CancelableRunnable("dom::CreateImageBitmapFromBlob") @@ -1275,7 +1234,6 @@ private: , mPromise(aPromise) , mGlobalObject(aGlobal) , mInputStream(std::move(aInputStream)) - , mMimeType(aMimeType) , mCropRect(aCropRect) , mOriginalCropRect(aCropRect) , mMainThreadEventTarget(aMainThreadEventTarget) @@ -1293,20 +1251,29 @@ private: } // Called on the owning thread. - nsresult StartDecodeAndCropBlob(); + nsresult StartMimeTypeAndDecodeAndCropBlob(); // Will be called when the decoding + cropping is completed on the // main-thread. This could the not the owning thread! - void DecodeAndCropBlobCompletedMainThread(layers::Image* aImage, - nsresult aStatus); + void MimeTypeAndDecodeAndCropBlobCompletedMainThread(layers::Image* aImage, + nsresult aStatus); // Will be called when the decoding + cropping is completed on the owning // thread. - void DecodeAndCropBlobCompletedOwningThread(layers::Image* aImage, - nsresult aStatus); + void MimeTypeAndDecodeAndCropBlobCompletedOwningThread(layers::Image* aImage, + nsresult aStatus); // This is called on the main-thread only. - nsresult DecodeAndCropBlob(); + nsresult MimeTypeAndDecodeAndCropBlob(); + + // This is called on the main-thread only. + nsresult DecodeAndCropBlob(const nsACString& aMimeType); + + // This is called on the main-thread only. + nsresult GetMimeTypeSync(nsACString& aMimeType); + + // This is called on the main-thread only. + nsresult GetMimeTypeAsync(); Mutex mMutex; @@ -1321,7 +1288,6 @@ private: nsCOMPtr mGlobalObject; nsCOMPtr mInputStream; - nsCString mMimeType; Maybe mCropRect; Maybe mOriginalCropRect; IntSize mSourceSize; @@ -1331,7 +1297,7 @@ private: }; NS_IMPL_ISUPPORTS_INHERITED(CreateImageBitmapFromBlob, CancelableRunnable, - imgIContainerCallback) + imgIContainerCallback, nsIInputStreamCallback) class CreateImageBitmapFromBlobRunnable : public WorkerRunnable { @@ -1349,7 +1315,7 @@ public: bool WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate) override { - mTask->DecodeAndCropBlobCompletedOwningThread(mImage, mStatus); + mTask->MimeTypeAndDecodeAndCropBlobCompletedOwningThread(mImage, mStatus); return true; } @@ -1427,7 +1393,7 @@ ImageBitmap::Create(nsIGlobalObject* aGlobal, const ImageBitmapSource& aSrc, AsyncCreateImageBitmapFromBlob(promise, aGlobal, aSrc.GetAsBlob(), aCropRect); return promise.forget(); } else { - aRv.Throw(NS_ERROR_NOT_IMPLEMENTED); + MOZ_CRASH("Unsupported type!"); return nullptr; } @@ -1454,15 +1420,16 @@ ImageBitmap::ReadStructuredClone(JSContext* aCx, uint32_t picRectWidth_; uint32_t picRectHeight_; uint32_t alphaType_; - uint32_t isCroppingAreaOutSideOfSourceImage_; + uint32_t dummy; if (!JS_ReadUint32Pair(aReader, &picRectX_, &picRectY_) || !JS_ReadUint32Pair(aReader, &picRectWidth_, &picRectHeight_) || - !JS_ReadUint32Pair(aReader, &alphaType_, - &isCroppingAreaOutSideOfSourceImage_)) { + !JS_ReadUint32Pair(aReader, &alphaType_, &dummy)) { return nullptr; } + MOZ_ASSERT(dummy == 0); + int32_t picRectX = BitwiseCast(picRectX_); int32_t picRectY = BitwiseCast(picRectY_); int32_t picRectWidth = BitwiseCast(picRectWidth_); @@ -1488,9 +1455,6 @@ ImageBitmap::ReadStructuredClone(JSContext* aCx, RefPtr img = CreateImageFromSurface(aClonedSurfaces[aIndex]); RefPtr imageBitmap = new ImageBitmap(aParent, img, alphaType); - imageBitmap->mIsCroppingAreaOutSideOfSourceImage = - isCroppingAreaOutSideOfSourceImage_; - ErrorResult error; imageBitmap->SetPictureRect(IntRect(picRectX, picRectY, picRectWidth, picRectHeight), error); @@ -1522,7 +1486,6 @@ ImageBitmap::WriteStructuredClone(JSStructuredCloneWriter* aWriter, const uint32_t picRectWidth = BitwiseCast(aImageBitmap->mPictureRect.width); const uint32_t picRectHeight = BitwiseCast(aImageBitmap->mPictureRect.height); const uint32_t alphaType = BitwiseCast(aImageBitmap->mAlphaType); - const uint32_t isCroppingAreaOutSideOfSourceImage = aImageBitmap->mIsCroppingAreaOutSideOfSourceImage ? 1 : 0; // Indexing the cloned surfaces and send the index to the receiver. uint32_t index = aClonedSurfaces.Length(); @@ -1530,8 +1493,7 @@ ImageBitmap::WriteStructuredClone(JSStructuredCloneWriter* aWriter, if (NS_WARN_IF(!JS_WriteUint32Pair(aWriter, SCTAG_DOM_IMAGEBITMAP, index)) || NS_WARN_IF(!JS_WriteUint32Pair(aWriter, picRectX, picRectY)) || NS_WARN_IF(!JS_WriteUint32Pair(aWriter, picRectWidth, picRectHeight)) || - NS_WARN_IF(!JS_WriteUint32Pair(aWriter, alphaType, - isCroppingAreaOutSideOfSourceImage))) { + NS_WARN_IF(!JS_WriteUint32Pair(aWriter, alphaType, 0))) { return false; } @@ -1558,573 +1520,6 @@ ImageBitmap::WriteStructuredClone(JSStructuredCloneWriter* aWriter, return true; } -// ImageBitmap extensions. -ImageBitmapFormat -ImageBitmap::FindOptimalFormat(const Optional>& aPossibleFormats, - ErrorResult& aRv) -{ - if (!mDataWrapper) { - aRv.Throw(NS_ERROR_NOT_AVAILABLE); - return ImageBitmapFormat::EndGuard_; - } - - ImageBitmapFormat platformFormat = mDataWrapper->GetFormat(); - - if (!aPossibleFormats.WasPassed() || - aPossibleFormats.Value().Contains(platformFormat)) { - return platformFormat; - } else { - // If no matching is found, FindBestMatchingFromat() returns - // ImageBitmapFormat::EndGuard_ and we throw an exception. - ImageBitmapFormat optimalFormat = - FindBestMatchingFromat(platformFormat, aPossibleFormats.Value()); - - if (optimalFormat == ImageBitmapFormat::EndGuard_) { - aRv.Throw(NS_ERROR_NOT_IMPLEMENTED); - } - - return optimalFormat; - } -} - -int32_t -ImageBitmap::MappedDataLength(ImageBitmapFormat aFormat, ErrorResult& aRv) -{ - if (!mDataWrapper) { - aRv.Throw(NS_ERROR_NOT_AVAILABLE); - return 0; - } - - if (aFormat == mDataWrapper->GetFormat()) { - return mDataWrapper->GetBufferLength(); - } else { - return CalculateImageBufferSize(aFormat, Width(), Height()); - } -} - -template -class MapDataIntoBufferSource -{ -protected: - MapDataIntoBufferSource(JSContext* aCx, - Promise *aPromise, - ImageBitmap *aImageBitmap, - const T& aBuffer, - int32_t aOffset, - ImageBitmapFormat aFormat) - : mPromise(aPromise) - , mImageBitmap(aImageBitmap) - , mBuffer(aCx, aBuffer.Obj()) - , mOffset(aOffset) - , mFormat(aFormat) - { - MOZ_ASSERT(mPromise); - MOZ_ASSERT(JS_IsArrayBufferObject(mBuffer) || - JS_IsArrayBufferViewObject(mBuffer)); - } - - virtual ~MapDataIntoBufferSource() = default; - - void DoMapDataIntoBufferSource() - { - ErrorResult error; - - auto rejectByDefault = - MakeScopeExit([this, &error]() { - this->mPromise->MaybeReject(error); - }); - - if (!mImageBitmap->mDataWrapper) { - error.Throw(NS_ERROR_NOT_AVAILABLE); - return; - } - - // Prepare destination buffer. - uint8_t* bufferData = nullptr; - uint32_t bufferLength = 0; - bool isSharedMemory = false; - if (JS_IsArrayBufferObject(mBuffer)) { - js::GetArrayBufferLengthAndData(mBuffer, &bufferLength, &isSharedMemory, &bufferData); - } else if (JS_IsArrayBufferViewObject(mBuffer)) { - js::GetArrayBufferViewLengthAndData(mBuffer, &bufferLength, &isSharedMemory, &bufferData); - } else { - error.Throw(NS_ERROR_NOT_IMPLEMENTED); - return; - } - - if (NS_WARN_IF(!bufferData) || NS_WARN_IF(!bufferLength)) { - error.Throw(NS_ERROR_NOT_AVAILABLE); - return; - } - - // Check length. - const int32_t neededBufferLength = - mImageBitmap->MappedDataLength(mFormat, error); - - if (((int32_t)bufferLength - mOffset) < neededBufferLength) { - error.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR); - return; - } - - // Call ImageBitmapFormatUtils. - UniquePtr layout = - mImageBitmap->mDataWrapper->MapDataInto(bufferData, - mOffset, - bufferLength, - mFormat, - error); - - if (NS_WARN_IF(!layout)) { - return; - } - - rejectByDefault.release(); - mPromise->MaybeResolve(*layout); - } - - RefPtr mPromise; - RefPtr mImageBitmap; - JS::PersistentRooted mBuffer; - int32_t mOffset; - ImageBitmapFormat mFormat; -}; - -template -class MapDataIntoBufferSourceTask final : public Runnable, - public MapDataIntoBufferSource -{ -public: - MapDataIntoBufferSourceTask(JSContext* aCx, - Promise* aPromise, - ImageBitmap* aImageBitmap, - const T& aBuffer, - int32_t aOffset, - ImageBitmapFormat aFormat) - : Runnable("dom::MapDataIntoBufferSourceTask") - , MapDataIntoBufferSource(aCx, - aPromise, - aImageBitmap, - aBuffer, - aOffset, - aFormat) - { - } - - virtual ~MapDataIntoBufferSourceTask() = default; - - NS_IMETHOD Run() override - { - MapDataIntoBufferSource::DoMapDataIntoBufferSource(); - return NS_OK; - } -}; - -template -class MapDataIntoBufferSourceWorkerTask final : public WorkerSameThreadRunnable, - public MapDataIntoBufferSource -{ -public: - MapDataIntoBufferSourceWorkerTask(JSContext* aCx, - Promise *aPromise, - ImageBitmap *aImageBitmap, - const T& aBuffer, - int32_t aOffset, - ImageBitmapFormat aFormat) - : WorkerSameThreadRunnable(GetCurrentThreadWorkerPrivate()), - MapDataIntoBufferSource(aCx, aPromise, aImageBitmap, aBuffer, aOffset, aFormat) - { - } - - virtual ~MapDataIntoBufferSourceWorkerTask() = default; - - bool WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate) override - { - MapDataIntoBufferSource::DoMapDataIntoBufferSource(); - return true; - } -}; - -void AsyncMapDataIntoBufferSource(JSContext* aCx, - Promise *aPromise, - ImageBitmap *aImageBitmap, - const ArrayBufferViewOrArrayBuffer& aBuffer, - int32_t aOffset, - ImageBitmapFormat aFormat) -{ - MOZ_ASSERT(aCx); - MOZ_ASSERT(aPromise); - MOZ_ASSERT(aImageBitmap); - - if (NS_IsMainThread()) { - nsCOMPtr task; - - if (aBuffer.IsArrayBuffer()) { - const ArrayBuffer& buffer = aBuffer.GetAsArrayBuffer(); - task = new MapDataIntoBufferSourceTask(aCx, aPromise, aImageBitmap, buffer, aOffset, aFormat); - } else if (aBuffer.IsArrayBufferView()) { - const ArrayBufferView& bufferView = aBuffer.GetAsArrayBufferView(); - task = new MapDataIntoBufferSourceTask(aCx, aPromise, aImageBitmap, bufferView, aOffset, aFormat); - } - - NS_DispatchToCurrentThread(task); // Actually, to the main-thread. - } else { - RefPtr task; - - if (aBuffer.IsArrayBuffer()) { - const ArrayBuffer& buffer = aBuffer.GetAsArrayBuffer(); - task = new MapDataIntoBufferSourceWorkerTask(aCx, aPromise, aImageBitmap, buffer, aOffset, aFormat); - } else if (aBuffer.IsArrayBufferView()) { - const ArrayBufferView& bufferView = aBuffer.GetAsArrayBufferView(); - task = new MapDataIntoBufferSourceWorkerTask(aCx, aPromise, aImageBitmap, bufferView, aOffset, aFormat); - } - - task->Dispatch(); // Actually, to the current worker-thread. - } -} - -already_AddRefed -ImageBitmap::MapDataInto(JSContext* aCx, - ImageBitmapFormat aFormat, - const ArrayBufferViewOrArrayBuffer& aBuffer, - int32_t aOffset, ErrorResult& aRv) -{ - MOZ_ASSERT(aCx, "No JSContext while calling ImageBitmap::MapDataInto()."); - - RefPtr promise = Promise::Create(mParent, aRv); - - if (NS_WARN_IF(aRv.Failed())) { - return nullptr; - } - - if (!mDataWrapper) { - aRv.Throw(NS_ERROR_NOT_AVAILABLE); - return promise.forget(); - - } - - // Check for cases that should throws. - // Case 1: - // If image bitmap was cropped to the source rectangle so that it contains any - // transparent black pixels (cropping area is outside of the source image), - // then reject promise with IndexSizeError and abort these steps. - if (mIsCroppingAreaOutSideOfSourceImage) { - aRv.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR); - return promise.forget(); - } - - // Case 2: - // If the image bitmap is going to be accessed in YUV422/YUV422 series with a - // cropping area starts at an odd x or y coordinate. - if (aFormat == ImageBitmapFormat::YUV422P || - aFormat == ImageBitmapFormat::YUV420P || - aFormat == ImageBitmapFormat::YUV420SP_NV12 || - aFormat == ImageBitmapFormat::YUV420SP_NV21) { - if ((mPictureRect.x & 1) || (mPictureRect.y & 1)) { - aRv.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR); - return promise.forget(); - } - } - - AsyncMapDataIntoBufferSource(aCx, promise, this, aBuffer, aOffset, aFormat); - return promise.forget(); -} - -// ImageBitmapFactories extensions. -static SurfaceFormat -ImageFormatToSurfaceFromat(mozilla::dom::ImageBitmapFormat aFormat) -{ - switch(aFormat) { - case ImageBitmapFormat::RGBA32: - return SurfaceFormat::R8G8B8A8; - case ImageBitmapFormat::BGRA32: - return SurfaceFormat::B8G8R8A8; - case ImageBitmapFormat::RGB24: - return SurfaceFormat::R8G8B8; - case ImageBitmapFormat::BGR24: - return SurfaceFormat::B8G8R8; - case ImageBitmapFormat::GRAY8: - return SurfaceFormat::A8; - case ImageBitmapFormat::HSV: - return SurfaceFormat::HSV; - case ImageBitmapFormat::Lab: - return SurfaceFormat::Lab; - case ImageBitmapFormat::DEPTH: - return SurfaceFormat::Depth; - default: - return SurfaceFormat::UNKNOWN; - } -} - -static already_AddRefed -CreateImageFromBufferSourceRawData(const uint8_t*aBufferData, - uint32_t aBufferLength, - mozilla::dom::ImageBitmapFormat aFormat, - const Sequence& aLayout) -{ - MOZ_ASSERT(aBufferData); - MOZ_ASSERT(aBufferLength > 0); - - switch(aFormat) { - case ImageBitmapFormat::RGBA32: - case ImageBitmapFormat::BGRA32: - case ImageBitmapFormat::RGB24: - case ImageBitmapFormat::BGR24: - case ImageBitmapFormat::GRAY8: - case ImageBitmapFormat::HSV: - case ImageBitmapFormat::Lab: - case ImageBitmapFormat::DEPTH: - { - const nsTArray& channels = aLayout; - MOZ_ASSERT(channels.Length() != 0, "Empty Channels."); - - const SurfaceFormat srcFormat = ImageFormatToSurfaceFromat(aFormat); - const uint32_t srcStride = channels[0].mStride; - const IntSize srcSize(channels[0].mWidth, channels[0].mHeight); - - RefPtr dstDataSurface = - Factory::CreateDataSourceSurfaceWithStride(srcSize, srcFormat, srcStride); - - if (NS_WARN_IF(!dstDataSurface)) { - return nullptr; - } - - // Copy the raw data into the newly created DataSourceSurface. - DataSourceSurface::ScopedMap dstMap(dstDataSurface, DataSourceSurface::WRITE); - if (NS_WARN_IF(!dstMap.IsMapped())) { - return nullptr; - } - - const uint8_t* srcBufferPtr = aBufferData; - uint8_t* dstBufferPtr = dstMap.GetData(); - - for (int i = 0; i < srcSize.height; ++i) { - memcpy(dstBufferPtr, srcBufferPtr, srcStride); - srcBufferPtr += srcStride; - dstBufferPtr += dstMap.GetStride(); - } - - // Create an Image from the BGRA SourceSurface. - RefPtr surface = dstDataSurface; - RefPtr image = CreateImageFromSurface(surface); - - if (NS_WARN_IF(!image)) { - return nullptr; - } - - return image.forget(); - } - case ImageBitmapFormat::YUV444P: - case ImageBitmapFormat::YUV422P: - case ImageBitmapFormat::YUV420P: - case ImageBitmapFormat::YUV420SP_NV12: - case ImageBitmapFormat::YUV420SP_NV21: - { - // Prepare the PlanarYCbCrData. - const ChannelPixelLayout& yLayout = aLayout[0]; - const ChannelPixelLayout& uLayout = aFormat != ImageBitmapFormat::YUV420SP_NV21 ? aLayout[1] : aLayout[2]; - const ChannelPixelLayout& vLayout = aFormat != ImageBitmapFormat::YUV420SP_NV21 ? aLayout[2] : aLayout[1]; - - layers::PlanarYCbCrData data; - - // Luminance buffer - data.mYChannel = const_cast(aBufferData + yLayout.mOffset); - data.mYStride = yLayout.mStride; - data.mYSize = gfx::IntSize(yLayout.mWidth, yLayout.mHeight); - data.mYSkip = yLayout.mSkip; - - // Chroma buffers - data.mCbChannel = const_cast(aBufferData + uLayout.mOffset); - data.mCrChannel = const_cast(aBufferData + vLayout.mOffset); - data.mCbCrStride = uLayout.mStride; - data.mCbCrSize = gfx::IntSize(uLayout.mWidth, uLayout.mHeight); - data.mCbSkip = uLayout.mSkip; - data.mCrSkip = vLayout.mSkip; - - // Picture rectangle. - // We set the picture rectangle to exactly the size of the source image to - // keep the full original data. - data.mPicX = 0; - data.mPicY = 0; - data.mPicSize = data.mYSize; - - // Create a layers::Image and set data. - if (aFormat == ImageBitmapFormat::YUV444P || - aFormat == ImageBitmapFormat::YUV422P || - aFormat == ImageBitmapFormat::YUV420P) { - RefPtr image = - new layers::RecyclingPlanarYCbCrImage(new layers::BufferRecycleBin()); - - if (NS_WARN_IF(!image)) { - return nullptr; - } - - // Set Data. - if (NS_WARN_IF(!image->CopyData(data))) { - return nullptr; - } - - return image.forget(); - } else { - RefPtrimage = new layers::NVImage(); - - if (NS_WARN_IF(!image)) { - return nullptr; - } - - // Set Data. - if (NS_WARN_IF(!image->SetData(data))) { - return nullptr; - } - - return image.forget(); - } - } - default: - return nullptr; - } -} - -/* - * This is a synchronous task. - * This class is used to create a layers::CairoImage from raw data in the main - * thread. While creating an ImageBitmap from an BufferSource, we need to create - * a SouceSurface from the BufferSource raw data and then set the SourceSurface - * into a layers::CairoImage. However, the layers::CairoImage asserts the - * setting operation in the main thread, so if we are going to create an - * ImageBitmap from an BufferSource off the main thread, we post an event to the - * main thread to create a layers::CairoImage from an BufferSource raw data. - * - * TODO: Once the layers::CairoImage is constructible off the main thread, which - * means the SouceSurface could be released anywhere, we do not need this - * task anymore. - */ -class CreateImageFromBufferSourceRawDataInMainThreadSyncTask final : - public WorkerMainThreadRunnable -{ -public: - CreateImageFromBufferSourceRawDataInMainThreadSyncTask(const uint8_t* aBuffer, - uint32_t aBufferLength, - mozilla::dom::ImageBitmapFormat aFormat, - const Sequence& aLayout, - /*output*/ layers::Image** aImage) - : WorkerMainThreadRunnable(GetCurrentThreadWorkerPrivate(), - NS_LITERAL_CSTRING("ImageBitmap-extensions :: Create Image from BufferSource Raw Data")) - , mImage(aImage) - , mBuffer(aBuffer) - , mBufferLength(aBufferLength) - , mFormat(aFormat) - , mLayout(aLayout) - { - MOZ_ASSERT(!(*aImage), "Don't pass an existing Image into CreateImageFromBufferSourceRawDataInMainThreadSyncTask."); - } - - bool MainThreadRun() override - { - RefPtr image = - CreateImageFromBufferSourceRawData(mBuffer, mBufferLength, mFormat, mLayout); - - if (NS_WARN_IF(!image)) { - return true; - } - - image.forget(mImage); - - return true; - } - -private: - layers::Image** mImage; - const uint8_t* mBuffer; - uint32_t mBufferLength; - mozilla::dom::ImageBitmapFormat mFormat; - const Sequence& mLayout; -}; - -/*static*/ already_AddRefed -ImageBitmap::Create(nsIGlobalObject* aGlobal, - const ImageBitmapSource& aBuffer, - int32_t aOffset, int32_t aLength, - mozilla::dom::ImageBitmapFormat aFormat, - const Sequence& aLayout, - ErrorResult& aRv) -{ - MOZ_ASSERT(aGlobal); - - RefPtr promise = Promise::Create(aGlobal, aRv); - - if (NS_WARN_IF(aRv.Failed())) { - return nullptr; - } - - uint8_t* bufferData = nullptr; - uint32_t bufferLength = 0; - - if (aBuffer.IsArrayBuffer()) { - const ArrayBuffer& buffer = aBuffer.GetAsArrayBuffer(); - buffer.ComputeLengthAndData(); - bufferData = buffer.Data(); - bufferLength = buffer.Length(); - } else if (aBuffer.IsArrayBufferView()) { - const ArrayBufferView& bufferView = aBuffer.GetAsArrayBufferView(); - bufferView.ComputeLengthAndData(); - bufferData = bufferView.Data(); - bufferLength = bufferView.Length(); - } else { - aRv.Throw(NS_ERROR_NOT_IMPLEMENTED); - return promise.forget(); - } - - MOZ_ASSERT(bufferData && bufferLength > 0, "Cannot read data from BufferSource."); - - // Check the buffer. - if (((uint32_t)(aOffset + aLength) > bufferLength)) { - aRv.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR); - return promise.forget(); - } - - // Create and Crop the raw data into a layers::Image - RefPtr data; - if (NS_IsMainThread()) { - data = CreateImageFromBufferSourceRawData(bufferData + aOffset, bufferLength, - aFormat, aLayout); - } else { - RefPtr task = - new CreateImageFromBufferSourceRawDataInMainThreadSyncTask(bufferData + aOffset, - bufferLength, - aFormat, - aLayout, - getter_AddRefs(data)); - task->Dispatch(Canceling, aRv); - if (aRv.Failed()) { - return promise.forget(); - } - } - - if (NS_WARN_IF(!data)) { - aRv.Throw(NS_ERROR_NOT_AVAILABLE); - return promise.forget(); - } - - // Create an ImageBimtap. - // Assume the data from an external buffer is not alpha-premultiplied. - RefPtr imageBitmap = new ImageBitmap(aGlobal, data, - gfxAlphaType::NonPremult); - - imageBitmap->mAllocatedImageData = true; - - // We don't need to call SetPictureRect() here because there is no cropping - // supported and the ImageBitmap's mPictureRect is the size of the source - // image in default - - // We don't need to set mIsCroppingAreaOutSideOfSourceImage here because there - // is no cropping supported and the mIsCroppingAreaOutSideOfSourceImage is - // false in default. - - AsyncFulfillImageBitmapPromise(promise, imageBitmap); - - return promise.forget(); -} - size_t ImageBitmap::GetAllocatedSize() const { @@ -2167,14 +1562,19 @@ CreateImageBitmapFromBlob::Create(Promise* aPromise, return nullptr; } - // Get the MIME type string of the blob. - // The type will be checked in the DecodeImageAsync() method. - nsAutoString mimeTypeUTF16; - aBlob.Impl()->GetType(mimeTypeUTF16); - NS_ConvertUTF16toUTF8 mimeType(mimeTypeUTF16); + if (!NS_InputStreamIsBuffered(stream)) { + nsCOMPtr bufferedStream; + nsresult rv = NS_NewBufferedInputStream(getter_AddRefs(bufferedStream), + stream.forget(), 4096); + if (NS_WARN_IF(NS_FAILED(rv))) { + return nullptr; + } + + stream = bufferedStream; + } RefPtr task = - new CreateImageBitmapFromBlob(aPromise, aGlobal, stream.forget(), mimeType, + new CreateImageBitmapFromBlob(aPromise, aGlobal, stream.forget(), aCropRect, aMainThreadEventTarget); // Nothing to do for the main-thread. @@ -2201,7 +1601,7 @@ CreateImageBitmapFromBlob::Create(Promise* aPromise, } nsresult -CreateImageBitmapFromBlob::StartDecodeAndCropBlob() +CreateImageBitmapFromBlob::StartMimeTypeAndDecodeAndCropBlob() { MOZ_ASSERT(IsCurrentThread()); @@ -2209,11 +1609,11 @@ CreateImageBitmapFromBlob::StartDecodeAndCropBlob() if (!NS_IsMainThread()) { RefPtr self = this; nsCOMPtr r = NS_NewRunnableFunction( - "CreateImageBitmapFromBlob::DecodeAndCropBlob", + "CreateImageBitmapFromBlob::MimeTypeAndDecodeAndCropBlob", [self]() { - nsresult rv = self->DecodeAndCropBlob(); + nsresult rv = self->MimeTypeAndDecodeAndCropBlob(); if (NS_WARN_IF(NS_FAILED(rv))) { - self->DecodeAndCropBlobCompletedMainThread(nullptr, rv); + self->MimeTypeAndDecodeAndCropBlobCompletedMainThread(nullptr, rv); } }); @@ -2221,14 +1621,30 @@ CreateImageBitmapFromBlob::StartDecodeAndCropBlob() } // Main-thread. - return DecodeAndCropBlob(); + return MimeTypeAndDecodeAndCropBlob(); } nsresult -CreateImageBitmapFromBlob::DecodeAndCropBlob() +CreateImageBitmapFromBlob::MimeTypeAndDecodeAndCropBlob() { MOZ_ASSERT(NS_IsMainThread()); + nsAutoCString mimeType; + nsresult rv = GetMimeTypeSync(mimeType); + if (rv == NS_BASE_STREAM_WOULD_BLOCK) { + return GetMimeTypeAsync(); + } + + if (NS_WARN_IF(NS_FAILED(rv))) { + return rv; + } + + return DecodeAndCropBlob(mimeType); +} + +nsresult +CreateImageBitmapFromBlob::DecodeAndCropBlob(const nsACString& aMimeType) +{ // Get the Component object. nsCOMPtr imgtool = do_GetService(NS_IMGTOOLS_CID); if (NS_WARN_IF(!imgtool)) { @@ -2236,8 +1652,7 @@ CreateImageBitmapFromBlob::DecodeAndCropBlob() } // Decode image. - nsCOMPtr imgContainer; - nsresult rv = imgtool->DecodeImageAsync(mInputStream, mMimeType, this, + nsresult rv = imgtool->DecodeImageAsync(mInputStream, aMimeType, this, mMainThreadEventTarget); if (NS_WARN_IF(NS_FAILED(rv))) { return rv; @@ -2246,6 +1661,54 @@ CreateImageBitmapFromBlob::DecodeAndCropBlob() return NS_OK; } +static nsresult +sniff_cb(nsIInputStream* aInputStream, + void* aClosure, + const char* aFromRawSegment, + uint32_t aToOffset, + uint32_t aCount, + uint32_t* aWriteCount) +{ + nsACString* mimeType = static_cast(aClosure); + MOZ_ASSERT(mimeType); + + if (aCount > 0) { + imgLoader::GetMimeTypeFromContent(aFromRawSegment, aCount, *mimeType); + } + + *aWriteCount = 0; + + // We don't want to consume data from the stream. + return NS_ERROR_FAILURE; +} + +nsresult +CreateImageBitmapFromBlob::GetMimeTypeSync(nsACString& aMimeType) +{ + uint32_t dummy; + return mInputStream->ReadSegments(sniff_cb, &aMimeType, 128, &dummy); +} + +nsresult +CreateImageBitmapFromBlob::GetMimeTypeAsync() +{ + nsCOMPtr asyncInputStream = + do_QueryInterface(mInputStream); + if (NS_WARN_IF(!asyncInputStream)) { + // If the stream is not async, why are we here? + return NS_ERROR_FAILURE; + } + + return asyncInputStream->AsyncWait(this, 0, 128, mMainThreadEventTarget); +} + +NS_IMETHODIMP +CreateImageBitmapFromBlob::OnInputStreamReady(nsIAsyncInputStream* aStream) +{ + // The stream should have data now. Let's start from scratch again. + return MimeTypeAndDecodeAndCropBlob(); +} + NS_IMETHODIMP CreateImageBitmapFromBlob::OnImageReady(imgIContainer* aImgContainer, nsresult aStatus) @@ -2253,7 +1716,7 @@ CreateImageBitmapFromBlob::OnImageReady(imgIContainer* aImgContainer, MOZ_ASSERT(NS_IsMainThread()); if (NS_FAILED(aStatus)) { - DecodeAndCropBlobCompletedMainThread(nullptr, aStatus); + MimeTypeAndDecodeAndCropBlobCompletedMainThread(nullptr, aStatus); return NS_OK; } @@ -2265,11 +1728,13 @@ CreateImageBitmapFromBlob::OnImageReady(imgIContainer* aImgContainer, RefPtr surface = aImgContainer->GetFrame(whichFrame, frameFlags); if (NS_WARN_IF(!surface)) { - DecodeAndCropBlobCompletedMainThread(nullptr, NS_ERROR_FAILURE); + MimeTypeAndDecodeAndCropBlobCompletedMainThread(nullptr, + NS_ERROR_DOM_INVALID_STATE_ERR); return NS_OK; } - // Store the sourceSize value for the DecodeAndCropBlobCompletedMainThread call. + // Store the sourceSize value for the + // MimeTypeAndDecodeAndCropBlobCompletedMainThread call. mSourceSize = surface->GetSize(); // Crop the source surface if needed. @@ -2294,7 +1759,8 @@ CreateImageBitmapFromBlob::OnImageReady(imgIContainer* aImgContainer, } if (NS_WARN_IF(!croppedSurface)) { - DecodeAndCropBlobCompletedMainThread(nullptr, NS_ERROR_FAILURE); + MimeTypeAndDecodeAndCropBlobCompletedMainThread(nullptr, + NS_ERROR_DOM_INVALID_STATE_ERR); return NS_OK; } @@ -2302,17 +1768,18 @@ CreateImageBitmapFromBlob::OnImageReady(imgIContainer* aImgContainer, RefPtr image = CreateImageFromSurface(croppedSurface); if (NS_WARN_IF(!image)) { - DecodeAndCropBlobCompletedMainThread(nullptr, NS_ERROR_FAILURE); + MimeTypeAndDecodeAndCropBlobCompletedMainThread(nullptr, + NS_ERROR_DOM_INVALID_STATE_ERR); return NS_OK; } - DecodeAndCropBlobCompletedMainThread(image, NS_OK); + MimeTypeAndDecodeAndCropBlobCompletedMainThread(image, NS_OK); return NS_OK; } void -CreateImageBitmapFromBlob::DecodeAndCropBlobCompletedMainThread(layers::Image* aImage, - nsresult aStatus) +CreateImageBitmapFromBlob::MimeTypeAndDecodeAndCropBlobCompletedMainThread(layers::Image* aImage, + nsresult aStatus) { MOZ_ASSERT(NS_IsMainThread()); @@ -2331,12 +1798,12 @@ CreateImageBitmapFromBlob::DecodeAndCropBlobCompletedMainThread(layers::Image* a return; } - DecodeAndCropBlobCompletedOwningThread(aImage, aStatus); + MimeTypeAndDecodeAndCropBlobCompletedOwningThread(aImage, aStatus); } void -CreateImageBitmapFromBlob::DecodeAndCropBlobCompletedOwningThread(layers::Image* aImage, - nsresult aStatus) +CreateImageBitmapFromBlob::MimeTypeAndDecodeAndCropBlobCompletedOwningThread(layers::Image* aImage, + nsresult aStatus) { MOZ_ASSERT(IsCurrentThread()); @@ -2362,10 +1829,6 @@ CreateImageBitmapFromBlob::DecodeAndCropBlobCompletedOwningThread(layers::Image* // Create ImageBitmap object. RefPtr imageBitmap = new ImageBitmap(mGlobalObject, aImage); - // Set mIsCroppingAreaOutSideOfSourceImage. - imageBitmap->SetIsCroppingAreaOutSideOfSourceImage(mSourceSize, - mOriginalCropRect); - if (mCropRect.isSome()) { ErrorResult rv; imageBitmap->SetPictureRect(mCropRect.ref(), rv); diff --git a/dom/canvas/ImageBitmap.h b/dom/canvas/ImageBitmap.h index ee7ee49ae7d3..4a49fdc45dcf 100644 --- a/dom/canvas/ImageBitmap.h +++ b/dom/canvas/ImageBitmap.h @@ -41,7 +41,6 @@ class OffscreenCanvas; class ArrayBufferViewOrArrayBuffer; class CanvasRenderingContext2D; -struct ChannelPixelLayout; class CreateImageBitmapFromBlob; class CreateImageBitmapFromBlobTask; class CreateImageBitmapFromBlobWorkerTask; @@ -52,7 +51,6 @@ class HTMLVideoElement; enum class ImageBitmapFormat : uint8_t; class ImageData; class ImageUtils; -template class MapDataIntoBufferSource; class Promise; class PostMessageEvent; // For StructuredClone between windows. class ImageBitmapShutdownObserver; @@ -62,7 +60,6 @@ struct ImageBitmapCloneData final RefPtr mSurface; gfx::IntRect mPictureRect; gfxAlphaType mAlphaType; - bool mIsCroppingAreaOutSideOfSourceImage; }; /* @@ -135,14 +132,6 @@ public: Create(nsIGlobalObject* aGlobal, const ImageBitmapSource& aSrc, const Maybe& aCropRect, ErrorResult& aRv); - static already_AddRefed - Create(nsIGlobalObject* aGlobal, - const ImageBitmapSource& aBuffer, - int32_t aOffset, int32_t aLength, - mozilla::dom::ImageBitmapFormat aFormat, - const Sequence& aLayout, - ErrorResult& aRv); - static JSObject* ReadStructuredClone(JSContext* aCx, JSStructuredCloneReader* aReader, @@ -159,23 +148,6 @@ public: friend CreateImageBitmapFromBlobTask; friend CreateImageBitmapFromBlobWorkerTask; - template - friend class MapDataIntoBufferSource; - - // Mozilla Extensions - ImageBitmapFormat - FindOptimalFormat(const Optional>& aPossibleFormats, - ErrorResult& aRv); - - int32_t - MappedDataLength(ImageBitmapFormat aFormat, ErrorResult& aRv); - - already_AddRefed - MapDataInto(JSContext* aCx, - ImageBitmapFormat aFormat, - const ArrayBufferViewOrArrayBuffer& aBuffer, - int32_t aOffset, ErrorResult& aRv); - size_t GetAllocatedSize() const; void OnShutdown(); @@ -208,9 +180,6 @@ protected: void SetPictureRect(const gfx::IntRect& aRect, ErrorResult& aRv); - void SetIsCroppingAreaOutSideOfSourceImage(const gfx::IntSize& aSourceSize, - const Maybe& aCroppingRect); - static already_AddRefed CreateInternal(nsIGlobalObject* aGlobal, HTMLImageElement& aImageEl, const Maybe& aCropRect, ErrorResult& aRv); @@ -278,15 +247,6 @@ protected: RefPtr mShutdownObserver; - /* - * Set mIsCroppingAreaOutSideOfSourceImage if image bitmap was cropped to the - * source rectangle so that it contains any transparent black pixels (cropping - * area is outside of the source image). - * This is used in mapDataInto() to check if we should reject promise with - * IndexSizeError. - */ - bool mIsCroppingAreaOutSideOfSourceImage; - /* * Whether this object allocated allocated and owns the image data. */ diff --git a/dom/canvas/ImageBitmapSource.h b/dom/canvas/ImageBitmapSource.h index 776c2d1deb8c..a11ce0a42763 100644 --- a/dom/canvas/ImageBitmapSource.h +++ b/dom/canvas/ImageBitmapSource.h @@ -11,9 +11,8 @@ namespace mozilla { namespace dom { // So we don't have to forward declare this elsewhere. -class HTMLImageElementOrHTMLVideoElementOrHTMLCanvasElementOrBlobOrImageDataOrCanvasRenderingContext2DOrImageBitmapOrArrayBufferViewOrArrayBuffer; -typedef HTMLImageElementOrHTMLVideoElementOrHTMLCanvasElementOrBlobOrImageDataOrCanvasRenderingContext2DOrImageBitmapOrArrayBufferViewOrArrayBuffer - ImageBitmapSource; +class HTMLImageElementOrHTMLCanvasElementOrHTMLVideoElementOrImageBitmapOrBlobOrCanvasRenderingContext2DOrImageData; +typedef HTMLImageElementOrHTMLCanvasElementOrHTMLVideoElementOrImageBitmapOrBlobOrCanvasRenderingContext2DOrImageData ImageBitmapSource; } } diff --git a/dom/canvas/ImageBitmapUtils.cpp b/dom/canvas/ImageBitmapUtils.cpp index 28e76bedc30b..9c827382e32e 100644 --- a/dom/canvas/ImageBitmapUtils.cpp +++ b/dom/canvas/ImageBitmapUtils.cpp @@ -2730,16 +2730,6 @@ GetChannelCountOfImageFormat(ImageBitmapFormat aFormat) return format->GetChannelCount(); } -uint32_t -CalculateImageBufferSize(ImageBitmapFormat aFormat, - uint32_t aWidth, uint32_t aHeight) -{ - UtilsUniquePtr format = Utils::GetUtils(aFormat); - MOZ_ASSERT(format, "Cannot get a valid ImageBitmapFormatUtils instance."); - - return format->NeededBufferSize(aWidth, aHeight); -} - UniquePtr CopyAndConvertImageData(ImageBitmapFormat aSrcFormat, const uint8_t* aSrcBuffer, diff --git a/dom/canvas/ImageBitmapUtils.h b/dom/canvas/ImageBitmapUtils.h index 39be43d8ae54..9e86fadf6af2 100644 --- a/dom/canvas/ImageBitmapUtils.h +++ b/dom/canvas/ImageBitmapUtils.h @@ -48,14 +48,6 @@ CreatePixelLayoutFromPlanarYCbCrData(const layers::PlanarYCbCrData* aData); uint8_t GetChannelCountOfImageFormat(ImageBitmapFormat aFormat); -/* - * Get the needed buffer size to store the image data in the given - * ImageBitmapFormat with the given width and height. - */ -uint32_t -CalculateImageBufferSize(ImageBitmapFormat aFormat, - uint32_t aWidth, uint32_t aHeight); - /* * This function always copies the image data in _aSrcBuffer_ into _aDstBuffer_ * and it also performs color conversion if the _aSrcFormat_ and the diff --git a/dom/canvas/ImageUtils.cpp b/dom/canvas/ImageUtils.cpp index 82d9d9137a56..5d3917bb1577 100644 --- a/dom/canvas/ImageUtils.cpp +++ b/dom/canvas/ImageUtils.cpp @@ -125,38 +125,6 @@ public: return (uint32_t)(size.height * stride); } - virtual UniquePtr - MapDataInto(uint8_t* aBuffer, - uint32_t aOffset, - uint32_t aBufferLength, - ImageBitmapFormat aFormat, - ErrorResult& aRv) const - { - DataSourceSurface::ScopedMap map(Surface(), DataSourceSurface::READ); - if (!map.IsMapped()) { - aRv.Throw(NS_ERROR_ILLEGAL_VALUE); - return nullptr; - } - - // Copy or convert data. - UniquePtr srcLayout = - CreateDefaultPixelLayout(GetFormat(), Surface()->GetSize().width, - Surface()->GetSize().height, map.GetStride()); - - // Prepare destination buffer. - uint8_t* dstBuffer = aBuffer + aOffset; - UniquePtr dstLayout = - CopyAndConvertImageData(GetFormat(), map.GetData(), srcLayout.get(), - aFormat, dstBuffer); - - if (!dstLayout) { - aRv.Throw(NS_ERROR_NOT_AVAILABLE); - return nullptr; - } - - return dstLayout; - } - protected: Impl() {} @@ -203,31 +171,6 @@ public: return mImage->AsNVImage()->GetBufferSize(); } - UniquePtr MapDataInto(uint8_t* aBuffer, - uint32_t aOffset, - uint32_t aBufferLength, - ImageBitmapFormat aFormat, - ErrorResult& aRv) const override - { - // Prepare source buffer and pixel layout. - const PlanarYCbCrData* data = GetPlanarYCbCrData(); - - UniquePtr srcLayout = - CreatePixelLayoutFromPlanarYCbCrData(data); - - // Do conversion. - UniquePtr dstLayout = - CopyAndConvertImageData(GetFormat(), data->mYChannel, srcLayout.get(), - aFormat, aBuffer+aOffset); - - if (!dstLayout) { - aRv.Throw(NS_ERROR_NOT_AVAILABLE); - return nullptr; - } - - return dstLayout; - } - private: const PlanarYCbCrData* GetPlanarYCbCrData() const { @@ -277,17 +220,5 @@ ImageUtils::GetBufferLength() const return mImpl->GetBufferLength(); } -UniquePtr -ImageUtils::MapDataInto(uint8_t* aBuffer, - uint32_t aOffset, - uint32_t aBufferLength, - ImageBitmapFormat aFormat, - ErrorResult& aRv) const -{ - MOZ_ASSERT(mImpl); - MOZ_ASSERT(aBuffer, "Map data into a null buffer."); - return mImpl->MapDataInto(aBuffer, aOffset, aBufferLength, aFormat, aRv); -} - } // namespace dom } // namespace mozilla diff --git a/dom/canvas/ImageUtils.h b/dom/canvas/ImageUtils.h index 185fe61db82e..97bbda17e73e 100644 --- a/dom/canvas/ImageUtils.h +++ b/dom/canvas/ImageUtils.h @@ -32,10 +32,6 @@ typedef nsTArray ImagePixelLayout; * (1) GetFormat() converts the image's format into ImageBitmapFormat enum. * (2) GetBufferLength() returns the number of bytes that are used to store * the image's underlying raw data. - * (3) MapDataInto() writes the image's underlying raw data into a given - * ArrayBuffer in the given format. (If the given format is different from - * the existing format, the ImageUtils uses the ImageBitmapFormatUtils to - * performa color conversion.) * * In theory, the functionalities of this class could be merged into the * interface of layers::Image. However, this is designed as a isolated wrapper @@ -59,10 +55,6 @@ public: uint32_t GetBufferLength() const; - UniquePtr - MapDataInto(uint8_t* aBuffer, uint32_t aOffset, uint32_t aBufferLength, - ImageBitmapFormat aFormat, ErrorResult& aRv) const; - protected: Impl* mImpl; }; diff --git a/dom/canvas/test/imagebitmap_extensions.html b/dom/canvas/test/imagebitmap_extensions.html deleted file mode 100644 index d66fe9ad1a3a..000000000000 --- a/dom/canvas/test/imagebitmap_extensions.html +++ /dev/null @@ -1,49 +0,0 @@ - - - Test ImageBitmap Extensions (Bug 1141979) - - - - - - - - - - diff --git a/dom/canvas/test/imagebitmap_extensions.js b/dom/canvas/test/imagebitmap_extensions.js deleted file mode 100644 index 21b0a71526b9..000000000000 --- a/dom/canvas/test/imagebitmap_extensions.js +++ /dev/null @@ -1,526 +0,0 @@ -function failed(ex) { - ok(false, "Promise failure: " + ex); -} - -function isPixel(sourceType, bitmapFormat, imageData, bitmapImageData, x, y, tolerance) { - if (imageData.width != bitmapImageData.width || - imageData.height != bitmapImageData.height) { - ok(false, "Wrong dimension"); - } - - var index = 4 * (y * imageData.width + x); - - var pr = imageData.data[index+0], - pg = imageData.data[index+1], - pb = imageData.data[index+2], - pa = imageData.data[index+3]; - - if (bitmapFormat == "RGBA32" || bitmapFormat == "RGBX32") { - var bpr = bitmapImageData.data[index+0], - bpg = bitmapImageData.data[index+1], - bpb = bitmapImageData.data[index+2], - bpa = bitmapImageData.data[index+3]; - } - else if (bitmapFormat == "BGRA32" || bitmapFormat == "BGRX32") { - var bpb = bitmapImageData.data[index+0], - bpg = bitmapImageData.data[index+1], - bpr = bitmapImageData.data[index+2], - bpa = bitmapImageData.data[index+3]; - } - else { - // format might be one of the followings: "R5G6B5", "A8", "YUV", "" - ok(false, "Not supported ImageFormat: " + bitmapFormat); - } - - ok(pr - tolerance <= bpr && bpr <= pr + tolerance && - pg - tolerance <= bpg && bpg <= pg + tolerance && - pb - tolerance <= bpb && bpb <= pb + tolerance && - pa - tolerance <= bpa && bpa <= pa + tolerance, - "pixel[" + x + "][" + y + "]: " + sourceType + " is "+pr+","+pg+","+pb+","+pa+"; ImageBitmap is "+ bpr + "," + bpg + "," + bpb + "," + bpa); -} - -function promiseThrows(p, name) { - var didThrow; - return p.then(function() { didThrow = false; }, - function() { didThrow = true; }) - .then(function() { ok(didThrow, name); }); -} - -function testExceptions() { - return Promise.all([ - promiseThrows(testColorConversion("GRAY8", "RGBA32", undefined, true), "[Exception] Cannot convert from GRAY8 to RGBA32"), - promiseThrows(testColorConversion("GRAY8", "BGRA32", undefined, true), "[Exception] Cannot convert from GRAY8 to BGRA32"), - promiseThrows(testColorConversion("GRAY8", "RGB24", undefined, true), "[Exception] Cannot convert from GRAY8 to RGB24"), - promiseThrows(testColorConversion("GRAY8", "BGR24", undefined, true), "[Exception] Cannot convert from GRAY8 to BGR24"), - promiseThrows(testColorConversion("GRAY8", "YUV444P", undefined, true), "[Exception] Cannot convert from GRAY8 to YUV444P"), - promiseThrows(testColorConversion("GRAY8", "YUV422P", undefined, true), "[Exception] Cannot convert from GRAY8 to YUV422P"), - promiseThrows(testColorConversion("GRAY8", "YUV420P", undefined, true), "[Exception] Cannot convert from GRAY8 to YUV420P"), - promiseThrows(testColorConversion("GRAY8", "YUV420SP_NV12", undefined, true), "[Exception] Cannot convert from GRAY8 to YUV420SP_NV12"), - promiseThrows(testColorConversion("GRAY8", "YUV420SP_NV21", undefined, true), "[Exception] Cannot convert from GRAY8 to YUV420SP_NV21"), - promiseThrows(testColorConversion("GRAY8", "HSV", undefined, true), "[Exception] Cannot convert from GRAY8 to HSV"), - promiseThrows(testColorConversion("GRAY8", "Lab", undefined, true), "[Exception] Cannot convert from GRAY8 to Lab"), - promiseThrows(testColorConversion("GRAY8", "DEPTH", undefined, true), "[Exception] Cannot convert from GRAY8 to DEPTH"), - - promiseThrows(testColorConversion("DEPTH", "RGBA32", undefined, true), "[Exception] Cannot convert from DEPTH to RGBA32"), - promiseThrows(testColorConversion("DEPTH", "BGRA32", undefined, true), "[Exception] Cannot convert from DEPTH to BGRA32"), - promiseThrows(testColorConversion("DEPTH", "RGB24", undefined, true), "[Exception] Cannot convert from DEPTH to RGB24"), - promiseThrows(testColorConversion("DEPTH", "BGR24", undefined, true), "[Exception] Cannot convert from DEPTH to BGR24"), - promiseThrows(testColorConversion("DEPTH", "GRAY8", undefined, true), "[Exception] Cannot convert from DEPTH to GRAY8"), - promiseThrows(testColorConversion("DEPTH", "YUV444P", undefined, true), "[Exception] Cannot convert from DEPTH to YUV444P"), - promiseThrows(testColorConversion("DEPTH", "YUV422P", undefined, true), "[Exception] Cannot convert from DEPTH to YUV422P"), - promiseThrows(testColorConversion("DEPTH", "YUV420P", undefined, true), "[Exception] Cannot convert from DEPTH to YUV420P"), - promiseThrows(testColorConversion("DEPTH", "YUV420SP_NV12", undefined, true), "[Exception] Cannot convert from DEPTH to YUV420SP_NV12"), - promiseThrows(testColorConversion("DEPTH", "YUV420SP_NV21", undefined, true), "[Exception] Cannot convert from DEPTH to YUV420SP_NV21"), - promiseThrows(testColorConversion("DEPTH", "HSV", undefined, true), "[Exception] Cannot convert from DEPTH to HSV"), - promiseThrows(testColorConversion("DEPTH", "Lab", undefined, true), "[Exception] Cannot convert from DEPTH to Lab"), - - promiseThrows(testColorConversion("RGBA32", "DEPTH", undefined, true), "[Exception] Cannot convert from RGBA32 to DEPTH"), - promiseThrows(testColorConversion("BGRA32", "DEPTH", undefined, true), "[Exception] Cannot convert from BGRA32 to DEPTH"), - promiseThrows(testColorConversion("RGB24", "DEPTH", undefined, true), "[Exception] Cannot convert from RGB24 to DEPTH"), - promiseThrows(testColorConversion("BGR24", "DEPTH", undefined, true), "[Exception] Cannot convert from BGR24 to DEPTH"), - promiseThrows(testColorConversion("YUV444P", "DEPTH", undefined, true), "[Exception] Cannot convert from YUV444P to DEPTH"), - promiseThrows(testColorConversion("YUV422P", "DEPTH", undefined, true), "[Exception] Cannot convert from YUV422P to DEPTH"), - promiseThrows(testColorConversion("YUV420P", "DEPTH", undefined, true), "[Exception] Cannot convert from YUV420P to DEPTH"), - promiseThrows(testColorConversion("YUV420SP_NV12", "DEPTH", undefined, true), "[Exception] Cannot convert from YUV420SP_NV12 to DEPTH"), - promiseThrows(testColorConversion("YUV420SP_NV21", "DEPTH", undefined, true), "[Exception] Cannot convert from YUV420SP_NV21 to DEPTH"), - promiseThrows(testColorConversion("HSV", "DEPTH", undefined, true), "[Exception] Cannot convert from HSV to DEPTH"), - promiseThrows(testColorConversion("Lab", "DEPTH", undefined, true), "[Exception] Cannot convert from Lab to DEPTH"), - ]); -} - -function testInvalidAccess(sources) { - - function callMapDataIntoWithImageBitmapCroppedOutSideOfTheSourceImage(source) { - return new Promise(function(resolve, reject) { - var p = createImageBitmap(source, -1, -1, 2, 2); - p.then( - function(bitmap) { - var format = bitmap.findOptimalFormat(); - var length = bitmap.mappedDataLength(format); - var buffer = new ArrayBuffer(length); - bitmap.mapDataInto(format, buffer, 0).then( - function(layout) { resolve(); }, - function(error) { reject(error); } - ); - }, - function() { resolve(); }); - }); - }; - - var testCases = sources.map( function(source) { - return promiseThrows(callMapDataIntoWithImageBitmapCroppedOutSideOfTheSourceImage(source), - "[Exception] mapDataInto() should throw with transparent black."); }); - - return Promise.all(testCases); -} - -function testColorConversions() { - return Promise.all([// From RGBA32 - testColorConversion("RGBA32", "RGBA32"), - testColorConversion("RGBA32", "BGRA32"), - testColorConversion("RGBA32", "RGB24"), - testColorConversion("RGBA32", "BGR24"), - testColorConversion("RGBA32", "GRAY8"), - testColorConversion("RGBA32", "YUV444P"), - testColorConversion("RGBA32", "YUV422P"), - testColorConversion("RGBA32", "YUV420P", 2), - testColorConversion("RGBA32", "YUV420SP_NV12"), - testColorConversion("RGBA32", "YUV420SP_NV21"), - testColorConversion("RGBA32", "HSV", 0.01), - testColorConversion("RGBA32", "Lab", 0.5), - - // From BGRA32 - testColorConversion("BGRA32", "RGBA32"), - testColorConversion("BGRA32", "BGRA32"), - testColorConversion("BGRA32", "RGB24"), - testColorConversion("BGRA32", "BGR24"), - testColorConversion("BGRA32", "GRAY8"), - testColorConversion("BGRA32", "YUV444P", 3), - testColorConversion("BGRA32", "YUV422P", 2), - testColorConversion("BGRA32", "YUV420P", 2), - testColorConversion("BGRA32", "YUV420SP_NV12", 2), - testColorConversion("BGRA32", "YUV420SP_NV21", 2), - testColorConversion("BGRA32", "HSV", 0.01), - testColorConversion("BGRA32", "Lab", 0.5), - - // From RGB24 - testColorConversion("RGB24", "RGBA32"), - testColorConversion("RGB24", "BGRA32"), - testColorConversion("RGB24", "RGB24"), - testColorConversion("RGB24", "BGR24"), - testColorConversion("RGB24", "GRAY8"), - testColorConversion("RGB24", "YUV444P"), - testColorConversion("RGB24", "YUV422P"), - testColorConversion("RGB24", "YUV420P"), - testColorConversion("RGB24", "YUV420SP_NV12"), - testColorConversion("RGB24", "YUV420SP_NV21"), - testColorConversion("RGB24", "HSV", 0.01), - testColorConversion("RGB24", "Lab", 0.5), - - // From BGR24 - testColorConversion("BGR24", "RGBA32"), - testColorConversion("BGR24", "BGRA32"), - testColorConversion("BGR24", "RGB24"), - testColorConversion("BGR24", "BGR24"), - testColorConversion("BGR24", "GRAY8"), - testColorConversion("BGR24", "YUV444P"), - testColorConversion("BGR24", "YUV422P"), - testColorConversion("BGR24", "YUV420P"), - testColorConversion("BGR24", "YUV420SP_NV12"), - testColorConversion("BGR24", "YUV420SP_NV21"), - testColorConversion("BGR24", "HSV", 0.01), - testColorConversion("BGR24", "Lab", 0.5), - - // From YUV444P - testColorConversion("YUV444P", "RGBA32"), - testColorConversion("YUV444P", "BGRA32"), - testColorConversion("YUV444P", "RGB24"), - testColorConversion("YUV444P", "BGR24"), - testColorConversion("YUV444P", "GRAY8"), - testColorConversion("YUV444P", "YUV444P"), - testColorConversion("YUV444P", "YUV422P", 4), - testColorConversion("YUV444P", "YUV420P", 3), - testColorConversion("YUV444P", "YUV420SP_NV12", 3), - testColorConversion("YUV444P", "YUV420SP_NV21", 3), - testColorConversion("YUV444P", "HSV", 0.01), - testColorConversion("YUV444P", "Lab", 0.01), - - // From YUV422P - testColorConversion("YUV422P", "RGBA32"), - testColorConversion("YUV422P", "BGRA32", 2), - testColorConversion("YUV422P", "RGB24"), - testColorConversion("YUV422P", "BGR24"), - testColorConversion("YUV422P", "GRAY8"), - testColorConversion("YUV422P", "YUV444P", 3), - testColorConversion("YUV422P", "YUV422P"), - testColorConversion("YUV422P", "YUV420P"), - testColorConversion("YUV422P", "YUV420SP_NV12"), - testColorConversion("YUV422P", "YUV420SP_NV21"), - testColorConversion("YUV422P", "HSV", 0.01), - testColorConversion("YUV422P", "Lab", 0.01), - - // From YUV420P - testColorConversion("YUV420P", "RGBA32", 2), - testColorConversion("YUV420P", "BGRA32", 2), - testColorConversion("YUV420P", "RGB24"), - testColorConversion("YUV420P", "BGR24"), - testColorConversion("YUV420P", "GRAY8"), - testColorConversion("YUV420P", "YUV444P", 3), - testColorConversion("YUV420P", "YUV422P", 1), - testColorConversion("YUV420P", "YUV420P"), - testColorConversion("YUV420P", "YUV420SP_NV12"), - testColorConversion("YUV420P", "YUV420SP_NV21"), - testColorConversion("YUV420P", "HSV", 0.01), - testColorConversion("YUV420P", "Lab", 0.01), - - // From NV12 - testColorConversion("YUV420SP_NV12", "RGBA32"), - testColorConversion("YUV420SP_NV12", "BGRA32", 2), - testColorConversion("YUV420SP_NV12", "RGB24"), - testColorConversion("YUV420SP_NV12", "BGR24"), - testColorConversion("YUV420SP_NV12", "GRAY8"), - testColorConversion("YUV420SP_NV12", "YUV444P", 3), - testColorConversion("YUV420SP_NV12", "YUV422P", 1), - testColorConversion("YUV420SP_NV12", "YUV420P"), - testColorConversion("YUV420SP_NV12", "YUV420SP_NV12"), - testColorConversion("YUV420SP_NV12", "YUV420SP_NV21"), - testColorConversion("YUV420SP_NV12", "HSV", 0.01), - testColorConversion("YUV420SP_NV12", "Lab", 0.01), - - // From NV21 - testColorConversion("YUV420SP_NV21", "RGBA32"), - testColorConversion("YUV420SP_NV21", "BGRA32", 2), - testColorConversion("YUV420SP_NV21", "RGB24"), - testColorConversion("YUV420SP_NV21", "BGR24"), - testColorConversion("YUV420SP_NV21", "GRAY8"), - testColorConversion("YUV420SP_NV21", "YUV444P", 3), - testColorConversion("YUV420SP_NV21", "YUV422P", 1), - testColorConversion("YUV420SP_NV21", "YUV420P"), - testColorConversion("YUV420SP_NV21", "YUV420SP_NV12"), - testColorConversion("YUV420SP_NV21", "YUV420SP_NV21"), - testColorConversion("YUV420SP_NV21", "HSV", 0.01), - testColorConversion("YUV420SP_NV21", "Lab", 0.01), - - // From HSV - testColorConversion("HSV", "RGBA32"), - testColorConversion("HSV", "BGRA32"), - testColorConversion("HSV", "RGB24"), - testColorConversion("HSV", "BGR24"), - testColorConversion("HSV", "GRAY8"), - testColorConversion("HSV", "YUV444P"), - testColorConversion("HSV", "YUV422P"), - testColorConversion("HSV", "YUV420P"), - testColorConversion("HSV", "YUV420SP_NV12"), - testColorConversion("HSV", "YUV420SP_NV21"), - testColorConversion("HSV", "HSV", 0), - testColorConversion("HSV", "Lab", 0.5), - - // From Lab - testColorConversion("Lab", "RGBA32", 1), - testColorConversion("Lab", "BGRA32", 1), - testColorConversion("Lab", "RGB24", 1), - testColorConversion("Lab", "BGR24", 1), - testColorConversion("Lab", "GRAY8", 1), - testColorConversion("Lab", "YUV444P", 1), - testColorConversion("Lab", "YUV422P", 1), - testColorConversion("Lab", "YUV420P", 1), - testColorConversion("Lab", "YUV420SP_NV12", 1), - testColorConversion("Lab", "YUV420SP_NV21", 1), - testColorConversion("Lab", "HSV", 0.5), - testColorConversion("Lab", "Lab", 0), - - // From GRAY8 - testColorConversion("GRAY8", "GRAY8"), - - // From DEPTH - testColorConversion("DEPTH", "DEPTH", 0, Uint16Array), - ]); -} - -function testDraw() { - return Promise.all([doOneDrawTest("RGB24"), - doOneDrawTest("BGR24"), - doOneDrawTest("YUV444P", 5), - doOneDrawTest("YUV422P", 2), - doOneDrawTest("YUV420P", 2), - doOneDrawTest("YUV420SP_NV12", 2), - doOneDrawTest("YUV420SP_NV21", 2), - doOneDrawTest("HSV", 2), - doOneDrawTest("Lab", 2)]); -} - -// Create an ImageBitmap, _bitmap_, from the _source_. -// Read the underlying data of _bitmap_ into _bitmapBuffer_. -// Compare the _bitmapBuffer_ with gGroundTruthImageData. -function testAccessing_randomTest(sourceType, source, duration) { - return new Promise(function(resolve, reject) { - var p = createImageBitmap(source); - p.then( - function(bitmap) { - bitmapFormat = "RGBA32"; - var bitmapBufferLength = bitmap.mappedDataLength(bitmapFormat); - - var bitmapBuffer = new ArrayBuffer(bitmapBufferLength); - var bitmapBufferView = new Uint8ClampedArray(bitmapBuffer, 0, bitmapBufferLength); - var promise = bitmap.mapDataInto(bitmapFormat, bitmapBuffer, 0); - promise.then( - function(bitmapPixelLayout) { - // Prepare. - bitmapImageData = new ImageData(bitmapBufferView, bitmap.width, bitmap.height); - - // Test. - for (var t = 0; t < 50; ++t) { - var randomX = Math.floor(Math.random() * 240); - var randomY = Math.floor(Math.random() * 175); - isPixel(sourceType, "RGBA32", gGroundTruthImageData, bitmapImageData, randomX, randomY, duration); - } - - resolve(); - }, - function(ev) { failed(ev); reject(); }); - }, - function(ev) { failed(ev); reject(); }); - }); -} - -// Create an ImageBitmap, _bitmap_, from the _source_. -// Read the underlying data of _bitmap_ into _bitmapBuffer_. -// Create another ImageBitmap, _bitmap2_, from _bitmapBuffer_. -// Read the underlying data of _bitmap2_ into _bitmapBuffer2_. -// Compare the _bitmapBuffer2_ with gGroundTruthImageData. -function testCreateFromArrayBffer_randomTest(sourceType, source, duration) { - return new Promise(function(resolve, reject) { - var p = createImageBitmap(source); - p.then( - function(bitmap) { - bitmapFormat = "RGBA32"; - var bitmapBufferLength = bitmap.mappedDataLength(bitmapFormat); - - var bitmapBuffer = new ArrayBuffer(bitmapBufferLength); - var bitmapBufferView = new Uint8ClampedArray(bitmapBuffer, 0, bitmapBufferLength); - var promiseMapDataInto = bitmap.mapDataInto(bitmapFormat, bitmapBuffer, 0); - promiseMapDataInto.then( - function(bitmapPixelLayout) { - // Create a new ImageBitmap from an ArrayBuffer. - var p2 = createImageBitmap(bitmapBufferView, - 0, - bitmapBufferLength, - bitmapFormat, - bitmapPixelLayout); - - p2.then( - function(bitmap2) { - bitmapFormat2 = "RGBA32"; - var bitmapBufferLength2 = bitmap2.mappedDataLength(bitmapFormat2); - - var bitmapBuffer2 = new ArrayBuffer(bitmapBufferLength2); - var bitmapBufferView2 = new Uint8ClampedArray(bitmapBuffer2, 0, bitmapBufferLength2); - var promise2 = bitmap2.mapDataInto(bitmapFormat2, bitmapBuffer2, 0); - promise2.then( - function(bitmapPixelLayout2) { - // Prepare. - var bitmapImageData2 = new ImageData(bitmapBufferView2, bitmap2.width, bitmap2.height); - - // Test. - for (var t = 0; t < 50; ++t) { - var randomX = Math.floor(Math.random() * 240); - var randomY = Math.floor(Math.random() * 175); - isPixel(sourceType, "RGBA32", gGroundTruthImageData, bitmapImageData2, randomX, randomY, duration); - } - - resolve(); - }, - function(ev) { failed(ev); reject(); }); - }, - function(ev) { console.log("p2 rejected!"); failed(ev); reject(); }); - }, - function(ev) { console.log("promiseMapDataInto rejected!"); failed(ev); reject(); }); - }, - function(ev) { failed(ev); reject(); }); - }); -} - -function testColorConversion(sourceFromat, destinationFormat, tolerance, shouldThrow) { - - tolerance = tolerance || 0; - shouldThrow = shouldThrow || false; - - return new Promise(function(resolve, reject) { - var [srcData, dstData] = getTestData(sourceFromat, destinationFormat); - - ok(!!srcData, "Get valid srcData of type:" + sourceFromat); - ok(!!dstData, "Get valid dstData of type:" + destinationFormat); - - // printInfo(sourceFromat, srcData); - // printInfo(destinationFormat, dstData); - - // Create a new ImageBitmap from an ArrayBuffer. - var p = createImageBitmap(srcData.buffer, - 0, - srcData.bufferLength, - srcData.format, - srcData.pixelLayout); - - p.then( - function(srcBitmap) { - ok(!!srcBitmap, "Should get a valid srcBitmap."); - ok(srcBitmap.findOptimalFormat() == sourceFromat, "srcBitmap.findOptimalFormat():" + srcBitmap.findOptimalFormat() + - " should equal to sourceFromat:" + sourceFromat); - - var dstBufferLength = srcBitmap.mappedDataLength(destinationFormat); - var dstBuffer = new ArrayBuffer(dstBufferLength); - var dstBufferView = new dstData.ArrayType(dstBuffer, 0, dstBufferLength / dstData.ArrayType.BYTES_PER_ELEMENT); - - // Do color conversion here. - var p2 = srcBitmap.mapDataInto(destinationFormat, dstBuffer, 0); - p2.then( - function(dstPixelLayout) { - var dataPixalLayout = dstData.pixelLayout; - - // Check pixel layout. - ok(dstPixelLayout.length == dstData.channelCount, "dstPixelLayout.length:" + dstPixelLayout.length + - " should equal to dstData.channelCount:" + dstData.channelCount); - - for (var c = 0; c < dstData.channelCount; ++c) { - var dstChannelLayout = dstPixelLayout[c]; - var dataChannelLayout = dataPixalLayout[c]; - ok(dstChannelLayout.width == dataChannelLayout.width, "channel[" + c + "] dstChannelLayout.width:" + dstChannelLayout.width + " should equal to dataChannelLayout.width:" + dataChannelLayout.width); - ok(dstChannelLayout.height == dataChannelLayout.height, "channel[" + c + "] dstChannelLayout.height:" + dstChannelLayout.height + " should equal to dataChannelLayout.height:" + dataChannelLayout.height); - ok(dstChannelLayout.skip == dataChannelLayout.skip, "channel[" + c + "] dstChannelLayout.skip:" + dstChannelLayout.skip + " should equal to dataChannelLayout.skip:" + dataChannelLayout.skip); - - for (var i = 0; i < dstChannelLayout.height; ++i) { - for (var j = 0; j < dstChannelLayout.width; ++j) { - var byteOffset = dstChannelLayout.offset + i * dstChannelLayout.stride + j * (dstChannelLayout.skip + 1) * dstData.ArrayType.BYTES_PER_ELEMENT; - var view = new dstData.ArrayType(dstBuffer, byteOffset, 1); - var dstBufferViewValue = view[0]; - var dstDataValue = dstData.getPixelValue(i, j, c); - ok(Math.abs(dstBufferViewValue - dstDataValue) <= tolerance, - "[" + sourceFromat + " -> " + destinationFormat + "] pixel(" + i + "," + j + ") channnel(" + c + - "): dstBufferViewValue:" + dstBufferViewValue + - " should equal to dstDataValue:" + dstDataValue); - } - } - } - - resolve(); - }, - function(ev) { - // If the "mapDataInto" throws, the flow goes here. - if (!shouldThrow) { failed(ev); } - reject(); - } - ); - }, - function(ev) { - reject(ev); - } - ); - }); -} - -function doOneDrawTest(sourceFromat, tolerance) { - tolerance = tolerance || 0; - var destinationFormat = "RGBA32"; - - return new Promise(function(resolve, reject) { - - var [srcData, dstData] = getTestData(sourceFromat, destinationFormat); - ok(!!srcData, "Get valid srcData of type:" + sourceFromat); - ok(!!dstData, "Get valid dstData of type:" + destinationFormat); - - var p = createImageBitmap(srcData.buffer, - 0, - srcData.bufferLength, - srcData.format, - srcData.pixelLayout); - - p.then( - function(srcBitmap) { - ok(!!srcBitmap, "Should get a valid srcBitmap."); - ok(srcBitmap.findOptimalFormat() == sourceFromat, "srcBitmap.findOptimalFormat():" + srcBitmap.findOptimalFormat() + - " should equal to sourceFromat:" + sourceFromat); - - var canvas = document.createElement("canvas"); - canvas.width = srcBitmap.width; - canvas.height = srcBitmap.height; - var ctx = canvas.getContext("2d"); - - ctx.drawImage(srcBitmap, 0, 0, srcBitmap.width, srcBitmap.height); - - // Get an ImageData from the canvas. - var imageData = ctx.getImageData(0, 0, srcBitmap.width, srcBitmap.height); - - for (var i = 0; i < srcBitmap.height; ++i) { - for (var j = 0; j < srcBitmap.width; ++j) { - var pixelOffset = i * srcBitmap.width * dstData.channelCount + j * dstData.channelCount; - var dstImageDataValue_R = imageData.data[pixelOffset + 0]; - var dstImageDataValue_G = imageData.data[pixelOffset + 1]; - var dstImageDataValue_B = imageData.data[pixelOffset + 2]; - var dstImageDataValue_A = imageData.data[pixelOffset + 3]; - - var logPrefix = "[" + sourceFromat + " -> " + destinationFormat + "] pixel(" + i + "," + j + ")"; - - var dstDataValue_R = dstData.getPixelValue(i, j, 0); - var dstDataValue_G = dstData.getPixelValue(i, j, 1); - var dstDataValue_B = dstData.getPixelValue(i, j, 2); - var dstDataValue_A = dstData.getPixelValue(i, j, 3); - ok(Math.abs(dstImageDataValue_R - dstDataValue_R) <= tolerance, - logPrefix + "channnel(R): dstImageDataValue:" + dstImageDataValue_R + " should equal to dstDataValue_R: " + dstDataValue_R); - ok(Math.abs(dstImageDataValue_G - dstDataValue_G) <= tolerance, - logPrefix + "channnel(G): dstImageDataValue:" + dstImageDataValue_G + " should equal to dstDataValue_G: " + dstDataValue_G); - ok(Math.abs(dstImageDataValue_B - dstDataValue_B) <= tolerance, - logPrefix + "channnel(B): dstImageDataValue:" + dstImageDataValue_B + " should equal to dstDataValue_B: " + dstDataValue_B); - ok(Math.abs(dstImageDataValue_A - dstDataValue_A) <= tolerance, - logPrefix + "channnel(A): dstImageDataValue:" + dstImageDataValue_A + " should equal to dstDataValue_A: " + dstDataValue_A); - } - } - - resolve(); - }, - function(ev) { - failed(ev); - reject(ev); - } - ); - }); -} \ No newline at end of file diff --git a/dom/canvas/test/imagebitmap_extensions_data.js b/dom/canvas/test/imagebitmap_extensions_data.js deleted file mode 100644 index 0dd785aa59a4..000000000000 --- a/dom/canvas/test/imagebitmap_extensions_data.js +++ /dev/null @@ -1,1066 +0,0 @@ -class Image { - constructor(channelCount, format, ArrayType) { - this.channelCount = channelCount; - this.format = format; - this.ArrayType = ArrayType; - this.pixelLayout = []; - this.buffer = undefined; - this.data = undefined; - }; -}; - -class TypedSimpleImage extends Image { - constructor(width, height, channelCount, format, ArrayType) { - super(channelCount, format, ArrayType); - this.width = width; - this.height = height; - this.stride = this.width * this.channelCount * this.ArrayType.BYTES_PER_ELEMENT; - this.bufferLength = this.height * this.stride; - this.buffer = new ArrayBuffer(this.bufferLength); - this.data = new this.ArrayType(this.buffer, 0, this.height * this.width * this.channelCount); - - // initialize pixel layout - for (var c = 0; c < this.channelCount; ++c) { - this.pixelLayout.push({offset:c * this.ArrayType.BYTES_PER_ELEMENT, - width:this.width, - height:this.height, - dataType:"uint8", - stride:this.stride, - skip:(this.channelCount - 1)}); - } - }; - - getPixelValue(i, j, c) { - var dataChannelLayout = this.pixelLayout[c]; - return this.data[i * this.width * this.channelCount + j * this.channelCount + c]; - } -}; - -class Uint8SimpleImage extends TypedSimpleImage { - constructor(width, height, channelCount, format) { - super(width, height, channelCount, format, Uint8ClampedArray); - }; -}; - -class Uint16SimpleImage extends TypedSimpleImage { - constructor(width, height, channelCount, format) { - super(width, height, channelCount, format, Uint16Array); - }; -}; - -class FloatSimpleImage extends TypedSimpleImage { - constructor(width, height, channelCount, format) { - super(width, height, channelCount, format, Float32Array); - }; -}; - -class DoubleSimpleImage extends TypedSimpleImage { - constructor(width, height, channelCount, format) { - super(width, height, channelCount, format, Float64Array); - }; -}; - -class RGBA32Data extends Uint8SimpleImage { - constructor() { - super(3, 3, 4, "RGBA32"); - - var i = 0; - this.data[i + 0] = 0; this.data[i + 1] = 0; this.data[i + 2] = 0; this.data[i + 3] = 255; - this.data[i + 4] = 255; this.data[i + 5] = 0; this.data[i + 6] = 0; this.data[i + 7] = 255; - this.data[i + 8] = 0; this.data[i + 9] = 255; this.data[i + 10] = 0; this.data[i + 11] = 255; - - i += this.stride; - this.data[i + 0] = 0; this.data[i + 1] = 0; this.data[i + 2] = 255; this.data[i + 3] = 255; - this.data[i + 4] = 255; this.data[i + 5] = 255; this.data[i + 6] = 0; this.data[i + 7] = 255; - this.data[i + 8] = 0; this.data[i + 9] = 255; this.data[i + 10] = 255; this.data[i + 11] = 255; - - i += this.stride; - this.data[i + 0] = 255; this.data[i + 1] = 0; this.data[i + 2] = 255; this.data[i + 3] = 255; - this.data[i + 4] = 255; this.data[i + 5] = 255; this.data[i + 6] = 255; this.data[i + 7] = 255; - this.data[i + 8] = 128; this.data[i + 9] = 128; this.data[i + 10] = 128; this.data[i + 11] = 255; - }; -}; - -class BGRA32Data extends Uint8SimpleImage { - constructor() { - super(3, 3, 4, "BGRA32"); - - var i = 0; - this.data[i + 2] = 0; this.data[i + 1] = 0; this.data[i + 0] = 0; this.data[i + 3] = 255; - this.data[i + 6] = 255; this.data[i + 5] = 0; this.data[i + 4] = 0; this.data[i + 7] = 255; - this.data[i + 10] = 0; this.data[i + 9] = 255; this.data[i + 8] = 0; this.data[i + 11] = 255; - - i += this.stride; - this.data[i + 2] = 0; this.data[i + 1] = 0; this.data[i + 0] = 255; this.data[i + 3] = 255; - this.data[i + 6] = 255; this.data[i + 5] = 255; this.data[i + 4] = 0; this.data[i + 7] = 255; - this.data[i + 10] = 0; this.data[i + 9] = 255; this.data[i + 8] = 255; this.data[i + 11] = 255; - - i += this.stride; - this.data[i + 2] = 255; this.data[i + 1] = 0; this.data[i + 0] = 255; this.data[i + 3] = 255; - this.data[i + 6] = 255; this.data[i + 5] = 255; this.data[i + 4] = 255; this.data[i + 7] = 255; - this.data[i + 10] = 128; this.data[i + 9] = 128; this.data[i + 8] = 128; this.data[i + 11] = 255; - }; -}; - -class RGB24Data extends Uint8SimpleImage { - constructor() { - super(3, 3, 3, "RGB24"); - - var i = 0; - this.data[i + 0] = 0; this.data[i + 1] = 0; this.data[i + 2] = 0; - this.data[i + 3] = 255; this.data[i + 4] = 0; this.data[i + 5] = 0; - this.data[i + 6] = 0; this.data[i + 7] = 255; this.data[i + 8] = 0; - - i += this.stride; - this.data[i + 0] = 0; this.data[i + 1] = 0; this.data[i + 2] = 255; - this.data[i + 3] = 255; this.data[i + 4] = 255; this.data[i + 5] = 0; - this.data[i + 6] = 0; this.data[i + 7] = 255; this.data[i + 8] = 255; - - i += this.stride; - this.data[i + 0] = 255; this.data[i + 1] = 0; this.data[i + 2] = 255; - this.data[i + 3] = 255; this.data[i + 4] = 255; this.data[i + 5] = 255; - this.data[i + 6] = 128; this.data[i + 7] = 128; this.data[i + 8] = 128; - }; -}; - -class BGR24Data extends Uint8SimpleImage { - constructor() { - super(3, 3, 3, "BGR24"); - - var i = 0; - this.data[i + 2] = 0; this.data[i + 1] = 0; this.data[i + 0] = 0; - this.data[i + 5] = 255; this.data[i + 4] = 0; this.data[i + 3] = 0; - this.data[i + 8] = 0; this.data[i + 7] = 255; this.data[i + 6] = 0; - - i += this.stride; - this.data[i + 2] = 0; this.data[i + 1] = 0; this.data[i + 0] = 255; - this.data[i + 5] = 255; this.data[i + 4] = 255; this.data[i + 3] = 0; - this.data[i + 8] = 0; this.data[i + 7] = 255; this.data[i + 6] = 255; - - i += this.stride; - this.data[i + 2] = 255; this.data[i + 1] = 0; this.data[i + 0] = 255; - this.data[i + 5] = 255; this.data[i + 4] = 255; this.data[i + 3] = 255; - this.data[i + 8] = 128; this.data[i + 7] = 128; this.data[i + 6] = 128; - }; -}; - -class Gray8Data extends Uint8SimpleImage { - constructor() { - super(3, 3, 1, "GRAY8"); - - var i = 0; - this.data[i + 0] = 0; this.data[i + 1] = 76; this.data[i + 2] = 149; - - i += this.stride; - this.data[i + 0] = 29; this.data[i + 1] = 225; this.data[i + 2] = 178; - - i += this.stride; - this.data[i + 0] = 105; this.data[i + 1] = 255; this.data[i + 2] = 127; - }; -}; - -class RGBA32DataFromYUV444PData extends Uint8SimpleImage { - constructor(redIndex, greenIndex, blueIndex, alphaIndex) { - - // Get the exact format. - var channelCount_ = !!alphaIndex ? 4 : 3; - var format_; - if (redIndex == 0) { - if (channelCount_ == 3) { - format_ = "RGBA32"; - } else { - format_ = "RGB24"; - } - } else if (redIndex == 2) { - if (channelCount_ == 3) { - format_ = "BGRA32"; - } else { - format_ = "BGR24"; - } - } else { - return undefined; - } - - // Call parent's consturctor. - super(3, 3, channelCount_, format_); - - // Calculate parameters for setting data. - var rIndex = redIndex; // 0 or 2 - var gIndex = 1; - var bIndex = redIndex ^ 2; // 0 or 2 - var aIndex = alphaIndex || 0; // If alphaIndex == undefined --> aIndex = 0; - var shift0 = 0; - var shift1 = channelCount_; - var shift2 = channelCount_ * 2; - - // Set the data. - var i = 0; - this.data[i + aIndex + shift0] = 255; this.data[i + rIndex + shift0] = 0; this.data[i + gIndex + shift0] = 0; this.data[i + bIndex + shift0] = 0; - this.data[i + aIndex + shift1] = 255; this.data[i + rIndex + shift1] = 254; this.data[i + gIndex + shift1] = 0; this.data[i + bIndex + shift1] = 0; - this.data[i + aIndex + shift2] = 255; this.data[i + rIndex + shift2] = 0; this.data[i + gIndex + shift2] = 253; this.data[i + bIndex + shift2] = 1; - - i += this.stride; - this.data[i + aIndex + shift0] = 255; this.data[i + rIndex + shift0] = 0; this.data[i + gIndex + shift0] = 0; this.data[i + bIndex + shift0] = 251; - this.data[i + aIndex + shift1] = 255; this.data[i + rIndex + shift1] = 253; this.data[i + gIndex + shift1] = 253; this.data[i + bIndex + shift1] = 2; - this.data[i + aIndex + shift2] = 255; this.data[i + rIndex + shift2] = 0; this.data[i + gIndex + shift2] = 253; this.data[i + bIndex + shift2] = 252; - - i += this.stride; - this.data[i + aIndex + shift0] = 255; this.data[i + rIndex + shift0] = 255; this.data[i + gIndex + shift0] = 0; this.data[i + bIndex + shift0] = 252; - this.data[i + aIndex + shift1] = 255; this.data[i + rIndex + shift1] = 253; this.data[i + gIndex + shift1] = 253; this.data[i + bIndex + shift1] = 253; - this.data[i + aIndex + shift2] = 255; this.data[i + rIndex + shift2] = 127; this.data[i + gIndex + shift2] = 127; this.data[i + bIndex + shift2] = 127; - }; -}; - -class RGBA32DataFromYUV422PData extends Uint8SimpleImage { - constructor(redIndex, greenIndex, blueIndex, alphaIndex) { - - // Get the exact format. - var channelCount_ = !!alphaIndex ? 4 : 3; - var format_; - if (redIndex == 0) { - if (channelCount_ == 3) { - format_ = "RGBA32"; - } else { - format_ = "RGB24"; - } - } else if (redIndex == 2) { - if (channelCount_ == 3) { - format_ = "BGRA32"; - } else { - format_ = "BGR24"; - } - } else { - return undefined; - } - - // Call parent's consturctor. - super(3, 3, channelCount_, format_); - - // Calculate parameters for setting data. - var rIndex = redIndex; // 0 or 2 - var gIndex = 1; - var bIndex = redIndex ^ 2; // 0 or 2 - var aIndex = alphaIndex || 0; // If alphaIndex == undefined --> aIndex = 0; - var shift0 = 0; - var shift1 = channelCount_; - var shift2 = channelCount_ * 2; - - // Set the data. - var i = 0; - this.data[i + aIndex + shift0] = 255; this.data[i + rIndex + shift0] = 89; this.data[i + gIndex + shift0] = 0; this.data[i + bIndex + shift0] = 0; - this.data[i + aIndex + shift1] = 255; this.data[i + rIndex + shift1] = 165; this.data[i + gIndex + shift1] = 38; this.data[i + bIndex + shift1] = 38; - this.data[i + aIndex + shift2] = 255; this.data[i + rIndex + shift2] = 0; this.data[i + gIndex + shift2] = 253; this.data[i + bIndex + shift2] = 1; - - i += this.stride; - this.data[i + aIndex + shift0] = 255; this.data[i + rIndex + shift0] = 28; this.data[i + gIndex + shift0] = 28; this.data[i + bIndex + shift0] = 28; - this.data[i + aIndex + shift1] = 255; this.data[i + rIndex + shift1] = 224; this.data[i + gIndex + shift1] = 224; this.data[i + bIndex + shift1] = 224; - this.data[i + aIndex + shift2] = 255; this.data[i + rIndex + shift2] = 0; this.data[i + gIndex + shift2] = 253; this.data[i + bIndex + shift2] = 252; - - i += this.stride; - this.data[i + aIndex + shift0] = 255; this.data[i + rIndex + shift0] = 180; this.data[i + gIndex + shift0] = 52; this.data[i + bIndex + shift0] = 178; - this.data[i + aIndex + shift1] = 255; this.data[i + rIndex + shift1] = 255; this.data[i + gIndex + shift1] = 200; this.data[i + bIndex + shift1] = 255; - this.data[i + aIndex + shift2] = 255; this.data[i + rIndex + shift2] = 127; this.data[i + gIndex + shift2] = 127; this.data[i + bIndex + shift2] = 127; - }; -}; - -class RGBA32DataFromYUV420PData extends Uint8SimpleImage { - constructor(redIndex, greenIndex, blueIndex, alphaIndex) { - - // Get the exact format. - var channelCount_ = !!alphaIndex ? 4 : 3; - var format_; - if (redIndex == 0) { - if (channelCount_ == 3) { - format_ = "RGBA32"; - } else { - format_ = "RGB24"; - } - } else if (redIndex == 2) { - if (channelCount_ == 3) { - format_ = "BGRA32"; - } else { - format_ = "BGR24"; - } - } else { - return undefined; - } - - // Call parent's consturctor. - super(3, 3, channelCount_, format_); - - // Calculate parameters for setting data. - var rIndex = redIndex; // 0 or 2 - var gIndex = 1; - var bIndex = redIndex ^ 2; // 0 or 2 - var aIndex = alphaIndex || 0; // If alphaIndex == undefined --> aIndex = 0; - var shift0 = 0; - var shift1 = channelCount_; - var shift2 = channelCount_ * 2; - - // Set the data. - var i = 0; - this.data[i + aIndex + shift0] = 255; this.data[i + rIndex + shift0] = 44; this.data[i + gIndex + shift0] = 0; this.data[i + bIndex + shift0] = 0; - this.data[i + aIndex + shift1] = 255; this.data[i + rIndex + shift1] = 120; this.data[i + gIndex + shift1] = 57; this.data[i + bIndex + shift1] = 58; - this.data[i + aIndex + shift2] = 255; this.data[i + rIndex + shift2] = 0; this.data[i + gIndex + shift2] = 238; this.data[i + bIndex + shift2] = 112; - - i += this.stride; - this.data[i + aIndex + shift0] = 255; this.data[i + rIndex + shift0] = 73; this.data[i + gIndex + shift0] = 9; this.data[i + bIndex + shift0] = 11; - this.data[i + aIndex + shift1] = 255; this.data[i + rIndex + shift1] = 255; this.data[i + gIndex + shift1] = 205; this.data[i + bIndex + shift1] = 206; - this.data[i + aIndex + shift2] = 255; this.data[i + rIndex + shift2] = 12; this.data[i + gIndex + shift2] = 255; this.data[i + bIndex + shift2] = 141; - - i += this.stride; - this.data[i + aIndex + shift0] = 255; this.data[i + rIndex + shift0] = 180; this.data[i + gIndex + shift0] = 52; this.data[i + bIndex + shift0] = 178; - this.data[i + aIndex + shift1] = 255; this.data[i + rIndex + shift1] = 255; this.data[i + gIndex + shift1] = 200; this.data[i + bIndex + shift1] = 255; - this.data[i + aIndex + shift2] = 255; this.data[i + rIndex + shift2] = 127; this.data[i + gIndex + shift2] = 127; this.data[i + bIndex + shift2] = 127; - }; -}; - -class Gray8DataFromYUVData extends Uint8SimpleImage { - constructor() { - super(3, 3, 1, "GRAY8"); - - var i = 0; - this.data[i + 0] = 16; this.data[i + 1] = 82; this.data[i + 2] = 144; - - i += this.stride; - this.data[i + 0] = 41; this.data[i + 1] = 210; this.data[i + 2] = 169; - - i += this.stride; - this.data[i + 0] = 107; this.data[i + 1] = 235; this.data[i + 2] = 126; - }; -}; - -class YUVImage extends Image { - constructor(yWidth, yHeight, uWidth, uHeight, vWidth, vHeight, format) { - super(3, format, Uint8ClampedArray); - this.yWidth = yWidth; - this.yHeight = yHeight; - this.yStride = this.yWidth * this.ArrayType.BYTES_PER_ELEMENT; - this.uWidth = uWidth; - this.uHeight = uHeight; - this.uStride = this.uWidth * this.ArrayType.BYTES_PER_ELEMENT; - this.vWidth = vWidth; - this.vHeight = vHeight; - this.vStride = this.vWidth * this.ArrayType.BYTES_PER_ELEMENT; - this.bufferLength = this.yHeight * this.yStride + - this.uHeight * this.uStride + - this.vHeight * this.vStride - this.buffer = new ArrayBuffer(this.bufferLength); - this.data = new this.ArrayType(this.buffer, 0, this.bufferLength); - this.yData = new this.ArrayType(this.buffer, 0, this.yHeight * this.yStride); - this.uData = new this.ArrayType(this.buffer, - this.yHeight * this.yStride, - this.uHeight * this.uStride); - this.vData = new this.ArrayType(this.buffer, - this.yHeight * this.yStride + this.uHeight * this.uStride, - this.vHeight * this.vStride); - - // Initialize pixel layout. - // y channel. - this.pixelLayout.push({offset:0, - width:this.yWidth, - height:this.yHeight, - dataType:"uint8", - stride:this.yStride, - skip:0}); - - // u channel. - this.pixelLayout.push({offset:(this.yHeight * this.yStride), - width:this.uWidth, - height:this.uHeight, - dataType:"uint8", - stride:this.uStride, - skip:0}); - - // v channel. - this.pixelLayout.push({offset:(this.yHeight * this.yStride + this.uHeight * this.uStride), - width:this.vWidth, - height:this.vHeight, - dataType:"uint8", - stride:this.vStride, - skip:0}); - }; - - getPixelValue(i, j, c) { - var dataChannelLayout = this.pixelLayout[c]; - return this.data[dataChannelLayout.offset + i * dataChannelLayout.stride + j * (dataChannelLayout.skip + 1)]; - } -}; - -class YUV444PData extends YUVImage { - constructor() { - super(3, 3, 3, 3, 3, 3, "YUV444P"); - - this.yData[0] = 16; this.yData[1] = 82; this.yData[2] = 144; - this.yData[3] = 41; this.yData[4] = 210; this.yData[5] = 169; - this.yData[6] = 107; this.yData[7] = 235; this.yData[8] = 126; - - this.uData[0] = 128; this.uData[1] = 90; this.uData[2] = 54; - this.uData[3] = 240; this.uData[4] = 16; this.uData[5] = 166; - this.uData[6] = 202; this.uData[7] = 128; this.uData[8] = 128; - - this.vData[0] = 128; this.vData[1] = 240; this.vData[2] = 34; - this.vData[3] = 110; this.vData[4] = 146; this.vData[5] = 16; - this.vData[6] = 222; this.vData[7] = 128; this.vData[8] = 128; - } -}; - -class YUV444PDataFromYUV422PData extends YUVImage { - constructor() { - super(3, 3, 3, 3, 3, 3, "YUV444P"); - - this.yData[0] = 16; this.yData[1] = 82; this.yData[2] = 144; - this.yData[3] = 41; this.yData[4] = 210; this.yData[5] = 169; - this.yData[6] = 107; this.yData[7] = 235; this.yData[8] = 126; - - this.uData[0] = 108; this.uData[1] = 81; this.uData[2] = 53; - this.uData[3] = 126; this.uData[4] = 112; this.uData[5] = 98; - this.uData[6] = 144; this.uData[7] = 144; this.uData[8] = 144; - - this.vData[0] = 182; this.vData[1] = 108; this.vData[2] = 33; - this.vData[3] = 166; this.vData[4] = 109; this.vData[5] = 51; - this.vData[6] = 150; this.vData[7] = 110; this.vData[8] = 70; - } -}; - -class YUV444PDataFromYUV420PData extends YUVImage { - constructor() { - super(3, 3, 3, 3, 3, 3, "YUV444P"); - - this.yData[0] = 16; this.yData[1] = 82; this.yData[2] = 144; - this.yData[3] = 41; this.yData[4] = 210; this.yData[5] = 169; - this.yData[6] = 107; this.yData[7] = 235; this.yData[8] = 126; - - this.uData[0] = 118; this.uData[1] = 113; this.uData[2] = 109; - this.uData[3] = 140; this.uData[4] = 128; this.uData[5] = 117; - this.uData[6] = 162; this.uData[7] = 144; this.uData[8] = 126; - - this.vData[0] = 154; this.vData[1] = 90; this.vData[2] = 24; - this.vData[3] = 163; this.vData[4] = 119; this.vData[5] = 75; - this.vData[6] = 172; this.vData[7] = 149; this.vData[8] = 126; - } -}; - -class YUV422PData extends YUVImage { - constructor() { - super(3, 3, 2, 3, 2, 3, "YUV422P"); - - this.yData[0] = 16; this.yData[1] = 82; this.yData[2] = 144; - this.yData[3] = 41; this.yData[4] = 210; this.yData[5] = 169; - this.yData[6] = 107; this.yData[7] = 235; this.yData[8] = 126; - - this.uData[0] = 109; this.uData[1] = 54; - this.uData[2] = 128; this.uData[3] = 166; - this.uData[4] = 165; this.uData[5] = 128; - - this.vData[0] = 184; this.vData[1] = 34; - this.vData[2] = 128; this.vData[3] = 16; - this.vData[4] = 175; this.vData[5] = 128; - } -}; - -class YUV422PDataFromYUV444PData extends YUVImage { - constructor() { - super(3, 3, 2, 3, 2, 3, "YUV422P"); - - this.yData[0] = 16; this.yData[1] = 82; this.yData[2] = 144; - this.yData[3] = 41; this.yData[4] = 210; this.yData[5] = 169; - this.yData[6] = 107; this.yData[7] = 235; this.yData[8] = 126; - - this.uData[0] = 133; this.uData[1] = 78; - this.uData[2] = 164; this.uData[3] = 109; - this.uData[4] = 180; this.uData[5] = 125; - - this.vData[0] = 145; this.vData[1] = 74; - this.vData[2] = 165; this.vData[3] = 95; - this.vData[4] = 175; this.vData[5] = 105; - } -}; - -class YUV422PDataFromYUV420PData extends YUVImage { - constructor() { - super(3, 3, 2, 3, 2, 3, "YUV422P"); - - this.yData[0] = 16; this.yData[1] = 82; this.yData[2] = 144; - this.yData[3] = 41; this.yData[4] = 210; this.yData[5] = 169; - this.yData[6] = 107; this.yData[7] = 235; this.yData[8] = 126; - - this.uData[0] = 119; this.uData[1] = 110; - this.uData[2] = 149; this.uData[3] = 121; - this.uData[4] = 164; this.uData[5] = 127; - - this.vData[0] = 156; this.vData[1] = 25; - this.vData[2] = 168; this.vData[3] = 93; - this.vData[4] = 174; this.vData[5] = 127; - } -}; - -class YUV420PData extends YUVImage { - constructor() { - super(3, 3, 2, 2, 2, 2, "YUV420P"); - - this.yData[0] = 16; this.yData[1] = 82; this.yData[2] = 144; - this.yData[3] = 41; this.yData[4] = 210; this.yData[5] = 169; - this.yData[6] = 107; this.yData[7] = 235; this.yData[8] = 126; - - this.uData[0] = 119; this.uData[1] = 110; - this.uData[2] = 165; this.uData[3] = 128; - - this.vData[0] = 156; this.vData[1] = 25; - this.vData[2] = 175; this.vData[3] = 128; - } -}; - -class YUV420PDataFromYUV444PData extends YUVImage { - constructor() { - super(3, 3, 2, 2, 2, 2, "YUV420P"); - - this.yData[0] = 16; this.yData[1] = 82; this.yData[2] = 144; - this.yData[3] = 41; this.yData[4] = 210; this.yData[5] = 169; - this.yData[6] = 107; this.yData[7] = 235; this.yData[8] = 126; - - this.uData[0] = 133; this.uData[1] = 78; - this.uData[2] = 181; this.uData[3] = 126; - - this.vData[0] = 145; this.vData[1] = 74; - this.vData[2] = 176; this.vData[3] = 106; - } -}; - -class YUV420PDataFromYUV422PData extends YUVImage { - constructor() { - super(3, 3, 2, 2, 2, 2, "YUV420P"); - - this.yData[0] = 16; this.yData[1] = 82; this.yData[2] = 144; - this.yData[3] = 41; this.yData[4] = 210; this.yData[5] = 169; - this.yData[6] = 107; this.yData[7] = 235; this.yData[8] = 126; - - this.uData[0] = 109; this.uData[1] = 54; - this.uData[2] = 147; this.uData[3] = 147; - - this.vData[0] = 184; this.vData[1] = 34; - this.vData[2] = 152; this.vData[3] = 72; - } -}; - -class NVImage extends Image { - constructor(yWidth, yHeight, uvWidth, uvHeight, format) { - super(3, format, Uint8ClampedArray); - this.yWidth = yWidth; - this.yHeight = yHeight; - this.yStride = this.yWidth * this.ArrayType.BYTES_PER_ELEMENT; - this.uvWidth = uvWidth; - this.uvHeight = uvHeight; - this.uvStride = this.uvWidth * 2 * this.ArrayType.BYTES_PER_ELEMENT; - this.bufferLength = this.yHeight * this.yStride + this.uvHeight * this.uvStride; - this.buffer = new ArrayBuffer(this.bufferLength); - this.data = new this.ArrayType(this.buffer, 0, this.bufferLength); - this.yData = new this.ArrayType(this.buffer, 0, this.yHeight * this.yStride); - this.uvData = new this.ArrayType(this.buffer, - this.yHeight * this.yStride, - this.uvHeight * this.uvStride); - - // Initialize pixel layout. - // y channel. - this.pixelLayout.push({offset:0, - width:this.yWidth, - height:this.yHeight, - dataType:"uint8", - stride:this.yStride, - skip:0}); - // v channel. - this.pixelLayout.push({offset:(this.yHeight * this.yStride), - width:this.uvWidth, - height:this.uvHeight, - dataType:"uint8", - stride:this.uvStride, - skip:1}); - - // u channel. - this.pixelLayout.push({offset:(this.yHeight * this.yStride + this.ArrayType.BYTES_PER_ELEMENT), - width:this.uvWidth, - height:this.uvHeight, - dataType:"uint8", - stride:this.uvStride, - skip:1}); - }; - - getPixelValue(i, j, c) { - var dataChannelLayout = this.pixelLayout[c]; - return this.data[dataChannelLayout.offset + i * dataChannelLayout.stride + j * (dataChannelLayout.skip + 1)]; - } -}; - -class NV12Data extends NVImage { - constructor() { - super(3, 3, 2, 2, "YUV420SP_NV12"); - - this.yData[0] = 16; this.yData[1] = 82; this.yData[2] = 144; - this.yData[3] = 41; this.yData[4] = 210; this.yData[5] = 169; - this.yData[6] = 107; this.yData[7] = 235; this.yData[8] = 126; - - // U - this.uvData[0] = 119; - this.uvData[2] = 110; - this.uvData[4] = 165; - this.uvData[6] = 128; - - // V - this.uvData[1] = 156; - this.uvData[3] = 25; - this.uvData[5] = 175; - this.uvData[7] = 128; - }; -}; - -class NV12DataFromYUV444PData extends NVImage { - constructor() { - super(3, 3, 2, 2, "YUV420SP_NV12"); - - this.yData[0] = 16; this.yData[1] = 82; this.yData[2] = 144; - this.yData[3] = 41; this.yData[4] = 210; this.yData[5] = 169; - this.yData[6] = 107; this.yData[7] = 235; this.yData[8] = 126; - - // U - this.uvData[0] = 133; - this.uvData[2] = 78; - this.uvData[4] = 181; - this.uvData[6] = 126; - - // V - this.uvData[1] = 145; - this.uvData[3] = 74; - this.uvData[5] = 176; - this.uvData[7] = 106; - }; -}; - -class NV12DataFromYUV422PData extends NVImage { - constructor() { - super(3, 3, 2, 2, "YUV420SP_NV12"); - - this.yData[0] = 16; this.yData[1] = 82; this.yData[2] = 144; - this.yData[3] = 41; this.yData[4] = 210; this.yData[5] = 169; - this.yData[6] = 107; this.yData[7] = 235; this.yData[8] = 126; - - // U - this.uvData[0] = 109; - this.uvData[2] = 54; - this.uvData[4] = 147; - this.uvData[6] = 147; - - // V - this.uvData[1] = 184; - this.uvData[3] = 34; - this.uvData[5] = 152; - this.uvData[7] = 72; - }; -}; - -class NV21Data extends NVImage { - constructor() { - super(3, 3, 2, 2, "YUV420SP_NV21"); - - this.yData[0] = 16; this.yData[1] = 82; this.yData[2] = 144; - this.yData[3] = 41; this.yData[4] = 210; this.yData[5] = 169; - this.yData[6] = 107; this.yData[7] = 235; this.yData[8] = 126; - - // U - this.uvData[1] = 119; - this.uvData[3] = 110; - this.uvData[5] = 165; - this.uvData[7] = 128; - - // V - this.uvData[0] = 156; - this.uvData[2] = 25; - this.uvData[4] = 175; - this.uvData[6] = 128; - }; -}; - -class NV21DataFromYUV444PData extends NVImage { - constructor() { - super(3, 3, 2, 2, "YUV420SP_NV12"); - - this.yData[0] = 16; this.yData[1] = 82; this.yData[2] = 144; - this.yData[3] = 41; this.yData[4] = 210; this.yData[5] = 169; - this.yData[6] = 107; this.yData[7] = 235; this.yData[8] = 126; - - // V - this.uvData[1] = 133; - this.uvData[3] = 78; - this.uvData[5] = 181; - this.uvData[7] = 126; - - // U - this.uvData[0] = 145; - this.uvData[2] = 74; - this.uvData[4] = 176; - this.uvData[6] = 106; - }; -}; - -class NV21DataFromYUV422PData extends NVImage { - constructor() { - super(3, 3, 2, 2, "YUV420SP_NV12"); - - this.yData[0] = 16; this.yData[1] = 82; this.yData[2] = 144; - this.yData[3] = 41; this.yData[4] = 210; this.yData[5] = 169; - this.yData[6] = 107; this.yData[7] = 235; this.yData[8] = 126; - - // V - this.uvData[1] = 109; - this.uvData[3] = 54; - this.uvData[5] = 147; - this.uvData[7] = 147; - - // U - this.uvData[0] = 184; - this.uvData[2] = 34; - this.uvData[4] = 152; - this.uvData[6] = 72; - }; -}; - -class HSVData extends FloatSimpleImage { - constructor() { - super(3, 3, 3, "HSV"); - - var i = 0; - this.data[i + 0] = 0.0; this.data[i + 1] = 0.0; this.data[i + 2] = 0.0; - this.data[i + 3] = 0.0; this.data[i + 4] = 1.0; this.data[i + 5] = 1.0; - this.data[i + 6] = 120.0; this.data[i + 7] = 1.0; this.data[i + 8] = 1.0; - - i += this.width * this.channelCount; - this.data[i + 0] = 240.0; this.data[i + 1] = 1.0; this.data[i + 2] = 1.0; - this.data[i + 3] = 60.0; this.data[i + 4] = 1.0; this.data[i + 5] = 1.0; - this.data[i + 6] = 180.0; this.data[i + 7] = 1.0; this.data[i + 8] = 1.0; - - i += this.width * this.channelCount; - this.data[i + 0] = 300.0; this.data[i + 1] = 1.0; this.data[i + 2] = 1.0; - this.data[i + 3] = 0.0; this.data[i + 4] = 0.0; this.data[i + 5] = 1.0; - this.data[i + 6] = 0.0; this.data[i + 7] = 0.0; this.data[i + 8] = 0.50196081; - }; -}; - -class HSVDataFromLabData extends FloatSimpleImage { - constructor() { - super(3, 3, 3, "HSV"); - - var i = 0; - this.data[i + 0] = 0.0; this.data[i + 1] = 0.0; this.data[i + 2] = 0.0; - this.data[i + 3] = 0.0; this.data[i + 4] = 1.0; this.data[i + 5] = 0.996078; - this.data[i + 6] = 120.0; this.data[i + 7] = 1.0; this.data[i + 8] = 1.0; - - i += this.width * this.channelCount; - this.data[i + 0] = 240.0; this.data[i + 1] = 1.0; this.data[i + 2] = 1.0; - this.data[i + 3] = 60.235294; this.data[i + 4] = 1.0; this.data[i + 5] = 1.0; - this.data[i + 6] = 179.764706; this.data[i + 7] = 1.0; this.data[i + 8] = 1.0; - - i += this.width * this.channelCount; - this.data[i + 0] = 300.0; this.data[i + 1] = 1.0; this.data[i + 2] = 1.0; - this.data[i + 3] = 0.0; this.data[i + 4] = 0.003922; this.data[i + 5] = 1.0; - this.data[i + 6] = 59.999998; this.data[i + 7] = 0.007813; this.data[i + 8] = 0.501961; - }; -}; - -class HSVDataFromYUV444PData extends FloatSimpleImage { - constructor() { - super(3, 3, 3, "HSV"); - - var i = 0; - this.data[i + 0] = 0.0; this.data[i + 1] = 0.0; this.data[i + 2] = 0.0; - this.data[i + 3] = 0.0; this.data[i + 4] = 1.0000000001003937; this.data[i + 5] = 0.996078431372549; - this.data[i + 6] = 120.23715415017372; this.data[i + 7] = 1.0000000001007905; this.data[i + 8] = 0.9921568627450981; - - i += this.width * this.channelCount; - this.data[i + 0] = 240.0; this.data[i + 1] = 1.0000000001015936; this.data[i + 2] = 0.984313725490196; - this.data[i + 3] = 59.99999999390438; this.data[i + 4] = 0.9920948617608696; this.data[i + 5] = 0.9921568627450981; - this.data[i + 6] = 179.76284584377885; this.data[i + 7] = 1.0000000001007905; this.data[i + 8] = 0.9921568627450981; - - i += this.width * this.channelCount; - this.data[i + 0] = 300.7058823588706; this.data[i + 1] = 1.0000000001; this.data[i + 2] = 1.0; - this.data[i + 3] = 0.0; this.data[i + 4] = 0.0; this.data[i + 5] = 0.9921568627450981; - this.data[i + 6] = 0.0; this.data[i + 7] = 0.0; this.data[i + 8] = 0.4980392156862745; - }; -}; - -class HSVDataFromYUV422PData extends FloatSimpleImage { - constructor() { - super(3, 3, 3, "HSV"); - - var i = 0; - this.data[i + 0] = 0.0; this.data[i + 1] = 1.0000000002865168; this.data[i + 2] = 0.34901960784313724; - this.data[i + 3] = 0.0; this.data[i + 4] = 0.7696969698515151; this.data[i + 5] = 0.6470588235294118; - this.data[i + 6] = 120.23715415017372; this.data[i + 7] = 1.0000000001007905; this.data[i + 8] = 0.9921568627450981; - - i += this.width * this.channelCount; - this.data[i + 0] = 0; this.data[i + 1] = 0.0; this.data[i + 2] = 0.10980392156862745; - this.data[i + 3] = 0; this.data[i + 4] = 0.0; this.data[i + 5] = 0.8784313725490196; - this.data[i + 6] = 179.76284584377885; this.data[i + 7] = 1.0000000001007905; this.data[i + 8] = 0.9921568627450981; - - i += this.width * this.channelCount; - this.data[i + 0] = 300.93750001176636; this.data[i + 1] = 0.7111111112527777; this.data[i + 2] = 0.7058823529411765; - this.data[i + 3] = 300.0000000278182; this.data[i + 4] = 0.21568627460980394; this.data[i + 5] = 1.0; - this.data[i + 6] = 0.0; this.data[i + 7] = 0.0; this.data[i + 8] = 0.4980392156862745; - }; -}; - -class HSVDataFromYUV420PData extends FloatSimpleImage { - constructor() { - super(3, 3, 3, "HSV"); - - var i = 0; - this.data[i + 0] = 0.0; this.data[i + 1] = 1.0000000005795455; this.data[i + 2] = 0.17254901960784313; - this.data[i + 3] = 359.04761904800455; this.data[i + 4] = 0.5250000002125; this.data[i + 5] = 0.47058823529411764; - this.data[i + 6] = 148.23529411462184; this.data[i + 7] = 1.000000000107143; this.data[i + 8] = 0.9333333333333333; - - i += this.width * this.channelCount; - this.data[i + 0] = 358.1250000007471; this.data[i + 1] = 0.8767123291164385; this.data[i + 2] = 0.28627450980392155; - this.data[i + 3] = 358.800000000612; this.data[i + 4] = 0.196078431472549; this.data[i + 5] = 1.0; - this.data[i + 6] = 151.85185184850937; this.data[i + 7] = 0.9529411765705882; this.data[i + 8] = 1.0; - - i += this.width * this.channelCount; - this.data[i + 0] = 300.93750001176636; this.data[i + 1] = 0.7111111112527777; this.data[i + 2] = 0.7058823529411765; - this.data[i + 3] = 300.0000000278182; this.data[i + 4] = 0.21568627460980394; this.data[i + 5] = 1.0; - this.data[i + 6] = 0.0; this.data[i + 7] = 0.0; this.data[i + 8] = 0.4980392156862745; - }; -}; - -class LabData extends FloatSimpleImage { - constructor() { - super(3, 3, 3, "Lab"); - - var i = 0; - this.data[i + 0] = 0.0; this.data[i + 1] = 0.0; this.data[i + 2] = 0.0; - this.data[i + 3] = 53.240585; this.data[i + 4] = 80.094185; this.data[i + 5] = 67.201538; - this.data[i + 6] = 87.7351; this.data[i + 7] = -86.181252; this.data[i + 8] = 83.177483; - - i += this.width * this.channelCount; - this.data[i + 0] = 32.29567; this.data[i + 1] = 79.186989; this.data[i + 2] = -107.86176; - this.data[i + 3] = 97.139511; this.data[i + 4] = -21.552414; this.data[i + 5] = 94.475792; - this.data[i + 6] = 91.113297; this.data[i + 7] = -48.088551; this.data[i + 8] = -14.130962; - - i += this.width * this.channelCount; - this.data[i + 0] = 60.323502; this.data[i + 1] = 98.235161; this.data[i + 2] = -60.825493; - this.data[i + 3] = 100.0; this.data[i + 4] = 0.0; this.data[i + 5] = 0.0; - this.data[i + 6] = 53.585014; this.data[i + 7] = 0.0; this.data[i + 8] = 0.0; - }; -}; - -class LabDataFromYUV444PData extends FloatSimpleImage { - constructor() { - super(3, 3, 3, "HSV"); - - var i = 0; - this.data[i + 0] = 0.0; this.data[i + 1] = 0.0; this.data[i + 2] = 0.0; - this.data[i + 3] = 53.034610465388056; this.data[i + 4] = 79.85590203914461; this.data[i + 5] = 67.0016253024788; - this.data[i + 6] = 87.11875689267448; this.data[i + 7] = -85.65429374039535; this.data[i + 8] = 82.60623202041464; - - i += this.width * this.channelCount; - this.data[i + 0] = 31.720345672804157; this.data[i + 1] = 78.24367895044873; this.data[i + 2] = -106.5768337072531; - this.data[i + 3] = 96.46792120648958; this.data[i + 4] = -21.409519847697347; this.data[i + 5] = 93.77548135780542; - this.data[i + 6] = 90.44660871821826; this.data[i + 7] = -48.089026724461526; this.data[i + 8] = -13.571034820412686; - - i += this.width * this.channelCount; - this.data[i + 0] = 60.151950936932494; this.data[i + 1] = 97.82071254270292; this.data[i + 2] = -59.43734830934828; - this.data[i + 3] = 99.30958687208283; this.data[i + 4] = 0.0; this.data[i + 5] = 0.0; - this.data[i + 6] = 53.19277745493915; this.data[i + 7] = 0.0; this.data[i + 8] = 0.0; - }; -}; - -class LabDataFromYUV422PData extends FloatSimpleImage { - constructor() { - super(3, 3, 3, "HSV"); - - var i = 0; - this.data[i + 0] = 16.127781199491146; this.data[i + 1] = 37.16386506574049; this.data[i + 2] = 25.043689417354877; - this.data[i + 3] = 36.981683077525915; this.data[i + 4] = 50.903511613481115; this.data[i + 5] = 32.31142038484883; - this.data[i + 6] = 87.11875689267448; this.data[i + 7] = -85.65429374039535; this.data[i + 8] = 82.60623202041464; - - i += this.width * this.channelCount; - this.data[i + 0] = 10.268184311230112; this.data[i + 1] = 0.0; this.data[i + 2] = 0.0; - this.data[i + 3] = 89.1772802290269; this.data[i + 4] = 0.0; this.data[i + 5] = 0.0; - this.data[i + 6] = 90.44660871821826; this.data[i + 7] = -48.089026724461526; this.data[i + 8] = -13.571034820412686; - - i += this.width * this.channelCount; - this.data[i + 0] = 46.144074613608296; this.data[i + 1] = 65.16894552944552; this.data[i + 2] = -40.267933584999625; - this.data[i + 3] = 86.8938834807636; this.data[i + 4] = 28.462923575986455; this.data[i + 5] = -19.464966592414633; - this.data[i + 6] = 53.19277745493915; this.data[i + 7] = 0.0; this.data[i + 8] = 0.0; - }; -}; - -class LabDataFromYUV420PData extends FloatSimpleImage { - constructor() { - super(3, 3, 3, "HSV"); - - var i = 0; - this.data[i + 0] = 4.838519820745088; this.data[i + 1] = 21.141105340568455; this.data[i + 2] = 7.645700032099379; - this.data[i + 3] = 32.31563239702677; this.data[i + 4] = 27.57546933915833; this.data[i + 5] = 12.300896526188554; - this.data[i + 6] = 83.08065258991849; this.data[i + 7] = -73.895752859582; this.data[i + 8] = 47.405921341516176; - - i += this.width * this.channelCount; - this.data[i + 0] = 13.450503010545155; this.data[i + 1] = 29.406984528513203; this.data[i + 2] = 16.333350166067607; - this.data[i + 3] = 86.69267491397105; this.data[i + 4] = 17.77388194061319; this.data[i + 5] = 6.21670853560361; - this.data[i + 6] = 88.693447032887; this.data[i + 7] = -74.34828426368617; this.data[i + 8] = 40.64106565615555; - - i += this.width * this.channelCount; - this.data[i + 0] = 46.144074613608296; this.data[i + 1] = 65.16894552944552; this.data[i + 2] = -40.267933584999625; - this.data[i + 3] = 86.8938834807636; this.data[i + 4] = 28.462923575986455; this.data[i + 5] = -19.464966592414633; - this.data[i + 6] = 53.19277745493915; this.data[i + 7] = 0.0; this.data[i + 8] = 0.0; - }; -}; - -class DepthData extends Uint16SimpleImage { - constructor() { - super(3, 3, 1, "DEPTH"); - - var i = 0; - this.data[i + 0] = 2; this.data[i + 1] = 4; this.data[i + 2] = 8; - - i += this.width * this.channelCount; - this.data[i + 0] = 16; this.data[i + 1] = 32; this.data[i + 2] = 64; - - i += this.width * this.channelCount; - this.data[i + 0] = 128; this.data[i + 1] = 256; this.data[i + 2] = 512; - }; -}; - -function getData(format, originalFormat) { - if (format == "RGBA32") { - if (originalFormat == "YUV444P") { - return new RGBA32DataFromYUV444PData(0, 1, 2, 3); - } else if (originalFormat == "YUV422P") { - return new RGBA32DataFromYUV422PData(0, 1, 2, 3); - } else if (originalFormat == "YUV420P" || - originalFormat == "YUV420SP_NV12" || - originalFormat == "YUV420SP_NV21") { - return new RGBA32DataFromYUV420PData(0, 1, 2, 3); - } else { - return new RGBA32Data(); - } - } else if (format == "BGRA32") { - if (originalFormat == "YUV444P") { - return new RGBA32DataFromYUV444PData(2, 1, 0, 3); - } else if (originalFormat == "YUV422P") { - return new RGBA32DataFromYUV422PData(2, 1, 0, 3); - } else if (originalFormat == "YUV420P" || - originalFormat == "YUV420SP_NV12" || - originalFormat == "YUV420SP_NV21") { - return new RGBA32DataFromYUV420PData(2, 1, 0, 3); - } else { - return new BGRA32Data(); - } - } else if (format == "RGB24") { - if (originalFormat == "YUV444P") { - return new RGBA32DataFromYUV444PData(0, 1, 2); - } else if (originalFormat == "YUV422P") { - return new RGBA32DataFromYUV422PData(0, 1, 2); - } else if (originalFormat == "YUV420P" || - originalFormat == "YUV420SP_NV12" || - originalFormat == "YUV420SP_NV21") { - return new RGBA32DataFromYUV420PData(0, 1, 2); - } else { - return new RGB24Data(); - } - } else if (format == "BGR24") { - if (originalFormat == "YUV444P") { - return new RGBA32DataFromYUV444PData(2, 1, 0); - } else if (originalFormat == "YUV422P") { - return new RGBA32DataFromYUV422PData(2, 1, 0); - } else if (originalFormat == "YUV420P" || - originalFormat == "YUV420SP_NV12" || - originalFormat == "YUV420SP_NV21") { - return new RGBA32DataFromYUV420PData(2, 1, 0); - } else { - return new BGR24Data(); - } - } else if (format == "GRAY8") { - if (originalFormat == "YUV444P" || - originalFormat == "YUV422P" || - originalFormat == "YUV420P" || - originalFormat == "YUV420SP_NV12" || - originalFormat == "YUV420SP_NV21") { - return new Gray8DataFromYUVData(); - } else { - return new Gray8Data(); - } - } else if (format == "YUV444P") { - if (originalFormat == "YUV422P") { - return new YUV444PDataFromYUV422PData(); - } else if (originalFormat == "YUV420P" || - originalFormat == "YUV420SP_NV12" || - originalFormat == "YUV420SP_NV21") { - return new YUV444PDataFromYUV420PData(); - } else { - return new YUV444PData(); - } - } else if (format == "YUV422P") { - if (originalFormat == "YUV444P") { - return new YUV422PDataFromYUV444PData(); - } else if (originalFormat == "YUV420P" || - originalFormat == "YUV420SP_NV12" || - originalFormat == "YUV420SP_NV21") { - return new YUV422PDataFromYUV420PData(); - } else { - return new YUV422PData(); - } - } else if (format == "YUV420P") { - if (originalFormat == "YUV444P") { - return new YUV420PDataFromYUV444PData(); - } else if (originalFormat == "YUV422P") { - return new YUV420PDataFromYUV422PData(); - } else { - return new YUV420PData(); - } - } else if (format == "YUV420SP_NV12") { - if (originalFormat == "YUV444P") { - return new NV12DataFromYUV444PData(); - } else if (originalFormat == "YUV422P") { - return new NV12DataFromYUV422PData(); - } else { - return new NV12Data(); - } - } else if (format == "YUV420SP_NV21") { - if (originalFormat == "YUV444P") { - return new NV21DataFromYUV444PData(); - } else if (originalFormat == "YUV422P") { - return new NV21DataFromYUV422PData(); - } else { - return new NV21Data(); - } - } else if (format == "HSV") { - if (originalFormat == "YUV444P") { - return new HSVDataFromYUV444PData(); - } else if (originalFormat == "YUV422P") { - return new HSVDataFromYUV422PData(); - } else if (originalFormat == "YUV420P" || - originalFormat == "YUV420SP_NV12" || - originalFormat == "YUV420SP_NV21") { - return new HSVDataFromYUV420PData(); - } else if (originalFormat == "Lab") { - return new HSVDataFromLabData(); - } else { - return new HSVData(); - } - } else if (format == "Lab") { - if (originalFormat == "YUV444P") { - return new LabDataFromYUV444PData(); - } else if (originalFormat == "YUV422P") { - return new LabDataFromYUV422PData(); - } else if (originalFormat == "YUV420P" || - originalFormat == "YUV420SP_NV12" || - originalFormat == "YUV420SP_NV21") { - return new LabDataFromYUV420PData(); - } else { - return new LabData(); - } - } else if (format == "DEPTH") { - return new DepthData(); - } -} - -function getTestData(sourceFromat, destinationFormat) { - return [getData(sourceFromat), getData(destinationFormat, sourceFromat)]; -} \ No newline at end of file diff --git a/dom/canvas/test/imagebitmap_extensions_on_worker.js b/dom/canvas/test/imagebitmap_extensions_on_worker.js deleted file mode 100644 index 63116e80e732..000000000000 --- a/dom/canvas/test/imagebitmap_extensions_on_worker.js +++ /dev/null @@ -1,47 +0,0 @@ -importScripts("imagebitmap_extensions_data.js"); -importScripts("imagebitmap_extensions.js"); - -var gGroundTruthImageData; -var gImageData; -var gImageBitmap; -var gPNGBlob; -var gJPEGBlob; - -onmessage = function(event) { - if (event.data.type == "setSources") { - gGroundTruthImageData = event.data.groundTruthImageData; - gImageData = event.data.imageData; - gImageBitmap = event.data.imageBitmap; - gPNGBlob = event.data.pngBlob; - gJPEGBlob = event.data.jpegBlob; - - ok(!!gGroundTruthImageData, "Get gGroundTruthImageData!"); - ok(!!gImageData, "Get gImageData!"); - ok(!!gImageBitmap, "Get gImageBitmap!"); - ok(!!gPNGBlob, "Get gPNGBlob!"); - ok(!!gJPEGBlob, "Get gJPEGBlob!"); - - runTests(); - } -}; - -function ok(expect, msg) { - postMessage({"type": "status", status: !!expect, msg: msg}); -} - -function runTests() { - testExceptions(). - then(testColorConversions()). - then( function() { return Promise.all([testAccessing_randomTest("ImageData", gImageData, 0), - testAccessing_randomTest("ImageBitmap", gImageBitmap, 0), - testAccessing_randomTest("PNG", gPNGBlob, 0), - testAccessing_randomTest("JPEG", gJPEGBlob, 10) // JPEG loses information - ]); }). - then( function() { return Promise.all([testCreateFromArrayBffer_randomTest("ImageData", gImageData, 0), - testCreateFromArrayBffer_randomTest("ImageBitmap", gImageBitmap, 0), - testCreateFromArrayBffer_randomTest("PNG", gPNGBlob, 0), - testCreateFromArrayBffer_randomTest("JPEG", gJPEGBlob, 10) // JPEG loses information - ]); }). - then(function() { return testInvalidAccess([gImageData, gImageBitmap, gPNGBlob, gJPEGBlob]); } ). - then(function() {postMessage({"type": "finish"});}, function(ev) { failed(ev); postMessage({"type": "finish"}); }); -} \ No newline at end of file diff --git a/dom/canvas/test/imagebitmap_extensions_prepareSources.js b/dom/canvas/test/imagebitmap_extensions_prepareSources.js deleted file mode 100644 index 3cf018ecc94d..000000000000 --- a/dom/canvas/test/imagebitmap_extensions_prepareSources.js +++ /dev/null @@ -1,94 +0,0 @@ -var gImage; -var gVideo; -var gCanvas; -var gCtx; -var gImageData; -var gImageBitmap; -var gPNGBlob; -var gJPEGBlob; - -var gGroundTruthImageData; - -function prepareSources() { - gVideo = document.createElement("video"); - gVideo.src = "http://example.com/tests/dom/canvas/test/crossorigin/video.sjs?name=tests/dom/canvas/test/320x240.ogv&type=video/ogg&cors=anonymous"; - gVideo.crossOrigin = "anonymous"; - gVideo.autoplay = "true" - - - gCanvas = document.createElement("canvas"); - gCtx = gCanvas.getContext("2d"); - - var resolver; - var promise = new Promise(function(resolve, reject) { - resolver = resolve; - }); - - // Prepare video. - gVideo.onloadeddata = function() { - ok(gVideo, "[Prepare Sources] gVideo is ok."); - - // Prepare canvas. - gCanvas.width = gVideo.videoWidth; - gCanvas.height = gVideo.videoHeight; - gCtx.drawImage(gVideo, 0, 0); - ok(gCanvas, "[Prepare Sources] gCanvas is ok."); - ok(gCtx, "[Prepare Sources] gCtx is ok."); - - // Prepare gGroundTruthImageData. - gGroundTruthImageData = gCtx.getImageData(0, 0, gCanvas.width, gCanvas.height); - ok(gGroundTruthImageData, "[Prepare Sources] gGroundTruthImageData is ok."); - - // Prepare image. - gImage = document.createElement("img"); - gImage.src = gCanvas.toDataURL(); - var resolverImage; - var promiseImage = new Promise(function(resolve, reject) { - resolverImage = resolve; - }); - gImage.onload = function() { - resolverImage(true); - } - - // Prepare ImageData. - gImageData = gCtx.getImageData(0, 0, gCanvas.width, gCanvas.height); - ok(gImageData, "[Prepare Sources] gImageData is ok."); - - // Prepapre PNG Blob. - var promisePNGBlob = new Promise(function(resolve, reject) { - gCanvas.toBlob(function(blob) { - gPNGBlob = blob; - ok(gPNGBlob, "[Prepare Sources] gPNGBlob is ok."); - resolve(true); - }); - }); - - // Prepare JPEG Blob. - var promiseJPEGBlob = new Promise(function(resolve, reject) { - gCanvas.toBlob(function(blob) { - gJPEGBlob = blob; - ok(gJPEGBlob, "[Prepare Sources] gJPEGBlob is ok."); - resolve(true); - }, "image/jpeg", 1.00); - }); - - // Prepare ImageBitmap. - var promiseImageBitmap = new Promise(function(resolve, reject) { - var p = createImageBitmap(gCanvas); - p.then(function(bitmap) { - gImageBitmap = bitmap; - ok(gImageBitmap, "[Prepare Sources] gImageBitmap is ok."); - resolve(true); - }); - }); - - resolver(Promise.all([ - promiseImage, - promisePNGBlob, - promiseJPEGBlob, - promiseImageBitmap - ])) - } - - return promise; -} \ No newline at end of file diff --git a/dom/canvas/test/mochitest.ini b/dom/canvas/test/mochitest.ini index 38e8d5f022aa..ba1116b75230 100644 --- a/dom/canvas/test/mochitest.ini +++ b/dom/canvas/test/mochitest.ini @@ -26,11 +26,6 @@ support-files = image_yellow75.png imagebitmap_bug1239300.js imagebitmap_bug1239752.js - imagebitmap_extensions.html - imagebitmap_extensions.js - imagebitmap_extensions_data.js - imagebitmap_extensions_on_worker.js - imagebitmap_extensions_prepareSources.js imagebitmap_on_worker.js imagebitmap_structuredclone.js imagebitmap_structuredclone_iframe.html @@ -238,15 +233,6 @@ tags = imagebitmap [test_imagebitmap_cropping.html] skip-if = android_version >= '17' # bug 1336581 tags = imagebitmap -[test_imagebitmap_extensions.html] -skip-if = android_version >= '17' # bug 1336581 -tags = imagebitmap -[test_imagebitmap_extensions_on_worker.html] -skip-if = android_version == '19' # bug 1338256 -tags = imagebitmap -[test_imagebitmap_on_worker.html] -skip-if = android_version >= '17' # bug 1336581 -tags = imagebitmap [test_imagebitmap_structuredclone.html] tags = imagebitmap [test_imagebitmap_structuredclone_iframe.html] @@ -311,3 +297,4 @@ skip-if = 1 subsuite = gpu tags = offscreencanvas skip-if = 1 +[test_invalid_mime_type_blob.html] diff --git a/dom/canvas/test/test_imagebitmap_extensions.html b/dom/canvas/test/test_imagebitmap_extensions.html deleted file mode 100644 index aae0ee4815b9..000000000000 --- a/dom/canvas/test/test_imagebitmap_extensions.html +++ /dev/null @@ -1,37 +0,0 @@ - - - Test ImageBitmap Extensions (Bug 1141979) - - - - - -
- - diff --git a/dom/canvas/test/test_imagebitmap_extensions_on_worker.html b/dom/canvas/test/test_imagebitmap_extensions_on_worker.html deleted file mode 100644 index 8287e0d83bf6..000000000000 --- a/dom/canvas/test/test_imagebitmap_extensions_on_worker.html +++ /dev/null @@ -1,39 +0,0 @@ - - - Test ImageBitmap Extensions On Worker (Bug 1141979) - - - - - -
- - - diff --git a/dom/canvas/test/test_invalid_mime_type_blob.html b/dom/canvas/test/test_invalid_mime_type_blob.html new file mode 100644 index 000000000000..e294ebbb40b1 --- /dev/null +++ b/dom/canvas/test/test_invalid_mime_type_blob.html @@ -0,0 +1,85 @@ + +createImageBitmap from Blob with invalid type + + + + + + diff --git a/dom/chrome-webidl/BrowsingContext.webidl b/dom/chrome-webidl/BrowsingContext.webidl index ac8079ce7eb3..31bf53c9dcda 100644 --- a/dom/chrome-webidl/BrowsingContext.webidl +++ b/dom/chrome-webidl/BrowsingContext.webidl @@ -5,7 +5,7 @@ interface nsIDocShell; -[Exposed=(Window, System), ChromeOnly] +[Exposed=Window, ChromeOnly] interface BrowsingContext { readonly attribute BrowsingContext? parent; diff --git a/dom/chrome-webidl/ChannelWrapper.webidl b/dom/chrome-webidl/ChannelWrapper.webidl index 8f9a5c3daf56..ef7469b1167f 100644 --- a/dom/chrome-webidl/ChannelWrapper.webidl +++ b/dom/chrome-webidl/ChannelWrapper.webidl @@ -41,7 +41,7 @@ enum MozContentPolicyType { * A thin wrapper around nsIChannel and nsIHttpChannel that allows JS * callers to access them without XPConnect overhead. */ -[ChromeOnly, Exposed=System] +[ChromeOnly, Exposed=Window] interface ChannelWrapper : EventTarget { /** * Returns the wrapper instance for the given channel. The same wrapper is diff --git a/dom/chrome-webidl/ChromeUtils.webidl b/dom/chrome-webidl/ChromeUtils.webidl index 20c3076478c8..c15f1bc1b7d9 100644 --- a/dom/chrome-webidl/ChromeUtils.webidl +++ b/dom/chrome-webidl/ChromeUtils.webidl @@ -14,7 +14,7 @@ * C++ callers use a fast path, and never call the JSAPI or WebIDL methods of * this object. */ -[ChromeOnly, Exposed=(Window,System)] +[ChromeOnly, Exposed=Window] interface MozQueryInterface { [Throws] legacycaller any (IID aIID); @@ -25,7 +25,7 @@ interface MozQueryInterface { * This is exposed in all the system globals where we can expose stuff by * default, so should only include methods that are **thread-safe**. */ -[ChromeOnly, Exposed=(Window,System,Worker)] +[ChromeOnly, Exposed=(Window,Worker)] namespace ChromeUtils { /** * Serialize a snapshot of the heap graph, as seen by |JS::ubi::Node| and @@ -148,7 +148,7 @@ namespace ChromeUtils { * Additional ChromeUtils methods that are _not_ thread-safe, and hence not * exposed in workers. */ -[Exposed=(Window,System)] +[Exposed=Window] partial namespace ChromeUtils { /** * A helper that converts OriginAttributesDictionary to a opaque suffix string. diff --git a/dom/chrome-webidl/DominatorTree.webidl b/dom/chrome-webidl/DominatorTree.webidl index 7eac4a8be251..518f0e980242 100644 --- a/dom/chrome-webidl/DominatorTree.webidl +++ b/dom/chrome-webidl/DominatorTree.webidl @@ -38,7 +38,7 @@ typedef unsigned long long NodeSize; * its retained size is therefore significant (assuming no external * references into the tree). */ -[ChromeOnly, Exposed=(Window,System,Worker)] +[ChromeOnly, Exposed=(Window,Worker)] interface DominatorTree { /** * The `NodeId` for the root of the dominator tree. This is a "meta-root" in diff --git a/dom/chrome-webidl/HeapSnapshot.webidl b/dom/chrome-webidl/HeapSnapshot.webidl index f1418dc28215..8b1b0b1a1404 100644 --- a/dom/chrome-webidl/HeapSnapshot.webidl +++ b/dom/chrome-webidl/HeapSnapshot.webidl @@ -7,7 +7,7 @@ /** * A HeapSnapshot represents a snapshot of the heap graph */ -[ChromeOnly, Exposed=(Window,System,Worker)] +[ChromeOnly, Exposed=(Window,Worker)] interface HeapSnapshot { /** * A time stamp of when the heap snapshot was taken, if available. Units are diff --git a/dom/chrome-webidl/MatchGlob.webidl b/dom/chrome-webidl/MatchGlob.webidl index 60fda71900c5..c7d19b5c257b 100644 --- a/dom/chrome-webidl/MatchGlob.webidl +++ b/dom/chrome-webidl/MatchGlob.webidl @@ -9,7 +9,7 @@ * occurrence of "?" in the glob matches any single literal character. */ [Constructor(DOMString glob, optional boolean allowQuestion = true), - ChromeOnly, Exposed=(Window,System)] + ChromeOnly, Exposed=Window] interface MatchGlob { /** * Returns true if the string matches the glob. diff --git a/dom/chrome-webidl/MatchPattern.webidl b/dom/chrome-webidl/MatchPattern.webidl index e7a96a486b04..4c2cfd4740b4 100644 --- a/dom/chrome-webidl/MatchPattern.webidl +++ b/dom/chrome-webidl/MatchPattern.webidl @@ -30,7 +30,7 @@ interface URI; * the URL path must exactly match the pattern path. */ [Constructor(DOMString pattern, optional MatchPatternOptions options), - ChromeOnly, Exposed=(Window,System)] + ChromeOnly, Exposed=Window] interface MatchPattern { /** * Returns true if the given URI matches the pattern. @@ -74,7 +74,7 @@ interface MatchPattern { * matches when any of its sub-patterns matches. */ [Constructor(sequence<(DOMString or MatchPattern)> patterns, optional MatchPatternOptions options), - ChromeOnly, Exposed=(Window,System)] + ChromeOnly, Exposed=Window] interface MatchPatternSet { /** * Returns true if the given URI matches any sub-pattern. diff --git a/dom/chrome-webidl/MozDocumentObserver.webidl b/dom/chrome-webidl/MozDocumentObserver.webidl index 6fcbffaaac2a..a63dc1f76098 100644 --- a/dom/chrome-webidl/MozDocumentObserver.webidl +++ b/dom/chrome-webidl/MozDocumentObserver.webidl @@ -9,7 +9,7 @@ callback interface MozDocumentCallback { void onPreloadDocument(MozDocumentMatcher matcher, LoadInfo loadInfo); }; -[ChromeOnly, Constructor(MozDocumentCallback callbacks), Exposed=System] +[ChromeOnly, Constructor(MozDocumentCallback callbacks), Exposed=Window] interface MozDocumentObserver { [Throws] void observe(sequence matchers); diff --git a/dom/chrome-webidl/PlacesEvent.webidl b/dom/chrome-webidl/PlacesEvent.webidl index ab98393e29fb..1365a35a2ae4 100644 --- a/dom/chrome-webidl/PlacesEvent.webidl +++ b/dom/chrome-webidl/PlacesEvent.webidl @@ -12,12 +12,12 @@ enum PlacesEventType { "bookmark-added", }; -[ChromeOnly, Exposed=(Window,System)] +[ChromeOnly, Exposed=Window] interface PlacesEvent { readonly attribute PlacesEventType type; }; -[ChromeOnly, Exposed=(Window,System)] +[ChromeOnly, Exposed=Window] interface PlacesVisit : PlacesEvent { /** * URL of the visit. @@ -76,7 +76,7 @@ interface PlacesVisit : PlacesEvent { /** * Base class for properties that are common to all bookmark events. */ -[ChromeOnly, Exposed=(Window,System)] +[ChromeOnly, Exposed=Window] interface PlacesBookmark : PlacesEvent { /** * The id of the item. @@ -135,7 +135,7 @@ dictionary PlacesBookmarkAdditionInit { required boolean isTagging; }; -[ChromeOnly, Exposed=(Window,System), Constructor(PlacesBookmarkAdditionInit initDict)] +[ChromeOnly, Exposed=Window, Constructor(PlacesBookmarkAdditionInit initDict)] interface PlacesBookmarkAddition : PlacesBookmark { /** * The item's index in the folder. diff --git a/dom/chrome-webidl/PlacesObservers.webidl b/dom/chrome-webidl/PlacesObservers.webidl index e6ab84872969..76c3e32a8ea5 100644 --- a/dom/chrome-webidl/PlacesObservers.webidl +++ b/dom/chrome-webidl/PlacesObservers.webidl @@ -6,13 +6,13 @@ callback PlacesEventCallback = void (sequence events); -[ChromeOnly, Exposed=(Window,System), +[ChromeOnly, Exposed=Window, Constructor(PlacesEventCallback callback)] interface PlacesWeakCallbackWrapper { }; // Global singleton which should handle all events for places. -[ChromeOnly, Exposed=(Window,System)] +[ChromeOnly, Exposed=Window] namespace PlacesObservers { [Throws] void addListener(sequence eventTypes, diff --git a/dom/chrome-webidl/PrecompiledScript.webidl b/dom/chrome-webidl/PrecompiledScript.webidl index 5e2a21ad202f..dafddd3c9b5e 100644 --- a/dom/chrome-webidl/PrecompiledScript.webidl +++ b/dom/chrome-webidl/PrecompiledScript.webidl @@ -8,7 +8,7 @@ * Represents a pre-compiled JS script, which can be repeatedly executed in * different globals without being re-parsed. */ -[ChromeOnly, Exposed=(Window,System)] +[ChromeOnly, Exposed=Window] interface PrecompiledScript { /** * Executes the script in the context of, and with the security principal diff --git a/dom/chrome-webidl/PrioEncoder.webidl b/dom/chrome-webidl/PrioEncoder.webidl index 3b0243326bcc..58ff5a21157f 100644 --- a/dom/chrome-webidl/PrioEncoder.webidl +++ b/dom/chrome-webidl/PrioEncoder.webidl @@ -4,7 +4,7 @@ * You can obtain one at http://mozilla.org/MPL/2.0/. */ -[ChromeOnly, Exposed=(Window,System)] +[ChromeOnly, Exposed=Window] namespace PrioEncoder { [Throws, NewObject] PrioEncodedData encode(ByteString batchID, PrioParams params); diff --git a/dom/chrome-webidl/PromiseDebugging.webidl b/dom/chrome-webidl/PromiseDebugging.webidl index 1a5c1aa321cc..8bef31b326bb 100644 --- a/dom/chrome-webidl/PromiseDebugging.webidl +++ b/dom/chrome-webidl/PromiseDebugging.webidl @@ -50,7 +50,7 @@ callback interface UncaughtRejectionObserver { void onConsumed(object p); }; -[ChromeOnly, Exposed=(Window,System)] +[ChromeOnly, Exposed=Window] interface PromiseDebugging { /** * The various functions on this interface all expect to take promises but diff --git a/dom/chrome-webidl/StructuredCloneHolder.webidl b/dom/chrome-webidl/StructuredCloneHolder.webidl index 716de49f5087..2e64193cda04 100644 --- a/dom/chrome-webidl/StructuredCloneHolder.webidl +++ b/dom/chrome-webidl/StructuredCloneHolder.webidl @@ -8,7 +8,7 @@ * A holder for structured-clonable data which can itself be cloned with * little overhead, and deserialized into an arbitrary global. */ -[ChromeOnly, Exposed=(Window,System,Worker), +[ChromeOnly, Exposed=(Window,Worker), /** * Serializes the given value to an opaque structured clone blob, and * returns the result. diff --git a/dom/chrome-webidl/WebExtensionContentScript.webidl b/dom/chrome-webidl/WebExtensionContentScript.webidl index 488bd82b104d..94b64b617cdf 100644 --- a/dom/chrome-webidl/WebExtensionContentScript.webidl +++ b/dom/chrome-webidl/WebExtensionContentScript.webidl @@ -9,7 +9,7 @@ interface WindowProxy; typedef (MatchPatternSet or sequence) MatchPatternSetOrStringSequence; typedef (MatchGlob or DOMString) MatchGlobOrString; -[Constructor(MozDocumentMatcherInit options), ChromeOnly, Exposed=System] +[Constructor(MozDocumentMatcherInit options), ChromeOnly, Exposed=Window] interface MozDocumentMatcher { /** * Returns true if the script's match and exclude patterns match the given @@ -132,7 +132,7 @@ enum ContentScriptRunAt { "document_idle", }; -[Constructor(WebExtensionPolicy extension, WebExtensionContentScriptInit options), ChromeOnly, Exposed=System] +[Constructor(WebExtensionPolicy extension, WebExtensionContentScriptInit options), ChromeOnly, Exposed=Window] interface WebExtensionContentScript : MozDocumentMatcher { /** * The earliest point in the load cycle at which this script should run. For diff --git a/dom/chrome-webidl/WebExtensionPolicy.webidl b/dom/chrome-webidl/WebExtensionPolicy.webidl index 6fc51046eb82..cb88b3648a1a 100644 --- a/dom/chrome-webidl/WebExtensionPolicy.webidl +++ b/dom/chrome-webidl/WebExtensionPolicy.webidl @@ -11,7 +11,7 @@ callback WebExtensionLocalizeCallback = DOMString (DOMString unlocalizedText); * Defines the platform-level policies for a WebExtension, including its * permissions and the characteristics of its moz-extension: URLs. */ -[Constructor(WebExtensionInit options), ChromeOnly, Exposed=System] +[Constructor(WebExtensionInit options), ChromeOnly, Exposed=Window] interface WebExtensionPolicy { /** * The add-on's internal ID, as specified in its manifest.json file or its diff --git a/dom/webidl/AbortController.webidl b/dom/webidl/AbortController.webidl index 19a8f8a63733..10cd4b67d6e3 100644 --- a/dom/webidl/AbortController.webidl +++ b/dom/webidl/AbortController.webidl @@ -7,7 +7,7 @@ * https://dom.spec.whatwg.org/#abortcontroller */ -[Constructor(), Exposed=(Window,Worker,System)] +[Constructor(), Exposed=(Window,Worker)] interface AbortController { readonly attribute AbortSignal signal; diff --git a/dom/webidl/AbortSignal.webidl b/dom/webidl/AbortSignal.webidl index 6b66f76c4cd9..be8adc70b4b4 100644 --- a/dom/webidl/AbortSignal.webidl +++ b/dom/webidl/AbortSignal.webidl @@ -7,7 +7,7 @@ * https://dom.spec.whatwg.org/#abortsignal */ -[Exposed=(Window,Worker,System)] +[Exposed=(Window,Worker)] interface AbortSignal : EventTarget { readonly attribute boolean aborted; diff --git a/dom/webidl/AbstractWorker.webidl b/dom/webidl/AbstractWorker.webidl index 7ea6e367b6c2..0a2adba68e95 100644 --- a/dom/webidl/AbstractWorker.webidl +++ b/dom/webidl/AbstractWorker.webidl @@ -4,7 +4,7 @@ * You can obtain one at http://mozilla.org/MPL/2.0/. */ -[NoInterfaceObject, Exposed=(Window,Worker,System)] +[NoInterfaceObject, Exposed=(Window,Worker)] interface AbstractWorker { attribute EventHandler onerror; }; diff --git a/dom/webidl/AddonManager.webidl b/dom/webidl/AddonManager.webidl index 0fb9cf3925ee..84ef69079236 100644 --- a/dom/webidl/AddonManager.webidl +++ b/dom/webidl/AddonManager.webidl @@ -82,7 +82,7 @@ interface AddonManager : EventTarget { readonly attribute boolean permissionPromptsEnabled; }; -[ChromeOnly,Exposed=System,HeaderFile="mozilla/AddonManagerWebAPI.h"] +[ChromeOnly,Exposed=Window,HeaderFile="mozilla/AddonManagerWebAPI.h"] interface AddonManagerPermissions { static boolean isHostPermitted(DOMString host); }; diff --git a/dom/webidl/Console.webidl b/dom/webidl/Console.webidl index 6fbce7a43d0b..2d4d5d13b135 100644 --- a/dom/webidl/Console.webidl +++ b/dom/webidl/Console.webidl @@ -8,7 +8,7 @@ * https://console.spec.whatwg.org/#console-namespace */ -[Exposed=(Window,Worker,WorkerDebugger,Worklet,System), +[Exposed=(Window,Worker,WorkerDebugger,Worklet), ClassString="Console", ProtoObjectHack] namespace console { @@ -146,7 +146,7 @@ dictionary ConsoleCounterError { }; [ChromeOnly, - Exposed=(Window,Worker,WorkerDebugger,Worklet,System)] + Exposed=(Window,Worker,WorkerDebugger,Worklet)] // This is basically a copy of the console namespace. interface ConsoleInstance { // Logging diff --git a/dom/webidl/DOMError.webidl b/dom/webidl/DOMError.webidl index 5fb5d17ed91b..ff2483f84a9a 100644 --- a/dom/webidl/DOMError.webidl +++ b/dom/webidl/DOMError.webidl @@ -11,7 +11,7 @@ */ [Constructor(DOMString name, optional DOMString message = ""), - Exposed=(Window,Worker,System)] + Exposed=(Window,Worker)] interface DOMError { [Constant, UseCounter] readonly attribute DOMString name; diff --git a/dom/webidl/DOMException.webidl b/dom/webidl/DOMException.webidl index 157e5cdca834..2b2b0b973995 100644 --- a/dom/webidl/DOMException.webidl +++ b/dom/webidl/DOMException.webidl @@ -16,7 +16,7 @@ interface StackFrame; [NoInterfaceObject, - Exposed=(Window,Worker,System)] + Exposed=(Window,Worker)] interface ExceptionMembers { // The nsresult associated with this exception. @@ -66,7 +66,7 @@ Exception implements ExceptionMembers; // XXXkhuey this is an 'exception', not an interface, but we don't have any // parser or codegen mechanisms for dealing with exceptions. [ExceptionClass, - Exposed=(Window, Worker,System), + Exposed=(Window, Worker), Constructor(optional DOMString message = "", optional DOMString name)] interface DOMException { // The name of the error code (ie, a string repr of |result|). diff --git a/dom/webidl/DOMRequest.webidl b/dom/webidl/DOMRequest.webidl index 2e25fc192734..3dd75a900835 100644 --- a/dom/webidl/DOMRequest.webidl +++ b/dom/webidl/DOMRequest.webidl @@ -5,7 +5,7 @@ enum DOMRequestReadyState { "pending", "done" }; -[Exposed=(Window,Worker,System), NoInterfaceObject] +[Exposed=(Window,Worker), NoInterfaceObject] interface DOMRequestShared { readonly attribute DOMRequestReadyState readyState; @@ -16,7 +16,7 @@ interface DOMRequestShared { attribute EventHandler onerror; }; -[Exposed=(Window,Worker,System)] +[Exposed=(Window,Worker)] interface DOMRequest : EventTarget { // The [TreatNonCallableAsNull] annotation is required since then() should do // nothing instead of throwing errors when non-callable arguments are passed. diff --git a/dom/webidl/DOMStringList.webidl b/dom/webidl/DOMStringList.webidl index 56c5836ffec7..023956b5b6f8 100644 --- a/dom/webidl/DOMStringList.webidl +++ b/dom/webidl/DOMStringList.webidl @@ -10,7 +10,7 @@ * liability, trademark and document use rules apply. */ -[Exposed=(Window,Worker,System)] +[Exposed=(Window,Worker)] interface DOMStringList { readonly attribute unsigned long length; getter DOMString? item(unsigned long index); diff --git a/dom/webidl/ErrorEvent.webidl b/dom/webidl/ErrorEvent.webidl index cb858dffdbe6..343343e000f5 100644 --- a/dom/webidl/ErrorEvent.webidl +++ b/dom/webidl/ErrorEvent.webidl @@ -4,7 +4,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ [Constructor(DOMString type, optional ErrorEventInit eventInitDict), - Exposed=(Window,Worker,System)] + Exposed=(Window,Worker)] interface ErrorEvent : Event { readonly attribute DOMString message; diff --git a/dom/webidl/Event.webidl b/dom/webidl/Event.webidl index 2d02ff7ef468..e50eb8fbf69e 100644 --- a/dom/webidl/Event.webidl +++ b/dom/webidl/Event.webidl @@ -11,7 +11,7 @@ */ [Constructor(DOMString type, optional EventInit eventInitDict), - Exposed=(Window,Worker,System), ProbablyShortLivingWrapper] + Exposed=(Window,Worker), ProbablyShortLivingWrapper] interface Event { [Pure] readonly attribute DOMString type; diff --git a/dom/webidl/EventTarget.webidl b/dom/webidl/EventTarget.webidl index 72475a4a3194..4805da5a9018 100644 --- a/dom/webidl/EventTarget.webidl +++ b/dom/webidl/EventTarget.webidl @@ -26,7 +26,7 @@ dictionary AddEventListenerOptions : EventListenerOptions { }; [Constructor, - Exposed=(Window,Worker,WorkerDebugger,AudioWorklet,System)] + Exposed=(Window,Worker,WorkerDebugger,AudioWorklet)] interface EventTarget { /* Passing null for wantsUntrusted means "default behavior", which differs in content and chrome. In content that default boolean @@ -65,6 +65,6 @@ partial interface EventTarget { // chrome easier. This returns the window which can be used to create // events to fire at this EventTarget, or null if there isn't one. partial interface EventTarget { - [ChromeOnly, Exposed=(Window,System), BinaryName="ownerGlobalForBindings"] + [ChromeOnly, Exposed=Window, BinaryName="ownerGlobalForBindings"] readonly attribute WindowProxy? ownerGlobal; }; diff --git a/dom/webidl/FileReader.webidl b/dom/webidl/FileReader.webidl index 1e79ba09fd9d..a8b6764e2be0 100644 --- a/dom/webidl/FileReader.webidl +++ b/dom/webidl/FileReader.webidl @@ -11,7 +11,7 @@ */ [Constructor, - Exposed=(Window,Worker,System)] + Exposed=(Window,Worker)] interface FileReader : EventTarget { // async read methods [Throws] diff --git a/dom/webidl/IDBCursor.webidl b/dom/webidl/IDBCursor.webidl index 159f9ba87ec5..c91e34088bf7 100644 --- a/dom/webidl/IDBCursor.webidl +++ b/dom/webidl/IDBCursor.webidl @@ -14,7 +14,7 @@ enum IDBCursorDirection { "prevunique" }; -[Exposed=(Window,Worker,System)] +[Exposed=(Window,Worker)] interface IDBCursor { readonly attribute (IDBObjectStore or IDBIndex) source; @@ -42,7 +42,7 @@ interface IDBCursor { IDBRequest delete (); }; -[Exposed=(Window,Worker,System)] +[Exposed=(Window,Worker)] interface IDBCursorWithValue : IDBCursor { [Throws] readonly attribute any value; diff --git a/dom/webidl/IDBDatabase.webidl b/dom/webidl/IDBDatabase.webidl index 19ecaa41b3cf..81f849e073b6 100644 --- a/dom/webidl/IDBDatabase.webidl +++ b/dom/webidl/IDBDatabase.webidl @@ -10,7 +10,7 @@ * liability, trademark and document use rules apply. */ -[Exposed=(Window,Worker,System)] +[Exposed=(Window,Worker)] interface IDBDatabase : EventTarget { readonly attribute DOMString name; readonly attribute unsigned long long version; diff --git a/dom/webidl/IDBFactory.webidl b/dom/webidl/IDBFactory.webidl index 0599af5e6805..ae90c8addd17 100644 --- a/dom/webidl/IDBFactory.webidl +++ b/dom/webidl/IDBFactory.webidl @@ -23,7 +23,7 @@ dictionary IDBOpenDBOptions * http://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#idl-def-IDBFactory * for more information. */ -[Exposed=(Window,Worker,System)] +[Exposed=(Window,Worker)] interface IDBFactory { [Throws, NeedsCallerType] IDBOpenDBRequest diff --git a/dom/webidl/IDBFileHandle.webidl b/dom/webidl/IDBFileHandle.webidl index e312742c640f..b347b970bf88 100644 --- a/dom/webidl/IDBFileHandle.webidl +++ b/dom/webidl/IDBFileHandle.webidl @@ -8,7 +8,7 @@ dictionary IDBFileMetadataParameters boolean lastModified = true; }; -[Exposed=(Window,System)] +[Exposed=(Window)] interface IDBFileHandle : EventTarget { readonly attribute IDBMutableFile? mutableFile; diff --git a/dom/webidl/IDBFileRequest.webidl b/dom/webidl/IDBFileRequest.webidl index fc3a8c5b67eb..7e9bae27a778 100644 --- a/dom/webidl/IDBFileRequest.webidl +++ b/dom/webidl/IDBFileRequest.webidl @@ -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/. */ -[Exposed=(Window,System)] +[Exposed=Window] interface IDBFileRequest : DOMRequest { readonly attribute IDBFileHandle? fileHandle; // this is deprecated due to renaming in the spec diff --git a/dom/webidl/IDBIndex.webidl b/dom/webidl/IDBIndex.webidl index 0e436650a47e..add37b34827d 100644 --- a/dom/webidl/IDBIndex.webidl +++ b/dom/webidl/IDBIndex.webidl @@ -18,7 +18,7 @@ dictionary IDBIndexParameters { DOMString? locale = null; }; -[Exposed=(Window,Worker,System)] +[Exposed=(Window,Worker)] interface IDBIndex { [SetterThrows] attribute DOMString name; diff --git a/dom/webidl/IDBKeyRange.webidl b/dom/webidl/IDBKeyRange.webidl index 1caba7618568..8bbb1e025f4a 100644 --- a/dom/webidl/IDBKeyRange.webidl +++ b/dom/webidl/IDBKeyRange.webidl @@ -9,7 +9,7 @@ * liability, trademark and document use rules apply. */ -[Exposed=(Window,Worker,System)] +[Exposed=(Window,Worker)] interface IDBKeyRange { [Throws] readonly attribute any lower; @@ -33,7 +33,7 @@ interface IDBKeyRange { static IDBKeyRange bound (any lower, any upper, optional boolean lowerOpen = false, optional boolean upperOpen = false); }; -[Exposed=(Window,Worker,System), +[Exposed=(Window,Worker), Func="mozilla::dom::IndexedDatabaseManager::ExperimentalFeaturesEnabled"] interface IDBLocaleAwareKeyRange : IDBKeyRange { [NewObject, Throws] diff --git a/dom/webidl/IDBMutableFile.webidl b/dom/webidl/IDBMutableFile.webidl index 4883cb22037e..ab7cb2fa7fe5 100644 --- a/dom/webidl/IDBMutableFile.webidl +++ b/dom/webidl/IDBMutableFile.webidl @@ -3,7 +3,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/. */ -[Exposed=(Window,System)] +[Exposed=Window] interface IDBMutableFile : EventTarget { readonly attribute DOMString name; readonly attribute DOMString type; diff --git a/dom/webidl/IDBObjectStore.webidl b/dom/webidl/IDBObjectStore.webidl index a06ac8897beb..562bd394efd0 100644 --- a/dom/webidl/IDBObjectStore.webidl +++ b/dom/webidl/IDBObjectStore.webidl @@ -12,7 +12,7 @@ dictionary IDBObjectStoreParameters { boolean autoIncrement = false; }; -[Exposed=(Window,Worker,System)] +[Exposed=(Window,Worker)] interface IDBObjectStore { [SetterThrows] attribute DOMString name; diff --git a/dom/webidl/IDBOpenDBRequest.webidl b/dom/webidl/IDBOpenDBRequest.webidl index ba0ebf837cb3..8668009a6b78 100644 --- a/dom/webidl/IDBOpenDBRequest.webidl +++ b/dom/webidl/IDBOpenDBRequest.webidl @@ -7,7 +7,7 @@ * https://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#idl-def-IDBOpenDBRequest */ -[Exposed=(Window,Worker,System)] +[Exposed=(Window,Worker)] interface IDBOpenDBRequest : IDBRequest { attribute EventHandler onblocked; diff --git a/dom/webidl/IDBRequest.webidl b/dom/webidl/IDBRequest.webidl index c23bf9fe709c..029368bc7d19 100644 --- a/dom/webidl/IDBRequest.webidl +++ b/dom/webidl/IDBRequest.webidl @@ -13,7 +13,7 @@ enum IDBRequestReadyState { "done" }; -[Exposed=(Window,Worker,System)] +[Exposed=(Window,Worker)] interface IDBRequest : EventTarget { [Throws] readonly attribute any result; diff --git a/dom/webidl/IDBTransaction.webidl b/dom/webidl/IDBTransaction.webidl index 336eaf2b8db7..7bca3da44fd6 100644 --- a/dom/webidl/IDBTransaction.webidl +++ b/dom/webidl/IDBTransaction.webidl @@ -19,7 +19,7 @@ enum IDBTransactionMode { "versionchange" }; -[Exposed=(Window,Worker,System)] +[Exposed=(Window,Worker)] interface IDBTransaction : EventTarget { [Throws] readonly attribute IDBTransactionMode mode; diff --git a/dom/webidl/IDBVersionChangeEvent.webidl b/dom/webidl/IDBVersionChangeEvent.webidl index 1c93850047d1..461b515f9477 100644 --- a/dom/webidl/IDBVersionChangeEvent.webidl +++ b/dom/webidl/IDBVersionChangeEvent.webidl @@ -16,7 +16,7 @@ dictionary IDBVersionChangeEventInit : EventInit { }; [Constructor(DOMString type, optional IDBVersionChangeEventInit eventInitDict), - Exposed=(Window,Worker,System)] + Exposed=(Window,Worker)] interface IDBVersionChangeEvent : Event { readonly attribute unsigned long long oldVersion; readonly attribute unsigned long long? newVersion; diff --git a/dom/webidl/IdleDeadline.webidl b/dom/webidl/IdleDeadline.webidl index 903122ab8921..17e150102cab 100644 --- a/dom/webidl/IdleDeadline.webidl +++ b/dom/webidl/IdleDeadline.webidl @@ -7,7 +7,7 @@ * https://w3c.github.io/requestidlecallback/ */ -[Exposed=(Window,System), +[Exposed=Window, Func="nsGlobalWindowInner::IsRequestIdleCallbackEnabled"] interface IdleDeadline { DOMHighResTimeStamp timeRemaining(); diff --git a/dom/webidl/ImageBitmap.webidl b/dom/webidl/ImageBitmap.webidl index abc800e21d89..eb2238d39e61 100644 --- a/dom/webidl/ImageBitmap.webidl +++ b/dom/webidl/ImageBitmap.webidl @@ -10,25 +10,17 @@ * http://w3c.github.io/mediacapture-worker/#imagebitmap-extensions */ -// Extensions -// Bug 1141979 - [FoxEye] Extend ImageBitmap with interfaces to access its -// underlying image data -// -// Note: -// Our overload resolution implementation doesn't deal with a union as the -// distinguishing argument which means we cannot overload functions via union -// types, a.k.a. we cannot overload createImageBitmap() via ImageBitmapSource -// and BufferSource. Here, we work around this issue by adding the BufferSource -// into ImageBitmapSource. - +// This is needed because we don't support SVG element as canvas image source. +// See bug 1500768. typedef (HTMLImageElement or - HTMLVideoElement or HTMLCanvasElement or + HTMLVideoElement or + ImageBitmap) CanvasImageSourceExcludedSVG; + +typedef (CanvasImageSourceExcludedSVG or Blob or - ImageData or - CanvasRenderingContext2D or - ImageBitmap or - BufferSource) ImageBitmapSource; + CanvasRenderingContext2D or // This is out of spec. + ImageData) ImageBitmapSource; [Exposed=(Window,Worker)] interface ImageBitmap { @@ -401,12 +393,3 @@ dictionary ChannelPixelLayout { }; typedef sequence ImagePixelLayout; - -partial interface ImageBitmap { - [Throws, Func="mozilla::dom::DOMPrefs::canvas_imagebitmap_extensions_enabled"] - ImageBitmapFormat findOptimalFormat (optional sequence aPossibleFormats); - [Throws, Func="mozilla::dom::DOMPrefs::canvas_imagebitmap_extensions_enabled"] - long mappedDataLength (ImageBitmapFormat aFormat); - [Throws, Func="mozilla::dom::DOMPrefs::canvas_imagebitmap_extensions_enabled"] - Promise mapDataInto (ImageBitmapFormat aFormat, BufferSource aBuffer, long aOffset); -}; diff --git a/dom/webidl/LegacyQueryInterface.webidl b/dom/webidl/LegacyQueryInterface.webidl index f6a4634aef7d..e31368dadf13 100644 --- a/dom/webidl/LegacyQueryInterface.webidl +++ b/dom/webidl/LegacyQueryInterface.webidl @@ -10,10 +10,10 @@ interface IID; [NoInterfaceObject, // Need Exposed here, because this is a mixin onto things like Event // that are exposed in workers. - Exposed=(Window,Worker,System)] + Exposed=(Window,Worker)] interface LegacyQueryInterface { // Legacy QueryInterface, only exposed to chrome code on the main thread. - [Exposed=(Window,System), ChromeOnly] + [Exposed=Window, ChromeOnly] nsISupports QueryInterface(IID iid); }; diff --git a/dom/webidl/MessageChannel.webidl b/dom/webidl/MessageChannel.webidl index 1e2ca4a19803..41208147c475 100644 --- a/dom/webidl/MessageChannel.webidl +++ b/dom/webidl/MessageChannel.webidl @@ -7,7 +7,7 @@ * http://www.whatwg.org/specs/web-apps/current-work/#channel-messaging */ -[Constructor, Exposed=(Window,Worker,System)] +[Constructor, Exposed=(Window,Worker)] interface MessageChannel { readonly attribute MessagePort port1; readonly attribute MessagePort port2; diff --git a/dom/webidl/MessageEvent.webidl b/dom/webidl/MessageEvent.webidl index 7d78c20e05b9..019a044c4806 100644 --- a/dom/webidl/MessageEvent.webidl +++ b/dom/webidl/MessageEvent.webidl @@ -8,7 +8,7 @@ */ [Constructor(DOMString type, optional MessageEventInit eventInitDict), - Exposed=(Window,Worker,System)] + Exposed=(Window,Worker)] interface MessageEvent : Event { /** * Custom data associated with this event. diff --git a/dom/webidl/MessagePort.webidl b/dom/webidl/MessagePort.webidl index f8b3de622cd2..ccb0eef0962e 100644 --- a/dom/webidl/MessagePort.webidl +++ b/dom/webidl/MessagePort.webidl @@ -7,7 +7,7 @@ * http://www.whatwg.org/specs/web-apps/current-work/#channel-messaging */ -[Exposed=(Window,Worker,AudioWorklet,System)] +[Exposed=(Window,Worker,AudioWorklet)] interface MessagePort : EventTarget { [Throws] void postMessage(any message, optional sequence transferable = []); diff --git a/dom/webidl/Promise.webidl b/dom/webidl/Promise.webidl index a296553dfa00..e251cbbeb253 100644 --- a/dom/webidl/Promise.webidl +++ b/dom/webidl/Promise.webidl @@ -14,7 +14,6 @@ callback AnyCallback = any (any value); // Hack to allow us to have JS owning and properly tracing/CCing/etc a // PromiseNativeHandler. -[NoInterfaceObject, - Exposed=(Window,Worker,System)] +[NoInterfaceObject, Exposed=(Window,Worker)] interface PromiseNativeHandler { }; diff --git a/dom/webidl/StreamFilter.webidl b/dom/webidl/StreamFilter.webidl index 3a100c4a3404..8574b8661008 100644 --- a/dom/webidl/StreamFilter.webidl +++ b/dom/webidl/StreamFilter.webidl @@ -57,7 +57,7 @@ enum StreamFilterStatus { * An interface which allows an extension to intercept, and optionally modify, * response data from an HTTP request. */ -[Exposed=(Window,System), +[Exposed=Window, Func="mozilla::extensions::StreamFilter::IsAllowedInContext"] interface StreamFilter : EventTarget { /** diff --git a/dom/webidl/StreamFilterDataEvent.webidl b/dom/webidl/StreamFilterDataEvent.webidl index 961c453dcff6..2dff6515eead 100644 --- a/dom/webidl/StreamFilterDataEvent.webidl +++ b/dom/webidl/StreamFilterDataEvent.webidl @@ -13,7 +13,7 @@ [Constructor(DOMString type, optional StreamFilterDataEventInit eventInitDict), Func="mozilla::extensions::StreamFilter::IsAllowedInContext", - Exposed=(Window,System)] + Exposed=Window] interface StreamFilterDataEvent : Event { /** * Contains a chunk of data read from the input stream. diff --git a/dom/webidl/TCPServerSocket.webidl b/dom/webidl/TCPServerSocket.webidl index 06d6689d2d00..764a16e43391 100644 --- a/dom/webidl/TCPServerSocket.webidl +++ b/dom/webidl/TCPServerSocket.webidl @@ -15,7 +15,7 @@ dictionary ServerSocketOptions { [Constructor(unsigned short port, optional ServerSocketOptions options, optional unsigned short backlog = 0), Func="mozilla::dom::TCPSocket::ShouldTCPSocketExist", - Exposed=(Window,System)] + Exposed=Window] interface TCPServerSocket : EventTarget { /** * The port of this server socket object. diff --git a/dom/webidl/TCPServerSocketEvent.webidl b/dom/webidl/TCPServerSocketEvent.webidl index f133ae7812f8..b15d264baf4c 100644 --- a/dom/webidl/TCPServerSocketEvent.webidl +++ b/dom/webidl/TCPServerSocketEvent.webidl @@ -5,7 +5,7 @@ [Constructor(DOMString type, optional TCPServerSocketEventInit eventInitDict), Func="mozilla::dom::TCPSocket::ShouldTCPSocketExist", - Exposed=(Window,System)] + Exposed=Window] interface TCPServerSocketEvent : Event { readonly attribute TCPSocket socket; }; diff --git a/dom/webidl/TCPSocket.webidl b/dom/webidl/TCPSocket.webidl index 42c6c2f7388c..0631fe689b94 100644 --- a/dom/webidl/TCPSocket.webidl +++ b/dom/webidl/TCPSocket.webidl @@ -41,7 +41,7 @@ interface LegacyMozTCPSocket { [Constructor(DOMString host, unsigned short port, optional SocketOptions options), Func="mozilla::dom::TCPSocket::ShouldTCPSocketExist", - Exposed=(Window,System)] + Exposed=Window] interface TCPSocket : EventTarget { /** * Upgrade an insecure connection to use TLS. Throws if the ready state is not OPEN. diff --git a/dom/webidl/TCPSocketErrorEvent.webidl b/dom/webidl/TCPSocketErrorEvent.webidl index 22db1b768c90..cd379500b693 100644 --- a/dom/webidl/TCPSocketErrorEvent.webidl +++ b/dom/webidl/TCPSocketErrorEvent.webidl @@ -11,7 +11,7 @@ [Constructor(DOMString type, optional TCPSocketErrorEventInit eventInitDict), Func="mozilla::dom::TCPSocket::ShouldTCPSocketExist", - Exposed=(Window,System)] + Exposed=Window] interface TCPSocketErrorEvent : Event { readonly attribute DOMString name; readonly attribute DOMString message; diff --git a/dom/webidl/TCPSocketEvent.webidl b/dom/webidl/TCPSocketEvent.webidl index 6a3d6851df4d..f449792a2f0c 100644 --- a/dom/webidl/TCPSocketEvent.webidl +++ b/dom/webidl/TCPSocketEvent.webidl @@ -11,7 +11,7 @@ [Constructor(DOMString type, optional TCPSocketEventInit eventInitDict), Func="mozilla::dom::TCPSocket::ShouldTCPSocketExist", - Exposed=(Window,System)] + Exposed=Window] interface TCPSocketEvent : Event { /** * If the event is a "data" event, data will be the bytes read from the network; diff --git a/dom/webidl/TextDecoder.webidl b/dom/webidl/TextDecoder.webidl index 9246c2a3207d..cefd13db52a2 100644 --- a/dom/webidl/TextDecoder.webidl +++ b/dom/webidl/TextDecoder.webidl @@ -11,7 +11,7 @@ */ [Constructor(optional DOMString label = "utf-8", optional TextDecoderOptions options), - Exposed=(Window,Worker,System)] + Exposed=(Window,Worker)] interface TextDecoder { [Constant] readonly attribute DOMString encoding; diff --git a/dom/webidl/TextEncoder.webidl b/dom/webidl/TextEncoder.webidl index 27f6e03d2cec..8acb7c6a0085 100644 --- a/dom/webidl/TextEncoder.webidl +++ b/dom/webidl/TextEncoder.webidl @@ -10,8 +10,7 @@ * http://creativecommons.org/publicdomain/zero/1.0/ */ -[Constructor, - Exposed=(Window,Worker,System)] +[Constructor, Exposed=(Window,Worker)] interface TextEncoder { [Constant] readonly attribute DOMString encoding; diff --git a/dom/webidl/URLSearchParams.webidl b/dom/webidl/URLSearchParams.webidl index 2828d81ddd46..a33b705d686e 100644 --- a/dom/webidl/URLSearchParams.webidl +++ b/dom/webidl/URLSearchParams.webidl @@ -14,7 +14,7 @@ */ [Constructor(optional (sequence> or record or USVString) init = ""), - Exposed=(Window,Worker,WorkerDebugger,System)] + Exposed=(Window,Worker,WorkerDebugger)] interface URLSearchParams { void append(USVString name, USVString value); void delete(USVString name); diff --git a/dom/webidl/WindowOrWorkerGlobalScope.webidl b/dom/webidl/WindowOrWorkerGlobalScope.webidl index 32e9966553de..78518d968368 100644 --- a/dom/webidl/WindowOrWorkerGlobalScope.webidl +++ b/dom/webidl/WindowOrWorkerGlobalScope.webidl @@ -65,18 +65,3 @@ partial interface WindowOrWorkerGlobalScope { [Throws, Func="mozilla::dom::DOMPrefs::dom_caches_enabled", SameObject] readonly attribute CacheStorage caches; }; - -// Mozilla extensions -partial interface WindowOrWorkerGlobalScope { - // Extensions to ImageBitmap bits. - // Bug 1141979 - [FoxEye] Extend ImageBitmap with interfaces to access its - // underlying image data - // - // Note: - // Overloaded functions cannot have different "extended attributes", - // so I cannot add preference on the extended version of createImageBitmap(). - // To work around, I will then check the preference at run time and throw if - // the preference is set to be false. - [Throws] - Promise createImageBitmap(ImageBitmapSource aImage, long aOffset, long aLength, ImageBitmapFormat aFormat, ImagePixelLayout aLayout); -}; diff --git a/dom/webidl/Worker.webidl b/dom/webidl/Worker.webidl index b4ce05003fc7..d8ddccbca45f 100644 --- a/dom/webidl/Worker.webidl +++ b/dom/webidl/Worker.webidl @@ -13,7 +13,7 @@ */ [Constructor(USVString scriptURL, optional WorkerOptions options), - Exposed=(Window,DedicatedWorker,SharedWorker,System)] + Exposed=(Window,DedicatedWorker,SharedWorker)] interface Worker : EventTarget { void terminate(); @@ -34,6 +34,6 @@ dictionary WorkerOptions { [Constructor(USVString scriptURL), Func="mozilla::dom::ChromeWorker::WorkerAvailable", - Exposed=(Window,DedicatedWorker,SharedWorker,System)] + Exposed=(Window,DedicatedWorker,SharedWorker)] interface ChromeWorker : Worker { }; diff --git a/dom/workers/WorkerScope.cpp b/dom/workers/WorkerScope.cpp index 1bf93ec0d40c..977336fb0c63 100644 --- a/dom/workers/WorkerScope.cpp +++ b/dom/workers/WorkerScope.cpp @@ -484,11 +484,6 @@ WorkerGlobalScope::CreateImageBitmap(JSContext* aCx, const ImageBitmapSource& aImage, ErrorResult& aRv) { - if (aImage.IsArrayBuffer() || aImage.IsArrayBufferView()) { - aRv.Throw(NS_ERROR_NOT_IMPLEMENTED); - return nullptr; - } - return ImageBitmap::Create(this, aImage, Nothing(), aRv); } @@ -498,36 +493,9 @@ WorkerGlobalScope::CreateImageBitmap(JSContext* aCx, int32_t aSx, int32_t aSy, int32_t aSw, int32_t aSh, ErrorResult& aRv) { - if (aImage.IsArrayBuffer() || aImage.IsArrayBufferView()) { - aRv.Throw(NS_ERROR_NOT_IMPLEMENTED); - return nullptr; - } - return ImageBitmap::Create(this, aImage, Some(gfx::IntRect(aSx, aSy, aSw, aSh)), aRv); } -already_AddRefed -WorkerGlobalScope::CreateImageBitmap(JSContext* aCx, - const ImageBitmapSource& aImage, - int32_t aOffset, int32_t aLength, - ImageBitmapFormat aFormat, - const Sequence& aLayout, - ErrorResult& aRv) -{ - if (!StaticPrefs::canvas_imagebitmap_extensions_enabled()) { - aRv.Throw(NS_ERROR_TYPE_ERR); - return nullptr; - } - - if (aImage.IsArrayBuffer() || aImage.IsArrayBufferView()) { - return ImageBitmap::Create(this, aImage, aOffset, aLength, aFormat, aLayout, - aRv); - } else { - aRv.Throw(NS_ERROR_TYPE_ERR); - return nullptr; - } -} - nsresult WorkerGlobalScope::Dispatch(TaskCategory aCategory, already_AddRefed&& aRunnable) diff --git a/dom/workers/WorkerScope.h b/dom/workers/WorkerScope.h index 291a162bf055..42f60c5ed660 100644 --- a/dom/workers/WorkerScope.h +++ b/dom/workers/WorkerScope.h @@ -191,14 +191,6 @@ public: int32_t aSx, int32_t aSy, int32_t aSw, int32_t aSh, ErrorResult& aRv); - already_AddRefed - CreateImageBitmap(JSContext* aCx, - const ImageBitmapSource& aImage, - int32_t aOffset, int32_t aLength, - mozilla::dom::ImageBitmapFormat aFormat, - const mozilla::dom::Sequence& aLayout, - mozilla::ErrorResult& aRv); - bool WindowInteractionAllowed() const { diff --git a/layout/painting/nsDisplayList.cpp b/layout/painting/nsDisplayList.cpp index a3030d23b4a6..f4c298768837 100644 --- a/layout/painting/nsDisplayList.cpp +++ b/layout/painting/nsDisplayList.cpp @@ -9976,47 +9976,88 @@ CreateSimpleClipRegion(const nsDisplayMasksAndClipPaths& aDisplayItem, return Nothing(); } - // TODO(emilio): We should be able to still generate a clip and pass the - // opacity down to StackingContextHelper instead. - if (frame->StyleEffects()->mOpacity != 1.0) { - return Nothing(); - } - auto& clipPath = style->mClipPath; if (clipPath.GetType() != StyleShapeSourceType::Shape) { return Nothing(); } - // TODO(emilio): We should be able to also simplify most of the circle() and - // ellipse() shapes. auto& shape = clipPath.GetBasicShape(); - if (shape->GetShapeType() != StyleBasicShapeType::Inset) { + if (shape->GetShapeType() == StyleBasicShapeType::Polygon) { return Nothing(); } + auto appUnitsPerDevPixel = frame->PresContext()->AppUnitsPerDevPixel(); const nsRect refBox = nsLayoutUtils::ComputeGeometryBox(frame, clipPath.GetReferenceBox()); - const nsRect insetRect = - ShapeUtils::ComputeInsetRect(shape, refBox) + aDisplayItem.ToReferenceFrame(); - - auto appUnitsPerDevPixel = frame->PresContext()->AppUnitsPerDevPixel(); - - nscoord radii[8] = { 0 }; AutoTArray clipRegions; - if (ShapeUtils::ComputeInsetRadii(shape, insetRect, refBox, radii)) { - clipRegions.AppendElement(wr::ToComplexClipRegion( - insetRect, radii, appUnitsPerDevPixel)); - } - auto rect = wr::ToRoundedLayoutRect( - LayoutDeviceRect::FromAppUnits(insetRect, appUnitsPerDevPixel)); + wr::LayoutRect rect; + switch (shape->GetShapeType()) { + case StyleBasicShapeType::Inset: { + const nsRect insetRect = + ShapeUtils::ComputeInsetRect(shape, refBox) + aDisplayItem.ToReferenceFrame(); + + nscoord radii[8] = { 0 }; + + if (ShapeUtils::ComputeInsetRadii(shape, insetRect, refBox, radii)) { + clipRegions.AppendElement(wr::ToComplexClipRegion( + insetRect, radii, appUnitsPerDevPixel)); + } + + rect = wr::ToRoundedLayoutRect( + LayoutDeviceRect::FromAppUnits(insetRect, appUnitsPerDevPixel)); + break; + } + case StyleBasicShapeType::Ellipse: + case StyleBasicShapeType::Circle: { + nsPoint center = ShapeUtils::ComputeCircleOrEllipseCenter(shape, refBox); + + nsSize radii; + if (shape->GetShapeType() == StyleBasicShapeType::Ellipse) { + radii = ShapeUtils::ComputeEllipseRadii(shape, center, refBox); + } else { + nscoord radius = ShapeUtils::ComputeCircleRadius(shape, center, refBox); + radii = { radius, radius }; + } + + nsRect ellipseRect( + aDisplayItem.ToReferenceFrame() + center - nsPoint(radii.width, radii.height), + radii * 2); + + nscoord ellipseRadii[8]; + NS_FOR_CSS_HALF_CORNERS(corner) { + ellipseRadii[corner] = HalfCornerIsX(corner) ? radii.width : radii.height; + } + + clipRegions.AppendElement(wr::ToComplexClipRegion( + ellipseRect, ellipseRadii, appUnitsPerDevPixel)); + + rect = wr::ToRoundedLayoutRect( + LayoutDeviceRect::FromAppUnits(ellipseRect, appUnitsPerDevPixel)); + break; + } + default: + // Please don't add more exceptions, try to find a way to define the clip + // without using a mask image. + // + // And if you _really really_ need to add an exception, add it to where + // the polygon check is. + MOZ_ASSERT_UNREACHABLE("Unhandled shape id?"); + return Nothing(); + } wr::WrClipId clipId = aBuilder.DefineClip(Nothing(), rect, &clipRegions, nullptr); return Some(clipId); } -static Maybe +enum class HandleOpacity +{ + No, + Yes, +}; + +static Maybe> CreateWRClipPathAndMasks(nsDisplayMasksAndClipPaths* aDisplayItem, const LayoutDeviceRect& aBounds, wr::IpcResourceUpdateQueue& aResources, @@ -10026,7 +10067,7 @@ CreateWRClipPathAndMasks(nsDisplayMasksAndClipPaths* aDisplayItem, nsDisplayListBuilder* aDisplayListBuilder) { if (auto clip = CreateSimpleClipRegion(*aDisplayItem, aBuilder)) { - return clip; + return Some(MakePair(*clip, HandleOpacity::Yes)); } Maybe mask = aManager->CommandBuilder().BuildWrMaskImage( @@ -10041,7 +10082,7 @@ CreateWRClipPathAndMasks(nsDisplayMasksAndClipPaths* aDisplayItem, nullptr, mask.ptr()); - return Some(clipId); + return Some(MakePair(clipId, HandleOpacity::No)); } bool @@ -10058,7 +10099,7 @@ nsDisplayMasksAndClipPaths::CreateWebRenderCommands( LayoutDeviceRect bounds = LayoutDeviceRect::FromAppUnits(displayBounds, appUnitsPerDevPixel); - Maybe clip = + Maybe> clip = CreateWRClipPathAndMasks( this, bounds, aResources, aBuilder, aSc, aManager, aDisplayListBuilder); @@ -10071,20 +10112,26 @@ nsDisplayMasksAndClipPaths::CreateWebRenderCommands( // The stacking context shouldn't have any offset. bounds.MoveTo(0, 0); + wr::WrClipId clipId = clip->first(); + + Maybe opacity = clip->second() == HandleOpacity::Yes + ? Some(mFrame->StyleEffects()->mOpacity) + : Nothing(); + layer.emplace(aSc, aBuilder, /*aFilters: */ nsTArray(), /*aBounds: */ bounds, /*aBoundTransform: */ nullptr, /*aAnimation: */ nullptr, - /*aOpacity: */ nullptr, + /*aOpacity: */ opacity.ptrOr(nullptr), /*aTransform: */ nullptr, /*aPerspective: */ nullptr, /*aMixBlendMode: */ gfx::CompositionOp::OP_OVER, /*aBackfaceVisible: */ true, /*aIsPreserve3D: */ false, /*aTransformForScrollData: */ Nothing(), - /*aClipNodeId: */ clip.ptr()); + /*aClipNodeId: */ &clipId); sc = layer.ptr(); // The whole stacking context will be clipped by us, so no need to have any // parent for the children context's clip. diff --git a/layout/reftests/font-inflation/reftest.list b/layout/reftests/font-inflation/reftest.list index df8cfd8b61c8..ed06fc435871 100644 --- a/layout/reftests/font-inflation/reftest.list +++ b/layout/reftests/font-inflation/reftest.list @@ -75,7 +75,7 @@ test-pref(font.size.inflation.emPerLine,20) test-pref(font.size.inflation.forceE # The tests below use nonzero values of the lineThreshold preference. test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.forceEnabled,true) test-pref(font.size.inflation.lineThreshold,100) == text-1.html text-1.html -test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.forceEnabled,true) test-pref(font.size.inflation.lineThreshold,100) random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == list-1.html list-1-ref.html # Bug 1392106 +test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.forceEnabled,true) test-pref(font.size.inflation.lineThreshold,100) random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) skip-if(cocoaWidget) == list-1.html list-1-ref.html # Bug 1392106, Bug 1434812 test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.forceEnabled,true) test-pref(font.size.inflation.lineThreshold,100) == threshold-1a.html threshold-1a.html test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.forceEnabled,true) test-pref(font.size.inflation.lineThreshold,100) == threshold-1b.html threshold-1b-ref.html test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.forceEnabled,true) test-pref(font.size.inflation.lineThreshold,100) == threshold-1c.html threshold-1c-ref.html diff --git a/layout/reftests/svg/svg-integration/clip-path/reftest.list b/layout/reftests/svg/svg-integration/clip-path/reftest.list index 67b8033aa29b..005111ccf33e 100644 --- a/layout/reftests/svg/svg-integration/clip-path/reftest.list +++ b/layout/reftests/svg/svg-integration/clip-path/reftest.list @@ -16,36 +16,36 @@ == clip-path-polygon-012.html clip-path-stripes-001-ref.html fuzzy-if(skiaContent,0-1,0-20) fuzzy-if(webrender&>kWidget,8-8,20-20) fails-if(webrender&&!gtkWidget) == clip-path-polygon-013.html clip-path-stripes-003-ref.html -fuzzy-if(webrender,64-64,714-714) == clip-path-circle-001.html clip-path-circle-001-ref.html -fuzzy-if(webrender,64-64,714-714) == clip-path-circle-002.html clip-path-circle-001-ref.html -fuzzy-if(webrender,64-64,714-714) == clip-path-circle-003.html clip-path-circle-001-ref.html -fuzzy-if(webrender,64-64,714-714) == clip-path-circle-004.html clip-path-circle-001-ref.html -fuzzy-if(webrender,64-64,714-714) == clip-path-circle-005.html clip-path-circle-002-ref.html -fuzzy-if(webrender,64-64,714-714) == clip-path-circle-006.html clip-path-circle-001-ref.html -fuzzy-if(webrender,64-64,714-714) == clip-path-circle-007.html clip-path-circle-002-ref.html -fuzzy-if(webrender,64-64,714-714) == clip-path-circle-008.html clip-path-circle-002-ref.html -fuzzy-if(webrender,64-64,714-714) == clip-path-circle-009.html clip-path-circle-003-ref.html -fuzzy-if(webrender,64-64,714-714) == clip-path-circle-010.html clip-path-circle-004-ref.html -fuzzy-if(webrender,64-64,714-714) == clip-path-circle-011.html clip-path-circle-005-ref.html -fuzzy-if(webrender,64-64,714-714) == clip-path-circle-012.html clip-path-circle-006-ref.html -fuzzy-if(webrender,64-64,714-714) == clip-path-circle-013.html clip-path-circle-002-ref.html -fuzzy-if(webrender,64-64,714-714) == clip-path-circle-014.html clip-path-circle-007-ref.html -fuzzy-if(webrender,64-64,714-714) == clip-path-circle-015.html clip-path-circle-008-ref.html -fuzzy-if(webrender,64-64,714-714) == clip-path-circle-016.html clip-path-circle-009-ref.html -fuzzy-if(/^Windows\x20NT\x2010\.0/.test(http.oscpu),0-16,0-9) fuzzy-if(webrender,64-64,714-714) == clip-path-circle-017.html clip-path-circle-007-ref.html -fuzzy-if(webrender,64-64,714-714) == clip-path-circle-018.html clip-path-circle-010-ref.html -fuzzy-if(webrender,64-64,714-714) == clip-path-circle-019.html clip-path-circle-002-ref.html -fuzzy-if(webrender,64-64,714-714) == clip-path-circle-020.html clip-path-circle-002-ref.html +fuzzy-if(webrender,35-35,703-703) == clip-path-circle-001.html clip-path-circle-001-ref.html +fuzzy-if(webrender,35-35,703-703) == clip-path-circle-002.html clip-path-circle-001-ref.html +fuzzy-if(webrender,35-35,703-703) == clip-path-circle-003.html clip-path-circle-001-ref.html +fuzzy-if(webrender,35-35,703-703) == clip-path-circle-004.html clip-path-circle-001-ref.html +fuzzy-if(webrender,35-35,703-703) == clip-path-circle-005.html clip-path-circle-002-ref.html +fuzzy-if(webrender,35-35,703-703) == clip-path-circle-006.html clip-path-circle-001-ref.html +fuzzy-if(webrender,35-35,703-703) == clip-path-circle-007.html clip-path-circle-002-ref.html +fuzzy-if(webrender,35-35,703-703) == clip-path-circle-008.html clip-path-circle-002-ref.html +fuzzy-if(webrender,35-35,703-703) == clip-path-circle-009.html clip-path-circle-003-ref.html +fuzzy-if(webrender,35-35,703-703) == clip-path-circle-010.html clip-path-circle-004-ref.html +fuzzy-if(webrender,35-35,703-703) == clip-path-circle-011.html clip-path-circle-005-ref.html +fuzzy-if(webrender,35-35,703-703) == clip-path-circle-012.html clip-path-circle-006-ref.html +fuzzy-if(webrender,35-35,703-703) == clip-path-circle-013.html clip-path-circle-002-ref.html +fuzzy-if(webrender,35-35,703-703) == clip-path-circle-014.html clip-path-circle-007-ref.html +fuzzy-if(webrender,35-35,703-703) == clip-path-circle-015.html clip-path-circle-008-ref.html +fuzzy-if(webrender,35-35,703-703) == clip-path-circle-016.html clip-path-circle-009-ref.html +fuzzy-if(/^Windows\x20NT\x2010\.0/.test(http.oscpu),0-16,0-9) fuzzy-if(webrender,35-35,703-703) == clip-path-circle-017.html clip-path-circle-007-ref.html +fuzzy-if(webrender,35-35,703-703) == clip-path-circle-018.html clip-path-circle-010-ref.html +fuzzy-if(webrender,35-35,703-703) == clip-path-circle-019.html clip-path-circle-002-ref.html +fuzzy-if(webrender,35-35,703-703) == clip-path-circle-020.html clip-path-circle-002-ref.html == clip-path-circle-021.html clip-path-circle-021-ref.html -fuzzy-if(webrender,64-64,1106-1106) == clip-path-ellipse-001.html clip-path-ellipse-001-ref.html -fuzzy-if(webrender,64-64,1106-1106) == clip-path-ellipse-002.html clip-path-ellipse-001-ref.html -fuzzy-if(webrender,64-64,1106-1106) == clip-path-ellipse-003.html clip-path-ellipse-001-ref.html -fuzzy-if(webrender,64-64,1106-1106) == clip-path-ellipse-004.html clip-path-ellipse-001-ref.html -fuzzy-if(webrender,64-64,1106-1106) == clip-path-ellipse-005.html clip-path-ellipse-001-ref.html -fuzzy-if(webrender,64-64,1106-1106) == clip-path-ellipse-006.html clip-path-ellipse-001-ref.html -fuzzy-if(webrender,64-64,1106-1106) == clip-path-ellipse-007.html clip-path-ellipse-001-ref.html -fuzzy-if(webrender,64-64,1106-1106) == clip-path-ellipse-008.html clip-path-ellipse-001-ref.html +fuzzy-if(webrender,36-36,1100-1100) == clip-path-ellipse-001.html clip-path-ellipse-001-ref.html +fuzzy-if(webrender,36-36,1100-1100) == clip-path-ellipse-002.html clip-path-ellipse-001-ref.html +fuzzy-if(webrender,36-36,1100-1100) == clip-path-ellipse-003.html clip-path-ellipse-001-ref.html +fuzzy-if(webrender,36-36,1100-1100) == clip-path-ellipse-004.html clip-path-ellipse-001-ref.html +fuzzy-if(webrender,36-36,1100-1100) == clip-path-ellipse-005.html clip-path-ellipse-001-ref.html +fuzzy-if(webrender,36-36,1100-1100) == clip-path-ellipse-006.html clip-path-ellipse-001-ref.html +fuzzy-if(webrender,36-36,1100-1100) == clip-path-ellipse-007.html clip-path-ellipse-001-ref.html +fuzzy-if(webrender,36-36,1100-1100) == clip-path-ellipse-008.html clip-path-ellipse-001-ref.html == clip-path-inset-001a.html clip-path-inset-001-ref.html == clip-path-inset-001b.html clip-path-inset-001-ref.html diff --git a/layout/reftests/w3c-css/submitted/masking/reftest.list b/layout/reftests/w3c-css/submitted/masking/reftest.list index f4a608e62c4c..6d1c4866b5b6 100644 --- a/layout/reftests/w3c-css/submitted/masking/reftest.list +++ b/layout/reftests/w3c-css/submitted/masking/reftest.list @@ -89,7 +89,7 @@ fails == mask-origin-2.html mask-origin-2-ref.html # bug 1260094 fuzzy-if(winWidget,0-1,0-21) fuzzy-if(skiaContent,0-1,0-60) fuzzy-if(webrender,0-64,0-371) == clip-path-contentBox-1a.html clip-path-geometryBox-1-ref.html fuzzy-if(winWidget,0-16,0-21) fuzzy-if(skiaContent,0-1,0-60) == clip-path-contentBox-1b.html clip-path-geometryBox-1-ref.html -fuzzy-if(winWidget,0-16,0-21) fuzzy-if(skiaContent,0-1,0-60) fuzzy-if(webrender,64-64,371-371) == clip-path-contentBox-1c.html clip-path-geometryBox-1-ref.html +fuzzy-if(winWidget,0-16,0-21) fuzzy-if(skiaContent,0-1,0-60) fuzzy-if(webrender,35-35,360-360) == clip-path-contentBox-1c.html clip-path-geometryBox-1-ref.html fuzzy-if(winWidget,0-16,0-21) fuzzy-if(skiaContent,0-1,0-60) fuzzy-if(webrender,0-64,0-371) == clip-path-paddingBox-1a.html clip-path-geometryBox-1-ref.html fuzzy-if(winWidget,0-16,0-21) fuzzy-if(skiaContent,0-1,0-60) == clip-path-paddingBox-1b.html clip-path-geometryBox-1-ref.html fuzzy-if(winWidget,0-16,0-21) fuzzy-if(skiaContent,0-1,0-60) fuzzy-if(webrender,0-64,0-371) == clip-path-paddingBox-1c.html clip-path-geometryBox-1-ref.html diff --git a/modules/libpref/init/StaticPrefList.h b/modules/libpref/init/StaticPrefList.h index 4e9e813b39b2..5ba4d0064455 100644 --- a/modules/libpref/init/StaticPrefList.h +++ b/modules/libpref/init/StaticPrefList.h @@ -250,13 +250,6 @@ VARCACHE_PREF( uint32_t, 5000 ) -// Disable the ImageBitmap-extensions for now. -VARCACHE_PREF( - "canvas.imagebitmap_extensions.enabled", - canvas_imagebitmap_extensions_enabled, - RelaxedAtomicBool, false -) - // SW Cache API VARCACHE_PREF( "dom.caches.enabled", diff --git a/taskcluster/ci/build/windows.yml b/taskcluster/ci/build/windows.yml index 44e0585435f3..f8d10c714988 100755 --- a/taskcluster/ci/build/windows.yml +++ b/taskcluster/ci/build/windows.yml @@ -954,7 +954,7 @@ win32-mingwclang/opt: - linux64-node - linux64-clang-trunk-mingw-x86 - linux64-mingw32-nsis - - linux64-mingw32-fxc2 + - linux64-mingw-fxc2-x86 win32-mingwclang/debug: description: "Win32 MinGW-Clang Debug" @@ -990,7 +990,7 @@ win32-mingwclang/debug: - linux64-node - linux64-clang-trunk-mingw-x86 - linux64-mingw32-nsis - - linux64-mingw32-fxc2 + - linux64-mingw-fxc2-x86 win64-mingwclang/opt: description: "Win64 MinGW-Clang Opt" @@ -1026,7 +1026,7 @@ win64-mingwclang/opt: - linux64-node - linux64-clang-trunk-mingw-x64 - linux64-mingw32-nsis - - linux64-mingw32-fxc2 + - linux64-mingw-fxc2-x86 win64-mingwclang/debug: description: "Win64 MinGW-Clang Debug" @@ -1062,4 +1062,4 @@ win64-mingwclang/debug: - linux64-node - linux64-clang-trunk-mingw-x64 - linux64-mingw32-nsis - - linux64-mingw32-fxc2 + - linux64-mingw-fxc2-x86 diff --git a/taskcluster/ci/test/test-platforms.yml b/taskcluster/ci/test/test-platforms.yml index ec9e97fc665e..ac5b69d2e659 100644 --- a/taskcluster/ci/test/test-platforms.yml +++ b/taskcluster/ci/test/test-platforms.yml @@ -309,32 +309,34 @@ android-em-7.0-x86/opt: test-sets: - android-x86-kvm-tests +# Bug 1501364 - Temporarily disable Bitbar android hardware tests + # android-hw test platforms execute on real devices attached to Autophone hosts. # android-hw-g5-7-0 Motorola Moto G5 Android 7.0 -android-hw-g5-7-0-arm7-api-16/opt: - build-platform: android-api-16/opt - test-sets: - - android-hw-arm7-raptor - - raptor-fetch-geckoview +# android-hw-g5-7-0-arm7-api-16/opt: +# build-platform: android-api-16/opt +# test-sets: +# - android-hw-arm7-raptor +# - raptor-fetch-geckoview # android-hw-p2-8-0 Google Pixel 2 Android 8.0 -android-hw-p2-8-0-arm7-api-16/opt: - build-platform: android-api-16/opt - test-sets: - - android-hw-arm7-opt-unittests - - android-hw-arm7-raptor - - raptor-fetch-geckoview +# android-hw-p2-8-0-arm7-api-16/opt: +# build-platform: android-api-16/opt +# test-sets: +# - android-hw-arm7-opt-unittests +# - android-hw-arm7-raptor +# - raptor-fetch-geckoview -android-hw-p2-8-0-arm7-api-16/debug: - build-platform: android-api-16/debug - test-sets: - - android-hw-arm7-debug-unittests +# android-hw-p2-8-0-arm7-api-16/debug: +# build-platform: android-api-16/debug +# test-sets: +# - android-hw-arm7-debug-unittests -android-hw-p2-8-0-android-aarch64/opt: - build-platform: android-aarch64/opt - test-sets: - - android-hw-aarch64-opt-unittests - - android-hw-aarch64-raptor +# android-hw-p2-8-0-android-aarch64/opt: +# build-platform: android-aarch64/opt +# test-sets: +# - android-hw-aarch64-opt-unittests +# - android-hw-aarch64-raptor diff --git a/taskcluster/ci/toolchain/linux.yml b/taskcluster/ci/toolchain/linux.yml index c3feef13a029..b326f0588ba2 100755 --- a/taskcluster/ci/toolchain/linux.yml +++ b/taskcluster/ci/toolchain/linux.yml @@ -810,12 +810,12 @@ linux64-mingw32-nsis: toolchains: - linux64-mingw32-gcc -linux64-mingw32-fxc2: - description: "fxc2.exe build for MinGW32 Cross Compile" +linux64-mingw-fxc2-x86: + description: "fxc2.exe x86 build for MinGW Cross Compile" treeherder: kind: build platform: toolchains/opt - symbol: TMW(mingw32-fxc2) + symbol: TMW(mingw-fxc2-x86) tier: 2 worker-type: aws-provisioner-v1/gecko-{level}-b-linux worker: @@ -823,10 +823,11 @@ linux64-mingw32-fxc2: max-run-time: 1800 run: using: toolchain-script - script: build-mingw32-fxc2.sh + script: build-mingw-fxc2-x86.sh resources: - - 'build/unix/build-gcc/build-gcc.sh' - - 'taskcluster/scripts/misc/build-gcc-mingw32.sh' + - 'build/build-clang/build-clang.py' + - 'build/build-clang/clang-trunk-mingw.json' + - 'taskcluster/scripts/misc/build-clang-trunk-mingw.sh' toolchain-artifact: public/build/fxc2.tar.xz toolchains: - - linux64-mingw32-gcc + - linux64-clang-trunk-mingw-x86 diff --git a/taskcluster/scripts/misc/build-clang-trunk-mingw.sh b/taskcluster/scripts/misc/build-clang-trunk-mingw.sh index d8645b8d584f..0211cf4c53f0 100755 --- a/taskcluster/scripts/misc/build-clang-trunk-mingw.sh +++ b/taskcluster/scripts/misc/build-clang-trunk-mingw.sh @@ -32,7 +32,7 @@ SRC_DIR=$TOOLCHAIN_DIR/src make_flags="-j$(nproc)" -mingw_version=cfd85ebed773810429bf2164c3a985895b7dbfe3 +mingw_version=c69c7a706d767c5ca3c7d1c70887fcd8e1f940b3 libunwind_version=1f89d78bb488bc71cfdee8281fc0834e9fbe5dce binutils_version=2.27 diff --git a/taskcluster/scripts/misc/build-mingw32-fxc2.sh b/taskcluster/scripts/misc/build-mingw-fxc2-x86.sh similarity index 60% rename from taskcluster/scripts/misc/build-mingw32-fxc2.sh rename to taskcluster/scripts/misc/build-mingw-fxc2-x86.sh index 384c3bb60858..b563b1d12135 100755 --- a/taskcluster/scripts/misc/build-mingw32-fxc2.sh +++ b/taskcluster/scripts/misc/build-mingw-fxc2-x86.sh @@ -11,20 +11,19 @@ mkdir -p $INSTALL_DIR/bin cd $TOOLTOOL_DIR . taskcluster/scripts/misc/tooltool-download.sh -export PATH="$TOOLTOOL_DIR/mingw32/bin:$PATH" +export PATH="$TOOLTOOL_DIR/clang/bin:$PATH" cd $WORKSPACE # -------------- -git clone -n https://github.com/mozilla/fxc2.git fxc2-clone +git clone -n https://github.com/tomrittervg/fxc2.git fxc2-clone cd fxc2-clone -git checkout 82527b81104e5e21390d3ddcd328700c67ce73d4 # Asserts integrity of the clone (right?) -make -j$(nproc) +git checkout 502ef40807a472ba845f1cbdeac95ecab1aea2fd # Asserts integrity of the clone (right?) +make -j$(nproc) x86 cp fxc2.exe $INSTALL_DIR/bin/ -cp d3dcompiler_47.dll $INSTALL_DIR/bin/ -cp $TOOLTOOL_DIR/mingw32/i686-w64-mingw32/bin/libwinpthread-1.dll $INSTALL_DIR/bin/ +cp dll/d3dcompiler_47_32.dll $INSTALL_DIR/bin/d3dcompiler_47.dll # -------------- diff --git a/taskcluster/scripts/misc/build-wine.sh b/taskcluster/scripts/misc/build-wine.sh index 992a5e91561b..af70e0bbc637 100755 --- a/taskcluster/scripts/misc/build-wine.sh +++ b/taskcluster/scripts/misc/build-wine.sh @@ -17,10 +17,9 @@ cd $WORKSPACE # -------------- $GPG --import $data_dir/DA23579A74D4AD9AF9D3F945CEFAC8EAAF17519D.key - -download_and_check http://dl.winehq.org/wine/source/2.0/ wine-2.0.1.tar.xz.sign -tar xaf $TMPDIR/wine-2.0.1.tar.xz -cd wine-2.0.1 +download_and_check http://dl.winehq.org/wine/source/3.0/ wine-3.0.3.tar.xz.sign +tar xaf $TMPDIR/wine-3.0.3.tar.xz +cd wine-3.0.3 ./configure --prefix=$INSTALL_DIR/ make -j$(nproc) make install diff --git a/testing/web-platform/meta/2dcontext/imagebitmap/createImageBitmap-invalid-args.html.ini b/testing/web-platform/meta/2dcontext/imagebitmap/createImageBitmap-invalid-args.html.ini index 7db6a7667cfa..de2f708303e3 100644 --- a/testing/web-platform/meta/2dcontext/imagebitmap/createImageBitmap-invalid-args.html.ini +++ b/testing/web-platform/meta/2dcontext/imagebitmap/createImageBitmap-invalid-args.html.ini @@ -1,28 +1,4 @@ [createImageBitmap-invalid-args.html] - [createImageBitmap with an oversized canvas source rejects with a RangeError.] - expected: FAIL - - [createImageBitmap with an invalid OffscreenCanvas source rejects with a RangeError.] - expected: FAIL - - [createImageBitmap with a broken image source rejects with an InvalidStateError.] - expected: FAIL - - [createImageBitmap with an available but undecodable image source rejects with an InvalidStateError.] - expected: FAIL - - [createImageBitmap with an HTMLCanvasElement source and oversized (unallocatable) crop region] - expected: FAIL - - [createImageBitmap with an HTMLVideoElement source and oversized (unallocatable) crop region] - expected: FAIL - - [createImageBitmap with an HTMLImageElement source and sw set to 0] - expected: FAIL - - [createImageBitmap with an HTMLImageElement source and oversized (unallocatable) crop region] - expected: FAIL - [createImageBitmap with an OffscreenCanvas source and sw set to 0] expected: FAIL @@ -32,15 +8,6 @@ [createImageBitmap with an OffscreenCanvas source and oversized (unallocatable) crop region] expected: FAIL - [createImageBitmap with an ImageData source and oversized (unallocatable) crop region] - expected: FAIL - - [createImageBitmap with an ImageBitmap source and oversized (unallocatable) crop region] - expected: FAIL - - [createImageBitmap with an oversized canvas source.] - expected: FAIL - [createImageBitmap with an invalid OffscreenCanvas source.] expected: FAIL @@ -50,39 +17,18 @@ [createImageBitmap with an available but undecodable image source.] expected: FAIL - [createImageBitmap with a closed ImageBitmap.] - expected: FAIL - - [createImageBitmap with a bitmap HTMLImageElement source and oversized (unallocatable) crop region] - expected: FAIL - [createImageBitmap with a bitmap SVGImageElement source and sw set to 0] expected: FAIL [createImageBitmap with a bitmap SVGImageElement source and sh set to 0] expected: FAIL - [createImageBitmap with a bitmap SVGImageElement source and oversized (unallocatable) crop region] - expected: FAIL - [createImageBitmap with a vector SVGImageElement source and sw set to 0] expected: FAIL [createImageBitmap with a vector SVGImageElement source and sh set to 0] expected: FAIL - [createImageBitmap with a vector SVGImageElement source and oversized (unallocatable) crop region] - expected: FAIL - [createImageBitmap with CanvasRenderingContext2D image source.] expected: FAIL - [createImageBitmap with Uint8Array image source.] - expected: FAIL - - [createImageBitmap with ArrayBuffer image source.] - expected: FAIL - - [createImageBitmap with an HTMLVideoElement from a data URL source and oversized (unallocatable) crop region] - expected: FAIL - diff --git a/testing/web-platform/meta/css/css-masking/clip-path/clip-path-circle-001.html.ini b/testing/web-platform/meta/css/css-masking/clip-path/clip-path-circle-001.html.ini index a91f322765a4..d449dcca15df 100644 --- a/testing/web-platform/meta/css/css-masking/clip-path/clip-path-circle-001.html.ini +++ b/testing/web-platform/meta/css/css-masking/clip-path/clip-path-circle-001.html.ini @@ -1,2 +1,3 @@ [clip-path-circle-001.html] - expected: FAIL + expected: + if not webrender: FAIL diff --git a/testing/web-platform/meta/css/css-masking/clip-path/clip-path-circle-002.html.ini b/testing/web-platform/meta/css/css-masking/clip-path/clip-path-circle-002.html.ini index e44f62621974..3f5e98272cc5 100644 --- a/testing/web-platform/meta/css/css-masking/clip-path/clip-path-circle-002.html.ini +++ b/testing/web-platform/meta/css/css-masking/clip-path/clip-path-circle-002.html.ini @@ -1,2 +1,3 @@ [clip-path-circle-002.html] - expected: FAIL + expected: + if not webrender: FAIL diff --git a/testing/web-platform/meta/css/css-masking/clip-path/clip-path-circle-003.html.ini b/testing/web-platform/meta/css/css-masking/clip-path/clip-path-circle-003.html.ini index 1c19ca2bb4f9..4af6ad3b8bd0 100644 --- a/testing/web-platform/meta/css/css-masking/clip-path/clip-path-circle-003.html.ini +++ b/testing/web-platform/meta/css/css-masking/clip-path/clip-path-circle-003.html.ini @@ -1,2 +1,3 @@ [clip-path-circle-003.html] - expected: FAIL + expected: + if not webrender: FAIL diff --git a/testing/web-platform/meta/css/css-masking/clip-path/clip-path-circle-004.html.ini b/testing/web-platform/meta/css/css-masking/clip-path/clip-path-circle-004.html.ini index 189c5c918589..f25f7d51bb6d 100644 --- a/testing/web-platform/meta/css/css-masking/clip-path/clip-path-circle-004.html.ini +++ b/testing/web-platform/meta/css/css-masking/clip-path/clip-path-circle-004.html.ini @@ -1,2 +1,3 @@ [clip-path-circle-004.html] - expected: FAIL + expected: + if not webrender: FAIL diff --git a/testing/web-platform/meta/css/css-masking/clip-path/clip-path-circle-005.html.ini b/testing/web-platform/meta/css/css-masking/clip-path/clip-path-circle-005.html.ini index 3157656065c2..a4226799cc44 100644 --- a/testing/web-platform/meta/css/css-masking/clip-path/clip-path-circle-005.html.ini +++ b/testing/web-platform/meta/css/css-masking/clip-path/clip-path-circle-005.html.ini @@ -1,2 +1,3 @@ [clip-path-circle-005.html] - expected: FAIL + expected: + if not webrender: FAIL diff --git a/testing/web-platform/meta/css/css-masking/clip-path/clip-path-circle-006.html.ini b/testing/web-platform/meta/css/css-masking/clip-path/clip-path-circle-006.html.ini index f3673e61f8ec..265f5e663e9c 100644 --- a/testing/web-platform/meta/css/css-masking/clip-path/clip-path-circle-006.html.ini +++ b/testing/web-platform/meta/css/css-masking/clip-path/clip-path-circle-006.html.ini @@ -1,2 +1,3 @@ [clip-path-circle-006.html] - expected: FAIL + expected: + if not webrender: FAIL diff --git a/testing/web-platform/meta/css/css-masking/clip-path/clip-path-circle-007.html.ini b/testing/web-platform/meta/css/css-masking/clip-path/clip-path-circle-007.html.ini index 8011255700d6..b71deab0d7d3 100644 --- a/testing/web-platform/meta/css/css-masking/clip-path/clip-path-circle-007.html.ini +++ b/testing/web-platform/meta/css/css-masking/clip-path/clip-path-circle-007.html.ini @@ -1,2 +1,3 @@ [clip-path-circle-007.html] - expected: FAIL + expected: + if not webrender: FAIL diff --git a/testing/web-platform/meta/css/css-masking/clip-path/clip-path-circle-008.html.ini b/testing/web-platform/meta/css/css-masking/clip-path/clip-path-circle-008.html.ini index c08852ac607a..d7106f5b22a2 100644 --- a/testing/web-platform/meta/css/css-masking/clip-path/clip-path-circle-008.html.ini +++ b/testing/web-platform/meta/css/css-masking/clip-path/clip-path-circle-008.html.ini @@ -1,2 +1,3 @@ [clip-path-circle-008.html] - expected: FAIL + expected: + if not webrender: FAIL diff --git a/testing/web-platform/meta/css/css-masking/clip-path/clip-path-ellipse-001.html.ini b/testing/web-platform/meta/css/css-masking/clip-path/clip-path-ellipse-001.html.ini index 030e5321801c..1e253d4164f5 100644 --- a/testing/web-platform/meta/css/css-masking/clip-path/clip-path-ellipse-001.html.ini +++ b/testing/web-platform/meta/css/css-masking/clip-path/clip-path-ellipse-001.html.ini @@ -1,10 +1,3 @@ [clip-path-ellipse-001.html] expected: - if webrender: FAIL - if os == "linux": FAIL - if debug and not webrender and e10s and (os == "win") and (version == "6.1.7601") and (processor == "x86") and (bits == 32): FAIL - if debug and not webrender and e10s and (os == "win") and (version == "10.0.15063") and (processor == "x86_64") and (bits == 64): FAIL - if not debug and not webrender and e10s and (os == "win") and (version == "10.0.15063") and (processor == "x86_64") and (bits == 64): FAIL - if not debug and not webrender and e10s and (os == "win") and (version == "6.1.7601") and (processor == "x86") and (bits == 32): FAIL - if debug and not webrender and e10s and (os == "mac") and (version == "OS X 10.10.5") and (processor == "x86_64") and (bits == 64): FAIL - if not debug and not webrender and e10s and (os == "mac") and (version == "OS X 10.10.5") and (processor == "x86_64") and (bits == 64): FAIL + if not webrender: FAIL diff --git a/testing/web-platform/meta/css/css-masking/clip-path/clip-path-ellipse-002.html.ini b/testing/web-platform/meta/css/css-masking/clip-path/clip-path-ellipse-002.html.ini index c644a7a7e664..10a43872bab8 100644 --- a/testing/web-platform/meta/css/css-masking/clip-path/clip-path-ellipse-002.html.ini +++ b/testing/web-platform/meta/css/css-masking/clip-path/clip-path-ellipse-002.html.ini @@ -1,11 +1,3 @@ [clip-path-ellipse-002.html] expected: - if debug and webrender and e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86_64") and (bits == 64): FAIL - if not debug and webrender and e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86_64") and (bits == 64): FAIL - if os == "linux": FAIL - if debug and not webrender and e10s and (os == "win") and (version == "6.1.7601") and (processor == "x86") and (bits == 32): FAIL - if debug and not webrender and e10s and (os == "win") and (version == "10.0.15063") and (processor == "x86_64") and (bits == 64): FAIL - if not debug and not webrender and e10s and (os == "win") and (version == "10.0.15063") and (processor == "x86_64") and (bits == 64): FAIL - if not debug and not webrender and e10s and (os == "win") and (version == "6.1.7601") and (processor == "x86") and (bits == 32): FAIL - if debug and not webrender and e10s and (os == "mac") and (version == "OS X 10.10.5") and (processor == "x86_64") and (bits == 64): FAIL - if not debug and not webrender and e10s and (os == "mac") and (version == "OS X 10.10.5") and (processor == "x86_64") and (bits == 64): FAIL + if not webrender: FAIL diff --git a/testing/web-platform/meta/css/css-masking/clip-path/clip-path-ellipse-003.html.ini b/testing/web-platform/meta/css/css-masking/clip-path/clip-path-ellipse-003.html.ini index 655c3574bb05..61fd17d8b115 100644 --- a/testing/web-platform/meta/css/css-masking/clip-path/clip-path-ellipse-003.html.ini +++ b/testing/web-platform/meta/css/css-masking/clip-path/clip-path-ellipse-003.html.ini @@ -1,11 +1,3 @@ [clip-path-ellipse-003.html] expected: - if debug and webrender and e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86_64") and (bits == 64): FAIL - if not debug and webrender and e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86_64") and (bits == 64): FAIL - if os == "linux": FAIL - if debug and not webrender and e10s and (os == "win") and (version == "6.1.7601") and (processor == "x86") and (bits == 32): FAIL - if debug and not webrender and e10s and (os == "win") and (version == "10.0.15063") and (processor == "x86_64") and (bits == 64): FAIL - if not debug and not webrender and e10s and (os == "win") and (version == "10.0.15063") and (processor == "x86_64") and (bits == 64): FAIL - if not debug and not webrender and e10s and (os == "win") and (version == "6.1.7601") and (processor == "x86") and (bits == 32): FAIL - if debug and not webrender and e10s and (os == "mac") and (version == "OS X 10.10.5") and (processor == "x86_64") and (bits == 64): FAIL - if not debug and not webrender and e10s and (os == "mac") and (version == "OS X 10.10.5") and (processor == "x86_64") and (bits == 64): FAIL + if not webrender: FAIL diff --git a/testing/web-platform/meta/css/css-masking/clip-path/clip-path-ellipse-004.html.ini b/testing/web-platform/meta/css/css-masking/clip-path/clip-path-ellipse-004.html.ini index ce5bff273848..eada6b60b8eb 100644 --- a/testing/web-platform/meta/css/css-masking/clip-path/clip-path-ellipse-004.html.ini +++ b/testing/web-platform/meta/css/css-masking/clip-path/clip-path-ellipse-004.html.ini @@ -1,11 +1,3 @@ [clip-path-ellipse-004.html] expected: - if debug and webrender and e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86_64") and (bits == 64): FAIL - if not debug and webrender and e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86_64") and (bits == 64): FAIL - if os == "linux": FAIL - if debug and not webrender and e10s and (os == "win") and (version == "6.1.7601") and (processor == "x86") and (bits == 32): FAIL - if debug and not webrender and e10s and (os == "win") and (version == "10.0.15063") and (processor == "x86_64") and (bits == 64): FAIL - if not debug and not webrender and e10s and (os == "win") and (version == "10.0.15063") and (processor == "x86_64") and (bits == 64): FAIL - if not debug and not webrender and e10s and (os == "win") and (version == "6.1.7601") and (processor == "x86") and (bits == 32): FAIL - if debug and not webrender and e10s and (os == "mac") and (version == "OS X 10.10.5") and (processor == "x86_64") and (bits == 64): FAIL - if not debug and not webrender and e10s and (os == "mac") and (version == "OS X 10.10.5") and (processor == "x86_64") and (bits == 64): FAIL + if not webrender: FAIL diff --git a/testing/web-platform/meta/css/css-masking/clip-path/clip-path-ellipse-005.html.ini b/testing/web-platform/meta/css/css-masking/clip-path/clip-path-ellipse-005.html.ini index da2556230375..8f37409c79ea 100644 --- a/testing/web-platform/meta/css/css-masking/clip-path/clip-path-ellipse-005.html.ini +++ b/testing/web-platform/meta/css/css-masking/clip-path/clip-path-ellipse-005.html.ini @@ -1,11 +1,3 @@ [clip-path-ellipse-005.html] expected: - if debug and webrender and e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86_64") and (bits == 64): FAIL - if not debug and webrender and e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86_64") and (bits == 64): FAIL - if os == "linux": FAIL - if debug and not webrender and e10s and (os == "win") and (version == "6.1.7601") and (processor == "x86") and (bits == 32): FAIL - if debug and not webrender and e10s and (os == "win") and (version == "10.0.15063") and (processor == "x86_64") and (bits == 64): FAIL - if not debug and not webrender and e10s and (os == "win") and (version == "10.0.15063") and (processor == "x86_64") and (bits == 64): FAIL - if not debug and not webrender and e10s and (os == "win") and (version == "6.1.7601") and (processor == "x86") and (bits == 32): FAIL - if debug and not webrender and e10s and (os == "mac") and (version == "OS X 10.10.5") and (processor == "x86_64") and (bits == 64): FAIL - if not debug and not webrender and e10s and (os == "mac") and (version == "OS X 10.10.5") and (processor == "x86_64") and (bits == 64): FAIL + if not webrender: FAIL diff --git a/testing/web-platform/meta/css/css-masking/clip-path/clip-path-ellipse-006.html.ini b/testing/web-platform/meta/css/css-masking/clip-path/clip-path-ellipse-006.html.ini index 56d2940c956c..0a2be2edb1cf 100644 --- a/testing/web-platform/meta/css/css-masking/clip-path/clip-path-ellipse-006.html.ini +++ b/testing/web-platform/meta/css/css-masking/clip-path/clip-path-ellipse-006.html.ini @@ -1,11 +1,3 @@ [clip-path-ellipse-006.html] expected: - if debug and webrender and e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86_64") and (bits == 64): FAIL - if not debug and webrender and e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86_64") and (bits == 64): FAIL - if os == "linux": FAIL - if debug and not webrender and e10s and (os == "win") and (version == "6.1.7601") and (processor == "x86") and (bits == 32): FAIL - if debug and not webrender and e10s and (os == "win") and (version == "10.0.15063") and (processor == "x86_64") and (bits == 64): FAIL - if not debug and not webrender and e10s and (os == "win") and (version == "10.0.15063") and (processor == "x86_64") and (bits == 64): FAIL - if not debug and not webrender and e10s and (os == "win") and (version == "6.1.7601") and (processor == "x86") and (bits == 32): FAIL - if debug and not webrender and e10s and (os == "mac") and (version == "OS X 10.10.5") and (processor == "x86_64") and (bits == 64): FAIL - if not debug and not webrender and e10s and (os == "mac") and (version == "OS X 10.10.5") and (processor == "x86_64") and (bits == 64): FAIL + if not webrender: FAIL diff --git a/testing/web-platform/meta/css/css-masking/clip-path/clip-path-ellipse-007.html.ini b/testing/web-platform/meta/css/css-masking/clip-path/clip-path-ellipse-007.html.ini index 0c082e2913ea..3fa866110e9e 100644 --- a/testing/web-platform/meta/css/css-masking/clip-path/clip-path-ellipse-007.html.ini +++ b/testing/web-platform/meta/css/css-masking/clip-path/clip-path-ellipse-007.html.ini @@ -1,11 +1,3 @@ [clip-path-ellipse-007.html] expected: - if debug and webrender and e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86_64") and (bits == 64): FAIL - if not debug and webrender and e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86_64") and (bits == 64): FAIL - if os == "linux": FAIL - if debug and not webrender and e10s and (os == "win") and (version == "6.1.7601") and (processor == "x86") and (bits == 32): FAIL - if debug and not webrender and e10s and (os == "win") and (version == "10.0.15063") and (processor == "x86_64") and (bits == 64): FAIL - if not debug and not webrender and e10s and (os == "win") and (version == "10.0.15063") and (processor == "x86_64") and (bits == 64): FAIL - if not debug and not webrender and e10s and (os == "win") and (version == "6.1.7601") and (processor == "x86") and (bits == 32): FAIL - if debug and not webrender and e10s and (os == "mac") and (version == "OS X 10.10.5") and (processor == "x86_64") and (bits == 64): FAIL - if not debug and not webrender and e10s and (os == "mac") and (version == "OS X 10.10.5") and (processor == "x86_64") and (bits == 64): FAIL + if not webrender: FAIL diff --git a/testing/web-platform/meta/css/css-masking/clip-path/clip-path-ellipse-008.html.ini b/testing/web-platform/meta/css/css-masking/clip-path/clip-path-ellipse-008.html.ini index 222bdb40e4de..30a46a0a0185 100644 --- a/testing/web-platform/meta/css/css-masking/clip-path/clip-path-ellipse-008.html.ini +++ b/testing/web-platform/meta/css/css-masking/clip-path/clip-path-ellipse-008.html.ini @@ -1,11 +1,3 @@ [clip-path-ellipse-008.html] expected: - if debug and webrender and e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86_64") and (bits == 64): FAIL - if not debug and webrender and e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86_64") and (bits == 64): FAIL - if os == "linux": FAIL - if debug and not webrender and e10s and (os == "win") and (version == "6.1.7601") and (processor == "x86") and (bits == 32): FAIL - if debug and not webrender and e10s and (os == "win") and (version == "10.0.15063") and (processor == "x86_64") and (bits == 64): FAIL - if not debug and not webrender and e10s and (os == "win") and (version == "10.0.15063") and (processor == "x86_64") and (bits == 64): FAIL - if not debug and not webrender and e10s and (os == "win") and (version == "6.1.7601") and (processor == "x86") and (bits == 32): FAIL - if debug and not webrender and e10s and (os == "mac") and (version == "OS X 10.10.5") and (processor == "x86_64") and (bits == 64): FAIL - if not debug and not webrender and e10s and (os == "mac") and (version == "OS X 10.10.5") and (processor == "x86_64") and (bits == 64): FAIL + if not webrender: FAIL diff --git a/testing/web-platform/tests/2dcontext/imagebitmap/createImageBitmap-blob-invalidtype.html b/testing/web-platform/tests/2dcontext/imagebitmap/createImageBitmap-blob-invalidtype.html new file mode 100644 index 000000000000..9b9669f186dc --- /dev/null +++ b/testing/web-platform/tests/2dcontext/imagebitmap/createImageBitmap-blob-invalidtype.html @@ -0,0 +1,27 @@ + + +createImageBitmap: blob with wrong mime type + + + + diff --git a/testing/web-platform/tests/2dcontext/imagebitmap/createImageBitmap-invalid-args.html b/testing/web-platform/tests/2dcontext/imagebitmap/createImageBitmap-invalid-args.html index a576e08da92a..39707e83cb03 100644 --- a/testing/web-platform/tests/2dcontext/imagebitmap/createImageBitmap-invalid-args.html +++ b/testing/web-platform/tests/2dcontext/imagebitmap/createImageBitmap-invalid-args.html @@ -65,17 +65,23 @@ testCases = [ } }, { - // This case is not explicitly documented in the specification for - // createImageBitmap, but it is expected that internal failures cause - // InvalidStateError. - // - // Note: https://bugs.chromium.org/p/chromium/issues/detail?id=799025 description: 'createImageBitmap with source and oversized ' + '(unallocatable) crop region', promiseTestFunction: (source, t) => { - return promise_rejects(t, new DOMException('', 'InvalidStateError'), - createImageBitmap(source, 0, 0, 100000000, 100000000)); + return createImageBitmap(source, 0, 0, 100000000, 100000000) + .then(i => { + assert_equals(i.width, 100000000); + assert_equals(i.height, 100000000); + }) + .catch(e => { + // This case is not explicitly documented in the specification for + // createImageBitmap, but it is expected that internal failures + // cause InvalidStateError. + // + // Note: https://bugs.chromium.org/p/chromium/issues/detail?id=799025 + assert_throws(e, function() { throw e }, new DOMException('', 'InvalidStateError')); + }); } }, ]; diff --git a/toolkit/mozapps/update/updater/macbuild/Contents/Info.plist.in b/toolkit/mozapps/update/updater/macbuild/Contents/Info.plist.in index 26fc3d26482e..3d1d798051c9 100644 --- a/toolkit/mozapps/update/updater/macbuild/Contents/Info.plist.in +++ b/toolkit/mozapps/update/updater/macbuild/Contents/Info.plist.in @@ -4,6 +4,8 @@ CFBundleDevelopmentRegion English + CFBundleDisplayName + updater CFBundleExecutable org.mozilla.updater CFBundleIconFile @@ -12,25 +14,20 @@ org.mozilla.updater CFBundleInfoDictionaryVersion 6.0 + CFBundleName + updater CFBundlePackageType APPL CFBundleSignature ???? CFBundleVersion 1.0 + LSHasLocalizedDisplayName + NSMainNibFile MainMenu NSPrincipalClass NSApplication - LSMinimumSystemVersion - 10.5 - LSMinimumSystemVersionByArchitecture - - i386 - 10.5.0 - x86_64 - 10.6.0 - LSUIElement SMAuthorizedClients diff --git a/toolkit/mozapps/update/updater/macbuild/Contents/Resources/English.lproj/InfoPlist.strings.in b/toolkit/mozapps/update/updater/macbuild/Contents/Resources/English.lproj/InfoPlist.strings.in index bca4022e755a..464abc667d73 100644 --- a/toolkit/mozapps/update/updater/macbuild/Contents/Resources/English.lproj/InfoPlist.strings.in +++ b/toolkit/mozapps/update/updater/macbuild/Contents/Resources/English.lproj/InfoPlist.strings.in @@ -4,4 +4,5 @@ /* Localized versions of Info.plist keys */ -CFBundleName = "%APP_NAME% Software Update"; +CFBundleName = "Software Update"; +CFBundleDisplayName = "%APP_NAME% Software Update";