| 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 | 124 |
| 125 /** @enum {symbol} */ | 125 /** @enum {symbol} */ |
| 126 SDK.NetworkManager.Events = { | 126 SDK.NetworkManager.Events = { |
| 127 RequestStarted: Symbol('RequestStarted'), | 127 RequestStarted: Symbol('RequestStarted'), |
| 128 RequestUpdated: Symbol('RequestUpdated'), | 128 RequestUpdated: Symbol('RequestUpdated'), |
| 129 RequestFinished: Symbol('RequestFinished'), | 129 RequestFinished: Symbol('RequestFinished'), |
| 130 RequestUpdateDropped: Symbol('RequestUpdateDropped'), | 130 RequestUpdateDropped: Symbol('RequestUpdateDropped'), |
| 131 ResponseReceived: Symbol('ResponseReceived') | 131 ResponseReceived: Symbol('ResponseReceived') |
| 132 }; | 132 }; |
| 133 | 133 |
| 134 /** @implements {Common.Emittable} */ |
| 135 SDK.NetworkManager.RequestRedirectEvent = class { |
| 136 /** |
| 137 * @param {!SDK.NetworkRequest} request |
| 138 */ |
| 139 constructor(request) { |
| 140 this.request = request; |
| 141 } |
| 142 }; |
| 143 |
| 134 SDK.NetworkManager._MIMETypes = { | 144 SDK.NetworkManager._MIMETypes = { |
| 135 'text/html': {'document': true}, | 145 'text/html': {'document': true}, |
| 136 'text/xml': {'document': true}, | 146 'text/xml': {'document': true}, |
| 137 'text/plain': {'document': true}, | 147 'text/plain': {'document': true}, |
| 138 'application/xhtml+xml': {'document': true}, | 148 'application/xhtml+xml': {'document': true}, |
| 139 'image/svg+xml': {'document': true}, | 149 'image/svg+xml': {'document': true}, |
| 140 'text/css': {'stylesheet': true}, | 150 'text/css': {'stylesheet': true}, |
| 141 'text/xsl': {'stylesheet': true}, | 151 'text/xsl': {'stylesheet': true}, |
| 142 'text/vtt': {'texttrack': true}, | 152 'text/vtt': {'texttrack': true}, |
| 143 }; | 153 }; |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 initiator, | 326 initiator, |
| 317 redirectResponse, | 327 redirectResponse, |
| 318 resourceType) { | 328 resourceType) { |
| 319 var networkRequest = this._inflightRequestsById[requestId]; | 329 var networkRequest = this._inflightRequestsById[requestId]; |
| 320 if (networkRequest) { | 330 if (networkRequest) { |
| 321 // FIXME: move this check to the backend. | 331 // FIXME: move this check to the backend. |
| 322 if (!redirectResponse) | 332 if (!redirectResponse) |
| 323 return; | 333 return; |
| 324 this.responseReceived(requestId, frameId, loaderId, time, Protocol.Page.Re
sourceType.Other, redirectResponse); | 334 this.responseReceived(requestId, frameId, loaderId, time, Protocol.Page.Re
sourceType.Other, redirectResponse); |
| 325 networkRequest = this._appendRedirect(requestId, time, request.url); | 335 networkRequest = this._appendRedirect(requestId, time, request.url); |
| 336 this._manager.emit(new SDK.NetworkManager.RequestRedirectEvent(networkRequ
est)); |
| 326 } else { | 337 } else { |
| 327 networkRequest = this._createNetworkRequest(requestId, frameId, loaderId,
request.url, documentURL, initiator); | 338 networkRequest = this._createNetworkRequest(requestId, frameId, loaderId,
request.url, documentURL, initiator); |
| 328 } | 339 } |
| 329 networkRequest.hasNetworkData = true; | 340 networkRequest.hasNetworkData = true; |
| 330 this._updateNetworkRequestWithRequest(networkRequest, request); | 341 this._updateNetworkRequestWithRequest(networkRequest, request); |
| 331 networkRequest.setIssueTime(time, wallTime); | 342 networkRequest.setIssueTime(time, wallTime); |
| 332 networkRequest.setResourceType( | 343 networkRequest.setResourceType( |
| 333 resourceType ? Common.resourceTypes[resourceType] : Protocol.Page.Resour
ceType.Other); | 344 resourceType ? Common.resourceTypes[resourceType] : Protocol.Page.Resour
ceType.Other); |
| 334 | 345 |
| 335 this._startNetworkRequest(networkRequest); | 346 this._startNetworkRequest(networkRequest); |
| (...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 897 SDK.MultitargetNetworkManager.Events = { | 908 SDK.MultitargetNetworkManager.Events = { |
| 898 ConditionsChanged: Symbol('ConditionsChanged'), | 909 ConditionsChanged: Symbol('ConditionsChanged'), |
| 899 UserAgentChanged: Symbol('UserAgentChanged') | 910 UserAgentChanged: Symbol('UserAgentChanged') |
| 900 }; | 911 }; |
| 901 | 912 |
| 902 | 913 |
| 903 /** | 914 /** |
| 904 * @type {!SDK.MultitargetNetworkManager} | 915 * @type {!SDK.MultitargetNetworkManager} |
| 905 */ | 916 */ |
| 906 SDK.multitargetNetworkManager; | 917 SDK.multitargetNetworkManager; |
| OLD | NEW |