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