CLOSED TREE: TraceMonkey merge head. (a=blockers)
[mozilla-central.git] / docshell / test / browser / browser_bug92473.js
blob4947989c4627b1b103d2b4048752cf0da4f2377d
1 /* The test text decoded correctly as Shift_JIS */
2 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";
4 /* The test text decoded incorrectly as Windows-1251. This is the "right" wrong
5 text; anything else is unexpected. */
6 const wrongText="\u0453\u2020\u0453\u006A\u0453\u0052\u0403\u005B\u0453\u0068\u201A\u041D\u0403\u0041\u201A\u00B7\u201A\u0427\u201A\u0414\u201A\u041C\u2022\u00B6\u040B\u0459\u201A\u0419\u040A\u0415\u2014\u004C\u201A\u041C\u201D\u0424\u040C\u2020\u201A\u0440\u2022\u0074\u2014\u005E\u201A\u00B5\u201A\u042C\u201A\u00B7";
8 function testContent(text) {
9 is(gBrowser.contentDocument.getElementById("testpar").innerHTML, text,
10 "<p> contains expected text");
11 is(gBrowser.contentDocument.getElementById("testtextarea").innerHTML, text,
12 "<textarea> contains expected text");
13 is(gBrowser.contentDocument.getElementById("testinput").value, text,
14 "<input> contains expected text");
17 function afterOpen() {
18 gBrowser.selectedBrowser.removeEventListener("load", afterOpen, true);
19 gBrowser.selectedBrowser.addEventListener("load", afterChangeCharset, true);
21 /* Test that the content on load is the expected wrong decoding */
22 testContent(wrongText);
24 /* Force the page encoding to Shift_JIS */
25 SetForcedCharset("Shift_JIS");
28 function afterChangeCharset() {
29 gBrowser.selectedBrowser.removeEventListener("load", afterChangeCharset, true);
31 /* test that the content is decoded correctly */
32 testContent(rightText);
33 gBrowser.removeCurrentTab();
34 finish();
37 function test() {
38 waitForExplicitFinish();
40 var rootDir = getRootDirectory(gTestPath);
41 gBrowser.selectedTab = gBrowser.addTab(rootDir + "test-form_sjis.html");
42 gBrowser.selectedBrowser.addEventListener("load", afterOpen, true);