Test for bug 642908 - Make the <noscript> handling state in the speculative document.write tree builder match the state of the non-speculative document.write tree builder. r=bzbarsky.
authorHenri Sivonen <hsivonen@iki.fi>
Thu, 28 Apr 2011 10:01:13 +0300
changeset 68700 557165a66267f01c4a3459eb861647bb117850c7
parent 68699 b16fc4a77dac26b9e043b52812ed631ed7353d31
child 68701 f4328cb97a23da6611a7296c5886bd8cd656c246
push idunknown
push userunknown
push dateunknown
reviewersbzbarsky
bugs642908
milestone6.0a1
Test for bug 642908 - Make the <noscript> handling state in the speculative document.write tree builder match the state of the non-speculative document.write tree builder. r=bzbarsky.
parser/htmlparser/tests/mochitest/Makefile.in
parser/htmlparser/tests/mochitest/file_bug642908.sjs
parser/htmlparser/tests/mochitest/test_bug642908.html
--- a/parser/htmlparser/tests/mochitest/Makefile.in
+++ b/parser/htmlparser/tests/mochitest/Makefile.in
@@ -79,16 +79,18 @@ include $(topsrcdir)/config/rules.mk
 		file_bug594730-4.html \
 		file_bug594730-5.html \
 		file_bug594730-6.html \
 		file_bug594730-7.html \
 		file_bug594730-8.html \
 		file_bug594730-9.html \
 		test_bug599584.html \
 		iframe_bug599584.html \
+		test_bug642908.html \
+		file_bug642908.sjs \
 		test_bug645115.html \
 		$(NULL)
 
 # Disabled test due to orange on Linux
 #		test_bug568470.html \
 #		file_bug568470.sjs \
 #		file_bug568470-script.sjs \
 
new file mode 100644
--- /dev/null
+++ b/parser/htmlparser/tests/mochitest/file_bug642908.sjs
@@ -0,0 +1,16 @@
+function handleRequest(request, response)
+{
+  if (request.queryString.indexOf("report") != -1) {
+    response.setHeader("Content-Type", "text/javascript", false);
+    if (getState("loaded") == "loaded") {
+      response.write("ok(false, 'There was an attempt to preload the image.');");      
+    } else {
+      response.write("ok(true, 'There was no attempt to preload the image.');");      
+    }
+    response.write("SimpleTest.finish();");
+  } else {
+    setState("loaded", "loaded");
+    response.setHeader("Content-Type", "image/svg", false);
+    response.write("<svg xmlns='http://www.w3.org/2000/svg'>Not supposed to load this</svg>");
+  }
+}
new file mode 100644
--- /dev/null
+++ b/parser/htmlparser/tests/mochitest/test_bug642908.html
@@ -0,0 +1,33 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=642908
+-->
+<head>
+  <title>Test for Bug 642908</title>
+  <script type="application/javascript" src="/MochiKit/packed.js"></script>
+  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body onload="loaded();">
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=642908">Mozilla Bug 642908</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+  
+</div>
+<pre id="test">
+<script type="application/javascript">
+SimpleTest.waitForExplicitFinish();
+document.write("\u003Cscript src='data:text/javascript,1;'>\u003C/script>");
+document.write("<noscript><img src='file_bug642908.sjs'></noscript>");
+
+function loaded() {
+  var s = document.createElement("script");
+  s.src = "file_bug642908.sjs?report=1";
+  document.body.appendChild(s);
+}
+
+</script>
+</pre>
+</body>
+</html>