content/base/test/test_bug527896.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=527896
     5 -->
     6 <head>
     7   <title>Test for Bug 527896</title>
     8   <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
     9   <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    10   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
    11 </head>
    12 <body onload='done();'>
    13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=527896">Mozilla Bug 527896</a>
    14 <p id="display"></p>
    15 <div id="content" style="display: none">
    16   <iframe></iframe>
    17 </div>
    18 <pre id="test">
    19 <script class="testbody" type="text/javascript">
    21 /** Test for Bug 527896 **/
    23 SimpleTest.waitForExplicitFinish();
    25 SimpleTest.expectAssertions(1);
    27 var docWrittenSrcExecuted = false;
    28 var scriptInsertedSrcExecuted = false;
    30 // the iframe test runs with the HTML5 parser
    32 var iframe = document.getElementsByTagName('iframe')[0];
    33 iframe.contentWindow.document.open();
    34 iframe.contentWindow.document.write("<!DOCTYPE html>");
    35 iframe.contentWindow.document.write("<body><script id =\"thescript\" src=\"data:text/javascript,parent.docWrittenSrcExecuted = true;\">");
    37 // now remove the src attribute before the end tag is parsed
    38 iframe.contentWindow.document.getElementById('thescript').removeAttribute('src');
    40 iframe.contentWindow.document.write("parent.ok(false, \"Content executed.\");");
    41 iframe.contentWindow.document.write("<\/script>");
    42 iframe.contentWindow.document.close();
    44 // the insertion test runs with the default HTML parser since it's in this document itself!
    46 var div = document.getElementById('content');
    47 var script = document.createElement('script');
    48 div.appendChild(script); // this shouldn't yet freeze the script node nor run it
    49 script.setAttribute("src", "data:text/javascript,scriptInsertedSrcExecuted = true;");
    51 todo(false, "Add SVG tests after bug 528442.");
    53 function done() {
    54   ok(docWrittenSrcExecuted, "document.written src didn't execute");
    55   ok(scriptInsertedSrcExecuted, "script-inserted src didn't execute");
    57   SimpleTest.finish();
    58 }
    60 </script>
    61 </pre>
    62 </body>
    63 </html>

mercurial