Bug 1045096. Make sure initial about:blank in iframes have a nsDOMNavigationTiming object, so we don't end up with window.performance throwing when accessed on their window. r=smaug
This commit is contained in:
@@ -7366,15 +7366,18 @@ nsDocShell::CreateAboutBlankContentViewer(nsIPrincipal* aPrincipal,
|
||||
// mContentViewer->PermitUnload may release |this| docshell.
|
||||
nsCOMPtr<nsIDocShell> kungFuDeathGrip(this);
|
||||
|
||||
// Make sure timing is created. But first record whether we had it
|
||||
// already, so we don't clobber the timing for an in-progress load.
|
||||
bool hadTiming = mTiming;
|
||||
MaybeInitTiming();
|
||||
if (mContentViewer) {
|
||||
// We've got a content viewer already. Make sure the user
|
||||
// permits us to discard the current document and replace it
|
||||
// with about:blank. And also ensure we fire the unload events
|
||||
// in the current document.
|
||||
|
||||
// Make sure timing is created. Unload gets fired first for
|
||||
// Unload gets fired first for
|
||||
// document loaded from the session history.
|
||||
MaybeInitTiming();
|
||||
mTiming->NotifyBeforeUnload();
|
||||
|
||||
bool okToUnload;
|
||||
@@ -7459,6 +7462,12 @@ nsDocShell::CreateAboutBlankContentViewer(nsIPrincipal* aPrincipal,
|
||||
// The transient about:blank viewer doesn't have a session history entry.
|
||||
SetHistoryEntry(&mOSHE, nullptr);
|
||||
|
||||
// Clear out our mTiming like we would in EndPageLoad, if we didn't
|
||||
// have one before entering this function.
|
||||
if (!hadTiming) {
|
||||
mTiming = nullptr;
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user