From 4f15bc133edc78e0cf696f2287afd3cf047c7c93 Mon Sep 17 00:00:00 2001 From: roytam1 Date: Fri, 25 Nov 2022 11:31:54 +0800 Subject: [PATCH] import changes from `dev' branch of rmottola/Arctic-Fox: - Bug 1072150 - Don't examine the subject principal in CheckSameOrigin. r=bz (60cbce0bd4) - Bug 633154. When alerts/prompts/confirms are suppressed, just return silently instead of throwing. r=sicking (a9b5bffb50) - Bug 1199295 - Pass right loadingPrincipal to uriloader/prefetch - dom changes (r=smaug) (c83e28c82f) - Bug 1206559, forward PuppetWidget::SetFocus request to the parent process, r=smaug (545b4befd2) - Bug 1171234 - Include triggering node in load info when doing prefetching (r=ckerschb) (28626724ea) - Bug 1192948 - Use channel->ascynOpen2 in uriloader/prefetch (r=smaug) (24cde65def) - Bug 1199295 - Pass right loadingPrincipal to uriloader/prefetch (r=mayhemer) (0a70254f49) - Bug 1111581 - Fix prefetch for e10s. r=mayhemer (1743b37e85) - adapted Bug 1172396 - Check for GMP resources from chrome process instead of content (71d438785f) - Bug 1184276 - Add some logging and don't bail if we can't find an nsPluginTag in RecvGetBlocklistState to try and get more diagnostic info r=billm (963ec63ad3) - Bug 1194897 - Copy parent window chromeFlags when instantiating a new TabParent in the parent process. r=smaug (296cafaacc) - Bug 1181467 - Fix mime type checking while copying image. r=Enn (2c77c687e5) - Bug 1139860 - Fix xpcshell content process timeout crashes (r=jimm) (e594a31bff) - Bug 1207490 - Part 1: Remove use of expression closure from browser/base/. r=dao (ef5ba24cbe) - Bug 1059014 (part 1) - Remove support for max line box width. r=dbaron. (eaf2e94721) --- .../base/content/browser-gestureSupport.js | 2 +- browser/base/content/browser-places.js | 4 +- browser/base/content/browser.js | 16 +- browser/base/content/sanitize.js | 4 +- browser/base/content/sync/setup.js | 10 +- browser/base/content/tabbrowser.xml | 12 +- browser/base/content/urlbarBindings.xml | 2 +- docshell/base/nsIContentViewer.idl | 9 - dom/base/nsContentSink.cpp | 3 +- dom/base/nsContentUtils.cpp | 3 - dom/base/nsGlobalWindow.cpp | 22 +- dom/ipc/ContentChild.cpp | 1 + dom/ipc/ContentChild.h | 1 + dom/ipc/ContentParent.cpp | 50 ++++- dom/ipc/ContentParent.h | 7 + dom/ipc/PContent.ipdl | 8 +- dom/offline/nsDOMOfflineResourceList.cpp | 7 +- dom/offline/nsDOMOfflineResourceList.h | 2 + layout/base/nsDocumentViewer.cpp | 30 --- layout/base/nsIPresShell.h | 10 - layout/base/nsPresShell.cpp | 15 -- layout/base/tests/mochitest.ini | 1 - layout/base/tests/test_maxLineBoxWidth.html | 191 ------------------ layout/forms/test/mochitest.ini | 2 +- layout/generic/nsLineLayout.cpp | 17 -- .../specialpowers/content/specialpowersAPI.js | 8 - .../prefetch/OfflineCacheUpdateChild.cpp | 15 +- uriloader/prefetch/OfflineCacheUpdateChild.h | 1 + uriloader/prefetch/OfflineCacheUpdateGlue.cpp | 7 +- uriloader/prefetch/OfflineCacheUpdateGlue.h | 8 +- .../prefetch/OfflineCacheUpdateParent.cpp | 8 +- uriloader/prefetch/OfflineCacheUpdateParent.h | 2 + uriloader/prefetch/nsIOfflineCacheUpdate.idl | 19 +- uriloader/prefetch/nsOfflineCacheUpdate.cpp | 48 +++-- uriloader/prefetch/nsOfflineCacheUpdate.h | 15 +- .../prefetch/nsOfflineCacheUpdateService.cpp | 29 ++- uriloader/prefetch/nsPrefetchService.cpp | 45 ++--- widget/PuppetWidget.cpp | 6 +- 38 files changed, 241 insertions(+), 399 deletions(-) delete mode 100644 layout/base/tests/test_maxLineBoxWidth.html diff --git a/browser/base/content/browser-gestureSupport.js b/browser/base/content/browser-gestureSupport.js index d88f47c793..17e441a448 100644 --- a/browser/base/content/browser-gestureSupport.js +++ b/browser/base/content/browser-gestureSupport.js @@ -57,7 +57,7 @@ let gGestureSupport = { } // Create a preference object with some defaults - let def = function(aThreshold, aLatched) + let def = (aThreshold, aLatched) => ({ threshold: aThreshold, latched: !!aLatched }); switch (aEvent.type) { diff --git a/browser/base/content/browser-places.js b/browser/base/content/browser-places.js index 2e74386e88..3323ee835d 100644 --- a/browser/base/content/browser-places.js +++ b/browser/base/content/browser-places.js @@ -30,7 +30,7 @@ var StarUI = { get _blockedCommands() { delete this._blockedCommands; return this._blockedCommands = - ["cmd_close", "cmd_closeWindow"].map(function (id) this._element(id), this); + ["cmd_close", "cmd_closeWindow"].map(id => this._element(id)); }, _blockCommands: function SU__blockCommands() { @@ -1202,7 +1202,7 @@ let BookmarkingUI = { // calls back. For such an edge case, retain all unique entries from both // arrays. this._itemIds = this._itemIds.filter( - function (id) aItemIds.indexOf(id) == -1 + id => aItemIds.indexOf(id) == -1 ).concat(aItemIds); this._updateStar(); diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js index 1bfbfd05b6..b4bcf4d86b 100644 --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -1505,7 +1505,7 @@ var gBrowserInit = { let itemArray = itemBranch.getChildList(""); // See if any privacy.item prefs are set - let doMigrate = itemArray.some(function (name) itemBranch.prefHasUserValue(name)); + let doMigrate = itemArray.some(name => itemBranch.prefHasUserValue(name)); // Or if sanitizeOnShutdown is set if (!doMigrate) doMigrate = gPrefService.getBoolPref("privacy.sanitize.sanitizeOnShutdown"); @@ -2674,7 +2674,7 @@ function FillInHTMLTooltip(tipElement) } var browserDragAndDrop = { - canDropLink: function (aEvent) Services.droppedLinkHandler.canDropLink(aEvent, true), + canDropLink: aEvent => Services.droppedLinkHandler.canDropLink(aEvent, true), dragOver: function (aEvent) { @@ -2931,7 +2931,7 @@ const BrowserSearch = { // Check to see whether we've already added an engine with this title if (browser.engines) { - if (browser.engines.some(function (e) e.title == engine.title)) + if (browser.engines.some(e => e.title == engine.title)) return; } @@ -4029,7 +4029,9 @@ var LinkTargetDisplay = { DELAY_HIDE: 250, _timer: 0, - get _isVisible () XULBrowserWindow.statusTextField.label != "", + get _isVisible () { + return XULBrowserWindow.statusTextField.label != ""; + }, update: function () { clearTimeout(this._timer); @@ -4363,7 +4365,7 @@ nsBrowserAccess.prototype = { }, isTabContentWindow: function (aWindow) { - return gBrowser.browsers.some(function (browser) browser.contentWindow == aWindow); + return gBrowser.browsers.some(browser => browser.contentWindow == aWindow); } } @@ -4563,8 +4565,8 @@ var TabsInTitlebar = { }, _update: function () { - function $(id) document.getElementById(id); - function rect(ele) ele.getBoundingClientRect(); + let $ = id => document.getElementById(id); + let rect = ele => ele.getBoundingClientRect(); if (!this._initialized || window.fullScreen) return; diff --git a/browser/base/content/sanitize.js b/browser/base/content/sanitize.js index fbfdcc0c0b..7bc0b8b7e6 100644 --- a/browser/base/content/sanitize.js +++ b/browser/base/content/sanitize.js @@ -297,8 +297,8 @@ Sanitizer.prototype = { let count = 0; let countDone = { - handleResult : function(aResult) count = aResult, - handleError : function(aError) Components.utils.reportError(aError), + handleResult : aResult => count = aResult, + handleError : aError => Components.utils.reportError(aError), handleCompletion : function(aReason) { aCallback("formdata", aReason == 0 && count > 0, aArg); } }; diff --git a/browser/base/content/sync/setup.js b/browser/base/content/sync/setup.js index 99faa038e4..50cb3fd29d 100644 --- a/browser/base/content/sync/setup.js +++ b/browser/base/content/sync/setup.js @@ -2,10 +2,10 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -const Ci = Components.interfaces; -const Cc = Components.classes; -const Cr = Components.results; -const Cu = Components.utils; +var Ci = Components.interfaces; +var Cc = Components.classes; +var Cr = Components.results; +var Cu = Components.utils; // page consts @@ -78,7 +78,7 @@ var gSyncSetup = { }); }; addRem(true); - window.addEventListener("unload", function() addRem(false), false); + window.addEventListener("unload", () => addRem(false), false); window.setTimeout(function () { // Force Service to be loaded so that engines are registered. diff --git a/browser/base/content/tabbrowser.xml b/browser/base/content/tabbrowser.xml index a5634ada57..d271e12125 100644 --- a/browser/base/content/tabbrowser.xml +++ b/browser/base/content/tabbrowser.xml @@ -60,7 +60,7 @@ !tab.hidden && !tab.closing); return this._visibleTabs; ]]> @@ -2357,7 +2357,7 @@ l != aListener); ]]> @@ -2374,7 +2374,7 @@ l != aListener); ]]> @@ -2491,7 +2491,7 @@ tab.linkedBrowser)); ]]> @@ -4334,7 +4334,9 @@ // positioned relative to the corner of the new window created upon // dragend such that the mouse appears to have the same position // relative to the corner of the dragged tab. - function clientX(ele) ele.getBoundingClientRect().left; + function clientX(ele) { + return ele.getBoundingClientRect().left; + } let tabOffsetX = clientX(tab) - clientX(this); tab._dragData = { offsetX: event.screenX - window.screenX - tabOffsetX, diff --git a/browser/base/content/urlbarBindings.xml b/browser/base/content/urlbarBindings.xml index 037dd5a3ad..7501b493bc 100644 --- a/browser/base/content/urlbarBindings.xml +++ b/browser/base/content/urlbarBindings.xml @@ -527,7 +527,7 @@ // are hard to read when encoded if (!uri.schemeIs("javascript") && !uri.schemeIs("data")) { // Parentheses are known to confuse third-party applications (bug 458565). - selectedVal = uri.spec.replace(/[()]/g, function (c) escape(c)); + selectedVal = uri.spec.replace(/[()]/g, c => escape(c)); } return selectedVal; diff --git a/docshell/base/nsIContentViewer.idl b/docshell/base/nsIContentViewer.idl index 507a5f41e2..03d9a6163b 100644 --- a/docshell/base/nsIContentViewer.idl +++ b/docshell/base/nsIContentViewer.idl @@ -245,15 +245,6 @@ interface nsIContentViewer : nsISupports */ [noscript] void appendSubtree(in nsIContentViewerTArray array); - /** - * Set the maximum line width for the document. - * NOTE: This will generate a reflow! - * - * @param maxLineWidth The maximum width of any line boxes on the page, - * in CSS pixels. - */ - void changeMaxLineBoxWidth(in int32_t maxLineBoxWidth); - /** * Instruct the refresh driver to discontinue painting until further * notice. diff --git a/dom/base/nsContentSink.cpp b/dom/base/nsContentSink.cpp index e954cdaa5a..ddc9b47385 100644 --- a/dom/base/nsContentSink.cpp +++ b/dom/base/nsContentSink.cpp @@ -1174,7 +1174,8 @@ nsContentSink::ProcessOfflineManifest(const nsAString& aManifestSpec) if (updateService) { nsCOMPtr domdoc = do_QueryInterface(mDocument); - updateService->ScheduleOnDocumentStop(manifestURI, mDocumentURI, domdoc); + updateService->ScheduleOnDocumentStop(manifestURI, mDocumentURI, + mDocument->NodePrincipal(), domdoc); } break; } diff --git a/dom/base/nsContentUtils.cpp b/dom/base/nsContentUtils.cpp index e78df4ac26..602cbe40f5 100644 --- a/dom/base/nsContentUtils.cpp +++ b/dom/base/nsContentUtils.cpp @@ -1971,9 +1971,6 @@ nsContentUtils::CheckSameOrigin(const nsINode* aTrustedNode, { MOZ_ASSERT(aTrustedNode); MOZ_ASSERT(unTrustedNode); - if (IsCallerChrome()) { - return NS_OK; - } /* * Get hold of each node's principal diff --git a/dom/base/nsGlobalWindow.cpp b/dom/base/nsGlobalWindow.cpp index f65268bf3f..32fed33520 100644 --- a/dom/base/nsGlobalWindow.cpp +++ b/dom/base/nsGlobalWindow.cpp @@ -4356,7 +4356,7 @@ nsGlobalWindow::GetApplicationCache(ErrorResult& aError) if (!mApplicationCache) { nsCOMPtr webNav(do_QueryInterface(GetDocShell())); - if (!webNav) { + if (!webNav || !mDoc) { aError.Throw(NS_ERROR_FAILURE); return nullptr; } @@ -4371,7 +4371,7 @@ nsGlobalWindow::GetApplicationCache(ErrorResult& aError) nsContentUtils::GetOfflineAppManifest(mDoc, getter_AddRefs(manifestURI)); RefPtr applicationCache = - new nsDOMOfflineResourceList(manifestURI, uri, this); + new nsDOMOfflineResourceList(manifestURI, uri, mDoc->NodePrincipal(), this); applicationCache->Init(); @@ -6593,7 +6593,9 @@ nsGlobalWindow::AlertOrConfirm(bool aAlert, MOZ_ASSERT(IsOuterWindow()); if (!AreDialogsEnabled()) { - aError.Throw(NS_ERROR_NOT_AVAILABLE); + // Just silently return. In the case of alert(), the return value is + // ignored. In the case of confirm(), returning false is the same thing as + // would happen if the user cancels. return false; } @@ -6733,7 +6735,7 @@ nsGlobalWindow::PromptOuter(const nsAString& aMessage, const nsAString& aInitial SetDOMStringToNull(aReturn); if (!AreDialogsEnabled()) { - aError.Throw(NS_ERROR_NOT_AVAILABLE); + // Return null, as if the user just canceled the prompt. return; } @@ -6924,13 +6926,11 @@ nsGlobalWindow::FocusOuter(ErrorResult& aError) } return; } - if (nsCOMPtr child = do_GetInterface(mDocShell)) { - child->SendRequestFocus(canFocus); - return; - } + if (canFocus) { // if there is no parent, this must be a toplevel window, so raise the - // window if canFocus is true + // window if canFocus is true. If this is a child process, the raise + // window request will get forwarded to the parent by the puppet widget. aError = fm->SetActiveWindow(this); } } @@ -7170,6 +7170,8 @@ nsGlobalWindow::PrintOuter(ErrorResult& aError) } if (!AreDialogsEnabled()) { + // We probably want to keep throwing here; silently doing nothing is a bit + // weird given the typical use cases of print(). aError.Throw(NS_ERROR_NOT_AVAILABLE); return; } @@ -9225,6 +9227,8 @@ nsGlobalWindow::ShowModalDialogOuter(const nsAString& aUrl, nsIVariant* aArgumen EnsureReflowFlushAndPaint(); if (!AreDialogsEnabled()) { + // We probably want to keep throwing here; silently doing nothing is a bit + // weird given the typical use cases of showModalDialog(). aError.Throw(NS_ERROR_NOT_AVAILABLE); return nullptr; } diff --git a/dom/ipc/ContentChild.cpp b/dom/ipc/ContentChild.cpp index ee128382cd..57ac224e72 100644 --- a/dom/ipc/ContentChild.cpp +++ b/dom/ipc/ContentChild.cpp @@ -2533,6 +2533,7 @@ ContentChild::RecvUnregisterSheet(const URIParams& aURI, const uint32_t& aType) POfflineCacheUpdateChild* ContentChild::AllocPOfflineCacheUpdateChild(const URIParams& manifestURI, const URIParams& documentURI, + const PrincipalInfo& aLoadingPrincipalInfo, const bool& stickDocument, const TabId& aTabId) { diff --git a/dom/ipc/ContentChild.h b/dom/ipc/ContentChild.h index 7499b5c92d..554515f9ee 100644 --- a/dom/ipc/ContentChild.h +++ b/dom/ipc/ContentChild.h @@ -450,6 +450,7 @@ public: virtual POfflineCacheUpdateChild* AllocPOfflineCacheUpdateChild( const URIParams& manifestURI, const URIParams& documentURI, + const PrincipalInfo& aLoadingPrincipalInfo, const bool& stickDocument, const TabId& aTabId) override; virtual bool diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp index 189debdf79..dc2a16cf2d 100755 --- a/dom/ipc/ContentParent.cpp +++ b/dom/ipc/ContentParent.cpp @@ -112,6 +112,7 @@ #include "nsIClipboard.h" #include "nsContentPermissionHelper.h" #include "nsICycleCollectorListener.h" +#include "nsIDocShellTreeOwner.h" #include "nsIDocument.h" #include "nsIDOMGeoGeolocation.h" #include "nsIDOMGeoPositionError.h" @@ -122,6 +123,7 @@ #include "nsIFormProcessor.h" #include "nsIGfxInfo.h" #include "nsIIdleService.h" +#include "nsIInterfaceRequestorUtils.h" #include "nsIMemoryInfoDumper.h" #include "nsIMemoryReporter.h" #include "nsIMozBrowserFrame.h" @@ -1118,6 +1120,23 @@ ContentParent::RecvGetGMPPluginVersionForAPI(const nsCString& aAPI, aVersion); } +bool +ContentParent::RecvIsGMPPresentOnDisk(const nsString& aKeySystem, + const nsCString& aVersion, + bool* aIsPresent, + nsCString* aMessage) +{ +#ifdef MOZ_EME + *aIsPresent = MediaKeySystemAccess::IsGMPPresentOnDisk(aKeySystem, + aVersion, + *aMessage); +#else + *aIsPresent = false; +#endif + + return true; +} + bool ContentParent::RecvLoadPlugin(const uint32_t& aPluginId, nsresult* aRv, uint32_t* aRunID) { @@ -1144,12 +1163,15 @@ ContentParent::RecvGetBlocklistState(const uint32_t& aPluginId, RefPtr pluginHost = nsPluginHost::GetInst(); if (!pluginHost) { + NS_WARNING("Plugin host not found"); return false; } nsPluginTag* tag = pluginHost->PluginWithId(aPluginId); if (!tag) { - return false; + // Default state is blocked anyway + NS_WARNING("Plugin tag not found. This should never happen, but to avoid a crash we're forcibly blocking it"); + return true; } return NS_SUCCEEDED(tag->GetBlocklistState(aState)); @@ -1212,7 +1234,18 @@ ContentParent::CreateBrowserOrApp(const TabContext& aContext, constructorSender->ChildID()); } if (constructorSender) { + nsCOMPtr treeOwner; + docShell->GetTreeOwner(getter_AddRefs(treeOwner)); + if (!treeOwner) { + return nullptr; + } + + nsCOMPtr wbc = do_GetInterface(treeOwner); + if (!wbc) { + return nullptr; + } uint32_t chromeFlags = 0; + wbc->GetChromeFlags(&chromeFlags); nsCOMPtr loadContext = do_QueryInterface(docShell); if (loadContext && loadContext->UsePrivateBrowsing()) { @@ -2664,7 +2697,8 @@ ContentParent::RecvSetClipboard(const IPCDataTransfer& aDataTransfer, NS_ENSURE_SUCCESS(rv, true); } else if (item.data().type() == IPCDataTransferData::TnsCString) { - if (item.flavor().EqualsLiteral(kJPEGImageMime) || + if (item.flavor().EqualsLiteral(kNativeImageMime) || + item.flavor().EqualsLiteral(kJPEGImageMime) || item.flavor().EqualsLiteral(kJPGImageMime) || item.flavor().EqualsLiteral(kPNGImageMime) || item.flavor().EqualsLiteral(kGIFImageMime)) { @@ -3427,6 +3461,14 @@ ContentParent::DeallocPRemoteSpellcheckEngineParent(PRemoteSpellcheckEngineParen /* static */ void ContentParent::ForceKillTimerCallback(nsITimer* aTimer, void* aClosure) { +#ifdef ENABLE_TESTS + // We don't want to time out the content process during XPCShell tests. This + // is the easiest way to ensure that. + if (PR_GetEnv("XPCSHELL_TEST_PROFILE_DIR")) { + return; + } +#endif + auto self = static_cast(aClosure); self->KillHard("ShutDownKill"); } @@ -5042,6 +5084,7 @@ ContentParent::GetManagedTabContext() mozilla::docshell::POfflineCacheUpdateParent* ContentParent::AllocPOfflineCacheUpdateParent(const URIParams& aManifestURI, const URIParams& aDocumentURI, + const PrincipalInfo& aLoadingPrincipalInfo, const bool& aStickDocument, const TabId& aTabId) { @@ -5062,6 +5105,7 @@ bool ContentParent::RecvPOfflineCacheUpdateConstructor(POfflineCacheUpdateParent* aActor, const URIParams& aManifestURI, const URIParams& aDocumentURI, + const PrincipalInfo& aLoadingPrincipal, const bool& aStickDocument, const TabId& aTabId) { @@ -5070,7 +5114,7 @@ ContentParent::RecvPOfflineCacheUpdateConstructor(POfflineCacheUpdateParent* aAc RefPtr update = static_cast(aActor); - nsresult rv = update->Schedule(aManifestURI, aDocumentURI, aStickDocument); + nsresult rv = update->Schedule(aManifestURI, aDocumentURI, aLoadingPrincipal, aStickDocument); if (NS_FAILED(rv) && IsAlive()) { // Inform the child of failure. unused << update->SendFinish(false, false); diff --git a/dom/ipc/ContentParent.h b/dom/ipc/ContentParent.h index 2c0d9e4c1d..a8bfac0847 100644 --- a/dom/ipc/ContentParent.h +++ b/dom/ipc/ContentParent.h @@ -81,6 +81,7 @@ class ContentParent final : public PContentParent typedef mozilla::ipc::PFileDescriptorSetParent PFileDescriptorSetParent; typedef mozilla::ipc::TestShellParent TestShellParent; typedef mozilla::ipc::URIParams URIParams; + typedef mozilla::ipc::PrincipalInfo PrincipalInfo; typedef mozilla::dom::ClonedMessageData ClonedMessageData; public: @@ -175,6 +176,10 @@ public: nsTArray&& aTags, bool* aHasPlugin, nsCString* aVersion) override; + virtual bool RecvIsGMPPresentOnDisk(const nsString& aKeySystem, + const nsCString& aVersion, + bool* aIsPresent, + nsCString* aMessage) override; virtual bool RecvLoadPlugin(const uint32_t& aPluginId, nsresult* aRv, uint32_t* aRunID) override; virtual bool RecvConnectPluginBridge(const uint32_t& aPluginId, nsresult* aRv) override; @@ -385,12 +390,14 @@ public: virtual POfflineCacheUpdateParent* AllocPOfflineCacheUpdateParent(const URIParams& aManifestURI, const URIParams& aDocumentURI, + const PrincipalInfo& aLoadingPrincipalInfo, const bool& aStickDocument, const TabId& aTabId) override; virtual bool RecvPOfflineCacheUpdateConstructor(POfflineCacheUpdateParent* aActor, const URIParams& aManifestURI, const URIParams& aDocumentURI, + const PrincipalInfo& aLoadingPrincipal, const bool& stickDocument, const TabId& aTabId) override; virtual bool diff --git a/dom/ipc/PContent.ipdl b/dom/ipc/PContent.ipdl index a77784e6ea..c66ad850c3 100644 --- a/dom/ipc/PContent.ipdl +++ b/dom/ipc/PContent.ipdl @@ -58,6 +58,7 @@ include PTabContext; include URIParams; include PluginTypes; include ProtocolTypes; +include PBackgroundSharedTypes; include PContentPermission; include BrowserConfiguration; include GraphicsMessages; @@ -697,6 +698,8 @@ parent: async CreateGMPService(); sync GetGMPPluginVersionForAPI(nsCString api, nsCString[] tags) returns (bool hasPlugin, nsCString version); + sync IsGMPPresentOnDisk(nsString keySystem, nsCString version) + returns (bool isPresent, nsCString message); /** * This call connects the content process to a plugin process. While this @@ -1009,6 +1012,8 @@ parent: * URI of the manifest to fetch, the application cache group ID * @param documentURI * URI of the document that referred the manifest + * @param loadingPrincipal + * Principal of the document that referred the manifest * @param stickDocument * True if the update was initiated by a document load that referred * a manifest. @@ -1028,7 +1033,8 @@ parent: * To identify which tab owns the app. */ POfflineCacheUpdate(URIParams manifestURI, URIParams documentURI, - bool stickDocument, TabId tabId); + PrincipalInfo loadingPrincipal, bool stickDocument, + TabId tabId); /** * Sets "offline-app" permission for the principal. Called when we hit diff --git a/dom/offline/nsDOMOfflineResourceList.cpp b/dom/offline/nsDOMOfflineResourceList.cpp index 62a454acda..41487680ce 100644 --- a/dom/offline/nsDOMOfflineResourceList.cpp +++ b/dom/offline/nsDOMOfflineResourceList.cpp @@ -81,11 +81,13 @@ NS_IMPL_EVENT_HANDLER(nsDOMOfflineResourceList, obsolete) nsDOMOfflineResourceList::nsDOMOfflineResourceList(nsIURI *aManifestURI, nsIURI *aDocumentURI, + nsIPrincipal *aLoadingPrincipal, nsPIDOMWindow *aWindow) : DOMEventTargetHelper(aWindow) , mInitialized(false) , mManifestURI(aManifestURI) , mDocumentURI(aDocumentURI) + , mLoadingPrincipal(aLoadingPrincipal) , mExposeCacheUpdateStatus(true) , mStatus(nsIDOMOfflineResourceList::IDLE) , mCachedKeys(nullptr) @@ -359,7 +361,8 @@ nsDOMOfflineResourceList::MozAdd(const nsAString& aURI) rv = appCache->GetClientID(clientID); NS_ENSURE_SUCCESS(rv, rv); - rv = update->InitPartial(mManifestURI, clientID, mDocumentURI); + rv = update->InitPartial(mManifestURI, clientID, + mDocumentURI, mLoadingPrincipal); NS_ENSURE_SUCCESS(rv, rv); rv = update->AddDynamicURI(requestedURI); @@ -466,7 +469,7 @@ nsDOMOfflineResourceList::Update() do_QueryInterface(GetOwner()); nsCOMPtr update; - rv = updateService->ScheduleUpdate(mManifestURI, mDocumentURI, + rv = updateService->ScheduleUpdate(mManifestURI, mDocumentURI, mLoadingPrincipal, window, getter_AddRefs(update)); NS_ENSURE_SUCCESS(rv, rv); diff --git a/dom/offline/nsDOMOfflineResourceList.h b/dom/offline/nsDOMOfflineResourceList.h index 2d6028f404..d954a283f5 100644 --- a/dom/offline/nsDOMOfflineResourceList.h +++ b/dom/offline/nsDOMOfflineResourceList.h @@ -52,6 +52,7 @@ public: nsDOMOfflineResourceList(nsIURI* aManifestURI, nsIURI* aDocumentURI, + nsIPrincipal* aLoadingPrincipal, nsPIDOMWindow* aWindow); void FirePendingEvents(); @@ -153,6 +154,7 @@ private: nsCString mManifestSpec; nsCOMPtr mDocumentURI; + nsCOMPtr mLoadingPrincipal; nsCOMPtr mApplicationCacheService; nsCOMPtr mAvailableApplicationCache; nsCOMPtr mCacheUpdate; diff --git a/layout/base/nsDocumentViewer.cpp b/layout/base/nsDocumentViewer.cpp index be2500a134..b348777cbb 100644 --- a/layout/base/nsDocumentViewer.cpp +++ b/layout/base/nsDocumentViewer.cpp @@ -2907,11 +2907,6 @@ nsDocumentViewer::CallChildren(CallChildFunc aFunc, void* aClosure) } } -struct LineBoxInfo -{ - nscoord mMaxLineBoxWidth; -}; - static void ChangeChildPaintingEnabled(nsIContentViewer* aChild, void* aClosure) { @@ -2923,13 +2918,6 @@ ChangeChildPaintingEnabled(nsIContentViewer* aChild, void* aClosure) } } -static void -ChangeChildMaxLineBoxWidth(nsIContentViewer* aChild, void* aClosure) -{ - struct LineBoxInfo* lbi = (struct LineBoxInfo*) aClosure; - aChild->ChangeMaxLineBoxWidth(lbi->mMaxLineBoxWidth); -} - struct ZoomInfo { float mZoom; @@ -3387,24 +3375,6 @@ nsDocumentViewer::ResumePainting() return NS_OK; } -NS_IMETHODIMP -nsDocumentViewer::ChangeMaxLineBoxWidth(int32_t aMaxLineBoxWidth) -{ - // Change the max line box width for all children. - struct LineBoxInfo lbi = { aMaxLineBoxWidth }; - CallChildren(ChangeChildMaxLineBoxWidth, &lbi); - - // Now, change our max line box width. - // Convert to app units, since our input is in CSS pixels. - nscoord mlbw = nsPresContext::CSSPixelsToAppUnits(aMaxLineBoxWidth); - nsIPresShell* presShell = GetPresShell(); - if (presShell) { - presShell->SetMaxLineBoxWidth(mlbw); - } - - return NS_OK; -} - NS_IMETHODIMP nsDocumentViewer::GetContentSize(int32_t* aWidth, int32_t* aHeight) { diff --git a/layout/base/nsIPresShell.h b/layout/base/nsIPresShell.h index d46c208330..f260cd8afa 100644 --- a/layout/base/nsIPresShell.h +++ b/layout/base/nsIPresShell.h @@ -1667,12 +1667,6 @@ public: virtual void ThemeChanged() = 0; virtual void BackingScaleFactorChanged() = 0; - nscoord MaxLineBoxWidth() { - return mMaxLineBoxWidth; - } - - void SetMaxLineBoxWidth(nscoord aMaxLineBoxWidth); - /** * Returns whether or not there is a reflow on zoom event pending. A reflow * on zoom event is a change to the max line box width, followed by a reflow. @@ -1830,10 +1824,6 @@ protected: // See IsReflowOnZoomPending() for more information. bool mReflowOnZoomPending; - // The maximum width of a line box. Text on a single line that exceeds this - // width will be wrapped. A value of 0 indicates that no limit is enforced. - nscoord mMaxLineBoxWidth; - // If a document belongs to an invisible DocShell, this flag must be set // to true, so we can avoid any paint calls for widget related to this // presshell. diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index b62d39f533..dfb5075b89 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -790,8 +790,6 @@ PresShell::PresShell() mScrollPositionClampingScrollPortSizeSet = false; - mMaxLineBoxWidth = 0; - static bool addedSynthMouseMove = false; if (!addedSynthMouseMove) { Preferences::AddBoolVarCache(&sSynthMouseMove, @@ -10927,19 +10925,6 @@ nsIPresShell::FontSizeInflationEnabled() return mFontSizeInflationEnabled; } -void -nsIPresShell::SetMaxLineBoxWidth(nscoord aMaxLineBoxWidth) -{ - NS_ASSERTION(aMaxLineBoxWidth >= 0, "attempting to set max line box width to a negative value"); - - if (mMaxLineBoxWidth != aMaxLineBoxWidth) { - mMaxLineBoxWidth = aMaxLineBoxWidth; - mReflowOnZoomPending = true; - FrameNeedsReflow(GetRootFrame(), nsIPresShell::eResize, - NS_FRAME_HAS_DIRTY_CHILDREN); - } -} - void PresShell::PausePainting() { diff --git a/layout/base/tests/mochitest.ini b/layout/base/tests/mochitest.ini index a5491d736d..c3474b38c4 100644 --- a/layout/base/tests/mochitest.ini +++ b/layout/base/tests/mochitest.ini @@ -195,7 +195,6 @@ skip-if = buildapp == 'mulet' || buildapp == 'b2g' || toolkit == 'android' || e1 [test_bug731777.html] [test_bug761572.html] [test_bug770106.html] -[test_maxLineBoxWidth.html] [test_remote_frame.html] skip-if = (buildapp == 'b2g' && toolkit != 'gonk') #Bug 931116, b2g desktop specific, initial triage [test_remote_passpointerevents.html] diff --git a/layout/base/tests/test_maxLineBoxWidth.html b/layout/base/tests/test_maxLineBoxWidth.html deleted file mode 100644 index d8b0431cac..0000000000 --- a/layout/base/tests/test_maxLineBoxWidth.html +++ /dev/null @@ -1,191 +0,0 @@ - - - - - - Test for Bug 780258 - - - - - - -Mozilla Bug 780258 -

- - -
-
-
- - diff --git a/layout/forms/test/mochitest.ini b/layout/forms/test/mochitest.ini index 72435cf793..739f2eab09 100644 --- a/layout/forms/test/mochitest.ini +++ b/layout/forms/test/mochitest.ini @@ -32,7 +32,7 @@ skip-if = (toolkit == 'gonk' && debug) #debug-only failure [test_bug562447.html] [test_bug563642.html] [test_bug564115.html] -skip-if = buildapp == 'mulet' || (buildapp == 'b2g' && (toolkit != 'gonk' || debug)) || toolkit == 'android' || e10s #TIMED_OUT # b2g-debug(times out on window.open and focus event) b2g-desktop(times out on window.open and focus event) +skip-if = buildapp == 'mulet' || (buildapp == 'b2g' && (toolkit != 'gonk' || debug)) || toolkit == 'android' #TIMED_OUT # b2g-debug(times out on window.open and focus event) b2g-desktop(times out on window.open and focus event) [test_bug571352.html] skip-if = (os == 'mac' && os_version == '10.10') || buildapp == 'mulet' || buildapp == 'b2g' || toolkit == 'android' #TIMED_OUT # OS X 10.10 - bug 947690, b2g(shift-click multi-select not working?) b2g-debug(shift-click multi-select not working?) b2g-desktop(shift-click multi-select not working?) [test_bug572406.html] diff --git a/layout/generic/nsLineLayout.cpp b/layout/generic/nsLineLayout.cpp index e1c0352717..82cbb0daac 100644 --- a/layout/generic/nsLineLayout.cpp +++ b/layout/generic/nsLineLayout.cpp @@ -211,23 +211,6 @@ nsLineLayout::BeginLineReflow(nscoord aICoord, nscoord aBCoord, psd->mIEnd = aICoord + aISize; mContainerSize = aContainerSize; - // If we're in a constrained block-size frame, then we don't allow a - // max line box width to take effect. - if (!(LineContainerFrame()->GetStateBits() & - NS_FRAME_IN_CONSTRAINED_BSIZE)) { - - // If the available size is greater than the maximum line box width (if - // specified), then we need to adjust the line box width to be at the max - // possible width. - nscoord maxLineBoxWidth = - LineContainerFrame()->PresContext()->PresShell()->MaxLineBoxWidth(); - - if (maxLineBoxWidth > 0 && - psd->mIEnd - psd->mIStart > maxLineBoxWidth) { - psd->mIEnd = psd->mIStart + maxLineBoxWidth; - } - } - mBStartEdge = aBCoord; psd->mNoWrap = !mStyleText->WhiteSpaceCanWrapStyle() || mSuppressLineWrap; diff --git a/testing/specialpowers/content/specialpowersAPI.js b/testing/specialpowers/content/specialpowersAPI.js index 63f68bd883..c95fb24bec 100644 --- a/testing/specialpowers/content/specialpowersAPI.js +++ b/testing/specialpowers/content/specialpowersAPI.js @@ -1350,14 +1350,6 @@ SpecialPowersAPI.prototype = { Services.console.reset(); }, - getMaxLineBoxWidth: function(window) { - return this._getMUDV(window).maxLineBoxWidth; - }, - - setMaxLineBoxWidth: function(window, width) { - this._getMUDV(window).changeMaxLineBoxWidth(width); - }, - getFullZoom: function(window) { return this._getMUDV(window).fullZoom; }, diff --git a/uriloader/prefetch/OfflineCacheUpdateChild.cpp b/uriloader/prefetch/OfflineCacheUpdateChild.cpp index a33576f25c..938d81a44c 100644 --- a/uriloader/prefetch/OfflineCacheUpdateChild.cpp +++ b/uriloader/prefetch/OfflineCacheUpdateChild.cpp @@ -3,6 +3,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#include "BackgroundUtils.h" #include "OfflineCacheUpdateChild.h" #include "nsOfflineCacheUpdate.h" #include "mozilla/dom/ContentChild.h" @@ -174,6 +175,7 @@ OfflineCacheUpdateChild::AssociateDocument(nsIDOMDocument *aDocument, NS_IMETHODIMP OfflineCacheUpdateChild::Init(nsIURI *aManifestURI, nsIURI *aDocumentURI, + nsIPrincipal *aLoadingPrincipal, nsIDOMDocument *aDocument, nsIFile *aCustomProfileDir, uint32_t aAppID, @@ -212,6 +214,7 @@ OfflineCacheUpdateChild::Init(nsIURI *aManifestURI, NS_ENSURE_SUCCESS(rv, rv); mDocumentURI = aDocumentURI; + mLoadingPrincipal = aLoadingPrincipal; mState = STATE_INITIALIZED; @@ -227,7 +230,8 @@ OfflineCacheUpdateChild::Init(nsIURI *aManifestURI, NS_IMETHODIMP OfflineCacheUpdateChild::InitPartial(nsIURI *aManifestURI, const nsACString& clientID, - nsIURI *aDocumentURI) + nsIURI *aDocumentURI, + nsIPrincipal *aLoadingPrincipal) { NS_NOTREACHED("Not expected to do partial offline cache updates" " on the child process"); @@ -237,6 +241,7 @@ OfflineCacheUpdateChild::InitPartial(nsIURI *aManifestURI, NS_IMETHODIMP OfflineCacheUpdateChild::InitForUpdateCheck(nsIURI *aManifestURI, + nsIPrincipal* aLoadingPrincipal, uint32_t aAppID, bool aInBrowser, nsIObserver *aObserver) @@ -409,6 +414,12 @@ OfflineCacheUpdateChild::Schedule() SerializeURI(mManifestURI, manifestURI); SerializeURI(mDocumentURI, documentURI); + nsresult rv = NS_OK; + PrincipalInfo loadingPrincipalInfo; + rv = PrincipalToPrincipalInfo(mLoadingPrincipal, + &loadingPrincipalInfo); + NS_ENSURE_SUCCESS(rv, rv); + nsCOMPtr observerService = mozilla::services::GetObserverService(); if (observerService) { @@ -431,7 +442,7 @@ OfflineCacheUpdateChild::Schedule() // a reference to us. Will be released in RecvFinish() that identifies // the work has been done. ContentChild::GetSingleton()->SendPOfflineCacheUpdateConstructor( - this, manifestURI, documentURI, + this, manifestURI, documentURI, loadingPrincipalInfo, stickDocument, child->GetTabId()); // ContentChild::DeallocPOfflineCacheUpdate will release this. diff --git a/uriloader/prefetch/OfflineCacheUpdateChild.h b/uriloader/prefetch/OfflineCacheUpdateChild.h index f99b66e948..d6b007655e 100644 --- a/uriloader/prefetch/OfflineCacheUpdateChild.h +++ b/uriloader/prefetch/OfflineCacheUpdateChild.h @@ -68,6 +68,7 @@ private: nsCString mUpdateDomain; nsCOMPtr mManifestURI; nsCOMPtr mDocumentURI; + nsCOMPtr mLoadingPrincipal; nsCOMPtr mObserverService; diff --git a/uriloader/prefetch/OfflineCacheUpdateGlue.cpp b/uriloader/prefetch/OfflineCacheUpdateGlue.cpp index 8ffac3811d..2b1135279f 100644 --- a/uriloader/prefetch/OfflineCacheUpdateGlue.cpp +++ b/uriloader/prefetch/OfflineCacheUpdateGlue.cpp @@ -95,8 +95,9 @@ OfflineCacheUpdateGlue::Schedule() } NS_IMETHODIMP -OfflineCacheUpdateGlue::Init(nsIURI *aManifestURI, +OfflineCacheUpdateGlue::Init(nsIURI *aManifestURI, nsIURI *aDocumentURI, + nsIPrincipal* aLoadingPrincipal, nsIDOMDocument *aDocument, nsIFile *aCustomProfileDir, uint32_t aAppID, @@ -114,6 +115,7 @@ OfflineCacheUpdateGlue::Init(nsIURI *aManifestURI, return NS_ERROR_NULL_POINTER; mDocumentURI = aDocumentURI; + mLoadingPrincipal = aLoadingPrincipal; if (aDocument) SetDocument(aDocument); @@ -123,7 +125,8 @@ OfflineCacheUpdateGlue::Init(nsIURI *aManifestURI, return NS_OK; } - return mUpdate->Init(aManifestURI, aDocumentURI, nullptr, aCustomProfileDir, aAppID, aInBrowser); + return mUpdate->Init(aManifestURI, aDocumentURI, aLoadingPrincipal, nullptr, + aCustomProfileDir, aAppID, aInBrowser); } void diff --git a/uriloader/prefetch/OfflineCacheUpdateGlue.h b/uriloader/prefetch/OfflineCacheUpdateGlue.h index b4af753d86..2df7fc73ee 100644 --- a/uriloader/prefetch/OfflineCacheUpdateGlue.h +++ b/uriloader/prefetch/OfflineCacheUpdateGlue.h @@ -29,8 +29,8 @@ namespace docshell { NS_IMETHOD GetUpdateDomain(nsACString & aUpdateDomain) override { return !_to ? NS_ERROR_NULL_POINTER : _to->GetUpdateDomain(aUpdateDomain); } \ NS_IMETHOD GetManifestURI(nsIURI **aManifestURI) override { return !_to ? NS_ERROR_NULL_POINTER : _to->GetManifestURI(aManifestURI); } \ NS_IMETHOD GetSucceeded(bool *aSucceeded) override { return !_to ? NS_ERROR_NULL_POINTER : _to->GetSucceeded(aSucceeded); } \ - NS_IMETHOD InitPartial(nsIURI *aManifestURI, const nsACString & aClientID, nsIURI *aDocumentURI) override { return !_to ? NS_ERROR_NULL_POINTER : _to->InitPartial(aManifestURI, aClientID, aDocumentURI); } \ - NS_IMETHOD InitForUpdateCheck(nsIURI *aManifestURI, uint32_t aAppID, bool aInBrowser, nsIObserver *aObserver) override { return !_to ? NS_ERROR_NULL_POINTER : _to->InitForUpdateCheck(aManifestURI, aAppID, aInBrowser, aObserver); } \ + NS_IMETHOD InitPartial(nsIURI *aManifestURI, const nsACString & aClientID, nsIURI *aDocumentURI, nsIPrincipal *aLoadingPrincipal) override { return !_to ? NS_ERROR_NULL_POINTER : _to->InitPartial(aManifestURI, aClientID, aDocumentURI, aLoadingPrincipal); } \ + NS_IMETHOD InitForUpdateCheck(nsIURI *aManifestURI, nsIPrincipal* aLoadingPrincipal, uint32_t aAppID, bool aInBrowser, nsIObserver *aObserver) override { return !_to ? NS_ERROR_NULL_POINTER : _to->InitForUpdateCheck(aManifestURI, aLoadingPrincipal, aAppID, aInBrowser, aObserver); } \ NS_IMETHOD AddDynamicURI(nsIURI *aURI) override { return !_to ? NS_ERROR_NULL_POINTER : _to->AddDynamicURI(aURI); } \ NS_IMETHOD AddObserver(nsIOfflineCacheUpdateObserver *aObserver, bool aHoldWeak) override { return !_to ? NS_ERROR_NULL_POINTER : _to->AddObserver(aObserver, aHoldWeak); } \ NS_IMETHOD RemoveObserver(nsIOfflineCacheUpdateObserver *aObserver) override { return !_to ? NS_ERROR_NULL_POINTER : _to->RemoveObserver(aObserver); } \ @@ -50,8 +50,9 @@ private: public: NS_ADJUSTED_FORWARD_NSIOFFLINECACHEUPDATE(EnsureUpdate()) NS_IMETHOD Schedule(void) override; - NS_IMETHOD Init(nsIURI *aManifestURI, + NS_IMETHOD Init(nsIURI *aManifestURI, nsIURI *aDocumentURI, + nsIPrincipal* aLoadingPrincipal, nsIDOMDocument *aDocument, nsIFile *aCustomProfileDir, uint32_t aAppID, @@ -72,6 +73,7 @@ private: /* Document that requested this update */ nsCOMPtr mDocument; nsCOMPtr mDocumentURI; + nsCOMPtr mLoadingPrincipal; }; } // namespace docshell diff --git a/uriloader/prefetch/OfflineCacheUpdateParent.cpp b/uriloader/prefetch/OfflineCacheUpdateParent.cpp index 2e53b60273..96721306d1 100644 --- a/uriloader/prefetch/OfflineCacheUpdateParent.cpp +++ b/uriloader/prefetch/OfflineCacheUpdateParent.cpp @@ -5,6 +5,7 @@ #include "OfflineCacheUpdateParent.h" +#include "BackgroundUtils.h" #include "mozilla/BasePrincipal.h" #include "mozilla/dom/TabParent.h" #include "mozilla/ipc/URIUtils.h" @@ -77,6 +78,7 @@ OfflineCacheUpdateParent::ActorDestroy(ActorDestroyReason why) nsresult OfflineCacheUpdateParent::Schedule(const URIParams& aManifestURI, const URIParams& aDocumentURI, + const PrincipalInfo& aLoadingPrincipalInfo, const bool& stickDocument) { LOG(("OfflineCacheUpdateParent::RecvSchedule [%p]", this)); @@ -119,9 +121,13 @@ OfflineCacheUpdateParent::Schedule(const URIParams& aManifestURI, if (!update) { update = new nsOfflineCacheUpdate(); + nsCOMPtr loadingPrincipal = + PrincipalInfoToPrincipal(aLoadingPrincipalInfo, &rv); + NS_ENSURE_SUCCESS(rv, rv); + // Leave aDocument argument null. Only glues and children keep // document instances. - rv = update->Init(manifestURI, documentURI, nullptr, nullptr, + rv = update->Init(manifestURI, documentURI, loadingPrincipal, nullptr, nullptr, mOriginAttributes.mAppId, mOriginAttributes.mInBrowser); NS_ENSURE_SUCCESS(rv, rv); diff --git a/uriloader/prefetch/OfflineCacheUpdateParent.h b/uriloader/prefetch/OfflineCacheUpdateParent.h index ce9cb0a204..60465162bf 100644 --- a/uriloader/prefetch/OfflineCacheUpdateParent.h +++ b/uriloader/prefetch/OfflineCacheUpdateParent.h @@ -26,6 +26,7 @@ class OfflineCacheUpdateParent : public POfflineCacheUpdateParent , public nsILoadContext { typedef mozilla::ipc::URIParams URIParams; + typedef mozilla::ipc::PrincipalInfo PrincipalInfo; public: NS_DECL_ISUPPORTS @@ -35,6 +36,7 @@ public: nsresult Schedule(const URIParams& manifestURI, const URIParams& documentURI, + const PrincipalInfo& loadingPrincipalInfo, const bool& stickDocument); void diff --git a/uriloader/prefetch/nsIOfflineCacheUpdate.idl b/uriloader/prefetch/nsIOfflineCacheUpdate.idl index 7504eaef49..d844f61d9b 100644 --- a/uriloader/prefetch/nsIOfflineCacheUpdate.idl +++ b/uriloader/prefetch/nsIOfflineCacheUpdate.idl @@ -58,7 +58,7 @@ interface nsIOfflineCacheUpdateObserver : nsISupports { * load its items one by one, sending itemCompleted() to any registered * observers. */ -[scriptable, uuid(a4503a53-6ab8-4b50-b01e-1c4f393fc980)] +[scriptable, uuid(e9029838-3553-4192-a00b-f0f11073a6eb)] interface nsIOfflineCacheUpdate : nsISupports { /** * Fetch the status of the running update. This will return a value @@ -101,8 +101,13 @@ interface nsIOfflineCacheUpdate : nsISupports { * The manifest URI to be checked. * @param aDocumentURI * The page that is requesting the update. + * @param aLoadingPrincipal + * The principal of the page that is requesting the update. */ - void init(in nsIURI aManifestURI, in nsIURI aDocumentURI, in nsIDOMDocument aDocument, + void init(in nsIURI aManifestURI, + in nsIURI aDocumentURI, + in nsIPrincipal aLoadingPrincipal, + in nsIDOMDocument aDocument, [optional] in nsIFile aCustomProfileDir, [optional] in unsigned long aAppId, [optional] in boolean aInBrowser); @@ -120,7 +125,8 @@ interface nsIOfflineCacheUpdate : nsISupports { * The page that is requesting the update. May be null * when this information is unknown. */ - void initPartial(in nsIURI aManifestURI, in ACString aClientID, in nsIURI aDocumentURI); + void initPartial(in nsIURI aManifestURI, in ACString aClientID, + in nsIURI aDocumentURI, in nsIPrincipal aPrincipal); /** * Initialize the update to only check whether there is an update @@ -141,6 +147,7 @@ interface nsIOfflineCacheUpdate : nsISupports { * update available (the manifest has not changed on the server). */ void initForUpdateCheck(in nsIURI aManifestURI, + in nsIPrincipal aLoadingPrincipal, in unsigned long aAppID, in boolean aInBrowser, in nsIObserver aObserver); @@ -192,7 +199,7 @@ interface nsIOfflineCacheUpdate : nsISupports { readonly attribute uint64_t byteProgress; }; -[scriptable, uuid(0668910d-d14f-4cee-8db5-25faebc360ab)] +[scriptable, uuid(a297a334-bcae-4779-a564-555593edc96b)] interface nsIOfflineCacheUpdateService : nsISupports { /** * Constants for the offline-app permission. @@ -220,6 +227,7 @@ interface nsIOfflineCacheUpdateService : nsISupports { */ nsIOfflineCacheUpdate scheduleUpdate(in nsIURI aManifestURI, in nsIURI aDocumentURI, + in nsIPrincipal aLoadingPrincipal, in nsIDOMWindow aWindow); /** @@ -230,6 +238,7 @@ interface nsIOfflineCacheUpdateService : nsISupports { */ nsIOfflineCacheUpdate scheduleAppUpdate(in nsIURI aManifestURI, in nsIURI aDocumentURI, + in nsIPrincipal aLoadingPrincipal, in unsigned long aAppID, in boolean aInBrowser, in nsIFile aProfileDir); @@ -240,6 +249,7 @@ interface nsIOfflineCacheUpdateService : nsISupports { */ void scheduleOnDocumentStop(in nsIURI aManifestURI, in nsIURI aDocumentURI, + in nsIPrincipal aLoadingPrincipal, in nsIDOMDocument aDocument); /** @@ -254,6 +264,7 @@ interface nsIOfflineCacheUpdateService : nsISupports { * description. */ void checkForUpdate(in nsIURI aManifestURI, + in nsIPrincipal aLoadingPrincipal, in unsigned long aAppID, in boolean aInBrowser, in nsIObserver aObserver); diff --git a/uriloader/prefetch/nsOfflineCacheUpdate.cpp b/uriloader/prefetch/nsOfflineCacheUpdate.cpp index 12c01954be..170be6d9bb 100644 --- a/uriloader/prefetch/nsOfflineCacheUpdate.cpp +++ b/uriloader/prefetch/nsOfflineCacheUpdate.cpp @@ -37,6 +37,7 @@ #include "mozilla/Preferences.h" #include "mozilla/Attributes.h" #include "nsContentUtils.h" +#include "nsIPrincipal.h" #include "nsXULAppAPI.h" @@ -120,10 +121,12 @@ class nsManifestCheck final : public nsIStreamListener public: nsManifestCheck(nsOfflineCacheUpdate *aUpdate, nsIURI *aURI, - nsIURI *aReferrerURI) + nsIURI *aReferrerURI, + nsIPrincipal* aLoadingPrincipal) : mUpdate(aUpdate) , mURI(aURI) , mReferrerURI(aReferrerURI) + , mLoadingPrincipal(aLoadingPrincipal) {} NS_DECL_ISUPPORTS @@ -148,6 +151,7 @@ private: RefPtr mUpdate; nsCOMPtr mURI; nsCOMPtr mReferrerURI; + nsCOMPtr mLoadingPrincipal; nsCOMPtr mManifestHash; nsCOMPtr mChannel; }; @@ -176,8 +180,8 @@ nsManifestCheck::Begin() NS_ENSURE_SUCCESS(rv, rv); rv = NS_NewChannel(getter_AddRefs(mChannel), mURI, - nsContentUtils::GetSystemPrincipal(), - nsILoadInfo::SEC_NORMAL, + mLoadingPrincipal, + nsILoadInfo::SEC_REQUIRE_SAME_ORIGIN_DATA_IS_BLOCKED, nsIContentPolicy::TYPE_OTHER, nullptr, // loadGroup nullptr, // aCallbacks @@ -195,10 +199,7 @@ nsManifestCheck::Begin() false); } - rv = mChannel->AsyncOpen(this, nullptr); - NS_ENSURE_SUCCESS(rv, rv); - - return NS_OK; + return mChannel->AsyncOpen2(this); } //----------------------------------------------------------------------------- @@ -320,11 +321,13 @@ NS_IMPL_ISUPPORTS(nsOfflineCacheUpdateItem, nsOfflineCacheUpdateItem::nsOfflineCacheUpdateItem(nsIURI *aURI, nsIURI *aReferrerURI, + nsIPrincipal* aLoadingPrincipal, nsIApplicationCache *aApplicationCache, nsIApplicationCache *aPreviousApplicationCache, uint32_t type) : mURI(aURI) , mReferrerURI(aReferrerURI) + , mLoadingPrincipal(aLoadingPrincipal) , mApplicationCache(aApplicationCache) , mPreviousApplicationCache(aPreviousApplicationCache) , mItemType(type) @@ -371,8 +374,8 @@ nsOfflineCacheUpdateItem::OpenChannel(nsOfflineCacheUpdate *aUpdate) rv = NS_NewChannel(getter_AddRefs(mChannel), mURI, - nsContentUtils::GetSystemPrincipal(), - nsILoadInfo::SEC_NORMAL, + mLoadingPrincipal, + nsILoadInfo::SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL, nsIContentPolicy::TYPE_OTHER, nullptr, // aLoadGroup this, // aCallbacks @@ -404,7 +407,7 @@ nsOfflineCacheUpdateItem::OpenChannel(nsOfflineCacheUpdate *aUpdate) false); } - rv = mChannel->AsyncOpen(this, nullptr); + rv = mChannel->AsyncOpen2(this); NS_ENSURE_SUCCESS(rv, rv); mUpdate = aUpdate; @@ -678,9 +681,10 @@ nsOfflineCacheUpdateItem::GetStatus(uint16_t *aStatus) nsOfflineManifestItem::nsOfflineManifestItem(nsIURI *aURI, nsIURI *aReferrerURI, + nsIPrincipal* aLoadingPrincipal, nsIApplicationCache *aApplicationCache, nsIApplicationCache *aPreviousApplicationCache) - : nsOfflineCacheUpdateItem(aURI, aReferrerURI, + : nsOfflineCacheUpdateItem(aURI, aReferrerURI, aLoadingPrincipal, aApplicationCache, aPreviousApplicationCache, nsIApplicationCache::ITEM_MANIFEST) , mParserState(PARSE_INIT) @@ -1192,7 +1196,8 @@ nsOfflineCacheUpdate::GetCacheKey(nsIURI *aURI, nsACString &aKey) } nsresult -nsOfflineCacheUpdate::InitInternal(nsIURI *aManifestURI) +nsOfflineCacheUpdate::InitInternal(nsIURI *aManifestURI, + nsIPrincipal* aLoadingPrincipal) { nsresult rv; @@ -1209,6 +1214,7 @@ nsOfflineCacheUpdate::InitInternal(nsIURI *aManifestURI) } mManifestURI = aManifestURI; + mLoadingPrincipal = aLoadingPrincipal; rv = mManifestURI->GetAsciiHost(mUpdateDomain); NS_ENSURE_SUCCESS(rv, rv); @@ -1221,6 +1227,7 @@ nsOfflineCacheUpdate::InitInternal(nsIURI *aManifestURI) nsresult nsOfflineCacheUpdate::Init(nsIURI *aManifestURI, nsIURI *aDocumentURI, + nsIPrincipal* aLoadingPrincipal, nsIDOMDocument *aDocument, nsIFile *aCustomProfileDir, uint32_t aAppID, @@ -1236,7 +1243,7 @@ nsOfflineCacheUpdate::Init(nsIURI *aManifestURI, LOG(("nsOfflineCacheUpdate::Init [%p]", this)); - rv = InitInternal(aManifestURI); + rv = InitInternal(aManifestURI, aLoadingPrincipal); NS_ENSURE_SUCCESS(rv, rv); nsCOMPtr cacheService = @@ -1296,6 +1303,7 @@ nsOfflineCacheUpdate::Init(nsIURI *aManifestURI, nsresult nsOfflineCacheUpdate::InitForUpdateCheck(nsIURI *aManifestURI, + nsIPrincipal* aLoadingPrincipal, uint32_t aAppID, bool aInBrowser, nsIObserver *aObserver) @@ -1310,7 +1318,7 @@ nsOfflineCacheUpdate::InitForUpdateCheck(nsIURI *aManifestURI, LOG(("nsOfflineCacheUpdate::InitForUpdateCheck [%p]", this)); - rv = InitInternal(aManifestURI); + rv = InitInternal(aManifestURI, aLoadingPrincipal); NS_ENSURE_SUCCESS(rv, rv); nsCOMPtr cacheService = @@ -1349,7 +1357,8 @@ nsOfflineCacheUpdate::InitForUpdateCheck(nsIURI *aManifestURI, nsresult nsOfflineCacheUpdate::InitPartial(nsIURI *aManifestURI, const nsACString& clientID, - nsIURI *aDocumentURI) + nsIURI *aDocumentURI, + nsIPrincipal *aLoadingPrincipal) { nsresult rv; @@ -1363,6 +1372,7 @@ nsOfflineCacheUpdate::InitPartial(nsIURI *aManifestURI, mPartialUpdate = true; mDocumentURI = aDocumentURI; + mLoadingPrincipal = aLoadingPrincipal; mManifestURI = aManifestURI; rv = mManifestURI->GetAsciiHost(mUpdateDomain); @@ -1700,7 +1710,7 @@ nsOfflineCacheUpdate::ManifestCheckCompleted(nsresult aStatus, new nsOfflineCacheUpdate(); // Leave aDocument argument null. Only glues and children keep // document instances. - newUpdate->Init(mManifestURI, mDocumentURI, nullptr, + newUpdate->Init(mManifestURI, mDocumentURI, mLoadingPrincipal, nullptr, mCustomProfileDir, mAppID, mInBrowser); // In a rare case the manifest will not be modified on the next refetch @@ -1752,6 +1762,7 @@ nsOfflineCacheUpdate::Begin() mManifestItem = new nsOfflineManifestItem(mManifestURI, mDocumentURI, + mLoadingPrincipal, mApplicationCache, mPreviousApplicationCache); if (!mManifestItem) { @@ -1857,7 +1868,7 @@ nsOfflineCacheUpdate::ProcessNextURI() // is being updated. The check will call // ManifestCheckCompleted() when it's done. RefPtr manifestCheck = - new nsManifestCheck(this, mManifestURI, mDocumentURI); + new nsManifestCheck(this, mManifestURI, mDocumentURI, mLoadingPrincipal); if (NS_FAILED(manifestCheck->Begin())) { mSucceeded = false; NotifyState(nsIOfflineCacheUpdateObserver::STATE_ERROR); @@ -2050,7 +2061,7 @@ nsOfflineCacheUpdate::ScheduleImplicit() NS_ERROR("Offline cache update not having set mApplicationCache?"); } - rv = update->InitPartial(mManifestURI, clientID, mDocumentURI); + rv = update->InitPartial(mManifestURI, clientID, mDocumentURI, mLoadingPrincipal); NS_ENSURE_SUCCESS(rv, rv); for (int32_t i = 0; i < mDocumentURIs.Count(); i++) { @@ -2292,6 +2303,7 @@ nsOfflineCacheUpdate::AddURI(nsIURI *aURI, uint32_t aType) RefPtr item = new nsOfflineCacheUpdateItem(aURI, mDocumentURI, + mLoadingPrincipal, mApplicationCache, mPreviousApplicationCache, aType); diff --git a/uriloader/prefetch/nsOfflineCacheUpdate.h b/uriloader/prefetch/nsOfflineCacheUpdate.h index 55e48d86c2..3fec6b8afe 100644 --- a/uriloader/prefetch/nsOfflineCacheUpdate.h +++ b/uriloader/prefetch/nsOfflineCacheUpdate.h @@ -51,16 +51,18 @@ public: nsOfflineCacheUpdateItem(nsIURI *aURI, nsIURI *aReferrerURI, + nsIPrincipal* aLoadingPrincipal, nsIApplicationCache *aApplicationCache, nsIApplicationCache *aPreviousApplicationCache, uint32_t aType); - nsCOMPtr mURI; - nsCOMPtr mReferrerURI; + nsCOMPtr mURI; + nsCOMPtr mReferrerURI; + nsCOMPtr mLoadingPrincipal; nsCOMPtr mApplicationCache; nsCOMPtr mPreviousApplicationCache; - nsCString mCacheKey; - uint32_t mItemType; + nsCString mCacheKey; + uint32_t mItemType; nsresult OpenChannel(nsOfflineCacheUpdate *aUpdate); nsresult Cancel(); @@ -99,6 +101,7 @@ public: nsOfflineManifestItem(nsIURI *aURI, nsIURI *aReferrerURI, + nsIPrincipal* aLoadingPrincipal, nsIApplicationCache *aApplicationCache, nsIApplicationCache *aPreviousApplicationCache); virtual ~nsOfflineManifestItem(); @@ -228,7 +231,7 @@ protected: void OnByteProgress(uint64_t byteIncrement); private: - nsresult InitInternal(nsIURI *aManifestURI); + nsresult InitInternal(nsIURI *aManifestURI, nsIPrincipal* aPrincipal); nsresult HandleManifest(bool *aDoUpdate); nsresult AddURI(nsIURI *aURI, uint32_t aItemType); @@ -275,6 +278,7 @@ private: nsCString mGroupID; nsCOMPtr mManifestURI; nsCOMPtr mDocumentURI; + nsCOMPtr mLoadingPrincipal; nsCOMPtr mCustomProfileDir; uint32_t mAppID; @@ -338,6 +342,7 @@ public: nsresult Schedule(nsIURI *aManifestURI, nsIURI *aDocumentURI, + nsIPrincipal* aLoadingPrincipal, nsIDOMDocument *aDocument, nsIDOMWindow* aWindow, nsIFile* aCustomProfileDir, diff --git a/uriloader/prefetch/nsOfflineCacheUpdateService.cpp b/uriloader/prefetch/nsOfflineCacheUpdateService.cpp index 1ebb33775b..2a4c9ae6a6 100644 --- a/uriloader/prefetch/nsOfflineCacheUpdateService.cpp +++ b/uriloader/prefetch/nsOfflineCacheUpdateService.cpp @@ -132,10 +132,12 @@ public: nsOfflineCachePendingUpdate(nsOfflineCacheUpdateService *aService, nsIURI *aManifestURI, nsIURI *aDocumentURI, + nsIPrincipal* aLoadingPrincipal, nsIDOMDocument *aDocument) : mService(aService) , mManifestURI(aManifestURI) , mDocumentURI(aDocumentURI) + , mLoadingPrincipal(aLoadingPrincipal) , mDidReleaseThis(false) { mDocument = do_GetWeakReference(aDocument); @@ -147,6 +149,7 @@ private: RefPtr mService; nsCOMPtr mManifestURI; nsCOMPtr mDocumentURI; + nsCOMPtr mLoadingPrincipal; nsCOMPtr mDocument; bool mDidReleaseThis; }; @@ -219,9 +222,8 @@ nsOfflineCachePendingUpdate::OnStateChange(nsIWebProgress* aWebProgress, NS_ENSURE_SUCCESS(rv, rv); nsCOMPtr update; - mService->Schedule(mManifestURI, mDocumentURI, - updateDoc, window, nullptr, - appId, isInBrowserElement, getter_AddRefs(update)); + mService->Schedule(mManifestURI, mDocumentURI, mLoadingPrincipal, updateDoc, window, + nullptr, appId, isInBrowserElement, getter_AddRefs(update)); if (mDidReleaseThis) { return NS_OK; } @@ -376,6 +378,7 @@ nsOfflineCacheUpdateService::ScheduleUpdate(nsOfflineCacheUpdate *aUpdate) NS_IMETHODIMP nsOfflineCacheUpdateService::ScheduleOnDocumentStop(nsIURI *aManifestURI, nsIURI *aDocumentURI, + nsIPrincipal* aLoadingPrincipal, nsIDOMDocument *aDocument) { LOG(("nsOfflineCacheUpdateService::ScheduleOnDocumentStop [%p, manifestURI=%p, documentURI=%p doc=%p]", @@ -387,8 +390,8 @@ nsOfflineCacheUpdateService::ScheduleOnDocumentStop(nsIURI *aManifestURI, // Proceed with cache update RefPtr update = - new nsOfflineCachePendingUpdate(this, aManifestURI, - aDocumentURI, aDocument); + new nsOfflineCachePendingUpdate(this, aManifestURI, aDocumentURI, + aLoadingPrincipal, aDocument); NS_ENSURE_TRUE(update, NS_ERROR_OUT_OF_MEMORY); nsresult rv = progress->AddProgressListener @@ -521,6 +524,7 @@ nsOfflineCacheUpdateService::FindUpdate(nsIURI *aManifestURI, nsresult nsOfflineCacheUpdateService::Schedule(nsIURI *aManifestURI, nsIURI *aDocumentURI, + nsIPrincipal* aLoadingPrincipal, nsIDOMDocument *aDocument, nsIDOMWindow* aWindow, nsIFile* aCustomProfileDir, @@ -546,7 +550,7 @@ nsOfflineCacheUpdateService::Schedule(nsIURI *aManifestURI, aWindow->GetApplicationCache(getter_AddRefs(appCacheWindowObject)); } - rv = update->Init(aManifestURI, aDocumentURI, aDocument, + rv = update->Init(aManifestURI, aDocumentURI, aLoadingPrincipal, aDocument, aCustomProfileDir, aAppID, aInBrowser); NS_ENSURE_SUCCESS(rv, rv); @@ -561,6 +565,7 @@ nsOfflineCacheUpdateService::Schedule(nsIURI *aManifestURI, NS_IMETHODIMP nsOfflineCacheUpdateService::ScheduleUpdate(nsIURI *aManifestURI, nsIURI *aDocumentURI, + nsIPrincipal* aLoadingPrincipal, nsIDOMWindow *aWindow, nsIOfflineCacheUpdate **aUpdate) { @@ -570,22 +575,24 @@ nsOfflineCacheUpdateService::ScheduleUpdate(nsIURI *aManifestURI, nsresult rv = GetAppIDAndInBrowserFromWindow(aWindow, &appId, &isInBrowser); NS_ENSURE_SUCCESS(rv, rv); - return Schedule(aManifestURI, aDocumentURI, nullptr, aWindow, nullptr, - appId, isInBrowser, aUpdate); + return Schedule(aManifestURI, aDocumentURI, aLoadingPrincipal, nullptr, aWindow, + nullptr, appId, isInBrowser, aUpdate); } NS_IMETHODIMP nsOfflineCacheUpdateService::ScheduleAppUpdate(nsIURI *aManifestURI, nsIURI *aDocumentURI, + nsIPrincipal* aLoadingPrincipal, uint32_t aAppID, bool aInBrowser, nsIFile *aProfileDir, nsIOfflineCacheUpdate **aUpdate) { - return Schedule(aManifestURI, aDocumentURI, nullptr, nullptr, aProfileDir, - aAppID, aInBrowser, aUpdate); + return Schedule(aManifestURI, aDocumentURI, aLoadingPrincipal, nullptr, nullptr, + aProfileDir, aAppID, aInBrowser, aUpdate); } NS_IMETHODIMP nsOfflineCacheUpdateService::CheckForUpdate(nsIURI *aManifestURI, + nsIPrincipal* aLoadingPrincipal, uint32_t aAppID, bool aInBrowser, nsIObserver *aObserver) @@ -599,7 +606,7 @@ NS_IMETHODIMP nsOfflineCacheUpdateService::CheckForUpdate(nsIURI *aManifestURI, nsresult rv; - rv = update->InitForUpdateCheck(aManifestURI, aAppID, aInBrowser, aObserver); + rv = update->InitForUpdateCheck(aManifestURI, aLoadingPrincipal, aAppID, aInBrowser, aObserver); NS_ENSURE_SUCCESS(rv, rv); rv = update->Schedule(); diff --git a/uriloader/prefetch/nsPrefetchService.cpp b/uriloader/prefetch/nsPrefetchService.cpp index 448f2bbbaf..342ee30525 100644 --- a/uriloader/prefetch/nsPrefetchService.cpp +++ b/uriloader/prefetch/nsPrefetchService.cpp @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ @@ -9,7 +10,7 @@ #include "nsIObserverService.h" #include "nsIWebProgress.h" #include "nsCURILoader.h" -#include "nsICachingChannel.h" +#include "nsICacheInfoChannel.h" #include "nsIHttpChannel.h" #include "nsIURL.h" #include "nsISimpleEnumerator.h" @@ -185,15 +186,17 @@ nsPrefetchNode::OpenChannel() return NS_ERROR_FAILURE; } nsCOMPtr loadGroup = source->OwnerDoc()->GetDocumentLoadGroup(); - nsresult rv = NS_NewChannel(getter_AddRefs(mChannel), - mURI, - nsContentUtils::GetSystemPrincipal(), - nsILoadInfo::SEC_NORMAL, - nsIContentPolicy::TYPE_OTHER, - loadGroup, // aLoadGroup - this, // aCallbacks - nsIRequest::LOAD_BACKGROUND | - nsICachingChannel::LOAD_ONLY_IF_MODIFIED); + nsresult rv = NS_NewChannelInternal(getter_AddRefs(mChannel), + mURI, + source, + source->NodePrincipal(), + nullptr, //aTriggeringPrincipal + nsILoadInfo::SEC_ALLOW_CROSS_ORIGIN_DATA_INHERITS, + nsIContentPolicy::TYPE_OTHER, + loadGroup, // aLoadGroup + this, // aCallbacks + nsIRequest::LOAD_BACKGROUND | + nsICachingChannel::LOAD_ONLY_IF_MODIFIED); NS_ENSURE_SUCCESS(rv, rv); @@ -208,10 +211,7 @@ nsPrefetchNode::OpenChannel() false); } - rv = mChannel->AsyncOpen(this, nullptr); - NS_ENSURE_SUCCESS(rv, rv); - - return NS_OK; + return mChannel->AsyncOpen2(this); } nsresult @@ -244,13 +244,13 @@ nsPrefetchNode::OnStartRequest(nsIRequest *aRequest, { nsresult rv; - nsCOMPtr cachingChannel = + nsCOMPtr cacheInfoChannel = do_QueryInterface(aRequest, &rv); if (NS_FAILED(rv)) return rv; - + // no need to prefetch a document that is already in the cache bool fromCache; - if (NS_SUCCEEDED(cachingChannel->IsFromCache(&fromCache)) && + if (NS_SUCCEEDED(cacheInfoChannel->IsFromCache(&fromCache)) && fromCache) { LOG(("document is already in the cache; canceling prefetch\n")); return NS_BINDING_ABORTED; @@ -260,17 +260,8 @@ nsPrefetchNode::OnStartRequest(nsIRequest *aRequest, // no need to prefetch a document that must be requested fresh each // and every time. // - nsCOMPtr cacheToken; - cachingChannel->GetCacheToken(getter_AddRefs(cacheToken)); - if (!cacheToken) - return NS_ERROR_ABORT; // bail, no cache entry - - nsCOMPtr entryInfo = - do_QueryInterface(cacheToken, &rv); - if (NS_FAILED(rv)) return rv; - uint32_t expTime; - if (NS_SUCCEEDED(entryInfo->GetExpirationTime(&expTime))) { + if (NS_SUCCEEDED(cacheInfoChannel->GetCacheTokenExpirationTime(&expTime))) { if (NowInSeconds() >= expTime) { LOG(("document cannot be reused from cache; " "canceling prefetch\n")); diff --git a/widget/PuppetWidget.cpp b/widget/PuppetWidget.cpp index def89a664a..d9fa697d66 100644 --- a/widget/PuppetWidget.cpp +++ b/widget/PuppetWidget.cpp @@ -255,8 +255,10 @@ PuppetWidget::ConfigureChildren(const nsTArray& aConfigurations) NS_IMETHODIMP PuppetWidget::SetFocus(bool aRaise) { - // XXX/cjones: someone who knows about event handling needs to - // decide how this should work. + if (aRaise && mTabChild) { + mTabChild->SendRequestFocus(true); + } + return NS_OK; }