content/base/test/test_bug453736.html

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

     1 <!DOCTYPE HTML>
     2 <html>
     3 <!--
     4 https://bugzilla.mozilla.org/show_bug.cgi?id=453736
     5 -->
     6 <head>
     7   <title>Test for Bug 453736</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=453736">Mozilla Bug 453736</a>
    13 <p id="display"></p>
    14 <div id="content" style="display: none">
    15 </div>
    16 <pre id="test">
    17 <script type="application/javascript">
    18 /** Test for Bug 453736 **/
    19 SimpleTest.waitForExplicitFinish();
    20 addLoadEvent(function() {
    21   const scriptCreationFuncs = [
    22     function() { return document.createElement("script"); },
    23     function() { return document.createElementNS("http://www.w3.org/2000/svg", "script"); }
    24   ];
    26   const scriptContainers = ["div", "iframe", "noframes", "noembed"];
    27   for (var i = 0; i < scriptContainers.length; ++i) {
    28     for (var func of scriptCreationFuncs) {
    29       var cont = scriptContainers[i];
    30       var node = document.createElement(cont);
    31       document.body.appendChild(node);
    32       var s = func();
    33       s.setAttribute("type", "application/javascript");
    34       s.appendChild(document.createTextNode('window["'+cont+'ScriptRan"] = true'));
    36       window[cont+"ScriptRan"] = false;
    37       node.appendChild(s);
    38       is(window[cont+"ScriptRan"], true,
    39          "Script created with " + func +" should run when inserting in <"+cont+">");
    41       window[cont+"ScriptRan"] = false;
    42       document.body.appendChild(s);
    43       is(window[cont+"ScriptRan"], false,
    44          "Script created with " + func + " shouldn't run when moving out of <"+cont+">");
    46       window[cont+"ScriptRan"] = false;
    47       document.body.appendChild(s.cloneNode(true));
    48       is(window[cont+"ScriptRan"], false,
    49          "Clone of script inside <" + cont + "> created with " + func + " shouldn't run");
    50     }
    51   }
    53   SimpleTest.finish();
    54 });
    55 </script>
    56 </pre>
    57 </body>
    58 </html>

mercurial