diff --git a/devtools/client/webconsole/console-output.js b/devtools/client/webconsole/console-output.js index a87f742e22ba..8a8e7f442c46 100644 --- a/devtools/client/webconsole/console-output.js +++ b/devtools/client/webconsole/console-output.js @@ -2705,10 +2705,10 @@ Widgets.ObjectRenderers.add({ _onClick: function () { let location = this.objectActor.location; - if (location && IGNORED_SOURCE_URLS.indexOf(location.url) === -1) { + let url = location && location.url; + if (url && IGNORED_SOURCE_URLS.indexOf(url) === -1) { this.output.openLocationInDebugger(location); - } - else { + } else { this.openObjectInVariablesView(); } } diff --git a/devtools/client/webconsole/test/browser_console_variables_view.js b/devtools/client/webconsole/test/browser_console_variables_view.js index ecd8071ce5fc..811e7de5ff67 100644 --- a/devtools/client/webconsole/test/browser_console_variables_view.js +++ b/devtools/client/webconsole/test/browser_console_variables_view.js @@ -40,6 +40,30 @@ add_task(function* () { }], { webconsole: hud }); }); +add_task(function* () { + yield loadTab(TEST_URI); + + hud = yield openConsole(); + + let msg = yield hud.jsterm.execute("Function.prototype"); + + ok(msg, "output message found"); + ok(msg.textContent.includes("function ()"), + "message text check"); + + executeSoon(() => { + EventUtils.synthesizeMouse(msg.querySelector("a"), 2, 2, {}, hud.iframeWindow); + }); + + let varView = yield hud.jsterm.once("variablesview-fetched"); + ok(varView, "object inspector opened on click"); + + yield findVariableViewProperties(varView, [{ + name: "constructor", + value: "Function()", + }], { webconsole: hud }); +}); + add_task(function* () { let msg = yield hud.jsterm.execute("fooObj");