Chromium Code Reviews| 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 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 333 */ | 333 */ |
| 334 resourceChangedPriority(requestId, newPriority, timestamp) { | 334 resourceChangedPriority(requestId, newPriority, timestamp) { |
| 335 var networkRequest = this._inflightRequestsById[requestId]; | 335 var networkRequest = this._inflightRequestsById[requestId]; |
| 336 if (networkRequest) | 336 if (networkRequest) |
| 337 networkRequest.setPriority(newPriority); | 337 networkRequest.setPriority(newPriority); |
| 338 } | 338 } |
| 339 | 339 |
| 340 /** | 340 /** |
| 341 * @override | 341 * @override |
| 342 * @param {!Protocol.Network.RequestId} requestId | 342 * @param {!Protocol.Network.RequestId} requestId |
| 343 * @param {!Protocol.Page.FrameId} frameId | |
| 344 * @param {!Protocol.Network.LoaderId} loaderId | 343 * @param {!Protocol.Network.LoaderId} loaderId |
| 345 * @param {string} documentURL | 344 * @param {string} documentURL |
| 346 * @param {!Protocol.Network.Request} request | 345 * @param {!Protocol.Network.Request} request |
| 347 * @param {!Protocol.Network.Timestamp} time | 346 * @param {!Protocol.Network.Timestamp} time |
| 348 * @param {!Protocol.Network.Timestamp} wallTime | 347 * @param {!Protocol.Network.Timestamp} wallTime |
| 349 * @param {!Protocol.Network.Initiator} initiator | 348 * @param {!Protocol.Network.Initiator} initiator |
| 350 * @param {!Protocol.Network.Response=} redirectResponse | 349 * @param {!Protocol.Network.Response=} redirectResponse |
| 351 * @param {!Protocol.Page.ResourceType=} resourceType | 350 * @param {!Protocol.Page.ResourceType=} resourceType |
| 351 * @param {!Protocol.Page.FrameId=} frameId | |
| 352 */ | 352 */ |
| 353 requestWillBeSent( | 353 requestWillBeSent( |
| 354 requestId, | 354 requestId, loaderId, documentURL, request, time, wallTime, initiator, redi rectResponse, resourceType, frameId) { |
| 355 frameId, | |
| 356 loaderId, | |
| 357 documentURL, | |
| 358 request, | |
| 359 time, | |
| 360 wallTime, | |
| 361 initiator, | |
| 362 redirectResponse, | |
| 363 resourceType) { | |
| 364 var networkRequest = this._inflightRequestsById[requestId]; | 355 var networkRequest = this._inflightRequestsById[requestId]; |
| 365 if (networkRequest) { | 356 if (networkRequest) { |
| 366 // FIXME: move this check to the backend. | 357 // FIXME: move this check to the backend. |
| 367 if (!redirectResponse) | 358 if (!redirectResponse) |
| 368 return; | 359 return; |
| 369 this.responseReceived(requestId, frameId, loaderId, time, Protocol.Page.Re sourceType.Other, redirectResponse); | 360 this.responseReceived(requestId, loaderId, time, Protocol.Page.ResourceTyp e.Other, redirectResponse, frameId); |
| 370 networkRequest = this._appendRedirect(requestId, time, request.url); | 361 networkRequest = this._appendRedirect(requestId, time, request.url); |
| 371 this._manager.dispatchEventToListeners(SDK.NetworkManager.Events.RequestRe directed, networkRequest); | 362 this._manager.dispatchEventToListeners(SDK.NetworkManager.Events.RequestRe directed, networkRequest); |
| 372 } else { | 363 } else { |
| 373 networkRequest = this._createNetworkRequest(requestId, frameId, loaderId, request.url, documentURL, initiator); | 364 networkRequest = |
| 365 this._createNetworkRequest(requestId, frameId ? frameId : '', loaderId , request.url, documentURL, initiator); | |
|
dgozman
2017/06/28 22:50:32
nit: frameId || ''
horo
2017/06/29 02:14:28
Done.
| |
| 374 } | 366 } |
| 375 networkRequest.hasNetworkData = true; | 367 networkRequest.hasNetworkData = true; |
| 376 this._updateNetworkRequestWithRequest(networkRequest, request); | 368 this._updateNetworkRequestWithRequest(networkRequest, request); |
| 377 networkRequest.setIssueTime(time, wallTime); | 369 networkRequest.setIssueTime(time, wallTime); |
| 378 networkRequest.setResourceType( | 370 networkRequest.setResourceType( |
| 379 resourceType ? Common.resourceTypes[resourceType] : Protocol.Page.Resour ceType.Other); | 371 resourceType ? Common.resourceTypes[resourceType] : Protocol.Page.Resour ceType.Other); |
| 380 | 372 |
| 381 this._startNetworkRequest(networkRequest); | 373 this._startNetworkRequest(networkRequest); |
| 382 } | 374 } |
| 383 | 375 |
| 384 /** | 376 /** |
| 385 * @override | 377 * @override |
| 386 * @param {!Protocol.Network.RequestId} requestId | 378 * @param {!Protocol.Network.RequestId} requestId |
| 387 */ | 379 */ |
| 388 requestServedFromCache(requestId) { | 380 requestServedFromCache(requestId) { |
| 389 var networkRequest = this._inflightRequestsById[requestId]; | 381 var networkRequest = this._inflightRequestsById[requestId]; |
| 390 if (!networkRequest) | 382 if (!networkRequest) |
| 391 return; | 383 return; |
| 392 | 384 |
| 393 networkRequest.setFromMemoryCache(); | 385 networkRequest.setFromMemoryCache(); |
| 394 } | 386 } |
| 395 | 387 |
| 396 /** | 388 /** |
| 397 * @override | 389 * @override |
| 398 * @param {!Protocol.Network.RequestId} requestId | 390 * @param {!Protocol.Network.RequestId} requestId |
| 399 * @param {!Protocol.Page.FrameId} frameId | |
| 400 * @param {!Protocol.Network.LoaderId} loaderId | 391 * @param {!Protocol.Network.LoaderId} loaderId |
| 401 * @param {!Protocol.Network.Timestamp} time | 392 * @param {!Protocol.Network.Timestamp} time |
| 402 * @param {!Protocol.Page.ResourceType} resourceType | 393 * @param {!Protocol.Page.ResourceType} resourceType |
| 403 * @param {!Protocol.Network.Response} response | 394 * @param {!Protocol.Network.Response} response |
| 395 * @param {!Protocol.Page.FrameId=} frameId | |
| 404 */ | 396 */ |
| 405 responseReceived(requestId, frameId, loaderId, time, resourceType, response) { | 397 responseReceived(requestId, loaderId, time, resourceType, response, frameId) { |
| 406 var networkRequest = this._inflightRequestsById[requestId]; | 398 var networkRequest = this._inflightRequestsById[requestId]; |
| 407 if (!networkRequest) { | 399 if (!networkRequest) { |
| 408 // We missed the requestWillBeSent. | 400 // We missed the requestWillBeSent. |
| 409 var eventData = {}; | 401 var eventData = {}; |
| 410 eventData.url = response.url; | 402 eventData.url = response.url; |
| 411 eventData.frameId = frameId; | 403 eventData.frameId = frameId ? frameId : ''; |
|
dgozman
2017/06/28 22:50:32
ditto
horo
2017/06/29 02:14:28
Done.
| |
| 412 eventData.loaderId = loaderId; | 404 eventData.loaderId = loaderId; |
| 413 eventData.resourceType = resourceType; | 405 eventData.resourceType = resourceType; |
| 414 eventData.mimeType = response.mimeType; | 406 eventData.mimeType = response.mimeType; |
| 415 var lastModifiedHeader = response.headers['last-modified']; | 407 var lastModifiedHeader = response.headers['last-modified']; |
| 416 eventData.lastModified = lastModifiedHeader ? new Date(lastModifiedHeader) : null; | 408 eventData.lastModified = lastModifiedHeader ? new Date(lastModifiedHeader) : null; |
| 417 this._manager.dispatchEventToListeners(SDK.NetworkManager.Events.RequestUp dateDropped, eventData); | 409 this._manager.dispatchEventToListeners(SDK.NetworkManager.Events.RequestUp dateDropped, eventData); |
| 418 return; | 410 return; |
| 419 } | 411 } |
| 420 | 412 |
| 421 networkRequest.responseReceivedTime = time; | 413 networkRequest.responseReceivedTime = time; |
| (...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 976 SDK.MultitargetNetworkManager.Events = { | 968 SDK.MultitargetNetworkManager.Events = { |
| 977 BlockedPatternsChanged: Symbol('BlockedPatternsChanged'), | 969 BlockedPatternsChanged: Symbol('BlockedPatternsChanged'), |
| 978 ConditionsChanged: Symbol('ConditionsChanged'), | 970 ConditionsChanged: Symbol('ConditionsChanged'), |
| 979 UserAgentChanged: Symbol('UserAgentChanged') | 971 UserAgentChanged: Symbol('UserAgentChanged') |
| 980 }; | 972 }; |
| 981 | 973 |
| 982 /** | 974 /** |
| 983 * @type {!SDK.MultitargetNetworkManager} | 975 * @type {!SDK.MultitargetNetworkManager} |
| 984 */ | 976 */ |
| 985 SDK.multitargetNetworkManager; | 977 SDK.multitargetNetworkManager; |
| OLD | NEW |