Bug 1559841. Make the 'load' event wait for OOP-iframes to load. r=kmag

Differential Revision: https://phabricator.services.mozilla.com/D41953
This commit is contained in:
Jonathan Watt
2019-09-19 00:00:44 +00:00
parent c219219694
commit c25ce80903
14 changed files with 124 additions and 30 deletions

View File

@@ -2130,6 +2130,16 @@ nsDocShell::HistoryPurged(int32_t aNumEntries) {
return NS_OK;
}
void nsDocShell::TriggerParentCheckDocShellIsEmpty() {
if (RefPtr<nsDocShell> parent = GetInProcessParentDocshell()) {
parent->DocLoaderIsEmpty(true);
} else if (BrowserChild* browserChild = BrowserChild::GetFrom(this)) {
// OOP parent
mozilla::Unused << browserChild->SendMaybeFireEmbedderLoadEvents(
/*aIsTrusted*/ true, /*aFireLoadAtEmbeddingElement*/ false);
}
}
nsresult nsDocShell::HistoryEntryRemoved(int32_t aIndex) {
// These indices are used for fastback cache eviction, to determine
// which session history entries are candidates for content viewer
@@ -3949,6 +3959,16 @@ NS_IMETHODIMP
nsDocShell::DisplayLoadError(nsresult aError, nsIURI* aURI,
const char16_t* aURL, nsIChannel* aFailedChannel,
bool* aDisplayedErrorPage) {
// If we have a cross-process parent document, we must notify it that we no
// longer block its load event. This is necessary for OOP sub-documents
// because error documents do not result in a call to
// SendMaybeFireEmbedderLoadEvents via any of the normal call paths.
// (Obviously, we must do this before any of the returns below.)
if (BrowserChild* browserChild = BrowserChild::GetFrom(this)) {
mozilla::Unused << browserChild->SendMaybeFireEmbedderLoadEvents(
/*aIsTrusted*/ true, /*aFireLoadAtEmbeddingElement*/ false);
}
*aDisplayedErrorPage = false;
// Get prompt and string bundle services
nsCOMPtr<nsIPrompt> prompter;