1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/parser/htmlparser/tests/mochitest/test_bug102699.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,75 @@ 1.4 +<!DOCTYPE HTML> 1.5 +<html> 1.6 +<!-- 1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=102699 1.8 +--> 1.9 +<head> 1.10 + <meta charset="utf-8"> 1.11 + <title>Test for Bug 102699</title> 1.12 + <script type="application/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> 1.16 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=102699">Mozilla Bug 102699</a> 1.17 +<p id="display"></p> 1.18 +<div id="content" style="display: none"> 1.19 + 1.20 +</div> 1.21 +<pre id="test"> 1.22 +<script type="application/javascript"> 1.23 + 1.24 +/** Test for Bug 102699 **/ 1.25 + 1.26 +SimpleTest.waitForExplicitFinish(); 1.27 + 1.28 +var p = new DOMParser(); 1.29 + 1.30 +var d = p.parseFromString( 1.31 +'<meta charset="windows-1252">' + 1.32 +'\u003cscript>' + 1.33 +'document.documentElement.setAttribute("data-fail", "FAIL");' + 1.34 +'\u003c/script>' + 1.35 +'\u003cscript src="http://mochi.test:8888/tests/parser/htmlparser/tests/mochitest/file_bug102699.sjs">\u003c/script>' + 1.36 +'\u003cscript src="http://mochi.test:8888/tests/parser/htmlparser/tests/mochitest/file_bug102699.sjs" defer>\u003c/script>' + 1.37 +'\u003cscript src="http://mochi.test:8888/tests/parser/htmlparser/tests/mochitest/file_bug102699.sjs" async>\u003c/script>' + 1.38 +'<link type="stylesheet" href="http://mochi.test:8888/tests/parser/htmlparser/tests/mochitest/file_bug102699.sjs">' + 1.39 +'<body onload=\'document.documentElement.setAttribute("data-fail", "FAIL");\'>' + 1.40 +'<img src="http://mochi.test:8888/tests/parser/htmlparser/tests/mochitest/file_bug102699.sjs">' + 1.41 +'<iframe src="http://mochi.test:8888/tests/parser/htmlparser/tests/mochitest/file_bug102699.sjs"></iframe>' + 1.42 +'<video poster="http://mochi.test:8888/tests/parser/htmlparser/tests/mochitest/file_bug102699.sjs" src="http://mochi.test:8888/tests/parser/htmlparser/tests/mochitest/file_bug102699.sjs"></video>' + 1.43 +'<object data="http://mochi.test:8888/tests/parser/htmlparser/tests/mochitest/file_bug102699.sjs"></object>' + 1.44 +'<noscript><div></div></noscript>"', "text/html"); 1.45 + 1.46 +is(d.createElement("div").tagName, "DIV", "The created document should have HTML nature."); 1.47 + 1.48 +is(d.getElementsByTagName("div").length, 1, "There should be one div."); 1.49 + 1.50 +is(d.contentType, "text/html", "contentType should be text/html"); 1.51 + 1.52 +is(d.characterSet, "UTF-8", "Expected the <meta> to be ignored."); 1.53 + 1.54 +is(d.compatMode, "BackCompat", "Should be in the quirks mode."); 1.55 + 1.56 +var scripts = d.getElementsByTagName("script"); 1.57 +is(scripts.length, 4, "Unexpected number of scripts."); 1.58 +while (scripts.length) { 1.59 + // These should not run when moved to another doc 1.60 + document.body.appendChild(scripts[0]); 1.61 +} 1.62 +var s = document.createElement("script"); 1.63 +s.src = "file_bug102699.sjs?report=1"; 1.64 +document.body.appendChild(s); 1.65 + 1.66 +function continueAfterReport() { 1.67 + ok(!d.documentElement.hasAttribute("data-fail"), "Should not have a data-fail attribute."); 1.68 + 1.69 + d = p.parseFromString("<!DOCTYPE html>", "text/html"); 1.70 + is(d.compatMode, "CSS1Compat", "Should be in the standards mode."); 1.71 + 1.72 + SimpleTest.finish(); 1.73 +} 1.74 + 1.75 +</script> 1.76 +</pre> 1.77 +</body> 1.78 +</html>