Bug 1594529: Infer nsDocShell::IsFrame from BrowsingContext. r=nika

This fixes the content policy type for document loads in these frames, where
the explicit mIsFrame flag was not set, due to DocShell creation taking a
different code path in remote frames than in in-process frames.

Differential Revision: https://phabricator.services.mozilla.com/D52093

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Kris Maglione 2020-04-13 22:41:37 +00:00
Родитель a209b9b948
Коммит c2aef15803
3 изменённых файлов: 1 добавлений и 10 удалений

Просмотреть файл

@ -398,7 +398,6 @@ nsDocShell::nsDocShell(BrowsingContext* aBrowsingContext,
mHasLoadedNonBlankURI(false), mHasLoadedNonBlankURI(false),
mBlankTiming(false), mBlankTiming(false),
mTitleValidForCurrentURI(false), mTitleValidForCurrentURI(false),
mIsFrame(false),
mWillChangeProcess(false), mWillChangeProcess(false),
mWatchedByDevtools(false), mWatchedByDevtools(false),
mIsNavigating(false) { mIsNavigating(false) {
@ -11630,8 +11629,6 @@ nsresult nsDocShell::EnsureFind() {
return NS_OK; return NS_OK;
} }
bool nsDocShell::IsFrame() { return mIsFrame; }
NS_IMETHODIMP NS_IMETHODIMP
nsDocShell::IsBeingDestroyed(bool* aDoomed) { nsDocShell::IsBeingDestroyed(bool* aDoomed) {
NS_ENSURE_ARG(aDoomed); NS_ENSURE_ARG(aDoomed);

Просмотреть файл

@ -360,8 +360,6 @@ class nsDocShell final : public nsDocLoader,
void SetInFrameSwap(bool aInSwap) { mInFrameSwap = aInSwap; } void SetInFrameSwap(bool aInSwap) { mInFrameSwap = aInSwap; }
bool InFrameSwap(); bool InFrameSwap();
void SetIsFrame() { mIsFrame = true; };
const mozilla::Encoding* GetForcedCharset() { return mForcedCharset; } const mozilla::Encoding* GetForcedCharset() { return mForcedCharset; }
mozilla::HTMLEditor* GetHTMLEditorInternal(); mozilla::HTMLEditor* GetHTMLEditorInternal();
@ -1002,7 +1000,7 @@ class nsDocShell final : public nsDocLoader,
void RecomputeCanExecuteScripts(); void RecomputeCanExecuteScripts();
void ClearFrameHistory(nsISHEntry* aEntry); void ClearFrameHistory(nsISHEntry* aEntry);
void UpdateGlobalHistoryTitle(nsIURI* aURI); void UpdateGlobalHistoryTitle(nsIURI* aURI);
bool IsFrame(); bool IsFrame() { return mBrowsingContext->GetParent(); }
bool CanSetOriginAttributes(); bool CanSetOriginAttributes();
bool ShouldBlockLoadingForBackButton(); bool ShouldBlockLoadingForBackButton();
bool ShouldDiscardLayoutState(nsIHttpChannel* aChannel); bool ShouldDiscardLayoutState(nsIHttpChannel* aChannel);
@ -1333,8 +1331,6 @@ class nsDocShell final : public nsDocLoader,
// This flag indicates when the title is valid for the current URI. // This flag indicates when the title is valid for the current URI.
bool mTitleValidForCurrentURI : 1; bool mTitleValidForCurrentURI : 1;
bool mIsFrame : 1;
// If mWillChangeProcess is set to true, then when the docshell is destroyed, // If mWillChangeProcess is set to true, then when the docshell is destroyed,
// we prepare the browsing context to change process. // we prepare the browsing context to change process.
bool mWillChangeProcess : 1; bool mWillChangeProcess : 1;

Просмотреть файл

@ -2147,8 +2147,6 @@ nsresult nsFrameLoader::MaybeCreateDocShell() {
if (OwnerIsMozBrowserFrame()) { if (OwnerIsMozBrowserFrame()) {
docShell->SetFrameType(nsIDocShell::FRAME_TYPE_BROWSER); 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 // Apply sandbox flags even if our owner is not an iframe, as this copies