| Index: third_party/WebKit/Source/devtools/front_end/common/StaticContentProvider.js
|
| diff --git a/third_party/WebKit/Source/devtools/front_end/common/StaticContentProvider.js b/third_party/WebKit/Source/devtools/front_end/common/StaticContentProvider.js
|
| index ec6c6b2d1aa6e981127e9fb9c179d89ebc785725..afe68e92775a5d03e6a216098174d6f7feea1e13 100644
|
| --- a/third_party/WebKit/Source/devtools/front_end/common/StaticContentProvider.js
|
| +++ b/third_party/WebKit/Source/devtools/front_end/common/StaticContentProvider.js
|
| @@ -5,33 +5,15 @@
|
| /**
|
| * @constructor
|
| * @implements {WebInspector.ContentProvider}
|
| - * @param {!WebInspector.ResourceType} contentType
|
| - * @param {string} content
|
| * @param {string} contentURL
|
| + * @param {!WebInspector.ResourceType} contentType
|
| + * @param {!Promise<string>} contentGetter
|
| */
|
| -WebInspector.StaticContentProvider = function(contentType, content, contentURL)
|
| +WebInspector.StaticContentProvider = function(contentURL, contentType, contentGetter)
|
| {
|
| - this._content = content;
|
| - this._contentType = contentType;
|
| this._contentURL = contentURL;
|
| -}
|
| -
|
| -/**
|
| - * @param {string} content
|
| - * @param {string} query
|
| - * @param {boolean} caseSensitive
|
| - * @param {boolean} isRegex
|
| - * @param {function(!Array.<!WebInspector.ContentProvider.SearchMatch>)} callback
|
| - */
|
| -WebInspector.StaticContentProvider.searchInContent = function(content, query, caseSensitive, isRegex, callback)
|
| -{
|
| - function performSearch()
|
| - {
|
| - callback(WebInspector.ContentProvider.performSearchInContent(content, query, caseSensitive, isRegex));
|
| - }
|
| -
|
| - // searchInContent should call back later.
|
| - setTimeout(performSearch.bind(null), 0);
|
| + this._contentType = contentType;
|
| + this._contentGetter = contentGetter;
|
| }
|
|
|
| WebInspector.StaticContentProvider.prototype = {
|
| @@ -59,7 +41,7 @@ WebInspector.StaticContentProvider.prototype = {
|
| */
|
| requestContent: function()
|
| {
|
| - return Promise.resolve(/** @type {?string} */(this._content));
|
| + return /** @type {!Promise<?string>} */(this._contentGetter);
|
| },
|
|
|
| /**
|
| @@ -71,6 +53,14 @@ WebInspector.StaticContentProvider.prototype = {
|
| */
|
| searchInContent: function(query, caseSensitive, isRegex, callback)
|
| {
|
| - WebInspector.StaticContentProvider.searchInContent(this._content, query, caseSensitive, isRegex, callback);
|
| + /**
|
| + * @param {string} content
|
| + */
|
| + function performSearch(content)
|
| + {
|
| + callback(WebInspector.ContentProvider.performSearchInContent(content, query, caseSensitive, isRegex));
|
| + }
|
| +
|
| + this._contentGetter.then(performSearch);
|
| }
|
| }
|
|
|