1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/browser/devtools/webconsole/test/browser_webconsole_bug_600183_charset.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,53 @@ 1.4 +/* vim:set ts=2 sw=2 sts=2 et: */ 1.5 +/* ***** BEGIN LICENSE BLOCK ***** 1.6 + * Any copyright is dedicated to the Public Domain. 1.7 + * http://creativecommons.org/publicdomain/zero/1.0/ 1.8 + * 1.9 + * Contributor(s): 1.10 + * Mihai Șucan <mihai.sucan@gmail.com> 1.11 + * 1.12 + * ***** END LICENSE BLOCK ***** */ 1.13 + 1.14 +const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-bug-600183-charset.html"; 1.15 + 1.16 +function performTest(lastFinishedRequest, aConsole) 1.17 +{ 1.18 + ok(lastFinishedRequest, "charset test page was loaded and logged"); 1.19 + HUDService.lastFinishedRequest.callback = null; 1.20 + 1.21 + executeSoon(() => { 1.22 + aConsole.webConsoleClient.getResponseContent(lastFinishedRequest.actor, 1.23 + (aResponse) => { 1.24 + ok(!aResponse.contentDiscarded, "response body was not discarded"); 1.25 + 1.26 + let body = aResponse.content.text; 1.27 + ok(body, "we have the response body"); 1.28 + 1.29 + let chars = "\u7684\u95ee\u5019!"; // 的问候! 1.30 + isnot(body.indexOf("<p>" + chars + "</p>"), -1, 1.31 + "found the chinese simplified string"); 1.32 + 1.33 + HUDService.lastFinishedRequest.callback = null; 1.34 + executeSoon(finishTest); 1.35 + }); 1.36 + }); 1.37 +} 1.38 + 1.39 +function test() 1.40 +{ 1.41 + addTab("data:text/html;charset=utf-8,Web Console - bug 600183 test"); 1.42 + 1.43 + browser.addEventListener("load", function onLoad() { 1.44 + browser.removeEventListener("load", onLoad, true); 1.45 + 1.46 + openConsole(null, function(hud) { 1.47 + hud.ui.setSaveRequestAndResponseBodies(true).then(() => { 1.48 + ok(hud.ui._saveRequestAndResponseBodies, 1.49 + "The saveRequestAndResponseBodies property was successfully set."); 1.50 + 1.51 + HUDService.lastFinishedRequest.callback = performTest; 1.52 + content.location = TEST_URI; 1.53 + }); 1.54 + }); 1.55 + }, true); 1.56 +}