mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-21 22:57:31 +09:00
Re-implement prompts.tab_modal.focusSwitch control in toolkit.
This commit is contained in:
parent
343a51f1a1
commit
21ea79484b
1 changed files with 9 additions and 3 deletions
|
|
@ -369,7 +369,13 @@ function openTabPrompt(domWin, tabPrompt, args) {
|
||||||
.getInterface(Ci.nsIDocShell);
|
.getInterface(Ci.nsIDocShell);
|
||||||
let inPermitUnload = docShell.contentViewer && docShell.contentViewer.inPermitUnload;
|
let inPermitUnload = docShell.contentViewer && docShell.contentViewer.inPermitUnload;
|
||||||
let eventDetail = Cu.cloneInto({tabPrompt: true, inPermitUnload}, domWin);
|
let eventDetail = Cu.cloneInto({tabPrompt: true, inPermitUnload}, domWin);
|
||||||
PromptUtils.fireDialogEvent(domWin, "DOMWillOpenModalDialog", null, eventDetail);
|
let allowFocusSwitch = true;
|
||||||
|
try {
|
||||||
|
allowFocusSwitch = Services.prefs.getBoolPref("prompts.tab_modal.focusSwitch");
|
||||||
|
} catch(e) {}
|
||||||
|
|
||||||
|
if (allowFocusSwitch)
|
||||||
|
PromptUtils.fireDialogEvent(domWin, "DOMWillOpenModalDialog", null, eventDetail);
|
||||||
|
|
||||||
let winUtils = domWin.QueryInterface(Ci.nsIInterfaceRequestor)
|
let winUtils = domWin.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||||
.getInterface(Ci.nsIDOMWindowUtils);
|
.getInterface(Ci.nsIDOMWindowUtils);
|
||||||
|
|
@ -395,8 +401,8 @@ function openTabPrompt(domWin, tabPrompt, args) {
|
||||||
frameMM.removeEventListener("pagehide", pagehide, true);
|
frameMM.removeEventListener("pagehide", pagehide, true);
|
||||||
|
|
||||||
winUtils.leaveModalState();
|
winUtils.leaveModalState();
|
||||||
|
if (allowFocusSwitch)
|
||||||
PromptUtils.fireDialogEvent(domWin, "DOMModalDialogClosed");
|
PromptUtils.fireDialogEvent(domWin, "DOMModalDialogClosed");
|
||||||
}
|
}
|
||||||
|
|
||||||
frameMM.addEventListener("pagehide", pagehide, true);
|
frameMM.addEventListener("pagehide", pagehide, true);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue