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 2019-11-06 20:34:36 +00:00
Родитель c277593b98
Коммит c4b5d4bfb9
3 изменённых файлов: 1 добавлений и 10 удалений

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

@ -388,7 +388,6 @@ nsDocShell::nsDocShell(BrowsingContext* aBrowsingContext,
mHasLoadedNonBlankURI(false), mHasLoadedNonBlankURI(false),
mBlankTiming(false), mBlankTiming(false),
mTitleValidForCurrentURI(false), mTitleValidForCurrentURI(false),
mIsFrame(false),
mSkipBrowsingContextDetachOnDestroy(false), mSkipBrowsingContextDetachOnDestroy(false),
mWatchedByDevtools(false), mWatchedByDevtools(false),
mIsNavigating(false) { mIsNavigating(false) {
@ -12088,8 +12087,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);

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

@ -348,8 +348,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();
@ -971,7 +969,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);
@ -1330,8 +1328,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 mSkipBrowsingContextDetachOnDestroy is set to true, then when the // If mSkipBrowsingContextDetachOnDestroy is set to true, then when the
// docshell is destroyed, the browsing context will not be detached. This is // docshell is destroyed, the browsing context will not be detached. This is
// for cases where we want to preserve the BC for future use. // for cases where we want to preserve the BC for future use.

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

@ -2133,8 +2133,6 @@ nsresult nsFrameLoader::MaybeCreateDocShell() {
if (OwnerIsMozBrowserFrame()) { if (OwnerIsMozBrowserFrame()) {
docShell->SetFrameType(nsIDocShell::FRAME_TYPE_BROWSER); docShell->SetFrameType(nsIDocShell::FRAME_TYPE_BROWSER);
} else if (mBrowsingContext->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