2007-11-11 12:03:33 -08:00
|
|
|
/* The test text decoded correctly as Shift_JIS */
|
|
|
|
const rightText="\u30E6\u30CB\u30B3\u30FC\u30C9\u306F\u3001\u3059\u3079\u3066\u306E\u6587\u5B57\u306B\u56FA\u6709\u306E\u756A\u53F7\u3092\u4ED8\u4E0E\u3057\u307E\u3059";
|
|
|
|
|
|
|
|
const enteredText1="The quick brown fox jumps over the lazy dog";
|
|
|
|
const enteredText2="\u03BE\u03B5\u03C3\u03BA\u03B5\u03C0\u03AC\u03B6\u03C9\u0020\u03C4\u1F74\u03BD\u0020\u03C8\u03C5\u03C7\u03BF\u03C6\u03B8\u03CC\u03C1\u03B1\u0020\u03B2\u03B4\u03B5\u03BB\u03C5\u03B3\u03BC\u03AF\u03B1";
|
|
|
|
|
|
|
|
var testPage;
|
|
|
|
|
|
|
|
function test() {
|
2009-07-13 01:16:52 -07:00
|
|
|
testPage = Application.activeWindow.open(url("about:blank"));
|
|
|
|
testPage.events.addListener("load", afterOpen);
|
|
|
|
testPage.load(url("chrome://mochikit/content/browser/docshell/test/browser/test-form_sjis.html"));
|
2007-11-11 12:03:33 -08:00
|
|
|
testPage.focus();
|
|
|
|
|
|
|
|
waitForExplicitFinish();
|
|
|
|
}
|
|
|
|
|
|
|
|
function afterOpen() {
|
2009-07-13 01:16:52 -07:00
|
|
|
testPage.events.removeListener("load", afterOpen);
|
|
|
|
testPage.events.addListener("load", afterChangeCharset);
|
2007-11-11 12:03:33 -08:00
|
|
|
testPage.document.getElementById("testtextarea").value=enteredText1;
|
|
|
|
testPage.document.getElementById("testinput").value=enteredText2;
|
|
|
|
|
|
|
|
/* Force the page encoding to Shift_JIS */
|
|
|
|
SetForcedCharset("Shift_JIS");
|
|
|
|
}
|
|
|
|
|
|
|
|
function afterChangeCharset() {
|
2009-07-13 01:16:52 -07:00
|
|
|
testPage.events.removeListener("load", afterChangeCharset);
|
2007-11-11 12:03:33 -08:00
|
|
|
is(testPage.document.getElementById("testpar").innerHTML, rightText,
|
|
|
|
"encoding successfully changed");
|
|
|
|
is(testPage.document.getElementById("testtextarea").value, enteredText1,
|
|
|
|
"text preserved in <textarea>");
|
|
|
|
is(testPage.document.getElementById("testinput").value, enteredText2,
|
|
|
|
"text preserved in <input>");
|
|
|
|
|
|
|
|
testPage.close();
|
|
|
|
finish();
|
|
|
|
}
|
|
|
|
|
|
|
|
function url(spec) {
|
2010-04-02 00:20:42 -07:00
|
|
|
return Services.io.newURI(spec, null, null);
|
2007-11-11 12:03:33 -08:00
|
|
|
}
|