Bug 1886239 - Remove obsolete prompting code. r=leftmostcat
The pref removal is a port of bug 1705440. Everything else is dead code. Differential Revision: https://phabricator.services.mozilla.com/D205141 --HG-- extra : amend_source : 2c201c8ffbba571c54b3ffac250c321fa056efd6
This commit is contained in:
Родитель
84097a9310
Коммит
700aa48c63
|
@ -9,88 +9,7 @@ ChromeUtils.defineESModuleGetters(lazy, {
|
|||
PromptUtils: "resource://gre/modules/PromptUtils.sys.mjs",
|
||||
});
|
||||
|
||||
/**
|
||||
* @typedef {object} Prompt
|
||||
* @property {Function} resolver
|
||||
* The resolve function to be called with the data from the Prompt
|
||||
* after the user closes it.
|
||||
* @property {object} tabModalPrompt
|
||||
* The TabModalPrompt being shown to the user.
|
||||
*/
|
||||
|
||||
/**
|
||||
* gBrowserPrompts weakly maps BrowsingContexts to a Map of their currently
|
||||
* active Prompts.
|
||||
*
|
||||
* @type {WeakMap<BrowsingContext, Prompt>}
|
||||
*/
|
||||
const gBrowserPrompts = new WeakMap();
|
||||
|
||||
export class PromptParent extends JSWindowActorParent {
|
||||
didDestroy() {
|
||||
// In the event that the subframe or tab crashed, make sure that
|
||||
// we close any active Prompts.
|
||||
this.forceClosePrompts();
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a new Prompt to be tracked for a particular BrowsingContext.
|
||||
* We need to track a Prompt so that we can, for example, force-close the
|
||||
* TabModalPrompt if the originating subframe or tab unloads or crashes.
|
||||
*
|
||||
* @param {object} tabModalPrompt
|
||||
* The TabModalPrompt that will be shown to the user.
|
||||
* @param {string} id
|
||||
* A unique ID to differentiate multiple Prompts coming from the same
|
||||
* BrowsingContext.
|
||||
* @returns {Promise}
|
||||
* @resolves {object}
|
||||
* Resolves with the arguments returned from the TabModalPrompt when it
|
||||
* is dismissed.
|
||||
*/
|
||||
registerPrompt(tabModalPrompt, id) {
|
||||
let prompts = gBrowserPrompts.get(this.browsingContext);
|
||||
if (!prompts) {
|
||||
prompts = new Map();
|
||||
gBrowserPrompts.set(this.browsingContext, prompts);
|
||||
}
|
||||
|
||||
const promise = new Promise(resolve => {
|
||||
prompts.set(id, {
|
||||
tabModalPrompt,
|
||||
resolver: resolve,
|
||||
});
|
||||
});
|
||||
|
||||
return promise;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes a Prompt for a BrowsingContext with a particular ID from the registry.
|
||||
* This needs to be done to avoid leaking <xul:browser>'s.
|
||||
*
|
||||
* @param {string} id
|
||||
* A unique ID to differentiate multiple Prompts coming from the same
|
||||
* BrowsingContext.
|
||||
*/
|
||||
unregisterPrompt(id) {
|
||||
const prompts = gBrowserPrompts.get(this.browsingContext);
|
||||
if (prompts) {
|
||||
prompts.delete(id);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Programmatically closes all Prompts for the current BrowsingContext.
|
||||
*/
|
||||
forceClosePrompts() {
|
||||
const prompts = gBrowserPrompts.get(this.browsingContext) || [];
|
||||
|
||||
for (const [, prompt] of prompts) {
|
||||
prompt.tabModalPrompt && prompt.tabModalPrompt.abortPrompt();
|
||||
}
|
||||
}
|
||||
|
||||
receiveMessage(message) {
|
||||
const args = message.data;
|
||||
|
||||
|
|
|
@ -1326,7 +1326,6 @@ pref("mail.minimizeToTray", false);
|
|||
#endif
|
||||
|
||||
pref("prompts.defaultModalType", 3);
|
||||
pref("prompts.contentPromptSubDialog", false);
|
||||
|
||||
// The URL for the privacy policy related to recommended extensions.
|
||||
pref("extensions.recommendations.privacyPolicyUrl", "https://www.mozilla.org/en-US/privacy/thunderbird/#addons");
|
||||
|
|
Загрузка…
Ссылка в новой задаче