Backed out 3 changesets (bug 1680637, bug 1682395) for browser/base/content/* failures CLOSED TREE

Backed out changeset 270e2e3183de (bug 1682395)
Backed out changeset e3566f596187 (bug 1680637)
Backed out changeset 66563136c84e (bug 1680637)
This commit is contained in:
Bogdan Tara 2021-01-11 21:36:20 +02:00
Родитель 37b2661e41
Коммит 6101a13054
17 изменённых файлов: 52 добавлений и 186 удалений

Просмотреть файл

@ -29,13 +29,6 @@ XPCOMUtils.defineLazyPreferenceGetter(
false
);
XPCOMUtils.defineLazyPreferenceGetter(
this,
"contentPromptSubDialog",
"prompts.contentPromptSubDialog",
false
);
/**
* @typedef {Object} Prompt
* @property {Function} resolver
@ -125,14 +118,13 @@ class PromptParent extends JSWindowActorParent {
switch (message.name) {
case "Prompt:Open": {
if (
(args.modalType === Ci.nsIPrompt.MODAL_TYPE_CONTENT &&
!contentPromptSubDialog) ||
args.modalType === Ci.nsIPrompt.MODAL_TYPE_CONTENT ||
(args.modalType === Ci.nsIPrompt.MODAL_TYPE_TAB &&
!tabChromePromptSubDialog)
) {
return this.openContentPrompt(args, id);
}
return this.openPromptWithTabDialogBox(args);
return this.openChromePrompt(args);
}
}
@ -233,19 +225,18 @@ class PromptParent extends JSWindowActorParent {
}
/**
* Opens either a window prompt or TabDialogBox at the content or tab level
* for a BrowsingContext, and puts the associated browser in the modal state
* until the prompt is closed.
* Opens a window prompt for a BrowsingContext, and puts the associated
* browser in the modal state until the prompt is closed.
*
* @param {Object} args
* The arguments passed up from the BrowsingContext to be passed
* directly to the modal prompt.
* directly to the modal window.
* @return {Promise}
* Resolves when the modal prompt is dismissed.
* Resolves when the window prompt is dismissed.
* @resolves {Object}
* The arguments returned from the modal prompt.
* The arguments returned from the window prompt.
*/
async openPromptWithTabDialogBox(args) {
async openChromePrompt(args) {
const COMMON_DIALOG = "chrome://global/content/commonDialog.xhtml";
const SELECT_DIALOG = "chrome://global/content/selectDialog.xhtml";
let uri = args.promptType == "select" ? SELECT_DIALOG : COMMON_DIALOG;
@ -280,29 +271,15 @@ class PromptParent extends JSWindowActorParent {
let bag = PromptUtils.objectToPropBag(args);
if (
args.modalType === Services.prompt.MODAL_TYPE_TAB ||
args.modalType === Services.prompt.MODAL_TYPE_CONTENT
) {
if (args.modalType === Services.prompt.MODAL_TYPE_TAB) {
if (!browser) {
let modal_type =
args.modalType === Services.prompt.MODAL_TYPE_TAB
? "tab"
: "content";
throw new Error(`Cannot ${modal_type}-prompt without a browser!`);
throw new Error("Cannot tab-prompt without a browser!");
}
// Tab or content level prompt
// Tab
let dialogBox = win.gBrowser.getTabDialogBox(browser);
await dialogBox.open(
uri,
{
features: "resizable=no",
modalType: args.modalType,
},
bag
);
await dialogBox.open(uri, { features: "resizable=no" }, bag);
} else {
// Window prompt
// Window
Services.ww.openWindow(
win,
uri,

Просмотреть файл

@ -1353,14 +1353,6 @@ pref("browser.partnerlink.campaign.topsites", "amzn_2020_a1");
// TabModalPromptBox (false).
pref("prompts.tabChromePromptSubDialog", true);
// Whether to show the dialogs opened at the content level, such as
// alert() or prompt(), using a SubDialogManager in the TabDialogBox.
#ifdef EARLY_BETA_OR_EARLIER
pref("prompts.contentPromptSubDialog", true);
#else
pref("prompts.contentPromptSubDialog", false);
#endif
// Activates preloading of the new tab url.
pref("browser.newtab.preload", true);

Просмотреть файл

@ -1568,11 +1568,6 @@ toolbar[keyNav=true]:not([collapsed=true], [customizing=true]) toolbartabstop {
width: 66ch;
}
.content-prompt-dialog > .dialogOverlay {
display: grid;
place-content: center;
}
/**
* End Tab Dialogs
*/

Просмотреть файл

@ -8894,10 +8894,9 @@ const SafeBrowsingNotificationBox = {
};
/**
* The TabDialogBox supports opening window dialogs as SubDialogs on the tab and content
* level. Both tab and content dialogs have their own separate managers.
* The TabDialogBox supports opening window dialogs as SubDialogs on tab level.
* Dialogs will be queued FIFO and cover the web content.
* Dialogs are closed when the user reloads or leaves the page.
* Tab dialogs are closed when the user reloads or leaves the page.
* While a dialog is open PopupNotifications, such as permission prompts, are
* suppressed.
*/
@ -8905,11 +8904,9 @@ class TabDialogBox {
constructor(browser) {
this._weakBrowserRef = Cu.getWeakReference(browser);
// Create parent element for tab dialogs
// Create parent element for dialogs
let template = document.getElementById("dialogStackTemplate");
let dialogStack = template.content.cloneNode(true).firstElementChild;
dialogStack.classList.add("tab-prompt-dialog");
this.browser.parentNode.insertBefore(
dialogStack,
this.browser.nextElementSibling
@ -8918,8 +8915,7 @@ class TabDialogBox {
// Initially the stack only contains the template
let dialogTemplate = dialogStack.firstElementChild;
// Create dialog manager for prompts at the tab level.
this._tabDialogManager = new SubDialogManager({
this._dialogManager = new SubDialogManager({
dialogStack,
dialogTemplate,
orderType: SubDialogManager.ORDER_QUEUE,
@ -8931,7 +8927,7 @@ class TabDialogBox {
}
/**
* Open a dialog on tab or content level.
* Open a dialog on tab level.
* @param {String} aURL - URL of the dialog to load in the tab box.
* @param {Object} [aOptions]
* @param {String} [aOptions.features] - Comma separated list of window
@ -8944,8 +8940,6 @@ class TabDialogBox {
* @param {Boolean} [aOptions.keepOpenSameOriginNav] - By default dialogs are
* aborted on any navigation.
* Set to true to keep the dialog open for same origin navigation.
* @param {Number} [aOptions.modalType] - The modal type to create the dialog for.
* By default, we show the dialog for tab prompts.
* @returns {Promise} - Resolves once the dialog has been closed.
*/
open(
@ -8955,32 +8949,22 @@ class TabDialogBox {
allowDuplicateDialogs = true,
sizeTo,
keepOpenSameOriginNav,
modalType = null,
} = {},
...aParams
) {
return new Promise(resolve => {
// Get the dialog manager to open the prompt with.
let dialogManager =
modalType === Ci.nsIPrompt.MODAL_TYPE_CONTENT
? this.getContentDialogManager()
: this._tabDialogManager;
let hasDialogs =
this._tabDialogManager.hasDialogs ||
this._contentDialogManager?.hasDialogs;
if (!hasDialogs) {
if (!this._dialogManager.hasDialogs) {
this._onFirstDialogOpen();
}
let closingCallback = () => {
if (!hasDialogs) {
if (!this._dialogManager.hasDialogs) {
this._onLastDialogClose();
}
};
// Open dialog and resolve once it has been closed
let dialog = dialogManager.open(
let dialog = this._dialogManager.open(
aURL,
{
features,
@ -9025,29 +9009,6 @@ class TabDialogBox {
this.tab?.removeEventListener("TabClose", this);
}
_buildContentPromptDialog() {
let template = document.getElementById("dialogStackTemplate");
let contentDialogStack = template.content.cloneNode(true).firstElementChild;
contentDialogStack.classList.add("content-prompt-dialog");
// Create a dialog manager for content prompts.
let tabPromptDialog = this.browser.parentNode.querySelector(
".tab-prompt-dialog"
);
this.browser.parentNode.insertBefore(contentDialogStack, tabPromptDialog);
let contentDialogTemplate = contentDialogStack.firstElementChild;
this._contentDialogManager = new SubDialogManager({
dialogStack: contentDialogStack,
dialogTemplate: contentDialogTemplate,
orderType: SubDialogManager.ORDER_QUEUE,
allowDuplicateDialogs: true,
dialogOptions: {
consumeOutsideClicks: false,
},
});
}
handleEvent(event) {
if (event.type !== "TabClose") {
return;
@ -9056,17 +9017,11 @@ class TabDialogBox {
}
abortAllDialogs() {
this._tabDialogManager.abortDialogs();
this._contentDialogManager?.abortDialogs();
this._dialogManager.abortDialogs();
}
focus() {
// Prioritize focusing the dialog manager for tab prompts
if (this._tabDialogManager._dialogs.length) {
this._tabDialogManager.focusTopDialog();
return;
}
this._contentDialogManager?.focusTopDialog();
this._dialogManager.focusTopDialog();
}
/**
@ -9096,8 +9051,7 @@ class TabDialogBox {
this._lastPrincipal = this.browser.contentPrincipal;
this._tabDialogManager.abortDialogs(filterFn);
this._contentDialogManager?.abortDialogs(filterFn);
this._dialogManager.abortDialogs(filterFn);
}
get tab() {
@ -9112,15 +9066,8 @@ class TabDialogBox {
return browser;
}
getTabDialogManager() {
return this._tabDialogManager;
}
getContentDialogManager() {
if (!this._contentDialogManager) {
this._buildContentPromptDialog();
}
return this._contentDialogManager;
getManager() {
return this._dialogManager;
}
}

Просмотреть файл

@ -2,9 +2,8 @@
support-files =
subdialog.xhtml
[browser_tabdialogbox_content_prompts.js]
[browser_tabdialogbox_navigation.js]
[browser_tabdialogbox_tab_switch_focus.js]
[browser_subdialog_esc.js]
support-files =
loadDelayedReply.sjs
loadDelayedReply.sjs

Просмотреть файл

@ -30,7 +30,7 @@ add_task(async function test_subdialog_esc_does_not_cancel_load() {
keepOpenSameOriginNav: true,
});
let dialogs = dialogBox.getTabDialogManager()._dialogs;
let dialogs = dialogBox._dialogManager._dialogs;
is(dialogs.length, 1, "Dialog manager has a dialog.");
@ -68,7 +68,7 @@ add_task(async function test_subdialog_esc_on_dropdown_does_not_close_dialog() {
keepOpenSameOriginNav: true,
});
let dialogs = dialogBox.getTabDialogManager()._dialogs;
let dialogs = dialogBox._dialogManager._dialogs;
is(dialogs.length, 1, "Dialog manager has a dialog.");

Просмотреть файл

@ -1,44 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
const PROTON_PREF = "browser.proton.enabled";
const TEST_ROOT_CHROME = getRootDirectory(gTestPath);
const TEST_DIALOG_PATH = TEST_ROOT_CHROME + "subdialog.xhtml";
/**
* Test that a manager for content prompts is added to tab dialog box.
*/
add_task(async function test_tabdialog_content_prompts() {
await BrowserTestUtils.withNewTab("http://example.com", async function(
browser
) {
await SpecialPowers.pushPrefEnv({
set: [[PROTON_PREF, true]],
});
info("Open a tab prompt.");
let dialogBox = gBrowser.getTabDialogBox(browser);
dialogBox.open(TEST_DIALOG_PATH);
info("Check the content prompt dialog is only created when needed.");
let contentPromptDialog = document.querySelector(".content-prompt-dialog");
ok(!contentPromptDialog, "Content prompt dialog should not be created.");
info("Open a content prompt");
dialogBox.open(TEST_DIALOG_PATH, {
modalType: Ci.nsIPrompt.MODAL_TYPE_CONTENT,
});
contentPromptDialog = document.querySelector(".content-prompt-dialog");
ok(contentPromptDialog, "Content prompt dialog should be created.");
let contentPromptManager = dialogBox.getContentDialogManager();
is(
contentPromptManager._dialogs.length,
1,
"Content prompt manager should have 1 dialog box."
);
});
});

Просмотреть файл

@ -20,7 +20,7 @@ add_task(async function test_tabdialogbox_multiple_close_on_nav() {
dialogBox.open(TEST_DIALOG_PATH),
];
let dialogs = dialogBox.getTabDialogManager()._dialogs;
let dialogs = dialogBox._dialogManager._dialogs;
is(dialogs.length, 2, "Dialog manager has two dialogs.");
@ -48,10 +48,10 @@ add_task(async function test_tabdialogbox_close_on_content_nav() {
let dialogBox = gBrowser.getTabDialogBox(browser);
let closedPromise = dialogBox.open(TEST_DIALOG_PATH);
let dialog = dialogBox.getTabDialogManager()._topDialog;
let dialog = dialogBox._dialogManager._topDialog;
is(
dialogBox.getTabDialogManager()._dialogs.length,
dialogBox._dialogManager._dialogs.length,
1,
"Dialog manager has one dialog."
);
@ -116,16 +116,16 @@ add_task(async function test_tabdialogbox_hide() {
) {
// Open a dialog and wait for it to be ready
let dialogBox = gBrowser.getTabDialogBox(browser);
let dialogBoxManager = dialogBox.getTabDialogManager();
let dialogBoxManager = dialogBox.getManager();
let closedPromises = [
dialogBox.open(TEST_DIALOG_PATH),
dialogBox.open(TEST_DIALOG_PATH),
];
let dialogs = dialogBox.getTabDialogManager()._dialogs;
let dialogs = dialogBox._dialogManager._dialogs;
is(
dialogBox.getTabDialogManager()._dialogs.length,
dialogBox._dialogManager._dialogs.length,
2,
"Dialog manager has two dialogs."
);

Просмотреть файл

@ -30,7 +30,7 @@ add_task(async function test_tabdialogbox_tab_switch_focus() {
for (let i = 0; i < 2; i += 1) {
let dialogBox = gBrowser.getTabDialogBox(tabs[i].linkedBrowser);
dialogBox.open(TEST_DIALOG_PATH);
dialogs.push(dialogBox.getTabDialogManager()._topDialog);
dialogs.push(dialogBox._dialogManager._topDialog);
}
// Wait for dialogs to be ready
@ -100,7 +100,7 @@ add_task(async function test_tabdialogbox_tab_switch_hidden() {
dialogBox = gBrowser.getTabDialogBox(tabs[i].linkedBrowser);
browser = tabs[i].linkedBrowser;
dialogBox.open(TEST_DIALOG_PATH);
dialogBoxManager = dialogBox.getTabDialogManager();
dialogBoxManager = dialogBox.getManager();
dialogs.push(dialogBoxManager._topDialog);
}
@ -121,7 +121,7 @@ add_task(async function test_tabdialogbox_tab_switch_hidden() {
// Check the dialog stack is showing in first tab
dialogBoxManager = gBrowser
.getTabDialogBox(tabs[0].linkedBrowser)
.getTabDialogManager();
.getManager();
is(dialogBoxManager._dialogStack.hidden, false, "Dialog stack is showing");
// Cleanup

Просмотреть файл

@ -70,9 +70,8 @@ modal.findModalDialogs = function(context) {
// This is for prompts that are shown in SubDialogs in the browser chrome.
if (context.tab && context.tabBrowser.getTabDialogBox) {
let contentBrowser = context.contentBrowser;
let dialogManager = context.tabBrowser
.getTabDialogBox(contentBrowser)
.getTabDialogManager();
let dialogManager = context.tabBrowser.getTabDialogBox(contentBrowser)
._dialogManager;
let dialogs = dialogManager._dialogs.filter(
dialog => dialog._openedURL === COMMON_DIALOG
);

Просмотреть файл

@ -150,7 +150,7 @@ add_task(async function test_protocolHandler() {
let window = await windowOpen;
let gBrowser = window.gBrowser
let tabDialogBox = gBrowser.getTabDialogBox(gBrowser.selectedBrowser);
let dialogStack = tabDialogBox.getTabDialogManager()._dialogStack;
let dialogStack = tabDialogBox._dialogManager._dialogStack;
let checkFn = dialogEvent =>
dialogEvent.detail.dialog?._openedURL == CONTENT_HANDLING_URL;

Просмотреть файл

@ -278,7 +278,7 @@ var PrintEventHandler = {
let sourceBrowser = this.getSourceBrowsingContext().top.embedderElement;
let dialogBoxManager = gBrowser
.getTabDialogBox(sourceBrowser)
.getTabDialogManager();
.getManager();
dialogBoxManager.hideDialog(sourceBrowser);
// Use our settings to prepopulate the system dialog.

Просмотреть файл

@ -118,7 +118,7 @@ var PrintUtils = {
getPreviewBrowser(sourceBrowser) {
let dialogBox = gBrowser.getTabDialogBox(sourceBrowser);
for (let dialog of dialogBox.getTabDialogManager()._dialogs) {
for (let dialog of dialogBox._dialogManager._dialogs) {
let browser = dialog._box.querySelector(".printPreviewBrowser");
if (browser) {
return browser;

Просмотреть файл

@ -175,8 +175,9 @@ add_task(async function test_focused_browsing_context() {
() =>
gBrowser
.getTabDialogBox(newTabBrowser)
.getTabDialogManager()
._dialogs.find(dlg => dlg._box.querySelector(".printSettingsBrowser")),
._dialogManager._dialogs.find(dlg =>
dlg._box.querySelector(".printSettingsBrowser")
),
"Wait for dialog"
);
await dialog._dialogReady;

Просмотреть файл

@ -277,11 +277,11 @@ class PrintHelper {
}
get _tabDialogBoxManager() {
return this._tabDialogBox.getTabDialogManager();
return this._tabDialogBox.getManager();
}
get _dialogs() {
return this._tabDialogBox.getTabDialogManager()._dialogs;
return this._tabDialogBox._dialogManager._dialogs;
}
get dialog() {

Просмотреть файл

@ -161,9 +161,9 @@ add_task(async function test_multiple_dialogs() {
// Check we only have one dialog
let tabDialogBox = gBrowser.getTabDialogBox(tab.linkedBrowser);
let dialogs = tabDialogBox
.getTabDialogManager()
._dialogs.filter(d => d._openedURL == CONTENT_HANDLING_URL);
let dialogs = tabDialogBox._dialogManager._dialogs.filter(
d => d._openedURL == CONTENT_HANDLING_URL
);
is(dialogs.length, 1, "Should only have 1 dialog open");

Просмотреть файл

@ -129,7 +129,7 @@ async function waitForSubDialog(browser, url, state) {
let eventStr = state ? "dialogopen" : "dialogclose";
let tabDialogBox = gBrowser.getTabDialogBox(browser);
let dialogStack = tabDialogBox.getTabDialogManager()._dialogStack;
let dialogStack = tabDialogBox._dialogManager._dialogStack;
let checkFn;