Bug 1843239, optimize Location.hash, r=peterv,dom-core

Differential Revision: https://phabricator.services.mozilla.com/D183788
This commit is contained in:
Olli Pettay
2023-08-07 12:31:25 +00:00
parent 7063dd9162
commit 3f2cf8ccea
8 changed files with 74 additions and 35 deletions

View File

@@ -1550,7 +1550,7 @@ bool nsDocShell::SetCurrentURI(nsIURI* aURI, nsIRequest* aRequest,
mTitleValidForCurrentURI = false;
}
mCurrentURI = aURI;
SetCurrentURIInternal(aURI);
#ifdef DEBUG
mLastOpenedURI = aURI;
@@ -1576,6 +1576,13 @@ bool nsDocShell::SetCurrentURI(nsIURI* aURI, nsIRequest* aRequest,
return !aFireOnLocationChange;
}
void nsDocShell::SetCurrentURIInternal(nsIURI* aURI) {
mCurrentURI = aURI;
if (mBrowsingContext) {
mBrowsingContext->ClearCachedValuesOfLocations();
}
}
NS_IMETHODIMP
nsDocShell::GetCharset(nsACString& aCharset) {
aCharset.Truncate();
@@ -4574,7 +4581,7 @@ nsDocShell::Destroy() {
nsDocLoader::Destroy();
mParentWidget = nullptr;
mCurrentURI = nullptr;
SetCurrentURIInternal(nullptr);
if (mScriptGlobal) {
mScriptGlobal->DetachFromDocShell(!mWillChangeProcess);
@@ -8189,7 +8196,7 @@ nsresult nsDocShell::SetupNewViewer(nsIContentViewer* aNewViewer,
viewer->Close(nullptr);
viewer->Destroy();
mContentViewer = nullptr;
mCurrentURI = nullptr;
SetCurrentURIInternal(nullptr);
NS_WARNING("ContentViewer Initialization failed");
return NS_ERROR_FAILURE;
}