1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/content/base/test/test_bug527896.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,63 @@ 1.4 +<!DOCTYPE HTML> 1.5 +<html> 1.6 +<!-- 1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=527896 1.8 +--> 1.9 +<head> 1.10 + <title>Test for Bug 527896</title> 1.11 + <script type="text/javascript" src="/MochiKit/MochiKit.js"></script> 1.12 + <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> 1.13 + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> 1.14 +</head> 1.15 +<body onload='done();'> 1.16 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=527896">Mozilla Bug 527896</a> 1.17 +<p id="display"></p> 1.18 +<div id="content" style="display: none"> 1.19 + <iframe></iframe> 1.20 +</div> 1.21 +<pre id="test"> 1.22 +<script class="testbody" type="text/javascript"> 1.23 + 1.24 +/** Test for Bug 527896 **/ 1.25 + 1.26 +SimpleTest.waitForExplicitFinish(); 1.27 + 1.28 +SimpleTest.expectAssertions(1); 1.29 + 1.30 +var docWrittenSrcExecuted = false; 1.31 +var scriptInsertedSrcExecuted = false; 1.32 + 1.33 +// the iframe test runs with the HTML5 parser 1.34 + 1.35 +var iframe = document.getElementsByTagName('iframe')[0]; 1.36 +iframe.contentWindow.document.open(); 1.37 +iframe.contentWindow.document.write("<!DOCTYPE html>"); 1.38 +iframe.contentWindow.document.write("<body><script id =\"thescript\" src=\"data:text/javascript,parent.docWrittenSrcExecuted = true;\">"); 1.39 + 1.40 +// now remove the src attribute before the end tag is parsed 1.41 +iframe.contentWindow.document.getElementById('thescript').removeAttribute('src'); 1.42 + 1.43 +iframe.contentWindow.document.write("parent.ok(false, \"Content executed.\");"); 1.44 +iframe.contentWindow.document.write("<\/script>"); 1.45 +iframe.contentWindow.document.close(); 1.46 + 1.47 +// the insertion test runs with the default HTML parser since it's in this document itself! 1.48 + 1.49 +var div = document.getElementById('content'); 1.50 +var script = document.createElement('script'); 1.51 +div.appendChild(script); // this shouldn't yet freeze the script node nor run it 1.52 +script.setAttribute("src", "data:text/javascript,scriptInsertedSrcExecuted = true;"); 1.53 + 1.54 +todo(false, "Add SVG tests after bug 528442."); 1.55 + 1.56 +function done() { 1.57 + ok(docWrittenSrcExecuted, "document.written src didn't execute"); 1.58 + ok(scriptInsertedSrcExecuted, "script-inserted src didn't execute"); 1.59 + 1.60 + SimpleTest.finish(); 1.61 +} 1.62 + 1.63 +</script> 1.64 +</pre> 1.65 +</body> 1.66 +</html>