| 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 27 matching lines...) Expand all Loading... |
| 38 WebInspector.SDKObject.call(this, target); | 38 WebInspector.SDKObject.call(this, target); |
| 39 | 39 |
| 40 this._requests = []; | 40 this._requests = []; |
| 41 this._requestForId = {}; | 41 this._requestForId = {}; |
| 42 target.networkManager.addEventListener(WebInspector.NetworkManager.EventType
s.RequestStarted, this._onRequestStarted, this); | 42 target.networkManager.addEventListener(WebInspector.NetworkManager.EventType
s.RequestStarted, this._onRequestStarted, this); |
| 43 target.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.Eve
ntTypes.MainFrameNavigated, this._onMainFrameNavigated, this); | 43 target.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.Eve
ntTypes.MainFrameNavigated, this._onMainFrameNavigated, this); |
| 44 target.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.Eve
ntTypes.Load, this._onLoad, this); | 44 target.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.Eve
ntTypes.Load, this._onLoad, this); |
| 45 target.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.Eve
ntTypes.DOMContentLoaded, this._onDOMContentLoaded, this); | 45 target.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.Eve
ntTypes.DOMContentLoaded, this._onDOMContentLoaded, this); |
| 46 } | 46 } |
| 47 | 47 |
| 48 /** |
| 49 * @param {string} url |
| 50 * @return {?WebInspector.NetworkRequest} |
| 51 */ |
| 52 WebInspector.NetworkLog.requestForURL = function(url) |
| 53 { |
| 54 for (var target of WebInspector.targetManager.targets()) { |
| 55 var result = target.networkLog.requestForURL(url); |
| 56 if (result) |
| 57 return result; |
| 58 } |
| 59 return null; |
| 60 } |
| 61 |
| 62 /** |
| 63 * @return {!Array.<!WebInspector.NetworkRequest>} |
| 64 */ |
| 65 WebInspector.NetworkLog.requests = function() |
| 66 { |
| 67 var result = []; |
| 68 for (var target of WebInspector.targetManager.targets()) { |
| 69 result = result.concat(target.networkLog.requests()); |
| 70 } |
| 71 return result; |
| 72 } |
| 73 |
| 48 WebInspector.NetworkLog.prototype = { | 74 WebInspector.NetworkLog.prototype = { |
| 49 /** | 75 /** |
| 50 * @return {!Array.<!WebInspector.NetworkRequest>} | 76 * @return {!Array.<!WebInspector.NetworkRequest>} |
| 51 */ | 77 */ |
| 52 get requests() | 78 requests: function() |
| 53 { | 79 { |
| 54 return this._requests; | 80 return this._requests; |
| 55 }, | 81 }, |
| 56 | 82 |
| 57 /** | 83 /** |
| 58 * @param {string} url | 84 * @param {string} url |
| 59 * @return {?WebInspector.NetworkRequest} | 85 * @return {?WebInspector.NetworkRequest} |
| 60 */ | 86 */ |
| 61 requestForURL: function(url) | 87 requestForURL: function(url) |
| 62 { | 88 { |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 */ | 159 */ |
| 134 requestForId: function(requestId) | 160 requestForId: function(requestId) |
| 135 { | 161 { |
| 136 return this._requestForId[requestId]; | 162 return this._requestForId[requestId]; |
| 137 }, | 163 }, |
| 138 | 164 |
| 139 __proto__: WebInspector.SDKObject.prototype | 165 __proto__: WebInspector.SDKObject.prototype |
| 140 } | 166 } |
| 141 | 167 |
| 142 /** | 168 /** |
| 143 * @type {!WebInspector.NetworkLog} | |
| 144 */ | |
| 145 WebInspector.networkLog; | |
| 146 | |
| 147 /** | |
| 148 * @constructor | 169 * @constructor |
| 149 * @param {!WebInspector.NetworkRequest} mainRequest | 170 * @param {!WebInspector.NetworkRequest} mainRequest |
| 150 */ | 171 */ |
| 151 WebInspector.PageLoad = function(mainRequest) | 172 WebInspector.PageLoad = function(mainRequest) |
| 152 { | 173 { |
| 153 this.id = ++WebInspector.PageLoad._lastIdentifier; | 174 this.id = ++WebInspector.PageLoad._lastIdentifier; |
| 154 this.url = mainRequest.url; | 175 this.url = mainRequest.url; |
| 155 this.startTime = mainRequest.startTime; | 176 this.startTime = mainRequest.startTime; |
| 156 } | 177 } |
| 157 | 178 |
| 158 WebInspector.PageLoad._lastIdentifier = 0; | 179 WebInspector.PageLoad._lastIdentifier = 0; |
| OLD | NEW |