toolkit/components/prompts/test/test_bug861605.html

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 <html>
     2 <head>
     3   <title>Test for Bug 861605</title>
     4   <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
     5   <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
     6   <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
     7   <script type="text/javascript" src="prompt_common.js"></script>
     8   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
     9 </head>
    10 <body onload="runtest()">
    11 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=861605">Mozilla Bug 861605</a>
    12 <pre id="test">
    13 </pre>
    15 <script class="testbody" type="text/javascript">
    16 SimpleTest.waitForExplicitFinish();
    18 var selectionTest = false;
    19 var testNum = 0;
    21 function hasTabModalPrompts() {
    22   var prefName = "prompts.tab_modal.enabled";
    23   var Services = SpecialPowers.Cu
    24                               .import("resource://gre/modules/Services.jsm")
    25                               .Services;
    26   return Services.prefs.getPrefType(prefName) == Services.prefs.PREF_BOOL &&
    27          Services.prefs.getBoolPref(prefName);
    28 }
    30 function runtest()
    31 {
    32   isTabModal = hasTabModalPrompts();
    33   if (!isTabModal) {
    34     todo(false, "Test is run with tab modal prompts disabled.");
    35     SimpleTest.finish();
    36     return;
    37   }
    39   ok(true, "Test is run with tab modal prompts enabled.");
    41   startCallbackTimer();
    43   try {
    44     alert();
    45     ok(true, "alert() without arguments should not throw!");
    46   } catch(e) {
    47     ok(false, "alert() without arguments should not throw!");
    48   }
    50   startCallbackTimer();
    52   try {
    53     confirm();
    54     ok(true, "confirm() without arguments should not throw!");
    55   } catch(e) {
    56     ok(false, "confirm() without arguments should not throw!");
    57   }
    59   SimpleTest.finish();
    60 }
    62 function handleDialog(ui, testNum)
    63 {
    64   synthesizeMouse(ui.button0, 5, 5, { }, SpecialPowers.unwrap(ui.button0.ownerDocument.defaultView));
    65 }
    66 </script>
    68 </body>
    69 </html>

mercurial