Backed out changeset 713114c0331a (bug 1938707) by developer request CLOSED TREE
[gecko.git] / js / xpconnect / tests / mochitest / test_bug965082.html
blobb2320b52c7ee43e751cd66877d900fb6d85c49b0
1 <!DOCTYPE HTML>
2 <html>
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=965082
5 -->
6 <head>
7 <meta charset="utf-8">
8 <title>Test for Bug 965082</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 965082 **/
14 SimpleTest.waitForExplicitFinish();
16 function checkThrows(f, msg) {
17 try { f(); ok(false, "Should have thrown: " + msg); }
18 catch (e) { ok(/denied|insecure|can't set prototype/.test(e), "Should throw security exception: " + e + " (" + msg + ")"); }
21 function go() {
22 var protoSetter = Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set;
23 checkThrows(function() { protoSetter.call(window[0], new Object()); }, "Setting cross-origin Window prototype");
24 checkThrows(function() { protoSetter.call(window[0].location, new Object()); }, "Setting cross-origin Location prototype");
25 SimpleTest.finish();
28 </script>
29 </head>
30 <body>
31 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=965082">Mozilla Bug 965082</a>
32 <p id="display"></p>
33 <div id="content" style="display: none">
34 </div>
35 <iframe id="ifr" onload="go();" src="http://example.org/tests/js/xpconnect/tests/mochitest/file_empty.html"></iframe>
36 <pre id="test">
37 </pre>
38 </body>
39 </html>