OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 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 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 */ | 285 */ |
286 resourceChangedPriority(requestId, newPriority, timestamp) { | 286 resourceChangedPriority(requestId, newPriority, timestamp) { |
287 var networkRequest = this._inflightRequestsById[requestId]; | 287 var networkRequest = this._inflightRequestsById[requestId]; |
288 if (networkRequest) | 288 if (networkRequest) |
289 networkRequest.setPriority(newPriority); | 289 networkRequest.setPriority(newPriority); |
290 } | 290 } |
291 | 291 |
292 /** | 292 /** |
293 * @override | 293 * @override |
294 * @param {!Protocol.Network.RequestId} requestId | 294 * @param {!Protocol.Network.RequestId} requestId |
295 * @param {!Protocol.Page.FrameId} frameId | |
296 * @param {!Protocol.Network.LoaderId} loaderId | 295 * @param {!Protocol.Network.LoaderId} loaderId |
297 * @param {string} documentURL | 296 * @param {string} documentURL |
298 * @param {!Protocol.Network.Request} request | 297 * @param {!Protocol.Network.Request} request |
299 * @param {!Protocol.Network.Timestamp} time | 298 * @param {!Protocol.Network.Timestamp} time |
300 * @param {!Protocol.Network.Timestamp} wallTime | 299 * @param {!Protocol.Network.Timestamp} wallTime |
301 * @param {!Protocol.Network.Initiator} initiator | 300 * @param {!Protocol.Network.Initiator} initiator |
302 * @param {!Protocol.Network.Response=} redirectResponse | 301 * @param {!Protocol.Network.Response=} redirectResponse |
303 * @param {!Protocol.Page.ResourceType=} resourceType | 302 * @param {!Protocol.Page.ResourceType=} resourceType |
| 303 * @param {!Protocol.Page.FrameId=} frameId |
304 */ | 304 */ |
305 requestWillBeSent( | 305 requestWillBeSent( |
306 requestId, | 306 requestId, loaderId, documentURL, request, time, wallTime, initiator, redi
rectResponse, resourceType, frameId) { |
307 frameId, | |
308 loaderId, | |
309 documentURL, | |
310 request, | |
311 time, | |
312 wallTime, | |
313 initiator, | |
314 redirectResponse, | |
315 resourceType) { | |
316 var networkRequest = this._inflightRequestsById[requestId]; | 307 var networkRequest = this._inflightRequestsById[requestId]; |
317 if (networkRequest) { | 308 if (networkRequest) { |
318 // FIXME: move this check to the backend. | 309 // FIXME: move this check to the backend. |
319 if (!redirectResponse) | 310 if (!redirectResponse) |
320 return; | 311 return; |
321 this.responseReceived(requestId, frameId, loaderId, time, Protocol.Page.Re
sourceType.Other, redirectResponse); | 312 this.responseReceived(requestId, loaderId, time, Protocol.Page.ResourceTyp
e.Other, redirectResponse, frameId); |
322 networkRequest = this._appendRedirect(requestId, time, request.url); | 313 networkRequest = this._appendRedirect(requestId, time, request.url); |
323 this._manager.dispatchEventToListeners(SDK.NetworkManager.Events.RequestRe
directed, networkRequest); | 314 this._manager.dispatchEventToListeners(SDK.NetworkManager.Events.RequestRe
directed, networkRequest); |
324 } else { | 315 } else { |
325 networkRequest = this._createNetworkRequest(requestId, frameId, loaderId,
request.url, documentURL, initiator); | 316 networkRequest = |
| 317 this._createNetworkRequest(requestId, frameId ? frameId : '', loaderId
, request.url, documentURL, initiator); |
326 } | 318 } |
327 networkRequest.hasNetworkData = true; | 319 networkRequest.hasNetworkData = true; |
328 this._updateNetworkRequestWithRequest(networkRequest, request); | 320 this._updateNetworkRequestWithRequest(networkRequest, request); |
329 networkRequest.setIssueTime(time, wallTime); | 321 networkRequest.setIssueTime(time, wallTime); |
330 networkRequest.setResourceType( | 322 networkRequest.setResourceType( |
331 resourceType ? Common.resourceTypes[resourceType] : Protocol.Page.Resour
ceType.Other); | 323 resourceType ? Common.resourceTypes[resourceType] : Protocol.Page.Resour
ceType.Other); |
332 | 324 |
333 this._startNetworkRequest(networkRequest); | 325 this._startNetworkRequest(networkRequest); |
334 } | 326 } |
335 | 327 |
336 /** | 328 /** |
337 * @override | 329 * @override |
338 * @param {!Protocol.Network.RequestId} requestId | 330 * @param {!Protocol.Network.RequestId} requestId |
339 */ | 331 */ |
340 requestServedFromCache(requestId) { | 332 requestServedFromCache(requestId) { |
341 var networkRequest = this._inflightRequestsById[requestId]; | 333 var networkRequest = this._inflightRequestsById[requestId]; |
342 if (!networkRequest) | 334 if (!networkRequest) |
343 return; | 335 return; |
344 | 336 |
345 networkRequest.setFromMemoryCache(); | 337 networkRequest.setFromMemoryCache(); |
346 } | 338 } |
347 | 339 |
348 /** | 340 /** |
349 * @override | 341 * @override |
350 * @param {!Protocol.Network.RequestId} requestId | 342 * @param {!Protocol.Network.RequestId} requestId |
351 * @param {!Protocol.Page.FrameId} frameId | |
352 * @param {!Protocol.Network.LoaderId} loaderId | 343 * @param {!Protocol.Network.LoaderId} loaderId |
353 * @param {!Protocol.Network.Timestamp} time | 344 * @param {!Protocol.Network.Timestamp} time |
354 * @param {!Protocol.Page.ResourceType} resourceType | 345 * @param {!Protocol.Page.ResourceType} resourceType |
355 * @param {!Protocol.Network.Response} response | 346 * @param {!Protocol.Network.Response} response |
| 347 * @param {!Protocol.Page.FrameId=} frameId |
356 */ | 348 */ |
357 responseReceived(requestId, frameId, loaderId, time, resourceType, response) { | 349 responseReceived(requestId, loaderId, time, resourceType, response, frameId) { |
358 var networkRequest = this._inflightRequestsById[requestId]; | 350 var networkRequest = this._inflightRequestsById[requestId]; |
359 if (!networkRequest) { | 351 if (!networkRequest) { |
360 // We missed the requestWillBeSent. | 352 // We missed the requestWillBeSent. |
361 var eventData = {}; | 353 var eventData = {}; |
362 eventData.url = response.url; | 354 eventData.url = response.url; |
363 eventData.frameId = frameId; | 355 eventData.frameId = frameId ? frameId : ''; |
364 eventData.loaderId = loaderId; | 356 eventData.loaderId = loaderId; |
365 eventData.resourceType = resourceType; | 357 eventData.resourceType = resourceType; |
366 eventData.mimeType = response.mimeType; | 358 eventData.mimeType = response.mimeType; |
367 var lastModifiedHeader = response.headers['last-modified']; | 359 var lastModifiedHeader = response.headers['last-modified']; |
368 eventData.lastModified = lastModifiedHeader ? new Date(lastModifiedHeader)
: null; | 360 eventData.lastModified = lastModifiedHeader ? new Date(lastModifiedHeader)
: null; |
369 this._manager.dispatchEventToListeners(SDK.NetworkManager.Events.RequestUp
dateDropped, eventData); | 361 this._manager.dispatchEventToListeners(SDK.NetworkManager.Events.RequestUp
dateDropped, eventData); |
370 return; | 362 return; |
371 } | 363 } |
372 | 364 |
373 networkRequest.responseReceivedTime = time; | 365 networkRequest.responseReceivedTime = time; |
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
921 SDK.MultitargetNetworkManager.Events = { | 913 SDK.MultitargetNetworkManager.Events = { |
922 BlockedPatternsChanged: Symbol('BlockedPatternsChanged'), | 914 BlockedPatternsChanged: Symbol('BlockedPatternsChanged'), |
923 ConditionsChanged: Symbol('ConditionsChanged'), | 915 ConditionsChanged: Symbol('ConditionsChanged'), |
924 UserAgentChanged: Symbol('UserAgentChanged') | 916 UserAgentChanged: Symbol('UserAgentChanged') |
925 }; | 917 }; |
926 | 918 |
927 /** | 919 /** |
928 * @type {!SDK.MultitargetNetworkManager} | 920 * @type {!SDK.MultitargetNetworkManager} |
929 */ | 921 */ |
930 SDK.multitargetNetworkManager; | 922 SDK.multitargetNetworkManager; |
OLD | NEW |