mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-13 05:15:45 +00:00
Bug 1499533 - Fix console log stringifying bug in webcompat reporter; r=miketaylr
Fix console log stringifying bug in webcompat reporter Differential Revision: https://phabricator.services.mozilla.com/D8984 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
116bfa4345
commit
832717d698
@ -47,8 +47,8 @@ function getInfoFrameScript(messageName) {
|
||||
return messages.map(evt => {
|
||||
const {columnNumber, filename, level, lineNumber, timeStamp} = evt;
|
||||
const args = evt.arguments.map(arg => {
|
||||
return arg.toString();
|
||||
});
|
||||
return "" + arg;
|
||||
}).join(", ");
|
||||
const message = `[console.${level}(${args}) ${filename}:${lineNumber}:${columnNumber}]`;
|
||||
return {timeStamp, message};
|
||||
});
|
||||
|
@ -61,6 +61,9 @@ add_task(async function test_opened_page() {
|
||||
const details = JSON.parse(detailsParam);
|
||||
ok(typeof details == "object", "Details param is a stringified JSON object.");
|
||||
ok(Array.isArray(details.consoleLog), "Details has a consoleLog array.");
|
||||
ok(details.consoleLog[0].match(/console\.log\(null\)[\s\S]*test.html:\d+:\d+/m), "Can handle degenerate console logs");
|
||||
ok(details.consoleLog[1].match(/console\.error\(colored message\)[\s\S]*test.html:\d+:\d+/m), "Can handle fancy console logs");
|
||||
ok(details.consoleLog[2].match(/document\.access is undefined[\s\S]*test.html:\d+:\d+/m), "Script errors are logged");
|
||||
ok(typeof details.buildID == "string", "Details has a buildID string.");
|
||||
ok(typeof details.channel == "string", "Details has a channel string.");
|
||||
ok(typeof details.hasTouchScreen == "boolean", "Details has a hasTouchScreen flag.");
|
||||
|
@ -1,5 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<script>
|
||||
/* eslint-disable no-console */
|
||||
/* eslint-disable no-unused-expressions */
|
||||
"use strict";
|
||||
console.log(null);
|
||||
console.error("%ccolored message", "background:green; color:white");
|
||||
document.access.non.existent.property.to.trigger.error;
|
||||
</script>
|
||||
<style>
|
||||
body {background: rgb(0, 128, 0);}
|
||||
</style>
|
||||
|
Loading…
Reference in New Issue
Block a user