browser/devtools/webconsole/test/browser_webconsole_bug_600183_charset.js

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

mercurial