1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/tests/mochitest/bugs/test_bug459848.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,60 @@ 1.4 +<!DOCTYPE HTML> 1.5 +<html> 1.6 +<!-- 1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=459848 1.8 +--> 1.9 +<head> 1.10 + <title>Test for Bug 459848</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=459848">Mozilla Bug 459848</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 +/** Test for Bug 459848 **/ 1.24 + 1.25 +var ifr1, irf2; 1.26 +var doc1, doc2; 1.27 + 1.28 +function testDocument(d) { 1.29 + d.documentElement.setAttribute("onload", "this.setAttribute('didRun', 'true');"); 1.30 + var e = d.createEvent("Events"); 1.31 + e.initEvent("load", true, true); 1.32 + d.documentElement.dispatchEvent(e); 1.33 +} 1.34 + 1.35 +function testDoc2() { 1.36 + testDocument(doc2); 1.37 + isnot(doc2.documentElement.getAttribute("didRun"), "true", 1.38 + "Shouldn't have run an event listener"); 1.39 + SimpleTest.finish(); 1.40 +} 1.41 + 1.42 +function startTest() { 1.43 + var ifr1 = document.getElementById('iframe1'); 1.44 + var ifr2 = document.getElementById('iframe2'); 1.45 + doc1 = ifr1.contentDocument; 1.46 + doc2 = ifr2.contentDocument; 1.47 + 1.48 + testDocument(doc1); 1.49 + is(doc1.documentElement.getAttribute("didRun"), "true", 1.50 + "Should have run an event listener"); 1.51 + 1.52 + ifr2.parentNode.removeChild(ifr2); 1.53 + setTimeout(testDoc2, 0); 1.54 +} 1.55 +SimpleTest.waitForExplicitFinish(); 1.56 +addLoadEvent(startTest); 1.57 + 1.58 +</script> 1.59 +</pre> 1.60 +<iframe id="iframe1"></iframe> 1.61 +<iframe id="iframe2"></iframe> 1.62 +</body> 1.63 +</html>