|
1 function test() { |
|
2 waitForExplicitFinish(); |
|
3 |
|
4 var rootDir = "http://mochi.test:8888/browser/docshell/test/browser/"; |
|
5 gBrowser.selectedTab = gBrowser.addTab(rootDir + "file_bug234628-6.html"); |
|
6 gBrowser.selectedBrowser.addEventListener("load", afterOpen, true); |
|
7 } |
|
8 |
|
9 function afterOpen(event) { |
|
10 if (event.target != gBrowser.contentDocument) { |
|
11 return; |
|
12 } |
|
13 |
|
14 gBrowser.selectedBrowser.removeEventListener("load", afterOpen, true); |
|
15 gBrowser.selectedBrowser.addEventListener("load", afterChangeCharset, true); |
|
16 |
|
17 is(gBrowser.contentDocument.documentElement.textContent.indexOf('\u20AC'), 190, "Parent doc should be windows-1252 initially"); |
|
18 |
|
19 is(gBrowser.contentDocument.getElementsByTagName("iframe")[0].contentDocument.documentElement.textContent.indexOf('\u20AC'), 109, "Child doc should be utf-16 initially"); |
|
20 |
|
21 BrowserSetForcedCharacterSet("windows-1251"); |
|
22 } |
|
23 |
|
24 function afterChangeCharset(event) { |
|
25 if (event.target != gBrowser.contentDocument) { |
|
26 return; |
|
27 } |
|
28 |
|
29 gBrowser.selectedBrowser.removeEventListener("load", afterChangeCharset, true); |
|
30 |
|
31 is(gBrowser.contentDocument.documentElement.textContent.indexOf('\u0402'), 190, "Parent doc should decode as windows-1251 subsequently"); |
|
32 is(gBrowser.contentDocument.getElementsByTagName("iframe")[0].contentDocument.documentElement.textContent.indexOf('\u20AC'), 109, "Child doc should decode as utf-16 subsequently"); |
|
33 |
|
34 is(gBrowser.contentDocument.characterSet, "windows-1251", "Parent doc should report windows-1251 subsequently"); |
|
35 is(gBrowser.contentDocument.getElementsByTagName("iframe")[0].contentDocument.characterSet, "UTF-16BE", "Child doc should report UTF-16 subsequently"); |
|
36 |
|
37 gBrowser.removeCurrentTab(); |
|
38 finish(); |
|
39 } |