toolkit/components/prompts/test/test_bug861605.html

Fri, 16 Jan 2015 18:13:44 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 16 Jan 2015 18:13:44 +0100
branch
TOR_BUG_9701
changeset 14
925c144e1f1f
permissions
-rw-r--r--

Integrate suggestion from review to improve consistency with existing code.

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

mercurial