Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(894)

Unified Diff: third_party/WebKit/Source/devtools/front_end/ui/SuggestBox.js

Issue 1760093003: [DevTools] Prepare UI module for closure compiler roll (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@remove-array-from
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/devtools/front_end/ui/SuggestBox.js
diff --git a/third_party/WebKit/Source/devtools/front_end/ui/SuggestBox.js b/third_party/WebKit/Source/devtools/front_end/ui/SuggestBox.js
index a6e2903d948d3a9a25e72f293d7aa2f70a5f8e26..7396c43b46c11ced49b1d8419e7c71970a7a7e5e 100644
--- a/third_party/WebKit/Source/devtools/front_end/ui/SuggestBox.js
+++ b/third_party/WebKit/Source/devtools/front_end/ui/SuggestBox.js
@@ -67,7 +67,8 @@ WebInspector.SuggestBox = function(suggestBoxDelegate, maxItemsHeight)
this._detailsPopup = this._container.createChild("div", "suggest-box details-popup monospace");
this._detailsPopup.classList.add("hidden");
this._asyncDetailsCallback = null;
- this._asyncDetailsPromises = /** @type {!Map<number, !Promise>} */ ({});
+ /** @type {!Map<number, !Promise<{detail: string, description: string}>>} */
+ this._asyncDetailsPromises = new Map();
}
WebInspector.SuggestBox.prototype = {
@@ -265,7 +266,7 @@ WebInspector.SuggestBox.prototype = {
_updateItems: function(items, userEnteredText, asyncDetails)
{
this._length = items.length;
- this._asyncDetailsPromises = {};
+ this._asyncDetailsPromises.clear();
this._asyncDetailsCallback = asyncDetails;
this._element.removeChildren();
delete this._selectedElement;
@@ -279,15 +280,15 @@ WebInspector.SuggestBox.prototype = {
/**
* @param {number} index
- * @return {!Promise<({detail: string, description: string}|undefined)>}
+ * @return {!Promise<{detail: string, description: string}>|!Promise<undefined>}
lushnikov 2016/03/04 00:42:44 use null instead
kozy 2016/03/04 00:50:11 Done.
*/
_asyncDetails: function(index)
{
if (!this._asyncDetailsCallback)
return Promise.resolve();
- if (!this._asyncDetailsPromises[index])
- this._asyncDetailsPromises[index] = this._asyncDetailsCallback(index);
- return this._asyncDetailsPromises[index];
+ if (!this._asyncDetailsPromises.has(index))
+ this._asyncDetailsPromises.set(index, this._asyncDetailsCallback(index));
+ return /** @type {!Promise<{detail: string, description: string}>} */(this._asyncDetailsPromises.get(index));
},
/**

Powered by Google App Engine
This is Rietveld 408576698