From 652cfe631693df67d5bd87f911151e22fe50ec37 Mon Sep 17 00:00:00 2001 From: Oriol Date: Mon, 15 May 2017 16:47:00 -0400 Subject: [PATCH] Bug 1297466 - Do not attempt to open Function.prototype in Debugger. r=bgrins --HG-- extra : rebase_source : fed13d5c980f853c313d6b62a7812af538bd79cb --- devtools/client/webconsole/console-output.js | 6 ++--- .../test/browser_console_variables_view.js | 24 +++++++++++++++++++ 2 files changed, 27 insertions(+), 3 deletions(-) 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");