browser/devtools/webconsole/test/browser_webconsole_bug_600183_charset.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.

     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 ***** */
    11 const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-bug-600183-charset.html";
    13 function performTest(lastFinishedRequest, aConsole)
    14 {
    15   ok(lastFinishedRequest, "charset test page was loaded and logged");
    16   HUDService.lastFinishedRequest.callback = null;
    18   executeSoon(() => {
    19     aConsole.webConsoleClient.getResponseContent(lastFinishedRequest.actor,
    20       (aResponse) => {
    21         ok(!aResponse.contentDiscarded, "response body was not discarded");
    23         let body = aResponse.content.text;
    24         ok(body, "we have the response body");
    26         let chars = "\u7684\u95ee\u5019!"; // 的问候!
    27         isnot(body.indexOf("<p>" + chars + "</p>"), -1,
    28           "found the chinese simplified string");
    30         HUDService.lastFinishedRequest.callback = null;
    31         executeSoon(finishTest);
    32       });
    33   });
    34 }
    36 function test()
    37 {
    38   addTab("data:text/html;charset=utf-8,Web Console - bug 600183 test");
    40   browser.addEventListener("load", function onLoad() {
    41     browser.removeEventListener("load", onLoad, true);
    43     openConsole(null, function(hud) {
    44       hud.ui.setSaveRequestAndResponseBodies(true).then(() => {
    45         ok(hud.ui._saveRequestAndResponseBodies,
    46           "The saveRequestAndResponseBodies property was successfully set.");
    48         HUDService.lastFinishedRequest.callback = performTest;
    49         content.location = TEST_URI;
    50       });
    51     });
    52   }, true);
    53 }

mercurial