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

Unified 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 side-by-side diff with in-line comments
Download patch
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 7403bb85738b3f922c819a190c04c41a41c91b62..07bfc7eb68f97b806f0e2b181fd4e4d508f38268 100644
--- a/third_party/WebKit/Source/devtools/front_end/common/StaticContentProvider.js
+++ b/third_party/WebKit/Source/devtools/front_end/common/StaticContentProvider.js
@@ -9,7 +9,7 @@ Common.StaticContentProvider = class {
/**
* @param {string} contentURL
* @param {!Common.ResourceType} contentType
- * @param {function():!Promise<string>} lazyContent
+ * @param {function():!Promise<?string>} lazyContent
*/
constructor(contentURL, contentType, lazyContent) {
this._contentURL = contentURL;
@@ -61,9 +61,13 @@ Common.StaticContentProvider = class {
*/
searchInContent(query, caseSensitive, isRegex, callback) {
/**
- * @param {string} content
+ * @param {?string} content
*/
function performSearch(content) {
+ if (!content) {
+ callback(/** @type {!Array<!Common.ContentProvider.SearchMatch>} */ ([]));
+ return;
+ }
callback(Common.ContentProvider.performSearchInContent(content, query, caseSensitive, isRegex));
}

Powered by Google App Engine
This is Rietveld 408576698