Bug 1307122 - Introducing a timeout for sync XHR when unload events are dispatched, r=smaug

This commit is contained in:
Andrea Marchesini
2016-10-16 08:46:10 +02:00
parent 5c4824fc92
commit 884f0f2753
10 changed files with 221 additions and 3 deletions

View File

@@ -1087,7 +1087,7 @@ nsDocumentViewer::PermitUnloadInternal(bool *aShouldPrompt,
static bool sBeforeUnloadRequiresInteraction;
static bool sBeforeUnloadPrefsCached = false;
if (!sBeforeUnloadPrefsCached ) {
if (!sBeforeUnloadPrefsCached) {
sBeforeUnloadPrefsCached = true;
Preferences::AddBoolVarCache(&sIsBeforeUnloadDisabled,
BEFOREUNLOAD_DISABLED_PREFNAME);
@@ -1135,6 +1135,8 @@ nsDocumentViewer::PermitUnloadInternal(bool *aShouldPrompt,
dialogsAreEnabled = globalWindow->AreDialogsEnabled();
nsGlobalWindow::TemporarilyDisableDialogs disableDialogs(globalWindow);
nsIDocument::PageUnloadingEventTimeStamp timestamp(mDocument);
mInPermitUnload = true;
EventDispatcher::DispatchDOMEvent(window, nullptr, event, mPresContext,
nullptr);
@@ -1318,6 +1320,8 @@ nsDocumentViewer::PageHide(bool aIsUnload)
// here.
nsAutoPopupStatePusher popupStatePusher(openAbused, true);
nsIDocument::PageUnloadingEventTimeStamp timestamp(mDocument);
EventDispatcher::Dispatch(window, mPresContext, &event, nullptr, &status);
}