OLD | NEW |
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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 this._redirectSource = null; | 54 this._redirectSource = null; |
55 this._issueTime = -1; | 55 this._issueTime = -1; |
56 this._startTime = -1; | 56 this._startTime = -1; |
57 this._endTime = -1; | 57 this._endTime = -1; |
58 /** @type {!Protocol.Network.BlockedReason|undefined} */ | 58 /** @type {!Protocol.Network.BlockedReason|undefined} */ |
59 this._blockedReason = undefined; | 59 this._blockedReason = undefined; |
60 | 60 |
61 this.statusCode = 0; | 61 this.statusCode = 0; |
62 this.statusText = ''; | 62 this.statusText = ''; |
63 this.requestMethod = ''; | 63 this.requestMethod = ''; |
64 this.requestTime = 0; | 64 //this.requestTime = 0; |
65 this.protocol = ''; | 65 this.protocol = ''; |
66 /** @type {!Protocol.Network.RequestMixedContentType} */ | 66 /** @type {!Protocol.Network.RequestMixedContentType} */ |
67 this.mixedContentType = Protocol.Network.RequestMixedContentType.None; | 67 this.mixedContentType = Protocol.Network.RequestMixedContentType.None; |
68 | 68 |
69 /** @type {?Protocol.Network.ResourcePriority} */ | 69 /** @type {?Protocol.Network.ResourcePriority} */ |
70 this._initialPriority = null; | 70 this._initialPriority = null; |
71 /** @type {?Protocol.Network.ResourcePriority} */ | 71 /** @type {?Protocol.Network.ResourcePriority} */ |
72 this._currentPriority = null; | 72 this._currentPriority = null; |
73 | 73 |
74 /** @type {!Common.ResourceType} */ | 74 /** @type {!Common.ResourceType} */ |
(...skipping 15 matching lines...) Expand all Loading... |
90 /** @type {!Protocol.Security.SecurityState} */ | 90 /** @type {!Protocol.Security.SecurityState} */ |
91 this._securityState = Protocol.Security.SecurityState.Unknown; | 91 this._securityState = Protocol.Security.SecurityState.Unknown; |
92 /** @type {?Protocol.Network.SecurityDetails} */ | 92 /** @type {?Protocol.Network.SecurityDetails} */ |
93 this._securityDetails = null; | 93 this._securityDetails = null; |
94 | 94 |
95 /** @type {string} */ | 95 /** @type {string} */ |
96 this.connectionId = '0'; | 96 this.connectionId = '0'; |
97 } | 97 } |
98 | 98 |
99 /** | 99 /** |
| 100 * @param {string} mimeType |
| 101 * @return {!Common.ResourceType} |
| 102 */ |
| 103 static resourceTypeForMimeType(mimeType) { |
| 104 if (mimeType.startsWith('image')) |
| 105 return Common.resourceTypes.Image; |
| 106 if (mimeType.includes('font')) |
| 107 return Common.resourceTypes.Font; |
| 108 return Common.resourceTypes.Other; |
| 109 } |
| 110 |
| 111 /** |
100 * @param {!SDK.NetworkRequest} other | 112 * @param {!SDK.NetworkRequest} other |
101 * @return {number} | 113 * @return {number} |
102 */ | 114 */ |
103 indentityCompare(other) { | 115 indentityCompare(other) { |
104 if (this._requestId > other._requestId) | 116 if (this._requestId > other._requestId) |
105 return 1; | 117 return 1; |
106 if (this._requestId < other._requestId) | 118 if (this._requestId < other._requestId) |
107 return -1; | 119 return -1; |
108 return 0; | 120 return 0; |
109 } | 121 } |
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
524 _parseNameAndPathFromURL() { | 536 _parseNameAndPathFromURL() { |
525 if (this._parsedURL.isDataURL()) { | 537 if (this._parsedURL.isDataURL()) { |
526 this._name = this._parsedURL.dataURLDisplayName(); | 538 this._name = this._parsedURL.dataURLDisplayName(); |
527 this._path = ''; | 539 this._path = ''; |
528 } else if (this._parsedURL.isAboutBlank()) { | 540 } else if (this._parsedURL.isAboutBlank()) { |
529 this._name = this._parsedURL.url; | 541 this._name = this._parsedURL.url; |
530 this._path = ''; | 542 this._path = ''; |
531 } else { | 543 } else { |
532 this._path = this._parsedURL.host + this._parsedURL.folderPathComponents; | 544 this._path = this._parsedURL.host + this._parsedURL.folderPathComponents; |
533 | 545 |
534 var networkManager = SDK.NetworkManager.managerForRequest(this); | 546 |
535 var inspectedURL = networkManager ? networkManager.target().inspectedURL()
.asParsedURL() : null; | 547 var pageLoad = NetworkLog.networkLog.pageLoadForRequest(this); |
| 548 var inspectedURL = pageLoad ? pageLoad.inspectedURL : null; |
536 this._path = this._path.trimURL(inspectedURL ? inspectedURL.host : ''); | 549 this._path = this._path.trimURL(inspectedURL ? inspectedURL.host : ''); |
537 if (this._parsedURL.lastPathComponent || this._parsedURL.queryParams) { | 550 if (this._parsedURL.lastPathComponent || this._parsedURL.queryParams) { |
538 this._name = | 551 this._name = |
539 this._parsedURL.lastPathComponent + (this._parsedURL.queryParams ? '
?' + this._parsedURL.queryParams : ''); | 552 this._parsedURL.lastPathComponent + (this._parsedURL.queryParams ? '
?' + this._parsedURL.queryParams : ''); |
540 } else if (this._parsedURL.folderPathComponents) { | 553 } else if (this._parsedURL.folderPathComponents) { |
541 this._name = | 554 this._name = |
542 this._parsedURL.folderPathComponents.substring(this._parsedURL.folde
rPathComponents.lastIndexOf('/') + 1) + | 555 this._parsedURL.folderPathComponents.substring(this._parsedURL.folde
rPathComponents.lastIndexOf('/') + 1) + |
543 '/'; | 556 '/'; |
544 this._path = this._path.substring(0, this._path.lastIndexOf('/')); | 557 this._path = this._path.substring(0, this._path.lastIndexOf('/')); |
545 } else { | 558 } else { |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
667 this._requestFormData = x; | 680 this._requestFormData = x; |
668 delete this._parsedFormParameters; | 681 delete this._parsedFormParameters; |
669 } | 682 } |
670 | 683 |
671 /** | 684 /** |
672 * @return {string} | 685 * @return {string} |
673 */ | 686 */ |
674 requestHttpVersion() { | 687 requestHttpVersion() { |
675 var headersText = this.requestHeadersText(); | 688 var headersText = this.requestHeadersText(); |
676 if (!headersText) | 689 if (!headersText) |
677 return this.requestHeaderValue('version') || this.requestHeaderValue(':ver
sion') || 'unknown'; | 690 return this.requestHeaderValue('version') || this.requestHeaderValue(':ver
sion') || this.protocol || 'unknown'; |
678 var firstLine = headersText.split(/\r\n/)[0]; | 691 var firstLine = headersText.split(/\r\n/)[0]; |
679 var match = firstLine.match(/(HTTP\/\d+\.\d+)$/); | 692 var match = firstLine.match(/(HTTP\/\d+\.\d+)$/); |
680 return match ? match[1] : 'HTTP/0.9'; | 693 return match ? match[1] : 'HTTP/0.9'; |
681 } | 694 } |
682 | 695 |
683 /** | 696 /** |
684 * @return {!Array.<!SDK.NetworkRequest.NameValue>} | 697 * @return {!Array.<!SDK.NetworkRequest.NameValue>} |
685 */ | 698 */ |
686 get responseHeaders() { | 699 get responseHeaders() { |
687 return this._responseHeaders || []; | 700 return this._responseHeaders || []; |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
815 this._parsedFormParameters = this._parseParameters(this.requestFormData); | 828 this._parsedFormParameters = this._parseParameters(this.requestFormData); |
816 return this._parsedFormParameters; | 829 return this._parsedFormParameters; |
817 } | 830 } |
818 | 831 |
819 /** | 832 /** |
820 * @return {string} | 833 * @return {string} |
821 */ | 834 */ |
822 responseHttpVersion() { | 835 responseHttpVersion() { |
823 var headersText = this._responseHeadersText; | 836 var headersText = this._responseHeadersText; |
824 if (!headersText) | 837 if (!headersText) |
825 return this.responseHeaderValue('version') || this.responseHeaderValue(':v
ersion') || 'unknown'; | 838 return this.responseHeaderValue('version') || this.responseHeaderValue(':v
ersion') || this.protocol || 'unknown'; |
826 var firstLine = headersText.split(/\r\n/)[0]; | 839 var firstLine = headersText.split(/\r\n/)[0]; |
827 var match = firstLine.match(/^(HTTP\/\d+\.\d+)/); | 840 var match = firstLine.match(/^(HTTP\/\d+\.\d+)/); |
828 return match ? match[1] : 'HTTP/0.9'; | 841 return match ? match[1] : 'HTTP/0.9'; |
829 } | 842 } |
830 | 843 |
831 /** | 844 /** |
832 * @param {string} queryString | 845 * @param {string} queryString |
833 * @return {!Array.<!SDK.NetworkRequest.NameValue>} | 846 * @return {!Array.<!SDK.NetworkRequest.NameValue>} |
834 */ | 847 */ |
835 _parseParameters(queryString) { | 848 _parseParameters(queryString) { |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1140 Send: 'send', | 1153 Send: 'send', |
1141 Receive: 'receive', | 1154 Receive: 'receive', |
1142 Error: 'error' | 1155 Error: 'error' |
1143 }; | 1156 }; |
1144 | 1157 |
1145 /** @typedef {!{type: SDK.NetworkRequest.WebSocketFrameType, time: number, text:
string, opCode: number, mask: boolean}} */ | 1158 /** @typedef {!{type: SDK.NetworkRequest.WebSocketFrameType, time: number, text:
string, opCode: number, mask: boolean}} */ |
1146 SDK.NetworkRequest.WebSocketFrame; | 1159 SDK.NetworkRequest.WebSocketFrame; |
1147 | 1160 |
1148 /** @typedef {!{time: number, eventName: string, eventId: string, data: string}}
*/ | 1161 /** @typedef {!{time: number, eventName: string, eventId: string, data: string}}
*/ |
1149 SDK.NetworkRequest.EventSourceMessage; | 1162 SDK.NetworkRequest.EventSourceMessage; |
OLD | NEW |