diff options
31 files changed, 141 insertions, 165 deletions
diff --git a/application/palemoon/components/about/AboutRedirector.cpp b/application/palemoon/components/about/AboutRedirector.cpp index 508202c7d..fbcad6094 100644 --- a/application/palemoon/components/about/AboutRedirector.cpp +++ b/application/palemoon/components/about/AboutRedirector.cpp @@ -70,12 +70,7 @@ static RedirEntry kRedirMap[] = { nsIAboutModule::ALLOW_SCRIPT }, { - "rights", -#ifdef MOZ_OFFICIAL_BRANDING - "chrome://global/content/aboutRights.xhtml", -#else - "chrome://global/content/aboutRights-unbranded.xhtml", -#endif + "rights", "chrome://global/content/aboutRights.xhtml", nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT | nsIAboutModule::MAKE_LINKABLE | nsIAboutModule::ALLOW_SCRIPT diff --git a/application/palemoon/locales/en-US/chrome/browser/browser.dtd b/application/palemoon/locales/en-US/chrome/browser/browser.dtd index 3d5f22b33..2d80c8078 100644 --- a/application/palemoon/locales/en-US/chrome/browser/browser.dtd +++ b/application/palemoon/locales/en-US/chrome/browser/browser.dtd @@ -204,67 +204,12 @@ These should match what Safari and other Apple applications use on OS X Lion. -- <!ENTITY webDeveloperMenu.label "Web Developer"> <!ENTITY webDeveloperMenu.accesskey "W"> -<!ENTITY devtoolsConnect.label "Connect…"> -<!ENTITY devtoolsConnect.accesskey "e"> - <!ENTITY errorConsoleCmd.label "Error Console"> <!ENTITY errorConsoleCmd.accesskey "C"> -<!ENTITY remoteWebConsoleCmd.label "Remote Web Console"> - -<!ENTITY browserConsoleCmd.label "Browser Console"> -<!ENTITY browserConsoleCmd.commandkey "j"> -<!ENTITY browserConsoleCmd.accesskey "B"> - <!ENTITY inspectContextMenu.label "Inspect Element"> <!ENTITY inspectContextMenu.accesskey "Q"> -<!ENTITY responsiveDesignTool.label "Responsive Design View"> -<!ENTITY responsiveDesignTool.accesskey "R"> -<!ENTITY responsiveDesignTool.commandkey "M"> - -<!ENTITY eyedropper.label "Eyedropper"> -<!ENTITY eyedropper.accesskey "Y"> - -<!-- LOCALIZATION NOTE (scratchpad.label): This menu item label appears - - in the Tools menu. See bug 653093. - - The Scratchpad is intended to provide a simple text editor for creating - - and evaluating bits of JavaScript code for the purposes of function - - prototyping, experimentation and convenient scripting. - - - - It's quite possible that you won't have a good analogue for the word - - "Scratchpad" in your locale. You should feel free to find a close - - approximation to it or choose a word (or words) that means - - "simple discardable text editor". --> -<!ENTITY scratchpad.label "Scratchpad"> -<!ENTITY scratchpad.accesskey "s"> -<!ENTITY scratchpad.keycode "VK_F4"> -<!ENTITY scratchpad.keytext "F4"> - -<!-- LOCALIZATION NOTE (chromeDebuggerMenu.label): This is the label for the - - application menu item that opens the browser debugger UI in the Tools menu. --> -<!ENTITY chromeDebuggerMenu.label "Browser Debugger"> - -<!ENTITY devToolbarCloseButton.tooltiptext "Close Developer Toolbar"> -<!ENTITY devToolbarMenu.label "Developer Toolbar"> -<!ENTITY devToolbarMenu.accesskey "v"> -<!ENTITY devAppMgrMenu.label "App Manager"> -<!ENTITY devAppMgrMenu.accesskey "A"> -<!ENTITY webide.label "WebIDE"> -<!ENTITY webide.accesskey "W"> -<!ENTITY webide.keycode "VK_F8"> -<!ENTITY webide.keytext "F8"> -<!ENTITY devToolbar.keycode "VK_F2"> -<!ENTITY devToolbar.keytext "F2"> -<!ENTITY devToolboxMenuItem.label "Toggle Tools"> -<!ENTITY devToolboxMenuItem.accesskey "T"> - -<!ENTITY devToolbarToolsButton.tooltip "Toggle developer tools"> -<!ENTITY devToolbarOtherToolsButton.label "More Tools"> - -<!ENTITY getMoreDevtoolsCmd.label "Get More Tools"> -<!ENTITY getMoreDevtoolsCmd.accesskey "M"> - <!ENTITY fileMenu.label "File"> <!ENTITY fileMenu.accesskey "F"> <!ENTITY newNavigatorCmd.label "New Window"> diff --git a/application/palemoon/themes/linux/browser.css b/application/palemoon/themes/linux/browser.css index 7d353685d..987406264 100644 --- a/application/palemoon/themes/linux/browser.css +++ b/application/palemoon/themes/linux/browser.css @@ -1223,8 +1223,7 @@ toolbar[iconsize="small"] #webrtc-status-button { list-style-image: url(chrome://global/skin/icons/question-64.png); } -.popup-notification-icon[popupid="password-save"], -.popup-notification-icon[popupid="password-change"] { +.popup-notification-icon[popupid="password"] { list-style-image: url(chrome://mozapps/skin/passwordmgr/key-64.png); } diff --git a/application/palemoon/themes/osx/browser.css b/application/palemoon/themes/osx/browser.css index fe4cdbf11..8d3784afd 100644 --- a/application/palemoon/themes/osx/browser.css +++ b/application/palemoon/themes/osx/browser.css @@ -1914,8 +1914,7 @@ toolbarbutton.bookmark-item[dragover="true"][open="true"] { list-style-image: url(chrome://global/skin/icons/question-64.png); } -.popup-notification-icon[popupid="password-save"], -.popup-notification-icon[popupid="password-change"] { +.popup-notification-icon[popupid="password"] { list-style-image: url(chrome://mozapps/skin/passwordmgr/key-64.png); } diff --git a/application/palemoon/themes/windows/browser.css b/application/palemoon/themes/windows/browser.css index 5c044fdd4..1aefa428c 100644 --- a/application/palemoon/themes/windows/browser.css +++ b/application/palemoon/themes/windows/browser.css @@ -2401,8 +2401,7 @@ toolbarbutton.bookmark-item[dragover="true"][open="true"] { list-style-image: url(chrome://global/skin/icons/question-64.png); } -.popup-notification-icon[popupid="password-save"], -.popup-notification-icon[popupid="password-change"] { +.popup-notification-icon[popupid="password"] { list-style-image: url(chrome://mozapps/skin/passwordmgr/key-64.png); } diff --git a/dom/base/File.cpp b/dom/base/File.cpp index 8602a3064..7d86dfe8a 100755 --- a/dom/base/File.cpp +++ b/dom/base/File.cpp @@ -912,7 +912,7 @@ BlobImplFile::GetType(nsAString& aType) new GetTypeRunnable(workerPrivate, this); ErrorResult rv; - runnable->Dispatch(rv); + runnable->Dispatch(Terminating, rv); if (NS_WARN_IF(rv.Failed())) { rv.SuppressException(); } diff --git a/dom/base/WebSocket.cpp b/dom/base/WebSocket.cpp index d85bae82b..af4b7858b 100644 --- a/dom/base/WebSocket.cpp +++ b/dom/base/WebSocket.cpp @@ -340,7 +340,7 @@ WebSocketImpl::PrintErrorOnConsole(const char *aBundleURI, new PrintErrorOnConsoleRunnable(this, aBundleURI, aError, aFormatStrings, aFormatStringsLen); ErrorResult rv; - runnable->Dispatch(rv); + runnable->Dispatch(Killing, rv); // XXXbz this seems totally broken. We should be propagating this out, but // none of our callers really propagate anything usefully. Come to think of // it, why is this a syncrunnable anyway? Can't this be a fire-and-forget @@ -629,7 +629,7 @@ WebSocketImpl::Disconnect() RefPtr<DisconnectInternalRunnable> runnable = new DisconnectInternalRunnable(this); ErrorResult rv; - runnable->Dispatch(rv); + runnable->Dispatch(Killing, rv); // XXXbz this seems totally broken. We should be propagating this out, but // where to, exactly? rv.SuppressException(); @@ -1293,7 +1293,7 @@ WebSocket::ConstructorCommon(const GlobalObject& aGlobal, new InitRunnable(webSocketImpl, !!aTransportProvider, aUrl, protocolArray, nsDependentCString(file.get()), lineno, column, aRv, &connectionFailed); - runnable->Dispatch(aRv); + runnable->Dispatch(Terminating, aRv); } if (NS_WARN_IF(aRv.Failed())) { @@ -1377,7 +1377,7 @@ WebSocket::ConstructorCommon(const GlobalObject& aGlobal, "not yet implemented"); RefPtr<AsyncOpenRunnable> runnable = new AsyncOpenRunnable(webSocket->mImpl, aRv); - runnable->Dispatch(aRv); + runnable->Dispatch(Terminating, aRv); } if (NS_WARN_IF(aRv.Failed())) { diff --git a/dom/broadcastchannel/BroadcastChannel.cpp b/dom/broadcastchannel/BroadcastChannel.cpp index 874212db7..d154b6562 100644 --- a/dom/broadcastchannel/BroadcastChannel.cpp +++ b/dom/broadcastchannel/BroadcastChannel.cpp @@ -369,7 +369,7 @@ BroadcastChannel::Constructor(const GlobalObject& aGlobal, RefPtr<InitializeRunnable> runnable = new InitializeRunnable(workerPrivate, origin, principalInfo, aRv); - runnable->Dispatch(aRv); + runnable->Dispatch(Closing, aRv); } if (aRv.Failed()) { diff --git a/dom/canvas/ImageBitmap.cpp b/dom/canvas/ImageBitmap.cpp index 6588e0aa3..e45cdfc6f 100644 --- a/dom/canvas/ImageBitmap.cpp +++ b/dom/canvas/ImageBitmap.cpp @@ -950,7 +950,7 @@ ImageBitmap::CreateInternal(nsIGlobalObject* aGlobal, ImageData& aImageData, imageSize, aCropRect, getter_AddRefs(data)); - task->Dispatch(aRv); + task->Dispatch(Terminating, aRv); } if (NS_WARN_IF(!data)) { @@ -1377,10 +1377,10 @@ private: RefPtr<DecodeBlobInMainThreadSyncTask> task = new DecodeBlobInMainThreadSyncTask(mWorkerPrivate, *mBlob, mCropRect, getter_AddRefs(data), sourceSize); - task->Dispatch(rv); // This is a synchronous call. + task->Dispatch(Terminating, rv); // This is a synchronous call. + // In case the worker is terminating, this rejection can be handled. if (NS_WARN_IF(rv.Failed())) { - // XXXbz does this really make sense if we're shutting down? Ah, well. mPromise->MaybeReject(rv); return nullptr; } @@ -2104,7 +2104,10 @@ ImageBitmap::Create(nsIGlobalObject* aGlobal, aFormat, aLayout, getter_AddRefs(data)); - task->Dispatch(aRv); + task->Dispatch(Terminating, aRv); + if (aRv.Failed()) { + return promise.forget(); + } } if (NS_WARN_IF(!data)) { diff --git a/dom/fetch/Request.cpp b/dom/fetch/Request.cpp index c119a503e..7ca5b43c4 100644 --- a/dom/fetch/Request.cpp +++ b/dom/fetch/Request.cpp @@ -338,8 +338,7 @@ Request::Constructor(const GlobalObject& aGlobal, if (mode == RequestMode::Navigate || (aInit.IsAnyMemberPresent() && request->Mode() == RequestMode::Navigate)) { - aRv.ThrowTypeError<MSG_INVALID_REQUEST_MODE>(NS_LITERAL_STRING("navigate")); - return nullptr; + mode = RequestMode::Same_origin; } if (aInit.IsAnyMemberPresent()) { @@ -374,11 +373,7 @@ Request::Constructor(const GlobalObject& aGlobal, nsresult rv = principal->CheckMayLoad(uri, /* report */ false, /* allowIfInheritsPrincipal */ false); if (NS_FAILED(rv)) { - nsAutoCString globalOrigin; - principal->GetOrigin(globalOrigin); - aRv.ThrowTypeError<MSG_CROSS_ORIGIN_REFERRER_URL>(referrer, - NS_ConvertUTF8toUTF16(globalOrigin)); - return nullptr; + referrerURL.AssignLiteral(kFETCH_CLIENT_REFERRER_STR); } } } @@ -403,11 +398,10 @@ Request::Constructor(const GlobalObject& aGlobal, // this work in a single sync loop. RefPtr<ReferrerSameOriginChecker> checker = new ReferrerSameOriginChecker(worker, referrerURL, rv); - checker->Dispatch(aRv); - if (aRv.Failed() || NS_FAILED(rv)) { - aRv.ThrowTypeError<MSG_CROSS_ORIGIN_REFERRER_URL>(referrer, - worker->GetLocationInfo().mOrigin); - return nullptr; + IgnoredErrorResult error; + checker->Dispatch(Terminating, error); + if (error.Failed() || NS_FAILED(rv)) { + referrerURL.AssignLiteral(kFETCH_CLIENT_REFERRER_STR); } } } diff --git a/dom/notification/Notification.cpp b/dom/notification/Notification.cpp index 9c0ce2f18..1dd5724e4 100644 --- a/dom/notification/Notification.cpp +++ b/dom/notification/Notification.cpp @@ -1881,7 +1881,7 @@ Notification::GetPermission(nsIGlobalObject* aGlobal, ErrorResult& aRv) MOZ_ASSERT(worker); RefPtr<GetPermissionRunnable> r = new GetPermissionRunnable(worker); - r->Dispatch(aRv); + r->Dispatch(Terminating, aRv); if (aRv.Failed()) { return NotificationPermission::Denied; } @@ -2484,7 +2484,7 @@ NotificationWorkerHolder::Notify(Status aStatus) RefPtr<CloseNotificationRunnable> r = new CloseNotificationRunnable(kungFuDeathGrip); ErrorResult rv; - r->Dispatch(rv); + r->Dispatch(Killing, rv); // XXXbz I'm told throwing and returning false from here is pointless (and // also that doing sync stuff from here is really weird), so I guess we just // suppress the exception on rv, if any. @@ -2627,7 +2627,7 @@ Notification::ShowPersistentNotification(JSContext* aCx, worker->AssertIsOnWorkerThread(); RefPtr<CheckLoadRunnable> loadChecker = new CheckLoadRunnable(worker, NS_ConvertUTF16toUTF8(aScope)); - loadChecker->Dispatch(aRv); + loadChecker->Dispatch(Terminating, aRv); if (aRv.Failed()) { return nullptr; } diff --git a/dom/quota/StorageManager.cpp b/dom/quota/StorageManager.cpp index c8455f0fe..4e9f0cf8c 100644 --- a/dom/quota/StorageManager.cpp +++ b/dom/quota/StorageManager.cpp @@ -335,7 +335,7 @@ StorageManager::Estimate(ErrorResult& aRv) new EstimateWorkerMainThreadRunnable(promiseProxy->GetWorkerPrivate(), promiseProxy); - runnnable->Dispatch(aRv); + runnnable->Dispatch(Terminating, aRv); if (NS_WARN_IF(aRv.Failed())) { return nullptr; } diff --git a/dom/security/nsContentSecurityManager.cpp b/dom/security/nsContentSecurityManager.cpp index 4ee9b4877..570730312 100644 --- a/dom/security/nsContentSecurityManager.cpp +++ b/dom/security/nsContentSecurityManager.cpp @@ -303,7 +303,7 @@ DoContentSecurityChecks(nsIChannel* aChannel, nsILoadInfo* aLoadInfo) case nsIContentPolicy::TYPE_DOCUMENT: { mimeTypeGuess = EmptyCString(); - requestingContext = aLoadInfo->LoadingNode(); + requestingContext = aLoadInfo->ContextForTopLevelLoad(); break; } diff --git a/dom/tests/mochitest/fetch/test_request.js b/dom/tests/mochitest/fetch/test_request.js index 5be361a46..405767b50 100644 --- a/dom/tests/mochitest/fetch/test_request.js +++ b/dom/tests/mochitest/fetch/test_request.js @@ -152,12 +152,9 @@ function testHeaderGuard() { } function testMode() { - try { - var req = new Request("http://example.com", {mode: "navigate"}); - ok(false, "Creating a Request with navigate RequestMode should throw a TypeError"); - } catch(e) { - is(e.name, "TypeError", "Creating a Request with navigate RequestMode should throw a TypeError"); - } + var req = new Request("http://example.com", {mode: "navigate"}); + ok(true, "Creating a Request with navigate RequestMode should not throw."); + is(req.mode, "same-origin", "Request mode becomes same-origin"); } function testMethod() { diff --git a/dom/url/URL.cpp b/dom/url/URL.cpp index c8724c359..04f5ec137 100644 --- a/dom/url/URL.cpp +++ b/dom/url/URL.cpp @@ -1113,6 +1113,12 @@ public: return true; } + void + Dispatch(ErrorResult& aRv) + { + WorkerMainThreadRunnable::Dispatch(Terminating, aRv); + } + private: nsAString& mValue; GetterType mType; @@ -1213,6 +1219,12 @@ public: return mFailed; } + void + Dispatch(ErrorResult& aRv) + { + WorkerMainThreadRunnable::Dispatch(Terminating, aRv); + } + private: const nsString mValue; SetterType mType; @@ -1224,7 +1236,7 @@ already_AddRefed<URLWorker> FinishConstructor(JSContext* aCx, WorkerPrivate* aPrivate, ConstructorRunnable* aRunnable, ErrorResult& aRv) { - aRunnable->Dispatch(aRv); + aRunnable->Dispatch(Terminating, aRv); if (NS_WARN_IF(aRv.Failed())) { return nullptr; } @@ -1302,7 +1314,7 @@ URLWorker::CreateObjectURL(const GlobalObject& aGlobal, Blob& aBlob, RefPtr<CreateURLRunnable> runnable = new CreateURLRunnable(workerPrivate, blobImpl, aOptions, aResult); - runnable->Dispatch(aRv); + runnable->Dispatch(Terminating, aRv); if (NS_WARN_IF(aRv.Failed())) { return; } @@ -1325,7 +1337,7 @@ URLWorker::RevokeObjectURL(const GlobalObject& aGlobal, const nsAString& aUrl, RefPtr<RevokeURLRunnable> runnable = new RevokeURLRunnable(workerPrivate, aUrl); - runnable->Dispatch(aRv); + runnable->Dispatch(Terminating, aRv); if (NS_WARN_IF(aRv.Failed())) { return; } @@ -1348,7 +1360,7 @@ URLWorker::IsValidURL(const GlobalObject& aGlobal, const nsAString& aUrl, RefPtr<IsValidURLRunnable> runnable = new IsValidURLRunnable(workerPrivate, aUrl); - runnable->Dispatch(aRv); + runnable->Dispatch(Terminating, aRv); if (NS_WARN_IF(aRv.Failed())) { return false; } diff --git a/dom/webidl/Document.webidl b/dom/webidl/Document.webidl index 0b8c278fe..904b1fb77 100644 --- a/dom/webidl/Document.webidl +++ b/dom/webidl/Document.webidl @@ -277,8 +277,11 @@ partial interface Document { // https://w3c.github.io/page-visibility/#extensions-to-the-document-interface partial interface Document { + [Pref="dom.visibilityAPI.enabled"] readonly attribute boolean hidden; + [Pref="dom.visibilityAPI.enabled"] readonly attribute VisibilityState visibilityState; + [Pref="dom.visibilityAPI.enabled"] attribute EventHandler onvisibilitychange; }; diff --git a/dom/workers/RuntimeService.cpp b/dom/workers/RuntimeService.cpp index ad95d4896..e1910536f 100644 --- a/dom/workers/RuntimeService.cpp +++ b/dom/workers/RuntimeService.cpp @@ -587,7 +587,7 @@ ContentSecurityPolicyAllows(JSContext* aCx) new LogViolationDetailsRunnable(worker, fileName, lineNum); ErrorResult rv; - runnable->Dispatch(rv); + runnable->Dispatch(Killing, rv); if (NS_WARN_IF(rv.Failed())) { rv.SuppressException(); } diff --git a/dom/workers/ScriptLoader.cpp b/dom/workers/ScriptLoader.cpp index 46545e737..56b18441e 100644 --- a/dom/workers/ScriptLoader.cpp +++ b/dom/workers/ScriptLoader.cpp @@ -2118,12 +2118,16 @@ LoadAllScripts(WorkerPrivate* aWorkerPrivate, aWorkerPrivate->AssertIsOnWorkerThread(); NS_ASSERTION(!aLoadInfos.IsEmpty(), "Bad arguments!"); - AutoSyncLoopHolder syncLoop(aWorkerPrivate); + AutoSyncLoopHolder syncLoop(aWorkerPrivate, Terminating); + nsCOMPtr<nsIEventTarget> syncLoopTarget = syncLoop.GetEventTarget(); + if (!syncLoopTarget) { + aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR); + return; + } RefPtr<ScriptLoaderRunnable> loader = - new ScriptLoaderRunnable(aWorkerPrivate, syncLoop.EventTarget(), - aLoadInfos, aIsMainScript, aWorkerScriptType, - aRv); + new ScriptLoaderRunnable(aWorkerPrivate, syncLoopTarget, aLoadInfos, + aIsMainScript, aWorkerScriptType, aRv); NS_ASSERTION(aLoadInfos.IsEmpty(), "Should have swapped!"); @@ -2184,7 +2188,7 @@ ChannelFromScriptURLWorkerThread(JSContext* aCx, new ChannelGetterRunnable(aParent, aScriptURL, aChannel); ErrorResult rv; - getter->Dispatch(rv); + getter->Dispatch(Terminating, rv); if (rv.Failed()) { NS_ERROR("Failed to dispatch!"); return rv.StealNSResult(); diff --git a/dom/workers/WorkerNavigator.cpp b/dom/workers/WorkerNavigator.cpp index 682c7a22c..f79896881 100644 --- a/dom/workers/WorkerNavigator.cpp +++ b/dom/workers/WorkerNavigator.cpp @@ -152,7 +152,7 @@ WorkerNavigator::GetUserAgent(nsString& aUserAgent, ErrorResult& aRv) const RefPtr<GetUserAgentRunnable> runnable = new GetUserAgentRunnable(workerPrivate, aUserAgent); - runnable->Dispatch(aRv); + runnable->Dispatch(Terminating, aRv); } uint64_t diff --git a/dom/workers/WorkerPrivate.cpp b/dom/workers/WorkerPrivate.cpp index 8848e881a..612090027 100644 --- a/dom/workers/WorkerPrivate.cpp +++ b/dom/workers/WorkerPrivate.cpp @@ -5446,10 +5446,18 @@ WorkerPrivate::CancelAllTimeouts() } already_AddRefed<nsIEventTarget> -WorkerPrivate::CreateNewSyncLoop() +WorkerPrivate::CreateNewSyncLoop(Status aFailStatus) { AssertIsOnWorkerThread(); + { + MutexAutoLock lock(mMutex); + + if (mStatus >= aFailStatus) { + return nullptr; + } + } + nsCOMPtr<nsIThreadInternal> thread = do_QueryInterface(NS_GetCurrentThread()); MOZ_ASSERT(thread); diff --git a/dom/workers/WorkerPrivate.h b/dom/workers/WorkerPrivate.h index 28283bed7..20a530205 100644 --- a/dom/workers/WorkerPrivate.h +++ b/dom/workers/WorkerPrivate.h @@ -1442,8 +1442,11 @@ private: memcpy(aPreferences, mPreferences, WORKERPREF_COUNT * sizeof(bool)); } + // If the worker shutdown status is equal or greater then aFailStatus, this + // operation will fail and nullptr will be returned. See WorkerHolder.h for + // more information about the correct value to use. already_AddRefed<nsIEventTarget> - CreateNewSyncLoop(); + CreateNewSyncLoop(Status aFailStatus); bool RunCurrentSyncLoop(); @@ -1518,9 +1521,11 @@ class AutoSyncLoopHolder uint32_t mIndex; public: - explicit AutoSyncLoopHolder(WorkerPrivate* aWorkerPrivate) + // See CreateNewSyncLoop() for more information about the correct value to use + // for aFailStatus. + AutoSyncLoopHolder(WorkerPrivate* aWorkerPrivate, Status aFailStatus) : mWorkerPrivate(aWorkerPrivate) - , mTarget(aWorkerPrivate->CreateNewSyncLoop()) + , mTarget(aWorkerPrivate->CreateNewSyncLoop(aFailStatus)) , mIndex(aWorkerPrivate->mSyncLoopStack.Length() - 1) { aWorkerPrivate->AssertIsOnWorkerThread(); @@ -1528,7 +1533,7 @@ public: ~AutoSyncLoopHolder() { - if (mWorkerPrivate) { + if (mWorkerPrivate && mTarget) { mWorkerPrivate->AssertIsOnWorkerThread(); mWorkerPrivate->StopSyncLoop(mTarget, false); mWorkerPrivate->DestroySyncLoop(mIndex); @@ -1547,8 +1552,9 @@ public: } nsIEventTarget* - EventTarget() const + GetEventTarget() const { + // This can be null if CreateNewSyncLoop() fails. return mTarget; } }; diff --git a/dom/workers/WorkerRunnable.cpp b/dom/workers/WorkerRunnable.cpp index 1e16d7254..6bbe40f66 100644 --- a/dom/workers/WorkerRunnable.cpp +++ b/dom/workers/WorkerRunnable.cpp @@ -568,15 +568,20 @@ WorkerMainThreadRunnable::WorkerMainThreadRunnable(WorkerPrivate* aWorkerPrivate } void -WorkerMainThreadRunnable::Dispatch(ErrorResult& aRv) +WorkerMainThreadRunnable::Dispatch(Status aFailStatus, ErrorResult& aRv) { mWorkerPrivate->AssertIsOnWorkerThread(); TimeStamp startTime = TimeStamp::NowLoRes(); - AutoSyncLoopHolder syncLoop(mWorkerPrivate); + AutoSyncLoopHolder syncLoop(mWorkerPrivate, aFailStatus); - mSyncLoopTarget = syncLoop.EventTarget(); + mSyncLoopTarget = syncLoop.GetEventTarget(); + if (!mSyncLoopTarget) { + // SyncLoop creation can fail if the worker is shutting down. + aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR); + return; + } DebugOnly<nsresult> rv = mWorkerPrivate->DispatchToMainThread(this); MOZ_ASSERT(NS_SUCCEEDED(rv), @@ -621,7 +626,7 @@ bool WorkerCheckAPIExposureOnMainThreadRunnable::Dispatch() { ErrorResult rv; - WorkerMainThreadRunnable::Dispatch(rv); + WorkerMainThreadRunnable::Dispatch(Terminating, rv); bool ok = !rv.Failed(); rv.SuppressException(); return ok; diff --git a/dom/workers/WorkerRunnable.h b/dom/workers/WorkerRunnable.h index c65060f44..8249a8053 100644 --- a/dom/workers/WorkerRunnable.h +++ b/dom/workers/WorkerRunnable.h @@ -401,9 +401,12 @@ protected: public: // Dispatch the runnable to the main thread. If dispatch to main thread - // fails, or if the worker is shut down while dispatching, an error will be - // reported on aRv. In that case the error MUST be propagated out to script. - void Dispatch(ErrorResult& aRv); + // fails, or if the worker is in a state equal or greater of aFailStatus, an + // error will be reported on aRv. Normally you want to use 'Terminating' for + // aFailStatus, except if you want an infallible runnable. In this case, use + // 'Killing'. + // In that case the error MUST be propagated out to script. + void Dispatch(Status aFailStatus, ErrorResult& aRv); private: NS_IMETHOD Run() override; diff --git a/dom/workers/test/serviceworkers/fetch_event_worker.js b/dom/workers/test/serviceworkers/fetch_event_worker.js index 1caef71e8..895128e2c 100644 --- a/dom/workers/test/serviceworkers/fetch_event_worker.js +++ b/dom/workers/test/serviceworkers/fetch_event_worker.js @@ -148,28 +148,21 @@ onfetch = function(ev) { } else if (ev.request.url.includes("navigate.html")) { - var navigateModeCorrectlyChecked = false; var requests = [ // should not throw new Request(ev.request), new Request(ev.request, undefined), new Request(ev.request, null), new Request(ev.request, {}), new Request(ev.request, {someUnrelatedProperty: 42}), + new Request(ev.request, {method: "GET"}), ]; - try { - var request3 = new Request(ev.request, {method: "GET"}); // should throw - } catch(e) { - navigateModeCorrectlyChecked = requests[0].mode == "navigate"; - } - if (navigateModeCorrectlyChecked) { - ev.respondWith(Promise.resolve( - new Response("<script>window.frameElement.test_result = true;</script>", { - headers : { - "Content-Type": "text/html" - } - }) - )); - } + ev.respondWith(Promise.resolve( + new Response("<script>window.frameElement.test_result = true;</script>", { + headers : { + "Content-Type": "text/html" + } + }) + )); } else if (ev.request.url.includes("nonexistent_worker_script.js")) { diff --git a/dom/xhr/XMLHttpRequestWorker.cpp b/dom/xhr/XMLHttpRequestWorker.cpp index e7193a279..c9e892f26 100644 --- a/dom/xhr/XMLHttpRequestWorker.cpp +++ b/dom/xhr/XMLHttpRequestWorker.cpp @@ -208,9 +208,9 @@ public: } void - Dispatch(ErrorResult& aRv) + Dispatch(Status aFailStatus, ErrorResult& aRv) { - WorkerMainThreadRunnable::Dispatch(aRv); + WorkerMainThreadRunnable::Dispatch(aFailStatus, aRv); if (NS_WARN_IF(aRv.Failed())) { return; } @@ -1633,11 +1633,10 @@ XMLHttpRequestWorker::ReleaseProxy(ReleaseType aType) new SyncTeardownRunnable(mWorkerPrivate, mProxy); mProxy = nullptr; - ErrorResult forAssertionsOnly; - runnable->Dispatch(forAssertionsOnly); - if (forAssertionsOnly.Failed()) { - NS_ERROR("Failed to dispatch teardown runnable!"); - } + IgnoredErrorResult forAssertionsOnly; + // This runnable _must_ be executed. + runnable->Dispatch(Dead, forAssertionsOnly); + MOZ_DIAGNOSTIC_ASSERT(!forAssertionsOnly.Failed()); } } } @@ -1804,8 +1803,12 @@ XMLHttpRequestWorker::SendInternal(SendRunnable* aRunnable, nsCOMPtr<nsIEventTarget> syncLoopTarget; bool isSyncXHR = mProxy->mIsSyncXHR; if (isSyncXHR) { - autoSyncLoop.emplace(mWorkerPrivate); - syncLoopTarget = autoSyncLoop->EventTarget(); + autoSyncLoop.emplace(mWorkerPrivate, Terminating); + syncLoopTarget = autoSyncLoop->GetEventTarget(); + if (!syncLoopTarget) { + aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR); + return; + } } mProxy->mOuterChannelId++; @@ -1815,7 +1818,7 @@ XMLHttpRequestWorker::SendInternal(SendRunnable* aRunnable, mStateData.mFlagSend = true; - aRunnable->Dispatch(aRv); + aRunnable->Dispatch(Terminating, aRv); if (aRv.Failed()) { // Dispatch() may have spun the event loop and we may have already unrooted. // If so we don't want autoUnpin to try again. @@ -1889,7 +1892,7 @@ XMLHttpRequestWorker::Open(const nsACString& aMethod, mTimeout, mResponseType); ++mProxy->mOpenCount; - runnable->Dispatch(aRv); + runnable->Dispatch(Terminating, aRv); if (aRv.Failed()) { if (mProxy && !--mProxy->mOpenCount) { ReleaseProxy(); @@ -1926,7 +1929,7 @@ XMLHttpRequestWorker::SetRequestHeader(const nsACString& aHeader, RefPtr<SetRequestHeaderRunnable> runnable = new SetRequestHeaderRunnable(mWorkerPrivate, mProxy, aHeader, aValue); - runnable->Dispatch(aRv); + runnable->Dispatch(Terminating, aRv); } void @@ -1949,7 +1952,7 @@ XMLHttpRequestWorker::SetTimeout(uint32_t aTimeout, ErrorResult& aRv) RefPtr<SetTimeoutRunnable> runnable = new SetTimeoutRunnable(mWorkerPrivate, mProxy, aTimeout); - runnable->Dispatch(aRv); + runnable->Dispatch(Terminating, aRv); } void @@ -1972,7 +1975,7 @@ XMLHttpRequestWorker::SetWithCredentials(bool aWithCredentials, ErrorResult& aRv RefPtr<SetWithCredentialsRunnable> runnable = new SetWithCredentialsRunnable(mWorkerPrivate, mProxy, aWithCredentials); - runnable->Dispatch(aRv); + runnable->Dispatch(Terminating, aRv); } void @@ -1997,7 +2000,7 @@ XMLHttpRequestWorker::SetMozBackgroundRequest(bool aBackgroundRequest, RefPtr<SetBackgroundRequestRunnable> runnable = new SetBackgroundRequestRunnable(mWorkerPrivate, mProxy, aBackgroundRequest); - runnable->Dispatch(aRv); + runnable->Dispatch(Terminating, aRv); } XMLHttpRequestUpload* @@ -2265,7 +2268,7 @@ XMLHttpRequestWorker::Abort(ErrorResult& aRv) mProxy->mOuterEventStreamId++; RefPtr<AbortRunnable> runnable = new AbortRunnable(mWorkerPrivate, mProxy); - runnable->Dispatch(aRv); + runnable->Dispatch(Terminating, aRv); } void @@ -2288,7 +2291,7 @@ XMLHttpRequestWorker::GetResponseHeader(const nsACString& aHeader, RefPtr<GetResponseHeaderRunnable> runnable = new GetResponseHeaderRunnable(mWorkerPrivate, mProxy, aHeader, responseHeader); - runnable->Dispatch(aRv); + runnable->Dispatch(Terminating, aRv); if (aRv.Failed()) { return; } @@ -2314,7 +2317,7 @@ XMLHttpRequestWorker::GetAllResponseHeaders(nsACString& aResponseHeaders, nsCString responseHeaders; RefPtr<GetAllResponseHeadersRunnable> runnable = new GetAllResponseHeadersRunnable(mWorkerPrivate, mProxy, responseHeaders); - runnable->Dispatch(aRv); + runnable->Dispatch(Terminating, aRv); if (aRv.Failed()) { return; } @@ -2346,7 +2349,7 @@ XMLHttpRequestWorker::OverrideMimeType(const nsAString& aMimeType, ErrorResult& RefPtr<OverrideMimeTypeRunnable> runnable = new OverrideMimeTypeRunnable(mWorkerPrivate, mProxy, aMimeType); - runnable->Dispatch(aRv); + runnable->Dispatch(Terminating, aRv); } void @@ -2382,7 +2385,7 @@ XMLHttpRequestWorker::SetResponseType(XMLHttpRequestResponseType aResponseType, RefPtr<SetResponseTypeRunnable> runnable = new SetResponseTypeRunnable(mWorkerPrivate, mProxy, aResponseType); - runnable->Dispatch(aRv); + runnable->Dispatch(Terminating, aRv); if (aRv.Failed()) { return; } diff --git a/gfx/thebes/gfxUtils.cpp b/gfx/thebes/gfxUtils.cpp index 313372ebc..401bceaa9 100644 --- a/gfx/thebes/gfxUtils.cpp +++ b/gfx/thebes/gfxUtils.cpp @@ -1477,7 +1477,7 @@ gfxUtils::ThreadSafeGetFeatureStatus(const nsCOMPtr<nsIGfxInfo>& gfxInfo, status); ErrorResult rv; - runnable->Dispatch(rv); + runnable->Dispatch(dom::workers::Terminating, rv); if (rv.Failed()) { // XXXbz This is totally broken, since we're supposed to just abort // everything up the callstack but the callers basically eat the diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js index d135f9309..beab06aff 100644 --- a/modules/libpref/init/all.js +++ b/modules/libpref/init/all.js @@ -155,6 +155,9 @@ pref("dom.select_events.textcontrols.enabled", true); pref("dom.select_events.textcontrols.enabled", false); #endif +// Whether or not the document visbility API is enabled +pref("dom.visibilityAPI.enabled", true); + // Whether or not Web Workers are enabled. pref("dom.workers.enabled", true); diff --git a/toolkit/components/thumbnails/BackgroundPageThumbs.jsm b/toolkit/components/thumbnails/BackgroundPageThumbs.jsm index fded51cea..bd52e77e9 100644 --- a/toolkit/components/thumbnails/BackgroundPageThumbs.jsm +++ b/toolkit/components/thumbnails/BackgroundPageThumbs.jsm @@ -468,7 +468,12 @@ Capture.prototype = { }; if (!data) { - done(); + // If this background attempt failed, cause a dummy file to be saved, so + // that gets loaded instead of attempting again (and again). + // XXX: Perhaps we can create a placeholder image to use instead of "null" + // here, so it has something to show to the user? + PageThumbs._store(this.url, this.url, null, true) + .then(done, done); return; } diff --git a/toolkit/content/aboutRights.xhtml b/toolkit/content/aboutRights.xhtml index 0d42e6fad..cdd94e13c 100644 --- a/toolkit/content/aboutRights.xhtml +++ b/toolkit/content/aboutRights.xhtml @@ -32,9 +32,9 @@ <!-- Point 2 discusses Mozilla trademarks, and isn't needed when the build is unbranded. - Point 3 discusses privacy policy, unbranded builds get a placeholder (for the vendor to replace) - Point 4 discusses web service terms, unbranded builds gets a placeholder (for the vendor to replace) --> - <li>&rights.intro-point2-a;<a href="http://www.mozilla.org/foundation/trademarks/policy.html">&rights.intro-point2-b;</a>&rights.intro-point2-c;</li> + <li>&rights.intro-point2-a;<a href="http://www.palemoon.org/branding.shtml">&rights.intro-point2-b;</a>&rights.intro-point2-c;</li> <li>&rights.intro-point2.5;</li> - <li>&rights2.intro-point3a;<a href="https://www.mozilla.org/legal/privacy/firefox.html">&rights2.intro-point3b;</a>&rights.intro-point3c;</li> + <li>&rights2.intro-point3a;<a href="http://www.palemoon.org/privacy.shtml">&rights2.intro-point3b;</a>&rights.intro-point3c;</li> <li>&rights2.intro-point4a;<a href="about:rights#webservices" onclick="showServices();">&rights.intro-point4b;</a>&rights.intro-point4c;</li> <li>&rights.intro-point5;</li> </ul> diff --git a/toolkit/content/jar.mn b/toolkit/content/jar.mn index 0c0f9494a..e1d432cb3 100644 --- a/toolkit/content/jar.mn +++ b/toolkit/content/jar.mn @@ -12,7 +12,7 @@ toolkit.jar: content/global/about.xhtml content/global/aboutAbout.js content/global/aboutAbout.xhtml -#ifdef MC_OFFICIAL +#ifdef MOZ_OFFICIAL_BRANDING * content/global/aboutRights.xhtml #else * content/global/aboutRights.xhtml (aboutRights-unbranded.xhtml) diff --git a/toolkit/locales/en-US/chrome/mozapps/extensions/extensions.properties b/toolkit/locales/en-US/chrome/mozapps/extensions/extensions.properties index 9d976e0e3..370198f56 100644 --- a/toolkit/locales/en-US/chrome/mozapps/extensions/extensions.properties +++ b/toolkit/locales/en-US/chrome/mozapps/extensions/extensions.properties @@ -169,7 +169,7 @@ cmd.purchaseAddon.accesskey=u eulaHeader=%S requires that you accept the following End User License Agreement before installation can proceed: type.extension.name=Extensions -type.theme.name=Appearance +type.theme.name=Themes type.locale.name=Languages type.plugin.name=Plugins type.dictionary.name=Dictionaries |