content/base/test/test_bug604660.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.

michael@0 1 <!DOCTYPE HTML>
michael@0 2 <html>
michael@0 3 <!--
michael@0 4 https://bugzilla.mozilla.org/show_bug.cgi?id=604660
michael@0 5 -->
michael@0 6 <head>
michael@0 7 <title>Test for Bug 604660</title>
michael@0 8 <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
michael@0 9 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
michael@0 10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
michael@0 11 </head>
michael@0 12 <body>
michael@0 13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=604660">Mozilla Bug 604660</a>
michael@0 14 <script>
michael@0 15 SimpleTest.waitForExplicitFinish();
michael@0 16 var asyncState = false;
michael@0 17 var scriptState = 0;
michael@0 18
michael@0 19 function scriptRan(num) {
michael@0 20 ++scriptState;
michael@0 21 is(scriptState, num, "Scripts ran in the wrong sequence.");
michael@0 22 }
michael@0 23
michael@0 24 function asyncRan() {
michael@0 25 asyncState = true;
michael@0 26 }
michael@0 27
michael@0 28 </script>
michael@0 29 <p id="display"><iframe src="file_bug604660-1.xml" onload="iframeloaded()";></iframe></p>
michael@0 30 <div id="content" style="display: none">
michael@0 31
michael@0 32 </div>
michael@0 33 <pre id="test">
michael@0 34 <script class="testbody" type="text/javascript">
michael@0 35
michael@0 36 var xlstProcessorState = false;
michael@0 37
michael@0 38 function xsltProcessorCreatedScriptRan() {
michael@0 39 xlstProcessorState = true;
michael@0 40 }
michael@0 41
michael@0 42 function iframeloaded() {
michael@0 43 ok(asyncState, "Async script should have run.");
michael@0 44 is(scriptState, 5, "Five scripts should have run.");
michael@0 45
michael@0 46 var processor = new XSLTProcessor();
michael@0 47
michael@0 48 var xhr = new XMLHttpRequest();
michael@0 49 xhr.onreadystatechange = function() {
michael@0 50 if (this.readyState == 4) {
michael@0 51 processor.importStylesheet(this.responseXML);
michael@0 52 xhr.onreadystatechange = function() {
michael@0 53 if (this.readyState == 4) {
michael@0 54 var doc = processor.transformToDocument(this.responseXML);
michael@0 55 var target = document.getElementById("display");
michael@0 56 target.appendChild(doc.documentElement.firstChild);
michael@0 57 ok(!xlstProcessorState, "Scripts created by transformToDocument should not run.");
michael@0 58
michael@0 59 var fragment = processor.transformToFragment(this.responseXML, document);
michael@0 60 target.appendChild(fragment.firstChild.firstChild);
michael@0 61 ok(xlstProcessorState, "Scripts created by transformToFragment should run.");
michael@0 62
michael@0 63 SimpleTest.finish();
michael@0 64 }
michael@0 65 }
michael@0 66 xhr.open("GET", "file_bug604660-5.xml");
michael@0 67 xhr.send();
michael@0 68 }
michael@0 69 }
michael@0 70 xhr.open("GET", "file_bug604660-6.xsl");
michael@0 71 xhr.send();
michael@0 72 }
michael@0 73 </script>
michael@0 74 </pre>
michael@0 75 </body>
michael@0 76 </html>
michael@0 77

mercurial