parser/htmlparser/tests/mochitest/test_bug102699.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=102699
michael@0 5 -->
michael@0 6 <head>
michael@0 7 <meta charset="utf-8">
michael@0 8 <title>Test for Bug 102699</title>
michael@0 9 <script type="application/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=102699">Mozilla Bug 102699</a>
michael@0 14 <p id="display"></p>
michael@0 15 <div id="content" style="display: none">
michael@0 16
michael@0 17 </div>
michael@0 18 <pre id="test">
michael@0 19 <script type="application/javascript">
michael@0 20
michael@0 21 /** Test for Bug 102699 **/
michael@0 22
michael@0 23 SimpleTest.waitForExplicitFinish();
michael@0 24
michael@0 25 var p = new DOMParser();
michael@0 26
michael@0 27 var d = p.parseFromString(
michael@0 28 '<meta charset="windows-1252">' +
michael@0 29 '\u003cscript>' +
michael@0 30 'document.documentElement.setAttribute("data-fail", "FAIL");' +
michael@0 31 '\u003c/script>' +
michael@0 32 '\u003cscript src="http://mochi.test:8888/tests/parser/htmlparser/tests/mochitest/file_bug102699.sjs">\u003c/script>' +
michael@0 33 '\u003cscript src="http://mochi.test:8888/tests/parser/htmlparser/tests/mochitest/file_bug102699.sjs" defer>\u003c/script>' +
michael@0 34 '\u003cscript src="http://mochi.test:8888/tests/parser/htmlparser/tests/mochitest/file_bug102699.sjs" async>\u003c/script>' +
michael@0 35 '<link type="stylesheet" href="http://mochi.test:8888/tests/parser/htmlparser/tests/mochitest/file_bug102699.sjs">' +
michael@0 36 '<body onload=\'document.documentElement.setAttribute("data-fail", "FAIL");\'>' +
michael@0 37 '<img src="http://mochi.test:8888/tests/parser/htmlparser/tests/mochitest/file_bug102699.sjs">' +
michael@0 38 '<iframe src="http://mochi.test:8888/tests/parser/htmlparser/tests/mochitest/file_bug102699.sjs"></iframe>' +
michael@0 39 '<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>' +
michael@0 40 '<object data="http://mochi.test:8888/tests/parser/htmlparser/tests/mochitest/file_bug102699.sjs"></object>' +
michael@0 41 '<noscript><div></div></noscript>"', "text/html");
michael@0 42
michael@0 43 is(d.createElement("div").tagName, "DIV", "The created document should have HTML nature.");
michael@0 44
michael@0 45 is(d.getElementsByTagName("div").length, 1, "There should be one div.");
michael@0 46
michael@0 47 is(d.contentType, "text/html", "contentType should be text/html");
michael@0 48
michael@0 49 is(d.characterSet, "UTF-8", "Expected the <meta> to be ignored.");
michael@0 50
michael@0 51 is(d.compatMode, "BackCompat", "Should be in the quirks mode.");
michael@0 52
michael@0 53 var scripts = d.getElementsByTagName("script");
michael@0 54 is(scripts.length, 4, "Unexpected number of scripts.");
michael@0 55 while (scripts.length) {
michael@0 56 // These should not run when moved to another doc
michael@0 57 document.body.appendChild(scripts[0]);
michael@0 58 }
michael@0 59 var s = document.createElement("script");
michael@0 60 s.src = "file_bug102699.sjs?report=1";
michael@0 61 document.body.appendChild(s);
michael@0 62
michael@0 63 function continueAfterReport() {
michael@0 64 ok(!d.documentElement.hasAttribute("data-fail"), "Should not have a data-fail attribute.");
michael@0 65
michael@0 66 d = p.parseFromString("<!DOCTYPE html>", "text/html");
michael@0 67 is(d.compatMode, "CSS1Compat", "Should be in the standards mode.");
michael@0 68
michael@0 69 SimpleTest.finish();
michael@0 70 }
michael@0 71
michael@0 72 </script>
michael@0 73 </pre>
michael@0 74 </body>
michael@0 75 </html>

mercurial