Index: Source/devtools/front_end/source_frame/CodeMirrorTextEditor.js |
diff --git a/Source/devtools/front_end/source_frame/CodeMirrorTextEditor.js b/Source/devtools/front_end/source_frame/CodeMirrorTextEditor.js |
index a01ac5e079b1be234d130ac3d6b6208a6a4e499a..fef9b534c297456d5bb86583b728ba7b0cbe003c 100644 |
--- a/Source/devtools/front_end/source_frame/CodeMirrorTextEditor.js |
+++ b/Source/devtools/front_end/source_frame/CodeMirrorTextEditor.js |
@@ -956,6 +956,13 @@ WebInspector.CodeMirrorTextEditor.prototype = { |
}, |
/** |
+ * @return {string} |
+ */ |
+ mimeType: function() { |
+ return this._mimeType; |
+ }, |
+ |
+ /** |
* @param {boolean} readOnly |
*/ |
setReadOnly: function(readOnly) |
@@ -1058,15 +1065,22 @@ WebInspector.CodeMirrorTextEditor.prototype = { |
_contextMenu: function(event) |
{ |
var contextMenu = new WebInspector.ContextMenu(event); |
+ event.consume(true); //Consume event now to prevent document from handling the async menu |
var target = event.target.enclosingNodeOrSelfWithClass("CodeMirror-gutter-elt"); |
+ var prom; |
if (target) |
- this._delegate.populateLineGutterContextMenu(contextMenu, parseInt(target.textContent, 10) - 1); |
+ prom = this._delegate.populateLineGutterContextMenu(contextMenu, parseInt(target.textContent, 10) - 1); |
else { |
var textSelection = this.selection(); |
- this._delegate.populateTextAreaContextMenu(contextMenu, textSelection.startLine, textSelection.startColumn); |
+ prom = this._delegate.populateTextAreaContextMenu(contextMenu, textSelection.startLine, textSelection.startColumn); |
+ } |
+ |
+ prom.then(showAsync, showAsync); |
+ var _this = this; |
+ function showAsync() { |
+ contextMenu.appendApplicableItems(_this); |
+ contextMenu.show(); |
} |
- contextMenu.appendApplicableItems(this); |
- contextMenu.show(); |
}, |
/** |
@@ -1537,6 +1551,14 @@ WebInspector.CodeMirrorTextEditor.prototype = { |
}, |
/** |
+ * @return {?string} |
+ */ |
+ url: function() |
+ { |
+ return this._url; |
+ }, |
+ |
+ /** |
* @param {number} line |
* @param {string} name |
* @param {?Object} value |
@@ -2164,6 +2186,7 @@ WebInspector.TextEditorDelegate.prototype = { |
/** |
* @param {!WebInspector.ContextMenu} contextMenu |
* @param {number} lineNumber |
+ * @return {!Promise} |
*/ |
populateLineGutterContextMenu: function(contextMenu, lineNumber) { }, |
@@ -2171,6 +2194,7 @@ WebInspector.TextEditorDelegate.prototype = { |
* @param {!WebInspector.ContextMenu} contextMenu |
* @param {number} lineNumber |
* @param {number} columnNumber |
+ * @return {!Promise} |
*/ |
populateTextAreaContextMenu: function(contextMenu, lineNumber, columnNumber) { }, |