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
This commit is contained in:
Emilio Cobos Álvarez 2021-01-26 04:22:10 +00:00
Родитель 532e6c0902
Коммит c2884081ee
2 изменённых файлов: 8 добавлений и 37 удалений

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

@ -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("<div>heya</div>");
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");

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

@ -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<Document> 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<Document> 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<nsIDocShell> docShell = do_QueryInterface(this);
bool isInUnload;
if (docShell &&
NS_SUCCEEDED(docShell->GetIsInUnload(&isInUnload)) &&
!isInUnload) {
doc->OnPageShow(false, nullptr);
}
}
}
NotifyDoneWithOnload(parent);