summaryrefslogtreecommitdiffstats
path: root/toolkit/components/prompts/src
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:34:42 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:34:42 +0000
commitda4c7e7ed675c3bf405668739c3012d140856109 (patch)
treecdd868dba063fecba609a1d819de271f0d51b23e /toolkit/components/prompts/src
parentAdding upstream version 125.0.3. (diff)
downloadfirefox-da4c7e7ed675c3bf405668739c3012d140856109.tar.xz
firefox-da4c7e7ed675c3bf405668739c3012d140856109.zip
Adding upstream version 126.0.upstream/126.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'toolkit/components/prompts/src')
-rw-r--r--toolkit/components/prompts/src/CommonDialog.sys.mjs62
-rw-r--r--toolkit/components/prompts/src/Prompter.sys.mjs31
2 files changed, 18 insertions, 75 deletions
diff --git a/toolkit/components/prompts/src/CommonDialog.sys.mjs b/toolkit/components/prompts/src/CommonDialog.sys.mjs
index a0812aa8ec..c788248442 100644
--- a/toolkit/components/prompts/src/CommonDialog.sys.mjs
+++ b/toolkit/components/prompts/src/CommonDialog.sys.mjs
@@ -30,11 +30,10 @@ CommonDialog.prototype = {
initialFocusResolver: null,
/**
- * @param [commonDialogEl] - Dialog element from commonDialog.xhtml,
- * null for TabModalPrompts.
+ * @param [commonDialogEl] - Dialog element from commonDialog.xhtml.
*/
- async onLoad(commonDialogEl = null) {
- let isEmbedded = !!commonDialogEl?.ownerGlobal.docShell.chromeEventHandler;
+ async onLoad(commonDialogEl) {
+ let isEmbedded = !!commonDialogEl.ownerGlobal.docShell.chromeEventHandler;
switch (this.args.promptType) {
case "alert":
@@ -106,36 +105,19 @@ CommonDialog.prototype = {
throw new Error("unknown dialog type");
}
- if (commonDialogEl) {
- commonDialogEl.setAttribute(
- "windowtype",
- "prompt:" + this.args.promptType
- );
- }
+ commonDialogEl.setAttribute("windowtype", "prompt:" + this.args.promptType);
// set the document title
let title = this.args.title;
let infoTitle = this.ui.infoTitle;
infoTitle.appendChild(infoTitle.ownerDocument.createTextNode(title));
- // Specific check to prevent showing the title on the old content prompts for macOS.
- // This should be removed when the old content prompts are removed.
- let contentSubDialogPromptEnabled = Services.prefs.getBoolPref(
- "prompts.contentPromptSubDialog"
- );
- let isOldContentPrompt =
- !contentSubDialogPromptEnabled &&
- this.args.modalType == Ci.nsIPrompt.MODAL_TYPE_CONTENT;
-
// After making these preventative checks, we can determine to show it if we're on
// macOS (where there is no titlebar) or if the prompt is a common dialog document
// and has been embedded (has a chromeEventHandler).
- infoTitle.hidden =
- isOldContentPrompt || !(AppConstants.platform === "macosx" || isEmbedded);
+ infoTitle.hidden = !(AppConstants.platform === "macosx" || isEmbedded);
- if (commonDialogEl) {
- commonDialogEl.ownerDocument.title = title;
- }
+ commonDialogEl.ownerDocument.title = title;
// Set button labels and visibility
//
@@ -193,7 +175,7 @@ CommonDialog.prototype = {
// set the icon
let icon = this.ui.infoIcon;
if (icon) {
- this.iconClass.forEach((el, idx, arr) => icon.classList.add(el));
+ this.iconClass.forEach(el => icon.classList.add(el));
}
// set default result to cancelled
@@ -202,15 +184,7 @@ CommonDialog.prototype = {
// Set the default button
let b = this.args.defaultButtonNum || 0;
- let button = this.ui["button" + b];
-
- if (commonDialogEl) {
- commonDialogEl.defaultButton = ["accept", "cancel", "extra1", "extra2"][
- b
- ];
- } else {
- button.setAttribute("default", "true");
- }
+ commonDialogEl.defaultButton = ["accept", "cancel", "extra1", "extra2"][b];
if (!isEmbedded && !this.ui.promptContainer?.hidden) {
// Set default focus and select textbox contents if applicable. If we're
@@ -229,7 +203,7 @@ CommonDialog.prototype = {
// Play a sound (unless we're showing a content prompt -- don't want those
// to feel like OS prompts).
try {
- if (commonDialogEl && this.soundID && !this.args.openedWithTabDialog) {
+ if (this.soundID && !this.args.openedWithTabDialog) {
Cc["@mozilla.org/sound;1"]
.getService(Ci.nsISound)
.playEventSound(this.soundID);
@@ -238,20 +212,12 @@ CommonDialog.prototype = {
console.error("Couldn't play common dialog event sound: ", e);
}
- if (commonDialogEl) {
- if (isEmbedded) {
- // If we delayed default focus above, wait for it to be ready before
- // sending the notification.
- await this.initialFocusPromise;
- }
- Services.obs.notifyObservers(this.ui.prompt, "common-dialog-loaded");
- } else {
- // ui.promptContainer is the <tabmodalprompt> element.
- Services.obs.notifyObservers(
- this.ui.promptContainer,
- "tabmodal-dialog-loaded"
- );
+ if (isEmbedded) {
+ // If we delayed default focus above, wait for it to be ready before
+ // sending the notification.
+ await this.initialFocusPromise;
}
+ Services.obs.notifyObservers(this.ui.prompt, "common-dialog-loaded");
},
setLabelForNode(aNode, aLabel) {
diff --git a/toolkit/components/prompts/src/Prompter.sys.mjs b/toolkit/components/prompts/src/Prompter.sys.mjs
index a0b5edca2f..2174ba10c6 100644
--- a/toolkit/components/prompts/src/Prompter.sys.mjs
+++ b/toolkit/components/prompts/src/Prompter.sys.mjs
@@ -1257,7 +1257,7 @@ class ModalPrompter {
}
async openInternalWindowPrompt(parentWindow, args) {
- if (!parentWindow?.gDialogBox || !ModalPrompter.windowPromptSubDialog) {
+ if (!parentWindow?.gDialogBox) {
this.openWindowPrompt(parentWindow, args);
return;
}
@@ -1720,15 +1720,7 @@ class ModalPrompter {
return result;
}
- asyncPromptAuth(
- channel,
- callback,
- context,
- level,
- authInfo,
- checkLabel,
- checkValue
- ) {
+ asyncPromptAuth() {
// Nothing calls this directly; netwerk ends up going through
// nsIPromptService::GetPrompt, which delegates to login manager.
// Login manger handles the async bits itself, and only calls out
@@ -1757,13 +1749,6 @@ XPCOMUtils.defineLazyPreferenceGetter(
MODAL_TYPE_WINDOW
);
-XPCOMUtils.defineLazyPreferenceGetter(
- ModalPrompter,
- "windowPromptSubDialog",
- "prompts.windowPromptSubDialog",
- false
-);
-
export function AuthPromptAdapterFactory() {}
AuthPromptAdapterFactory.prototype = {
classID: Components.ID("{6e134924-6c3a-4d86-81ac-69432dd971dc}"),
@@ -1786,7 +1771,7 @@ AuthPromptAdapter.prototype = {
/* ---------- nsIAuthPrompt2 ---------- */
- promptAuth(channel, level, authInfo, checkLabel, checkValue) {
+ promptAuth(channel, level, authInfo) {
let message = InternalPromptUtils.makeAuthMessage(
this.oldPrompter,
channel,
@@ -1833,15 +1818,7 @@ AuthPromptAdapter.prototype = {
return ok;
},
- asyncPromptAuth(
- channel,
- callback,
- context,
- level,
- authInfo,
- checkLabel,
- checkValue
- ) {
+ asyncPromptAuth() {
throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
},
};