Bug 626294 - [SeaMonkey] permanent "TEST-UNEXPECTED-FAIL | .../test_bug620145.html | got tabmodal promptbox"; (Av1) Fix bug 625038 nit, Fix bug 620145 case and bug 615186 case.
authorSerge Gautherie <sgautherie.bz@free.fr>
Mon, 17 Jan 2011 19:32:47 +0100
changeset 60709 dce56b3d284bd531bd1b9a61d5011f3c71f02336
parent 60708 a66254dfa588baa0a4223301c93add90be411f69
child 60710 ea0d32edf11b2d9ff2d0ba4e71964d8466fb73d3
push idunknown
push userunknown
push dateunknown
bugs626294, 620145, 625038, 615186
milestone2.0b10pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 626294 - [SeaMonkey] permanent "TEST-UNEXPECTED-FAIL | .../test_bug620145.html | got tabmodal promptbox"; (Av1) Fix bug 625038 nit, Fix bug 620145 case and bug 615186 case. r=Olli.Pettay a=(test only).
toolkit/components/prompts/test/test_bug619644.html
toolkit/components/prompts/test/test_bug620145.html
--- a/toolkit/components/prompts/test/test_bug619644.html
+++ b/toolkit/components/prompts/test/test_bug619644.html
@@ -10,17 +10,17 @@ https://bugzilla.mozilla.org/show_bug.cg
   <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
 </head>
 <body>
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=619644">Mozilla Bug 619644</a>
 <pre id="test">
 <script class="testbody" type="text/javascript">
 function hasTabModalPrompts() {
-  prefName = "prompts.tab_modal.enabled";
+  var prefName = "prompts.tab_modal.enabled";
   netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
   Components.utils.import("resource://gre/modules/Services.jsm");
   return Services.prefs.getPrefType(prefName) == Services.prefs.PREF_BOOL &&
          Services.prefs.getBoolPref(prefName);
 }
 
 if (!hasTabModalPrompts()) {
   todo(false, "Test disabled when tab modal prompts are not enabled.");
--- a/toolkit/components/prompts/test/test_bug620145.html
+++ b/toolkit/components/prompts/test/test_bug620145.html
@@ -25,36 +25,48 @@
 <script class="testbody" type="text/javascript">
 SimpleTest.waitForExplicitFinish();
 
 var selectionTest = false;
 var testNum = 0;
 var utils = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
               getInterface(Components.interfaces.nsIDOMWindowUtils);
 
+function hasTabModalPrompts() {
+  var prefName = "prompts.tab_modal.enabled";
+  netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+  Components.utils.import("resource://gre/modules/Services.jsm");
+  return Services.prefs.getPrefType(prefName) == Services.prefs.PREF_BOOL &&
+         Services.prefs.getBoolPref(prefName);
+}
+
 function openAlert() {
   ok(true, "opening alert...");
   alert("hello!");
   ok(true, "...alert done.");
 }
 
 function runtest()
 {
   // The <button> in this test's HTML opens a prompt when clicked.
   // Here we send the events to simulate clicking it.
   netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
   ok(true, "starting test");
-  isTabModal = true;
+  isTabModal = hasTabModalPrompts();
+  if (!isTabModal)
+    todo(false, "Test is run with tab modal prompts disabled.");
+  else
+    ok(true, "Test is run with tab modal prompts enabled.");
   startCallbackTimer();
 
   var button = $("button");
   dispatchMouseEvent(button, "mousedown");
   dispatchMouseEvent(button, "mouseup");
 
-  selectionTest = true;
+  selectionTest = isTabModal;
 
   startCallbackTimer();
 
   var text = $("text");
   dispatchMouseEvent(text, "mousedown");
   dispatchMouseEvent(text, "mouseup");
 
   SimpleTest.finish();
@@ -66,17 +78,19 @@ function dispatchMouseEvent(target, type
   e.initEvent(type, false, false, window, 0, 1, 1, 1, 1,
               false, false, false, false, 0, null);
   utils.dispatchDOMEventViaPresShell(target, e, true);
   ok(true, type + " sent to " + target.id);
 }
 
 function handleDialog(ui, testNum)
 {
-  if (selectionTest) {
+  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");
     synthesizeMouse(ui.button0, 5, 5, { }, ui.button0.ownerDocument.defaultView);
   }
 
   ok(true, "handleDialog sending mouseclick to dialog...");
   synthesizeMouse(ui.button0, 5, 5, { }, ui.button0.ownerDocument.defaultView);
 }