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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/sdk/NetworkRequest.js

Issue 2851913002: [DevTools] Do not expose agents on Target
Patch Set: storage and tests.js Created 3 years, 7 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 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 16 matching lines...) Expand all
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 /** 30 /**
31 * @implements {Common.ContentProvider} 31 * @implements {Common.ContentProvider}
32 * @unrestricted 32 * @unrestricted
33 */ 33 */
34 SDK.NetworkRequest = class extends Common.Object { 34 SDK.NetworkRequest = class extends Common.Object {
35 /** 35 /**
36 * @param {!SDK.NetworkManager} networkManager 36 * @param {!SDK.NetworkManager} networkManager
37 * @param {!Protocol.NetworkAgent} networkAgent
caseq 2017/04/29 02:12:53 Do we really need both manager and agent here? It
37 * @param {!Protocol.Network.RequestId} requestId 38 * @param {!Protocol.Network.RequestId} requestId
38 * @param {string} url 39 * @param {string} url
39 * @param {string} documentURL 40 * @param {string} documentURL
40 * @param {!Protocol.Page.FrameId} frameId 41 * @param {!Protocol.Page.FrameId} frameId
41 * @param {!Protocol.Network.LoaderId} loaderId 42 * @param {!Protocol.Network.LoaderId} loaderId
42 * @param {?Protocol.Network.Initiator} initiator 43 * @param {?Protocol.Network.Initiator} initiator
43 */ 44 */
44 constructor(networkManager, requestId, url, documentURL, frameId, loaderId, in itiator) { 45 constructor(networkManager, networkAgent, requestId, url, documentURL, frameId , loaderId, initiator) {
45 super(); 46 super();
46 47
47 this._networkManager = networkManager; 48 this._networkManager = networkManager;
49 this._networkAgent = networkAgent;
48 this._requestId = requestId; 50 this._requestId = requestId;
49 this.setUrl(url); 51 this.setUrl(url);
50 this._documentURL = documentURL; 52 this._documentURL = documentURL;
51 this._frameId = frameId; 53 this._frameId = frameId;
52 this._loaderId = loaderId; 54 this._loaderId = loaderId;
53 /** @type {?Protocol.Network.Initiator} */ 55 /** @type {?Protocol.Network.Initiator} */
54 this._initiator = initiator; 56 this._initiator = initiator;
55 this._issueTime = -1; 57 this._issueTime = -1;
56 this._startTime = -1; 58 this._startTime = -1;
57 this._endTime = -1; 59 this._endTime = -1;
(...skipping 969 matching lines...) Expand 10 before | Expand all | Expand 10 after
1027 function onResourceContent(error, content, contentEncoded) { 1029 function onResourceContent(error, content, contentEncoded) {
1028 this._content = error ? null : content; 1030 this._content = error ? null : content;
1029 this._contentError = error; 1031 this._contentError = error;
1030 this._contentEncoded = contentEncoded; 1032 this._contentEncoded = contentEncoded;
1031 var callbacks = this._pendingContentCallbacks.slice(); 1033 var callbacks = this._pendingContentCallbacks.slice();
1032 for (var i = 0; i < callbacks.length; ++i) 1034 for (var i = 0; i < callbacks.length; ++i)
1033 callbacks[i](this._content); 1035 callbacks[i](this._content);
1034 this._pendingContentCallbacks.length = 0; 1036 this._pendingContentCallbacks.length = 0;
1035 delete this._contentRequested; 1037 delete this._contentRequested;
1036 } 1038 }
1037 this._networkManager.target().networkAgent().getResponseBody(this._requestId , onResourceContent.bind(this)); 1039 this._networkAgent.getResponseBody(this._requestId, onResourceContent.bind(t his));
1038 } 1040 }
1039 1041
1040 /** 1042 /**
1041 * @return {?Protocol.Network.Initiator} 1043 * @return {?Protocol.Network.Initiator}
1042 */ 1044 */
1043 initiator() { 1045 initiator() {
1044 return this._initiator; 1046 return this._initiator;
1045 } 1047 }
1046 1048
1047 /** 1049 /**
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
1102 * @param {string} eventId 1104 * @param {string} eventId
1103 * @param {string} data 1105 * @param {string} data
1104 */ 1106 */
1105 addEventSourceMessage(time, eventName, eventId, data) { 1107 addEventSourceMessage(time, eventName, eventId, data) {
1106 var message = {time: this.pseudoWallTime(time), eventName: eventName, eventI d: eventId, data: data}; 1108 var message = {time: this.pseudoWallTime(time), eventName: eventName, eventI d: eventId, data: data};
1107 this._eventSourceMessages.push(message); 1109 this._eventSourceMessages.push(message);
1108 this.dispatchEventToListeners(SDK.NetworkRequest.Events.EventSourceMessageAd ded, message); 1110 this.dispatchEventToListeners(SDK.NetworkRequest.Events.EventSourceMessageAd ded, message);
1109 } 1111 }
1110 1112
1111 replayXHR() { 1113 replayXHR() {
1112 this._networkManager.target().networkAgent().replayXHR(this._requestId); 1114 this._networkAgent.replayXHR(this._requestId);
1113 } 1115 }
1114 1116
1115 /** 1117 /**
1116 * @return {!SDK.NetworkManager} 1118 * @return {!SDK.NetworkManager}
1117 */ 1119 */
1118 networkManager() { 1120 networkManager() {
1119 return this._networkManager; 1121 return this._networkManager;
1120 } 1122 }
1121 }; 1123 };
1122 1124
(...skipping 25 matching lines...) Expand all
1148 Send: 'send', 1150 Send: 'send',
1149 Receive: 'receive', 1151 Receive: 'receive',
1150 Error: 'error' 1152 Error: 'error'
1151 }; 1153 };
1152 1154
1153 /** @typedef {!{type: SDK.NetworkRequest.WebSocketFrameType, time: number, text: string, opCode: number, mask: boolean}} */ 1155 /** @typedef {!{type: SDK.NetworkRequest.WebSocketFrameType, time: number, text: string, opCode: number, mask: boolean}} */
1154 SDK.NetworkRequest.WebSocketFrame; 1156 SDK.NetworkRequest.WebSocketFrame;
1155 1157
1156 /** @typedef {!{time: number, eventName: string, eventId: string, data: string}} */ 1158 /** @typedef {!{time: number, eventName: string, eventId: string, data: string}} */
1157 SDK.NetworkRequest.EventSourceMessage; 1159 SDK.NetworkRequest.EventSourceMessage;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698