From 1b55e83f7a90593ff77bcccc83b337721773de74 Mon Sep 17 00:00:00 2001 From: Stefan Hindli Date: Wed, 15 Apr 2020 08:41:10 +0300 Subject: [PATCH] Backed out 2 changesets (bug 1594529) for causing perma wpt2 with ValueError: badly formed hexadecimal UUID string in /cookies/samesite/iframe-reload.https.html CLOSED TREE Backed out changeset fbf55a44d7fb (bug 1594529) Backed out changeset 4ba9a230586a (bug 1594529) --- docshell/base/CanonicalBrowsingContext.cpp | 8 - docshell/base/CanonicalBrowsingContext.h | 3 - docshell/base/nsDocShell.cpp | 19 +- docshell/base/nsDocShell.h | 6 +- dom/base/Document.cpp | 26 +-- dom/base/Document.h | 8 - dom/base/ThirdPartyUtil.cpp | 33 --- dom/base/ThirdPartyUtil.h | 4 - dom/base/nsFrameLoader.cpp | 2 + dom/base/nsGlobalWindowInner.cpp | 8 - dom/base/nsGlobalWindowOuter.cpp | 15 -- dom/ipc/ContentParent.cpp | 2 +- dom/ipc/PWindowGlobal.ipdl | 22 -- dom/ipc/WindowGlobalChild.cpp | 7 - dom/ipc/WindowGlobalChild.h | 3 - dom/ipc/WindowGlobalParent.cpp | 48 +--- dom/ipc/WindowGlobalParent.h | 30 --- gfx/layers/ipc/CompositorBridgeParent.h | 2 +- netwerk/base/LoadInfo.cpp | 207 +----------------- netwerk/base/LoadInfo.h | 7 - netwerk/ipc/DocumentChannelChild.cpp | 18 +- netwerk/ipc/DocumentChannelParent.cpp | 10 +- netwerk/ipc/DocumentLoadListener.cpp | 58 ++--- netwerk/ipc/DocumentLoadListener.h | 12 +- netwerk/ipc/NeckoChannelParams.ipdlh | 1 + netwerk/ipc/NeckoParent.cpp | 12 +- .../passwordmgr/test/mochitest/mochitest.ini | 1 + 27 files changed, 84 insertions(+), 488 deletions(-) diff --git a/docshell/base/CanonicalBrowsingContext.cpp b/docshell/base/CanonicalBrowsingContext.cpp index 63ba94d89b54..d23a42cd99bb 100644 --- a/docshell/base/CanonicalBrowsingContext.cpp +++ b/docshell/base/CanonicalBrowsingContext.cpp @@ -156,14 +156,6 @@ CanonicalBrowsingContext::GetEmbedderWindowGlobal() const { return WindowGlobalParent::GetByInnerWindowId(windowId); } -already_AddRefed -CanonicalBrowsingContext::GetParentWindowGlobal() const { - if (GetParent()) { - return GetEmbedderWindowGlobal(); - } - return nullptr; -} - nsISHistory* CanonicalBrowsingContext::GetSessionHistory() { if (mSessionHistory) { return mSessionHistory; diff --git a/docshell/base/CanonicalBrowsingContext.h b/docshell/base/CanonicalBrowsingContext.h index cb315d16249e..cd1230655052 100644 --- a/docshell/base/CanonicalBrowsingContext.h +++ b/docshell/base/CanonicalBrowsingContext.h @@ -65,9 +65,6 @@ class CanonicalBrowsingContext final : public BrowsingContext { already_AddRefed GetEmbedderWindowGlobal() const; - // Same as GetEmbedderWindowGlobal but within the same browsing context group - already_AddRefed GetParentWindowGlobal() const; - nsISHistory* GetSessionHistory(); void SetSessionHistory(nsISHistory* aSHistory) { mSessionHistory = aSHistory; diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index 0a7fa4c51b1f..644ad8e395ea 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -398,6 +398,7 @@ nsDocShell::nsDocShell(BrowsingContext* aBrowsingContext, mHasLoadedNonBlankURI(false), mBlankTiming(false), mTitleValidForCurrentURI(false), + mIsFrame(false), mWillChangeProcess(false), mWatchedByDevtools(false), mIsNavigating(false) { @@ -9634,17 +9635,11 @@ nsresult nsDocShell::DoURILoad(nsDocShellLoadState* aLoadState, "subframes should have the same docshell type as their parent"); #endif } else { - if (mIsBeingDestroyed) { - // If this isn't a top-level load and mScriptGlobal's frame element is - // null, then the element got removed from the DOM while we were trying - // to load this resource. This docshell is scheduled for destruction - // already, so bail out here. - return NS_OK; - } - // If we are not being destroyed and we do not have access to the loading - // node, then we are a remote subframe. Set the loading principal - // to be a null principal and then set it correctly in the parent. - loadingPrincipal = NullPrincipal::Create(GetOriginAttributes(), nullptr); + // If this isn't a top-level load and mScriptGlobal's frame element is + // null, then the element got removed from the DOM while we were trying + // to load this resource. This docshell is scheduled for destruction + // already, so bail out here. + return NS_OK; } } @@ -11642,6 +11637,8 @@ nsresult nsDocShell::EnsureFind() { return NS_OK; } +bool nsDocShell::IsFrame() { return mIsFrame; } + NS_IMETHODIMP nsDocShell::IsBeingDestroyed(bool* aDoomed) { NS_ENSURE_ARG(aDoomed); diff --git a/docshell/base/nsDocShell.h b/docshell/base/nsDocShell.h index 2f9dabf4eb38..6492c48cf1d4 100644 --- a/docshell/base/nsDocShell.h +++ b/docshell/base/nsDocShell.h @@ -360,6 +360,8 @@ class nsDocShell final : public nsDocLoader, void SetInFrameSwap(bool aInSwap) { mInFrameSwap = aInSwap; } bool InFrameSwap(); + void SetIsFrame() { mIsFrame = true; }; + const mozilla::Encoding* GetForcedCharset() { return mForcedCharset; } mozilla::HTMLEditor* GetHTMLEditorInternal(); @@ -1000,7 +1002,7 @@ class nsDocShell final : public nsDocLoader, void RecomputeCanExecuteScripts(); void ClearFrameHistory(nsISHEntry* aEntry); void UpdateGlobalHistoryTitle(nsIURI* aURI); - bool IsFrame() { return mBrowsingContext->GetParent(); } + bool IsFrame(); bool CanSetOriginAttributes(); bool ShouldBlockLoadingForBackButton(); bool ShouldDiscardLayoutState(nsIHttpChannel* aChannel); @@ -1331,6 +1333,8 @@ class nsDocShell final : public nsDocLoader, // This flag indicates when the title is valid for the current URI. bool mTitleValidForCurrentURI : 1; + bool mIsFrame : 1; + // If mWillChangeProcess is set to true, then when the docshell is destroyed, // we prepare the browsing context to change process. bool mWillChangeProcess : 1; diff --git a/dom/base/Document.cpp b/dom/base/Document.cpp index f6f5ed935153..c381236e6fad 100644 --- a/dom/base/Document.cpp +++ b/dom/base/Document.cpp @@ -3243,11 +3243,6 @@ void Document::ApplySettingsFromCSP(bool aSpeculative) { if (!mUpgradeInsecurePreloads) { mUpgradeInsecurePreloads = mUpgradeInsecureRequests; } - // Update csp settings in the parent process - if (auto* wgc = GetWindowGlobalChild()) { - wgc->SendUpdateDocumentCspSettings(mBlockAllMixedContent, - mUpgradeInsecureRequests); - } } return; } @@ -15008,10 +15003,6 @@ void Document::SetUserHasInteracted() { nsCOMPtr loadInfo = mChannel->LoadInfo(); loadInfo->SetDocumentHasUserInteracted(true); } - // Tell the parent process about user interaction - if (auto* wgc = GetWindowGlobalChild()) { - wgc->SendUpdateDocumentHasUserInteracted(true); - } MaybeAllowStorageForOpenerAfterUserInteraction(); } @@ -16159,17 +16150,6 @@ nsICookieJarSettings* Document::CookieJarSettings() { ? net::CookieJarSettings::Create( inProcessParent->CookieJarSettings()->GetCookieBehavior()) : net::CookieJarSettings::Create(); - - if (auto* wgc = GetWindowGlobalChild()) { - net::CookieJarSettingsArgs csArgs; - net::CookieJarSettings::Cast(mCookieJarSettings)->Serialize(csArgs); - // Update cookie settings in the parent process - if (!wgc->SendUpdateCookieJarSettings(csArgs)) { - NS_WARNING( - "Failed to update document's cookie jar settings on the " - "WindowGlobalParent"); - } - } } return mCookieJarSettings; @@ -16211,8 +16191,10 @@ void Document::SetIsInitialDocument(bool aIsInitialDocument) { // Asynchronously tell the parent process that we are, or are no longer, the // initial document. This happens async. - if (auto* wgc = GetWindowGlobalChild()) { - wgc->SendSetIsInitialDocument(aIsInitialDocument); + if (RefPtr inner = GetInnerWindow()) { + if (RefPtr wgc = inner->GetWindowGlobalChild()) { + wgc->SendSetIsInitialDocument(aIsInitialDocument); + } } } diff --git a/dom/base/Document.h b/dom/base/Document.h index 9811be178b71..38c6b0c4cd5b 100644 --- a/dom/base/Document.h +++ b/dom/base/Document.h @@ -1847,14 +1847,6 @@ class Document : public nsINode, return window ? window->WindowID() : 0; } - /** - * Return WindowGlobalChild that is associated with the inner window. - */ - WindowGlobalChild* GetWindowGlobalChild() { - return GetInnerWindow() ? GetInnerWindow()->GetWindowGlobalChild() - : nullptr; - } - bool IsTopLevelWindowInactive() const; /** diff --git a/dom/base/ThirdPartyUtil.cpp b/dom/base/ThirdPartyUtil.cpp index 685029c28a9f..568b120811f6 100644 --- a/dom/base/ThirdPartyUtil.cpp +++ b/dom/base/ThirdPartyUtil.cpp @@ -274,39 +274,6 @@ ThirdPartyUtil::IsThirdPartyWindow(mozIDOMWindowProxy* aWindow, nsIURI* aURI, return NS_ERROR_UNEXPECTED; } -nsresult ThirdPartyUtil::IsThirdPartyGlobal( - mozilla::dom::WindowGlobalParent* aWindowGlobal, bool* aResult) { - NS_ENSURE_ARG(aWindowGlobal); - NS_ASSERTION(aResult, "null outparam pointer"); - - auto* currentWGP = aWindowGlobal; - do { - MOZ_ASSERT(currentWGP->BrowsingContext()); - if (currentWGP->BrowsingContext()->IsTop()) { - *aResult = false; - return NS_OK; - } - nsCOMPtr currentPrincipal = currentWGP->DocumentPrincipal(); - RefPtr parent = - currentWGP->BrowsingContext()->GetEmbedderWindowGlobal(); - if (!parent) { - return NS_ERROR_FAILURE; - } - nsCOMPtr parentPrincipal = parent->DocumentPrincipal(); - nsresult rv = - currentPrincipal->IsThirdPartyPrincipal(parentPrincipal, aResult); - if (NS_FAILED(rv)) { - return rv; - } - - if (*aResult) { - return NS_OK; - } - - currentWGP = parent; - } while (true); -} - // Determine if the URI associated with aChannel or any URI of the window // hierarchy associated with the channel is foreign with respect to aSecondURI. // See docs for mozIThirdPartyUtil. diff --git a/dom/base/ThirdPartyUtil.h b/dom/base/ThirdPartyUtil.h index 84190915ae55..6e4ef7317763 100644 --- a/dom/base/ThirdPartyUtil.h +++ b/dom/base/ThirdPartyUtil.h @@ -14,7 +14,6 @@ #include "nsEffectiveTLDService.h" #include "nsString.h" #include "nsPIDOMWindow.h" -#include "mozilla/dom/WindowGlobalParent.h" class nsIURI; class nsPIDOMWindowOuter; @@ -29,9 +28,6 @@ class ThirdPartyUtil final : public mozIThirdPartyUtil { static void Startup(); static ThirdPartyUtil* GetInstance(); - nsresult IsThirdPartyGlobal(mozilla::dom::WindowGlobalParent* aWindowGlobal, - bool* aResult); - private: ~ThirdPartyUtil(); diff --git a/dom/base/nsFrameLoader.cpp b/dom/base/nsFrameLoader.cpp index 5f4c2986fbe6..11da7a0ebb0e 100644 --- a/dom/base/nsFrameLoader.cpp +++ b/dom/base/nsFrameLoader.cpp @@ -2147,6 +2147,8 @@ nsresult nsFrameLoader::MaybeCreateDocShell() { if (OwnerIsMozBrowserFrame()) { docShell->SetFrameType(nsIDocShell::FRAME_TYPE_BROWSER); + } else if (mPendingBrowsingContext->GetParent()) { + docShell->SetIsFrame(); } // Apply sandbox flags even if our owner is not an iframe, as this copies diff --git a/dom/base/nsGlobalWindowInner.cpp b/dom/base/nsGlobalWindowInner.cpp index 6d3755702adc..8de8b1b752dd 100644 --- a/dom/base/nsGlobalWindowInner.cpp +++ b/dom/base/nsGlobalWindowInner.cpp @@ -1996,19 +1996,11 @@ nsresult nsGlobalWindowInner::PostHandleEvent(EventChainPostVisitor& aVisitor) { } } mIsDocumentLoaded = false; - // Tell the parent process that the document is not loaded. - if (mWindowGlobalChild) { - mWindowGlobalChild->SendUpdateDocumentHasLoaded(mIsDocumentLoaded); - } } else if (aVisitor.mEvent->mMessage == eLoad && aVisitor.mEvent->IsTrusted()) { // This is page load event since load events don't propagate to |window|. // @see Document::GetEventTargetParent. mIsDocumentLoaded = true; - // Tell the parent process that the document is loaded. - if (mWindowGlobalChild) { - mWindowGlobalChild->SendUpdateDocumentHasLoaded(mIsDocumentLoaded); - } mTimeoutManager->OnDocumentLoaded(); diff --git a/dom/base/nsGlobalWindowOuter.cpp b/dom/base/nsGlobalWindowOuter.cpp index de5592360edf..681832a37121 100644 --- a/dom/base/nsGlobalWindowOuter.cpp +++ b/dom/base/nsGlobalWindowOuter.cpp @@ -2415,21 +2415,6 @@ nsresult nsGlobalWindowOuter::SetNewDocument(Document* aDocument, WindowGlobalChild* wgc = mInnerWindow->GetWindowGlobalChild(); wgc->SetDocumentURI(aDocument->GetDocumentURI()); - wgc->SetDocumentPrincipal(aDocument->NodePrincipal()); - - wgc->SendUpdateDocumentCspSettings( - aDocument->GetBlockAllMixedContent(false), - aDocument->GetUpgradeInsecureRequests(false)); - wgc->SendUpdateSandboxFlags(aDocument->GetSandboxFlags()); - net::CookieJarSettingsArgs csArgs; - net::CookieJarSettings::Cast(aDocument->CookieJarSettings()) - ->Serialize(csArgs); - if (!wgc->SendUpdateCookieJarSettings(csArgs)) { - NS_WARNING( - "Failed to update document's cookie jar settings on the " - "WindowGlobalParent"); - } - RefPtr bc = GetBrowsingContext(); bc->SetCurrentInnerWindowId(mInnerWindow->WindowID()); diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp index 030b4f218a3a..f3443b3a6979 100644 --- a/dom/ipc/ContentParent.cpp +++ b/dom/ipc/ContentParent.cpp @@ -5411,7 +5411,7 @@ nsresult ContentParent::AboutToLoadHttpFtpDocumentForChild( NS_ENSURE_SUCCESS(rv, rv); RefPtr browsingContext; - rv = loadInfo->GetTargetBrowsingContext(getter_AddRefs(browsingContext)); + rv = loadInfo->GetBrowsingContext(getter_AddRefs(browsingContext)); NS_ENSURE_SUCCESS(rv, rv); if (browsingContext && !browsingContext->IsDiscarded()) { diff --git a/dom/ipc/PWindowGlobal.ipdl b/dom/ipc/PWindowGlobal.ipdl index 863692fc9641..1c5f214ffa7a 100644 --- a/dom/ipc/PWindowGlobal.ipdl +++ b/dom/ipc/PWindowGlobal.ipdl @@ -12,7 +12,6 @@ include protocol PBrowserBridge; include DOMTypes; include ClientIPCTypes; -include NeckoChannelParams; using JSWindowActorMessageKind from "mozilla/dom/JSWindowActor.h"; using mozilla::gfx::IntRect from "mozilla/gfx/Rect.h"; @@ -84,27 +83,6 @@ parent: /// Update the URI of the document in this WindowGlobal. async UpdateDocumentURI(nsIURI aUri); - // We expose frameAncestors to web-extensions and they extract URIs from the - // principals collected. In order to be compatible with that API, we need to - // update the document's principal. This is only allowed if the principals are - // `equals` to each other. - async UpdateDocumentPrincipal(nsIPrincipal aPrincipal); - - // Update document's `documentHasLoaded` bit in this WindowGlobal. - async UpdateDocumentHasLoaded(bool aDocumentHasLoaded); - - // Update document's 'documentHasUserInteracted' bit in this WindowGlobal. - async UpdateDocumentHasUserInteracted(bool aDocumentHasUserInteracted); - - // Update document's sandbox flags in this WindowGlobal. - async UpdateSandboxFlags(uint32_t aSandboxFlags); - - // Update document csp's fields in this WindowGlobal. - async UpdateDocumentCspSettings(bool aBlockAllMixedContent, bool aUpgradeInsecureRequests); - - // Update document's cookie settings in this WindowGlobal. - async UpdateCookieJarSettings(CookieJarSettingsArgs cookieJarSettings); - // Update the title of the document in this WindowGlobal. async UpdateDocumentTitle(nsString aTitle); diff --git a/dom/ipc/WindowGlobalChild.cpp b/dom/ipc/WindowGlobalChild.cpp index 8376646c9063..a78e2beac376 100644 --- a/dom/ipc/WindowGlobalChild.cpp +++ b/dom/ipc/WindowGlobalChild.cpp @@ -455,13 +455,6 @@ void WindowGlobalChild::SetDocumentURI(nsIURI* aDocumentURI) { SendUpdateDocumentURI(aDocumentURI); } -void WindowGlobalChild::SetDocumentPrincipal( - nsIPrincipal* aNewDocumentPrincipal) { - MOZ_ASSERT(mDocumentPrincipal->Equals(aNewDocumentPrincipal)); - mDocumentPrincipal = aNewDocumentPrincipal; - SendUpdateDocumentPrincipal(aNewDocumentPrincipal); -} - const nsAString& WindowGlobalChild::GetRemoteType() { if (XRE_IsContentProcess()) { return ContentChild::GetSingleton()->GetRemoteType(); diff --git a/dom/ipc/WindowGlobalChild.h b/dom/ipc/WindowGlobalChild.h index 96bf99ee6c84..cd58a8cb0a3b 100644 --- a/dom/ipc/WindowGlobalChild.h +++ b/dom/ipc/WindowGlobalChild.h @@ -61,9 +61,6 @@ class WindowGlobalChild final : public WindowGlobalActor, nsIURI* GetDocumentURI() override { return mDocumentURI; } void SetDocumentURI(nsIURI* aDocumentURI); - // See the corresponding comment for `UpdateDocumentPrincipal` in - // PWindowGlobal on why and when this is allowed - void SetDocumentPrincipal(nsIPrincipal* aNewDocumentPrincipal); nsIPrincipal* DocumentPrincipal() { return mDocumentPrincipal; } diff --git a/dom/ipc/WindowGlobalParent.cpp b/dom/ipc/WindowGlobalParent.cpp index b0bb5e227e7f..cde409b9fa87 100644 --- a/dom/ipc/WindowGlobalParent.cpp +++ b/dom/ipc/WindowGlobalParent.cpp @@ -59,12 +59,7 @@ WindowGlobalParent::WindowGlobalParent(const WindowGlobalInit& aInit, mDocumentURI(aInit.documentURI()), mInProcess(aInProcess), mIsInitialDocument(false), - mHasBeforeUnload(false), - mSandboxFlags(0), - mDocumentHasLoaded(false), - mDocumentHasUserInteracted(false), - mBlockAllMixedContent(false), - mUpgradeInsecureRequests(false) { + mHasBeforeUnload(false) { MOZ_DIAGNOSTIC_ASSERT(XRE_IsParentProcess(), "Parent process only"); MOZ_RELEASE_ASSERT( @@ -254,46 +249,12 @@ IPCResult WindowGlobalParent::RecvUpdateDocumentURI(nsIURI* aURI) { return IPC_OK(); } -IPCResult WindowGlobalParent::RecvUpdateDocumentPrincipal( - nsIPrincipal* aNewDocumentPrincipal) { - if (!mDocumentPrincipal->Equals(aNewDocumentPrincipal)) { - return IPC_FAIL(this, - "Trying to reuse WindowGlobalParent but the principal of " - "the new document does not match the old one"); - } - mDocumentPrincipal = aNewDocumentPrincipal; - return IPC_OK(); -} mozilla::ipc::IPCResult WindowGlobalParent::RecvUpdateDocumentTitle( const nsString& aTitle) { mDocumentTitle = aTitle; return IPC_OK(); } -IPCResult WindowGlobalParent::RecvUpdateDocumentHasLoaded( - bool aDocumentHasLoaded) { - mDocumentHasLoaded = aDocumentHasLoaded; - return IPC_OK(); -} - -IPCResult WindowGlobalParent::RecvUpdateDocumentHasUserInteracted( - bool aDocumentHasUserInteracted) { - mDocumentHasUserInteracted = aDocumentHasUserInteracted; - return IPC_OK(); -} - -IPCResult WindowGlobalParent::RecvUpdateSandboxFlags(uint32_t aSandboxFlags) { - mSandboxFlags = aSandboxFlags; - return IPC_OK(); -} - -IPCResult WindowGlobalParent::RecvUpdateDocumentCspSettings( - bool aBlockAllMixedContent, bool aUpgradeInsecureRequests) { - mBlockAllMixedContent = aBlockAllMixedContent; - mUpgradeInsecureRequests = aUpgradeInsecureRequests; - return IPC_OK(); -} - IPCResult WindowGlobalParent::RecvSetHasBeforeUnload(bool aHasBeforeUnload) { mHasBeforeUnload = aHasBeforeUnload; return IPC_OK(); @@ -502,13 +463,6 @@ mozilla::ipc::IPCResult WindowGlobalParent::RecvGetContentBlockingEvents( return IPC_OK(); } -mozilla::ipc::IPCResult WindowGlobalParent::RecvUpdateCookieJarSettings( - const CookieJarSettingsArgs& aCookieJarSettingsArgs) { - net::CookieJarSettings::Deserialize(aCookieJarSettingsArgs, - getter_AddRefs(mCookieJarSettings)); - return IPC_OK(); -} - mozilla::ipc::IPCResult WindowGlobalParent::RecvShare( IPCWebShareData&& aData, WindowGlobalParent::ShareResolver&& aResolver) { // Widget Layer handoff... diff --git a/dom/ipc/WindowGlobalParent.h b/dom/ipc/WindowGlobalParent.h index f5e8d40be726..3e4e1aad9860 100644 --- a/dom/ipc/WindowGlobalParent.h +++ b/dom/ipc/WindowGlobalParent.h @@ -22,7 +22,6 @@ #include "nsIContentParent.h" #include "mozilla/dom/WindowGlobalActor.h" #include "mozilla/dom/CanonicalBrowsingContext.h" -#include "mozilla/net/CookieJarSettings.h" class nsIPrincipal; class nsIURI; @@ -163,18 +162,6 @@ class WindowGlobalParent final : public WindowContext, nsIContentParent* GetContentParent(); - nsICookieJarSettings* CookieJarSettings() { return mCookieJarSettings; } - - bool DocumentHasLoaded() { return mDocumentHasLoaded; } - - bool DocumentHasUserInteracted() { return mDocumentHasUserInteracted; } - - uint32_t SandboxFlags() { return mSandboxFlags; } - - bool GetDocumentBlockAllMixedContent() { return mBlockAllMixedContent; } - - bool GetDocumentUpgradeInsecureRequests() { return mUpgradeInsecureRequests; } - protected: const nsAString& GetRemoteType() override; JSWindowActor::Type GetSide() override { return JSWindowActor::Type::Parent; } @@ -187,14 +174,6 @@ class WindowGlobalParent final : public WindowContext, const MaybeDiscarded& aTargetBC, nsDocShellLoadState* aLoadState); mozilla::ipc::IPCResult RecvUpdateDocumentURI(nsIURI* aURI); - mozilla::ipc::IPCResult RecvUpdateDocumentPrincipal( - nsIPrincipal* aNewDocumentPrincipal); - mozilla::ipc::IPCResult RecvUpdateDocumentHasLoaded(bool aDocumentHasLoaded); - mozilla::ipc::IPCResult RecvUpdateDocumentHasUserInteracted( - bool aDocumentHasUserInteracted); - mozilla::ipc::IPCResult RecvUpdateSandboxFlags(uint32_t aSandboxFlags); - mozilla::ipc::IPCResult RecvUpdateDocumentCspSettings( - bool aBlockAllMixedContent, bool aUpgradeInsecureRequests); mozilla::ipc::IPCResult RecvUpdateDocumentTitle(const nsString& aTitle); mozilla::ipc::IPCResult RecvSetIsInitialDocument(bool aIsInitialDocument) { mIsInitialDocument = aIsInitialDocument; @@ -210,8 +189,6 @@ class WindowGlobalParent final : public WindowContext, mozilla::ipc::IPCResult RecvGetContentBlockingEvents( GetContentBlockingEventsResolver&& aResolver); - mozilla::ipc::IPCResult RecvUpdateCookieJarSettings( - const CookieJarSettingsArgs& aCookieJarSettingsArgs); void ActorDestroy(ActorDestroyReason aWhy) override; @@ -246,13 +223,6 @@ class WindowGlobalParent final : public WindowContext, ContentBlockingLog mContentBlockingLog; Maybe mClientInfo; - // Fields being mirrored from the corresponding document - nsCOMPtr mCookieJarSettings; - uint32_t mSandboxFlags; - bool mDocumentHasLoaded; - bool mDocumentHasUserInteracted; - bool mBlockAllMixedContent; - bool mUpgradeInsecureRequests; }; } // namespace dom diff --git a/gfx/layers/ipc/CompositorBridgeParent.h b/gfx/layers/ipc/CompositorBridgeParent.h index 7317150481a7..ac0eb3f0ba24 100644 --- a/gfx/layers/ipc/CompositorBridgeParent.h +++ b/gfx/layers/ipc/CompositorBridgeParent.h @@ -53,9 +53,9 @@ class nsIWidget; namespace mozilla { class CancelableRunnable; -class HostWebGLCommandSink; namespace dom { +class HostWebGLCommandSink; class WebGLParent; } // namespace dom diff --git a/netwerk/base/LoadInfo.cpp b/netwerk/base/LoadInfo.cpp index 25a2e55aa7bf..b0b8cefc3145 100644 --- a/netwerk/base/LoadInfo.cpp +++ b/netwerk/base/LoadInfo.cpp @@ -22,7 +22,6 @@ #include "mozilla/StaticPrefs_network.h" #include "mozilla/StaticPrefs_security.h" #include "mozIThirdPartyUtil.h" -#include "ThirdPartyUtil.h" #include "nsFrameLoader.h" #include "nsFrameLoaderOwner.h" #include "nsIContentSecurityPolicy.h" @@ -39,7 +38,6 @@ #include "nsQueryObject.h" #include "nsRedirectHistoryEntry.h" #include "nsSandboxFlags.h" -#include "nsICookieService.h" using namespace mozilla::dom; @@ -292,6 +290,7 @@ LoadInfo::LoadInfo( } } } + mOriginAttributes = mLoadingPrincipal->OriginAttributesRef(); // We need to do this after inheriting the document's origin attributes @@ -522,195 +521,6 @@ LoadInfo::LoadInfo(dom::CanonicalBrowsingContext* aBrowsingContext, mCookieJarSettings = CookieJarSettings::Create(); } -LoadInfo::LoadInfo(dom::CanonicalBrowsingContext* aBrowsingContext, - nsIPrincipal* aTriggeringPrincipal, - uint64_t aFrameOuterWindowID, nsSecurityFlags aSecurityFlags, - uint32_t aSandboxFlags) - : mLoadingPrincipal(nullptr), - mTriggeringPrincipal(aTriggeringPrincipal), - mPrincipalToInherit(nullptr), - mClientInfo(Maybe()), - mController(Maybe()), - mLoadingContext(nullptr), - mContextForTopLevelLoad(nullptr), - mSecurityFlags(aSecurityFlags), - mSandboxFlags(aSandboxFlags), - mTainting(LoadTainting::Basic), - mBlockAllMixedContent(false), - mUpgradeInsecureRequests(false), - mBrowserUpgradeInsecureRequests(false), - mBrowserWouldUpgradeInsecureRequests(false), - mForceAllowDataURI(false), - mAllowInsecureRedirectToDataURI(false), - mBypassCORSChecks(false), - mSkipContentPolicyCheckForWebRequest(false), - mOriginalFrameSrcLoad(false), - mForceInheritPrincipalDropped(false), - mInnerWindowID(0), - mOuterWindowID(0), - mParentOuterWindowID(0), - mTopOuterWindowID(0), - mFrameOuterWindowID(aFrameOuterWindowID), - mBrowsingContextID(0), - mFrameBrowsingContextID(0), - // annyG: we are mimicking the old LoadInfo since it has gone through - // security checks in the content and we wouldn't reach this point - // if the load got blocked earlier. - mInitialSecurityCheckDone(true), - mIsThirdPartyContext(false), - mIsFormSubmission(false), - mSendCSPViolationEvents(true), - mRequestBlockingReason(BLOCKING_REASON_NONE), - mForcePreflight(false), - mIsPreflight(false), - mLoadTriggeredFromExternal(false), - mServiceWorkerTaintingSynthesized(false), - mDocumentHasUserInteracted(false), - mDocumentHasLoaded(false), - mAllowListFutureDocumentsCreatedFromThisRedirectChain(false), - mSkipContentSniffing(false), - mHttpsOnlyStatus(nsILoadInfo::HTTPS_ONLY_UNINITIALIZED), - mAllowDeprecatedSystemRequests(false), - mParserCreatedScript(false), - mHasStoragePermission(false), - mIsFromProcessingFrameAttributes(false) { - RefPtr embedderWGP = - aBrowsingContext->GetParentWindowGlobal(); - BrowsingContext* embedderBC = embedderWGP->BrowsingContext(); - MOZ_ASSERT(embedderBC); - nsTArray> ancestorPrincipals; - nsTArray ancestorOuterWindowIDs; - CanonicalBrowsingContext* ancestorBC = embedderBC->Canonical(); - RefPtr topLevelWGP = embedderWGP; - - // Iterate over ancestor WindowGlobalParent's - collect principals and - // outer window IDs. Also note the top level WindowGlobalParent. - while (RefPtr ancestorWGP = - ancestorBC->GetParentWindowGlobal()) { - nsCOMPtr parentPrincipal = ancestorWGP->DocumentPrincipal(); - MOZ_ASSERT(parentPrincipal, "Ancestor principal is null"); - ancestorPrincipals.AppendElement(parentPrincipal.forget()); - ancestorOuterWindowIDs.AppendElement(ancestorWGP->OuterWindowId()); - topLevelWGP = ancestorWGP; - ancestorBC = ancestorWGP->BrowsingContext(); - } - mAncestorPrincipals = ancestorPrincipals; - mAncestorOuterWindowIDs = ancestorOuterWindowIDs; - MOZ_DIAGNOSTIC_ASSERT(mAncestorPrincipals.Length() == - mAncestorOuterWindowIDs.Length()); - - if (RefPtr ancestorWGP = - embedderWGP->BrowsingContext()->GetParentWindowGlobal()) { - mParentOuterWindowID = ancestorWGP->OuterWindowId(); - } else { - mParentOuterWindowID = embedderWGP->OuterWindowId(); - } - - // if the load is sandboxed, we can not also inherit the principal - if (mSandboxFlags & SANDBOXED_ORIGIN) { - mForceInheritPrincipalDropped = - (mSecurityFlags & nsILoadInfo::SEC_FORCE_INHERIT_PRINCIPAL); - mSecurityFlags &= ~nsILoadInfo::SEC_FORCE_INHERIT_PRINCIPAL; - } - - const auto& maybeEmbedderElementType = - aBrowsingContext->GetEmbedderElementType(); - MOZ_ASSERT(maybeEmbedderElementType.isSome()); - auto embedderElementType = maybeEmbedderElementType.value(); - - // Assign same type as in nsDocShell::DetermineContentType. - // N.B. internal content policy type will never be TYPE_DOCUMENT - mInternalContentPolicyType = nsIContentPolicy::TYPE_INTERNAL_FRAME; - if (embedderElementType.EqualsLiteral("iframe")) { - mInternalContentPolicyType = nsIContentPolicy::TYPE_INTERNAL_IFRAME; - } - - // Ensure that all network requests for a window client have the ClientInfo - // properly set. - mClientInfo = embedderWGP->GetClientInfo(); - mLoadingPrincipal = embedderWGP->DocumentPrincipal(); - ComputeIsThirdPartyContext(embedderWGP); - - // When the element being loaded is a frame, we choose the frame's window - // for the window ID (see mInnerWindowID being set below) and the frame - // element's window as the parent window. This is the behavior that Chrome - // exposes to add-ons. - mOuterWindowID = embedderWGP->OuterWindowId(); - mTopOuterWindowID = topLevelWGP->OuterWindowId(); - mBrowsingContextID = embedderBC->Id(); - - // Let's inherit the cookie behavior and permission from the embedder - // document. - mCookieJarSettings = embedderWGP->CookieJarSettings(); - if (embedderBC->IsContentSubframe()) { - mDocumentHasLoaded = false; - } else { - mDocumentHasLoaded = embedderWGP->DocumentHasLoaded(); - } - if (topLevelWGP->BrowsingContext()->IsTop()) { - if (mCookieJarSettings) { - bool stopAtOurLevel = mCookieJarSettings->GetCookieBehavior() == - nsICookieService::BEHAVIOR_REJECT_TRACKER; - if (!stopAtOurLevel || - topLevelWGP->OuterWindowId() != embedderWGP->OuterWindowId()) { - mTopLevelPrincipal = topLevelWGP->DocumentPrincipal(); - } - } - if (embedderBC->IsContentSubframe()) { - // For resources within iframes, we actually want the - // top-level document's flag, not the iframe document's. - mDocumentHasLoaded = topLevelWGP->DocumentHasLoaded(); - } - } - - // The top-level-storage-area-principal is not null only for the first - // level of iframes (null for top-level contexts, and null for - // sub-iframes). If we are loading a sub-document resource, we must - // calculate what the top-level-storage-area-principal will be for the - // new context. - if (embedderBC->IsTop()) { - if (!Document::StorageAccessSandboxed(embedderWGP->SandboxFlags())) { - mTopLevelStorageAreaPrincipal = embedderWGP->DocumentPrincipal(); - } - - // If this is the first level iframe, embedder WindowGlobalParent's document - // principal is our top-level principal. - if (!mTopLevelPrincipal) { - mTopLevelPrincipal = embedderWGP->DocumentPrincipal(); - } - } - - mInnerWindowID = embedderWGP->InnerWindowId(); - mFrameBrowsingContextID = aBrowsingContext->Id(); - mDocumentHasUserInteracted = embedderWGP->DocumentHasUserInteracted(); - - // if the document forces all mixed content to be blocked, then we - // store that bit for all requests on the loadinfo. - mBlockAllMixedContent = embedderWGP->GetDocumentBlockAllMixedContent(); - - // if the document forces all requests to be upgraded from http to https, - // then we should do that for all requests. If it only forces preloads to be - // upgraded then we should enforce upgrade insecure requests only for - // preloads. - mUpgradeInsecureRequests = embedderWGP->GetDocumentUpgradeInsecureRequests(); - mOriginAttributes = mLoadingPrincipal->OriginAttributesRef(); - - // We need to do this after inheriting the document's origin attributes - // above, in case the loading principal ends up being the system principal. - if (embedderBC->IsContent()) { - mOriginAttributes.SyncAttributesWithPrivateBrowsing( - embedderBC->UsePrivateBrowsing()); - } - - // For chrome BC, the mPrivateBrowsingId remains 0 even its - // UsePrivateBrowsing() is true, so we only update the mPrivateBrowsingId in - // origin attributes if the type of the BC is content. - if (embedderBC->IsChrome()) { - MOZ_ASSERT(mOriginAttributes.mPrivateBrowsingId == 0, - "chrome docshell shouldn't have mPrivateBrowsingId set."); - } -} - LoadInfo::LoadInfo(const LoadInfo& rhs) : mLoadingPrincipal(rhs.mLoadingPrincipal), mTriggeringPrincipal(rhs.mTriggeringPrincipal), @@ -909,21 +719,6 @@ void LoadInfo::ComputeIsThirdPartyContext(nsPIDOMWindowOuter* aOuterWindow) { util->IsThirdPartyWindow(aOuterWindow, nullptr, &mIsThirdPartyContext); } -void LoadInfo::ComputeIsThirdPartyContext(dom::WindowGlobalParent* aGlobal) { - if (nsILoadInfo::GetExternalContentPolicyType() == - nsIContentPolicy::TYPE_DOCUMENT) { - // Top-level loads are never third-party. - mIsThirdPartyContext = false; - return; - } - - ThirdPartyUtil* thirdPartyUtil = ThirdPartyUtil::GetInstance(); - if (!thirdPartyUtil) { - return; - } - thirdPartyUtil->IsThirdPartyGlobal(aGlobal, &mIsThirdPartyContext); -} - NS_IMPL_ISUPPORTS(LoadInfo, nsILoadInfo) already_AddRefed LoadInfo::Clone() const { diff --git a/netwerk/base/LoadInfo.h b/netwerk/base/LoadInfo.h index a00d30f7160d..4d7fbb98c03c 100644 --- a/netwerk/base/LoadInfo.h +++ b/netwerk/base/LoadInfo.h @@ -30,7 +30,6 @@ namespace dom { class PerformanceStorage; class XMLHttpRequestMainThread; class CanonicalBrowsingContext; -class WindowGlobalParent; } // namespace dom namespace net { @@ -57,7 +56,6 @@ class LoadInfo final : public nsILoadInfo { NS_DECL_ISUPPORTS NS_DECL_NSILOADINFO - // Used for TYPE_SUBDOCUMENT load. // aLoadingPrincipal MUST NOT BE NULL. LoadInfo(nsIPrincipal* aLoadingPrincipal, nsIPrincipal* aTriggeringPrincipal, nsINode* aLoadingContext, nsSecurityFlags aSecurityFlags, @@ -67,10 +65,6 @@ class LoadInfo final : public nsILoadInfo { const Maybe& aController = Maybe(), uint32_t aSandboxFlags = 0); - // Used for TYPE_SUBDOCUMENT load. - LoadInfo(dom::CanonicalBrowsingContext* aBrowsingContext, - nsIPrincipal* aTriggeringPrincipal, uint64_t aFrameOuterWindowID, - nsSecurityFlags aSecurityFlags, uint32_t aSandboxFlags); // Constructor used for TYPE_DOCUMENT loads which have a different // loadingContext than other loads. This ContextForTopLevelLoad is @@ -185,7 +179,6 @@ class LoadInfo final : public nsILoadInfo { ~LoadInfo() = default; void ComputeIsThirdPartyContext(nsPIDOMWindowOuter* aOuterWindow); - void ComputeIsThirdPartyContext(dom::WindowGlobalParent* aGlobal); // This function is the *only* function which can change the securityflags // of a loadinfo. It only exists because of the XHR code. Don't call it diff --git a/netwerk/ipc/DocumentChannelChild.cpp b/netwerk/ipc/DocumentChannelChild.cpp index 6d547e7e25f0..cf5de5febac7 100644 --- a/netwerk/ipc/DocumentChannelChild.cpp +++ b/netwerk/ipc/DocumentChannelChild.cpp @@ -73,19 +73,20 @@ DocumentChannelChild::AsyncOpen(nsIStreamListener* aListener) { gHttpHandler->OnOpeningDocumentRequest(this); - if (!GetDocShell() || !GetDocShell()->GetBrowsingContext() || - GetDocShell()->GetBrowsingContext()->IsDiscarded()) { - return NS_ERROR_FAILURE; - } - DocumentChannelCreationArgs args; args.loadState() = mLoadState->Serialize(); + Maybe maybeArgs; + rv = LoadInfoToLoadInfoArgs(mLoadInfo, &maybeArgs); + NS_ENSURE_SUCCESS(rv, rv); + MOZ_DIAGNOSTIC_ASSERT(maybeArgs); + + args.loadInfo() = *maybeArgs; args.loadFlags() = mLoadFlags; args.cacheKey() = mCacheKey; args.channelId() = mChannelId; args.asyncOpenTime() = mAsyncOpenTime; - args.outerWindowId() = GetDocShell()->GetOuterWindowID(); + args.outerWindowId() = mLoadInfo->GetOuterWindowID(); Maybe ipcClientInfo; if (mInitialClientInfo.isSome()) { @@ -106,6 +107,11 @@ DocumentChannelChild::AsyncOpen(nsIStreamListener* aListener) { return NS_ERROR_ILLEGAL_VALUE; } + if (!GetDocShell() || !GetDocShell()->GetBrowsingContext() || + GetDocShell()->GetBrowsingContext()->IsDiscarded()) { + return NS_ERROR_FAILURE; + } + args.hasValidTransientUserAction() = GetDocShell() ->GetBrowsingContext() diff --git a/netwerk/ipc/DocumentChannelParent.cpp b/netwerk/ipc/DocumentChannelParent.cpp index 022c42356e22..3b8764a0901b 100644 --- a/netwerk/ipc/DocumentChannelParent.cpp +++ b/netwerk/ipc/DocumentChannelParent.cpp @@ -39,13 +39,19 @@ bool DocumentChannelParent::Init(const DocumentChannelCreationArgs& aArgs) { LOG(("DocumentChannelParent Init [this=%p, uri=%s]", this, loadState->URI()->GetSpecOrDefault().get())); + RefPtr loadInfo; + nsresult rv = mozilla::ipc::LoadInfoArgsToLoadInfo(Some(aArgs.loadInfo()), + getter_AddRefs(loadInfo)); + Maybe clientInfo; if (aArgs.initialClientInfo().isSome()) { clientInfo.emplace(ClientInfo(aArgs.initialClientInfo().ref())); } - nsresult rv = NS_ERROR_UNEXPECTED; - if (!mParent->Open(loadState, aArgs.loadFlags(), aArgs.cacheKey(), + MOZ_ASSERT(NS_SUCCEEDED(rv)); + + rv = NS_ERROR_UNEXPECTED; + if (!mParent->Open(loadState, loadInfo, aArgs.loadFlags(), aArgs.cacheKey(), aArgs.channelId(), aArgs.asyncOpenTime(), aArgs.timing().refOr(nullptr), std::move(clientInfo), aArgs.outerWindowId(), aArgs.hasValidTransientUserAction(), diff --git a/netwerk/ipc/DocumentLoadListener.cpp b/netwerk/ipc/DocumentLoadListener.cpp index 769f036b8c73..316f13e3b40e 100644 --- a/netwerk/ipc/DocumentLoadListener.cpp +++ b/netwerk/ipc/DocumentLoadListener.cpp @@ -40,7 +40,6 @@ #include "nsIOService.h" #include "mozilla/dom/WindowGlobalParent.h" #include "mozilla/StaticPrefs_security.h" -#include "nsICookieService.h" #ifdef ANDROID # include "mozilla/widget/nsWindow.h" @@ -260,6 +259,9 @@ DocumentLoadListener::~DocumentLoadListener() { already_AddRefed DocumentLoadListener::CreateLoadInfo( CanonicalBrowsingContext* aBrowsingContext, nsDocShellLoadState* aLoadState, uint64_t aOuterWindowId) { + OriginAttributes attrs; + mLoadContext->GetOriginAttributes(attrs); + // TODO: Block copied from nsDocShell::DoURILoad, refactor out somewhere bool inheritPrincipal = false; @@ -289,22 +291,22 @@ already_AddRefed DocumentLoadListener::CreateLoadInfo( securityFlags |= nsILoadInfo::SEC_FORCE_INHERIT_PRINCIPAL; } - if (aBrowsingContext->GetParent()) { - // Build LoadInfo for TYPE_SUBDOCUMENT - RefPtr loadInfo = - new LoadInfo(aBrowsingContext, aLoadState->TriggeringPrincipal(), - aOuterWindowId, securityFlags, sandboxFlags); - return loadInfo.forget(); - } - // Build LoadInfo for TYPE_DOCUMENT - OriginAttributes attrs; - mLoadContext->GetOriginAttributes(attrs); RefPtr loadInfo = new LoadInfo(aBrowsingContext, aLoadState->TriggeringPrincipal(), attrs, aOuterWindowId, securityFlags, sandboxFlags); return loadInfo.forget(); } +already_AddRefed GetParentEmbedderWindowGlobal( + CanonicalBrowsingContext* aBrowsingContext) { + RefPtr parent = + aBrowsingContext->GetEmbedderWindowGlobal(); + if (parent && parent->BrowsingContext() == aBrowsingContext->GetParent()) { + return parent.forget(); + } + return nullptr; +} + // parent-process implementation of // nsGlobalWindowOuter::GetTopExcludingExtensionAccessibleContentFrames already_AddRefed @@ -312,7 +314,8 @@ GetTopWindowExcludingExtensionAccessibleContentFrames( CanonicalBrowsingContext* aBrowsingContext, nsIURI* aURIBeingLoaded) { CanonicalBrowsingContext* bc = aBrowsingContext; RefPtr prev; - while (RefPtr parent = bc->GetParentWindowGlobal()) { + while (RefPtr parent = + GetParentEmbedderWindowGlobal(bc)) { CanonicalBrowsingContext* parentBC = parent->BrowsingContext(); nsIPrincipal* parentPrincipal = parent->DocumentPrincipal(); @@ -337,10 +340,11 @@ GetTopWindowExcludingExtensionAccessibleContentFrames( } bool DocumentLoadListener::Open( - nsDocShellLoadState* aLoadState, nsLoadFlags aLoadFlags, uint32_t aCacheKey, - const uint64_t& aChannelId, const TimeStamp& aAsyncOpenTime, - nsDOMNavigationTiming* aTiming, Maybe&& aInfo, - uint64_t aOuterWindowId, bool aHasGesture, nsresult* aRv) { + nsDocShellLoadState* aLoadState, class LoadInfo* aLoadInfo, + nsLoadFlags aLoadFlags, uint32_t aCacheKey, const uint64_t& aChannelId, + const TimeStamp& aAsyncOpenTime, nsDOMNavigationTiming* aTiming, + Maybe&& aInfo, uint64_t aOuterWindowId, bool aHasGesture, + nsresult* aRv) { LOG(("DocumentLoadListener Open [this=%p, uri=%s]", this, aLoadState->URI()->GetSpecOrDefault().get())); RefPtr browsingContext = @@ -349,21 +353,19 @@ bool DocumentLoadListener::Open( OriginAttributes attrs; mLoadContext->GetOriginAttributes(attrs); - RefPtr embedderWGP = - browsingContext->GetParentWindowGlobal(); - if (browsingContext->GetParent() && !embedderWGP) { - // this is a race, bug 1331295 - NS_WARNING( - "We don't have an embedder WindowGlobalParent, probably because of a " - "race"); - return false; - } - // If this is a top-level load, then rebuild the LoadInfo from scratch, // since the goal is to be able to initiate loads in the parent, where the // content process won't have provided us with an existing one. - RefPtr loadInfo = - CreateLoadInfo(browsingContext, aLoadState, aOuterWindowId); + // TODO: Handle TYPE_SUBDOCUMENT LoadInfo construction, and stop passing + // aLoadInfo across IPC. + RefPtr loadInfo = aLoadInfo; + if (!browsingContext->GetParent()) { + // If we're a top level load, then we should have not got an existing + // LoadInfo, or if we did, it should be TYPE_DOCUMENT. + MOZ_ASSERT(!aLoadInfo || aLoadInfo->InternalContentPolicyType() == + nsIContentPolicy::TYPE_DOCUMENT); + loadInfo = CreateLoadInfo(browsingContext, aLoadState, aOuterWindowId); + } if (!nsDocShell::CreateAndConfigureRealChannelForLoadState( browsingContext, aLoadState, loadInfo, mParentChannelListener, diff --git a/netwerk/ipc/DocumentLoadListener.h b/netwerk/ipc/DocumentLoadListener.h index b65515bdcc94..58c9d971feab 100644 --- a/netwerk/ipc/DocumentLoadListener.h +++ b/netwerk/ipc/DocumentLoadListener.h @@ -96,11 +96,11 @@ class DocumentLoadListener : public nsIInterfaceRequestor, ADocumentChannelBridge* aBridge); // Creates the channel, and then calls AsyncOpen on it. - bool Open(nsDocShellLoadState* aLoadState, nsLoadFlags aLoadFlags, - uint32_t aCacheKey, const uint64_t& aChannelId, - const TimeStamp& aAsyncOpenTime, nsDOMNavigationTiming* aTiming, - Maybe&& aInfo, uint64_t aOuterWindowId, - bool aHasGesture, nsresult* aRv); + bool Open(nsDocShellLoadState* aLoadState, LoadInfo* aLoadInfo, + nsLoadFlags aLoadFlags, uint32_t aCacheKey, + const uint64_t& aChannelId, const TimeStamp& aAsyncOpenTime, + nsDOMNavigationTiming* aTiming, Maybe&& aInfo, + uint64_t aOuterWindowId, bool aHasGesture, nsresult* aRv); NS_DECL_ISUPPORTS NS_DECL_NSIREQUESTOBSERVER @@ -214,6 +214,8 @@ class DocumentLoadListener : public nsIInterfaceRequestor, nsTArray&& aStreamFilterEndpoints); // Construct a LoadInfo object to use for the internal channel. + // TODO: This currently only supports creating top window TYPE_DOCUMENT + // LoadInfos already_AddRefed CreateLoadInfo( dom::CanonicalBrowsingContext* aBrowsingContext, nsDocShellLoadState* aLoadState, uint64_t aOuterWindowId); diff --git a/netwerk/ipc/NeckoChannelParams.ipdlh b/netwerk/ipc/NeckoChannelParams.ipdlh index 802929c575ae..3f975fd644f8 100644 --- a/netwerk/ipc/NeckoChannelParams.ipdlh +++ b/netwerk/ipc/NeckoChannelParams.ipdlh @@ -425,6 +425,7 @@ struct CookieStruct struct DocumentChannelCreationArgs { DocShellLoadStateInit loadState; + LoadInfoArgs loadInfo; TimeStamp asyncOpenTime; uint64_t channelId; uint32_t loadFlags; diff --git a/netwerk/ipc/NeckoParent.cpp b/netwerk/ipc/NeckoParent.cpp index 8b7aa00281c1..a56093190c66 100644 --- a/netwerk/ipc/NeckoParent.cpp +++ b/netwerk/ipc/NeckoParent.cpp @@ -420,16 +420,8 @@ NeckoParent::AllocPDocumentChannelParent( context = aContext.get_canonical(); } - nsCOMPtr requestingPrincipal; - // We only have the requesting principal in case of TYPE_SUBDOCUMENT. - // If we don't have an embedder window global, then it is probably a race and - // we will deal with that later in the code path. - if (context && !aContext.IsDiscarded() && context->GetParent()) { - if (RefPtr embedderWGP = - context->GetParentWindowGlobal()) { - requestingPrincipal = embedderWGP->DocumentPrincipal(); - } - } + nsCOMPtr requestingPrincipal = + GetRequestingPrincipal(Some(args.loadInfo())); nsCOMPtr loadContext; const char* error = CreateChannelLoadContext( diff --git a/toolkit/components/passwordmgr/test/mochitest/mochitest.ini b/toolkit/components/passwordmgr/test/mochitest/mochitest.ini index 7a273f81ba5e..873d75eed4fd 100644 --- a/toolkit/components/passwordmgr/test/mochitest/mochitest.ini +++ b/toolkit/components/passwordmgr/test/mochitest/mochitest.ini @@ -151,6 +151,7 @@ skip-if = toolkit == 'android' # bug 1535505 [test_prompt.html] skip-if = os == "linux" || toolkit == 'android' # Tests desktop prompts [test_prompt_async.html] +fail-if = fission # bug 1582117 skip-if = toolkit == 'android' || (debug || asan || tsan) # Tests desktop prompts # Bug 1603659 support-files = subtst_prompt_async.html [test_prompt_http.html]