diff options
Diffstat (limited to 'dom')
86 files changed, 642 insertions, 1778 deletions
diff --git a/dom/base/nsContentUtils.h b/dom/base/nsContentUtils.h index 299a8e859..606d67de9 100644 --- a/dom/base/nsContentUtils.h +++ b/dom/base/nsContentUtils.h @@ -9,10 +9,14 @@ #ifndef nsContentUtils_h___ #define nsContentUtils_h___ -#if defined(XP_WIN) +#ifdef XP_WIN #include <float.h> #endif +#ifdef XP_SOLARIS +#include <ieeefp.h> +#endif + #include "js/TypeDecls.h" #include "js/Value.h" #include "js/RootingAPI.h" diff --git a/dom/base/nsDocument.cpp b/dom/base/nsDocument.cpp index 6b8e11db0..e2be6b664 100644 --- a/dom/base/nsDocument.cpp +++ b/dom/base/nsDocument.cpp @@ -395,6 +395,21 @@ nsIdentifierMapEntry::FireChangeCallbacks(Element* aOldElement, } } +void +nsIdentifierMapEntry::ClearAndNotify() +{ + Element* currentElement = mIdContentList.SafeElementAt(0); + mIdContentList.Clear(); + if (currentElement) { + FireChangeCallbacks(currentElement, nullptr); + } + mNameContentList = nullptr; + if (mImageElement) { + SetImageElement(nullptr); + } + mChangeCallbacks = nullptr; +} + namespace { struct PositionComparator @@ -1422,12 +1437,12 @@ nsDocument::~nsDocument() delete mSubDocuments; mSubDocuments = nullptr; + nsAutoScriptBlocker scriptBlocker; + // Destroy link map now so we don't waste time removing // links one by one DestroyElementMaps(); - nsAutoScriptBlocker scriptBlocker; - for (uint32_t indx = mChildren.ChildCount(); indx-- != 0; ) { mChildren.ChildAt(indx)->UnbindFromTree(); mChildren.RemoveChildAt(indx); @@ -1972,15 +1987,16 @@ nsDocument::ResetToURI(nsIURI *aURI, nsILoadGroup *aLoadGroup, delete mSubDocuments; mSubDocuments = nullptr; - // Destroy link map now so we don't waste time removing - // links one by one - DestroyElementMaps(); - bool oldVal = mInUnlinkOrDeletion; mInUnlinkOrDeletion = true; uint32_t count = mChildren.ChildCount(); { // Scope for update MOZ_AUTO_DOC_UPDATE(this, UPDATE_CONTENT_MODEL, true); + + // Destroy link map now so we don't waste time removing + // links one by one + DestroyElementMaps(); + for (int32_t i = int32_t(count) - 1; i >= 0; i--) { nsCOMPtr<nsIContent> content = mChildren.ChildAt(i); @@ -8955,7 +8971,14 @@ nsDocument::DestroyElementMaps() mStyledLinksCleared = true; #endif mStyledLinks.Clear(); + + // Notify ID change listeners before clearing the identifier map. + for (auto iter = mIdentifierMap.Iter(); !iter.Done(); iter.Next()) { + iter.Get()->ClearAndNotify(); + } + mIdentifierMap.Clear(); + ++mExpandoAndGeneration.generation; } diff --git a/dom/base/nsDocument.h b/dom/base/nsDocument.h index 2b29b98fa..ac600eb43 100644 --- a/dom/base/nsDocument.h +++ b/dom/base/nsDocument.h @@ -216,6 +216,11 @@ public: void RemoveContentChangeCallback(nsIDocument::IDTargetObserver aCallback, void* aData, bool aForImage); + /** + * Remove all elements and notify change listeners. + */ + void ClearAndNotify(); + void Traverse(nsCycleCollectionTraversalCallback* aCallback); struct ChangeCallback { diff --git a/dom/base/nsGkAtomList.h b/dom/base/nsGkAtomList.h index 8fefa0e02..73a3a02b1 100644 --- a/dom/base/nsGkAtomList.h +++ b/dom/base/nsGkAtomList.h @@ -665,6 +665,7 @@ GK_ATOM(noembed, "noembed") GK_ATOM(noframes, "noframes") GK_ATOM(nohref, "nohref") GK_ATOM(noisolation, "noisolation") +GK_ATOM(nomodule, "nomodule") GK_ATOM(nonce, "nonce") GK_ATOM(none, "none") GK_ATOM(noresize, "noresize") diff --git a/dom/base/nsGlobalWindow.cpp b/dom/base/nsGlobalWindow.cpp index ec546f068..1288b3435 100644 --- a/dom/base/nsGlobalWindow.cpp +++ b/dom/base/nsGlobalWindow.cpp @@ -1026,11 +1026,6 @@ public: return false; } - virtual bool watch(JSContext *cx, JS::Handle<JSObject*> proxy, - JS::Handle<jsid> id, JS::Handle<JSObject*> callable) const override; - virtual bool unwatch(JSContext *cx, JS::Handle<JSObject*> proxy, - JS::Handle<jsid> id) const override; - static void ObjectMoved(JSObject *obj, const JSObject *old); static const nsOuterWindowProxy singleton; @@ -1398,20 +1393,6 @@ nsOuterWindowProxy::AppendIndexedPropertyNames(JSContext *cx, JSObject *proxy, return true; } -bool -nsOuterWindowProxy::watch(JSContext *cx, JS::Handle<JSObject*> proxy, - JS::Handle<jsid> id, JS::Handle<JSObject*> callable) const -{ - return js::WatchGuts(cx, proxy, id, callable); -} - -bool -nsOuterWindowProxy::unwatch(JSContext *cx, JS::Handle<JSObject*> proxy, - JS::Handle<jsid> id) const -{ - return js::UnwatchGuts(cx, proxy, id); -} - void nsOuterWindowProxy::ObjectMoved(JSObject *obj, const JSObject *old) { diff --git a/dom/base/nsPlainTextSerializer.cpp b/dom/base/nsPlainTextSerializer.cpp index 8097c4ec8..98c9cfe32 100644 --- a/dom/base/nsPlainTextSerializer.cpp +++ b/dom/base/nsPlainTextSerializer.cpp @@ -53,7 +53,6 @@ static int32_t GetUnicharStringWidth(const char16_t* pwcs, int32_t n); // Someday may want to make this non-const: static const uint32_t TagStackSize = 500; -static const uint32_t OLStackSize = 100; nsresult NS_NewPlainTextSerializer(nsIContentSerializer** aSerializer) @@ -100,10 +99,6 @@ nsPlainTextSerializer::nsPlainTextSerializer() mTagStackIndex = 0; mIgnoreAboveIndex = (uint32_t)kNotFound; - // initialize the OL stack, where numbers for ordered lists are kept - mOLStack = new int32_t[OLStackSize]; - mOLStackIndex = 0; - mULCount = 0; mIgnoredChildNodeLevel = 0; @@ -112,7 +107,6 @@ nsPlainTextSerializer::nsPlainTextSerializer() nsPlainTextSerializer::~nsPlainTextSerializer() { delete[] mTagStack; - delete[] mOLStack; NS_WARNING_ASSERTION(mHeadLevel == 0, "Wrong head level!"); } @@ -189,6 +183,8 @@ nsPlainTextSerializer::Init(uint32_t aFlags, uint32_t aWrapColumn, // XXX We should let the caller decide whether to do this or not mFlags &= ~nsIDocumentEncoder::OutputNoFramesContent; + MOZ_ASSERT(mOLStack.IsEmpty()); + return NS_OK; } @@ -438,6 +434,8 @@ nsPlainTextSerializer::AppendDocumentStart(nsIDocument *aDocument, return NS_OK; } +int32_t kOlStackDummyValue = 0; + nsresult nsPlainTextSerializer::DoOpenContainer(nsIAtom* aTag) { @@ -616,44 +614,45 @@ nsPlainTextSerializer::DoOpenContainer(nsIAtom* aTag) } else if (aTag == nsGkAtoms::ul) { // Indent here to support nested lists, which aren't included in li :-( - EnsureVerticalSpace(mULCount + mOLStackIndex == 0 ? 1 : 0); - // Must end the current line before we change indention + EnsureVerticalSpace(IsInOLOrUL() ? 0 : 1); + // Must end the current line before we change indention mIndent += kIndentSizeList; mULCount++; } else if (aTag == nsGkAtoms::ol) { - EnsureVerticalSpace(mULCount + mOLStackIndex == 0 ? 1 : 0); + EnsureVerticalSpace(IsInOLOrUL() ? 0 : 1); if (mFlags & nsIDocumentEncoder::OutputFormatted) { // Must end the current line before we change indention - if (mOLStackIndex < OLStackSize) { - nsAutoString startAttr; - int32_t startVal = 1; - if (NS_SUCCEEDED(GetAttributeValue(nsGkAtoms::start, startAttr))) { - nsresult rv = NS_OK; - startVal = startAttr.ToInteger(&rv); - if (NS_FAILED(rv)) - startVal = 1; + nsAutoString startAttr; + int32_t startVal = 1; + if (NS_SUCCEEDED(GetAttributeValue(nsGkAtoms::start, startAttr))) { + nsresult rv = NS_OK; + startVal = startAttr.ToInteger(&rv); + if (NS_FAILED(rv)) { + startVal = 1; } - mOLStack[mOLStackIndex++] = startVal; } + mOLStack.AppendElement(startVal); } else { - mOLStackIndex++; + mOLStack.AppendElement(kOlStackDummyValue); } mIndent += kIndentSizeList; // see ul } else if (aTag == nsGkAtoms::li && (mFlags & nsIDocumentEncoder::OutputFormatted)) { if (mTagStackIndex > 1 && IsInOL()) { - if (mOLStackIndex > 0) { + if (!mOLStack.IsEmpty()) { nsAutoString valueAttr; if (NS_SUCCEEDED(GetAttributeValue(nsGkAtoms::value, valueAttr))) { nsresult rv = NS_OK; int32_t valueAttrVal = valueAttr.ToInteger(&rv); - if (NS_SUCCEEDED(rv)) - mOLStack[mOLStackIndex-1] = valueAttrVal; + if (NS_SUCCEEDED(rv)) { + mOLStack.LastElement() = valueAttrVal; + } } // This is what nsBulletFrame does for OLs: - mInIndentString.AppendInt(mOLStack[mOLStackIndex-1]++, 10); + mInIndentString.AppendInt(mOLStack.LastElement(), 10); + mOLStack.LastElement()++; } else { mInIndentString.Append(char16_t('#')); @@ -878,7 +877,8 @@ nsPlainTextSerializer::DoCloseContainer(nsIAtom* aTag) else if (aTag == nsGkAtoms::ul) { FlushLine(); mIndent -= kIndentSizeList; - if (--mULCount + mOLStackIndex == 0) { + --mULCount; + if (!IsInOLOrUL()) { mFloatingLines = 1; mLineBreakDue = true; } @@ -886,9 +886,9 @@ nsPlainTextSerializer::DoCloseContainer(nsIAtom* aTag) else if (aTag == nsGkAtoms::ol) { FlushLine(); // Doing this after decreasing OLStackIndex would be wrong. mIndent -= kIndentSizeList; - NS_ASSERTION(mOLStackIndex, "Wrong OLStack level!"); - mOLStackIndex--; - if (mULCount + mOLStackIndex == 0) { + NS_ASSERTION(!mOLStack.IsEmpty(), "Wrong OLStack level!"); + mOLStack.RemoveElementAt(mOLStack.Length() - 1); + if (!IsInOLOrUL()) { mFloatingLines = 1; mLineBreakDue = true; } @@ -1861,6 +1861,10 @@ nsPlainTextSerializer::IsInOL() return false; } +bool nsPlainTextSerializer::IsInOLOrUL() const { + return (mULCount > 0) || !mOLStack.IsEmpty(); +} + /* @return 0 = no header, 1 = h1, ..., 6 = h6 */ diff --git a/dom/base/nsPlainTextSerializer.h b/dom/base/nsPlainTextSerializer.h index 5055c75a0..650a8e3e7 100644 --- a/dom/base/nsPlainTextSerializer.h +++ b/dom/base/nsPlainTextSerializer.h @@ -81,6 +81,7 @@ private: void Write(const nsAString& aString); bool IsInPre(); bool IsInOL(); + bool IsInOLOrUL() const; bool IsCurrentNodeConverted(); bool MustSuppressLeaf(); @@ -218,8 +219,7 @@ private: uint32_t mIgnoreAboveIndex; // The stack for ordered lists - int32_t *mOLStack; - uint32_t mOLStackIndex; + AutoTArray<int32_t, 100> mOLStack; uint32_t mULCount; diff --git a/dom/base/nsScriptLoader.cpp b/dom/base/nsScriptLoader.cpp index 1e23d6c5f..3ac00142d 100644 --- a/dom/base/nsScriptLoader.cpp +++ b/dom/base/nsScriptLoader.cpp @@ -654,6 +654,19 @@ nsScriptLoader::CheckContentPolicy(nsIDocument* aDocument, } bool +nsScriptLoader::ModuleScriptsEnabled() +{ + static bool sEnabledForContent = false; + static bool sCachedPref = false; + if (!sCachedPref) { + sCachedPref = true; + Preferences::AddBoolVarCache(&sEnabledForContent, "dom.moduleScripts.enabled", false); + } + + return nsContentUtils::IsChromeDoc(mDocument) || sEnabledForContent; +} + +bool nsScriptLoader::ModuleMapContainsModule(nsModuleLoadRequest *aRequest) const { // Returns whether we have fetched, or are currently fetching, a module script @@ -1230,15 +1243,27 @@ nsScriptLoader::StartLoad(nsScriptLoadRequest *aRequest, const nsAString &aType, nsCOMPtr<nsIInterfaceRequestor> prompter(do_QueryInterface(docshell)); nsSecurityFlags securityFlags; - // TODO: the spec currently gives module scripts different CORS behaviour to - // classic scripts. - securityFlags = aRequest->mCORSMode == CORS_NONE - ? nsILoadInfo::SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL - : nsILoadInfo::SEC_REQUIRE_CORS_DATA_INHERITS; - if (aRequest->mCORSMode == CORS_ANONYMOUS) { - securityFlags |= nsILoadInfo::SEC_COOKIES_SAME_ORIGIN; - } else if (aRequest->mCORSMode == CORS_USE_CREDENTIALS) { - securityFlags |= nsILoadInfo::SEC_COOKIES_INCLUDE; + if (aRequest->IsModuleRequest()) { + // According to the spec, module scripts have different behaviour to classic + // scripts and always use CORS. + securityFlags = nsILoadInfo::SEC_REQUIRE_CORS_DATA_INHERITS; + if (aRequest->mCORSMode == CORS_NONE) { + securityFlags |= nsILoadInfo::SEC_COOKIES_OMIT; + } else if (aRequest->mCORSMode == CORS_ANONYMOUS) { + securityFlags |= nsILoadInfo::SEC_COOKIES_SAME_ORIGIN; + } else { + MOZ_ASSERT(aRequest->mCORSMode == CORS_USE_CREDENTIALS); + securityFlags |= nsILoadInfo::SEC_COOKIES_INCLUDE; + } + } else { + securityFlags = aRequest->mCORSMode == CORS_NONE + ? nsILoadInfo::SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL + : nsILoadInfo::SEC_REQUIRE_CORS_DATA_INHERITS; + if (aRequest->mCORSMode == CORS_ANONYMOUS) { + securityFlags |= nsILoadInfo::SEC_COOKIES_SAME_ORIGIN; + } else if (aRequest->mCORSMode == CORS_USE_CREDENTIALS) { + securityFlags |= nsILoadInfo::SEC_COOKIES_INCLUDE; + } } securityFlags |= nsILoadInfo::SEC_ALLOW_CHROME; @@ -1434,7 +1459,7 @@ nsScriptLoader::ProcessScriptElement(nsIScriptElement *aElement) nsCOMPtr<nsIContent> scriptContent = do_QueryInterface(aElement); - // Step 12. Check that the script is not an eventhandler + // Step 13. Check that the script is not an eventhandler if (IsScriptEventHandler(scriptContent)) { return false; } @@ -1448,8 +1473,7 @@ nsScriptLoader::ProcessScriptElement(nsIScriptElement *aElement) nsScriptKind scriptKind = nsScriptKind::Classic; if (!type.IsEmpty()) { - // Support type="module" only for chrome documents. - if (nsContentUtils::IsChromeDoc(mDocument) && type.LowerCaseEqualsASCII("module")) { + if (ModuleScriptsEnabled() && type.LowerCaseEqualsASCII("module")) { scriptKind = nsScriptKind::Module; } else { NS_ENSURE_TRUE(ParseTypeAttribute(type, &version), false); @@ -1469,7 +1493,18 @@ nsScriptLoader::ProcessScriptElement(nsIScriptElement *aElement) } } - // Step 14. in the HTML5 spec + // "In modern user agents that support module scripts, the script element with + // the nomodule attribute will be ignored". + // "The nomodule attribute must not be specified on module scripts (and will + // be ignored if it is)." + if (ModuleScriptsEnabled() && + scriptKind == nsScriptKind::Classic && + scriptContent->IsHTMLElement() && + scriptContent->HasAttr(kNameSpaceID_None, nsGkAtoms::nomodule)) { + return false; + } + + // Step 15. and later in the HTML5 spec nsresult rv = NS_OK; RefPtr<nsScriptLoadRequest> request; if (aElement->GetScriptExternal()) { @@ -1577,7 +1612,7 @@ nsScriptLoader::ProcessScriptElement(nsIScriptElement *aElement) } return false; } - if (!aElement->GetParserCreated() && !request->IsModuleRequest()) { + if (!aElement->GetParserCreated()) { // Violate the HTML5 spec in order to make LABjs and the "order" plug-in // for RequireJS work with their Gecko-sniffed code path. See // http://lists.w3.org/Archives/Public/public-html/2010Oct/0088.html @@ -2768,7 +2803,7 @@ nsScriptLoader::PreloadURI(nsIURI *aURI, const nsAString &aCharset, } // TODO: Preload module scripts. - if (nsContentUtils::IsChromeDoc(mDocument) && aType.LowerCaseEqualsASCII("module")) { + if (ModuleScriptsEnabled() && aType.LowerCaseEqualsASCII("module")) { return; } diff --git a/dom/base/nsScriptLoader.h b/dom/base/nsScriptLoader.h index d30a58441..a00239be5 100644 --- a/dom/base/nsScriptLoader.h +++ b/dom/base/nsScriptLoader.h @@ -568,6 +568,8 @@ private: JS::SourceBufferHolder GetScriptSource(nsScriptLoadRequest* aRequest, nsAutoString& inlineData); + bool ModuleScriptsEnabled(); + void SetModuleFetchStarted(nsModuleLoadRequest *aRequest); void SetModuleFetchFinishedAndResumeWaitingRequests(nsModuleLoadRequest *aRequest, nsresult aResult); diff --git a/dom/bindings/BindingUtils.cpp b/dom/bindings/BindingUtils.cpp index a26fc4422..6e0db29b1 100644 --- a/dom/bindings/BindingUtils.cpp +++ b/dom/bindings/BindingUtils.cpp @@ -1968,8 +1968,6 @@ const js::ObjectOps sInterfaceObjectClassObjectOps = { nullptr, /* setProperty */ nullptr, /* getOwnPropertyDescriptor */ nullptr, /* deleteProperty */ - nullptr, /* watch */ - nullptr, /* unwatch */ nullptr, /* getElements */ nullptr, /* enumerate */ InterfaceObjectToString, /* funToString */ diff --git a/dom/bindings/Codegen.py b/dom/bindings/Codegen.py index d7d700a96..924241aa0 100644 --- a/dom/bindings/Codegen.py +++ b/dom/bindings/Codegen.py @@ -13169,9 +13169,9 @@ class CGDictionary(CGThing): # continues to match the list in test_Object.prototype_props.html if (member.identifier.name in ["constructor", "toSource", "toString", "toLocaleString", "valueOf", - "watch", "unwatch", "hasOwnProperty", "isPrototypeOf", - "propertyIsEnumerable", "__defineGetter__", "__defineSetter__", - "__lookupGetter__", "__lookupSetter__", "__proto__"]): + "hasOwnProperty", "isPrototypeOf", "propertyIsEnumerable", + "__defineGetter__", "__defineSetter__", "__lookupGetter__", + "__lookupSetter__", "__proto__"]): raise TypeError("'%s' member of %s dictionary shadows " "a property of Object.prototype, and Xrays to " "Object can't handle that.\n" diff --git a/dom/bindings/DOMJSProxyHandler.cpp b/dom/bindings/DOMJSProxyHandler.cpp index 23f0abd88..49281c1c2 100644 --- a/dom/bindings/DOMJSProxyHandler.cpp +++ b/dom/bindings/DOMJSProxyHandler.cpp @@ -275,19 +275,6 @@ DOMProxyHandler::delete_(JSContext* cx, JS::Handle<JSObject*> proxy, } bool -BaseDOMProxyHandler::watch(JSContext* cx, JS::Handle<JSObject*> proxy, JS::Handle<jsid> id, - JS::Handle<JSObject*> callable) const -{ - return js::WatchGuts(cx, proxy, id, callable); -} - -bool -BaseDOMProxyHandler::unwatch(JSContext* cx, JS::Handle<JSObject*> proxy, JS::Handle<jsid> id) const -{ - return js::UnwatchGuts(cx, proxy, id); -} - -bool BaseDOMProxyHandler::ownPropertyKeys(JSContext* cx, JS::Handle<JSObject*> proxy, JS::AutoIdVector& props) const diff --git a/dom/bindings/DOMJSProxyHandler.h b/dom/bindings/DOMJSProxyHandler.h index 1781649cc..e3e151b7a 100644 --- a/dom/bindings/DOMJSProxyHandler.h +++ b/dom/bindings/DOMJSProxyHandler.h @@ -72,11 +72,6 @@ public: virtual bool getOwnEnumerablePropertyKeys(JSContext* cx, JS::Handle<JSObject*> proxy, JS::AutoIdVector &props) const override; - bool watch(JSContext* cx, JS::Handle<JSObject*> proxy, JS::Handle<jsid> id, - JS::Handle<JSObject*> callable) const override; - bool unwatch(JSContext* cx, JS::Handle<JSObject*> proxy, - JS::Handle<jsid> id) const override; - protected: // Hook for subclasses to implement shared ownPropertyKeys()/keys() // functionality. The "flags" argument is either JSITER_OWNONLY (for keys()) diff --git a/dom/bindings/test/test_Object.prototype_props.html b/dom/bindings/test/test_Object.prototype_props.html index 03147eb03..3ab27c5e4 100644 --- a/dom/bindings/test/test_Object.prototype_props.html +++ b/dom/bindings/test/test_Object.prototype_props.html @@ -11,9 +11,9 @@ test(function() { // Codegen.py's CGDictionary.getMemberDefinition method. var expected = [ "constructor", "toSource", "toString", "toLocaleString", "valueOf", - "watch", "unwatch", "hasOwnProperty", "isPrototypeOf", - "propertyIsEnumerable", "__defineGetter__", "__defineSetter__", - "__lookupGetter__", "__lookupSetter__", "__proto__" + "hasOwnProperty", "isPrototypeOf", "propertyIsEnumerable", + "__defineGetter__", "__defineSetter__", "__lookupGetter__", + "__lookupSetter__", "__proto__" ]; assert_array_equals(props.sort(), expected.sort()); }, "Own properties of Object.prototype"); diff --git a/dom/cache/StreamControl.cpp b/dom/cache/StreamControl.cpp index aab176666..69a72d0b6 100644 --- a/dom/cache/StreamControl.cpp +++ b/dom/cache/StreamControl.cpp @@ -68,7 +68,8 @@ StreamControl::CloseAllReadStreams() { AssertOwningThread(); - ReadStreamList::ForwardIterator iter(mReadStreamList); + auto readStreamList = mReadStreamList; + ReadStreamList::ForwardIterator iter(readStreamList); while (iter.HasMore()) { iter.GetNext()->CloseStream(); } diff --git a/dom/canvas/test/reftest/filters/liveness-document-open.html b/dom/canvas/test/reftest/filters/liveness-document-open.html new file mode 100644 index 000000000..b3d76e550 --- /dev/null +++ b/dom/canvas/test/reftest/filters/liveness-document-open.html @@ -0,0 +1,46 @@ +<!DOCTYPE html> +<html lang="en"> + +<title>canvas filters: remove referenced filter element through document.open()</title> + +<body onload="loaded()"> + +<canvas id="canvas" width="10" height="10"></canvas> + +<svg height="0"> + <filter id="filter"> + <feFlood flood-color="red"/> + </filter> +</svg> + +<script> + +function loaded() { + var ctx = document.getElementById('canvas').getContext('2d'); + + ctx.filter = 'url(#filter)'; + ctx.fillRect(0, 0, 10, 10); // do a draw first to work around bug 1287316 + + document.open(); + + // The document.open() call removed #filter from the document. So the filter + // reference should now be invalid, and the rect should be drawn without a + // filter applied, resulting in black. + ctx.fillRect(0, 0, 10, 10); + + try { + var data = ctx.getImageData(0, 0, 1, 1).data; + if (data[0] == 0 && data[1] == 0 && data[2] == 0 && data[3] == 255) { + // Successfully painted black. + document.write('PASS'); + } else { + // Painted something else, like red. + document.write('FAIL'); + } + } catch (e) { + document.write('getImageData failed'); + } + document.close(); +} + +</script> diff --git a/dom/canvas/test/reftest/filters/reftest.list b/dom/canvas/test/reftest/filters/reftest.list index 983030715..f5d671e4d 100644 --- a/dom/canvas/test/reftest/filters/reftest.list +++ b/dom/canvas/test/reftest/filters/reftest.list @@ -6,6 +6,7 @@ default-preferences pref(canvas.filters.enabled,true) fuzzy-if(azureSkia,1,1500) == global-alpha.html global-alpha-ref.html == global-composite-operation.html global-composite-operation-ref.html == liveness.html ref.html +== liveness-document-open.html data:text/html,PASS == multiple-drop-shadows.html shadow-ref.html == shadow.html shadow-ref.html == subregion-fill-paint.html subregion-ref.html diff --git a/dom/events/IMEStateManager.cpp b/dom/events/IMEStateManager.cpp index 1c8ed63f0..80abad3cc 100644 --- a/dom/events/IMEStateManager.cpp +++ b/dom/events/IMEStateManager.cpp @@ -297,7 +297,7 @@ IMEStateManager::OnDestroyPresContext(nsPresContext* aPresContext) IMEState newState = GetNewIMEState(sPresContext, nullptr); InputContextAction action(InputContextAction::CAUSE_UNKNOWN, InputContextAction::LOST_FOCUS); - SetIMEState(newState, nullptr, sWidget, action); + SetIMEState(newState, nullptr, nullptr, sWidget, action); } sWidget = nullptr; sContent = nullptr; @@ -352,7 +352,7 @@ IMEStateManager::OnRemoveContent(nsPresContext* aPresContext, IMEState newState = GetNewIMEState(sPresContext, nullptr); InputContextAction action(InputContextAction::CAUSE_UNKNOWN, InputContextAction::LOST_FOCUS); - SetIMEState(newState, nullptr, sWidget, action); + SetIMEState(newState, aPresContext, nullptr, sWidget, action); } sWidget = nullptr; @@ -542,7 +542,7 @@ IMEStateManager::OnChangeFocusInternal(nsPresContext* aPresContext, } // Update IME state for new focus widget - SetIMEState(newState, aContent, newWidget, aAction); + SetIMEState(newState, aPresContext, aContent, newWidget, aAction); } sActiveTabParent = newTabParent; @@ -704,7 +704,7 @@ IMEStateManager::OnClickInEditor(nsPresContext* aPresContext, InputContextAction action(cause, InputContextAction::FOCUS_NOT_CHANGED); IMEState newState = GetNewIMEState(aPresContext, aContent); - SetIMEState(newState, aContent, widget, action); + SetIMEState(newState, aPresContext, aContent, widget, action); } // static @@ -912,7 +912,7 @@ IMEStateManager::UpdateIMEState(const IMEState& aNewIMEState, if (updateIMEState) { InputContextAction action(InputContextAction::CAUSE_UNKNOWN, InputContextAction::FOCUS_NOT_CHANGED); - SetIMEState(aNewIMEState, aContent, widget, action); + SetIMEState(aNewIMEState, sPresContext, aContent, widget, action); if (NS_WARN_IF(widget->Destroyed())) { MOZ_LOG(sISMLog, LogLevel::Error, (" UpdateIMEState(), widget has gone during setting input context")); @@ -1022,8 +1022,8 @@ IMEStateManager::SetInputContextForChildProcess( MOZ_LOG(sISMLog, LogLevel::Info, ("SetInputContextForChildProcess(aTabParent=0x%p, " "aInputContext={ mIMEState={ mEnabled=%s, mOpen=%s }, " - "mHTMLInputType=\"%s\", mHTMLInputInputmode=\"%s\", mActionHint=\"%s\" }, " - "aAction={ mCause=%s, mAction=%s }), " + "mHTMLInputType=\"%s\", mHTMLInputInputmode=\"%s\", mActionHint=\"%s\", " + "mInPrivateBrowsing=%s }, aAction={ mCause=%s, mAction=%s }), " "sPresContext=0x%p (available: %s), sWidget=0x%p (available: %s), " "sActiveTabParent=0x%p", aTabParent, GetIMEStateEnabledName(aInputContext.mIMEState.mEnabled), @@ -1031,6 +1031,7 @@ IMEStateManager::SetInputContextForChildProcess( NS_ConvertUTF16toUTF8(aInputContext.mHTMLInputType).get(), NS_ConvertUTF16toUTF8(aInputContext.mHTMLInputInputmode).get(), NS_ConvertUTF16toUTF8(aInputContext.mActionHint).get(), + GetBoolName(aInputContext.mInPrivateBrowsing), GetActionCauseName(aAction.mCause), GetActionFocusChangeName(aAction.mFocusChange), sPresContext.get(), GetBoolName(CanHandleWith(sPresContext)), @@ -1070,6 +1071,7 @@ IMEStateManager::SetInputContextForChildProcess( // static void IMEStateManager::SetIMEState(const IMEState& aState, + nsPresContext* aPresContext, nsIContent* aContent, nsIWidget* aWidget, InputContextAction aAction) @@ -1090,6 +1092,10 @@ IMEStateManager::SetIMEState(const IMEState& aState, context.mIMEState = aState; context.mMayBeIMEUnaware = context.mIMEState.IsEditable() && sCheckForIMEUnawareWebApps && MayBeIMEUnawareWebApp(aContent); + + context.mInPrivateBrowsing = + aPresContext && + nsContentUtils::IsInPrivateBrowsing(aPresContext->Document()); if (aContent && aContent->IsAnyOfHTMLElements(nsGkAtoms::input, nsGkAtoms::textarea)) { @@ -1175,7 +1181,8 @@ IMEStateManager::SetInputContext(nsIWidget* aWidget, MOZ_LOG(sISMLog, LogLevel::Info, ("SetInputContext(aWidget=0x%p, aInputContext={ " "mIMEState={ mEnabled=%s, mOpen=%s }, mHTMLInputType=\"%s\", " - "mHTMLInputInputmode=\"%s\", mActionHint=\"%s\" }, " + "mHTMLInputInputmode=\"%s\", mActionHint=\"%s\", " + "mInPrivateBrowsing=%s }, " "aAction={ mCause=%s, mAction=%s }), sActiveTabParent=0x%p", aWidget, GetIMEStateEnabledName(aInputContext.mIMEState.mEnabled), @@ -1183,6 +1190,7 @@ IMEStateManager::SetInputContext(nsIWidget* aWidget, NS_ConvertUTF16toUTF8(aInputContext.mHTMLInputType).get(), NS_ConvertUTF16toUTF8(aInputContext.mHTMLInputInputmode).get(), NS_ConvertUTF16toUTF8(aInputContext.mActionHint).get(), + GetBoolName(aInputContext.mInPrivateBrowsing), GetActionCauseName(aAction.mCause), GetActionFocusChangeName(aAction.mFocusChange), sActiveTabParent.get())); diff --git a/dom/events/IMEStateManager.h b/dom/events/IMEStateManager.h index 7dfc48aa5..34509847f 100644 --- a/dom/events/IMEStateManager.h +++ b/dom/events/IMEStateManager.h @@ -247,6 +247,7 @@ protected: nsIContent* aContent, InputContextAction aAction); static void SetIMEState(const IMEState &aState, + nsPresContext* aPresContext, nsIContent* aContent, nsIWidget* aWidget, InputContextAction aAction); diff --git a/dom/grid/GridLines.cpp b/dom/grid/GridLines.cpp index fac645c64..898885346 100644 --- a/dom/grid/GridLines.cpp +++ b/dom/grid/GridLines.cpp @@ -90,7 +90,9 @@ GridLines::SetLineInfo(const ComputedGridTrackInfo* aTrackInfo, for (uint32_t i = aTrackInfo->mStartFragmentTrack; i < aTrackInfo->mEndFragmentTrack + 1; i++) { - uint32_t line1Index = i + 1; + // Since line indexes are 1-based, calculate a 1-based value + // for this track to simplify some calculations. + const uint32_t line1Index = i + 1; startOfNextTrack = (i < aTrackInfo->mEndFragmentTrack) ? aTrackInfo->mPositions[i] : @@ -127,7 +129,8 @@ GridLines::SetLineInfo(const ComputedGridTrackInfo* aTrackInfo, } } - if (i >= aTrackInfo->mRepeatFirstTrack && + if (i >= (aTrackInfo->mRepeatFirstTrack + + aTrackInfo->mNumLeadingImplicitTracks) && repeatIndex < numRepeatTracks) { numAddedLines += AppendRemovedAutoFits(aTrackInfo, aLineInfo, @@ -139,23 +142,30 @@ GridLines::SetLineInfo(const ComputedGridTrackInfo* aTrackInfo, RefPtr<GridLine> line = new GridLine(this); mLines.AppendElement(line); + MOZ_ASSERT(line1Index > 0, "line1Index must be positive."); + bool isBeforeFirstExplicit = + (line1Index <= aTrackInfo->mNumLeadingImplicitTracks); + // Calculate an actionable line number for this line, that could be used + // in a css grid property to align a grid item or area at that line. + // For implicit lines that appear before line 1, report a number of 0. + // We can't report negative indexes, because those have a different + // meaning in the css grid spec (negative indexes are negative-1-based + // from the end of the grid decreasing towards the front). + uint32_t lineNumber = isBeforeFirstExplicit ? 0 : + (line1Index - aTrackInfo->mNumLeadingImplicitTracks + numAddedLines); + GridDeclaration lineType = + (isBeforeFirstExplicit || + line1Index > (aTrackInfo->mNumLeadingImplicitTracks + + aTrackInfo->mNumExplicitTracks + 1)) + ? GridDeclaration::Implicit + : GridDeclaration::Explicit; line->SetLineValues( lineNames, nsPresContext::AppUnitsToDoubleCSSPixels(lastTrackEdge), nsPresContext::AppUnitsToDoubleCSSPixels(startOfNextTrack - lastTrackEdge), - line1Index + numAddedLines, - ( - // Implicit if there are no explicit tracks, or if the index - // is before the first explicit track, or after - // a track beyond the last explicit track. - (aTrackInfo->mNumExplicitTracks == 0) || - (i < aTrackInfo->mNumLeadingImplicitTracks) || - (i > aTrackInfo->mNumLeadingImplicitTracks + - aTrackInfo->mNumExplicitTracks) ? - GridDeclaration::Implicit : - GridDeclaration::Explicit - ) + lineNumber, + lineType ); if (i < aTrackInfo->mEndFragmentTrack) { @@ -215,11 +225,13 @@ GridLines::AppendRemovedAutoFits(const ComputedGridTrackInfo* aTrackInfo, RefPtr<GridLine> line = new GridLine(this); mLines.AppendElement(line); + uint32_t lineNumber = aTrackInfo->mRepeatFirstTrack + + aRepeatIndex + 1; line->SetLineValues( aLineNames, nsPresContext::AppUnitsToDoubleCSSPixels(aLastTrackEdge), nsPresContext::AppUnitsToDoubleCSSPixels(0), - aTrackInfo->mRepeatFirstTrack + aRepeatIndex + 1, + lineNumber, GridDeclaration::Explicit ); diff --git a/dom/grid/test/chrome.ini b/dom/grid/test/chrome.ini index 2241cf9eb..169fa9b89 100644 --- a/dom/grid/test/chrome.ini +++ b/dom/grid/test/chrome.ini @@ -2,6 +2,7 @@ [chrome/test_grid_fragmentation.html] [chrome/test_grid_implicit.html] [chrome/test_grid_lines.html] +[chrome/test_grid_line_numbers.html] [chrome/test_grid_object.html] [chrome/test_grid_repeats.html] [chrome/test_grid_tracks.html] diff --git a/dom/grid/test/chrome/test_grid_implicit.html b/dom/grid/test/chrome/test_grid_implicit.html index c7782e0e5..1f7142658 100644 --- a/dom/grid/test/chrome/test_grid_implicit.html +++ b/dom/grid/test/chrome/test_grid_implicit.html @@ -33,6 +33,11 @@ body { grid-template-rows: [areaA-end areaB-start areaC-end] 50px [areaA-start areaB-end areaC-start]; } +.template4 { + grid-template-columns: 100px 50px 100px; + grid-template-rows: 50px; +} + .box { background-color: #444; color: #fff; @@ -50,6 +55,9 @@ body { .d { grid-area: areaD; } +.e { + grid-column: -7 / 5; +} </style> <script> @@ -78,9 +86,12 @@ function runTests() { is(grid.cols.lines[4].type, "implicit", "Grid column line 5 is implicit."); is(grid.cols.lines[5].type, "implicit", "Grid column line 6 is implicit."); - is(grid.rows.lines[0].type, "implicit", "Grid row line 1 is implicit."); - is(grid.rows.lines[1].type, "explicit", "Grid row line 2 is explicit."); - is(grid.rows.lines[3].type, "explicit", "Grid row line 4 is explicit."); + is(grid.rows.lines[0].type, "implicit", "Grid row line 0 is implicit."); + is(grid.rows.lines[0].number, 0, "Grid row line 0 has correct number."); + is(grid.rows.lines[1].type, "explicit", "Grid row line 1 is explicit."); + is(grid.rows.lines[1].number, 1, "Grid row line 1 has correct number."); + is(grid.rows.lines[3].type, "explicit", "Grid row line 3 is explicit."); + is(grid.rows.lines[3].number, 3, "Grid row line 3 has correct number."); // test that row line 1 gets the name forced on it by placement of item B todo_isnot(grid.rows.lines[0].names.indexOf("got-this-name-implicitly"), -1, @@ -221,6 +232,48 @@ function runTests() { } } + // test the fourth grid wrapper + wrapper = document.getElementById("wrapper4"); + grid = wrapper.getGridFragments()[0]; + + // test column and row line counts + is(grid.cols.lines.length, 8, + "Grid.cols.lines property expands properly with implicit columns on both sides." + ); + is(grid.rows.lines.length, 2, + "Grid.rows.lines property is as expected" + ); + + if (grid.cols.lines.length == 8) { + // check that all the lines get correct implict/explicit type and number + let expectedType = [ + "implicit", + "implicit", + "implicit", + "explicit", + "explicit", + "explicit", + "explicit", + "implicit", + ]; + let expectedNumber = [ + 0, + 0, + 0, + 1, + 2, + 3, + 4, + 5, + ]; + + for (let i = 0; i < grid.cols.lines.length; i++) { + let line = grid.cols.lines[i]; + is(line.type, expectedType[i], "Line index " + i + " has expected type."); + is(line.number, expectedNumber[i], "Line index " + i + " has expected number."); + } + } + SimpleTest.finish(); } </script> @@ -246,5 +299,9 @@ function runTests() { <div id="boxC" class="box c">C</div> </div> + <div id="wrapper4" class="wrapper template4"> + <div id="boxE" class="box e">E</div> + </div> + </body> </html> diff --git a/dom/grid/test/chrome/test_grid_line_numbers.html b/dom/grid/test/chrome/test_grid_line_numbers.html new file mode 100644 index 000000000..c8e5226b6 --- /dev/null +++ b/dom/grid/test/chrome/test_grid_line_numbers.html @@ -0,0 +1,101 @@ +<!doctype html> +<html> +<head> +<meta charset="utf-8"> +<script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> +<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" /> +<style> +body { + margin: 40px; +} +.wrapper { + display: grid; + grid-gap: 0px; + background-color: #f00; +} +.wrapper > div { + background-color: #444; + color: #fff; +} +.repeatColumns { + width: 600px; + grid-auto-columns: 50px; + grid-template-columns: repeat(auto-fit, 100px); +} +.repeatRows { + height: 600px; + grid-auto-rows: 50px; + grid-template-rows: repeat(auto-fit, 100px); +} +</style> + +<script> +'use strict'; + +SimpleTest.waitForExplicitFinish(); + +function testLines(elementName, lines, expectedValues) { + is(lines.count, expectedValues.count, elementName + " has expected number of lines."); + for (let i = 0; i < lines.length; i++) { + is(lines[i].number, expectedValues[i].number, elementName + " line index " + i + " has expected number."); + } +} + +function runTests() { + let grid; + let lines; + let expectedValues; + + grid = document.getElementById("gridWithColumns").getGridFragments()[0]; + lines = grid.cols.lines; + expectedValues = [ + { "number": 0 }, + { "number": 0 }, + { "number": 1 }, + { "number": 2 }, + { "number": 3 }, + { "number": 4 }, + { "number": 5 }, + { "number": 6 }, + { "number": 7 }, + { "number": 8 }, + ]; + testLines("gridWithColumns", lines, expectedValues); + + grid = document.getElementById("gridWithRows").getGridFragments()[0]; + lines = grid.rows.lines; + expectedValues = [ + { "number": 0 }, + { "number": 0 }, + { "number": 1 }, + { "number": 2 }, + { "number": 3 }, + { "number": 4 }, + { "number": 5 }, + { "number": 6 }, + { "number": 7 }, + { "number": 8 }, + ]; + testLines("gridWithRows", lines, expectedValues); + + SimpleTest.finish(); +} +</script> +</head> +<body onLoad="runTests();"> + +<div id="gridWithColumns" class="wrapper repeatColumns"> +<div style="grid-column: -9">A</div> +<div style="grid-column: 4">B</div> +<div style="grid-column: 7">C</div> +</div> + +<div id="gridWithRows" class="wrapper repeatRows"> +<div style="grid-row: span 3 / 2">A</div> +<div style="grid-row: 4">B</div> +<div style="grid-row: 5">C</div> +<div style="grid-row: span 2 / 8">D</div> +</div> + +</body> +</html> diff --git a/dom/html/HTMLScriptElement.cpp b/dom/html/HTMLScriptElement.cpp index 94d09c12c..095b9b77d 100644 --- a/dom/html/HTMLScriptElement.cpp +++ b/dom/html/HTMLScriptElement.cpp @@ -218,6 +218,18 @@ HTMLScriptElement::SetAsync(bool aValue, ErrorResult& rv) SetHTMLBoolAttr(nsGkAtoms::async, aValue, rv); } +bool +HTMLScriptElement::NoModule() +{ + return GetBoolAttr(nsGkAtoms::nomodule); +} + +void +HTMLScriptElement::SetNoModule(bool aValue, ErrorResult& aRv) +{ + SetHTMLBoolAttr(nsGkAtoms::nomodule, aValue, aRv); +} + nsresult HTMLScriptElement::AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName, const nsAttrValue* aValue, bool aNotify) diff --git a/dom/html/HTMLScriptElement.h b/dom/html/HTMLScriptElement.h index 00628bd6d..19ceb414f 100644 --- a/dom/html/HTMLScriptElement.h +++ b/dom/html/HTMLScriptElement.h @@ -89,6 +89,8 @@ public: } bool Async(); void SetAsync(bool aValue, ErrorResult& rv); + bool NoModule(); + void SetNoModule(bool aValue, ErrorResult& rv); protected: virtual ~HTMLScriptElement(); diff --git a/dom/html/test/file_script_module.html b/dom/html/test/file_script_module.html new file mode 100644 index 000000000..78c499265 --- /dev/null +++ b/dom/html/test/file_script_module.html @@ -0,0 +1,42 @@ +<html> +<body> + <script> +// Helper methods. +function ok(a, msg) { + parent.postMessage({ check: !!a, msg }, "*") +} + +function is(a, b, msg) { + ok(a === b, msg); +} + +function finish() { + parent.postMessage({ done: true }, "*"); +} + </script> + + <script id="a" nomodule>42</script> + <script id="b">42</script> + <script> +// Let's test the behavior of nomodule attribute and noModule getter/setter. +var a = document.getElementById("a"); +is(a.noModule, true, "HTMLScriptElement with nomodule attribute has noModule set to true"); +a.removeAttribute("nomodule"); +is(a.noModule, false, "HTMLScriptElement without nomodule attribute has noModule set to false"); +a.noModule = true; +ok(a.hasAttribute('nomodule'), "HTMLScriptElement.noModule = true add the nomodule attribute"); + +var b = document.getElementById("b"); +is(b.noModule, false, "HTMLScriptElement without nomodule attribute has noModule set to false"); +b.noModule = true; +ok(b.hasAttribute('nomodule'), "HTMLScriptElement.noModule = true add the nomodule attribute"); + </script> + + <script>var foo = 42;</script> + <script nomodule>foo = 43;</script> + <script> +is(foo, 42, "nomodule HTMLScriptElements should not be executed in modern browsers"); +finish(); + </script> +</body> +</html> diff --git a/dom/html/test/file_script_nomodule.html b/dom/html/test/file_script_nomodule.html new file mode 100644 index 000000000..303edb90b --- /dev/null +++ b/dom/html/test/file_script_nomodule.html @@ -0,0 +1,32 @@ +<html> +<body> + <script> +// Helper methods. +function ok(a, msg) { + parent.postMessage({ check: !!a, msg }, "*") +} + +function is(a, b, msg) { + ok(a === b, msg); +} + +function finish() { + parent.postMessage({ done: true }, "*"); +} + </script> + + <script id="a" nomodule>42</script> + <script> +// Let's test the behavior of nomodule attribute and noModule getter/setter. +var a = document.getElementById("a"); +ok(!("noModule" in a), "When modules are disabled HTMLScriptElement.noModule is not defined"); + </script> + + <script>var foo = 42;</script> + <script nomodule>foo = 43;</script> + <script> +is(foo, 43, "nomodule attribute is ignored when modules are disabled"); +finish(); + </script> +</body> +</html> diff --git a/dom/html/test/mochitest.ini b/dom/html/test/mochitest.ini index 99b425df8..b9da7def8 100644 --- a/dom/html/test/mochitest.ini +++ b/dom/html/test/mochitest.ini @@ -553,7 +553,6 @@ skip-if = true # Disabled for timeouts. [test_viewport.html] [test_documentAll.html] [test_document-element-inserted.html] -[test_document.watch.html] [test_bug445004.html] skip-if = true || toolkit == 'android' # Disabled permanently (bug 559932). [test_bug446483.html] @@ -606,3 +605,7 @@ skip-if = os == "android" # up/down arrow keys not supported on android [test_bug1295719_event_sequence_for_number_keys.html] [test_bug1310865.html] [test_bug1315146.html] +[test_script_module.html] +support-files = + file_script_module.html + file_script_nomodule.html
\ No newline at end of file diff --git a/dom/html/test/test_document.watch.html b/dom/html/test/test_document.watch.html deleted file mode 100644 index 54509823b..000000000 --- a/dom/html/test/test_document.watch.html +++ /dev/null @@ -1,129 +0,0 @@ -<!DOCTYPE html> -<html> -<!-- -https://bugzilla.mozilla.org/show_bug.cgi?id=903332 ---> -<head> - <meta charset="utf-8"> - <title>Test for Bug 903332</title> - <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> - <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> - <script type="application/javascript"> - - /** Test for Bug 903332 **/ - - var watch1Called; - function watch1(prop, oldValue, newValue) - { - is(watch1Called, false, "watch1Called not reset properly?"); - watch1Called = true; - - is(prop, "cookie", "wrong property name passed to watch1"); - return newValue; - } - - var watch2Called; - function watch2(prop, oldValue, newValue) - { - is(watch2Called, false, "watch2Called not reset properly?"); - watch2Called = true; - - is(prop, "cookie", "wrong property name passed to watch2"); - return newValue; - } - - // Just in case subsequent tests depend on a particular value... - var originalValue = document.cookie; - ok(true, "originalValue: " + originalValue); - - var originalPrefix = originalValue.length > 0 ? originalValue + "; " : ""; - - try - { - // trial set (no watch) to verify things work - document.cookie = "first=set"; - is(document.cookie, originalPrefix + "first=set", - "first value correct"); - - // add a watch - document.watch("cookie", watch1); - - // set, check for watch invoked - watch1Called = false; - document.cookie = "second=set"; - is(watch1Called, true, "watch1 function should be called"); - is(document.cookie, originalPrefix + "first=set; second=set", - "second value correct"); - - // and a second time, just in case - watch1Called = false; - document.cookie = "third=set"; - is(watch1Called, true, "watch1 function should be called"); - is(document.cookie, originalPrefix + "first=set; second=set; third=set", - "third value correct"); - - // overwrite the current watch with a new one - document.watch("cookie", watch2); - - // set, check for watch invoked - watch1Called = false; - watch2Called = false; - document.cookie = "fourth=set"; - is(watch1Called, false, "watch1 invoked erroneously"); - is(watch2Called, true, "watch2 function should be called"); - is(document.cookie, originalPrefix + "first=set; second=set; third=set; fourth=set", - "fourth value correct"); - - // and a second time, just in case - watch1Called = false; - watch2Called = false; - document.cookie = "fifth=set"; - is(watch1Called, false, "watch1 invoked erroneously"); - is(watch2Called, true, "watch2 function should be called"); - is(document.cookie, originalPrefix + "first=set; second=set; third=set; fourth=set; fifth=set", - "fifth value correct"); - - // remove the watch - document.unwatch("cookie"); - - // check for non-invocation now - watch1Called = false; - watch2Called = false; - document.cookie = "sixth=set"; - is(watch1Called, false, "watch1 shouldn't be called"); - is(watch2Called, false, "watch2 shouldn't be called"); - is(document.cookie, originalPrefix + "first=set; second=set; third=set; fourth=set; fifth=set; sixth=set", - "sixth value correct"); - } - finally - { - // reset - document.unwatch("cookie"); // harmless, should be no-op except if bugs - - var d = new Date(); - d.setTime(0); - var suffix = "=; expires=" + d.toGMTString(); - - document.cookie = "first" + suffix; - document.cookie = "second" + suffix; - document.cookie = "third" + suffix; - document.cookie = "fourth" + suffix; - document.cookie = "fifth" + suffix; - document.cookie = "sixth" + suffix; - } - - is(document.cookie, originalValue, - "document.cookie isn't what it was initially! expect bustage further " + - "down the line"); - </script> -</head> -<body> -<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=903332">Mozilla Bug 903332</a> -<p id="display"></p> -<div id="content" style="display: none"> - -</div> -<pre id="test"> -</pre> -</body> -</html> diff --git a/dom/html/test/test_script_module.html b/dom/html/test/test_script_module.html new file mode 100644 index 000000000..4878bb379 --- /dev/null +++ b/dom/html/test/test_script_module.html @@ -0,0 +1,56 @@ +<!DOCTYPE HTML> +<html> +<head> + <title>Test for HTMLScriptElement with nomodule attribute</title> + <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> +</head> + +<body> + <script> +onmessage = (e) => { + if ("done" in e.data) { + next(); + } else if ("check" in e.data) { + ok(e.data.check, e.data.msg); + } else { + ok(false, "Unknown message"); + } +} + +var tests = [ + function() { + SpecialPowers.pushPrefEnv({"set":[["dom.moduleScripts.enabled", true]]}) + .then(() => { + var ifr = document.createElement('iframe'); + ifr.src = "file_script_module.html"; + document.body.appendChild(ifr); + }); + }, + + function() { + SpecialPowers.pushPrefEnv({"set":[["dom.moduleScripts.enabled", false]]}) + .then(() => { + var ifr = document.createElement('iframe'); + ifr.src = "file_script_nomodule.html"; + document.body.appendChild(ifr); + }); + }, +]; + +SimpleTest.waitForExplicitFinish(); +next(); + +function next() { + if (!tests.length) { + SimpleTest.finish(); + return; + } + + var test = tests.shift(); + test(); +} + </script> + +</body> +</html> diff --git a/dom/indexedDB/ActorsParent.cpp b/dom/indexedDB/ActorsParent.cpp index cd998c31c..74afef452 100644 --- a/dom/indexedDB/ActorsParent.cpp +++ b/dom/indexedDB/ActorsParent.cpp @@ -4427,18 +4427,6 @@ CreateStorageConnection(nsIFile* aDBFile, nsresult rv; bool exists; - if (IndexedDatabaseManager::InLowDiskSpaceMode()) { - rv = aDBFile->Exists(&exists); - if (NS_WARN_IF(NS_FAILED(rv))) { - return rv; - } - - if (!exists) { - NS_WARNING("Refusing to create database because disk space is low!"); - return NS_ERROR_DOM_INDEXEDDB_QUOTA_ERR; - } - } - nsCOMPtr<nsIFileURL> dbFileUrl; rv = GetDatabaseFileURL(aDBFile, aPersistenceType, @@ -19103,23 +19091,6 @@ DatabaseMaintenance::DetermineMaintenanceAction( return NS_OK; } - bool lowDiskSpace = IndexedDatabaseManager::InLowDiskSpaceMode(); - - if (QuotaManager::IsRunningXPCShellTests()) { - // If we're running XPCShell then we want to test both the low disk space - // and normal disk space code paths so pick semi-randomly based on the - // current time. - lowDiskSpace = ((PR_Now() / PR_USEC_PER_MSEC) % 2) == 0; - } - - // If we're low on disk space then the best we can hope for is that an - // incremental vacuum might free some space. That is a journaled operation so - // it may not be possible even then. - if (lowDiskSpace) { - *aMaintenanceAction = MaintenanceAction::IncrementalVacuum; - return NS_OK; - } - // This method shouldn't make any permanent changes to the database, so make // sure everything gets rolled back when we leave. mozStorageTransaction transaction(aConnection, @@ -24233,11 +24204,6 @@ CreateFileOp::DoDatabaseWork() "CreateFileOp::DoDatabaseWork", js::ProfileEntry::Category::STORAGE); - if (NS_WARN_IF(IndexedDatabaseManager::InLowDiskSpaceMode())) { - NS_WARNING("Refusing to create file because disk space is low!"); - return NS_ERROR_DOM_INDEXEDDB_QUOTA_ERR; - } - if (NS_WARN_IF(QuotaManager::IsShuttingDown()) || !OperationMayProceed()) { IDB_REPORT_INTERNAL_ERR(); return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR; @@ -24378,10 +24344,6 @@ CreateObjectStoreOp::DoDatabaseWork(DatabaseConnection* aConnection) "CreateObjectStoreOp::DoDatabaseWork", js::ProfileEntry::Category::STORAGE); - if (NS_WARN_IF(IndexedDatabaseManager::InLowDiskSpaceMode())) { - return NS_ERROR_DOM_INDEXEDDB_QUOTA_ERR; - } - #ifdef DEBUG { // Make sure that we're not creating an object store with the same name as @@ -24705,10 +24667,6 @@ RenameObjectStoreOp::DoDatabaseWork(DatabaseConnection* aConnection) "RenameObjectStoreOp::DoDatabaseWork", js::ProfileEntry::Category::STORAGE); - if (NS_WARN_IF(IndexedDatabaseManager::InLowDiskSpaceMode())) { - return NS_ERROR_DOM_INDEXEDDB_QUOTA_ERR; - } - #ifdef DEBUG { // Make sure that we're not renaming an object store with the same name as @@ -24798,7 +24756,6 @@ CreateIndexOp::InsertDataFromObjectStore(DatabaseConnection* aConnection) { MOZ_ASSERT(aConnection); aConnection->AssertIsOnConnectionThread(); - MOZ_ASSERT(!IndexedDatabaseManager::InLowDiskSpaceMode()); MOZ_ASSERT(mMaybeUniqueIndexTable); PROFILER_LABEL("IndexedDB", @@ -24849,7 +24806,6 @@ CreateIndexOp::InsertDataFromObjectStoreInternal( { MOZ_ASSERT(aConnection); aConnection->AssertIsOnConnectionThread(); - MOZ_ASSERT(!IndexedDatabaseManager::InLowDiskSpaceMode()); MOZ_ASSERT(mMaybeUniqueIndexTable); DebugOnly<void*> storageConnection = aConnection->GetStorageConnection(); @@ -24926,10 +24882,6 @@ CreateIndexOp::DoDatabaseWork(DatabaseConnection* aConnection) "CreateIndexOp::DoDatabaseWork", js::ProfileEntry::Category::STORAGE); - if (NS_WARN_IF(IndexedDatabaseManager::InLowDiskSpaceMode())) { - return NS_ERROR_DOM_INDEXEDDB_QUOTA_ERR; - } - #ifdef DEBUG { // Make sure that we're not creating an index with the same name and object @@ -25806,10 +25758,6 @@ RenameIndexOp::DoDatabaseWork(DatabaseConnection* aConnection) "RenameIndexOp::DoDatabaseWork", js::ProfileEntry::Category::STORAGE); - if (NS_WARN_IF(IndexedDatabaseManager::InLowDiskSpaceMode())) { - return NS_ERROR_DOM_INDEXEDDB_QUOTA_ERR; - } - #ifdef DEBUG { // Make sure that we're not renaming an index with the same name as another @@ -26294,10 +26242,6 @@ ObjectStoreAddOrPutRequestOp::DoDatabaseWork(DatabaseConnection* aConnection) "ObjectStoreAddOrPutRequestOp::DoDatabaseWork", js::ProfileEntry::Category::STORAGE); - if (NS_WARN_IF(IndexedDatabaseManager::InLowDiskSpaceMode())) { - return NS_ERROR_DOM_INDEXEDDB_QUOTA_ERR; - } - DatabaseConnection::AutoSavepoint autoSave; nsresult rv = autoSave.Start(Transaction()); if (NS_WARN_IF(NS_FAILED(rv))) { diff --git a/dom/indexedDB/IndexedDatabaseManager.cpp b/dom/indexedDB/IndexedDatabaseManager.cpp index 62ba51c08..213de5cc9 100644 --- a/dom/indexedDB/IndexedDatabaseManager.cpp +++ b/dom/indexedDB/IndexedDatabaseManager.cpp @@ -8,11 +8,9 @@ #include "chrome/common/ipc_channel.h" // for IPC::Channel::kMaximumMessageSize #include "nsIConsoleService.h" -#include "nsIDiskSpaceWatcher.h" #include "nsIDOMWindow.h" #include "nsIEventTarget.h" #include "nsIFile.h" -#include "nsIObserverService.h" #include "nsIScriptError.h" #include "nsIScriptGlobalObject.h" @@ -64,11 +62,6 @@ #define IDB_STR "indexedDB" -// The two possible values for the data argument when receiving the disk space -// observer notification. -#define LOW_DISK_SPACE_DATA_FULL "full" -#define LOW_DISK_SPACE_DATA_FREE "free" - namespace mozilla { namespace dom { namespace indexedDB { @@ -313,8 +306,6 @@ Atomic<IndexedDatabaseManager::LoggingMode> IndexedDatabaseManager::sLoggingMode( IndexedDatabaseManager::Logging_Disabled); -mozilla::Atomic<bool> IndexedDatabaseManager::sLowDiskSpaceMode(false); - // static IndexedDatabaseManager* IndexedDatabaseManager::GetOrCreate() @@ -329,24 +320,6 @@ IndexedDatabaseManager::GetOrCreate() if (!gDBManager) { sIsMainProcess = XRE_IsParentProcess(); - if (sIsMainProcess && Preferences::GetBool("disk_space_watcher.enabled", false)) { - // See if we're starting up in low disk space conditions. - nsCOMPtr<nsIDiskSpaceWatcher> watcher = - do_GetService(DISKSPACEWATCHER_CONTRACTID); - if (watcher) { - bool isDiskFull; - if (NS_SUCCEEDED(watcher->GetIsDiskFull(&isDiskFull))) { - sLowDiskSpaceMode = isDiskFull; - } - else { - NS_WARNING("GetIsDiskFull failed!"); - } - } - else { - NS_WARNING("No disk space watcher component available!"); - } - } - RefPtr<IndexedDatabaseManager> instance(new IndexedDatabaseManager()); nsresult rv = instance->Init(); @@ -380,13 +353,6 @@ IndexedDatabaseManager::Init() // During Init() we can't yet call IsMainProcess(), just check sIsMainProcess // directly. if (sIsMainProcess) { - nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService(); - NS_ENSURE_STATE(obs); - - nsresult rv = - obs->AddObserver(this, DISKSPACEWATCHER_OBSERVER_TOPIC, false); - NS_ENSURE_SUCCESS(rv, rv); - mDeleteTimer = do_CreateInstance(NS_TIMER_CONTRACTID); NS_ENSURE_STATE(mDeleteTimer); @@ -680,16 +646,6 @@ IndexedDatabaseManager::IsMainProcess() return sIsMainProcess; } -//static -bool -IndexedDatabaseManager::InLowDiskSpaceMode() -{ - NS_ASSERTION(gDBManager, - "InLowDiskSpaceMode() called before indexedDB has been " - "initialized!"); - return sLowDiskSpaceMode; -} - // static IndexedDatabaseManager::LoggingMode IndexedDatabaseManager::GetLoggingMode() @@ -1087,36 +1043,7 @@ IndexedDatabaseManager::GetLocale() NS_IMPL_ADDREF(IndexedDatabaseManager) NS_IMPL_RELEASE_WITH_DESTROY(IndexedDatabaseManager, Destroy()) -NS_IMPL_QUERY_INTERFACE(IndexedDatabaseManager, nsIObserver, nsITimerCallback) - -NS_IMETHODIMP -IndexedDatabaseManager::Observe(nsISupports* aSubject, const char* aTopic, - const char16_t* aData) -{ - NS_ASSERTION(IsMainProcess(), "Wrong process!"); - NS_ASSERTION(NS_IsMainThread(), "Wrong thread!"); - - if (!strcmp(aTopic, DISKSPACEWATCHER_OBSERVER_TOPIC)) { - NS_ASSERTION(aData, "No data?!"); - - const nsDependentString data(aData); - - if (data.EqualsLiteral(LOW_DISK_SPACE_DATA_FULL)) { - sLowDiskSpaceMode = true; - } - else if (data.EqualsLiteral(LOW_DISK_SPACE_DATA_FREE)) { - sLowDiskSpaceMode = false; - } - else { - NS_NOTREACHED("Unknown data value!"); - } - - return NS_OK; - } - - NS_NOTREACHED("Unknown topic!"); - return NS_ERROR_UNEXPECTED; -} +NS_IMPL_QUERY_INTERFACE(IndexedDatabaseManager, nsITimerCallback) NS_IMETHODIMP IndexedDatabaseManager::Notify(nsITimer* aTimer) diff --git a/dom/indexedDB/IndexedDatabaseManager.h b/dom/indexedDB/IndexedDatabaseManager.h index d63c548ec..fb4376426 100644 --- a/dom/indexedDB/IndexedDatabaseManager.h +++ b/dom/indexedDB/IndexedDatabaseManager.h @@ -7,8 +7,6 @@ #ifndef mozilla_dom_indexeddatabasemanager_h__ #define mozilla_dom_indexeddatabasemanager_h__ -#include "nsIObserver.h" - #include "js/TypeDecls.h" #include "mozilla/Atomics.h" #include "mozilla/dom/quota/PersistenceType.h" @@ -43,8 +41,7 @@ class FileManagerInfo; } // namespace indexedDB class IndexedDatabaseManager final - : public nsIObserver - , public nsITimerCallback + : public nsITimerCallback { typedef mozilla::dom::quota::PersistenceType PersistenceType; typedef mozilla::dom::quota::QuotaManager QuotaManager; @@ -62,7 +59,6 @@ public: }; NS_DECL_ISUPPORTS - NS_DECL_NSIOBSERVER NS_DECL_NSITIMERCALLBACK // Returns a non-owning reference. @@ -87,16 +83,6 @@ public: #endif static bool - InLowDiskSpaceMode() -#ifdef DEBUG - ; -#else - { - return !!sLowDiskSpaceMode; - } -#endif - - static bool InTestingMode(); static bool @@ -244,7 +230,6 @@ private: static bool sFullSynchronousMode; static LazyLogModule sLoggingModule; static Atomic<LoggingMode> sLoggingMode; - static mozilla::Atomic<bool> sLowDiskSpaceMode; }; } // namespace dom diff --git a/dom/indexedDB/crashtests/1558522-1.html b/dom/indexedDB/crashtests/1558522-1.html new file mode 100644 index 000000000..47dd2f843 --- /dev/null +++ b/dom/indexedDB/crashtests/1558522-1.html @@ -0,0 +1,40 @@ +<html>
+<head>
+ <script id='worker' type='javascript/worker'>
+ onmessage = function (e) {
+ const file = e.data[0]
+ const db = indexedDB.open('', {})
+ db.onupgradeneeded = function (event) {
+ const store = event.target.result.createObjectStore('IDBStore_0', {})
+ store.add({}, '')
+ }
+ db.onsuccess = function (event) {
+ const transaction = event.target.result.transaction('IDBStore_0', 'readwrite')
+ const store = transaction.objectStore('IDBStore_0')
+ const cursor = store.openCursor()
+ cursor.onsuccess = function (event) {
+ event.target.result.update({
+ data: file
+ })
+ event.target.result.advance(1)
+ }
+
+ event.target.result.close()
+ }
+ }
+
+ </script>
+ <script>
+ let worker;
+
+ function start () {
+ const file = new File([], 'x')
+ const blob = new Blob([document.getElementById('worker').textContent], { type: 'text/javascript' })
+ worker = new Worker(window.URL.createObjectURL(blob))
+ worker.postMessage([file], [])
+ }
+
+ document.addEventListener('DOMContentLoaded', start)
+ </script>
+</head>
+</html>
\ No newline at end of file diff --git a/dom/indexedDB/crashtests/crashtests.list b/dom/indexedDB/crashtests/crashtests.list index 69f5dab0b..ead6024dc 100644 --- a/dom/indexedDB/crashtests/crashtests.list +++ b/dom/indexedDB/crashtests/crashtests.list @@ -1 +1,2 @@ load 726376-1.html +load 1558522-1.html diff --git a/dom/indexedDB/test/helpers.js b/dom/indexedDB/test/helpers.js index e6e27f3f3..ffe66ebcd 100644 --- a/dom/indexedDB/test/helpers.js +++ b/dom/indexedDB/test/helpers.js @@ -217,10 +217,6 @@ if (!window.runTest) { function finishTest() { - SpecialPowers.notifyObserversInParentProcess(null, - "disk-space-watcher", - "free"); - SimpleTest.executeSoon(function() { testGenerator.close(); testHarnessGenerator.close(); diff --git a/dom/indexedDB/test/mochitest.ini b/dom/indexedDB/test/mochitest.ini index 4ab55a9dc..ca65ea8b6 100644 --- a/dom/indexedDB/test/mochitest.ini +++ b/dom/indexedDB/test/mochitest.ini @@ -66,7 +66,6 @@ support-files = unit/test_locale_aware_indexes.js unit/test_locale_aware_index_getAll.js unit/test_locale_aware_index_getAllObjects.js - unit/test_lowDiskSpace.js unit/test_maximal_serialized_object_size.js unit/test_multientry.js unit/test_names_sorted.js @@ -214,7 +213,6 @@ skip-if = true [test_key_requirements.html] [test_keys.html] [test_leaving_page.html] -[test_lowDiskSpace.html] [test_maximal_serialized_object_size.html] [test_message_manager_ipc.html] # This test is only supposed to run in the main process. diff --git a/dom/indexedDB/test/test_lowDiskSpace.html b/dom/indexedDB/test/test_lowDiskSpace.html deleted file mode 100644 index cffd46549..000000000 --- a/dom/indexedDB/test/test_lowDiskSpace.html +++ /dev/null @@ -1,19 +0,0 @@ -<!-- - Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ ---> -<html> -<head> - <title>Indexed Database Low Disk Space Test</title> - - <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> - <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> - - <script type="text/javascript;version=1.7" src="unit/test_lowDiskSpace.js"></script> - <script type="text/javascript;version=1.7" src="helpers.js"></script> - -</head> - -<body onload="runTest();"></body> - -</html> diff --git a/dom/indexedDB/test/unit/test_lowDiskSpace.js b/dom/indexedDB/test/unit/test_lowDiskSpace.js deleted file mode 100644 index eaea5797d..000000000 --- a/dom/indexedDB/test/unit/test_lowDiskSpace.js +++ /dev/null @@ -1,754 +0,0 @@ -/** - * Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ - */ -"use strict"; - -var disableWorkerTest = "This test uses SpecialPowers"; - -var self = this; - -var testGenerator = testSteps(); - -function testSteps() -{ - const dbName = self.window ? window.location.pathname : "test_lowDiskSpace"; - const dbVersion = 1; - - const objectStoreName = "foo"; - const objectStoreOptions = { keyPath: "foo" }; - - const indexName = "bar"; - const indexOptions = { unique: true }; - - const dbData = [ - { foo: 0, bar: 0 }, - { foo: 1, bar: 10 }, - { foo: 2, bar: 20 }, - { foo: 3, bar: 30 }, - { foo: 4, bar: 40 }, - { foo: 5, bar: 50 }, - { foo: 6, bar: 60 }, - { foo: 7, bar: 70 }, - { foo: 8, bar: 80 }, - { foo: 9, bar: 90 } - ]; - - let lowDiskMode = false; - function setLowDiskMode(val) { - let data = val ? "full" : "free"; - - if (val == lowDiskMode) { - info("Low disk mode is: " + data); - } - else { - info("Changing low disk mode to: " + data); - SpecialPowers.notifyObserversInParentProcess(null, "disk-space-watcher", - data); - lowDiskMode = val; - } - } - - { // Make sure opening works from the beginning. - info("Test 1"); - - setLowDiskMode(false); - - let request = indexedDB.open(dbName, dbVersion); - request.onerror = errorHandler; - request.onsuccess = grabEventAndContinueHandler; - let event = yield undefined; - - is(event.type, "success", "Opened database without setting low disk mode"); - - let db = event.target.result; - db.close(); - } - - { // Make sure delete works in low disk mode. - info("Test 2"); - - setLowDiskMode(true); - - let request = indexedDB.deleteDatabase(dbName); - request.onerror = errorHandler; - request.onsuccess = grabEventAndContinueHandler; - let event = yield undefined; - - is(event.type, "success", "Deleted database after setting low disk mode"); - } - - { // Make sure creating a db in low disk mode fails. - info("Test 3"); - - setLowDiskMode(true); - - let request = indexedDB.open(dbName, dbVersion); - request.onerror = expectedErrorHandler("QuotaExceededError"); - request.onupgradeneeded = unexpectedSuccessHandler; - request.onsuccess = unexpectedSuccessHandler; - let event = yield undefined; - - is(event.type, "error", "Didn't create new database in low disk mode"); - } - - { // Make sure opening an already-existing db in low disk mode succeeds. - info("Test 4"); - - setLowDiskMode(false); - - let request = indexedDB.open(dbName, dbVersion); - request.onerror = errorHandler; - request.onupgradeneeded = grabEventAndContinueHandler; - request.onsuccess = unexpectedSuccessHandler; - let event = yield undefined; - - is(event.type, "upgradeneeded", "Upgrading database"); - - let db = event.target.result; - db.onerror = errorHandler; - - request.onupgradeneeded = unexpectedSuccessHandler; - request.onsuccess = grabEventAndContinueHandler; - event = yield undefined; - - is(event.type, "success", "Created database"); - ok(event.target.result === db, "Got the same database"); - - db.close(); - - setLowDiskMode(true); - - request = indexedDB.open(dbName); - request.onerror = errorHandler; - request.onupgradeneeded = unexpectedSuccessHandler; - request.onsuccess = grabEventAndContinueHandler; - event = yield undefined; - - is(event.type, "success", "Opened existing database in low disk mode"); - - db = event.target.result; - db.close(); - } - - { // Make sure upgrading an already-existing db in low disk mode succeeds. - info("Test 5"); - - setLowDiskMode(true); - - let request = indexedDB.open(dbName, dbVersion + 1); - request.onerror = errorHandler; - request.onupgradeneeded = grabEventAndContinueHandler; - request.onsuccess = unexpectedSuccessHandler; - - let event = yield undefined; - - is(event.type, "upgradeneeded", "Upgrading database"); - - let db = event.target.result; - db.onerror = errorHandler; - - request.onupgradeneeded = unexpectedSuccessHandler; - request.onsuccess = grabEventAndContinueHandler; - event = yield undefined; - - is(event.type, "success", "Created database"); - ok(event.target.result === db, "Got the same database"); - - db.close(); - } - - { // Make sure creating objectStores in low disk mode fails. - info("Test 6"); - - setLowDiskMode(true); - - let request = indexedDB.open(dbName, dbVersion + 2); - request.onerror = errorHandler; - request.onupgradeneeded = grabEventAndContinueHandler; - request.onsuccess = unexpectedSuccessHandler; - - let event = yield undefined; - - is(event.type, "upgradeneeded", "Upgrading database"); - - let db = event.target.result; - db.onerror = errorHandler; - - let txn = event.target.transaction; - txn.onerror = expectedErrorHandler("AbortError"); - txn.onabort = grabEventAndContinueHandler; - - let objectStore = db.createObjectStore(objectStoreName, objectStoreOptions); - - request.onupgradeneeded = unexpectedSuccessHandler; - event = yield undefined; - - is(event.type, "abort", "Got correct event type"); - is(event.target.error.name, "QuotaExceededError", "Got correct error type"); - - request.onerror = expectedErrorHandler("AbortError"); - event = yield undefined; - } - - { // Make sure creating indexes in low disk mode fails. - info("Test 7"); - - setLowDiskMode(false); - - let request = indexedDB.open(dbName, dbVersion + 2); - request.onerror = errorHandler; - request.onupgradeneeded = grabEventAndContinueHandler; - request.onsuccess = unexpectedSuccessHandler; - - let event = yield undefined; - - is(event.type, "upgradeneeded", "Upgrading database"); - - let db = event.target.result; - db.onerror = errorHandler; - - let objectStore = db.createObjectStore(objectStoreName, objectStoreOptions); - - request.onupgradeneeded = unexpectedSuccessHandler; - request.onsuccess = grabEventAndContinueHandler; - event = yield undefined; - - is(event.type, "success", "Upgraded database"); - ok(event.target.result === db, "Got the same database"); - - db.close(); - - setLowDiskMode(true); - - request = indexedDB.open(dbName, dbVersion + 3); - request.onerror = errorHandler; - request.onupgradeneeded = grabEventAndContinueHandler; - request.onsuccess = unexpectedSuccessHandler; - event = yield undefined; - - is(event.type, "upgradeneeded", "Upgrading database"); - - db = event.target.result; - db.onerror = errorHandler; - let txn = event.target.transaction; - txn.onerror = expectedErrorHandler("AbortError"); - txn.onabort = grabEventAndContinueHandler; - - objectStore = event.target.transaction.objectStore(objectStoreName); - let index = objectStore.createIndex(indexName, indexName, indexOptions); - - request.onupgradeneeded = unexpectedSuccessHandler; - event = yield undefined; - - is(event.type, "abort", "Got correct event type"); - is(event.target.error.name, "QuotaExceededError", "Got correct error type"); - - request.onerror = expectedErrorHandler("AbortError"); - event = yield undefined; - } - - { // Make sure deleting indexes in low disk mode succeeds. - info("Test 8"); - - setLowDiskMode(false); - - let request = indexedDB.open(dbName, dbVersion + 3); - request.onerror = errorHandler; - request.onupgradeneeded = grabEventAndContinueHandler; - request.onsuccess = unexpectedSuccessHandler; - - let event = yield undefined; - - is(event.type, "upgradeneeded", "Upgrading database"); - - let db = event.target.result; - db.onerror = errorHandler; - - let objectStore = event.target.transaction.objectStore(objectStoreName); - let index = objectStore.createIndex(indexName, indexName, indexOptions); - - request.onupgradeneeded = unexpectedSuccessHandler; - request.onsuccess = grabEventAndContinueHandler; - event = yield undefined; - - is(event.type, "success", "Upgraded database"); - ok(event.target.result === db, "Got the same database"); - - db.close(); - - setLowDiskMode(true); - - request = indexedDB.open(dbName, dbVersion + 4); - request.onerror = errorHandler; - request.onupgradeneeded = grabEventAndContinueHandler; - request.onsuccess = unexpectedSuccessHandler; - event = yield undefined; - - is(event.type, "upgradeneeded", "Upgrading database"); - - db = event.target.result; - db.onerror = errorHandler; - - objectStore = event.target.transaction.objectStore(objectStoreName); - objectStore.deleteIndex(indexName); - - request.onupgradeneeded = unexpectedSuccessHandler; - request.onsuccess = grabEventAndContinueHandler; - event = yield undefined; - - is(event.type, "success", "Upgraded database"); - ok(event.target.result === db, "Got the same database"); - - db.close(); - } - - { // Make sure deleting objectStores in low disk mode succeeds. - info("Test 9"); - - setLowDiskMode(true); - - let request = indexedDB.open(dbName, dbVersion + 5); - request.onerror = errorHandler; - request.onupgradeneeded = grabEventAndContinueHandler; - request.onsuccess = unexpectedSuccessHandler; - - let event = yield undefined; - - is(event.type, "upgradeneeded", "Upgrading database"); - - let db = event.target.result; - db.onerror = errorHandler; - - db.deleteObjectStore(objectStoreName); - - request.onupgradeneeded = unexpectedSuccessHandler; - request.onsuccess = grabEventAndContinueHandler; - event = yield undefined; - - is(event.type, "success", "Upgraded database"); - ok(event.target.result === db, "Got the same database"); - - db.close(); - - // Reset everything. - indexedDB.deleteDatabase(dbName); - } - - - { // Add data that the rest of the tests will use. - info("Adding test data"); - - setLowDiskMode(false); - - let request = indexedDB.open(dbName, dbVersion); - request.onerror = errorHandler; - request.onupgradeneeded = grabEventAndContinueHandler; - request.onsuccess = unexpectedSuccessHandler; - let event = yield undefined; - - is(event.type, "upgradeneeded", "Upgrading database"); - - let db = event.target.result; - db.onerror = errorHandler; - - let objectStore = db.createObjectStore(objectStoreName, objectStoreOptions); - let index = objectStore.createIndex(indexName, indexName, indexOptions); - - for (let data of dbData) { - objectStore.add(data); - } - - request.onupgradeneeded = unexpectedSuccessHandler; - request.onsuccess = grabEventAndContinueHandler; - event = yield undefined; - - is(event.type, "success", "Upgraded database"); - ok(event.target.result === db, "Got the same database"); - - db.close(); - } - - { // Make sure read operations in readonly transactions succeed in low disk - // mode. - info("Test 10"); - - setLowDiskMode(true); - - let request = indexedDB.open(dbName, dbVersion); - request.onerror = errorHandler; - request.onupgradeneeded = unexpectedSuccessHandler; - request.onsuccess = grabEventAndContinueHandler; - let event = yield undefined; - - let db = event.target.result; - db.onerror = errorHandler; - - let transaction = db.transaction(objectStoreName); - let objectStore = transaction.objectStore(objectStoreName); - let index = objectStore.index(indexName); - - let data = dbData[0]; - - let requestCounter = new RequestCounter(); - - objectStore.get(data.foo).onsuccess = requestCounter.handler(); - objectStore.mozGetAll().onsuccess = requestCounter.handler(); - objectStore.count().onsuccess = requestCounter.handler(); - index.get(data.bar).onsuccess = requestCounter.handler(); - index.mozGetAll().onsuccess = requestCounter.handler(); - index.getKey(data.bar).onsuccess = requestCounter.handler(); - index.mozGetAllKeys().onsuccess = requestCounter.handler(); - index.count().onsuccess = requestCounter.handler(); - - let objectStoreDataCount = 0; - - request = objectStore.openCursor(); - request.onsuccess = function(event) { - let cursor = event.target.result; - if (cursor) { - objectStoreDataCount++; - objectStoreDataCount % 2 ? cursor.continue() : cursor.advance(1); - } - else { - is(objectStoreDataCount, dbData.length, "Saw all data"); - requestCounter.decr(); - } - }; - requestCounter.incr(); - - let indexDataCount = 0; - - request = index.openCursor(); - request.onsuccess = function(event) { - let cursor = event.target.result; - if (cursor) { - indexDataCount++; - indexDataCount % 2 ? cursor.continue() : cursor.advance(1); - } - else { - is(indexDataCount, dbData.length, "Saw all data"); - requestCounter.decr(); - } - }; - requestCounter.incr(); - - let indexKeyDataCount = 0; - - request = index.openCursor(); - request.onsuccess = function(event) { - let cursor = event.target.result; - if (cursor) { - indexKeyDataCount++; - indexKeyDataCount % 2 ? cursor.continue() : cursor.advance(1); - } - else { - is(indexKeyDataCount, dbData.length, "Saw all data"); - requestCounter.decr(); - } - }; - requestCounter.incr(); - - // Wait for all requests. - yield undefined; - - transaction.oncomplete = grabEventAndContinueHandler; - event = yield undefined; - - is(event.type, "complete", "Transaction succeeded"); - - db.close(); - } - - { // Make sure read operations in readwrite transactions succeed in low disk - // mode. - info("Test 11"); - - setLowDiskMode(true); - - let request = indexedDB.open(dbName, dbVersion); - request.onerror = errorHandler; - request.onupgradeneeded = unexpectedSuccessHandler; - request.onsuccess = grabEventAndContinueHandler; - let event = yield undefined; - - let db = event.target.result; - db.onerror = errorHandler; - - let transaction = db.transaction(objectStoreName, "readwrite"); - let objectStore = transaction.objectStore(objectStoreName); - let index = objectStore.index(indexName); - - let data = dbData[0]; - - let requestCounter = new RequestCounter(); - - objectStore.get(data.foo).onsuccess = requestCounter.handler(); - objectStore.mozGetAll().onsuccess = requestCounter.handler(); - objectStore.count().onsuccess = requestCounter.handler(); - index.get(data.bar).onsuccess = requestCounter.handler(); - index.mozGetAll().onsuccess = requestCounter.handler(); - index.getKey(data.bar).onsuccess = requestCounter.handler(); - index.mozGetAllKeys().onsuccess = requestCounter.handler(); - index.count().onsuccess = requestCounter.handler(); - - let objectStoreDataCount = 0; - - request = objectStore.openCursor(); - request.onsuccess = function(event) { - let cursor = event.target.result; - if (cursor) { - objectStoreDataCount++; - objectStoreDataCount % 2 ? cursor.continue() : cursor.advance(1); - } - else { - is(objectStoreDataCount, dbData.length, "Saw all data"); - requestCounter.decr(); - } - }; - requestCounter.incr(); - - let indexDataCount = 0; - - request = index.openCursor(); - request.onsuccess = function(event) { - let cursor = event.target.result; - if (cursor) { - indexDataCount++; - indexDataCount % 2 ? cursor.continue() : cursor.advance(1); - } - else { - is(indexDataCount, dbData.length, "Saw all data"); - requestCounter.decr(); - } - }; - requestCounter.incr(); - - let indexKeyDataCount = 0; - - request = index.openCursor(); - request.onsuccess = function(event) { - let cursor = event.target.result; - if (cursor) { - indexKeyDataCount++; - indexKeyDataCount % 2 ? cursor.continue() : cursor.advance(1); - } - else { - is(indexKeyDataCount, dbData.length, "Saw all data"); - requestCounter.decr(); - } - }; - requestCounter.incr(); - - // Wait for all requests. - yield undefined; - - transaction.oncomplete = grabEventAndContinueHandler; - event = yield undefined; - - is(event.type, "complete", "Transaction succeeded"); - - db.close(); - } - - { // Make sure write operations in readwrite transactions fail in low disk - // mode. - info("Test 12"); - - setLowDiskMode(true); - - let request = indexedDB.open(dbName, dbVersion); - request.onerror = errorHandler; - request.onupgradeneeded = unexpectedSuccessHandler; - request.onsuccess = grabEventAndContinueHandler; - let event = yield undefined; - - let db = event.target.result; - db.onerror = errorHandler; - - let transaction = db.transaction(objectStoreName, "readwrite"); - let objectStore = transaction.objectStore(objectStoreName); - let index = objectStore.index(indexName); - - let data = dbData[0]; - let newData = { foo: 999, bar: 999 }; - - let requestCounter = new RequestCounter(); - - objectStore.add(newData).onerror = requestCounter.errorHandler(); - objectStore.put(newData).onerror = requestCounter.errorHandler(); - - objectStore.get(data.foo).onsuccess = requestCounter.handler(); - objectStore.mozGetAll().onsuccess = requestCounter.handler(); - objectStore.count().onsuccess = requestCounter.handler(); - index.get(data.bar).onsuccess = requestCounter.handler(); - index.mozGetAll().onsuccess = requestCounter.handler(); - index.getKey(data.bar).onsuccess = requestCounter.handler(); - index.mozGetAllKeys().onsuccess = requestCounter.handler(); - index.count().onsuccess = requestCounter.handler(); - - let objectStoreDataCount = 0; - - request = objectStore.openCursor(); - request.onsuccess = function(event) { - let cursor = event.target.result; - if (cursor) { - objectStoreDataCount++; - cursor.update(cursor.value).onerror = requestCounter.errorHandler(); - objectStoreDataCount % 2 ? cursor.continue() : cursor.advance(1); - } - else { - is(objectStoreDataCount, dbData.length, "Saw all data"); - requestCounter.decr(); - } - }; - requestCounter.incr(); - - let indexDataCount = 0; - - request = index.openCursor(); - request.onsuccess = function(event) { - let cursor = event.target.result; - if (cursor) { - indexDataCount++; - cursor.update(cursor.value).onerror = requestCounter.errorHandler(); - indexDataCount % 2 ? cursor.continue() : cursor.advance(1); - } - else { - is(indexDataCount, dbData.length, "Saw all data"); - requestCounter.decr(); - } - }; - requestCounter.incr(); - - let indexKeyDataCount = 0; - - request = index.openCursor(); - request.onsuccess = function(event) { - let cursor = event.target.result; - if (cursor) { - indexKeyDataCount++; - cursor.update(cursor.value).onerror = requestCounter.errorHandler(); - indexKeyDataCount % 2 ? cursor.continue() : cursor.advance(1); - } - else { - is(indexKeyDataCount, dbData.length, "Saw all data"); - requestCounter.decr(); - } - }; - requestCounter.incr(); - - // Wait for all requests. - yield undefined; - - transaction.oncomplete = grabEventAndContinueHandler; - event = yield undefined; - - is(event.type, "complete", "Transaction succeeded"); - - db.close(); - } - - { // Make sure deleting operations in readwrite transactions succeed in low - // disk mode. - info("Test 13"); - - setLowDiskMode(true); - - let request = indexedDB.open(dbName, dbVersion); - request.onerror = errorHandler; - request.onupgradeneeded = unexpectedSuccessHandler; - request.onsuccess = grabEventAndContinueHandler; - let event = yield undefined; - - let db = event.target.result; - db.onerror = errorHandler; - - let transaction = db.transaction(objectStoreName, "readwrite"); - let objectStore = transaction.objectStore(objectStoreName); - let index = objectStore.index(indexName); - - let dataIndex = 0; - let data = dbData[dataIndex++]; - - let requestCounter = new RequestCounter(); - - objectStore.delete(data.foo).onsuccess = requestCounter.handler(); - - objectStore.openCursor().onsuccess = function(event) { - let cursor = event.target.result; - if (cursor) { - cursor.delete().onsuccess = requestCounter.handler(); - } - requestCounter.decr(); - }; - requestCounter.incr(); - - index.openCursor(null, "prev").onsuccess = function(event) { - let cursor = event.target.result; - if (cursor) { - cursor.delete().onsuccess = requestCounter.handler(); - } - requestCounter.decr(); - }; - requestCounter.incr(); - - yield undefined; - - objectStore.count().onsuccess = grabEventAndContinueHandler; - event = yield undefined; - - is(event.target.result, dbData.length - 3, "Actually deleted something"); - - objectStore.clear(); - objectStore.count().onsuccess = grabEventAndContinueHandler; - event = yield undefined; - - is(event.target.result, 0, "Actually cleared"); - - transaction.oncomplete = grabEventAndContinueHandler; - event = yield undefined; - - is(event.type, "complete", "Transaction succeeded"); - - db.close(); - } - - finishTest(); - yield undefined; -} - -function RequestCounter(expectedType) { - this._counter = 0; -} -RequestCounter.prototype = { - incr: function() { - this._counter++; - }, - - decr: function() { - if (!--this._counter) { - continueToNextStepSync(); - } - }, - - handler: function(type, preventDefault) { - this.incr(); - return function(event) { - is(event.type, type || "success", "Correct type"); - this.decr(); - }.bind(this); - }, - - errorHandler: function(eventType, errorName) { - this.incr(); - return function(event) { - is(event.type, eventType || "error", "Correct type"); - is(event.target.error.name, errorName || "QuotaExceededError", - "Correct error name"); - event.preventDefault(); - event.stopPropagation(); - this.decr(); - }.bind(this); - } -}; diff --git a/dom/indexedDB/test/unit/xpcshell-head-parent-process.js b/dom/indexedDB/test/unit/xpcshell-head-parent-process.js index def791f52..fe69b1f7b 100644 --- a/dom/indexedDB/test/unit/xpcshell-head-parent-process.js +++ b/dom/indexedDB/test/unit/xpcshell-head-parent-process.js @@ -66,9 +66,6 @@ function finishTest() resetWasm(); resetExperimental(); resetTesting(); - - SpecialPowers.notifyObserversInParentProcess(null, "disk-space-watcher", - "free"); } SpecialPowers.removeFiles(); diff --git a/dom/indexedDB/test/unit/xpcshell-parent-process.ini b/dom/indexedDB/test/unit/xpcshell-parent-process.ini index 04df5f552..2def60c34 100644 --- a/dom/indexedDB/test/unit/xpcshell-parent-process.ini +++ b/dom/indexedDB/test/unit/xpcshell-parent-process.ini @@ -46,7 +46,6 @@ skip-if = toolkit == 'android' [test_invalidate.js] # disabled for the moment. skip-if = true -[test_lowDiskSpace.js] [test_maximal_serialized_object_size.js] [test_metadata2Restore.js] [test_metadataRestore.js] diff --git a/dom/interfaces/css/nsIDOMCSSGroupingRule.idl b/dom/interfaces/css/nsIDOMCSSGroupingRule.idl index 80f072d16..f3580aeec 100644 --- a/dom/interfaces/css/nsIDOMCSSGroupingRule.idl +++ b/dom/interfaces/css/nsIDOMCSSGroupingRule.idl @@ -14,7 +14,7 @@ interface nsIDOMCSSGroupingRule : nsIDOMCSSRule readonly attribute nsIDOMCSSRuleList cssRules; unsigned long insertRule(in DOMString rule, - in unsigned long index) + [optional] in unsigned long index) raises(DOMException); void deleteRule(in unsigned long index) raises(DOMException); diff --git a/dom/interfaces/css/nsIDOMCSSStyleSheet.idl b/dom/interfaces/css/nsIDOMCSSStyleSheet.idl index b9e13134e..cefe4f704 100644 --- a/dom/interfaces/css/nsIDOMCSSStyleSheet.idl +++ b/dom/interfaces/css/nsIDOMCSSStyleSheet.idl @@ -20,7 +20,7 @@ interface nsIDOMCSSStyleSheet : nsIDOMStyleSheet readonly attribute nsIDOMCSSRuleList cssRules; unsigned long insertRule(in DOMString rule, - in unsigned long index) + [optional] in unsigned long index) raises(DOMException); void deleteRule(in unsigned long index) raises(DOMException); diff --git a/dom/locales/en-US/chrome/plugins.properties b/dom/locales/en-US/chrome/plugins.properties index fe03be59e..d5e65fea7 100644 --- a/dom/locales/en-US/chrome/plugins.properties +++ b/dom/locales/en-US/chrome/plugins.properties @@ -28,7 +28,5 @@ gmp_privacy_info=Privacy Information openH264_name=OpenH264 Video Codec provided by Cisco Systems, Inc. openH264_description2=This plugin is automatically installed by Mozilla to comply with the WebRTC specification and to enable WebRTC calls with devices that require the H.264 video codec. Visit http://www.openh264.org/ to view the codec source code and learn more about the implementation. -eme-adobe_name=Primetime Content Decryption Module provided by Adobe Systems, Incorporated -eme-adobe_description=Play back protected web video. - -widevine_description=Widevine Content Decryption Module provided by Google Inc. +widevine_name=Widevine Content Decryption Module provided by Google Inc. +widevine_description2=Play back protected web video. diff --git a/dom/media/AudioStream.h b/dom/media/AudioStream.h index acc38b93d..199314d4b 100644 --- a/dom/media/AudioStream.h +++ b/dom/media/AudioStream.h @@ -17,6 +17,10 @@ #include "mozilla/UniquePtr.h" #include "CubebUtils.h" #include "soundtouch/SoundTouchFactory.h" +#ifdef XP_SOLARIS +#include "soundtouch/SoundTouch.h" +#endif + namespace mozilla { diff --git a/dom/media/VideoUtils.cpp b/dom/media/VideoUtils.cpp index c06ba9070..56033c2fa 100644 --- a/dom/media/VideoUtils.cpp +++ b/dom/media/VideoUtils.cpp @@ -31,7 +31,6 @@ namespace mozilla { NS_NAMED_LITERAL_CSTRING(kEMEKeySystemClearkey, "org.w3.clearkey"); NS_NAMED_LITERAL_CSTRING(kEMEKeySystemWidevine, "com.widevine.alpha"); -NS_NAMED_LITERAL_CSTRING(kEMEKeySystemPrimetime, "com.adobe.primetime"); using layers::PlanarYCbCrImage; diff --git a/dom/media/VideoUtils.h b/dom/media/VideoUtils.h index aaf0e9903..eee6561fd 100644 --- a/dom/media/VideoUtils.h +++ b/dom/media/VideoUtils.h @@ -47,7 +47,6 @@ class MediaContentType; // EME Key System String. extern const nsLiteralCString kEMEKeySystemClearkey; extern const nsLiteralCString kEMEKeySystemWidevine; -extern const nsLiteralCString kEMEKeySystemPrimetime; /** * ReentrantMonitorConditionallyEnter diff --git a/dom/media/eme/EMEUtils.cpp b/dom/media/eme/EMEUtils.cpp index c248b3a24..11eb0026e 100644 --- a/dom/media/eme/EMEUtils.cpp +++ b/dom/media/eme/EMEUtils.cpp @@ -54,12 +54,6 @@ IsClearkeyKeySystem(const nsAString& aKeySystem) } bool -IsPrimetimeKeySystem(const nsAString& aKeySystem) -{ - return !CompareUTF8toUTF16(kEMEKeySystemPrimetime, aKeySystem); -} - -bool IsWidevineKeySystem(const nsAString& aKeySystem) { return !CompareUTF8toUTF16(kEMEKeySystemWidevine, aKeySystem); @@ -68,9 +62,6 @@ IsWidevineKeySystem(const nsAString& aKeySystem) nsString KeySystemToGMPName(const nsAString& aKeySystem) { - if (IsPrimetimeKeySystem(aKeySystem)) { - return NS_LITERAL_STRING("gmp-eme-adobe"); - } if (IsClearkeyKeySystem(aKeySystem)) { return NS_LITERAL_STRING("gmp-clearkey"); } @@ -88,8 +79,6 @@ ToCDMTypeTelemetryEnum(const nsString& aKeySystem) return CDMType::eWidevine; } else if (IsClearkeyKeySystem(aKeySystem)) { return CDMType::eClearKey; - } else if (IsPrimetimeKeySystem(aKeySystem)) { - return CDMType::ePrimetime; } return CDMType::eUnknown; } diff --git a/dom/media/eme/EMEUtils.h b/dom/media/eme/EMEUtils.h index 1794f8462..4a2e5da18 100644 --- a/dom/media/eme/EMEUtils.h +++ b/dom/media/eme/EMEUtils.h @@ -87,14 +87,10 @@ bool IsClearkeyKeySystem(const nsAString& aKeySystem); bool -IsPrimetimeKeySystem(const nsAString& aKeySystem); - -bool IsWidevineKeySystem(const nsAString& aKeySystem); enum CDMType { eClearKey = 0, - ePrimetime = 1, eWidevine = 2, eUnknown = 3 }; diff --git a/dom/media/eme/MediaKeySystemAccess.cpp b/dom/media/eme/MediaKeySystemAccess.cpp index 4cff464e7..4a5a7a30c 100644 --- a/dom/media/eme/MediaKeySystemAccess.cpp +++ b/dom/media/eme/MediaKeySystemAccess.cpp @@ -134,16 +134,6 @@ MediaKeySystemAccess::GetKeySystemStatus(const nsAString& aKeySystem, return EnsureCDMInstalled(aKeySystem, aOutMessage); } - if (Preferences::GetBool("media.gmp-eme-adobe.visible", false)) { - if (IsPrimetimeKeySystem(aKeySystem)) { - if (!Preferences::GetBool("media.gmp-eme-adobe.enabled", false)) { - aOutMessage = NS_LITERAL_CSTRING("Adobe EME disabled"); - return MediaKeySystemStatus::Cdm_disabled; - } - return EnsureCDMInstalled(aKeySystem, aOutMessage); - } - } - if (IsWidevineKeySystem(aKeySystem)) { if (Preferences::GetBool("media.gmp-widevinecdm.visible", false)) { if (!Preferences::GetBool("media.gmp-widevinecdm.enabled", false)) { @@ -376,19 +366,6 @@ GetSupportedKeySystems() keySystemConfigs.AppendElement(Move(widevine)); } } - { - if (HavePluginForKeySystem(kEMEKeySystemPrimetime)) { - KeySystemConfig primetime; - primetime.mKeySystem = NS_ConvertUTF8toUTF16(kEMEKeySystemPrimetime); - primetime.mInitDataTypes.AppendElement(NS_LITERAL_STRING("cenc")); - primetime.mPersistentState = KeySystemFeatureSupport::Required; - primetime.mDistinctiveIdentifier = KeySystemFeatureSupport::Required; - primetime.mSessionTypes.AppendElement(MediaKeySessionType::Temporary); - primetime.mMP4.SetCanDecryptAndDecode(EME_CODEC_AAC); - primetime.mMP4.SetCanDecryptAndDecode(EME_CODEC_H264); - keySystemConfigs.AppendElement(Move(primetime)); - } - } return keySystemConfigs; } diff --git a/dom/media/eme/MediaKeySystemAccessManager.cpp b/dom/media/eme/MediaKeySystemAccessManager.cpp index 8fefc62ec..ed31059e2 100644 --- a/dom/media/eme/MediaKeySystemAccessManager.cpp +++ b/dom/media/eme/MediaKeySystemAccessManager.cpp @@ -95,8 +95,7 @@ MediaKeySystemAccessManager::Request(DetailedPromise* aPromise, // Ensure keysystem is supported. if (!IsWidevineKeySystem(aKeySystem) && - !IsClearkeyKeySystem(aKeySystem) && - !IsPrimetimeKeySystem(aKeySystem)) { + !IsClearkeyKeySystem(aKeySystem)) { // Not to inform user, because nothing to do if the keySystem is not // supported. aPromise->MaybeReject(NS_ERROR_DOM_NOT_SUPPORTED_ERR, @@ -132,7 +131,7 @@ MediaKeySystemAccessManager::Request(DetailedPromise* aPromise, LogToBrowserConsole(NS_ConvertUTF8toUTF16(msg)); if (status == MediaKeySystemStatus::Cdm_not_installed && - (IsPrimetimeKeySystem(aKeySystem) || IsWidevineKeySystem(aKeySystem))) { + IsWidevineKeySystem(aKeySystem)) { // These are cases which could be resolved by downloading a new(er) CDM. // When we send the status to chrome, chrome's GMPProvider will attempt to // download or update the CDM. In AwaitInstall() we add listeners to wait diff --git a/dom/media/gmp/GMPParent.cpp b/dom/media/gmp/GMPParent.cpp index 418f14736..234ed5c05 100644 --- a/dom/media/gmp/GMPParent.cpp +++ b/dom/media/gmp/GMPParent.cpp @@ -726,16 +726,6 @@ GMPParent::ReadGMPInfoFile(nsIFile* aFile) if (cap.mAPIName.EqualsLiteral(GMP_API_DECRYPTOR)) { mCanDecrypt = true; - -#ifdef XP_WIN - // Adobe GMP doesn't work without SSE2. Check the tags to see if - // the decryptor is for the Adobe GMP, and refuse to load it if - // SSE2 isn't supported. - if (cap.mAPITags.Contains(kEMEKeySystemPrimetime) && - !mozilla::supports_sse2()) { - return GenericPromise::CreateAndReject(NS_ERROR_FAILURE, __func__); - } -#endif // XP_WIN } mCapabilities.AppendElement(Move(cap)); diff --git a/dom/media/gmp/GMPServiceParent.cpp b/dom/media/gmp/GMPServiceParent.cpp index 2b4831cd6..fcf9fa920 100644 --- a/dom/media/gmp/GMPServiceParent.cpp +++ b/dom/media/gmp/GMPServiceParent.cpp @@ -203,29 +203,6 @@ MoveAndOverwrite(nsIFile* aOldParentDir, } } -static void -MigratePreGecko42StorageDir(nsIFile* aOldStorageDir, - nsIFile* aNewStorageDir) -{ - MoveAndOverwrite(aOldStorageDir, aNewStorageDir, NS_LITERAL_STRING("id")); - MoveAndOverwrite(aOldStorageDir, aNewStorageDir, NS_LITERAL_STRING("storage")); -} - -static void -MigratePreGecko45StorageDir(nsIFile* aStorageDirBase) -{ - nsCOMPtr<nsIFile> adobeStorageDir(CloneAndAppend(aStorageDirBase, NS_LITERAL_STRING("gmp-eme-adobe"))); - if (NS_WARN_IF(!adobeStorageDir)) { - return; - } - - // The base storage dir in pre-45 contained "id" and "storage" subdirs. - // We assume all storage in the base storage dir that aren't known to GMP - // storage are records for the Adobe GMP. - MoveAndOverwrite(aStorageDirBase, adobeStorageDir, NS_LITERAL_STRING("id")); - MoveAndOverwrite(aStorageDirBase, adobeStorageDir, NS_LITERAL_STRING("storage")); -} - static nsresult GMPPlatformString(nsAString& aOutPlatform) { @@ -308,19 +285,6 @@ GeckoMediaPluginServiceParent::InitStorage() return rv; } - // Prior to 42, GMP storage was stored in $profileDir/gmp/. After 42, it's - // stored in $profileDir/gmp/$platform/. So we must migrate any old records - // from the old location to the new location, for forwards compatibility. - MigratePreGecko42StorageDir(gmpDirWithoutPlatform, mStorageBaseDir); - - // Prior to 45, GMP storage was not separated by plugin. In 45 and after, - // it's stored in $profile/gmp/$platform/$gmpName. So we must migrate old - // records from the old location to the new location, for forwards - // compatibility. We assume all directories in the base storage dir that - // aren't known to GMP storage are records for the Adobe GMP, since it - // was first. - MigratePreGecko45StorageDir(mStorageBaseDir); - return GeckoMediaPluginService::Init(); } diff --git a/dom/media/platforms/agnostic/gmp/GMPDecoderModule.cpp b/dom/media/platforms/agnostic/gmp/GMPDecoderModule.cpp index cc53d2c93..50a5097ac 100644 --- a/dom/media/platforms/agnostic/gmp/GMPDecoderModule.cpp +++ b/dom/media/platforms/agnostic/gmp/GMPDecoderModule.cpp @@ -109,7 +109,6 @@ GMPDecoderModule::PreferredGMP(const nsACString& aMimeType) if (aMimeType.EqualsLiteral("audio/mp4a-latm")) { switch (MediaPrefs::GMPAACPreferred()) { case 1: rv.emplace(kEMEKeySystemClearkey); break; - case 2: rv.emplace(kEMEKeySystemPrimetime); break; default: break; } } @@ -117,7 +116,6 @@ GMPDecoderModule::PreferredGMP(const nsACString& aMimeType) if (MP4Decoder::IsH264(aMimeType)) { switch (MediaPrefs::GMPH264Preferred()) { case 1: rv.emplace(kEMEKeySystemClearkey); break; - case 2: rv.emplace(kEMEKeySystemPrimetime); break; default: break; } } diff --git a/dom/media/test/external/external_media_harness/testcase.py b/dom/media/test/external/external_media_harness/testcase.py index 56350ccd9..35a944484 100644 --- a/dom/media/test/external/external_media_harness/testcase.py +++ b/dom/media/test/external/external_media_harness/testcase.py @@ -200,19 +200,6 @@ class NetworkBandwidthTestsMixin(object): self.run_videos(timeout=120) -reset_adobe_gmp_script = """ -navigator.requestMediaKeySystemAccess('com.adobe.primetime', -[{initDataTypes: ['cenc']}]).then( - function(access) { - marionetteScriptFinished('success'); - }, - function(ex) { - marionetteScriptFinished(ex); - } -); -""" - - reset_widevine_gmp_script = """ navigator.requestMediaKeySystemAccess('com.widevine.alpha', [{initDataTypes: ['cenc']}]).then( @@ -256,21 +243,12 @@ class EMESetupMixin(object): def reset_GMP_version(self): if EMESetupMixin.version_needs_reset: with self.marionette.using_context(Marionette.CONTEXT_CHROME): - if self.marionette.get_pref('media.gmp-eme-adobe.version'): - self.marionette.reset_pref('media.gmp-eme-adobe.version') if self.marionette.get_pref('media.gmp-widevinecdm.version'): self.marionette.reset_pref('media.gmp-widevinecdm.version') with self.marionette.using_context(Marionette.CONTEXT_CONTENT): - adobe_result = self.marionette.execute_async_script( - reset_adobe_gmp_script, - script_timeout=60000) widevine_result = self.marionette.execute_async_script( reset_widevine_gmp_script, script_timeout=60000) - if not adobe_result == 'success': - raise VideoException( - 'ERROR: Resetting Adobe GMP failed {}' - .format(adobe_result)) if not widevine_result == 'success': raise VideoException( 'ERROR: Resetting Widevine GMP failed {}' @@ -352,10 +330,6 @@ class EMESetupMixin(object): self.check_and_log_boolean_pref( 'media.mediasource.mp4.enabled', True), self.check_and_log_boolean_pref( - 'media.gmp-eme-adobe.enabled', True), - self.check_and_log_integer_pref( - 'media.gmp-eme-adobe.version', 1), - self.check_and_log_boolean_pref( 'media.gmp-widevinecdm.enabled', True), self.chceck_and_log_version_string_pref( 'media.gmp-widevinecdm.version', '1.0.0.0') diff --git a/dom/plugins/base/npapi.h b/dom/plugins/base/npapi.h index 12ac635c7..e554aaabc 100644 --- a/dom/plugins/base/npapi.h +++ b/dom/plugins/base/npapi.h @@ -327,9 +327,12 @@ typedef enum { #define NP_ABI_GCC3_MASK 0x10000000 /* * gcc 3.x generated vtables on UNIX and OSX are incompatible with - * previous compilers. + * previous compilers. Flash plugin binaries for Solaris were compiled + * with Sun Studio, so this has to be false to make things work. This may + * become a problem in the future when/if new plugins are compiled with + * GCC, however. */ -#if (defined(XP_UNIX) && defined(__GNUC__) && (__GNUC__ >= 3)) +#if (defined(XP_UNIX) && defined(__GNUC__) && (__GNUC__ >= 3) && !defined(XP_SOLARIS)) #define _NP_ABI_MIXIN_FOR_GCC3 NP_ABI_GCC3_MASK #else #define _NP_ABI_MIXIN_FOR_GCC3 0 diff --git a/dom/plugins/base/nptypes.h b/dom/plugins/base/nptypes.h index c36532472..d0cef6540 100644 --- a/dom/plugins/base/nptypes.h +++ b/dom/plugins/base/nptypes.h @@ -22,6 +22,19 @@ typedef unsigned int uint32_t; typedef long long int64_t; typedef unsigned long long uint64_t; +#elif defined(__sun) + /* + * SunOS ships an inttypes.h header that defines [u]int32_t, + * but not bool for C. + */ + #include <inttypes.h> + + + #ifndef __cplusplus + typedef int bool; + #define true 1 + #define false 0 + #endif #elif defined(bsdi) || defined(FREEBSD) || defined(OPENBSD) /* * BSD/OS, FreeBSD, and OpenBSD ship sys/types.h that define int32_t and diff --git a/dom/plugins/base/nsJSNPRuntime.cpp b/dom/plugins/base/nsJSNPRuntime.cpp index 05e0ec4ba..1d42c18d6 100644 --- a/dom/plugins/base/nsJSNPRuntime.cpp +++ b/dom/plugins/base/nsJSNPRuntime.cpp @@ -248,7 +248,6 @@ const static js::ObjectOps sNPObjectJSWrapperObjectOps = { nullptr, // setProperty nullptr, // getOwnPropertyDescriptor nullptr, // deleteProperty - nullptr, nullptr, // watch/unwatch nullptr, // getElements NPObjWrapper_Enumerate, nullptr, diff --git a/dom/plugins/base/nsPluginsDirUnix.cpp b/dom/plugins/base/nsPluginsDirUnix.cpp index e6956c34c..de3b7a2d1 100644 --- a/dom/plugins/base/nsPluginsDirUnix.cpp +++ b/dom/plugins/base/nsPluginsDirUnix.cpp @@ -19,7 +19,9 @@ #include "nsIPrefService.h" #define LOCAL_PLUGIN_DLL_SUFFIX ".so" -#if defined(LINUX) +#ifdef XP_SOLARIS +#define DEFAULT_X11_PATH "/usr/openwin/lib" +#elif defined(LINUX) #define DEFAULT_X11_PATH "/usr/X11R6/lib/" #elif defined(__APPLE__) #define DEFAULT_X11_PATH "/usr/X11R6/lib" @@ -92,7 +94,11 @@ static bool LoadExtraSharedLib(const char *name, char **soname, bool tryToGetSon #define PLUGIN_MAX_NUMBER_OF_EXTRA_LIBS 32 #define PREF_PLUGINS_SONAME "plugin.soname.list" +#ifdef XP_SOLARIS +#define DEFAULT_EXTRA_LIBS_LIST "libXt" LOCAL_PLUGIN_DLL_SUFFIX ":libXext" LOCAL_PLUGIN_DLL_SUFFIX ":libXm" LOCAL_PLUGIN_DLL_SUFFIX +#else #define DEFAULT_EXTRA_LIBS_LIST "libXt" LOCAL_PLUGIN_DLL_SUFFIX ":libXext" LOCAL_PLUGIN_DLL_SUFFIX +#endif /* this function looks for user_pref("plugin.soname.list", "/usr/X11R6/lib/libXt.so.6:libXext.so"); @@ -264,11 +270,15 @@ nsresult nsPluginFile::LoadPlugin(PRLibrary **outLibrary) // at runtime. Explicitly opening Xt/Xext into the global // namespace before attempting to load the plug-in seems to // work fine. - - +#if defined(XP_SOLARIS) + // Acrobat/libXm: Lazy resolving might cause crash later (bug 211587) + *outLibrary = PR_LoadLibraryWithFlags(libSpec, PR_LD_NOW); + pLibrary = *outLibrary; +#else // Some dlopen() doesn't recover from a failed PR_LD_NOW (bug 223744) *outLibrary = PR_LoadLibraryWithFlags(libSpec, 0); pLibrary = *outLibrary; +#endif if (!pLibrary) { LoadExtraSharedLibs(); // try reload plugin once more diff --git a/dom/plugins/ipc/PluginInstanceChild.cpp b/dom/plugins/ipc/PluginInstanceChild.cpp index af9db9103..3f2cdbc13 100644 --- a/dom/plugins/ipc/PluginInstanceChild.cpp +++ b/dom/plugins/ipc/PluginInstanceChild.cpp @@ -310,9 +310,10 @@ PluginInstanceChild::InternalGetNPObjectForValue(NPNVariable aValue, switch (aValue) { case NPNVWindowNPObject: if (!(actor = mCachedWindowActor)) { + result = NPERR_GENERIC_ERROR; PPluginScriptableObjectChild* actorProtocol; - CallNPN_GetValue_NPNVWindowNPObject(&actorProtocol, &result); - if (result == NPERR_NO_ERROR) { + if (CallNPN_GetValue_NPNVWindowNPObject(&actorProtocol, &result) && + result == NPERR_NO_ERROR) { actor = mCachedWindowActor = static_cast<PluginScriptableObjectChild*>(actorProtocol); NS_ASSERTION(actor, "Null actor!"); @@ -324,10 +325,10 @@ PluginInstanceChild::InternalGetNPObjectForValue(NPNVariable aValue, case NPNVPluginElementNPObject: if (!(actor = mCachedElementActor)) { + result = NPERR_GENERIC_ERROR; PPluginScriptableObjectChild* actorProtocol; - CallNPN_GetValue_NPNVPluginElementNPObject(&actorProtocol, - &result); - if (result == NPERR_NO_ERROR) { + if (CallNPN_GetValue_NPNVPluginElementNPObject(&actorProtocol, &result) && + result == NPERR_NO_ERROR) { actor = mCachedElementActor = static_cast<PluginScriptableObjectChild*>(actorProtocol); NS_ASSERTION(actor, "Null actor!"); @@ -338,6 +339,7 @@ PluginInstanceChild::InternalGetNPObjectForValue(NPNVariable aValue, break; default: + result = NPERR_GENERIC_ERROR; NS_NOTREACHED("Don't know what to do with this value type!"); } @@ -434,6 +436,7 @@ PluginInstanceChild::NPN_GetValue(NPNVariable aVar, case NPNVWindowNPObject: // Intentional fall-through case NPNVPluginElementNPObject: { NPObject* object; + *((NPObject**)aValue) = nullptr; NPError result = InternalGetNPObjectForValue(aVar, &object); if (result == NPERR_NO_ERROR) { *((NPObject**)aValue) = object; diff --git a/dom/plugins/ipc/PluginMessageUtils.cpp b/dom/plugins/ipc/PluginMessageUtils.cpp index 47653fe6e..5b1d1667f 100644 --- a/dom/plugins/ipc/PluginMessageUtils.cpp +++ b/dom/plugins/ipc/PluginMessageUtils.cpp @@ -82,7 +82,7 @@ MediateRace(const MessageChannel::MessageInfo& parent, } } -#if defined(OS_LINUX) +#if defined(OS_LINUX) || defined(OS_SOLARIS) static string ReplaceAll(const string& haystack, const string& needle, const string& with) { @@ -101,7 +101,7 @@ ReplaceAll(const string& haystack, const string& needle, const string& with) string MungePluginDsoPath(const string& path) { -#if defined(OS_LINUX) +#if defined(OS_LINUX) || defined(OS_SOLARIS) // https://bugzilla.mozilla.org/show_bug.cgi?id=519601 return ReplaceAll(path, "netscape", "netsc@pe"); #else @@ -112,7 +112,7 @@ MungePluginDsoPath(const string& path) string UnmungePluginDsoPath(const string& munged) { -#if defined(OS_LINUX) +#if defined(OS_LINUX) || defined(OS_SOLARIS) return ReplaceAll(munged, "netsc@pe", "netscape"); #else return munged; diff --git a/dom/plugins/ipc/PluginModuleChild.cpp b/dom/plugins/ipc/PluginModuleChild.cpp index cbf6e509f..f943dfc42 100644 --- a/dom/plugins/ipc/PluginModuleChild.cpp +++ b/dom/plugins/ipc/PluginModuleChild.cpp @@ -286,7 +286,7 @@ PluginModuleChild::InitForChrome(const std::string& aPluginFilename, // TODO: use PluginPRLibrary here -#if defined(OS_LINUX) || defined(OS_BSD) +#if defined(OS_LINUX) || defined(OS_BSD) || defined(OS_SOLARIS) mShutdownFunc = (NP_PLUGINSHUTDOWN) PR_FindFunctionSymbol(mLibrary, "NP_Shutdown"); @@ -1821,7 +1821,7 @@ PluginModuleChild::AnswerNP_GetEntryPoints(NPError* _retval) AssertPluginThread(); MOZ_ASSERT(mIsChrome); -#if defined(OS_LINUX) || defined(OS_BSD) +#if defined(OS_LINUX) || defined(OS_BSD) || defined(OS_SOLARIS) return true; #elif defined(OS_WIN) || defined(OS_MACOSX) *_retval = mGetEntryPointsFunc(&mFunctions); @@ -1866,7 +1866,7 @@ PluginModuleChild::DoNP_Initialize(const PluginSettings& aSettings) #endif NPError result; -#if defined(OS_LINUX) || defined(OS_BSD) +#if defined(OS_LINUX) || defined(OS_BSD) || defined(OS_SOLARIS) result = mInitializeFunc(&sBrowserFuncs, &mFunctions); #elif defined(OS_WIN) || defined(OS_MACOSX) result = mInitializeFunc(&sBrowserFuncs); diff --git a/dom/plugins/ipc/PluginModuleChild.h b/dom/plugins/ipc/PluginModuleChild.h index 681743582..5e4fa7d20 100644 --- a/dom/plugins/ipc/PluginModuleChild.h +++ b/dom/plugins/ipc/PluginModuleChild.h @@ -258,7 +258,7 @@ private: // we get this from the plugin NP_PLUGINSHUTDOWN mShutdownFunc; -#if defined(OS_LINUX) || defined(OS_BSD) +#if defined(OS_LINUX) || defined(OS_BSD) || defined(OS_SOLARIS) NP_PLUGINUNIXINIT mInitializeFunc; #elif defined(OS_WIN) || defined(OS_MACOSX) NP_PLUGININIT mInitializeFunc; diff --git a/dom/storage/DOMStorageCache.cpp b/dom/storage/DOMStorageCache.cpp index a2b5a6f73..ee9a22e96 100644 --- a/dom/storage/DOMStorageCache.cpp +++ b/dom/storage/DOMStorageCache.cpp @@ -205,11 +205,6 @@ DOMStorageCache::ProcessUsageDelta(const DOMStorage* aStorage, int64_t aDelta) bool DOMStorageCache::ProcessUsageDelta(uint32_t aGetDataSetIndex, const int64_t aDelta) { - // Check if we are in a low disk space situation - if (aDelta > 0 && mManager && mManager->IsLowDiskSpace()) { - return false; - } - // Check limit per this origin Data& data = mData[aGetDataSetIndex]; uint64_t newOriginUsage = data.mOriginQuotaUsage + aDelta; diff --git a/dom/storage/DOMStorageIPC.cpp b/dom/storage/DOMStorageIPC.cpp index a8cd745f1..9d87a5788 100644 --- a/dom/storage/DOMStorageIPC.cpp +++ b/dom/storage/DOMStorageIPC.cpp @@ -11,7 +11,6 @@ #include "mozilla/dom/ContentChild.h" #include "mozilla/dom/ContentParent.h" #include "mozilla/Unused.h" -#include "nsIDiskSpaceWatcher.h" #include "nsThreadUtils.h" namespace mozilla { @@ -321,22 +320,6 @@ private: mozilla::Unused << mParent->SendOriginsHavingData(scopes); } - // We need to check if the device is in a low disk space situation, so - // we can forbid in that case any write in localStorage. - nsCOMPtr<nsIDiskSpaceWatcher> diskSpaceWatcher = - do_GetService("@mozilla.org/toolkit/disk-space-watcher;1"); - if (!diskSpaceWatcher) { - return NS_OK; - } - - bool lowDiskSpace = false; - diskSpaceWatcher->GetIsDiskFull(&lowDiskSpace); - - if (lowDiskSpace) { - mozilla::Unused << mParent->SendObserve( - nsDependentCString("low-disk-space"), EmptyString(), EmptyCString()); - } - return NS_OK; } diff --git a/dom/storage/DOMStorageManager.cpp b/dom/storage/DOMStorageManager.cpp index 156e846ba..8f50fcfb4 100644 --- a/dom/storage/DOMStorageManager.cpp +++ b/dom/storage/DOMStorageManager.cpp @@ -103,7 +103,6 @@ NS_IMPL_ISUPPORTS(DOMStorageManager, DOMStorageManager::DOMStorageManager(DOMStorage::StorageType aType) : mCaches(8) , mType(aType) - , mLowDiskSpace(false) { DOMStorageObserver* observer = DOMStorageObserver::Self(); NS_ASSERTION(observer, "No DOMStorageObserver, cannot observe private data delete notifications!"); @@ -566,22 +565,6 @@ DOMStorageManager::Observe(const char* aTopic, return NS_OK; } - if (!strcmp(aTopic, "low-disk-space")) { - if (mType == LocalStorage) { - mLowDiskSpace = true; - } - - return NS_OK; - } - - if (!strcmp(aTopic, "no-low-disk-space")) { - if (mType == LocalStorage) { - mLowDiskSpace = false; - } - - return NS_OK; - } - #ifdef DOM_STORAGE_TESTS if (!strcmp(aTopic, "test-reload")) { if (mType != LocalStorage) { diff --git a/dom/storage/DOMStorageManager.h b/dom/storage/DOMStorageManager.h index 666e16a6f..0bfd21975 100644 --- a/dom/storage/DOMStorageManager.h +++ b/dom/storage/DOMStorageManager.h @@ -102,12 +102,6 @@ private: const DOMStorage::StorageType mType; - // If mLowDiskSpace is true it indicates a low device storage situation and - // so no localStorage writes are allowed. sessionStorage writes are still - // allowed. - bool mLowDiskSpace; - bool IsLowDiskSpace() const { return mLowDiskSpace; }; - void ClearCaches(uint32_t aUnloadFlags, const OriginAttributesPattern& aPattern, const nsACString& aKeyPrefix); diff --git a/dom/storage/DOMStorageObserver.cpp b/dom/storage/DOMStorageObserver.cpp index a2b3f1da8..fbbab8e54 100644 --- a/dom/storage/DOMStorageObserver.cpp +++ b/dom/storage/DOMStorageObserver.cpp @@ -70,9 +70,6 @@ DOMStorageObserver::Init() obs->AddObserver(sSelf, "profile-before-change", true); obs->AddObserver(sSelf, "xpcom-shutdown", true); - // Observe low device storage notifications. - obs->AddObserver(sSelf, "disk-space-watcher", true); - #ifdef DOM_STORAGE_TESTS // Testing obs->AddObserver(sSelf, "domstorage-test-flush-force", true); @@ -313,16 +310,6 @@ DOMStorageObserver::Observe(nsISupports* aSubject, return NS_OK; } - if (!strcmp(aTopic, "disk-space-watcher")) { - if (NS_LITERAL_STRING("full").Equals(aData)) { - Notify("low-disk-space"); - } else if (NS_LITERAL_STRING("free").Equals(aData)) { - Notify("no-low-disk-space"); - } - - return NS_OK; - } - #ifdef DOM_STORAGE_TESTS if (!strcmp(aTopic, "domstorage-test-flush-force")) { DOMStorageDBBridge* db = DOMStorageCache::GetDatabase(); diff --git a/dom/svg/crashtests/880544-1.svg b/dom/svg/crashtests/880544-1.svg deleted file mode 100644 index 9052d2396..000000000 --- a/dom/svg/crashtests/880544-1.svg +++ /dev/null @@ -1,15 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg">
- <script>//<![CDATA[
-
-function add_watch()
-{
- document.getElementById("p").transform.baseVal.watch("0", function(){});
-}
-
-window.addEventListener("load", add_watch, false);
-
- //]]></script>
-
- <path id="p" transform="scale(1)" />
-
-</svg>
diff --git a/dom/svg/crashtests/880544-2.svg b/dom/svg/crashtests/880544-2.svg deleted file mode 100644 index 7570c7cbf..000000000 --- a/dom/svg/crashtests/880544-2.svg +++ /dev/null @@ -1,15 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg">
- <script>//<![CDATA[
-
-function add_watch()
-{
- document.getElementById("e").x.baseVal.watch("0", function(){});
-}
-
-window.addEventListener("load", add_watch, false);
-
- //]]></script>
-
- <text id="e" x="10">foo</text>
-
-</svg>
diff --git a/dom/svg/crashtests/880544-3.svg b/dom/svg/crashtests/880544-3.svg deleted file mode 100644 index 5791b8ec6..000000000 --- a/dom/svg/crashtests/880544-3.svg +++ /dev/null @@ -1,15 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg">
- <script>//<![CDATA[
-
-function add_watch()
-{
- document.getElementById("e").rotate.baseVal.watch("0", function(){});
-}
-
-window.addEventListener("load", add_watch, false);
-
- //]]></script>
-
- <text id="e" rotate="10">foo</text>
-
-</svg>
diff --git a/dom/svg/crashtests/880544-4.svg b/dom/svg/crashtests/880544-4.svg deleted file mode 100644 index 7bdb80f47..000000000 --- a/dom/svg/crashtests/880544-4.svg +++ /dev/null @@ -1,15 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg">
- <script>//<![CDATA[
-
-function add_watch()
-{
- document.getElementById("e").pathSegList.watch("0", function(){});
-}
-
-window.addEventListener("load", add_watch, false);
-
- //]]></script>
-
- <path id="e" d="M0,0"/>
-
-</svg>
diff --git a/dom/svg/crashtests/880544-5.svg b/dom/svg/crashtests/880544-5.svg deleted file mode 100644 index ef7f468f8..000000000 --- a/dom/svg/crashtests/880544-5.svg +++ /dev/null @@ -1,15 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg">
- <script>//<![CDATA[
-
-function add_watch()
-{
- document.getElementById("e").points.watch("0", function(){});
-}
-
-window.addEventListener("load", add_watch, false);
-
- //]]></script>
-
- <polygon id="e" points="0,0"/>
-
-</svg>
diff --git a/dom/svg/crashtests/crashtests.list b/dom/svg/crashtests/crashtests.list index 147838bbe..b2e920152 100644 --- a/dom/svg/crashtests/crashtests.list +++ b/dom/svg/crashtests/crashtests.list @@ -66,11 +66,6 @@ load 837450-1.svg load 842463-1.html load 847138-1.svg load 864509.svg -load 880544-1.svg -load 880544-2.svg -load 880544-3.svg -load 880544-4.svg -load 880544-5.svg load 898915-1.svg load 1035248-1.svg load 1035248-2.svg diff --git a/dom/tests/mochitest/ajax/offline/mochitest.ini b/dom/tests/mochitest/ajax/offline/mochitest.ini index 961b143b6..45909e94e 100644 --- a/dom/tests/mochitest/ajax/offline/mochitest.ini +++ b/dom/tests/mochitest/ajax/offline/mochitest.ini @@ -79,8 +79,6 @@ support-files = [test_fallback.html] [test_foreign.html] [test_identicalManifest.html] -[test_lowDeviceStorage.html] -[test_lowDeviceStorageDuringUpdate.html] [test_missingFile.html] [test_missingManifest.html] [test_noManifest.html] diff --git a/dom/tests/mochitest/ajax/offline/test_lowDeviceStorage.html b/dom/tests/mochitest/ajax/offline/test_lowDeviceStorage.html deleted file mode 100644 index d03ef5a12..000000000 --- a/dom/tests/mochitest/ajax/offline/test_lowDeviceStorage.html +++ /dev/null @@ -1,91 +0,0 @@ -<html xmlns="http://www.w3.org/1999/xhtml"> -<head> -<title>Low device storage</title> - -<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> -<script type="text/javascript" src="/tests/dom/tests/mochitest/ajax/offline/offlineTests.js"></script> -<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> - -<script type="text/javascript"> - -/** - * This test checks that an offline cache update scheduled *after* a low device - * storage situation appears is canceled. It basically does: - * - * 1. Notifies to the offline cache update service about a fake - * low device storage situation. - * 2. Schedules an update and observes for its notifications. - * 3. We are supposed to receive an error event notifying about the cancelation - * of the update because of the low storage situation. - * 4. Notifies to the offline cache update service that we've recovered from - * the low storage situation. - */ - -var updateService = SpecialPowers.Cc['@mozilla.org/offlinecacheupdate-service;1'] - .getService(Ci.nsIOfflineCacheUpdateService); - -var obs = SpecialPowers.Cc["@mozilla.org/observer-service;1"] - .getService(SpecialPowers.Ci.nsIObserverService); - -var errorReceived = false; - -var systemPrincipal = SpecialPowers.Services.scriptSecurityManager.getSystemPrincipal(); - -function finish() { - obs.notifyObservers(updateService, "disk-space-watcher", "free"); - - OfflineTest.teardownAndFinish(); -} - -if (OfflineTest.setup()) { - obs.notifyObservers(updateService, "disk-space-watcher", "full"); - - var updateObserver = { - updateStateChanged: function (aUpdate, aState) { - switch(aState) { - case Ci.nsIOfflineCacheUpdateObserver.STATE_ERROR: - errorReceived = true; - OfflineTest.ok(true, "Expected error. Update canceled"); - break; - case Ci.nsIOfflineCacheUpdateObserver.STATE_FINISHED: - aUpdate.removeObserver(this); - OfflineTest.ok(errorReceived, - "Finished after receiving the expected error"); - finish(); - break; - case Ci.nsIOfflineCacheUpdateObserver.STATE_NOUPDATE: - aUpdate.removeObserver(this); - OfflineTest.ok(false, "No update"); - finish(); - break; - case Ci.nsIOfflineCacheUpdateObserver.STATE_DOWNLOADING: - case Ci.nsIOfflineCacheUpdateObserver.STATE_ITEMSTARTED: - case Ci.nsIOfflineCacheUpdateObserver.STATE_ITEMPROGRESS: - aUpdate.removeObserver(this); - OfflineTest.ok(false, "The update was supposed to be canceled"); - finish(); - break; - } - }, - applicationCacheAvailable: function() {} - }; - - var manifest = "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/simpleManifest.cacheManifest"; - var ioService = Cc["@mozilla.org/network/io-service;1"] - .getService(Ci.nsIIOService); - var manifestURI = ioService.newURI(manifest, null, null); - var documentURI = ioService.newURI(document.documentURI, null, null); - var update = updateService.scheduleUpdate(manifestURI, documentURI, systemPrincipal, window); - update.addObserver(updateObserver, false); -} - -SimpleTest.waitForExplicitFinish(); - -</script> - -</head> - -<body> - -</body> -</html> diff --git a/dom/tests/mochitest/ajax/offline/test_lowDeviceStorageDuringUpdate.html b/dom/tests/mochitest/ajax/offline/test_lowDeviceStorageDuringUpdate.html deleted file mode 100644 index 88a0b4eae..000000000 --- a/dom/tests/mochitest/ajax/offline/test_lowDeviceStorageDuringUpdate.html +++ /dev/null @@ -1,58 +0,0 @@ -<html xmlns="http://www.w3.org/1999/xhtml" manifest="http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/simpleManifest.cacheManifest"> -<head> -<title>Low device storage during update</title> - -<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> -<script type="text/javascript" src="/tests/dom/tests/mochitest/ajax/offline/offlineTests.js"></script> -<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> - -<script type="text/javascript"> - -/** - * This test checks that an offline cache update is canceled when a low device - * storage condition is detected during the update. - */ - -var updateService = Cc['@mozilla.org/offlinecacheupdate-service;1'] - .getService(Ci.nsIOfflineCacheUpdateService); - -var obs = SpecialPowers.Cc["@mozilla.org/observer-service;1"] - .getService(SpecialPowers.Ci.nsIObserverService); - -function finish() { - obs.notifyObservers(updateService, "disk-space-watcher", "free"); - - OfflineTest.teardownAndFinish(); -} - -function onError() { - OfflineTest.ok(true, "Expected error: Update canceled"); - finish(); -} - -function onUnexpectedEvent() { - OfflineTest.ok(false, "The update was supposed to be canceled"); - finish(); -} - -function onChecking() { - obs.notifyObservers(updateService, "disk-space-watcher", "full"); -} - -if (OfflineTest.setup()) { - applicationCache.onerror = OfflineTest.priv(onError); - applicationCache.onprogress = OfflineTest.priv(onUnexpectedEvent); - applicationCache.oncached = OfflineTest.priv(onUnexpectedEvent); - applicationCache.onchecking = OfflineTest.priv(onChecking); -} - -SimpleTest.waitForExplicitFinish(); - -</script> - -</head> - -<body> - -</body> -</html> diff --git a/dom/tests/mochitest/bugs/iframe_bug38959-1.html b/dom/tests/mochitest/bugs/iframe_bug38959-1.html deleted file mode 100644 index d4c16c47a..000000000 --- a/dom/tests/mochitest/bugs/iframe_bug38959-1.html +++ /dev/null @@ -1,14 +0,0 @@ -<html> -<head> - <title>Iframe test for bug 38959</title> -</head> -<body"> -<script> - -x = false; -window.opener.postMessage(1, "http://mochi.test:8888"); -window.close(); - -</script> -</body> -</html> diff --git a/dom/tests/mochitest/bugs/iframe_bug38959-2.html b/dom/tests/mochitest/bugs/iframe_bug38959-2.html deleted file mode 100644 index 36cd0c156..000000000 --- a/dom/tests/mochitest/bugs/iframe_bug38959-2.html +++ /dev/null @@ -1,14 +0,0 @@ -<html> -<head> - <title>Iframe test for bug 38959</title> -</head> -<body"> -<script> - -x = true; -window.opener.postMessage(2, "http://mochi.test:8888"); -window.close(); - -</script> -</body> -</html> diff --git a/dom/tests/mochitest/bugs/mochitest.ini b/dom/tests/mochitest/bugs/mochitest.ini index e0c71f857..309aab6e0 100644 --- a/dom/tests/mochitest/bugs/mochitest.ini +++ b/dom/tests/mochitest/bugs/mochitest.ini @@ -23,8 +23,6 @@ support-files = grandchild_bug260264.html iframe_bug304459-1.html iframe_bug304459-2.html - iframe_bug38959-1.html - iframe_bug38959-2.html iframe_bug430276-2.html iframe_bug430276.html iframe_bug440572.html @@ -64,7 +62,6 @@ skip-if = toolkit == 'android' #TIMED_OUT [test_bug377539.html] [test_bug384122.html] [test_bug389366.html] -[test_bug38959.html] [test_bug393974.html] [test_bug394769.html] [test_bug396843.html] diff --git a/dom/tests/mochitest/bugs/test_bug38959.html b/dom/tests/mochitest/bugs/test_bug38959.html deleted file mode 100644 index a8d07d1a6..000000000 --- a/dom/tests/mochitest/bugs/test_bug38959.html +++ /dev/null @@ -1,57 +0,0 @@ -<!DOCTYPE HTML> -<html> -<!-- -https://bugzilla.mozilla.org/show_bug.cgi?id=38959 ---> -<head> - <title>Test for Bug 38959</title> - <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> - <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> -</head> -<body> -<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=38959">Mozilla Bug 38959</a> -<p id="display"></p> -<div id="content" style="display: none"> - <iframe id="frame"></iframe> -</div> -<pre id="test"> -<script type="application/javascript"> - -/** Test for Bug 38959 **/ - -var newValue; - -function watcher(id, ol, ne) -{ - newValue = ne; - return ne; -} - -function openWindow(url, crossOrigin) -{ - newValue = true; - var w = window.open(url); - w.watch("x", watcher); -} - -function receiveMessage(evt) -{ - ok(newValue, "Watchpoints only allowed same-origin."); - if (evt.data == 1) { - openWindow("/tests/dom/tests/mochitest/bugs/iframe_bug38959-2.html"); - } - else { - SimpleTest.finish(); - } -} - -SimpleTest.waitForExplicitFinish(); - -window.addEventListener("message", receiveMessage, false); - -openWindow("http://example.org/tests/dom/tests/mochitest/bugs/iframe_bug38959-1.html"); - -</script> -</pre> -</body> -</html> diff --git a/dom/tests/mochitest/localstorage/mochitest.ini b/dom/tests/mochitest/localstorage/mochitest.ini index 5242bf9b1..30b90664a 100644 --- a/dom/tests/mochitest/localstorage/mochitest.ini +++ b/dom/tests/mochitest/localstorage/mochitest.ini @@ -47,6 +47,5 @@ skip-if = toolkit == 'android' #TIMED_OUT skip-if = toolkit == 'android' #TIMED_OUT [test_localStorageReplace.html] skip-if = toolkit == 'android' -[test_lowDeviceStorage.html] [test_storageConstructor.html] [test_localStorageSessionPrefOverride.html] diff --git a/dom/tests/mochitest/localstorage/test_lowDeviceStorage.html b/dom/tests/mochitest/localstorage/test_lowDeviceStorage.html deleted file mode 100644 index 046587150..000000000 --- a/dom/tests/mochitest/localstorage/test_lowDeviceStorage.html +++ /dev/null @@ -1,76 +0,0 @@ -<html xmlns="http://www.w3.org/1999/xhtml"> -<head> -<title>Test localStorage usage while in a low device storage situation</title> - -<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> -<script type="text/javascript" src="localStorageCommon.js"></script> -<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> - -<script type="text/javascript"> - -/* -This test does the following: -- Stores an item in localStorage. -- Checks the stored value. -- Emulates a low device storage situation. -- Gets the stored item again. -- Removes the stored item. -- Fails storing a new value. -- Emulates recovering from a low device storage situation. -- Stores a new value. -- Checks the stored value. -*/ - -function lowDeviceStorage(lowStorage) { - var data = lowStorage ? "full" : "free"; - os().notifyObservers(null, "disk-space-watcher", data); -} - -function startTest() { - // Add a test item. - localStorage.setItem("item", "value"); - is(localStorage.getItem("item"), "value", "getItem()"); - - // Emulates a low device storage situation. - lowDeviceStorage(true); - - // Checks that we can still access to the stored item. - is(localStorage.getItem("item"), "value", - "getItem() during a device storage situation"); - - // Removes the stored item. - localStorage.removeItem("item"); - is(localStorage.getItem("item"), null, - "getItem() after removing the item"); - - // Fails storing a new item. - try { - localStorage.setItem("newItem", "value"); - ok(false, "Storing a new item is expected to fail"); - } catch(e) { - ok(true, "Got an expected exception " + e); - } finally { - is(localStorage.getItem("newItem"), null, - "setItem while device storage is low"); - } - - // Emulates recovering from a low device storage situation. - lowDeviceStorage(false); - - // Add a test item after recovering from the low device storage situation. - localStorage.setItem("newItem", "value"); - is(localStorage.getItem("newItem"), "value", - "getItem() with available storage"); - - SimpleTest.finish(); -} - -SimpleTest.waitForExplicitFinish(); - -</script> - -</head> - -<body onload="startTest();"> -</body> -</html> diff --git a/dom/webidl/CSSStyleSheet.webidl b/dom/webidl/CSSStyleSheet.webidl index 48fb89db1..15c110b8b 100644 --- a/dom/webidl/CSSStyleSheet.webidl +++ b/dom/webidl/CSSStyleSheet.webidl @@ -23,7 +23,7 @@ interface CSSStyleSheet : StyleSheet { [ChromeOnly, BinaryName="parsingModeDOM"] readonly attribute CSSStyleSheetParsingMode parsingMode; [Throws, NeedsSubjectPrincipal] - unsigned long insertRule(DOMString rule, unsigned long index); + unsigned long insertRule(DOMString rule, optional unsigned long index = 0); [Throws, NeedsSubjectPrincipal] void deleteRule(unsigned long index); }; diff --git a/dom/webidl/HTMLScriptElement.webidl b/dom/webidl/HTMLScriptElement.webidl index 377056366..5b64c42d7 100644 --- a/dom/webidl/HTMLScriptElement.webidl +++ b/dom/webidl/HTMLScriptElement.webidl @@ -13,6 +13,8 @@ interface HTMLScriptElement : HTMLElement { attribute DOMString src; [SetterThrows] attribute DOMString type; + [SetterThrows, Pref="dom.moduleScripts.enabled"] + attribute boolean noModule; [SetterThrows] attribute DOMString charset; [SetterThrows] diff --git a/dom/workers/WorkerPrivate.cpp b/dom/workers/WorkerPrivate.cpp index 27eb570e9..c6ef21f2c 100644 --- a/dom/workers/WorkerPrivate.cpp +++ b/dom/workers/WorkerPrivate.cpp @@ -2543,6 +2543,12 @@ WorkerPrivateParent<Derived>::DisableDebugger() WorkerPrivate* self = ParentAsWorkerPrivate(); + // RegisterDebugger might have been dispatched but not completed. + // Wait for its execution to complete before unregistering. + if (!NS_IsMainThread()) { + self->WaitForIsDebuggerRegistered(true); + } + if (NS_FAILED(UnregisterWorkerDebugger(self))) { NS_WARNING("Failed to unregister worker debugger!"); } |