diff options
author | janekptacijarabaci <janekptacijarabaci@seznam.cz> | 2018-05-15 22:45:40 +0200 |
---|---|---|
committer | janekptacijarabaci <janekptacijarabaci@seznam.cz> | 2018-05-15 22:45:40 +0200 |
commit | d1184bfb4939e76f3aa442daa90dc5cca3a850e4 (patch) | |
tree | 38fb593b4e01dca46ab37540e1933327d055105f /layout/base | |
parent | e968422d299e49d1906e6f4c7746cfd9a677e72b (diff) | |
download | UXP-d1184bfb4939e76f3aa442daa90dc5cca3a850e4.tar UXP-d1184bfb4939e76f3aa442daa90dc5cca3a850e4.tar.gz UXP-d1184bfb4939e76f3aa442daa90dc5cca3a850e4.tar.lz UXP-d1184bfb4939e76f3aa442daa90dc5cca3a850e4.tar.xz UXP-d1184bfb4939e76f3aa442daa90dc5cca3a850e4.zip |
Bug 1379762 part 2. Use a more reliable test to figure out when we can skip firing onload in nsDocumentViewer::LoadComplete
Issue #357
Diffstat (limited to 'layout/base')
-rw-r--r-- | layout/base/nsDocumentViewer.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/layout/base/nsDocumentViewer.cpp b/layout/base/nsDocumentViewer.cpp index 137efb3cd..7b8734928 100644 --- a/layout/base/nsDocumentViewer.cpp +++ b/layout/base/nsDocumentViewer.cpp @@ -1012,7 +1012,13 @@ nsDocumentViewer::LoadComplete(nsresult aStatus) nsIDocShell *docShell = window->GetDocShell(); NS_ENSURE_TRUE(docShell, NS_ERROR_UNEXPECTED); - docShell->GetRestoringDocument(&restoring); + // Unfortunately, docShell->GetRestoringDocument() might no longer be set + // correctly. In particular, it can be false by now if someone took it upon + // themselves to block onload from inside restoration and unblock it later. + // But we can detect the restoring case very simply: by whether our + // document's readyState is COMPLETE. + restoring = (mDocument->GetReadyStateEnum() == + nsIDocument::READYSTATE_COMPLETE); if (!restoring) { NS_ASSERTION(mDocument->IsXULDocument() || // readyState for XUL is bogus mDocument->GetReadyStateEnum() == @@ -1023,6 +1029,13 @@ nsDocumentViewer::LoadComplete(nsresult aStatus) nsIDocument::READYSTATE_UNINITIALIZED && NS_IsAboutBlank(mDocument->GetDocumentURI())), "Bad readystate"); +#ifdef DEBUG + bool docShellThinksWeAreRestoring; + docShell->GetRestoringDocument(&docShellThinksWeAreRestoring); + MOZ_ASSERT(!docShellThinksWeAreRestoring, + "How can docshell think we are restoring if we don't have a " + "READYSTATE_COMPLETE document?"); +#endif // DEBUG nsCOMPtr<nsIDocument> d = mDocument; mDocument->SetReadyStateInternal(nsIDocument::READYSTATE_COMPLETE); |