Bug 1754759 Comment 11 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

Here is a log for the modal state enter / exit calls. We seem do be doing it in both `PromptParent` and `Prompter`. Not necessarily the root cause of the bug but still unexpected.

```
// Prompt Opens

console.trace: "Prompter.sys.mjs:enterModalState"
resource://gre/modules/Prompter.sys.mjs 1182 openPrompt
resource://gre/modules/Prompter.sys.mjs 1049 openPromptSync
resource://gre/modules/Prompter.sys.mjs 1354 alert
https://bug1754759.bmoattachments.org/attachment.cgi?id=9263291 3 

console.trace: "browser: Entering modal state"
chrome://global/content/elements/browser-custom-element.js 1868 enterModalState
resource:///actors/PromptParent.sys.mjs 163 openPromptWithTabDialogBox
resource:///actors/PromptParent.sys.mjs 103 receiveMessage

// Prompt closes

console.trace: "browser: maybe leave modal state"
chrome://global/content/elements/browser-custom-element.js 1887 maybeLeaveModalState
resource:///actors/PromptParent.sys.mjs 266 openPromptWithTabDialogBox

console.trace: "Prompter.sys.mjs:leaveModalState"
resource://gre/modules/Prompter.sys.mjs 1222 openPrompt
resource://gre/modules/Prompter.sys.mjs 1060 openPromptSync
resource://gre/modules/Prompter.sys.mjs 1354 alert
https://bug1754759.bmoattachments.org/attachment.cgi?id=9263291 3 
JavaScript error: resource://gre/modules/Prompter.sys.mjs, line 1213: NS_ERROR_NOT_AVAILABLE: prompt aborted by user
```
Here is a log for the modal state enter / exit calls. We seem do be doing it in both `PromptParent` and `Prompter`. Not necessarily the root cause of the bug but still unexpected.

```
// Prompt Opens

console.trace: "Prompter.sys.mjs:enterModalState"
resource://gre/modules/Prompter.sys.mjs 1182 openPrompt
resource://gre/modules/Prompter.sys.mjs 1049 openPromptSync
resource://gre/modules/Prompter.sys.mjs 1354 alert
https://bug1754759.bmoattachments.org/attachment.cgi?id=9263291 3 

console.trace: "browser: Entering modal state"
chrome://global/content/elements/browser-custom-element.js 1868 enterModalState
resource:///actors/PromptParent.sys.mjs 163 openPromptWithTabDialogBox
resource:///actors/PromptParent.sys.mjs 103 receiveMessage

// Prompt closes

console.trace: "browser: maybe leave modal state"
chrome://global/content/elements/browser-custom-element.js 1887 maybeLeaveModalState
resource:///actors/PromptParent.sys.mjs 266 openPromptWithTabDialogBox

console.trace: "Prompter.sys.mjs:leaveModalState"
resource://gre/modules/Prompter.sys.mjs 1222 openPrompt
resource://gre/modules/Prompter.sys.mjs 1060 openPromptSync
resource://gre/modules/Prompter.sys.mjs 1354 alert
https://bug1754759.bmoattachments.org/attachment.cgi?id=9263291 3 

JavaScript error: resource://gre/modules/Prompter.sys.mjs, line 1213: NS_ERROR_NOT_AVAILABLE: prompt aborted by user
```
Here is a log for the modal state enter / exit calls. We seem do be doing it in both `PromptParent` and `Prompter`. Not necessarily the root cause of the bug but still unexpected.

```
// Prompt Opens

console.trace: "Prompter.sys.mjs:enterModalState"
resource://gre/modules/Prompter.sys.mjs 1182 openPrompt
resource://gre/modules/Prompter.sys.mjs 1049 openPromptSync
resource://gre/modules/Prompter.sys.mjs 1354 alert
https://bug1754759.bmoattachments.org/attachment.cgi?id=9263291 3 

console.trace: "browser: Entering modal state"
chrome://global/content/elements/browser-custom-element.js 1868 enterModalState
resource:///actors/PromptParent.sys.mjs 163 openPromptWithTabDialogBox
resource:///actors/PromptParent.sys.mjs 103 receiveMessage

// Prompt closes

console.trace: "browser: maybe leave modal state"
chrome://global/content/elements/browser-custom-element.js 1887 maybeLeaveModalState
resource:///actors/PromptParent.sys.mjs 266 openPromptWithTabDialogBox

console.trace: "Prompter.sys.mjs:leaveModalState"
resource://gre/modules/Prompter.sys.mjs 1222 openPrompt
resource://gre/modules/Prompter.sys.mjs 1060 openPromptSync
resource://gre/modules/Prompter.sys.mjs 1354 alert
https://bug1754759.bmoattachments.org/attachment.cgi?id=9263291 3 

JavaScript error: resource://gre/modules/Prompter.sys.mjs, line 1213: NS_ERROR_NOT_AVAILABLE: prompt aborted by user
```

The "prompt aborted by user" error comes from here:
```
commonDialogOnLoad (chrome://global/content/commonDialog.js#109)
close (resource://gre/modules/SubDialog.sys.mjs#446)
abort (resource://gre/modules/SubDialog.sys.mjs#232)
abortDialogs (resource://gre/modules/SubDialog.sys.mjs#1095)
abortDialogs (resource://gre/modules/SubDialog.sys.mjs#1095)
abortAllDialogs (chrome://browser/content/browser.js#7607)
handleEvent (chrome://browser/content/browser.js#7602)
_beginRemoveTab (chrome://browser/content/tabbrowser/tabbrowser.js#4314)
swapBrowsersAndCloseOther (chrome://browser/content/tabbrowser/tabbrowser.js#4701)
swapBrowsers (chrome://browser/content/browser-init.js#264)
onLoad (chrome://browser/content/browser-init.js#276)
<anonymous> (chrome://browser/content/browser.xhtml#126)
```
The tab move triggers a "TabClose" event which then calls into `abortAllDialogs` and then bubbles up as the error message "prompt aborted by user" via `commonDialog.js` and `Prompter.sys.mjs` here: https://searchfox.org/mozilla-central/rev/4582d908c17fbf7924f5699609fe4a12c28ddc4a/toolkit/components/prompts/src/Prompter.sys.mjs#1211

Back to Bug 1754759 Comment 11