зеркало из https://github.com/mozilla/gecko-dev.git
Bug 956524
--HG-- extra : rebase_source : 1bfe727a03a06a90a49c7002a9d2a71bc17acbfe
This commit is contained in:
Родитель
248b724fe7
Коммит
0daa541342
|
@ -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()
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче