Bug 1462883 - Performance object must be reset when the inner window changes document, r=bz

This commit is contained in:
Andrea Marchesini 2018-08-03 13:08:30 +02:00
Родитель 26b46f82a4
Коммит 4c36f8e23c
2 изменённых файлов: 12 добавлений и 1 удалений

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

@ -1691,10 +1691,16 @@ nsGlobalWindowInner::InnerSetNewDocument(JSContext* aCx, nsIDocument* aDocument)
}
mDoc = aDocument;
ClearDocumentDependentSlots(aCx);
mFocusedElement = nullptr;
mLocalStorage = nullptr;
mSessionStorage = nullptr;
mPerformance = nullptr;
// This must be called after nullifying the internal objects because here we
// could recreate them, calling the getter methods, and store them into the JS
// slots. If we nullify them after, the slot values and the objects will be
// out of sync.
ClearDocumentDependentSlots(aCx);
#ifdef DEBUG
mLastOpenedURI = aDocument->GetDocumentURI();

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

@ -1920,7 +1920,12 @@ nsGlobalWindowOuter::SetNewDocument(nsIDocument* aDocument,
// recreate them when the innerWindow is reused.
newInnerWindow->mLocalStorage = nullptr;
newInnerWindow->mSessionStorage = nullptr;
newInnerWindow->mPerformance = nullptr;
// This must be called after nullifying the internal objects because
// here we could recreate them, calling the getter methods, and store
// them into the JS slots. If we nullify them after, the slot values and
// the objects will be out of sync.
newInnerWindow->ClearDocumentDependentSlots(cx);
// When replacing an initial about:blank document we call