1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/toolkit/components/prompts/test/test_bug861605.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,69 @@ 1.4 +<html> 1.5 +<head> 1.6 + <title>Test for Bug 861605</title> 1.7 + <script type="text/javascript" src="/MochiKit/MochiKit.js"></script> 1.8 + <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> 1.9 + <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script> 1.10 + <script type="text/javascript" src="prompt_common.js"></script> 1.11 + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> 1.12 +</head> 1.13 +<body onload="runtest()"> 1.14 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=861605">Mozilla Bug 861605</a> 1.15 +<pre id="test"> 1.16 +</pre> 1.17 + 1.18 +<script class="testbody" type="text/javascript"> 1.19 +SimpleTest.waitForExplicitFinish(); 1.20 + 1.21 +var selectionTest = false; 1.22 +var testNum = 0; 1.23 + 1.24 +function hasTabModalPrompts() { 1.25 + var prefName = "prompts.tab_modal.enabled"; 1.26 + var Services = SpecialPowers.Cu 1.27 + .import("resource://gre/modules/Services.jsm") 1.28 + .Services; 1.29 + return Services.prefs.getPrefType(prefName) == Services.prefs.PREF_BOOL && 1.30 + Services.prefs.getBoolPref(prefName); 1.31 +} 1.32 + 1.33 +function runtest() 1.34 +{ 1.35 + isTabModal = hasTabModalPrompts(); 1.36 + if (!isTabModal) { 1.37 + todo(false, "Test is run with tab modal prompts disabled."); 1.38 + SimpleTest.finish(); 1.39 + return; 1.40 + } 1.41 + 1.42 + ok(true, "Test is run with tab modal prompts enabled."); 1.43 + 1.44 + startCallbackTimer(); 1.45 + 1.46 + try { 1.47 + alert(); 1.48 + ok(true, "alert() without arguments should not throw!"); 1.49 + } catch(e) { 1.50 + ok(false, "alert() without arguments should not throw!"); 1.51 + } 1.52 + 1.53 + startCallbackTimer(); 1.54 + 1.55 + try { 1.56 + confirm(); 1.57 + ok(true, "confirm() without arguments should not throw!"); 1.58 + } catch(e) { 1.59 + ok(false, "confirm() without arguments should not throw!"); 1.60 + } 1.61 + 1.62 + SimpleTest.finish(); 1.63 +} 1.64 + 1.65 +function handleDialog(ui, testNum) 1.66 +{ 1.67 + synthesizeMouse(ui.button0, 5, 5, { }, SpecialPowers.unwrap(ui.button0.ownerDocument.defaultView)); 1.68 +} 1.69 +</script> 1.70 + 1.71 +</body> 1.72 +</html>