Wed, 31 Dec 2014 06:09:35 +0100
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=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>