| 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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 this._frames.set(frame.id, frame); | 131 this._frames.set(frame.id, frame); |
| 132 if (frame.isMainFrame()) | 132 if (frame.isMainFrame()) |
| 133 this.mainFrame = frame; | 133 this.mainFrame = frame; |
| 134 this.dispatchEventToListeners(SDK.ResourceTreeModel.Events.FrameAdded, frame
); | 134 this.dispatchEventToListeners(SDK.ResourceTreeModel.Events.FrameAdded, frame
); |
| 135 this._updateSecurityOrigins(); | 135 this._updateSecurityOrigins(); |
| 136 } | 136 } |
| 137 | 137 |
| 138 /** | 138 /** |
| 139 * @param {!Protocol.Page.FrameId} frameId | 139 * @param {!Protocol.Page.FrameId} frameId |
| 140 * @param {?Protocol.Page.FrameId} parentFrameId | 140 * @param {?Protocol.Page.FrameId} parentFrameId |
| 141 * @param {!Protocol.Runtime.StackTrace=} stackTrace |
| 141 * @return {?SDK.ResourceTreeFrame} | 142 * @return {?SDK.ResourceTreeFrame} |
| 142 */ | 143 */ |
| 143 _frameAttached(frameId, parentFrameId) { | 144 _frameAttached(frameId, parentFrameId, stackTrace) { |
| 144 // Do nothing unless cached resource tree is processed - it will overwrite e
verything. | 145 // Do nothing unless cached resource tree is processed - it will overwrite e
verything. |
| 145 if (!this._cachedResourcesProcessed && parentFrameId) | 146 if (!this._cachedResourcesProcessed && parentFrameId) |
| 146 return null; | 147 return null; |
| 147 if (this._frames.has(frameId)) | 148 if (this._frames.has(frameId)) |
| 148 return null; | 149 return null; |
| 149 | 150 |
| 151 var callFrames = null; |
| 152 if (stackTrace && stackTrace.callFrames) |
| 153 callFrames = stackTrace.callFrames; |
| 154 |
| 150 var parentFrame = parentFrameId ? (this._frames.get(parentFrameId) || null)
: null; | 155 var parentFrame = parentFrameId ? (this._frames.get(parentFrameId) || null)
: null; |
| 151 var frame = new SDK.ResourceTreeFrame(this, parentFrame, frameId); | 156 var frame = new SDK.ResourceTreeFrame(this, parentFrame, frameId, null, call
Frames); |
| 152 if (frame.isMainFrame() && this.mainFrame) { | 157 if (frame.isMainFrame() && this.mainFrame) { |
| 153 // Navigation to the new backend process. | 158 // Navigation to the new backend process. |
| 154 this._frameDetached(this.mainFrame.id); | 159 this._frameDetached(this.mainFrame.id); |
| 155 } | 160 } |
| 156 this._addFrame(frame, true); | 161 this._addFrame(frame, true); |
| 157 return frame; | 162 return frame; |
| 158 } | 163 } |
| 159 | 164 |
| 160 /** | 165 /** |
| 161 * @param {!Protocol.Page.Frame} framePayload | 166 * @param {!Protocol.Page.Frame} framePayload |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 // Workers call into this with no frames available. | 297 // Workers call into this with no frames available. |
| 293 return this.mainFrame ? this.mainFrame.resourceForURL(url) : null; | 298 return this.mainFrame ? this.mainFrame.resourceForURL(url) : null; |
| 294 } | 299 } |
| 295 | 300 |
| 296 /** | 301 /** |
| 297 * @param {?SDK.ResourceTreeFrame} parentFrame | 302 * @param {?SDK.ResourceTreeFrame} parentFrame |
| 298 * @param {!Protocol.Page.FrameResourceTree} frameTreePayload | 303 * @param {!Protocol.Page.FrameResourceTree} frameTreePayload |
| 299 */ | 304 */ |
| 300 _addFramesRecursively(parentFrame, frameTreePayload) { | 305 _addFramesRecursively(parentFrame, frameTreePayload) { |
| 301 var framePayload = frameTreePayload.frame; | 306 var framePayload = frameTreePayload.frame; |
| 302 var frame = new SDK.ResourceTreeFrame(this, parentFrame, framePayload.id, fr
amePayload); | 307 var frame = new SDK.ResourceTreeFrame(this, parentFrame, framePayload.id, fr
amePayload, null); |
| 303 this._addFrame(frame); | 308 this._addFrame(frame); |
| 304 | 309 |
| 305 var frameResource = this._createResourceFromFramePayload( | 310 var frameResource = this._createResourceFromFramePayload( |
| 306 framePayload, framePayload.url, Common.resourceTypes.Document, framePayl
oad.mimeType, null, null); | 311 framePayload, framePayload.url, Common.resourceTypes.Document, framePayl
oad.mimeType, null, null); |
| 307 frame.addResource(frameResource); | 312 frame.addResource(frameResource); |
| 308 | 313 |
| 309 for (var i = 0; frameTreePayload.childFrames && i < frameTreePayload.childFr
ames.length; ++i) | 314 for (var i = 0; frameTreePayload.childFrames && i < frameTreePayload.childFr
ames.length; ++i) |
| 310 this._addFramesRecursively(frame, frameTreePayload.childFrames[i]); | 315 this._addFramesRecursively(frame, frameTreePayload.childFrames[i]); |
| 311 | 316 |
| 312 for (var i = 0; i < frameTreePayload.resources.length; ++i) { | 317 for (var i = 0; i < frameTreePayload.resources.length; ++i) { |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 | 471 |
| 467 | 472 |
| 468 /** | 473 /** |
| 469 * @unrestricted | 474 * @unrestricted |
| 470 */ | 475 */ |
| 471 SDK.ResourceTreeFrame = class { | 476 SDK.ResourceTreeFrame = class { |
| 472 /** | 477 /** |
| 473 * @param {!SDK.ResourceTreeModel} model | 478 * @param {!SDK.ResourceTreeModel} model |
| 474 * @param {?SDK.ResourceTreeFrame} parentFrame | 479 * @param {?SDK.ResourceTreeFrame} parentFrame |
| 475 * @param {!Protocol.Page.FrameId} frameId | 480 * @param {!Protocol.Page.FrameId} frameId |
| 476 * @param {!Protocol.Page.Frame=} payload | 481 * @param {?Protocol.Page.Frame} payload |
| 482 * @param {?Array<!Protocol.Runtime.CallFrame>} creationStackTrace |
| 477 */ | 483 */ |
| 478 constructor(model, parentFrame, frameId, payload) { | 484 constructor(model, parentFrame, frameId, payload, creationStackTrace) { |
| 479 this._model = model; | 485 this._model = model; |
| 480 this._parentFrame = parentFrame; | 486 this._parentFrame = parentFrame; |
| 481 this._id = frameId; | 487 this._id = frameId; |
| 482 this._url = ''; | 488 this._url = ''; |
| 483 | 489 |
| 484 if (payload) { | 490 if (payload) { |
| 485 this._loaderId = payload.loaderId; | 491 this._loaderId = payload.loaderId; |
| 486 this._name = payload.name; | 492 this._name = payload.name; |
| 487 this._url = payload.url; | 493 this._url = payload.url; |
| 488 this._securityOrigin = payload.securityOrigin; | 494 this._securityOrigin = payload.securityOrigin; |
| 489 this._mimeType = payload.mimeType; | 495 this._mimeType = payload.mimeType; |
| 490 } | 496 } |
| 491 | 497 |
| 498 this._creationStackTrace = creationStackTrace; |
| 499 |
| 492 /** | 500 /** |
| 493 * @type {!Array.<!SDK.ResourceTreeFrame>} | 501 * @type {!Array.<!SDK.ResourceTreeFrame>} |
| 494 */ | 502 */ |
| 495 this._childFrames = []; | 503 this._childFrames = []; |
| 496 | 504 |
| 497 /** | 505 /** |
| 498 * @type {!Object.<string, !SDK.Resource>} | 506 * @type {!Object.<string, !SDK.Resource>} |
| 499 */ | 507 */ |
| 500 this._resourcesMap = {}; | 508 this._resourcesMap = {}; |
| 501 | 509 |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 760 * @param {number} time | 768 * @param {number} time |
| 761 */ | 769 */ |
| 762 loadEventFired(time) { | 770 loadEventFired(time) { |
| 763 this._resourceTreeModel.dispatchEventToListeners(SDK.ResourceTreeModel.Event
s.Load, time); | 771 this._resourceTreeModel.dispatchEventToListeners(SDK.ResourceTreeModel.Event
s.Load, time); |
| 764 } | 772 } |
| 765 | 773 |
| 766 /** | 774 /** |
| 767 * @override | 775 * @override |
| 768 * @param {!Protocol.Page.FrameId} frameId | 776 * @param {!Protocol.Page.FrameId} frameId |
| 769 * @param {!Protocol.Page.FrameId} parentFrameId | 777 * @param {!Protocol.Page.FrameId} parentFrameId |
| 778 * @param {!Protocol.Runtime.StackTrace=} stackTrace |
| 770 */ | 779 */ |
| 771 frameAttached(frameId, parentFrameId) { | 780 frameAttached(frameId, parentFrameId, stackTrace) { |
| 772 this._resourceTreeModel._frameAttached(frameId, parentFrameId); | 781 this._resourceTreeModel._frameAttached(frameId, parentFrameId, stackTrace); |
| 773 } | 782 } |
| 774 | 783 |
| 775 /** | 784 /** |
| 776 * @override | 785 * @override |
| 777 * @param {!Protocol.Page.Frame} frame | 786 * @param {!Protocol.Page.Frame} frame |
| 778 */ | 787 */ |
| 779 frameNavigated(frame) { | 788 frameNavigated(frame) { |
| 780 this._resourceTreeModel._frameNavigated(frame); | 789 this._resourceTreeModel._frameNavigated(frame); |
| 781 } | 790 } |
| 782 | 791 |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 880 this._resourceTreeModel.dispatchEventToListeners(SDK.ResourceTreeModel.Event
s.InterstitialHidden); | 889 this._resourceTreeModel.dispatchEventToListeners(SDK.ResourceTreeModel.Event
s.InterstitialHidden); |
| 881 } | 890 } |
| 882 | 891 |
| 883 /** | 892 /** |
| 884 * @override | 893 * @override |
| 885 */ | 894 */ |
| 886 navigationRequested() { | 895 navigationRequested() { |
| 887 // Frontend is not interested in when navigations are requested. | 896 // Frontend is not interested in when navigations are requested. |
| 888 } | 897 } |
| 889 }; | 898 }; |
| OLD | NEW |