1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/xpconnect/tests/mochitest/test_bug720619.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,55 @@ 1.4 +<!DOCTYPE HTML> 1.5 +<html> 1.6 +<!-- 1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=720619 1.8 +--> 1.9 +<head> 1.10 + <title>Test for Bug 629227</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=720619">Mozilla Bug 720619</a> 1.16 +<p id="display"> 1.17 + <iframe id="testTarget"></iframe> 1.18 +</p> 1.19 +<div id="content" style="display: none"> 1.20 + 1.21 +</div> 1.22 +<pre id="test"> 1.23 +<script type="application/javascript"> 1.24 + 1.25 +/** Test for Bug 720619 **/ 1.26 +SimpleTest.waitForExplicitFinish(); 1.27 + 1.28 +function checkThrows(f, exception) { 1.29 + try { 1.30 + f(); 1.31 + ok(false, "should have thrown: " + f); 1.32 + } catch (e) { 1.33 + ok(exception.test(e.toString()), "correctly threw"); 1.34 + } 1.35 +} 1.36 + 1.37 +function go() { 1.38 + var loc = $('ifr').contentWindow.location; 1.39 + checkThrows(function() {loc + '';}, /Permission denied/); 1.40 + checkThrows(function() {'' + loc;}, /Permission denied/); 1.41 + checkThrows(function() {String(loc);}, /Permission denied/); 1.42 + 1.43 + var win = $('ifr').contentWindow; 1.44 + checkThrows(function() {win + '';}, /Permission denied/); 1.45 + checkThrows(function() {'' + win;}, /Permission denied/); 1.46 + checkThrows(function() {String(win);}, /Permission denied/); 1.47 + 1.48 + SimpleTest.finish(); 1.49 +} 1.50 + 1.51 +</script> 1.52 + 1.53 +<iframe id="ifr" onload="go()" 1.54 + src="http://example.org/tests/js/xpconnect/tests/mochitest/file_bug720619.html"> 1.55 +</iframe> 1.56 +</pre> 1.57 +</body> 1.58 +</html>