summaryrefslogtreecommitdiffstats
path: root/LayoutTests/fast/encoding/resources/invalid-xml.js
blob: e241a0c1411bbecf0165a03338995eea4966ef19 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// test 70: XML encoding test
// q.v. XML 1.0, section 4.3.3 Character Encoding in Entities
// this only tests one of a large number of conditions that should cause fatal errors

function runEncodingTest(event)
{
    debug("Testing: " + encodingTests[currentTest-1]);
    shouldBeEqualToString("iframe.contentDocument.documentElement.tagName", "root");
    shouldBeTrue("iframe.contentDocument.documentElement.getElementsByTagName('test').length < 1");
    setTimeout(runNextTest, 0);
}

var currentTest = 0;
var encodingTests = [
    "invalid-xml-utf8.xml",
    "invalid-xml-utf16.xml",
    "invalid-xml-shift-jis.xml",
    "invalid-xml-x-mac-thai.xml",
];

function runNextTest()
{
    if (currentTest >= encodingTests.length) {
        var script = document.createElement("script");
        script.src = "../js/resources/js-test-post.js";
        if (window.layoutTestController)
            script.setAttribute("onload", "layoutTestController.notifyDone()");
        document.body.appendChild(script);
        iframe.parentNode.removeChild(iframe);
        return;
    }
    iframe.src = "resources/" + encodingTests[currentTest++];
}

if (window.layoutTestController)
    layoutTestController.waitUntilDone();

var iframe = document.createElement("iframe");
document.body.appendChild(iframe);
iframe.onload = runEncodingTest;
runNextTest();

var successfullyParsed = true;