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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 static resourceForURL(url) { | 83 static resourceForURL(url) { |
84 for (var target of SDK.targetManager.targets(SDK.Target.Capability.DOM)) { | 84 for (var target of SDK.targetManager.targets(SDK.Target.Capability.DOM)) { |
85 var mainFrame = SDK.ResourceTreeModel.fromTarget(target).mainFrame; | 85 var mainFrame = SDK.ResourceTreeModel.fromTarget(target).mainFrame; |
86 var result = mainFrame ? mainFrame.resourceForURL(url) : null; | 86 var result = mainFrame ? mainFrame.resourceForURL(url) : null; |
87 if (result) | 87 if (result) |
88 return result; | 88 return result; |
89 } | 89 } |
90 return null; | 90 return null; |
91 } | 91 } |
92 | 92 |
| 93 /** |
| 94 * @param {boolean=} bypassCache |
| 95 * @param {string=} scriptToEvaluateOnLoad |
| 96 */ |
| 97 static reloadAllPages(bypassCache, scriptToEvaluateOnLoad) { |
| 98 for (var resourceTreeModel of SDK.targetManager.models(SDK.ResourceTreeModel
)) { |
| 99 if (!resourceTreeModel.target().parentTarget()) |
| 100 resourceTreeModel.reloadPage(bypassCache, scriptToEvaluateOnLoad); |
| 101 } |
| 102 } |
| 103 |
93 _fetchResourceTree() { | 104 _fetchResourceTree() { |
94 /** @type {!Map<string, !SDK.ResourceTreeFrame>} */ | 105 /** @type {!Map<string, !SDK.ResourceTreeFrame>} */ |
95 this._frames = new Map(); | 106 this._frames = new Map(); |
96 this._cachedResourcesProcessed = false; | 107 this._cachedResourcesProcessed = false; |
97 this._agent.getResourceTree(this._processCachedResources.bind(this)); | 108 this._agent.getResourceTree(this._processCachedResources.bind(this)); |
98 } | 109 } |
99 | 110 |
100 _processCachedResources(error, mainFramePayload) { | 111 _processCachedResources(error, mainFramePayload) { |
101 if (!error) { | 112 if (!error) { |
102 this.dispatchEventToListeners(SDK.ResourceTreeModel.Events.WillLoadCachedR
esources); | 113 this.dispatchEventToListeners(SDK.ResourceTreeModel.Events.WillLoadCachedR
esources); |
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
714 */ | 725 */ |
715 domContentEventFired(time) { | 726 domContentEventFired(time) { |
716 this._resourceTreeModel.dispatchEventToListeners(SDK.ResourceTreeModel.Event
s.DOMContentLoaded, time); | 727 this._resourceTreeModel.dispatchEventToListeners(SDK.ResourceTreeModel.Event
s.DOMContentLoaded, time); |
717 } | 728 } |
718 | 729 |
719 /** | 730 /** |
720 * @override | 731 * @override |
721 * @param {number} time | 732 * @param {number} time |
722 */ | 733 */ |
723 loadEventFired(time) { | 734 loadEventFired(time) { |
724 this._resourceTreeModel.dispatchEventToListeners(SDK.ResourceTreeModel.Event
s.Load, time); | 735 this._resourceTreeModel.dispatchEventToListeners( |
| 736 SDK.ResourceTreeModel.Events.Load, {resourceTreeModel: this._resourceTre
eModel, loadTime: time}); |
725 } | 737 } |
726 | 738 |
727 /** | 739 /** |
728 * @override | 740 * @override |
729 * @param {!Protocol.Page.FrameId} frameId | 741 * @param {!Protocol.Page.FrameId} frameId |
730 * @param {!Protocol.Page.FrameId} parentFrameId | 742 * @param {!Protocol.Page.FrameId} parentFrameId |
731 */ | 743 */ |
732 frameAttached(frameId, parentFrameId) { | 744 frameAttached(frameId, parentFrameId) { |
733 this._resourceTreeModel._frameAttached(frameId, parentFrameId); | 745 this._resourceTreeModel._frameAttached(frameId, parentFrameId); |
734 } | 746 } |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
841 this._resourceTreeModel.dispatchEventToListeners(SDK.ResourceTreeModel.Event
s.InterstitialHidden); | 853 this._resourceTreeModel.dispatchEventToListeners(SDK.ResourceTreeModel.Event
s.InterstitialHidden); |
842 } | 854 } |
843 | 855 |
844 /** | 856 /** |
845 * @override | 857 * @override |
846 */ | 858 */ |
847 navigationRequested() { | 859 navigationRequested() { |
848 // Frontend is not interested in when navigations are requested. | 860 // Frontend is not interested in when navigations are requested. |
849 } | 861 } |
850 }; | 862 }; |
OLD | NEW |