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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/common/StaticContentProvider.js

Issue 2702583003: DevTools: do not assign empty content to CSS UISourceCode in case of protocol error (Closed)
Patch Set: fix test Created 3 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 /** 4 /**
5 * @implements {Common.ContentProvider} 5 * @implements {Common.ContentProvider}
6 * @unrestricted 6 * @unrestricted
7 */ 7 */
8 Common.StaticContentProvider = class { 8 Common.StaticContentProvider = class {
9 /** 9 /**
10 * @param {string} contentURL 10 * @param {string} contentURL
11 * @param {!Common.ResourceType} contentType 11 * @param {!Common.ResourceType} contentType
12 * @param {function():!Promise<string>} lazyContent 12 * @param {function():!Promise<?string>} lazyContent
13 */ 13 */
14 constructor(contentURL, contentType, lazyContent) { 14 constructor(contentURL, contentType, lazyContent) {
15 this._contentURL = contentURL; 15 this._contentURL = contentURL;
16 this._contentType = contentType; 16 this._contentType = contentType;
17 this._lazyContent = lazyContent; 17 this._lazyContent = lazyContent;
18 } 18 }
19 19
20 /** 20 /**
21 * @param {string} contentURL 21 * @param {string} contentURL
22 * @param {!Common.ResourceType} contentType 22 * @param {!Common.ResourceType} contentType
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 54
55 /** 55 /**
56 * @override 56 * @override
57 * @param {string} query 57 * @param {string} query
58 * @param {boolean} caseSensitive 58 * @param {boolean} caseSensitive
59 * @param {boolean} isRegex 59 * @param {boolean} isRegex
60 * @param {function(!Array.<!Common.ContentProvider.SearchMatch>)} callback 60 * @param {function(!Array.<!Common.ContentProvider.SearchMatch>)} callback
61 */ 61 */
62 searchInContent(query, caseSensitive, isRegex, callback) { 62 searchInContent(query, caseSensitive, isRegex, callback) {
63 /** 63 /**
64 * @param {string} content 64 * @param {?string} content
65 */ 65 */
66 function performSearch(content) { 66 function performSearch(content) {
67 if (!content) {
68 callback(/** @type {!Array<!Common.ContentProvider.SearchMatch>} */ ([]) );
69 return;
70 }
67 callback(Common.ContentProvider.performSearchInContent(content, query, cas eSensitive, isRegex)); 71 callback(Common.ContentProvider.performSearchInContent(content, query, cas eSensitive, isRegex));
68 } 72 }
69 73
70 this._lazyContent().then(performSearch); 74 this._lazyContent().then(performSearch);
71 } 75 }
72 }; 76 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698