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.

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

mercurial