docshell/test/browser/browser_bug234628-1.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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 }

mercurial