test_bug634834.html (1435B)
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 src="/tests/SimpleTest/SimpleTest.js"></script> 9 <script 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'> 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 // eslint-disable-next-line @microsoft/sdl/no-insecure-url 27 $("iframe").contentWindow.location = "http://example.com"; 28 29 // Wait until we've loaded example.com. 30 do { 31 var r = new XMLHttpRequest(); 32 r.open("GET", location.href, false); 33 r.overrideMimeType("text/plain"); 34 try { r.send(null); } catch (e) {} 35 } while (!loadedAfterPushstate); 36 }); 37 38 try { 39 $("iframe").contentWindow.history.pushState(obj, ""); 40 ok(false, "pushState should throw exception."); 41 } catch (e) { 42 ok(true, "pushState threw an exception."); 43 } 44 SimpleTest.finish(); 45 } 46 47 </script> 48 49 <iframe id='iframe' src='file_bug634834.html' onload='iframe_loaded()'></iframe> 50 51 </body> 52 </html>