1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/content/xml/document/test/test_bug445330.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=445330 1.8 +--> 1.9 +<head> 1.10 + <title>Test for Bug 445330</title> 1.11 + <script type="text/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=445330">Mozilla Bug 445330</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 class="testbody" type="text/javascript"> 1.22 + 1.23 +/** Test for Bug 445330 **/ 1.24 + 1.25 +var loadCounter = 0; 1.26 +var dclCounter = 0; 1.27 + 1.28 +function runTest() { 1.29 + var doc = document.implementation.createDocument("", "", null); 1.30 + doc.onload = function(evt) { 1.31 + ++loadCounter; 1.32 + ok(dclCounter == 1, "DOMContentLoaded should have fired."); 1.33 + if (loadCounter == 1 && dclCounter == 1) { 1.34 + SimpleTest.finish(); 1.35 + } 1.36 + }; 1.37 + 1.38 + doc.addEventListener("DOMContentLoaded", 1.39 + function (evt) { 1.40 + ++dclCounter; 1.41 + ok(loadCounter == 0, "load event shouldn't have fired."); 1.42 + if (loadCounter == 1 && dclCounter == 1) { 1.43 + SimpleTest.finish(); 1.44 + } 1.45 + }, 1.46 + true); 1.47 + 1.48 + doc.load(""); 1.49 +} 1.50 + 1.51 +SimpleTest.waitForExplicitFinish(); 1.52 +addLoadEvent(runTest); 1.53 + 1.54 +</script> 1.55 +</pre> 1.56 +</body> 1.57 +</html> 1.58 +