| <script src="../../resources/js-test-pre.js"></script> |
| description("First load a script with a wrong charset then again with the right one. Second attempt should work and 'scriptSuccess' should be set to true."); |
| function appendScriptWithCharset(charset, onload) |
| var script = document.createElement("script"); |
| script.src = "resources/success.js"; |
| script.setAttribute("charset", charset); |
| document.body.appendChild(script); |
| debug("Loading with the wrong encoding..."); |
| appendScriptWithCharset("utf-16", function () { |
| // We should get a SyntaxError since the script was loaded with the wrong encoding. |
| shouldHaveHadError("SyntaxError"); |
| shouldBeUndefined("window.scriptSuccess"); |
| debug("Now loading with the right encoding..."); |
| appendScriptWithCharset("utf-8", function () { |
| shouldBeTrue("scriptSuccess"); |
| <script src="../../resources/js-test-post.js"></script> |