зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset ca41e6b53c94 (bug 1639218) for mochitest failures at toolkit/components/prompts/test/test_bug619644.html on a CLOSED TREE
This commit is contained in:
Родитель
6e49dfa042
Коммит
edd1803ffc
|
@ -20,6 +20,14 @@
|
|||
src="../browser.js"></script>
|
||||
|
||||
<script type="application/javascript">
|
||||
function hasTabModalPrompts() {
|
||||
try {
|
||||
return SpecialPowers.getBoolPref("prompts.tab_modal.enabled");
|
||||
} catch (ex) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function showAlert() {
|
||||
this.eventSeq = [
|
||||
{
|
||||
|
@ -85,8 +93,12 @@
|
|||
gQueue.invoke(); // will call SimpleTest.finish()
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
openBrowserWindow(doTests);
|
||||
if (!hasTabModalPrompts()) {
|
||||
todo(false, "Test disabled when tab modal prompts are not enabled.");
|
||||
} else {
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
openBrowserWindow(doTests);
|
||||
}
|
||||
</script>
|
||||
|
||||
</head>
|
||||
|
|
|
@ -1357,6 +1357,9 @@ pref("services.sync.syncedTabs.showRemoteIcons", true);
|
|||
// preference is a string so that localizers can alter it.
|
||||
pref("browser.menu.showCharacterEncoding", "chrome://browser/locale/browser.properties");
|
||||
|
||||
// Allow using tab-modal prompts when possible.
|
||||
pref("prompts.tab_modal.enabled", true);
|
||||
|
||||
// Whether prompts should be content modal (1) tab modal (2) or window modal(3) by default
|
||||
// This is a fallback value for when prompt callers do not specify a modalType.
|
||||
pref("prompts.defaultModalType", 3);
|
||||
|
|
|
@ -34,6 +34,12 @@ class BaseAlertTestCase(WindowManagerMixin, MarionetteTestCase):
|
|||
class TestTabModalAlerts(BaseAlertTestCase):
|
||||
def setUp(self):
|
||||
super(TestTabModalAlerts, self).setUp()
|
||||
self.assertTrue(
|
||||
self.marionette.get_pref(
|
||||
"prompts.tab_modal.enabled",
|
||||
"Tab modal alerts should be enabled by default.",
|
||||
)
|
||||
)
|
||||
|
||||
self.test_page = self.marionette.absolute_url("test_tab_modal_dialogs.html")
|
||||
self.marionette.navigate(self.test_page)
|
||||
|
|
|
@ -33,9 +33,12 @@ const LOGIN_FIELD_UTILS = LoginTestUtils.loginField;
|
|||
const TESTS_DIR = "/tests/toolkit/components/passwordmgr/test/";
|
||||
|
||||
// Depending on pref state we either show auth prompts as windows or on tab level.
|
||||
let authPromptModalType = SpecialPowers.Services.prefs.getIntPref(
|
||||
"prompts.modalType.httpAuth"
|
||||
);
|
||||
let authPromptModalType = SpecialPowers.Services.prompt.MODAL_TYPE_WINDOW;
|
||||
if (SpecialPowers.Services.prefs.getBoolPref("prompts.tab_modal.enabled")) {
|
||||
authPromptModalType = SpecialPowers.Services.prefs.getIntPref(
|
||||
"prompts.modalType.httpAuth"
|
||||
);
|
||||
}
|
||||
|
||||
// Whether the auth prompt is a commonDialog.xhtml or a TabModalPrompt
|
||||
let authPromptIsCommonDialog =
|
||||
|
|
|
@ -90,6 +90,6 @@ content and is **not** intended to look like secure browser UI.
|
|||
|
||||
Disabling tab/content modal prompts
|
||||
-----------------------------------
|
||||
You can disable tab and content modal prompts and get back window-modal for
|
||||
individual prompts by setting the `prompts.modalType.<promptName>` preference to
|
||||
`3`.
|
||||
You can disable tab and content modal prompts and get back window-modal prompts
|
||||
by setting the `prompts.tab_modal.enabled` preference to `false`.
|
||||
This pref might be removed in the future.
|
|
@ -1042,7 +1042,11 @@ class ModalPrompter {
|
|||
|
||||
// We can't use content / tab prompts if they are disabled by pref,
|
||||
// or we are not given a parent.
|
||||
if (!this.browsingContext || !this.browsingContext.isContent) {
|
||||
if (
|
||||
!ModalPrompter.tabModalEnabled ||
|
||||
!this.browsingContext ||
|
||||
!this.browsingContext.isContent
|
||||
) {
|
||||
modalType = Ci.nsIPrompt.MODAL_TYPE_WINDOW;
|
||||
|
||||
Cu.reportError(
|
||||
|
@ -1713,6 +1717,13 @@ XPCOMUtils.defineLazyPreferenceGetter(
|
|||
Ci.nsIPrompt.MODAL_TYPE_WINDOW
|
||||
);
|
||||
|
||||
XPCOMUtils.defineLazyPreferenceGetter(
|
||||
ModalPrompter,
|
||||
"tabModalEnabled",
|
||||
"prompts.tab_modal.enabled",
|
||||
true
|
||||
);
|
||||
|
||||
function AuthPromptAdapterFactory() {}
|
||||
AuthPromptAdapterFactory.prototype = {
|
||||
classID: Components.ID("{6e134924-6c3a-4d86-81ac-69432dd971dc}"),
|
||||
|
|
|
@ -4,6 +4,16 @@ const { propBagToObject } = ChromeUtils.import(
|
|||
"resource://gre/modules/BrowserUtils.jsm"
|
||||
).BrowserUtils;
|
||||
|
||||
function hasTabModalPrompts() {
|
||||
var prefName = "prompts.tab_modal.enabled";
|
||||
const Services = SpecialPowers.Services;
|
||||
return (
|
||||
Services.prefs.getPrefType(prefName) == Services.prefs.PREF_BOOL &&
|
||||
Services.prefs.getBoolPref(prefName)
|
||||
);
|
||||
}
|
||||
var tabModalPromptEnabled = hasTabModalPrompts();
|
||||
|
||||
var modalType;
|
||||
var tabSubDialogsEnabled = SpecialPowers.Services.prefs.getBoolPref(
|
||||
"prompts.tabChromePromptSubDialog",
|
||||
|
@ -35,11 +45,12 @@ async function runPromptCombinations(window, testFunc) {
|
|||
util.useAsync = false;
|
||||
await run();
|
||||
|
||||
let modalTypes = [
|
||||
Ci.nsIPrompt.MODAL_TYPE_WINDOW,
|
||||
Ci.nsIPrompt.MODAL_TYPE_TAB,
|
||||
Ci.nsIPrompt.MODAL_TYPE_CONTENT,
|
||||
];
|
||||
let modalTypes = [Ci.nsIPrompt.MODAL_TYPE_WINDOW];
|
||||
// if tab/content prompts are disabled by pref, only test window prompts
|
||||
if (SpecialPowers.getBoolPref("prompts.tab_modal.enabled")) {
|
||||
modalTypes.push(Ci.nsIPrompt.MODAL_TYPE_TAB);
|
||||
modalTypes.push(Ci.nsIPrompt.MODAL_TYPE_CONTENT);
|
||||
}
|
||||
|
||||
for (let type of modalTypes) {
|
||||
util.modalType = type;
|
||||
|
|
|
@ -20,7 +20,11 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=619644
|
|||
const expectedFinalDoc =
|
||||
"<head><\/head><body><p>Original content<\/p>\n<script>\n window.opener.postMessage(\"\", \"*\");\n confirm(\"Message\");\n document.write(\"Extra content\");\n window.opener.postMessage(document.documentElement.innerHTML, \"*\");\n<\/script>Extra content<\/body>";
|
||||
|
||||
inittest();
|
||||
if (!tabModalPromptEnabled) {
|
||||
todo(false, "Test disabled when tab modal prompts are not enabled.");
|
||||
} else {
|
||||
inittest();
|
||||
}
|
||||
|
||||
var promptDone;
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
<button id="button" onmouseup="openAlert()">Button</button>
|
||||
|
||||
<script class="testbody" type="text/javascript">
|
||||
var selectionTest = false;
|
||||
|
||||
function openAlert() {
|
||||
info("opening alert...");
|
||||
|
@ -34,6 +35,8 @@ add_task(async function runTest() {
|
|||
var state, action;
|
||||
// The <button> in this test's HTML opens a prompt when clicked.
|
||||
// Here we send the events to simulate clicking it.
|
||||
info("tabModalPromptEnabled? " + tabModalPromptEnabled);
|
||||
selectionTest = tabModalPromptEnabled;
|
||||
modalType = Ci.nsIPrompt.MODAL_TYPE_CONTENT;
|
||||
|
||||
state = {
|
||||
|
@ -87,8 +90,12 @@ function dispatchMouseEvent(target, type) {
|
|||
}
|
||||
|
||||
function checkSelection() {
|
||||
synthesizeMouse($("text"), 25, 55, { type: "mousemove" });
|
||||
is(window.getSelection().toString(), "", "selection not made");
|
||||
if (!selectionTest) {
|
||||
todo(false, "Selection test is disabled when tab modal prompts are not enabled.");
|
||||
} else {
|
||||
synthesizeMouse($("text"), 25, 55, { type: "mousemove" });
|
||||
is(window.getSelection().toString(), "", "selection not made");
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
|
@ -34,11 +34,21 @@ 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"
|
||||
);
|
||||
let authPromptModalType = SpecialPowers.Services.prompt.MODAL_TYPE_WINDOW;
|
||||
if (SpecialPowers.Services.prefs.getBoolPref("prompts.tab_modal.enabled")) {
|
||||
authPromptModalType = SpecialPowers.Services.prefs.getIntPref(
|
||||
"prompts.modalType.httpAuth"
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
add_task(async function runTest() {
|
||||
// This test depends on tab modal prompts being enabled.
|
||||
if (!tabModalPromptEnabled) {
|
||||
todo(false, "Test disabled when tab modal prompts are not enabled.");
|
||||
return;
|
||||
}
|
||||
|
||||
modalType = Ci.nsIPrompt.MODAL_TYPE_CONTENT;
|
||||
|
||||
info("Ensuring iframe1 has loaded...");
|
||||
|
|
Загрузка…
Ссылка в новой задаче