зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1643204 - Fire pageshow event when we finish loading a Document.open load, if we haven't already fired one for the Document. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D84934
This commit is contained in:
Родитель
015cd602ab
Коммит
5193267988
|
@ -0,0 +1,13 @@
|
|||
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,17 @@ void nsDocLoader::DocLoaderIsEmpty(bool aFlushLayout,
|
|||
if (!parent || parent->ChildEnteringOnload(this)) {
|
||||
nsresult loadGroupStatus = NS_OK;
|
||||
mLoadGroup->GetStatus(&loadGroupStatus);
|
||||
// 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);
|
||||
|
||||
// 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);
|
||||
// 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) {
|
||||
nsCOMPtr<nsPIDOMWindowOuter> window = doc->GetWindow();
|
||||
if (window && !doc->SkipLoadEventAfterClose()) {
|
||||
if (!mozilla::dom::DocGroup::TryToLoadIframesInBackground() ||
|
||||
|
@ -817,6 +817,19 @@ 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);
|
||||
|
|
Загрузка…
Ссылка в новой задаче