Bug 1593246 - Part 1: Move SessionStorageManager to BrowsingContext r=dom-workers-and-storage-reviewers,sg,smaug

With Fission enabled we do not necessarily have access to the
nsDocShell that holds the top-level browsing context, so the
BrowsingContext is a better place to store information that needs
to be accessible to nested browsing contexts.

Differential Revision: https://phabricator.services.mozilla.com/D55276
This commit is contained in:
Yaron Tausky
2019-12-09 13:04:51 +00:00
parent 77e91b6f90
commit af3113e2f9
7 changed files with 41 additions and 57 deletions

View File

@@ -529,8 +529,7 @@ void nsDocShell::DestroyChildren() {
nsDocLoader::DestroyChildren();
}
NS_IMPL_CYCLE_COLLECTION_INHERITED(nsDocShell, nsDocLoader,
mSessionStorageManager, mScriptGlobal,
NS_IMPL_CYCLE_COLLECTION_INHERITED(nsDocShell, nsDocLoader, mScriptGlobal,
mInitialClientSource, mSessionHistory,
mBrowsingContext, mChromeEventHandler)
@@ -549,7 +548,6 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsDocShell)
NS_INTERFACE_MAP_ENTRY(nsIWebPageDescriptor)
NS_INTERFACE_MAP_ENTRY(nsIAuthPromptProvider)
NS_INTERFACE_MAP_ENTRY(nsILoadContext)
NS_INTERFACE_MAP_ENTRY(nsIDOMStorageManager)
NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsINetworkInterceptController,
mInterceptController)
NS_INTERFACE_MAP_ENTRY(nsIDeprecationWarner)
@@ -2248,31 +2246,6 @@ nsDocShell::GetWindowDraggingAllowed(bool* aValue) {
return NS_OK;
}
nsIDOMStorageManager* nsDocShell::TopSessionStorageManager() {
nsresult rv;
nsCOMPtr<nsIDocShellTreeItem> topItem;
rv = GetInProcessSameTypeRootTreeItem(getter_AddRefs(topItem));
if (NS_FAILED(rv)) {
return nullptr;
}
if (!topItem) {
return nullptr;
}
nsDocShell* topDocShell = static_cast<nsDocShell*>(topItem.get());
if (topDocShell != this) {
return topDocShell->TopSessionStorageManager();
}
if (!mSessionStorageManager) {
mSessionStorageManager = new SessionStorageManager();
}
return mSessionStorageManager;
}
NS_IMETHODIMP
nsDocShell::GetCurrentDocumentChannel(nsIChannel** aResult) {
NS_IF_ADDREF(*aResult = GetCurrentDocChannel());