Bug 1680637 Comment 2 Edit History

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

Micah and I met and discussed how to move forward here. Right now we have 3 implementations of prompting:

1. window-modal prompts
2. tab-modal prompts (the "pretty" blue buttons / white background dialogs that we use for e.g. the http auth dialog)
3. content-modal prompts (the "ugly" ones that we wanna fix)

You can see all 3 in action using:

```
Services.prompt.alertBC(gBrowser.selectedBrowser.browsingContext, Ci.nsIPromptService.Ci.nsIPromptService.MODAL_TYPE_WINDOW, "Title", "message")
```

and for the other two, substitute `Ci.nsIPromptService.MODAL_TYPE_TAB` and `Ci.nsiPromptService.MODAL_TYPE_CONTENT`, respectively.

At one point, both (2) and (3) were implemented on [TabModalPromptBox](https://searchfox.org/mozilla-central/rev/23c25cd32a1e87095301273937b4ee162f41e860/browser/base/content/browser.js#9079,9088-9089), and we made some display differentiation but used the same [`tabprompts.jsm`](https://searchfox.org/mozilla-central/source/toolkit/components/prompts/content/tabprompts.jsm) code to display both. This is [documented](https://firefox-source-docs.mozilla.org/toolkit/components/prompts/prompts/modalTypes.html).

Unfortunately, the documentation is now slightly outdated - we [switched](https://bugzilla.mozilla.org/show_bug.cgi?id=1664817) to the new-ish ("pretty") dialogs for `MODAL_TYPE_TAB` in Firefox 82. The pref for this still exists, and so does a bunch of the old code, but because the pref is now always `true`, [the check in PromptParent](https://searchfox.org/mozilla-central/rev/23c25cd32a1e87095301273937b4ee162f41e860/browser/actors/PromptParent.jsm#121-125) will now always use the new dialog for content type prompts.

In this bug, we basically want to (behind the proton pref, which is still off by default everywhere) switch to using the new/"pretty" implementation for the `TYPE_CONTENT` dialogs, too. Some other changes (like vertical centering, and displaying the origin in the dialog) are in other deps of the 
proton-modals bug.

In theory, this could maybe use `openChromePrompt` in `PromptParent`, but in practice that runs the risk of showing a window-modal dialog. I think we'll want to make sure that we never show dialogs from web content in window-modal dialogs, so we should modify `openContentPrompt` and/or add a separate method to deal with the `TYPE_CONTENT` prompts when the proton pref is true.

Paul, can you double-check my representation above is correct? :-)
Micah and I met and discussed how to move forward here. Right now we have 3 implementations of prompting:

1. window-modal prompts
2. tab-modal prompts (the "pretty" blue buttons / white background dialogs that we use for e.g. the http auth dialog)
3. content-modal prompts (the "ugly" ones that we wanna fix)

You can see all 3 in action using:

```
Services.prompt.alertBC(gBrowser.selectedBrowser.browsingContext, Ci.nsIPromptService.Ci.nsIPromptService.MODAL_TYPE_WINDOW, "Title", "message")
```

and for the other two, substitute `Ci.nsIPromptService.MODAL_TYPE_TAB` and `Ci.nsiPromptService.MODAL_TYPE_CONTENT`, respectively.

At one point, both (2) and (3) were implemented on [TabModalPromptBox](https://searchfox.org/mozilla-central/rev/23c25cd32a1e87095301273937b4ee162f41e860/browser/base/content/browser.js#9079,9088-9089), and we made some display differentiation but used the same [`tabprompts.jsm`](https://searchfox.org/mozilla-central/source/toolkit/components/prompts/content/tabprompts.jsm) code to display both. This is [documented](https://firefox-source-docs.mozilla.org/toolkit/components/prompts/prompts/modalTypes.html).

Unfortunately, the documentation is now slightly outdated - we [switched](https://bugzilla.mozilla.org/show_bug.cgi?id=1664817) to the new-ish ("pretty") dialogs for `MODAL_TYPE_TAB` in Firefox 82. The pref for this still exists, and so does a bunch of the old code, but because the pref is now always `true`, [the check in PromptParent](https://searchfox.org/mozilla-central/rev/23c25cd32a1e87095301273937b4ee162f41e860/browser/actors/PromptParent.jsm#121-125) will now always use the new dialog for `TAB` type prompts.

In this bug, we basically want to (behind the proton pref, which is still off by default everywhere) switch to using the new/"pretty" implementation for the `TYPE_CONTENT` dialogs, too. Some other changes (like vertical centering, and displaying the origin in the dialog) are in other deps of the 
proton-modals bug.

In theory, this could maybe use `openChromePrompt` in `PromptParent`, but in practice that runs the risk of showing a window-modal dialog. I think we'll want to make sure that we never show dialogs from web content in window-modal dialogs, so we should modify `openContentPrompt` and/or add a separate method to deal with the `TYPE_CONTENT` prompts when the proton pref is true.

Paul, can you double-check my representation above is correct? :-)

Back to Bug 1680637 Comment 2