зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 0fccc6a4922d (bug 1686743) for remote failures on browser_javascriptDialog_* CLOSED TREE
This commit is contained in:
Родитель
9e236c5b86
Коммит
c4608fba0e
|
@ -30,4 +30,8 @@ const RecommendedPreferences = new Map([
|
|||
"-tp,tpPrivate,cookieBehavior0,-cm,-fp",
|
||||
],
|
||||
["network.cookie.cookieBehavior", 0],
|
||||
|
||||
// Only allow the old modal dialogs. This should be removed when there is
|
||||
// support for the new modal UI (see Bug 1686743).
|
||||
["prompts.contentPromptSubDialog", false],
|
||||
]);
|
||||
|
|
|
@ -15,13 +15,6 @@ XPCOMUtils.defineLazyModuleGetters(this, {
|
|||
Services: "resource://gre/modules/Services.jsm",
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyPreferenceGetter(
|
||||
this,
|
||||
"contentPromptSubDialog",
|
||||
"prompts.contentPromptSubDialog",
|
||||
false
|
||||
);
|
||||
|
||||
const DIALOG_TYPES = {
|
||||
ALERT: "alert",
|
||||
BEFOREUNLOAD: "beforeunload",
|
||||
|
@ -45,13 +38,8 @@ class DialogHandler {
|
|||
this._dialog = null;
|
||||
this._browser = browser;
|
||||
|
||||
this._onCommonDialogLoaded = this._onCommonDialogLoaded.bind(this);
|
||||
this._onTabDialogLoaded = this._onTabDialogLoaded.bind(this);
|
||||
|
||||
Services.obs.addObserver(
|
||||
this._onCommonDialogLoaded,
|
||||
"common-dialog-loaded"
|
||||
);
|
||||
Services.obs.addObserver(this._onTabDialogLoaded, "tabmodal-dialog-loaded");
|
||||
}
|
||||
|
||||
|
@ -59,10 +47,6 @@ class DialogHandler {
|
|||
this._dialog = null;
|
||||
this._pageTarget = null;
|
||||
|
||||
Services.obs.removeObserver(
|
||||
this._onCommonDialogLoaded,
|
||||
"common-dialog-loaded"
|
||||
);
|
||||
Services.obs.removeObserver(
|
||||
this._onTabDialogLoaded,
|
||||
"tabmodal-dialog-loaded"
|
||||
|
@ -87,13 +71,7 @@ class DialogHandler {
|
|||
|
||||
// 0 corresponds to the OK callback, 1 to the CANCEL callback.
|
||||
if (accept) {
|
||||
if (contentPromptSubDialog) {
|
||||
this._dialog.ui.button0.click();
|
||||
} else {
|
||||
this._dialog.onButtonClick(0);
|
||||
}
|
||||
} else if (contentPromptSubDialog) {
|
||||
this._dialog.ui.button1.click();
|
||||
this._dialog.onButtonClick(0);
|
||||
} else {
|
||||
this._dialog.onButtonClick(1);
|
||||
}
|
||||
|
@ -125,23 +103,6 @@ class DialogHandler {
|
|||
}
|
||||
}
|
||||
|
||||
_onCommonDialogLoaded(dialogWindow) {
|
||||
const dialogs = this._browser.tabDialogBox.getContentDialogManager()
|
||||
.dialogs;
|
||||
const dialog = dialogs.find(d => d.frameContentWindow === dialogWindow);
|
||||
|
||||
if (!dialog) {
|
||||
// The dialog is not for the current tab.
|
||||
return;
|
||||
}
|
||||
|
||||
this._dialog = dialogWindow.Dialog;
|
||||
const message = this._dialog.args.text;
|
||||
const type = this._getDialogType();
|
||||
|
||||
this.emit("dialog-loaded", { message, type });
|
||||
}
|
||||
|
||||
_onTabDialogLoaded(promptContainer) {
|
||||
const prompts = this._browser.tabModalPromptBox.listPrompts();
|
||||
const prompt = prompts.find(p => p.ui.promptContainer === promptContainer);
|
||||
|
|
|
@ -25,25 +25,13 @@ add_task(async function({ client }) {
|
|||
|
||||
// Create a promise that resolve when dialog prompt is created.
|
||||
// It will also take care of closing the dialog.
|
||||
let onOtherPageDialog;
|
||||
|
||||
if (Services.prefs.getBoolPref("prompts.contentPromptSubDialog", false)) {
|
||||
onOtherPageDialog = new Promise(r => {
|
||||
Services.obs.addObserver(function onDialogLoaded(promptWindow) {
|
||||
Services.obs.removeObserver(onDialogLoaded, "common-dialog-loaded");
|
||||
promptWindow.Dialog.ui.button0.click();
|
||||
r();
|
||||
}, "common-dialog-loaded");
|
||||
});
|
||||
} else {
|
||||
onOtherPageDialog = new Promise(r => {
|
||||
Services.obs.addObserver(function onDialogLoaded(promptContainer) {
|
||||
Services.obs.removeObserver(onDialogLoaded, "tabmodal-dialog-loaded");
|
||||
promptContainer.querySelector(".tabmodalprompt-button0").click();
|
||||
r();
|
||||
}, "tabmodal-dialog-loaded");
|
||||
});
|
||||
}
|
||||
const onOtherPageDialog = new Promise(r => {
|
||||
Services.obs.addObserver(function onDialogLoaded(promptContainer) {
|
||||
Services.obs.removeObserver(onDialogLoaded, "tabmodal-dialog-loaded");
|
||||
promptContainer.querySelector(".tabmodalprompt-button0").click();
|
||||
r();
|
||||
}, "tabmodal-dialog-loaded");
|
||||
});
|
||||
|
||||
info("Trigger an alert in the second page");
|
||||
SpecialPowers.spawn(gBrowser.selectedBrowser, [], () => {
|
||||
|
|
|
@ -80,10 +80,6 @@ SubDialog.prototype = {
|
|||
_titleElement: null,
|
||||
_closeButton: null,
|
||||
|
||||
get frameContentWindow() {
|
||||
return this._frame?.contentWindow;
|
||||
},
|
||||
|
||||
get _window() {
|
||||
return this._overlay?.ownerGlobal;
|
||||
},
|
||||
|
@ -991,10 +987,6 @@ class SubDialogManager {
|
|||
return this._dialogs.some(dialog => !dialog._isClosing);
|
||||
}
|
||||
|
||||
get dialogs() {
|
||||
return [...this._dialogs];
|
||||
}
|
||||
|
||||
focusTopDialog() {
|
||||
this._topDialog?.focus();
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче