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 618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
629 } | 629 } |
630 | 630 |
631 /** | 631 /** |
632 * @param {!Protocol.Network.RequestId} requestId | 632 * @param {!Protocol.Network.RequestId} requestId |
633 * @param {!Protocol.Network.Timestamp} time | 633 * @param {!Protocol.Network.Timestamp} time |
634 * @param {string} redirectURL | 634 * @param {string} redirectURL |
635 * @return {!SDK.NetworkRequest} | 635 * @return {!SDK.NetworkRequest} |
636 */ | 636 */ |
637 _appendRedirect(requestId, time, redirectURL) { | 637 _appendRedirect(requestId, time, redirectURL) { |
638 var originalNetworkRequest = this._inflightRequestsById[requestId]; | 638 var originalNetworkRequest = this._inflightRequestsById[requestId]; |
639 var previousRedirects = originalNetworkRequest.redirects || []; | 639 var redirectCount = 0; |
640 originalNetworkRequest.setRequestId(requestId + ':redirected.' + previousRed
irects.length); | 640 for (var redirect = originalNetworkRequest.redirectSource(); redirect; redir
ect = redirect.redirectSource()) |
641 delete originalNetworkRequest.redirects; | 641 redirectCount++; |
642 if (previousRedirects.length > 0) | 642 |
643 originalNetworkRequest.redirectSource = previousRedirects[previousRedirect
s.length - 1]; | 643 originalNetworkRequest.setRequestId(requestId + ':redirected.' + redirectCou
nt); |
644 this._finishNetworkRequest(originalNetworkRequest, time, -1); | 644 this._finishNetworkRequest(originalNetworkRequest, time, -1); |
645 var newNetworkRequest = this._createNetworkRequest( | 645 var newNetworkRequest = this._createNetworkRequest( |
646 requestId, originalNetworkRequest.frameId, originalNetworkRequest.loader
Id, redirectURL, | 646 requestId, originalNetworkRequest.frameId, originalNetworkRequest.loader
Id, redirectURL, |
647 originalNetworkRequest.documentURL, originalNetworkRequest.initiator()); | 647 originalNetworkRequest.documentURL, originalNetworkRequest.initiator()); |
648 newNetworkRequest.redirects = previousRedirects.concat(originalNetworkReques
t); | 648 newNetworkRequest.setRedirectSource(originalNetworkRequest); |
649 return newNetworkRequest; | 649 return newNetworkRequest; |
650 } | 650 } |
651 | 651 |
652 /** | 652 /** |
653 * @param {!SDK.NetworkRequest} networkRequest | 653 * @param {!SDK.NetworkRequest} networkRequest |
654 */ | 654 */ |
655 _startNetworkRequest(networkRequest) { | 655 _startNetworkRequest(networkRequest) { |
656 this._inflightRequestsById[networkRequest.requestId()] = networkRequest; | 656 this._inflightRequestsById[networkRequest.requestId()] = networkRequest; |
657 this._inflightRequestsByURL[networkRequest.url()] = networkRequest; | 657 this._inflightRequestsByURL[networkRequest.url()] = networkRequest; |
658 this._manager.dispatchEventToListeners(SDK.NetworkManager.Events.RequestStar
ted, networkRequest); | 658 this._manager.dispatchEventToListeners(SDK.NetworkManager.Events.RequestStar
ted, networkRequest); |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
956 SDK.MultitargetNetworkManager.Events = { | 956 SDK.MultitargetNetworkManager.Events = { |
957 BlockedPatternsChanged: Symbol('BlockedPatternsChanged'), | 957 BlockedPatternsChanged: Symbol('BlockedPatternsChanged'), |
958 ConditionsChanged: Symbol('ConditionsChanged'), | 958 ConditionsChanged: Symbol('ConditionsChanged'), |
959 UserAgentChanged: Symbol('UserAgentChanged') | 959 UserAgentChanged: Symbol('UserAgentChanged') |
960 }; | 960 }; |
961 | 961 |
962 /** | 962 /** |
963 * @type {!SDK.MultitargetNetworkManager} | 963 * @type {!SDK.MultitargetNetworkManager} |
964 */ | 964 */ |
965 SDK.multitargetNetworkManager; | 965 SDK.multitargetNetworkManager; |
OLD | NEW |