Skip to content

Commit a356882

Browse files
committed
Bug 1705440 - remove old modal prompt implementation, r=mconley,webdriver-reviewers,extension-reviewers,desktop-theme-reviewers,tabbrowser-reviewers,whimboo,rpl
Differential Revision: https://phabricator.services.mozilla.com/D204759
1 parent 5d1af66 commit a356882

File tree

29 files changed

+24
-1228
lines changed

29 files changed

+24
-1228
lines changed

accessible/tests/mochitest/relations/a11y.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,4 @@ skip-if = [
1818

1919
["test_tree.xhtml"]
2020

21-
["test_ui_modalprompt.html"]
22-
2321
["test_update.html"]

accessible/tests/mochitest/relations/test_ui_modalprompt.html

Lines changed: 0 additions & 111 deletions
This file was deleted.

browser/actors/PromptParent.sys.mjs

Lines changed: 1 addition & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,6 @@ ChromeUtils.defineESModuleGetters(lazy, {
99
PromptUtils: "resource://gre/modules/PromptUtils.sys.mjs",
1010
BrowserUtils: "resource://gre/modules/BrowserUtils.sys.mjs",
1111
});
12-
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
13-
14-
XPCOMUtils.defineLazyPreferenceGetter(
15-
lazy,
16-
"tabChromePromptSubDialog",
17-
"prompts.tabChromePromptSubDialog",
18-
false
19-
);
20-
21-
XPCOMUtils.defineLazyPreferenceGetter(
22-
lazy,
23-
"contentPromptSubDialog",
24-
"prompts.contentPromptSubDialog",
25-
false
26-
);
2712

2813
ChromeUtils.defineLazyGetter(lazy, "gTabBrowserLocalization", function () {
2914
return new Localization(["browser/tabbrowser.ftl"], true);
@@ -109,116 +94,18 @@ export class PromptParent extends JSWindowActorParent {
10994
}
11095

11196
receiveMessage(message) {
112-
let args = message.data;
113-
let id = args._remoteId;
114-
11597
switch (message.name) {
11698
case "Prompt:Open":
11799
if (!this.windowContext.isActiveInTab) {
118100
return undefined;
119101
}
120102

121-
if (
122-
(args.modalType === Ci.nsIPrompt.MODAL_TYPE_CONTENT &&
123-
!lazy.contentPromptSubDialog) ||
124-
(args.modalType === Ci.nsIPrompt.MODAL_TYPE_TAB &&
125-
!lazy.tabChromePromptSubDialog)
126-
) {
127-
return this.openContentPrompt(args, id);
128-
}
129-
return this.openPromptWithTabDialogBox(args);
103+
return this.openPromptWithTabDialogBox(message.data);
130104
}
131105

132106
return undefined;
133107
}
134108

135-
/**
136-
* Opens a TabModalPrompt for a BrowsingContext, and puts the associated browser
137-
* in the modal state until the TabModalPrompt is closed.
138-
*
139-
* @param {Object} args
140-
* The arguments passed up from the BrowsingContext to be passed directly
141-
* to the TabModalPrompt.
142-
* @param {string} id
143-
* A unique ID to differentiate multiple Prompts coming from the same
144-
* BrowsingContext.
145-
* @return {Promise}
146-
* Resolves when the TabModalPrompt is dismissed.
147-
* @resolves {Object}
148-
* The arguments returned from the TabModalPrompt.
149-
*/
150-
openContentPrompt(args, id) {
151-
let browser = this.browsingContext.top.embedderElement;
152-
if (!browser) {
153-
throw new Error("Cannot tab-prompt without a browser!");
154-
}
155-
let window = browser.ownerGlobal;
156-
let tabPrompt = window.gBrowser.getTabModalPromptBox(browser);
157-
let newPrompt;
158-
let needRemove = false;
159-
160-
// If the page which called the prompt is different from the the top context
161-
// where we show the prompt, ask the prompt implementation to display the origin.
162-
// For example, this can happen if a cross origin subframe shows a prompt.
163-
args.showCallerOrigin =
164-
args.promptPrincipal &&
165-
!browser.contentPrincipal.equals(args.promptPrincipal);
166-
167-
let onPromptClose = () => {
168-
// NOTE: this code is totally bust now, as `gBrowserDialogs` won't produce
169-
// the right objects for it. It's also unused though, and removed in the
170-
// next commit.
171-
let promptData = gBrowserDialogs.get(this.browsingContext);
172-
if (!promptData || !promptData.has(id)) {
173-
throw new Error(
174-
"Failed to close a prompt since it wasn't registered for some reason."
175-
);
176-
}
177-
178-
let { resolver, tabModalPrompt } = promptData.get(id);
179-
// It's possible that we removed the prompt during the
180-
// appendPrompt call below. In that case, newPrompt will be
181-
// undefined. We set the needRemove flag to remember to remove
182-
// it right after we've finished adding it.
183-
if (tabModalPrompt) {
184-
tabPrompt.removePrompt(tabModalPrompt);
185-
} else {
186-
needRemove = true;
187-
}
188-
189-
lazy.PromptUtils.fireDialogEvent(
190-
window,
191-
"DOMModalDialogClosed",
192-
browser,
193-
this.getClosingEventDetail(args)
194-
);
195-
resolver(args);
196-
browser.maybeLeaveModalState();
197-
};
198-
199-
try {
200-
browser.enterModalState();
201-
lazy.PromptUtils.fireDialogEvent(
202-
window,
203-
"DOMWillOpenModalDialog",
204-
browser,
205-
this.getOpenEventDetail(args)
206-
);
207-
208-
args.promptActive = true;
209-
210-
newPrompt = tabPrompt.appendPrompt(args, onPromptClose);
211-
if (needRemove) {
212-
tabPrompt.removePrompt(newPrompt);
213-
}
214-
} catch (ex) {
215-
console.error(ex);
216-
onPromptClose(true);
217-
}
218-
219-
return null;
220-
}
221-
222109
/**
223110
* Opens either a window prompt or TabDialogBox at the content or tab level
224111
* for a BrowsingContext, and puts the associated browser in the modal state

browser/app/profile/firefox.js

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1680,15 +1680,6 @@ pref("browser.topsites.contile.sov.enabled", true);
16801680
pref("browser.partnerlink.attributionURL", "https://topsites.services.mozilla.com/cid/");
16811681
pref("browser.partnerlink.campaign.topsites", "amzn_2020_a1");
16821682

1683-
// Whether to show tab level system prompts opened via nsIPrompt(Service) as
1684-
// SubDialogs in the TabDialogBox (true) or as TabModalPrompt in the
1685-
// TabModalPromptBox (false).
1686-
pref("prompts.tabChromePromptSubDialog", true);
1687-
1688-
// Whether to show the dialogs opened at the content level, such as
1689-
// alert() or prompt(), using a SubDialogManager in the TabDialogBox.
1690-
pref("prompts.contentPromptSubDialog", true);
1691-
16921683
// Whether to show window-modal dialogs opened for browser windows
16931684
// in a SubDialog inside their parent, instead of an OS level window.
16941685
pref("prompts.windowPromptSubDialog", true);

browser/base/content/browser.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -916,7 +916,7 @@ menupopup[emptyplacesresult="true"] > .hide-if-empty-places-result {
916916
position: absolute;
917917
}
918918

919-
browser[tabmodalPromptShowing], browser[tabDialogShowing] {
919+
browser[tabDialogShowing] {
920920
-moz-user-focus: none !important;
921921
}
922922

0 commit comments

Comments
 (0)