From b241cff35eef0d2ec2c6a699aa8ca90c89b65a8a Mon Sep 17 00:00:00 2001 From: Cosmin Sabou Date: Wed, 21 Nov 2018 17:14:29 +0200 Subject: [PATCH] Backed out changeset 395b95afd795 (bug 1487964) for mochitest failures on test_resource_timing_nocors. --- docshell/base/nsDocShell.cpp | 24 +++---------------- docshell/base/nsDocShell.h | 1 - docshell/base/nsDocShellLoadState.cpp | 1 - docshell/base/nsDocShellLoadState.h | 7 ------ docshell/base/nsIDocShell.idl | 4 ---- dom/base/nsFrameLoader.cpp | 2 -- ipc/glue/BackgroundUtils.cpp | 9 ++----- netwerk/base/LoadInfo.cpp | 18 -------------- netwerk/base/LoadInfo.h | 6 ----- netwerk/base/nsILoadInfo.idl | 7 ------ netwerk/ipc/NeckoChannelParams.ipdlh | 1 - netwerk/protocol/http/HttpBaseChannel.cpp | 9 +++---- ...resource_subframe_self_navigation.html.ini | 13 ++++++++++ 13 files changed, 23 insertions(+), 79 deletions(-) create mode 100644 testing/web-platform/meta/resource-timing/resource_subframe_self_navigation.html.ini diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index 128770b85286..c446bcf2657f 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -764,7 +764,6 @@ nsDocShell::LoadURI(nsDocShellLoadState* aLoadState) resultPrincipalURI, aLoadState->KeepResultPrincipalURIIfSet(), aLoadState->LoadReplace(), - aLoadState->GetIsFromProcessingFrameAttributes(), aLoadState->Referrer(), aLoadState->ReferrerPolicy(), aLoadState->TriggeringPrincipal(), @@ -4815,8 +4814,7 @@ nsDocShell::LoadErrorPage(nsIURI* aErrorURI, nsIURI* aFailedURI, nsIChannel* aFa mLSHE->AbandonBFCacheEntry(); } - return InternalLoad(aErrorURI, nullptr, Nothing(), false, false, - false, nullptr, RP_Unset, + return InternalLoad(aErrorURI, nullptr, Nothing(), false, false, nullptr, RP_Unset, nsContentUtils::GetSystemPrincipal(), nullptr, INTERNAL_LOAD_FLAGS_NONE, EmptyString(), VoidCString(), VoidString(), nullptr, nullptr, @@ -4916,7 +4914,6 @@ nsDocShell::Reload(uint32_t aReloadFlags) emplacedResultPrincipalURI, false, loadReplace, - false, // IsFromProcessingFrameAttributes referrerURI, referrerPolicy, triggeringPrincipal, @@ -9005,7 +9002,6 @@ public: Maybe> const& aResultPrincipalURI, bool aKeepResultPrincipalURIIfSet, bool aLoadReplace, - bool aIsFromProcessingFrameAttributes, nsIURI* aReferrer, uint32_t aReferrerPolicy, nsIPrincipal* aTriggeringPrincipal, nsIPrincipal* aPrincipalToInherit, @@ -9028,7 +9024,6 @@ public: , mResultPrincipalURI(aResultPrincipalURI) , mKeepResultPrincipalURIIfSet(aKeepResultPrincipalURIIfSet) , mLoadReplace(aLoadReplace) - , mIsFromProcessingFrameAttributes(aIsFromProcessingFrameAttributes) , mReferrer(aReferrer) , mReferrerPolicy(aReferrerPolicy) , mTriggeringPrincipal(aTriggeringPrincipal) @@ -9053,7 +9048,6 @@ public: return mDocShell->InternalLoad(mURI, mOriginalURI, mResultPrincipalURI, mKeepResultPrincipalURIIfSet, mLoadReplace, - mIsFromProcessingFrameAttributes, mReferrer, mReferrerPolicy, mTriggeringPrincipal, mPrincipalToInherit, @@ -9076,7 +9070,6 @@ private: Maybe> mResultPrincipalURI; bool mKeepResultPrincipalURIIfSet; bool mLoadReplace; - bool mIsFromProcessingFrameAttributes; nsCOMPtr mReferrer; uint32_t mReferrerPolicy; nsCOMPtr mTriggeringPrincipal; @@ -9113,7 +9106,6 @@ nsDocShell::InternalLoad(nsIURI* aURI, Maybe> const& aResultPrincipalURI, bool aKeepResultPrincipalURIIfSet, bool aLoadReplace, - bool aIsFromProcessingFrameAttributes, nsIURI* aReferrer, uint32_t aReferrerPolicy, nsIPrincipal* aTriggeringPrincipal, @@ -9466,7 +9458,6 @@ nsDocShell::InternalLoad(nsIURI* aURI, aResultPrincipalURI, aKeepResultPrincipalURIIfSet, aLoadReplace, - aIsFromProcessingFrameAttributes, aReferrer, aReferrerPolicy, aTriggeringPrincipal, @@ -9565,8 +9556,7 @@ nsDocShell::InternalLoad(nsIURI* aURI, nsCOMPtr ev = new InternalLoadEvent(this, aURI, aOriginalURI, aResultPrincipalURI, aKeepResultPrincipalURIIfSet, - aLoadReplace, aIsFromProcessingFrameAttributes, - aReferrer, aReferrerPolicy, + aLoadReplace, aReferrer, aReferrerPolicy, aTriggeringPrincipal, principalToInherit, aFlags, aTypeHint, aPostData, aHeadersData, aLoadType, aSHEntry, aFirstParty, @@ -10080,7 +10070,6 @@ nsDocShell::InternalLoad(nsIURI* aURI, nsCOMPtr req; rv = DoURILoad(aURI, aOriginalURI, aResultPrincipalURI, aKeepResultPrincipalURIIfSet, aLoadReplace, - aIsFromProcessingFrameAttributes, loadFromExternal, (aFlags & INTERNAL_LOAD_FLAGS_FORCE_ALLOW_DATA_URI), (aFlags & INTERNAL_LOAD_FLAGS_ORIGINAL_FRAME_SRC), @@ -10229,7 +10218,6 @@ nsDocShell::DoURILoad(nsIURI* aURI, Maybe> const& aResultPrincipalURI, bool aKeepResultPrincipalURIIfSet, bool aLoadReplace, - bool aIsFromProcessingFrameAttributes, bool aLoadFromExternal, bool aForceAllowDataURI, bool aOriginalFrameSrc, @@ -10405,7 +10393,7 @@ nsDocShell::DoURILoad(nsIURI* aURI, securityFlags |= nsILoadInfo::SEC_SANDBOXED; } - RefPtr loadInfo = + nsCOMPtr loadInfo = (aContentPolicyType == nsIContentPolicy::TYPE_DOCUMENT) ? new LoadInfo(loadingWindow, aTriggeringPrincipal, topLevelLoadingContext, securityFlags) : @@ -10451,10 +10439,6 @@ nsDocShell::DoURILoad(nsIURI* aURI, rv = loadInfo->SetIsDocshellReload(mLoadType & LOAD_CMD_RELOAD); NS_ENSURE_SUCCESS(rv, rv); - if (aIsFromProcessingFrameAttributes) { - loadInfo->SetIsFromProcessingFrameAttributes(); - } - if (!isSrcdoc) { rv = NS_NewChannelInternal(getter_AddRefs(channel), aURI, @@ -12165,7 +12149,6 @@ nsDocShell::LoadHistoryEntry(nsISHEntry* aEntry, uint32_t aLoadType) emplacedResultPrincipalURI, false, loadReplace, - false, // IsFromProcessingFrameAttributes referrerURI, referrerPolicy, triggeringPrincipal, @@ -13358,7 +13341,6 @@ nsDocShell::OnLinkClickSync(nsIContent* aContent, Nothing(), // Let the protocol handler assign it false, false, // LoadReplace - false, // IsFromProcessingFrameAttributes referer, // Referer URI refererPolicy, // Referer policy triggeringPrincipal, diff --git a/docshell/base/nsDocShell.h b/docshell/base/nsDocShell.h index 7b3a65847ef9..c7aa18dbc08e 100644 --- a/docshell/base/nsDocShell.h +++ b/docshell/base/nsDocShell.h @@ -532,7 +532,6 @@ private: // member functions mozilla::Maybe> const& aResultPrincipalURI, bool aKeepResultPrincipalURIIfSet, bool aLoadReplace, - bool aIsFromProcessingFrameAttributes, bool aLoadFromExternal, bool aForceAllowDataURI, bool aOriginalFrameSrc, diff --git a/docshell/base/nsDocShellLoadState.cpp b/docshell/base/nsDocShellLoadState.cpp index a4b7717ed682..ade4e39a1950 100644 --- a/docshell/base/nsDocShellLoadState.cpp +++ b/docshell/base/nsDocShellLoadState.cpp @@ -30,7 +30,6 @@ nsDocShellLoadState::nsDocShellLoadState() , mTypeHint(VoidCString()) , mFileName(VoidString()) , mDocShellInternalLoadFlags(0) - , mIsFromProcessingFrameAttributes(false) { } diff --git a/docshell/base/nsDocShellLoadState.h b/docshell/base/nsDocShellLoadState.h index f999e61d19bd..e7fb54b71ad9 100644 --- a/docshell/base/nsDocShellLoadState.h +++ b/docshell/base/nsDocShellLoadState.h @@ -165,9 +165,6 @@ public: // information and origin attributes. nsresult SetupTriggeringPrincipal(const mozilla::OriginAttributes& aOriginAttributes); - void SetIsFromProcessingFrameAttributes() { mIsFromProcessingFrameAttributes = true; } - bool GetIsFromProcessingFrameAttributes() { return mIsFromProcessingFrameAttributes; } - // When loading a document through nsDocShell::LoadURI(), a special set of // flags needs to be set based on other values in nsDocShellLoadState. This // function calculates those flags, before the LoadState is passed to @@ -291,10 +288,6 @@ protected: // nsDocShell::InternalLoad, taken from the INTERNAL_LOAD consts in // nsIDocShell.idl uint32_t mDocShellInternalLoadFlags; - - // This will be true if this load is triggered by attribute changes. - // See nsILoadInfo.isFromProcessingFrameAttributes - bool mIsFromProcessingFrameAttributes; }; #endif /* nsDocShellLoadState_h__ */ diff --git a/docshell/base/nsIDocShell.idl b/docshell/base/nsIDocShell.idl index ddd11e5f6076..8376b69243b8 100644 --- a/docshell/base/nsIDocShell.idl +++ b/docshell/base/nsIDocShell.idl @@ -137,9 +137,6 @@ interface nsIDocShell : nsIDocShellTreeItem * @param aLoadReplace - If set LOAD_REPLACE flag will be set on the * channel. aOriginalURI is null, this argument is * ignored. - * @param aIsFromProcessingFrameAttributes - * - If this is a load triggered by changing frame attributes. - * See nsILoadInfo.isFromProcessingFrameAttributes * @param aReferrer - Referring URI * @param aReferrerPolicy - Referrer policy * @param aTriggeringPrincipal - A non-null principal that initiated that load. @@ -187,7 +184,6 @@ interface nsIDocShell : nsIDocShellTreeItem [const] in MaybeURI aResultPrincipalURI, in bool aKeepResultPrincipalURIIfSet, in boolean aLoadReplace, - in boolean aIsFromProcessingFrameAttributes, in nsIURI aReferrer, in unsigned long aReferrerPolicy, in nsIPrincipal aTriggeringPrincipal, diff --git a/dom/base/nsFrameLoader.cpp b/dom/base/nsFrameLoader.cpp index 77091ac5ca1c..3ada83c00f7a 100644 --- a/dom/base/nsFrameLoader.cpp +++ b/dom/base/nsFrameLoader.cpp @@ -464,8 +464,6 @@ nsFrameLoader::ReallyStartLoadingInternal() nsIWebNavigation::LOAD_FLAGS_DISALLOW_INHERIT_PRINCIPAL; } - loadState->SetIsFromProcessingFrameAttributes(); - // Kick off the load... bool tmpState = mNeedsAsyncDestroy; mNeedsAsyncDestroy = true; diff --git a/ipc/glue/BackgroundUtils.cpp b/ipc/glue/BackgroundUtils.cpp index 4cf694217bc6..9fbc3fe7511e 100644 --- a/ipc/glue/BackgroundUtils.cpp +++ b/ipc/glue/BackgroundUtils.cpp @@ -453,8 +453,7 @@ LoadInfoToLoadInfoArgs(nsILoadInfo *aLoadInfo, aLoadInfo->GetLoadTriggeredFromExternal(), aLoadInfo->GetServiceWorkerTaintingSynthesized(), aLoadInfo->GetDocumentHasUserInteracted(), - aLoadInfo->GetDocumentHasLoaded(), - aLoadInfo->GetIsFromProcessingFrameAttributes() + aLoadInfo->GetDocumentHasLoaded() ); return NS_OK; @@ -572,7 +571,7 @@ LoadInfoArgsToLoadInfo(const OptionalLoadInfoArgs& aOptionalLoadInfoArgs, loadInfoArgs.controller().get_IPCServiceWorkerDescriptor())); } - RefPtr loadInfo = + nsCOMPtr loadInfo = new mozilla::LoadInfo(loadingPrincipal, triggeringPrincipal, principalToInherit, @@ -620,10 +619,6 @@ LoadInfoArgsToLoadInfo(const OptionalLoadInfoArgs& aOptionalLoadInfoArgs, loadInfoArgs.documentHasLoaded() ); - if (loadInfoArgs.isFromProcessingFrameAttributes()) { - loadInfo->SetIsFromProcessingFrameAttributes(); - } - loadInfo.forget(outLoadInfo); return NS_OK; } diff --git a/netwerk/base/LoadInfo.cpp b/netwerk/base/LoadInfo.cpp index 8aadd67f1d67..d838912d703d 100644 --- a/netwerk/base/LoadInfo.cpp +++ b/netwerk/base/LoadInfo.cpp @@ -94,7 +94,6 @@ LoadInfo::LoadInfo(nsIPrincipal* aLoadingPrincipal, , mIsTrackerBlocked(false) , mDocumentHasUserInteracted(false) , mDocumentHasLoaded(false) - , mIsFromProcessingFrameAttributes(false) { MOZ_ASSERT(mLoadingPrincipal); MOZ_ASSERT(mTriggeringPrincipal); @@ -367,7 +366,6 @@ LoadInfo::LoadInfo(nsPIDOMWindowOuter* aOuterWindow, , mIsTrackerBlocked(false) , mDocumentHasUserInteracted(false) , mDocumentHasLoaded(false) - , mIsFromProcessingFrameAttributes(false) { // Top-level loads are never third-party // Grab the information we can out of the window. @@ -470,7 +468,6 @@ LoadInfo::LoadInfo(const LoadInfo& rhs) , mIsTrackerBlocked(rhs.mIsTrackerBlocked) , mDocumentHasUserInteracted(rhs.mDocumentHasUserInteracted) , mDocumentHasLoaded(rhs.mDocumentHasLoaded) - , mIsFromProcessingFrameAttributes(rhs.mIsFromProcessingFrameAttributes) { } @@ -565,7 +562,6 @@ LoadInfo::LoadInfo(nsIPrincipal* aLoadingPrincipal, , mIsTrackerBlocked(false) , mDocumentHasUserInteracted(aDocumentHasUserInteracted) , mDocumentHasLoaded(aDocumentHasLoaded) - , mIsFromProcessingFrameAttributes(false) { // Only top level TYPE_DOCUMENT loads can have a null loadingPrincipal MOZ_ASSERT(mLoadingPrincipal || aContentPolicyType == nsIContentPolicy::TYPE_DOCUMENT); @@ -1454,20 +1450,6 @@ LoadInfo::GetIsTopLevelLoad(bool *aResult) return NS_OK; } -void -LoadInfo::SetIsFromProcessingFrameAttributes() -{ - mIsFromProcessingFrameAttributes = true; -} - -NS_IMETHODIMP -LoadInfo::GetIsFromProcessingFrameAttributes(bool *aIsFromProcessingFrameAttributes) -{ - MOZ_ASSERT(aIsFromProcessingFrameAttributes); - *aIsFromProcessingFrameAttributes = mIsFromProcessingFrameAttributes; - return NS_OK; -} - NS_IMETHODIMP LoadInfo::GetResultPrincipalURI(nsIURI **aURI) { diff --git a/netwerk/base/LoadInfo.h b/netwerk/base/LoadInfo.h index ea984d6fa792..5dba5ae17cb6 100644 --- a/netwerk/base/LoadInfo.h +++ b/netwerk/base/LoadInfo.h @@ -87,7 +87,6 @@ public: void SetUpgradeInsecureRequests(); void SetBrowserUpgradeInsecureRequests(); void SetBrowserWouldUpgradeInsecureRequests(); - void SetIsFromProcessingFrameAttributes(); private: // private constructor that is only allowed to be called from within @@ -220,11 +219,6 @@ private: bool mIsTrackerBlocked; bool mDocumentHasUserInteracted; bool mDocumentHasLoaded; - - // Is true if this load was triggered by processing the attributes of the - // browsing context container. - // See nsILoadInfo.isFromProcessingFrameAttributes - bool mIsFromProcessingFrameAttributes; }; } // namespace net diff --git a/netwerk/base/nsILoadInfo.idl b/netwerk/base/nsILoadInfo.idl index f22f6475f1d6..897b9f8f463a 100644 --- a/netwerk/base/nsILoadInfo.idl +++ b/netwerk/base/nsILoadInfo.idl @@ -1068,11 +1068,4 @@ interface nsILoadInfo : nsISupports * See bug 1500908. */ attribute nsICSPEventListener cspEventListener; - - /** - * This attribute will be true if this is a load triggered by - * https://html.spec.whatwg.org/multipage/iframe-embed-object.html#process-the-iframe-attributes - * or https://html.spec.whatwg.org/multipage/obsolete.html#process-the-frame-attributes - */ - [infallible] readonly attribute boolean isFromProcessingFrameAttributes; }; diff --git a/netwerk/ipc/NeckoChannelParams.ipdlh b/netwerk/ipc/NeckoChannelParams.ipdlh index 49346bc1da48..cbcdc4df48ff 100644 --- a/netwerk/ipc/NeckoChannelParams.ipdlh +++ b/netwerk/ipc/NeckoChannelParams.ipdlh @@ -110,7 +110,6 @@ struct LoadInfoArgs bool serviceWorkerTaintingSynthesized; bool documentHasUserInteracted; bool documentHasLoaded; - bool isFromProcessingFrameAttributes; }; /** diff --git a/netwerk/protocol/http/HttpBaseChannel.cpp b/netwerk/protocol/http/HttpBaseChannel.cpp index 26a64188d3d8..b61b216025f3 100644 --- a/netwerk/protocol/http/HttpBaseChannel.cpp +++ b/netwerk/protocol/http/HttpBaseChannel.cpp @@ -4413,10 +4413,11 @@ HttpBaseChannel::GetPerformanceStorage() return nullptr; } - if (mLoadInfo->GetExternalContentPolicyType() == nsIContentPolicy::TYPE_SUBDOCUMENT && - !mLoadInfo->GetIsFromProcessingFrameAttributes()) { - // We only report loads caused by processing the attributes of the - // browsing context container. + // We only add to the document's performance object if it has the same + // principal as the one triggering the load. This is to prevent navigations + // triggered _by_ the iframe from showing up in the parent document's + // performance entries if they have different origins. + if (!mLoadInfo->TriggeringPrincipal()->Equals(loadingDocument->NodePrincipal())) { return nullptr; } diff --git a/testing/web-platform/meta/resource-timing/resource_subframe_self_navigation.html.ini b/testing/web-platform/meta/resource-timing/resource_subframe_self_navigation.html.ini new file mode 100644 index 000000000000..e96e303017de --- /dev/null +++ b/testing/web-platform/meta/resource-timing/resource_subframe_self_navigation.html.ini @@ -0,0 +1,13 @@ +[resource_subframe_self_navigation.html] + [Subsequent