1 // test 70: XML encoding test 2 // q.v. XML 1.0, section 4.3.3 Character Encoding in Entities 3 // this only tests one of a large number of conditions that should cause fatal errors 4 5 function runEncodingTest(event) 6 { 7 debug("Testing: " + encodingTests[currentTest-1]); 8 shouldBeEqualToString("iframe.contentDocument.documentElement.tagName", "root"); 9 shouldBeTrue("iframe.contentDocument.documentElement.getElementsByTagName('test').length < 1"); 10 setTimeout(runNextTest, 0); 11 } 12 13 var currentTest = 0; 14 var encodingTests = [ 15 "invalid-xml-utf8.xml", 16 "invalid-xml-utf16.xml", 17 "invalid-xml-shift-jis.xml", 18 "invalid-xml-x-mac-thai.xml", 19 ]; 20 21 function runNextTest() 22 { 23 if (currentTest >= encodingTests.length) { 24 var script = document.createElement("script"); 25 script.src = "../js/resources/js-test-post.js"; 26 if (window.layoutTestController) 27 script.setAttribute("onload", "layoutTestController.notifyDone()"); 28 document.body.appendChild(script); 29 iframe.parentNode.removeChild(iframe); 30 return; 31 } 32 iframe.src = "resources/" + encodingTests[currentTest++]; 33 } 34 35 if (window.layoutTestController) 36 layoutTestController.waitUntilDone(); 37 38 var iframe = document.createElement("iframe"); 39 document.body.appendChild(iframe); 40 iframe.onload = runEncodingTest; 41 runNextTest(); 42 43 var successfullyParsed = true; 44