2010-11-20 11:53:14 -08:00
|
|
|
/* vim:set ts=2 sw=2 sts=2 et: */
|
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
|
|
|
* Any copyright is dedicated to the Public Domain.
|
|
|
|
* http://creativecommons.org/publicdomain/zero/1.0/
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
|
|
|
* Mihai Șucan <mihai.sucan@gmail.com>
|
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
|
|
|
|
2012-01-17 06:04:23 -08:00
|
|
|
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-bug-600183-charset.html";
|
2010-11-20 11:53:14 -08:00
|
|
|
|
2012-10-05 04:54:43 -07:00
|
|
|
function performTest(lastFinishedRequest, aConsole)
|
2010-11-20 11:53:14 -08:00
|
|
|
{
|
|
|
|
ok(lastFinishedRequest, "charset test page was loaded and logged");
|
2013-08-02 10:11:57 -07:00
|
|
|
HUDService.lastFinishedRequest.callback = null;
|
2010-11-20 11:53:14 -08:00
|
|
|
|
2013-04-09 02:46:30 -07:00
|
|
|
executeSoon(() => {
|
|
|
|
aConsole.webConsoleClient.getResponseContent(lastFinishedRequest.actor,
|
|
|
|
(aResponse) => {
|
|
|
|
ok(!aResponse.contentDiscarded, "response body was not discarded");
|
2010-11-20 11:53:14 -08:00
|
|
|
|
2013-04-09 02:46:30 -07:00
|
|
|
let body = aResponse.content.text;
|
|
|
|
ok(body, "we have the response body");
|
2012-10-05 04:54:43 -07:00
|
|
|
|
2013-04-09 02:46:30 -07:00
|
|
|
let chars = "\u7684\u95ee\u5019!"; // 的问候!
|
|
|
|
isnot(body.indexOf("<p>" + chars + "</p>"), -1,
|
|
|
|
"found the chinese simplified string");
|
2010-11-20 11:53:14 -08:00
|
|
|
|
2013-08-02 10:11:57 -07:00
|
|
|
HUDService.lastFinishedRequest.callback = null;
|
2013-04-09 02:46:30 -07:00
|
|
|
executeSoon(finishTest);
|
|
|
|
});
|
|
|
|
});
|
2010-11-20 11:53:14 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
function test()
|
|
|
|
{
|
2012-03-24 04:34:42 -07:00
|
|
|
addTab("data:text/html;charset=utf-8,Web Console - bug 600183 test");
|
2010-11-20 11:53:14 -08:00
|
|
|
|
2012-05-29 05:48:05 -07:00
|
|
|
browser.addEventListener("load", function onLoad() {
|
2012-10-05 04:54:43 -07:00
|
|
|
browser.removeEventListener("load", onLoad, true);
|
|
|
|
|
|
|
|
openConsole(null, function(hud) {
|
2013-06-26 13:35:39 -07:00
|
|
|
hud.ui.setSaveRequestAndResponseBodies(true).then(() => {
|
|
|
|
ok(hud.ui._saveRequestAndResponseBodies,
|
|
|
|
"The saveRequestAndResponseBodies property was successfully set.");
|
|
|
|
|
2013-08-02 10:11:57 -07:00
|
|
|
HUDService.lastFinishedRequest.callback = performTest;
|
2013-06-26 13:35:39 -07:00
|
|
|
content.location = TEST_URI;
|
2012-05-29 05:48:05 -07:00
|
|
|
});
|
2012-10-05 04:54:43 -07:00
|
|
|
});
|
2010-11-20 11:53:14 -08:00
|
|
|
}, true);
|
|
|
|
}
|