Skip to content

Commit

Permalink
devtools: fix welcome message display
Browse files Browse the repository at this point in the history
It didn't display under some circumstances because
WebInspector.context.flavor(WebInspector.ExecutionContext)
returned null.
  • Loading branch information
darwin committed Jun 20, 2016
1 parent d4f8deb commit b14ebf3
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions resources/unpacked/devtools/front_end/console/ConsoleView.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
},
Expand All @@ -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) {
Expand Down

0 comments on commit b14ebf3

Please sign in to comment.