4 https://bugzilla.mozilla.org/show_bug.cgi?id=940783
8 <title>Test for Bug
940783</title>
9 <script src=
"/tests/SimpleTest/SimpleTest.js"></script>
10 <link rel=
"stylesheet" type=
"text/css" href=
"/tests/SimpleTest/test.css"/>
11 <script type=
"application/javascript">
13 /** Test for Bug
940783 **/
14 SimpleTest.waitForExplicitFinish();
16 function checkHistoryThrows(hist) {
17 checkThrows(function() { hist.length; });
18 checkThrows(function() { hist.state; });
19 checkThrows(function() { hist.go(); });
20 checkThrows(function() { hist.back(); });
21 checkThrows(function() { hist.forward(); });
22 checkThrows(function() { hist.pushState({},
"foo"); });
23 checkThrows(function() { hist.replaceState({},
"foo"); });
29 var iwin = $('ifr').contentWindow;
32 window.gHist = iwin.history;
33 iwin.location =
"file_empty.html";
34 } else if (gLoads ==
2) {
35 checkHistoryThrows(gHist);
36 window.gHist = iwin.history;
37 iwin.location =
"http://example.org/tests/js/xpconnect/tests/mochitest/file_empty.html";
39 checkHistoryThrows(gHist);
40 $('ifr').setAttribute('onload', null);
45 function checkThrows(fn) {
46 try { fn(); ok(false,
"Should have thrown: " + fn.toSource()); }
47 catch (e) { ok(!!/denied|insecure/.exec(e),
"Threw correctly: " + e); }
53 <a target=
"_blank" href=
"https://bugzilla.mozilla.org/show_bug.cgi?id=940783">Mozilla Bug
940783</a>
55 <div id=
"content" style=
"display: none">
56 <iframe id=
"ifr" onload=
"load();" src=
"file_empty.html"></iframe>