1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/xpconnect/tests/mochitest/test_bug396851.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,41 @@ 1.4 +<!DOCTYPE HTML> 1.5 +<html> 1.6 +<!-- 1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=396851 1.8 +--> 1.9 +<head> 1.10 + <title>Test for Bug 396851</title> 1.11 + <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> 1.12 + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 1.13 + 1.14 + <script type="text/javascript"> 1.15 + function go() { 1.16 + var iframe = $("ifr"); 1.17 + var win = iframe.contentWindow; 1.18 + try { 1.19 + var doc = win.document; 1.20 + fail("Allowed cross-origin access to the document"); 1.21 + } catch (e) { 1.22 + ok(e.toString().match("Permission denied") != null, "Weird exception thrown"); 1.23 + } 1.24 + 1.25 + doc = SpecialPowers.wrap(win).document; 1.26 + ok(doc != null, "Able to access the cross-origin document"); 1.27 + SimpleTest.finish(); 1.28 + } 1.29 + </script> 1.30 +</head> 1.31 +<body> 1.32 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=396851">Mozilla Bug 396851</a> 1.33 +<p id="display"></p> 1.34 +<div id="content" style="display: none"> 1.35 +</div> 1.36 +<script type="text/javascript"> 1.37 + SimpleTest.waitForExplicitFinish(); 1.38 +</script> 1.39 +<iframe id="ifr" 1.40 + src="http://example.org/tests/js/xpconnect/tests/mochitest/inner.html" 1.41 + onload="go()"> 1.42 +</iframe> 1.43 +</body> 1.44 +</html>