| Index: Source/devtools/front_end/sources/JavaScriptSourceFrame.js
|
| diff --git a/Source/devtools/front_end/sources/JavaScriptSourceFrame.js b/Source/devtools/front_end/sources/JavaScriptSourceFrame.js
|
| index 6c0bacdb7442dacf3d5c8388e5e46b8bd3f3021c..086445e4f31f307b4fa79d8c919c7a0db73496c2 100644
|
| --- a/Source/devtools/front_end/sources/JavaScriptSourceFrame.js
|
| +++ b/Source/devtools/front_end/sources/JavaScriptSourceFrame.js
|
| @@ -261,26 +261,37 @@ WebInspector.JavaScriptSourceFrame.prototype = {
|
| this._compiler.scheduleCompile();
|
| },
|
|
|
| + /**
|
| + * @override
|
| + * @return {!Promise}
|
| + */
|
| populateLineGutterContextMenu: function(contextMenu, lineNumber)
|
| {
|
| - var uiLocation = new WebInspector.UILocation(this._uiSourceCode, lineNumber, 0);
|
| - this._scriptsPanel.appendUILocationItems(contextMenu, uiLocation);
|
| - var breakpoint = this._breakpointManager.findBreakpointOnLine(this._uiSourceCode, lineNumber);
|
| - if (!breakpoint) {
|
| - // This row doesn't have a breakpoint: We want to show Add Breakpoint and Add and Edit Breakpoint.
|
| - contextMenu.appendItem(WebInspector.UIString.capitalize("Add ^breakpoint"), this._createNewBreakpoint.bind(this, lineNumber, 0, "", true));
|
| - contextMenu.appendItem(WebInspector.UIString.capitalize("Add ^conditional ^breakpoint…"), this._editBreakpointCondition.bind(this, lineNumber));
|
| - } else {
|
| - // This row has a breakpoint, we want to show edit and remove breakpoint, and either disable or enable.
|
| - contextMenu.appendItem(WebInspector.UIString.capitalize("Remove ^breakpoint"), breakpoint.remove.bind(breakpoint));
|
| - contextMenu.appendItem(WebInspector.UIString.capitalize("Edit ^breakpoint…"), this._editBreakpointCondition.bind(this, lineNumber, breakpoint));
|
| - if (breakpoint.enabled())
|
| - contextMenu.appendItem(WebInspector.UIString.capitalize("Disable ^breakpoint"), breakpoint.setEnabled.bind(breakpoint, false));
|
| - else
|
| - contextMenu.appendItem(WebInspector.UIString.capitalize("Enable ^breakpoint"), breakpoint.setEnabled.bind(breakpoint, true));
|
| - }
|
| + return new Promise((function(resolve, reject) {
|
| + var uiLocation = new WebInspector.UILocation(this._uiSourceCode, lineNumber, 0);
|
| + this._scriptsPanel.appendUILocationItems(contextMenu, uiLocation);
|
| + var breakpoint = this._breakpointManager.findBreakpointOnLine(this._uiSourceCode, lineNumber);
|
| + if (!breakpoint) {
|
| + // This row doesn't have a breakpoint: We want to show Add Breakpoint and Add and Edit Breakpoint.
|
| + contextMenu.appendItem(WebInspector.UIString.capitalize("Add ^breakpoint"), this._createNewBreakpoint.bind(this, lineNumber, 0, "", true));
|
| + contextMenu.appendItem(WebInspector.UIString.capitalize("Add ^conditional ^breakpoint…"), this._editBreakpointCondition.bind(this, lineNumber));
|
| + } else {
|
| + // This row has a breakpoint, we want to show edit and remove breakpoint, and either disable or enable.
|
| + contextMenu.appendItem(WebInspector.UIString.capitalize("Remove ^breakpoint"), breakpoint.remove.bind(breakpoint));
|
| + contextMenu.appendItem(WebInspector.UIString.capitalize("Edit ^breakpoint…"), this._editBreakpointCondition.bind(this, lineNumber, breakpoint));
|
| + if (breakpoint.enabled())
|
| + contextMenu.appendItem(WebInspector.UIString.capitalize("Disable ^breakpoint"), breakpoint.setEnabled.bind(breakpoint, false));
|
| + else
|
| + contextMenu.appendItem(WebInspector.UIString.capitalize("Enable ^breakpoint"), breakpoint.setEnabled.bind(breakpoint, true));
|
| + }
|
| + resolve();
|
| + }).bind(this));
|
| },
|
|
|
| + /**
|
| + * @override
|
| + * @return {!Promise}
|
| + */
|
| populateTextAreaContextMenu: function(contextMenu, lineNumber, columnNumber)
|
| {
|
| var textSelection = this.textEditor.selection();
|
| @@ -313,16 +324,16 @@ WebInspector.JavaScriptSourceFrame.prototype = {
|
| scriptFile.addSourceMapURL(url);
|
| }
|
|
|
| - WebInspector.UISourceCodeFrame.prototype.populateTextAreaContextMenu.call(this, contextMenu, lineNumber, columnNumber);
|
| -
|
| - if (this._uiSourceCode.project().type() === WebInspector.projectTypes.Network && WebInspector.moduleSetting("jsSourceMapsEnabled").get()) {
|
| - if (this._scriptFileForTarget.size) {
|
| - var scriptFile = this._scriptFileForTarget.valuesArray()[0];
|
| - var addSourceMapURLLabel = WebInspector.UIString.capitalize("Add ^source ^map\u2026");
|
| - contextMenu.appendItem(addSourceMapURLLabel, addSourceMapURL.bind(this, scriptFile));
|
| - contextMenu.appendSeparator();
|
| + return WebInspector.UISourceCodeFrame.prototype.populateTextAreaContextMenu.call(this, contextMenu, lineNumber, columnNumber).then((function() {
|
| + if (this._uiSourceCode.project().type() === WebInspector.projectTypes.Network && WebInspector.moduleSetting("jsSourceMapsEnabled").get()) {
|
| + if (this._scriptFileForTarget.size) {
|
| + var scriptFile = this._scriptFileForTarget.valuesArray()[0];
|
| + var addSourceMapURLLabel = WebInspector.UIString.capitalize("Add ^source ^map\u2026");
|
| + contextMenu.appendItem(addSourceMapURLLabel, addSourceMapURL.bind(this, scriptFile));
|
| + contextMenu.appendSeparator();
|
| + }
|
| }
|
| - }
|
| + }).bind(this));
|
| },
|
|
|
| _workingCopyChanged: function(event)
|
| @@ -394,7 +405,8 @@ WebInspector.JavaScriptSourceFrame.prototype = {
|
| var compileError = errorData.compileError;
|
| if (compileError) {
|
| var messageText = WebInspector.UIString("LiveEdit compile failed: %s", compileError.message);
|
| - var message = new WebInspector.SourceFrameMessage(messageText, WebInspector.SourceFrameMessage.Level.Error, compileError.lineNumber - 1, compileError.columnNumber + 1);
|
| + var location = {line: compileError.lineNumber - 1, column: compileError.columnNumber + 1};
|
| + var message = new WebInspector.SourceFrameMessage(messageText, WebInspector.SourceFrameMessage.Level.Error, location, location);
|
| this.addMessageToSource(message);
|
| } else {
|
| WebInspector.console.addMessage(WebInspector.UIString("Unknown LiveEdit error: %s; %s", JSON.stringify(errorData), error), warningLevel);
|
|
|