mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 05:41:12 +00:00
Bug 967873 - Allow RemotePrompt to be closed while it's being opened (r=Gijs)
This commit is contained in:
parent
c76ae8f933
commit
cb38fc540e
@ -39,11 +39,18 @@ var RemotePrompt = {
|
||||
let tabPrompt = window.gBrowser.getTabModalPromptBox(browser)
|
||||
let callbackInvoked = false;
|
||||
let newPrompt;
|
||||
let needRemove = false;
|
||||
let promptId = args._remoteId;
|
||||
|
||||
function onPromptClose(forceCleanup) {
|
||||
// It's possible that we removed the prompt during the
|
||||
// appendPrompt call below. In that case, newPrompt will be
|
||||
// undefined. We set the needRemove flag to remember to remove
|
||||
// it right after we've finished adding it.
|
||||
if (newPrompt)
|
||||
tabPrompt.removePrompt(newPrompt);
|
||||
else
|
||||
needRemove = true;
|
||||
|
||||
PromptUtils.fireDialogEvent(window, "DOMModalDialogClosed", browser);
|
||||
browser.messageManager.sendAsyncMessage("Prompt:Close", args);
|
||||
@ -74,6 +81,10 @@ var RemotePrompt = {
|
||||
|
||||
newPrompt = tabPrompt.appendPrompt(args, onPromptClose);
|
||||
|
||||
if (needRemove) {
|
||||
tabPrompt.removePrompt(newPrompt);
|
||||
}
|
||||
|
||||
// TODO since we don't actually open a window, need to check if
|
||||
// there's other stuff in nsWindowWatcher::OpenWindowInternal
|
||||
// that we might need to do here as well.
|
||||
|
Loading…
Reference in New Issue
Block a user