From c2884081eeb3bb47fdae45fa270c4dea6a26cbe5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Tue, 26 Jan 2021 04:22:10 +0000 Subject: [PATCH] Bug 1685201 - Back out bug 1643204. r=mattwoodrow,smaug Bug 1643204 really only papered over the issue of the active state being messed up / the document becoming visible internally without notifying media. Bug 1572798 notifies media properly so that the visibility state is consistent with what media thinks the visibility state is, so I think there's no longer a reason to do this. No other browser passes the test added in bug 1643204. Differential Revision: https://phabricator.services.mozilla.com/D100836 --- .../pageshow-event.window.js | 13 -------- uriloader/base/nsDocLoader.cpp | 32 +++++-------------- 2 files changed, 8 insertions(+), 37 deletions(-) delete mode 100644 testing/web-platform/tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/pageshow-event.window.js diff --git a/testing/web-platform/tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/pageshow-event.window.js b/testing/web-platform/tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/pageshow-event.window.js deleted file mode 100644 index 45570b35abf2..000000000000 --- a/testing/web-platform/tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/pageshow-event.window.js +++ /dev/null @@ -1,13 +0,0 @@ -async_test(t => { - const frame = document.body.appendChild(document.createElement("iframe")); - assert_equals(frame.contentDocument.open(), frame.contentDocument); - assert_equals(frame.contentDocument.documentElement, null); - frame.contentDocument.write("
heya
"); - frame.contentDocument.close(); - frame.contentWindow.addEventListener("pageshow", function() { - t.step(function() { - assert_true(true, "Got pageshow event"); - }); - t.done(); - }); -}, "document.open(), and the pageshow events"); diff --git a/uriloader/base/nsDocLoader.cpp b/uriloader/base/nsDocLoader.cpp index bf7902f5dd64..d62c6926efe0 100644 --- a/uriloader/base/nsDocLoader.cpp +++ b/uriloader/base/nsDocLoader.cpp @@ -769,17 +769,14 @@ void nsDocLoader::DocLoaderIsEmpty(bool aFlushLayout, if (!parent || parent->ChildEnteringOnload(this)) { nsresult loadGroupStatus = NS_OK; mLoadGroup->GetStatus(&loadGroupStatus); - - // Can "doc" or "window" ever come back null here? Our state machine - // is complicated enough I wouldn't bet against it... - nsCOMPtr doc = do_GetInterface(GetAsSupports(this)); - if (doc) { - // Make sure we're not canceling the loadgroup. If we are, then just - // like the normal navigation case we should not fire a load event. - if (NS_SUCCEEDED(loadGroupStatus) || - loadGroupStatus == NS_ERROR_PARSED_DATA_CACHED) { - // The readyState change is required to pass - // dom/html/test/test_bug347174_write.html + // Make sure we're not canceling the loadgroup. If we are, then just + // like the normal navigation case we should not fire a load event. + if (NS_SUCCEEDED(loadGroupStatus) || + loadGroupStatus == NS_ERROR_PARSED_DATA_CACHED) { + // Can "doc" or "window" ever come back null here? Our state machine + // is complicated enough I wouldn't bet against it... + nsCOMPtr doc = do_GetInterface(GetAsSupports(this)); + if (doc) { doc->SetReadyStateInternal(Document::READYSTATE_COMPLETE, /* updateTimingInformation = */ false); doc->StopDocumentLoad(); @@ -821,19 +818,6 @@ void nsDocLoader::DocLoaderIsEmpty(bool aFlushLayout, } } } - } else if (loadGroupStatus == NS_BINDING_ABORTED) { - doc->NotifyAbortedLoad(); - } - - if (doc->IsCurrentActiveDocument() && !doc->IsShowing() && - loadGroupStatus != NS_BINDING_ABORTED) { - nsCOMPtr docShell = do_QueryInterface(this); - bool isInUnload; - if (docShell && - NS_SUCCEEDED(docShell->GetIsInUnload(&isInUnload)) && - !isInUnload) { - doc->OnPageShow(false, nullptr); - } } } NotifyDoneWithOnload(parent);