Chromium Code Reviews| Index: third_party/WebKit/Source/devtools/front_end/ui/ContextMenu.js |
| diff --git a/third_party/WebKit/Source/devtools/front_end/ui/ContextMenu.js b/third_party/WebKit/Source/devtools/front_end/ui/ContextMenu.js |
| index 16f51444c17c05de24247a83761837575339a2d0..1b88e3339c525771e280c64cf6b90e4817ca7242 100644 |
| --- a/third_party/WebKit/Source/devtools/front_end/ui/ContextMenu.js |
| +++ b/third_party/WebKit/Source/devtools/front_end/ui/ContextMenu.js |
| @@ -350,16 +350,24 @@ WebInspector.ContextMenu.prototype = { |
| return this._id++; |
| }, |
| + /** |
| + * @param {function()} callback |
| + */ |
| + beforeShow: function(callback) |
| + { |
| + this._beforeShow = callback; |
| + }, |
| + |
| show: function() |
| { |
| - Promise.all(this._pendingPromises).then(populateAndShow.bind(this)); |
| + Promise.all(this._pendingPromises).then(populate.bind(this)).then(this._innerShow.bind(this)); |
| WebInspector.ContextMenu._pendingMenu = this; |
| /** |
| * @param {!Array.<!Array.<!WebInspector.ContextMenu.Provider>>} appendCallResults |
| * @this {WebInspector.ContextMenu} |
| */ |
| - function populateAndShow(appendCallResults) |
| + function populate(appendCallResults) |
| { |
| if (WebInspector.ContextMenu._pendingMenu !== this) |
| return; |
| @@ -379,7 +387,6 @@ WebInspector.ContextMenu.prototype = { |
| this._pendingPromises = []; |
| this._pendingTargets = []; |
| - this._innerShow(); |
| } |
| this._event.consume(true); |
| @@ -393,6 +400,9 @@ WebInspector.ContextMenu.prototype = { |
| _innerShow: function() |
| { |
| + if (typeof this._beforeShow === "function") |
| + this._beforeShow(); |
|
dgozman
2016/05/18 23:56:32
delete this._beforeShow;
luoe
2016/05/19 00:04:58
Done.
|
| + |
| var menuObject = this._buildDescriptors(); |
| WebInspector._contextMenu = this; |