dom/tests/mochitest/bugs/test_bug459848.html

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 <!DOCTYPE HTML>
     2 <html>
     3 <!--
     4 https://bugzilla.mozilla.org/show_bug.cgi?id=459848
     5 -->
     6 <head>
     7   <title>Test for Bug 459848</title>
     8   <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
     9   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    10 </head>
    11 <body>
    12 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=459848">Mozilla Bug 459848</a>
    13 <p id="display"></p>
    14 <div id="content" style="display: none">
    16 </div>
    17 <pre id="test">
    18 <script type="application/javascript">
    20 /** Test for Bug 459848 **/
    22 var ifr1, irf2;
    23 var doc1, doc2;
    25 function testDocument(d) {
    26   d.documentElement.setAttribute("onload", "this.setAttribute('didRun', 'true');");
    27   var e = d.createEvent("Events");
    28   e.initEvent("load", true, true);
    29   d.documentElement.dispatchEvent(e);
    30 }
    32 function testDoc2() {
    33   testDocument(doc2);
    34   isnot(doc2.documentElement.getAttribute("didRun"), "true",
    35         "Shouldn't have run an event listener");
    36   SimpleTest.finish();
    37 }
    39 function startTest() {
    40   var ifr1 = document.getElementById('iframe1');
    41   var ifr2 = document.getElementById('iframe2');
    42   doc1 = ifr1.contentDocument;
    43   doc2 = ifr2.contentDocument;
    45   testDocument(doc1);
    46   is(doc1.documentElement.getAttribute("didRun"), "true",
    47      "Should have run an event listener");
    49   ifr2.parentNode.removeChild(ifr2);
    50   setTimeout(testDoc2, 0);
    51 }
    52 SimpleTest.waitForExplicitFinish();
    53 addLoadEvent(startTest);
    55 </script>
    56 </pre>
    57 <iframe id="iframe1"></iframe>
    58 <iframe id="iframe2"></iframe>
    59 </body>
    60 </html>

mercurial