Bug 1383208 - Allow for null functionName in console messages;r=baku
authorBrian Grinstead <bgrinstead@mozilla.com>
Wed, 26 Jul 2017 15:14:07 -0700
changeset 371466 1bb99bce4b89dadfd41eee201cf1ea340a504ea2
parent 371465 fcd8bb8c31f75fcf821536a9a20f42437199797c
child 371467 b18177e6556b8e31b3b0900aed456d8a2698792d
push id32249
push usercbook@mozilla.com
push dateFri, 28 Jul 2017 13:23:04 +0000
treeherdermozilla-central@09a412e3cc3b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku
bugs1383208
milestone56.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1383208 - Allow for null functionName in console messages;r=baku MozReview-Commit-ID: 47O6kPQ3W8o
devtools/client/webconsole/test/browser_console.js
toolkit/components/processsingleton/ContentProcessSingleton.js
--- a/devtools/client/webconsole/test/browser_console.js
+++ b/devtools/client/webconsole/test/browser_console.js
@@ -62,16 +62,22 @@ function testMessages(hud) {
   Cu.nukeSandbox(sandbox);
 
   // Add a message from a content window.
   content.console.log("bug587757b");
 
   // Test eval.
   hud.jsterm.execute("document.location.href");
 
+  // Test eval frame script
+  hud.jsterm.execute(`
+    gBrowser.selectedBrowser.messageManager.loadFrameScript('data:application/javascript,console.log("framescript-message")', false);
+    "framescript-eval";
+  `);
+
   // Check for network requests.
   let xhr = new XMLHttpRequest();
   xhr.onload = () => console.log("xhr loaded, status is: " + xhr.status);
   xhr.open("get", TEST_URI, true);
   xhr.send();
 
   // Check for xhr error.
   let xhrErr = new XMLHttpRequest();
@@ -124,16 +130,28 @@ function testMessages(hud) {
       },
       {
         name: "jsterm eval result",
         text: "browser.xul",
         category: CATEGORY_OUTPUT,
         severity: SEVERITY_LOG,
       },
       {
+        name: "jsterm eval result 2",
+        text: "framescript-eval",
+        category: CATEGORY_OUTPUT,
+        severity: SEVERITY_LOG,
+      },
+      {
+        name: "frame script message",
+        text: "framescript-message",
+        category: CATEGORY_WEBDEV,
+        severity: SEVERITY_LOG,
+      },
+      {
         name: "exception message",
         text: "foobarExceptionBug587757",
         category: CATEGORY_JS,
         severity: SEVERITY_ERROR,
       },
       {
         name: "network message",
         text: "test-console.html",
--- a/toolkit/components/processsingleton/ContentProcessSingleton.js
+++ b/toolkit/components/processsingleton/ContentProcessSingleton.js
@@ -54,18 +54,18 @@ ContentProcessSingleton.prototype = {
     }
     case "console-api-log-event": {
       let consoleMsg = subject.wrappedJSObject;
 
       let msgData = {
         level: consoleMsg.level,
         filename: consoleMsg.filename.substring(0, MSG_MGR_CONSOLE_INFO_MAX),
         lineNumber: consoleMsg.lineNumber,
-        functionName: consoleMsg.functionName.substring(0,
-          MSG_MGR_CONSOLE_INFO_MAX),
+        functionName: consoleMsg.functionName &&
+          consoleMsg.functionName.substring(0, MSG_MGR_CONSOLE_INFO_MAX),
         timeStamp: consoleMsg.timeStamp,
         addonId: consoleMsg.addonId,
         arguments: [],
       };
 
       // We can't send objects over the message manager, so we sanitize
       // them out, replacing those arguments with "<unavailable>".
       let unavailString = "<unavailable>";