1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/tests/mochitest/bugs/test_bug850517.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,47 @@ 1.4 +<!DOCTYPE HTML> 1.5 +<html> 1.6 +<!-- 1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=850517 1.8 +--> 1.9 +<head> 1.10 + <meta charset="utf-8"> 1.11 + <title>Test for Bug 850517</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 live updating of named child resolution. **/ 1.17 + SimpleTest.waitForExplicitFinish(); 1.18 + 1.19 + function go() { 1.20 + var ifrA = $('a'); 1.21 + var ifrB = $('b'); 1.22 + var sb = new SpecialPowers.Cu.Sandbox('http://www.example.com'); 1.23 + sb.win = window; 1.24 + sb.childA = ifrA.contentWindow; 1.25 + sb.childB = ifrB.contentWindow; 1.26 + sb.is = SpecialPowers.wrap(is); 1.27 + sb.ok = SpecialPowers.wrap(ok); 1.28 + is(window.theoneandonly.frameElement, ifrA, "Named child resolution works"); 1.29 + SpecialPowers.Cu.evalInSandbox('is(win.theoneandonly, childA, "Named child resolution works via Xray");', sb); 1.30 + ifrA.removeAttribute('name'); 1.31 + is(typeof window.theoneandonly, 'undefined', "Revocation works"); 1.32 + SpecialPowers.Cu.evalInSandbox('try { win.theoneandonly; ok(false, "Should have thrown"); } ' + 1.33 + 'catch (e) {ok(!!/denied/.exec(e) && !!/theoneandonly/.exec(e), "Revocation works via Xray");};', sb); 1.34 + ifrB.setAttribute('name', 'theoneandonly'); 1.35 + is(window.theoneandonly.frameElement, ifrB, "Another mule kicking in the same old stall"); 1.36 + SpecialPowers.Cu.evalInSandbox('is(win.theoneandonly, childB, "Another mule via Xray");', sb); 1.37 + SimpleTest.finish(); 1.38 + } 1.39 + 1.40 + </script> 1.41 +</head> 1.42 +<body onload="go();"> 1.43 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=850517">Mozilla Bug 850517</a> 1.44 +<p id="display"></p> 1.45 +<iframe id="a" name="theoneandonly"></iframe> 1.46 +<iframe id="b"></iframe> 1.47 +<pre id="test"> 1.48 +</pre> 1.49 +</body> 1.50 +</html>