mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1232615 - Properly parse server logs without a label. r=jryans
This commit is contained in:
parent
03a46106e1
commit
808c6c0ebc
@ -74,6 +74,7 @@ support-files =
|
||||
test-console-extras.html
|
||||
test-console-replaced-api.html
|
||||
test-console-server-logging.sjs
|
||||
test-console-server-logging-array.sjs
|
||||
test-console.html
|
||||
test-console-workers.html
|
||||
test-console-table.html
|
||||
|
@ -37,6 +37,37 @@ add_task(function* () {
|
||||
yield updateServerLoggingListener(hud);
|
||||
});
|
||||
|
||||
add_task(function* () {
|
||||
const TEST_URI = "http://example.com/browser/devtools/client/webconsole/test/test-console-server-logging-array.sjs";
|
||||
|
||||
yield loadTab(TEST_URI);
|
||||
|
||||
let hud = yield openConsole();
|
||||
|
||||
// Set logging filter and wait till it's set on the backend
|
||||
hud.setFilterState("serverlog", true);
|
||||
yield updateServerLoggingListener(hud);
|
||||
|
||||
BrowserReloadSkipCache();
|
||||
|
||||
// Note that the test is also checking out the (printf like)
|
||||
// formatters and encoding of UTF8 characters (see the one at the end).
|
||||
let text = "Object { best: \"Firefox\", reckless: \"Chrome\", new_ie: \"Safari\", new_new_ie: \"Edge\" }";
|
||||
|
||||
yield waitForMessages({
|
||||
webconsole: hud,
|
||||
messages: [{
|
||||
text: text,
|
||||
category: CATEGORY_SERVER,
|
||||
severity: SEVERITY_LOG,
|
||||
}],
|
||||
})
|
||||
|
||||
// Clean up filter
|
||||
hud.setFilterState("serverlog", false);
|
||||
yield updateServerLoggingListener(hud);
|
||||
});
|
||||
|
||||
function updateServerLoggingListener(hud) {
|
||||
let deferred = promise.defer();
|
||||
hud.ui._updateServerLoggingListener(response => {
|
||||
|
@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
|
||||
function handleRequest(request, response)
|
||||
{
|
||||
var page = "<!DOCTYPE html><html>" +
|
||||
"<head><meta charset='utf-8'></head>" +
|
||||
"<body><p>hello world!</p></body>" +
|
||||
"</html>";
|
||||
|
||||
var data = {
|
||||
"version": "4.1.0",
|
||||
"columns": ["log", "backtrace", "type"],
|
||||
"rows":[[
|
||||
[{ "best": "Firefox", "reckless": "Chrome", "new_ie": "Safari", "new_new_ie": "Edge"}],
|
||||
"C:\\src\\www\\serverlogging\\test7.php:4:1",
|
||||
""
|
||||
]],
|
||||
};
|
||||
|
||||
// Put log into headers.
|
||||
var value = b64EncodeUnicode(JSON.stringify(data));
|
||||
response.setHeader("X-ChromeLogger-Data", value, false);
|
||||
|
||||
response.write(page);
|
||||
}
|
||||
|
||||
function b64EncodeUnicode(str) {
|
||||
return btoa(unescape(encodeURIComponent(str)));
|
||||
}
|
@ -408,7 +408,15 @@ function format(msg) {
|
||||
msg.styles = [];
|
||||
|
||||
// Remove and get the first log (in which the specifiers are).
|
||||
let firstString = msg.logs.shift();
|
||||
// Note that the first string doesn't have to be specified.
|
||||
// An example of a log on the server side:
|
||||
// ChromePhp::log("server info: ", $_SERVER);
|
||||
// ChromePhp::log($_SERVER);
|
||||
let firstString = "";
|
||||
if (typeof msg.logs[0] == "string") {
|
||||
firstString = msg.logs.shift();
|
||||
}
|
||||
|
||||
// All the specifiers present in the first string.
|
||||
let splitLogRegExp = /(.*?)(%[oOcsdif]|$)/g;
|
||||
let splitLogRegExpRes;
|
||||
|
Loading…
Reference in New Issue
Block a user