diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:27 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:27 +0000 |
commit | 40a355a42d4a9444dc753c04c6608dade2f06a23 (patch) | |
tree | 871fc667d2de662f171103ce5ec067014ef85e61 /toolkit/components/prompts | |
parent | Adding upstream version 124.0.1. (diff) | |
download | firefox-upstream/125.0.1.tar.xz firefox-upstream/125.0.1.zip |
Adding upstream version 125.0.1.upstream/125.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'toolkit/components/prompts')
9 files changed, 42 insertions, 160 deletions
diff --git a/toolkit/components/prompts/content/commonDialog.css b/toolkit/components/prompts/content/commonDialog.css index ac01353aae..3521af13c6 100644 --- a/toolkit/components/prompts/content/commonDialog.css +++ b/toolkit/components/prompts/content/commonDialog.css @@ -58,15 +58,6 @@ dialog[insecureauth] { flex: 1; } -#spinnerContainer { - align-items: center; -} - -#spinnerContainer > img { - width: 16px; - height: 16px; -} - #loginLabel, #password1Label { text-align: start; } diff --git a/toolkit/components/prompts/content/commonDialog.js b/toolkit/components/prompts/content/commonDialog.js index d9b39f696a..1c9ba6a9a8 100644 --- a/toolkit/components/prompts/content/commonDialog.js +++ b/toolkit/components/prompts/content/commonDialog.js @@ -95,7 +95,6 @@ function commonDialogOnLoad() { infoBody: document.getElementById("infoBody"), infoTitle: document.getElementById("infoTitle"), infoIcon: document.getElementById("infoIcon"), - spinnerContainer: document.getElementById("spinnerContainer"), checkbox: document.getElementById("checkbox"), checkboxContainer: document.getElementById("checkboxContainer"), button3: dialog.getButton("extra2"), diff --git a/toolkit/components/prompts/content/commonDialog.xhtml b/toolkit/components/prompts/content/commonDialog.xhtml index def3b93956..83cc37d9ed 100644 --- a/toolkit/components/prompts/content/commonDialog.xhtml +++ b/toolkit/components/prompts/content/commonDialog.xhtml @@ -83,16 +83,6 @@ /> </div> </div> - <div id="spinnerContainer" class="dialogRow" hidden="hidden"> - <img - src="chrome://global/skin/icons/loading.png" - data-l10n-id="common-dialog-spinner" - srcset=" - chrome://global/skin/icons/loading.png, - chrome://global/skin/icons/loading@2x.png 1.25x - " - /> - </div> <div id="loginContainer" class="dialogRow" hidden="hidden"> <xul:label id="loginLabel" diff --git a/toolkit/components/prompts/docs/nsIPromptService-reference.rst b/toolkit/components/prompts/docs/nsIPromptService-reference.rst index 9879cd753a..c1412a30f8 100644 --- a/toolkit/components/prompts/docs/nsIPromptService-reference.rst +++ b/toolkit/components/prompts/docs/nsIPromptService-reference.rst @@ -2,7 +2,7 @@ Prompt Service Reference ======================== -This is the JSDoc from the Prompter.jsm implementation. You can find the full +This is the JSDoc from the Prompter.sys.mjs implementation. You can find the full interface definition in `nsIPromptService.idl <https://searchfox.org/mozilla-central/source/toolkit/components/windowwatcher/nsIPromptService.idl>`_. diff --git a/toolkit/components/prompts/src/CommonDialog.sys.mjs b/toolkit/components/prompts/src/CommonDialog.sys.mjs index 22b6921917..a0812aa8ec 100644 --- a/toolkit/components/prompts/src/CommonDialog.sys.mjs +++ b/toolkit/components/prompts/src/CommonDialog.sys.mjs @@ -137,10 +137,6 @@ CommonDialog.prototype = { commonDialogEl.ownerDocument.title = title; } - if (this.ui.spinnerContainer && this.args.showSpinner) { - this.ui.spinnerContainer.hidden = false; - } - // Set button labels and visibility // // This assumes that button0 defaults to a visible "ok" button, and diff --git a/toolkit/components/prompts/src/Prompter.sys.mjs b/toolkit/components/prompts/src/Prompter.sys.mjs index ce17f1b457..a0b5edca2f 100644 --- a/toolkit/components/prompts/src/Prompter.sys.mjs +++ b/toolkit/components/prompts/src/Prompter.sys.mjs @@ -1058,7 +1058,7 @@ class ModalPrompter { closed = true; }); Services.tm.spinEventLoopUntilOrQuit( - "prompts/Prompter.jsm:openPromptSync", + "prompts/Prompter.sys.mjs:openPromptSync", () => closed ); } @@ -1474,7 +1474,8 @@ class ModalPrompter { } if (flags & Ci.nsIPrompt.SHOW_SPINNER) { - args.showSpinner = true; + // When bug 1879550 is fixed, add a higher-res version here + args.headerIconURL = "chrome://global/skin/icons/loading.png"; } if (this.async) { diff --git a/toolkit/components/prompts/test/PromptTestUtils.sys.mjs b/toolkit/components/prompts/test/PromptTestUtils.sys.mjs index 138c61b189..051763cfa8 100644 --- a/toolkit/components/prompts/test/PromptTestUtils.sys.mjs +++ b/toolkit/components/prompts/test/PromptTestUtils.sys.mjs @@ -6,40 +6,9 @@ * nsIPromptService. */ -import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; import { BrowserTestUtils } from "resource://testing-common/BrowserTestUtils.sys.mjs"; import { TestUtils } from "resource://testing-common/TestUtils.sys.mjs"; -const kPrefs = {}; - -// Whether prompts with modal type TAB are shown as SubDialog (true) or -// TabModalPrompt (false). -XPCOMUtils.defineLazyPreferenceGetter( - kPrefs, - "tabPromptSubDialogEnabled", - "prompts.tabChromePromptSubDialog", - false -); - -// Whether web content prompts (alert etc.) are shown as SubDialog (true) -// or TabModalPrompt (false) -XPCOMUtils.defineLazyPreferenceGetter( - kPrefs, - "contentPromptSubDialogEnabled", - "prompts.contentPromptSubDialog", - false -); - -function isCommonDialog(modalType) { - return ( - modalType === Services.prompt.MODAL_TYPE_WINDOW || - (kPrefs.tabPromptSubDialogEnabled && - modalType === Services.prompt.MODAL_TYPE_TAB) || - (kPrefs.contentPromptSubDialogEnabled && - modalType === Services.prompt.MODAL_TYPE_CONTENT) - ); -} - export let PromptTestUtils = { /** * Wait for a prompt from nsIPrompt or nsIPromptsService, interact with it and @@ -85,13 +54,7 @@ export let PromptTestUtils = { let promptClosePromise; // Get parent window to listen for prompt close event - let win; - if (isCommonDialog(dialog.args.modalType)) { - win = dialog.ui.prompt?.opener; - } else { - // Tab prompts should always have a parent window - win = dialog.ui.prompt.win; - } + let win = dialog.ui.prompt?.opener; if (win) { promptClosePromise = BrowserTestUtils.waitForEvent( @@ -161,65 +124,50 @@ export let PromptTestUtils = { } } - let topic = isCommonDialog(modalType) - ? "common-dialog-loaded" - : "tabmodal-dialog-loaded"; + let topic = "common-dialog-loaded"; let dialog; await TestUtils.topicObserved(topic, subject => { // If we are not given a browser, use the currently selected browser of the window let browser = parentBrowser || subject.ownerGlobal.gBrowser?.selectedBrowser; - if (isCommonDialog(modalType)) { - // Is not associated with given parent window, skip - if (parentWindow && subject.opener !== parentWindow) { - return false; - } - - // For tab prompts, ensure that the associated browser matches. - if (browser && modalType == Services.prompt.MODAL_TYPE_TAB) { - let dialogBox = parentWindow.gBrowser.getTabDialogBox(browser); - let hasMatchingDialog = dialogBox - .getTabDialogManager() - ._dialogs.some( - d => d._frame?.browsingContext == subject.browsingContext - ); - if (!hasMatchingDialog) { - return false; - } - } + // Is not associated with given parent window, skip + if (parentWindow && subject.opener !== parentWindow) { + return false; + } - if (browser && modalType == Services.prompt.MODAL_TYPE_CONTENT) { - let dialogBox = parentWindow.gBrowser.getTabDialogBox(browser); - let hasMatchingDialog = dialogBox - .getContentDialogManager() - ._dialogs.some( - d => d._frame?.browsingContext == subject.browsingContext - ); - if (!hasMatchingDialog) { - return false; - } + // For tab prompts, ensure that the associated browser matches. + if (browser && modalType == Services.prompt.MODAL_TYPE_TAB) { + let dialogBox = parentWindow.gBrowser.getTabDialogBox(browser); + let hasMatchingDialog = dialogBox + .getTabDialogManager() + ._dialogs.some( + d => d._frame?.browsingContext == subject.browsingContext + ); + if (!hasMatchingDialog) { + return false; } + } - // subject is the window object of the prompt which has a Dialog object - // attached. - dialog = subject.Dialog; - } else { - // subject is the tabprompt dom node - // Get the full prompt object which has the dialog object - let prompt = browser.tabModalPromptBox.getPrompt(subject); - - // Is not associated with given parent browser, skip. - if (!prompt) { + if (browser && modalType == Services.prompt.MODAL_TYPE_CONTENT) { + let dialogBox = parentWindow.gBrowser.getTabDialogBox(browser); + let hasMatchingDialog = dialogBox + .getContentDialogManager() + ._dialogs.some( + d => d._frame?.browsingContext == subject.browsingContext + ); + if (!hasMatchingDialog) { return false; } - - dialog = prompt.Dialog; } + // subject is the window object of the prompt which has a Dialog object + // attached. + dialog = subject.Dialog; + // Not the modalType we're looking for. // For window prompts dialog.args.modalType is undefined. - if (isCommonDialog(modalType) && dialog.args.modalType !== modalType) { + if (dialog.args.modalType !== modalType) { return false; } diff --git a/toolkit/components/prompts/test/chromeScript.js b/toolkit/components/prompts/test/chromeScript.js index 1e71224f6b..9a6bacc8a4 100644 --- a/toolkit/components/prompts/test/chromeScript.js +++ b/toolkit/components/prompts/test/chromeScript.js @@ -8,16 +8,6 @@ const { BrowserTestUtils } = ChromeUtils.importESModule( "resource://testing-common/BrowserTestUtils.sys.mjs" ); -var tabSubDialogsEnabled = Services.prefs.getBoolPref( - "prompts.tabChromePromptSubDialog", - false -); - -var contentPromptSubdialogsEnabled = Services.prefs.getBoolPref( - "prompts.contentPromptSubDialog", - false -); - // Define these to make EventUtils happy. let window = this; let parent = {}; @@ -91,31 +81,15 @@ async function handlePrompt(action, modalType, isSelect) { let ui; let browserWin = Services.wm.getMostRecentWindow("navigator:browser"); - if ( - (!contentPromptSubdialogsEnabled && - modalType === Services.prompt.MODAL_TYPE_CONTENT) || - (!tabSubDialogsEnabled && modalType === Services.prompt.MODAL_TYPE_TAB) - ) { - let gBrowser = browserWin.gBrowser; - let promptManager = gBrowser.getTabModalPromptBox(gBrowser.selectedBrowser); - let prompts = promptManager.listPrompts(); - if (!prompts.length) { - return false; // try again in a bit - } + let doc = getDialogDoc(); + if (!doc) { + return false; // try again in a bit + } - ui = prompts[0].Dialog.ui; - checkTabModal(prompts[0], gBrowser.selectedBrowser); + if (isSelect) { + ui = doc; } else { - let doc = getDialogDoc(); - if (!doc) { - return false; // try again in a bit - } - - if (isSelect) { - ui = doc; - } else { - ui = doc.defaultView.Dialog.ui; - } + ui = doc.defaultView.Dialog.ui; } let dialogClosed = BrowserTestUtils.waitForEvent( diff --git a/toolkit/components/prompts/test/prompt_common.js b/toolkit/components/prompts/test/prompt_common.js index 4b3a2262aa..8d583060da 100644 --- a/toolkit/components/prompts/test/prompt_common.js +++ b/toolkit/components/prompts/test/prompt_common.js @@ -21,10 +21,6 @@ var tabSubDialogsEnabled = SpecialPowers.Services.prefs.getBoolPref( "prompts.tabChromePromptSubDialog", false ); -var contentSubDialogsEnabled = SpecialPowers.Services.prefs.getBoolPref( - "prompts.contentPromptSubDialog", - false -); var isSelectDialog = false; var isOSX = "nsILocalFileMac" in SpecialPowers.Ci; var isE10S = SpecialPowers.Services.appinfo.processType == 2; @@ -200,20 +196,7 @@ function checkPromptState(promptState, expectedState) { // XXX check title? OS X has title in content is(promptState.msg, expectedState.msg, "Checking expected message"); - let isOldContentPrompt = - !promptState.isSubDialogPrompt && - modalType === Ci.nsIPrompt.MODAL_TYPE_CONTENT; - - if (isOldContentPrompt && !promptState.showCallerOrigin) { - ok( - promptState.titleHidden, - "The title should be hidden for content prompts opened with tab modal prompt." - ); - } else if ( - isOSX || - promptState.isSubDialogPrompt || - promptState.showCallerOrigin - ) { + if (isOSX || promptState.isSubDialogPrompt || promptState.showCallerOrigin) { ok( !promptState.titleHidden, "Checking title always visible on OS X or when opened with common dialog" |