mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-21 17:25:36 +00:00
Bug 1616788 - Part 6: Propagate the HasStoragePermission from the loadInfo to the WindowContext. r=dimi,baku
We propagate the HasStoragePermission flag from the loadInfo to the WindowContext in the patch. We add a flag HasStoragePermission in the document and this flag will get updated when the Document::StartDocumentLoad() happens. And then, we would sync this to the WindowContext in the final stage of the nsGlobalWindowOuter::SetNewDocument() where the WindowContext is ready. Differential Revision: https://phabricator.services.mozilla.com/D67471 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
7e5e34c94e
commit
ab2fc0513f
@ -1363,6 +1363,7 @@ Document::Document(const char* aContentType)
|
||||
mSavedResolution(1.0f),
|
||||
mSavedResolutionBeforeMVM(1.0f),
|
||||
mPendingInitialTranslation(false),
|
||||
mHasStoragePermission(false),
|
||||
mGeneration(0),
|
||||
mCachedTabSizeGeneration(0),
|
||||
mNextFormNumber(0),
|
||||
@ -3228,6 +3229,8 @@ nsresult Document::StartDocumentLoad(const char* aCommand, nsIChannel* aChannel,
|
||||
rv = loadInfo->GetCookieJarSettings(getter_AddRefs(mCookieJarSettings));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
mHasStoragePermission = loadInfo->GetHasStoragePermission();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -1430,6 +1430,9 @@ class Document : public nsINode,
|
||||
// Returns the cookie jar settings for this and sub contexts.
|
||||
nsICookieJarSettings* CookieJarSettings();
|
||||
|
||||
// Returns whether this document has the storage permission.
|
||||
bool HasStoragePermission() { return mHasStoragePermission; }
|
||||
|
||||
// Increments the document generation.
|
||||
inline void Changed() { ++mGeneration; }
|
||||
|
||||
@ -5037,6 +5040,8 @@ class Document : public nsINode,
|
||||
|
||||
nsCOMPtr<nsICookieJarSettings> mCookieJarSettings;
|
||||
|
||||
bool mHasStoragePermission;
|
||||
|
||||
// Document generation. Gets incremented everytime it changes.
|
||||
int32_t mGeneration;
|
||||
|
||||
|
@ -2503,6 +2503,10 @@ nsresult nsGlobalWindowOuter::SetNewDocument(Document* aDocument,
|
||||
ContentBlocking::ShouldAllowAccessFor(newInnerWindow, uri, nullptr);
|
||||
}
|
||||
|
||||
newInnerWindow->GetWindowGlobalChild()
|
||||
->WindowContext()
|
||||
->SetHasStoragePermission(aDocument->HasStoragePermission());
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user