Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | function test() { |
michael@0 | 2 | waitForExplicitFinish(); |
michael@0 | 3 | |
michael@0 | 4 | var rootDir = "http://mochi.test:8888/browser/docshell/test/browser/"; |
michael@0 | 5 | gBrowser.selectedTab = gBrowser.addTab(rootDir + "file_bug234628-1.html"); |
michael@0 | 6 | gBrowser.selectedBrowser.addEventListener("load", afterOpen, true); |
michael@0 | 7 | } |
michael@0 | 8 | |
michael@0 | 9 | function afterOpen(event) { |
michael@0 | 10 | if (event.target != gBrowser.contentDocument) { |
michael@0 | 11 | return; |
michael@0 | 12 | } |
michael@0 | 13 | |
michael@0 | 14 | gBrowser.selectedBrowser.removeEventListener("load", afterOpen, true); |
michael@0 | 15 | gBrowser.selectedBrowser.addEventListener("load", afterChangeCharset, true); |
michael@0 | 16 | |
michael@0 | 17 | is(gBrowser.contentDocument.documentElement.textContent.indexOf('\u20AC'), 129, "Parent doc should be windows-1252 initially"); |
michael@0 | 18 | |
michael@0 | 19 | is(gBrowser.contentDocument.getElementsByTagName("iframe")[0].contentDocument.documentElement.textContent.indexOf('\u20AC'), 85, "Child doc should be windows-1252 initially"); |
michael@0 | 20 | |
michael@0 | 21 | BrowserSetForcedCharacterSet("windows-1251"); |
michael@0 | 22 | } |
michael@0 | 23 | |
michael@0 | 24 | function afterChangeCharset(event) { |
michael@0 | 25 | if (event.target != gBrowser.contentDocument) { |
michael@0 | 26 | return; |
michael@0 | 27 | } |
michael@0 | 28 | |
michael@0 | 29 | gBrowser.selectedBrowser.removeEventListener("load", afterChangeCharset, true); |
michael@0 | 30 | |
michael@0 | 31 | is(gBrowser.contentDocument.documentElement.textContent.indexOf('\u0402'), 129, "Parent doc should decode as windows-1251 subsequently"); |
michael@0 | 32 | is(gBrowser.contentDocument.getElementsByTagName("iframe")[0].contentDocument.documentElement.textContent.indexOf('\u0402'), 85, "Child doc should decode as windows-1251 subsequently"); |
michael@0 | 33 | |
michael@0 | 34 | is(gBrowser.contentDocument.characterSet, "windows-1251", "Parent doc should report windows-1251 subsequently"); |
michael@0 | 35 | is(gBrowser.contentDocument.getElementsByTagName("iframe")[0].contentDocument.characterSet, "windows-1251", "Child doc should report windows-1251 subsequently"); |
michael@0 | 36 | |
michael@0 | 37 | gBrowser.removeCurrentTab(); |
michael@0 | 38 | finish(); |
michael@0 | 39 | } |