1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/xpconnect/tests/mochitest/test_bug965082.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,39 @@ 1.4 +<!DOCTYPE HTML> 1.5 +<html> 1.6 +<!-- 1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=965082 1.8 +--> 1.9 +<head> 1.10 + <meta charset="utf-8"> 1.11 + <title>Test for Bug 965082</title> 1.12 + <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> 1.13 + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 1.14 + <script type="application/javascript"> 1.15 + 1.16 + /** Test for Bug 965082 **/ 1.17 + SimpleTest.waitForExplicitFinish(); 1.18 + 1.19 + function checkThrows(f, msg) { 1.20 + try { f(); ok(false, "Should have thrown: " + msg); } 1.21 + catch (e) { ok(/denied|insecure/.test(e), "Should throw security exception: " + e + " (" + msg + ")"); } 1.22 + } 1.23 + 1.24 + function go() { 1.25 + var protoSetter = Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set; 1.26 + checkThrows(function() { protoSetter.call(window[0], new Object()); }, "Setting cross-origin Window prototype"); 1.27 + checkThrows(function() { protoSetter.call(window[0].location, new Object()); }, "Setting cross-origin Location prototype"); 1.28 + SimpleTest.finish(); 1.29 + } 1.30 + 1.31 + </script> 1.32 +</head> 1.33 +<body> 1.34 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=965082">Mozilla Bug 965082</a> 1.35 +<p id="display"></p> 1.36 +<div id="content" style="display: none"> 1.37 +</div> 1.38 +<iframe id="ifr" onload="go();" src="http://example.org/tests/js/xpconnect/tests/mochitest/file_empty.html"></iframe> 1.39 +<pre id="test"> 1.40 +</pre> 1.41 +</body> 1.42 +</html>