From b14ebf393e6f85aec284b854de9e21265a40deb0 Mon Sep 17 00:00:00 2001 From: Antonin Hildebrand Date: Mon, 20 Jun 2016 22:50:18 +0200 Subject: [PATCH] devtools: fix welcome message display It didn't display under some circumstances because WebInspector.context.flavor(WebInspector.ExecutionContext) returned null. --- .../unpacked/devtools/front_end/console/ConsoleView.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/resources/unpacked/devtools/front_end/console/ConsoleView.js b/resources/unpacked/devtools/front_end/console/ConsoleView.js index 825a244bf9..d1ed550017 100644 --- a/resources/unpacked/devtools/front_end/console/ConsoleView.js +++ b/resources/unpacked/devtools/front_end/console/ConsoleView.js @@ -1081,17 +1081,15 @@ WebInspector.ConsoleView.prototype = { * @return {boolean} */ appendDiracMarkup: function (markup) { - const executionContext = WebInspector.context.flavor(WebInspector.ExecutionContext); - if (!executionContext) { + const target = WebInspector.targetManager.mainTarget(); + if (!target) { return false; } - const target = executionContext.target(); const source = WebInspector.ConsoleMessage.MessageSource.Other; const level = WebInspector.ConsoleMessage.MessageLevel.Log; const type = WebInspector.ConsoleMessage.MessageType.DiracMarkup; const message = new WebInspector.ConsoleMessage(target, source, level, markup, type); - message.setExecutionContextId(executionContext.id); target.consoleModel.addMessage(message); return true; }, @@ -1109,7 +1107,9 @@ WebInspector.ConsoleView.prototype = { "Welcome to " + wrapBold("Dirac DevTools") + " hosted in " + wrapBold("Dirac Chrome Extension v" + dirac.getVersion()) + ".", "Use " + wrapCode("CTRL+,") + " and " + wrapCode("CTRL+.") + " to cycle between Javascript and Dirac prompts.", "In connected Dirac prompt, you can enter " + wrapCode("(dirac! :help)") + " for more info."]; - this.appendDiracMarkup(markup.join("\n")); + if (!this.appendDiracMarkup(markup.join("\n"))) { + console.warn("displayWelcomeMessage: unable to add console message"); + } }, _normalizePromptIndex: function(index) {