Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* vim:set ts=2 sw=2 sts=2 et: */ |
michael@0 | 2 | /* ***** BEGIN LICENSE BLOCK ***** |
michael@0 | 3 | * Any copyright is dedicated to the Public Domain. |
michael@0 | 4 | * http://creativecommons.org/publicdomain/zero/1.0/ |
michael@0 | 5 | * |
michael@0 | 6 | * Contributor(s): |
michael@0 | 7 | * Mihai Șucan <mihai.sucan@gmail.com> |
michael@0 | 8 | * |
michael@0 | 9 | * ***** END LICENSE BLOCK ***** */ |
michael@0 | 10 | |
michael@0 | 11 | const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-bug-600183-charset.html"; |
michael@0 | 12 | |
michael@0 | 13 | function performTest(lastFinishedRequest, aConsole) |
michael@0 | 14 | { |
michael@0 | 15 | ok(lastFinishedRequest, "charset test page was loaded and logged"); |
michael@0 | 16 | HUDService.lastFinishedRequest.callback = null; |
michael@0 | 17 | |
michael@0 | 18 | executeSoon(() => { |
michael@0 | 19 | aConsole.webConsoleClient.getResponseContent(lastFinishedRequest.actor, |
michael@0 | 20 | (aResponse) => { |
michael@0 | 21 | ok(!aResponse.contentDiscarded, "response body was not discarded"); |
michael@0 | 22 | |
michael@0 | 23 | let body = aResponse.content.text; |
michael@0 | 24 | ok(body, "we have the response body"); |
michael@0 | 25 | |
michael@0 | 26 | let chars = "\u7684\u95ee\u5019!"; // 的问候! |
michael@0 | 27 | isnot(body.indexOf("<p>" + chars + "</p>"), -1, |
michael@0 | 28 | "found the chinese simplified string"); |
michael@0 | 29 | |
michael@0 | 30 | HUDService.lastFinishedRequest.callback = null; |
michael@0 | 31 | executeSoon(finishTest); |
michael@0 | 32 | }); |
michael@0 | 33 | }); |
michael@0 | 34 | } |
michael@0 | 35 | |
michael@0 | 36 | function test() |
michael@0 | 37 | { |
michael@0 | 38 | addTab("data:text/html;charset=utf-8,Web Console - bug 600183 test"); |
michael@0 | 39 | |
michael@0 | 40 | browser.addEventListener("load", function onLoad() { |
michael@0 | 41 | browser.removeEventListener("load", onLoad, true); |
michael@0 | 42 | |
michael@0 | 43 | openConsole(null, function(hud) { |
michael@0 | 44 | hud.ui.setSaveRequestAndResponseBodies(true).then(() => { |
michael@0 | 45 | ok(hud.ui._saveRequestAndResponseBodies, |
michael@0 | 46 | "The saveRequestAndResponseBodies property was successfully set."); |
michael@0 | 47 | |
michael@0 | 48 | HUDService.lastFinishedRequest.callback = performTest; |
michael@0 | 49 | content.location = TEST_URI; |
michael@0 | 50 | }); |
michael@0 | 51 | }); |
michael@0 | 52 | }, true); |
michael@0 | 53 | } |