1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/xpconnect/tests/mochitest/test_bug800864.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,51 @@ 1.4 +<!DOCTYPE HTML> 1.5 +<html> 1.6 +<!-- 1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=800864 1.8 +--> 1.9 +<head> 1.10 + <title>Test for Bug 800864</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=800864">Mozilla Bug 800864</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"> 1.22 + 1.23 +SimpleTest.waitForExplicitFinish(); 1.24 + 1.25 +function checkThrows(f) { 1.26 + try { 1.27 + f(); 1.28 + ok(false, "Didn't throw a security exception like we should"); 1.29 + } catch(e) { 1.30 + ok(/denied|insecure/.exec(e), "Should throw security exception. Got: " + e); 1.31 + } 1.32 +} 1.33 + 1.34 +function go() { 1.35 + ifr = document.getElementById('ifr'); 1.36 + win = ifr.contentWindow; 1.37 + loc = win.location; 1.38 + ifr.onload = check; 1.39 + win.location = 'http://test1.example.com'; 1.40 +} 1.41 + 1.42 +function check() { 1.43 + checkThrows(function() { loc.toString(); }); 1.44 + checkThrows(function() { loc.valueOf().toString(); }); 1.45 + checkThrows(function() { loc.href; }); 1.46 + checkThrows(function() { loc + ''; }); 1.47 + SimpleTest.finish(); 1.48 +} 1.49 + 1.50 +</script> 1.51 +</pre> 1.52 +</body> 1.53 +<iframe id="ifr" onload="go()" src="file_empty.html"></iframe> 1.54 +</html>