summaryrefslogtreecommitdiffstats
path: root/toolkit/components/prompts
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:35:49 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:35:49 +0000
commitd8bbc7858622b6d9c278469aab701ca0b609cddf (patch)
treeeff41dc61d9f714852212739e6b3738b82a2af87 /toolkit/components/prompts
parentReleasing progress-linux version 125.0.3-1~progress7.99u1. (diff)
downloadfirefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.tar.xz
firefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.zip
Merging upstream version 126.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'toolkit/components/prompts')
-rw-r--r--toolkit/components/prompts/content/tabprompts.css119
-rw-r--r--toolkit/components/prompts/content/tabprompts.sys.mjs298
-rw-r--r--toolkit/components/prompts/jar.mn2
-rw-r--r--toolkit/components/prompts/src/CommonDialog.sys.mjs62
-rw-r--r--toolkit/components/prompts/src/Prompter.sys.mjs31
-rw-r--r--toolkit/components/prompts/test/chromeScript.js49
-rw-r--r--toolkit/components/prompts/test/prompt_common.js10
-rw-r--r--toolkit/components/prompts/test/test_bug619644.html2
-rw-r--r--toolkit/components/prompts/test/test_subresources_prompts.html7
9 files changed, 24 insertions, 556 deletions
diff --git a/toolkit/components/prompts/content/tabprompts.css b/toolkit/components/prompts/content/tabprompts.css
deleted file mode 100644
index 539e8792cc..0000000000
--- a/toolkit/components/prompts/content/tabprompts.css
+++ /dev/null
@@ -1,119 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-/* Tab Modal Prompt boxes */
-
-.tabModalBackground {
- justify-content: center;
- flex-direction: column;
-}
-
-.tabModalBackground,
-tabmodalprompt {
- width: 100%;
- height: 100%;
-}
-
-tabmodalprompt {
- --tabmodalprompt-padding: 20px;
- overflow: hidden;
- text-shadow: none; /* remove lightweight theme text-shadow */
-}
-
-tabmodalprompt:not([hidden]) {
- display: grid;
- grid-template-rows: 1fr [dialog-start] auto [dialog-end] 2fr;
- justify-items: center;
-}
-
-/*
- Adjustments for chrome level tab-prompts to make them
- overlap with the upper chrome UI and move them in
- front of content prompts.
-*/
-tabmodalprompt.tab-prompt {
- overflow: visible;
- z-index: 1;
- grid-template-rows: [dialog-start] auto [dialog-end] 1fr;
-}
-
-tabmodalprompt.tab-prompt .tabmodalprompt-mainContainer {
- margin-top: -5px;
-}
-
-.tabmodalprompt-mainContainer {
- min-width: 20em;
- min-height: 12em;
- max-width: calc(60% + calc(var(--tabmodalprompt-padding) * 2));
- -moz-user-focus: normal;
- grid-row: dialog;
-
- display: flex;
- flex-direction: column;
-}
-
-.tabmodalprompt-topContainer {
- flex-grow: 1;
- padding: var(--tabmodalprompt-padding);
- display: grid;
- grid-template-columns: auto 1fr;
- align-items: baseline;
- align-content: center; /* center content vertically */
- max-width: 100%;
- min-height: 0;
- max-height: 60vh;
- box-sizing: border-box;
-}
-
-.tabmodalprompt-topContainer > div:not(.tabmodalprompt-infoContainer, [hidden]) {
- display: contents;
-}
-
-.tabmodalprompt-infoContainer {
- grid-column: span 2;
-
- display: block;
- margin-block: auto;
- max-width: 100%;
- height: 100%;
- min-height: 0;
- justify-self: center; /* center text, but only when it fits in one line */
-}
-
-/* When all elements in the first column are hidden, prevent the second column
- from becoming the first one because it won't have the right fraction */
-.tabmodalprompt-topContainer > div > *:nth-child(2) {
- grid-column: 2;
-}
-
-.infoTitle {
- margin-bottom: 1em !important;
- font-weight: bold;
-}
-
-.infoBody {
- margin: 0 !important;
- -moz-user-focus: normal;
- user-select: text;
- cursor: text !important;
- white-space: pre-wrap;
- unicode-bidi: plaintext;
- outline: none; /* remove focus outline */
- overflow: auto;
- max-width: 100%;
- max-height: 100%;
-}
-
-tabmodalprompt label[value=""] {
- display: none;
-}
-
-.tabmodalprompt-buttonContainer {
- display: flex;
- padding: 12px var(--tabmodalprompt-padding) 15px;
-}
-
-.tabmodalprompt-buttonSpacer {
- flex-grow: 1;
-}
diff --git a/toolkit/components/prompts/content/tabprompts.sys.mjs b/toolkit/components/prompts/content/tabprompts.sys.mjs
deleted file mode 100644
index 7edb024fa8..0000000000
--- a/toolkit/components/prompts/content/tabprompts.sys.mjs
+++ /dev/null
@@ -1,298 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs";
-
-export var TabModalPrompt = class {
- constructor(win) {
- this.win = win;
- let newPrompt = (this.element =
- win.document.createElement("tabmodalprompt"));
- win.MozXULElement.insertFTLIfNeeded("toolkit/global/tabprompts.ftl");
- newPrompt.setAttribute("role", "dialog");
- let randomIdSuffix = Math.random().toString(32).substring(2);
- newPrompt.setAttribute("aria-describedby", `infoBody-${randomIdSuffix}`);
- newPrompt.appendChild(
- win.MozXULElement.parseXULToFragment(
- `
- <div class="tabmodalprompt-mainContainer" xmlns="http://www.w3.org/1999/xhtml" xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
- <div class="tabmodalprompt-topContainer">
- <div class="tabmodalprompt-infoContainer">
- <div class="tabmodalprompt-infoTitle infoTitle" hidden="hidden"/>
- <div class="tabmodalprompt-infoBody infoBody" id="infoBody-${randomIdSuffix}" tabindex="-1"/>
- </div>
-
- <div class="tabmodalprompt-loginContainer" hidden="hidden">
- <xul:label class="tabmodalprompt-loginLabel" data-l10n-id="tabmodalprompt-username" control="loginTextbox-${randomIdSuffix}"/>
- <input class="tabmodalprompt-loginTextbox" id="loginTextbox-${randomIdSuffix}"/>
- </div>
-
- <div class="tabmodalprompt-password1Container" hidden="hidden">
- <xul:label class="tabmodalprompt-password1Label" data-l10n-id="tabmodalprompt-password" control="password1Textbox-${randomIdSuffix}"/>
- <input class="tabmodalprompt-password1Textbox" type="password" id="password1Textbox-${randomIdSuffix}"/>
- </div>
-
- <div class="tabmodalprompt-checkboxContainer" hidden="hidden">
- <div/>
- <xul:checkbox class="tabmodalprompt-checkbox"/>
- </div>
-
- <!-- content goes here -->
- </div>
- <div class="tabmodalprompt-buttonContainer">
- <xul:button class="tabmodalprompt-button3" hidden="true"/>
- <div class="tabmodalprompt-buttonSpacer"/>
- <xul:button class="tabmodalprompt-button0" data-l10n-id="tabmodalprompt-ok-button"/>
- <xul:button class="tabmodalprompt-button2" hidden="true"/>
- <xul:button class="tabmodalprompt-button1" data-l10n-id="tabmodalprompt-cancel-button"/>
- </div>
- </div>`
- )
- );
-
- this.ui = {
- prompt: this,
- promptContainer: this.element,
- mainContainer: newPrompt.querySelector(".tabmodalprompt-mainContainer"),
- loginContainer: newPrompt.querySelector(".tabmodalprompt-loginContainer"),
- loginTextbox: newPrompt.querySelector(".tabmodalprompt-loginTextbox"),
- loginLabel: newPrompt.querySelector(".tabmodalprompt-loginLabel"),
- password1Container: newPrompt.querySelector(
- ".tabmodalprompt-password1Container"
- ),
- password1Textbox: newPrompt.querySelector(
- ".tabmodalprompt-password1Textbox"
- ),
- password1Label: newPrompt.querySelector(".tabmodalprompt-password1Label"),
- infoContainer: newPrompt.querySelector(".tabmodalprompt-infoContainer"),
- infoBody: newPrompt.querySelector(".tabmodalprompt-infoBody"),
- infoTitle: newPrompt.querySelector(".tabmodalprompt-infoTitle"),
- infoIcon: null,
- rows: newPrompt.querySelector(".tabmodalprompt-topContainer"),
- checkbox: newPrompt.querySelector(".tabmodalprompt-checkbox"),
- checkboxContainer: newPrompt.querySelector(
- ".tabmodalprompt-checkboxContainer"
- ),
- button3: newPrompt.querySelector(".tabmodalprompt-button3"),
- button2: newPrompt.querySelector(".tabmodalprompt-button2"),
- button1: newPrompt.querySelector(".tabmodalprompt-button1"),
- button0: newPrompt.querySelector(".tabmodalprompt-button0"),
- // focusTarget (for BUTTON_DELAY_ENABLE) not yet supported
- };
-
- if (AppConstants.XP_UNIX) {
- // Reorder buttons on Linux
- let buttonContainer = newPrompt.querySelector(
- ".tabmodalprompt-buttonContainer"
- );
- buttonContainer.appendChild(this.ui.button3);
- buttonContainer.appendChild(this.ui.button2);
- buttonContainer.appendChild(
- newPrompt.querySelector(".tabmodalprompt-buttonSpacer")
- );
- buttonContainer.appendChild(this.ui.button1);
- buttonContainer.appendChild(this.ui.button0);
- }
-
- this.ui.button0.addEventListener(
- "command",
- this.onButtonClick.bind(this, 0)
- );
- this.ui.button1.addEventListener(
- "command",
- this.onButtonClick.bind(this, 1)
- );
- this.ui.button2.addEventListener(
- "command",
- this.onButtonClick.bind(this, 2)
- );
- this.ui.button3.addEventListener(
- "command",
- this.onButtonClick.bind(this, 3)
- );
- // Anonymous wrapper used here because |Dialog| doesn't exist until init() is called!
- this.ui.checkbox.addEventListener("command", () => {
- this.Dialog.onCheckbox();
- });
-
- /**
- * Based on dialog.xml handlers
- */
- this.element.addEventListener(
- "keypress",
- event => {
- switch (event.keyCode) {
- case KeyEvent.DOM_VK_RETURN:
- this.onKeyAction("default", event);
- break;
-
- case KeyEvent.DOM_VK_ESCAPE:
- this.onKeyAction("cancel", event);
- break;
-
- default:
- if (
- AppConstants.platform == "macosx" &&
- event.key == "." &&
- event.metaKey
- ) {
- this.onKeyAction("cancel", event);
- }
- break;
- }
- },
- { mozSystemGroup: true }
- );
-
- this.element.addEventListener(
- "focus",
- event => {
- let bnum = this.args.defaultButtonNum || 0;
- let defaultButton = this.ui["button" + bnum];
-
- if (AppConstants.platform == "macosx") {
- // On OS X, the default button always stays marked as such (until
- // the entire prompt blurs).
- defaultButton.setAttribute("default", "true");
- } else {
- // On other platforms, the default button is only marked as such
- // when no other button has focus. XUL buttons on not-OSX will
- // react to pressing enter as a command, so you can't trigger the
- // default without tabbing to it or something that isn't a button.
- let focusedDefault = event.originalTarget == defaultButton;
- let someButtonFocused =
- event.originalTarget.localName == "button" ||
- event.originalTarget.localName == "toolbarbutton";
- if (focusedDefault || !someButtonFocused) {
- defaultButton.setAttribute("default", "true");
- }
- }
- },
- true
- );
-
- this.element.addEventListener("blur", () => {
- // If focus shifted to somewhere else in the browser, don't make
- // the default button look active.
- let bnum = this.args.defaultButtonNum || 0;
- let button = this.ui["button" + bnum];
- button.removeAttribute("default");
- });
- }
-
- init(args, linkedTab, onCloseCallback) {
- this.args = args;
- this.linkedTab = linkedTab;
- this.onCloseCallback = onCloseCallback;
-
- if (args.enableDelay) {
- throw new Error(
- "BUTTON_DELAY_ENABLE not yet supported for tab-modal prompts"
- );
- }
-
- // Apply styling depending on modalType (content or tab prompt)
- if (args.modalType === Ci.nsIPrompt.MODAL_TYPE_TAB) {
- this.element.classList.add("tab-prompt");
- } else {
- this.element.classList.add("content-prompt");
- }
-
- // We need to remove the prompt when the tab or browser window is closed or
- // the page navigates, else we never unwind the event loop and that's sad times.
- // Remember to cleanup in shutdownPrompt()!
- this.win.addEventListener("resize", this);
- this.win.addEventListener("unload", this);
- if (linkedTab) {
- linkedTab.addEventListener("TabClose", this);
- }
- // Note:
- // nsPrompter.js or in e10s mode browser-parent.js call abortPrompt,
- // when the domWindow, for which the prompt was created, generates
- // a "pagehide" event.
-
- let { CommonDialog } = ChromeUtils.importESModule(
- "resource://gre/modules/CommonDialog.sys.mjs"
- );
- this.Dialog = new CommonDialog(args, this.ui);
- this.Dialog.onLoad(null);
-
- // For content prompts display the tabprompt title that shows the prompt origin when
- // the prompt origin is not the same as that of the top window.
- if (
- args.modalType == Ci.nsIPrompt.MODAL_TYPE_CONTENT &&
- args.showCallerOrigin
- ) {
- this.ui.infoTitle.removeAttribute("hidden");
- }
-
- // TODO: should unhide buttonSpacer on Windows when there are 4 buttons.
- // Better yet, just drop support for 4-button dialogs. (bug 609510)
- }
-
- shutdownPrompt() {
- // remove our event listeners
- try {
- this.win.removeEventListener("resize", this);
- this.win.removeEventListener("unload", this);
- if (this.linkedTab) {
- this.linkedTab.removeEventListener("TabClose", this);
- }
- } catch (e) {}
- // invoke callback
- this.onCloseCallback();
- this.win = null;
- this.ui = null;
- // Intentionally not cleaning up |this.element| here --
- // TabModalPromptBox.removePrompt() would need it and it might not
- // be called yet -- see browser_double_close_tabs.js.
- }
-
- abortPrompt() {
- // Called from other code when the page changes.
- this.Dialog.abortPrompt();
- this.shutdownPrompt();
- }
-
- handleEvent(aEvent) {
- switch (aEvent.type) {
- case "unload":
- case "TabClose":
- this.abortPrompt();
- break;
- }
- }
-
- onButtonClick(buttonNum) {
- // We want to do all the work her asynchronously off a Gecko
- // runnable, because of situations like the one described in
- // https://bugzilla.mozilla.org/show_bug.cgi?id=1167575#c35 : we
- // get here off processing of an OS event and will also process
- // one more Gecko runnable before we break out of the event loop
- // spin whoever posted the prompt is doing. If we do all our
- // work sync, we will exit modal state _before_ processing that
- // runnable, and if exiting moral state posts a runnable we will
- // incorrectly process that runnable before leaving our event
- // loop spin.
- Services.tm.dispatchToMainThread(() => {
- this.Dialog["onButton" + buttonNum]();
- this.shutdownPrompt();
- });
- }
-
- onKeyAction(action, event) {
- if (event.defaultPrevented) {
- return;
- }
-
- event.stopPropagation();
- if (action == "default") {
- let bnum = this.args.defaultButtonNum || 0;
- this.onButtonClick(bnum);
- } else {
- // action == "cancel"
- this.onButtonClick(1); // Cancel button
- }
- }
-};
diff --git a/toolkit/components/prompts/jar.mn b/toolkit/components/prompts/jar.mn
index 819af6dc1d..7a904c4363 100644
--- a/toolkit/components/prompts/jar.mn
+++ b/toolkit/components/prompts/jar.mn
@@ -9,5 +9,3 @@ toolkit.jar:
content/global/commonDialog.css (content/commonDialog.css)
content/global/selectDialog.js (content/selectDialog.js)
content/global/selectDialog.xhtml (content/selectDialog.xhtml)
- content/global/tabprompts.css (content/tabprompts.css)
- content/global/tabprompts.sys.mjs (content/tabprompts.sys.mjs)
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);
},
};
diff --git a/toolkit/components/prompts/test/chromeScript.js b/toolkit/components/prompts/test/chromeScript.js
index 9a6bacc8a4..f873c5d04b 100644
--- a/toolkit/components/prompts/test/chromeScript.js
+++ b/toolkit/components/prompts/test/chromeScript.js
@@ -31,52 +31,6 @@ async function handlePromptWhenItAppears(action, modalType, isSelect) {
}
}
-function checkTabModal(prompt, browser) {
- let doc = browser.ownerDocument;
-
- let { bottom: toolboxBottom } = doc
- .getElementById("navigator-toolbox")
- .getBoundingClientRect();
-
- let { mainContainer } = prompt.ui;
-
- let { x, y } = mainContainer.getBoundingClientRect();
- ok(y > 0, "Container should have y > 0");
- // Inset by 1px since the corner point doesn't return the frame due to the
- // border-radius.
- is(
- doc.elementFromPoint(x + 1, y + 1).parentNode,
- mainContainer,
- "Check tabmodalprompt is visible"
- );
-
- info("Click to the left of the dialog over the content area");
- isnot(
- doc.elementFromPoint(x - 10, y + 50),
- browser,
- "Check clicks on the content area don't go to the browser"
- );
- is(
- doc.elementFromPoint(x - 10, y + 50),
- prompt.element,
- "Check clicks on the content area go to the prompt dialog background"
- );
-
- if (prompt.args.modalType == Ci.nsIPrompt.MODAL_TYPE_TAB) {
- ok(
- y <= toolboxBottom - 5,
- "Dialog should overlap the toolbox by at least 5px"
- );
- } else {
- ok(y >= toolboxBottom, "Dialog must not overlap with toolbox.");
- }
-
- ok(
- browser.hasAttribute("tabmodalPromptShowing"),
- "Check browser has @tabmodalPromptShowing"
- );
-}
-
async function handlePrompt(action, modalType, isSelect) {
let ui;
let browserWin = Services.wm.getMostRecentWindow("navigator:browser");
@@ -142,8 +96,7 @@ function getPromptState(ui) {
state.checkHidden = ui.checkboxContainer.hidden;
state.checkMsg = state.checkHidden ? "" : ui.checkbox.label;
state.checked = state.checkHidden ? false : ui.checkbox.checked;
- // TabModalPrompts don't have an infoIcon
- state.iconClass = ui.infoIcon ? ui.infoIcon.className : null;
+ state.iconClass = ui.infoIcon.className;
state.textValue = ui.loginTextbox.value;
state.passValue = ui.password1Textbox.value;
diff --git a/toolkit/components/prompts/test/prompt_common.js b/toolkit/components/prompts/test/prompt_common.js
index 8d583060da..25b0a4c438 100644
--- a/toolkit/components/prompts/test/prompt_common.js
+++ b/toolkit/components/prompts/test/prompt_common.js
@@ -17,10 +17,6 @@ function propBagToObject(bag) {
}
var modalType;
-var tabSubDialogsEnabled = SpecialPowers.Services.prefs.getBoolPref(
- "prompts.tabChromePromptSubDialog",
- false
-);
var isSelectDialog = false;
var isOSX = "nsILocalFileMac" in SpecialPowers.Ci;
var isE10S = SpecialPowers.Services.appinfo.processType == 2;
@@ -160,7 +156,7 @@ function onloadPromiseFor(id) {
return new Promise(resolve => {
iframe.addEventListener(
"load",
- function (e) {
+ function () {
resolve(true);
},
{ once: true }
@@ -227,7 +223,7 @@ function checkPromptState(promptState, expectedState) {
is(promptState.checked, expectedState.checked, "Checking checkbox checked");
if (
modalType === Ci.nsIPrompt.MODAL_TYPE_WINDOW ||
- (modalType === Ci.nsIPrompt.MODAL_TYPE_TAB && tabSubDialogsEnabled)
+ modalType === Ci.nsIPrompt.MODAL_TYPE_TAB
) {
is(
promptState.iconClass,
@@ -366,7 +362,7 @@ function PrompterProxy(chromeScript) {
return new Proxy(
{},
{
- get(target, prop, receiver) {
+ get(target, prop) {
return (...args) => {
// Array of indices of out/inout params to copy from the parent back to the caller.
let outParams = [];
diff --git a/toolkit/components/prompts/test/test_bug619644.html b/toolkit/components/prompts/test/test_bug619644.html
index 2b424c71a6..03650d6d6d 100644
--- a/toolkit/components/prompts/test/test_bug619644.html
+++ b/toolkit/components/prompts/test/test_bug619644.html
@@ -31,7 +31,7 @@ function inittest() {
SimpleTest.waitForExplicitFinish();
}
-function runtest(e) {
+function runtest() {
modalType = Ci.nsIPrompt.MODAL_TYPE_CONTENT;
window.removeEventListener("message", runtest);
diff --git a/toolkit/components/prompts/test/test_subresources_prompts.html b/toolkit/components/prompts/test/test_subresources_prompts.html
index b71ad0694e..134af95c6d 100644
--- a/toolkit/components/prompts/test/test_subresources_prompts.html
+++ b/toolkit/components/prompts/test/test_subresources_prompts.html
@@ -33,11 +33,6 @@ var iframe1Loaded = onloadPromiseFor("iframe_diff_origin");
var iframe2Loaded = onloadPromiseFor("iframe_same_origin");
var iframe_prompt = document.getElementById("iframe_prompt");
-// Depending on pref state we either show auth prompts as windows or on tab level.
-let authPromptModalType = SpecialPowers.Services.prefs.getIntPref(
- "prompts.modalType.httpAuth"
-);
-
add_task(async function runTest() {
modalType = Ci.nsIPrompt.MODAL_TYPE_CONTENT;
@@ -104,7 +99,7 @@ add_task(async function runTestAuth() {
// cross-origin subresources load
// Let prompt_common know what kind of modal type is enabled for auth prompts.
- modalType = authPromptModalType;
+ modalType = Ci.nsIPrompt.MODAL_TYPE_TAB;
let state, action;