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-15 18:53:22 +00:00
Родитель b5343020a4
Коммит 2033e946f0
3 изменённых файлов: 1 добавлений и 10 удалений

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

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

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

@ -360,8 +360,6 @@ 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();
@ -1002,7 +1000,7 @@ class nsDocShell final : public nsDocLoader,
void RecomputeCanExecuteScripts();
void ClearFrameHistory(nsISHEntry* aEntry);
void UpdateGlobalHistoryTitle(nsIURI* aURI);
bool IsFrame();
bool IsFrame() { return mBrowsingContext->GetParent(); }
bool CanSetOriginAttributes();
bool ShouldBlockLoadingForBackButton();
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.
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;

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

@ -2147,8 +2147,6 @@ 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