1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/xpconnect/tests/mochitest/test_bug605167.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,56 @@ 1.4 +<!DOCTYPE HTML> 1.5 +<html> 1.6 +<!-- 1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=505915 1.8 +--> 1.9 +<head> 1.10 + <title>Test for Bug 505915</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 +</head> 1.14 +<body> 1.15 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=505915">Mozilla Bug 505915</a> 1.16 +<p id="display"></p> 1.17 +<div id="content" style="display: none"> 1.18 + 1.19 +</div> 1.20 +<pre id="test"> 1.21 +<script type="application/javascript;version=1.7"> 1.22 + 1.23 +/** Test for Bug 505915 **/ 1.24 +var dataUrl = "data:text/html,<script>parent.f = function() { return this; };<" + "/script>"; 1.25 +var targetUrl = "http://example.com"; 1.26 +var f; 1.27 + 1.28 +var p = 0; 1.29 +function go() { 1.30 + switch (++p) { 1.31 + case 1: 1.32 + frames[0].location = dataUrl; 1.33 + break; 1.34 + case 2: 1.35 + frames[0].location = targetUrl; 1.36 + break; 1.37 + case 3: 1.38 + try { 1.39 + f().cross_origin_property; 1.40 + ok(false, "should have thrown an exception"); 1.41 + } catch (e) { 1.42 + ok(/Permission denied/.test(e) || /attempt to run compile-and-go script/.test(e), 1.43 + "threw the correct exception"); 1.44 + } 1.45 + SimpleTest.finish(); 1.46 + break; 1.47 + } 1.48 +} 1.49 + 1.50 + 1.51 +SimpleTest.waitForExplicitFinish(); 1.52 + 1.53 +</script> 1.54 +</pre> 1.55 + 1.56 +<iframe id="ifr" onload="go();"></iframe> 1.57 + 1.58 +</body> 1.59 +</html>