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

Unified Diff: third_party/WebKit/Source/devtools/front_end/sdk/Resource.js

Issue 2851913002: [DevTools] Do not expose agents on Target
Patch Set: storage and tests.js Created 3 years, 8 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/sdk/Resource.js
diff --git a/third_party/WebKit/Source/devtools/front_end/sdk/Resource.js b/third_party/WebKit/Source/devtools/front_end/sdk/Resource.js
index 91e50c8c56d8e59489de9ff81d4990d0db2a0f9d..48236975ce9e8fb0a4fef1564d464a25bc8968aa 100644
--- a/third_party/WebKit/Source/devtools/front_end/sdk/Resource.js
+++ b/third_party/WebKit/Source/devtools/front_end/sdk/Resource.js
@@ -32,6 +32,7 @@
SDK.Resource = class {
/**
* @param {!SDK.ResourceTreeModel} resourceTreeModel
+ * @param {!Protocol.PageAgent} pageAgent
* @param {?SDK.NetworkRequest} request
* @param {string} url
* @param {string} documentURL
@@ -43,8 +44,10 @@ SDK.Resource = class {
* @param {?number} contentSize
*/
constructor(
- resourceTreeModel, request, url, documentURL, frameId, loaderId, type, mimeType, lastModified, contentSize) {
+ resourceTreeModel, pageAgent, request, url, documentURL, frameId, loaderId, type, mimeType, lastModified,
+ contentSize) {
this._resourceTreeModel = resourceTreeModel;
+ this._pageAgent = pageAgent;
this._request = request;
this.url = url;
this._documentURL = documentURL;
@@ -223,12 +226,10 @@ SDK.Resource = class {
callback(searchMatches || []);
}
- if (this.frameId) {
- this._resourceTreeModel.target().pageAgent().searchInResource(
- this.frameId, this.url, query, caseSensitive, isRegex, callbackWrapper);
- } else {
+ if (this.frameId)
+ this._pageAgent.searchInResource(this.frameId, this.url, query, caseSensitive, isRegex, callbackWrapper);
+ else
callback([]);
- }
}
/**
@@ -312,8 +313,7 @@ SDK.Resource = class {
contentLoaded.call(this, null, content, this.request.contentEncoded);
}
- this._resourceTreeModel.target().pageAgent().getResourceContent(
- this.frameId, this.url, resourceContentLoaded.bind(this));
+ this._pageAgent.getResourceContent(this.frameId, this.url, resourceContentLoaded.bind(this));
}
/**

Powered by Google App Engine
This is Rietveld 408576698