--HG--
extra : rebase_source : 1bfe727a03a06a90a49c7002a9d2a71bc17acbfe
This commit is contained in:
Gijs Kruitbosch 2014-01-16 16:57:13 +01:00
Родитель 248b724fe7
Коммит 0daa541342
3 изменённых файлов: 24 добавлений и 2 удалений

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

@ -4132,7 +4132,16 @@ nsDocShell::IsPrintingOrPP(bool aDisplayErrorDialog)
bool
nsDocShell::IsNavigationAllowed(bool aDisplayPrintErrorDialog)
{
return !IsPrintingOrPP(aDisplayPrintErrorDialog) && !mFiredUnloadEvent;
bool isAllowed = !IsPrintingOrPP(aDisplayPrintErrorDialog) && !mFiredUnloadEvent;
if (!isAllowed) {
return false;
}
if (!mContentViewer) {
return true;
}
bool firingBeforeUnload;
mContentViewer->GetBeforeUnloadFiring(&firingBeforeUnload);
return !firingBeforeUnload;
}
//*****************************************************************************

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

@ -28,7 +28,7 @@ class nsDOMNavigationTiming;
[ptr] native nsViewPtr(nsView);
[ptr] native nsDOMNavigationTimingPtr(nsDOMNavigationTiming);
[scriptable, builtinclass, uuid(1b22be51-efe8-42ac-a9a0-06f50f39beee)]
[scriptable, builtinclass, uuid(a73d693a-6260-468a-ae64-d64237f0858c)]
interface nsIContentViewer : nsISupports
{
@ -58,6 +58,12 @@ interface nsIContentViewer : nsISupports
[noscript,nostdcall] boolean permitUnloadInternal(in boolean aCallerClosesWindow,
inout boolean aShouldPrompt);
/**
* Exposes whether we're in the process of firing the beforeunload event.
* In this case, the corresponding docshell will not allow navigation.
*/
readonly attribute boolean beforeUnloadFiring;
/**
* Works in tandem with permitUnload, if the caller decides not to close the
* window it indicated it will, it is the caller's responsibility to reset

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

@ -1239,6 +1239,13 @@ nsDocumentViewer::PermitUnloadInternal(bool aCallerClosesWindow,
return NS_OK;
}
NS_IMETHODIMP
nsDocumentViewer::GetBeforeUnloadFiring(bool* aInEvent)
{
*aInEvent = mInPermitUnload;
return NS_OK;
}
NS_IMETHODIMP
nsDocumentViewer::ResetCloseWindow()
{