|
1 <!DOCTYPE HTML> |
|
2 <html> |
|
3 <!-- |
|
4 https://bugzilla.mozilla.org/show_bug.cgi?id=634834 |
|
5 --> |
|
6 <head> |
|
7 <title>Test for Bug 634834</title> |
|
8 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
|
9 <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script> |
|
10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> |
|
11 </head> |
|
12 <body> |
|
13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=634834">Mozilla Bug 634834</a> |
|
14 |
|
15 <script type='application/javascript;version=1.7'> |
|
16 SimpleTest.waitForExplicitFinish(); |
|
17 |
|
18 function iframe_loaded() { |
|
19 var loadedAfterPushstate = false; |
|
20 $('iframe').onload = function() { |
|
21 loadedAfterPushstate = true; |
|
22 } |
|
23 |
|
24 var obj = { name: 'name' }; |
|
25 obj.__defineGetter__('a', function() { |
|
26 $('iframe').contentWindow.location = 'http://example.com'; |
|
27 |
|
28 // Wait until we've loaded example.com. |
|
29 do { |
|
30 var r = new XMLHttpRequest(); |
|
31 r.open("GET", location.href, false); |
|
32 r.overrideMimeType("text/plain"); |
|
33 try { r.send(null); } |
|
34 catch (e) {} |
|
35 } while (!loadedAfterPushstate); |
|
36 }); |
|
37 |
|
38 try { |
|
39 $('iframe').contentWindow.history.pushState(obj, ''); |
|
40 ok(false, 'pushState should throw exception.'); |
|
41 } |
|
42 catch(e) { |
|
43 ok(true, 'pushState threw an exception.'); |
|
44 } |
|
45 SimpleTest.finish(); |
|
46 } |
|
47 |
|
48 </script> |
|
49 |
|
50 <iframe id='iframe' src='file_bug634834.html' onload='iframe_loaded()'></iframe> |
|
51 |
|
52 </body> |
|
53 </html> |