Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(858)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/sdk/ResourceTreeModel.js

Issue 2563883005: [DevTools] clean console on navigation as early as possible (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 197
198 this._securityOriginManager.removeSecurityOrigin(frame.securityOrigin); 198 this._securityOriginManager.removeSecurityOrigin(frame.securityOrigin);
199 frame._navigate(framePayload); 199 frame._navigate(framePayload);
200 var addedOrigin = frame.securityOrigin; 200 var addedOrigin = frame.securityOrigin;
201 201
202 this.dispatchEventToListeners(SDK.ResourceTreeModel.Events.FrameNavigated, f rame); 202 this.dispatchEventToListeners(SDK.ResourceTreeModel.Events.FrameNavigated, f rame);
203 if (frame.isMainFrame()) { 203 if (frame.isMainFrame()) {
204 this.dispatchEventToListeners(SDK.ResourceTreeModel.Events.MainFrameNaviga ted, frame); 204 this.dispatchEventToListeners(SDK.ResourceTreeModel.Events.MainFrameNaviga ted, frame);
205 if (Common.moduleSetting('preserveConsoleLog').get()) 205 if (Common.moduleSetting('preserveConsoleLog').get())
206 Common.console.log(Common.UIString('Navigated to %s', frame.url)); 206 Common.console.log(Common.UIString('Navigated to %s', frame.url));
207 else
208 this.target().consoleModel.clear();
209 } 207 }
210 if (addedOrigin) 208 if (addedOrigin)
211 this._securityOriginManager.addSecurityOrigin(addedOrigin); 209 this._securityOriginManager.addSecurityOrigin(addedOrigin);
212 210
213 // Fill frame with retained resources (the ones loaded using new loader). 211 // Fill frame with retained resources (the ones loaded using new loader).
214 var resources = frame.resources(); 212 var resources = frame.resources();
215 for (var i = 0; i < resources.length; ++i) 213 for (var i = 0; i < resources.length; ++i)
216 this.dispatchEventToListeners(SDK.ResourceTreeModel.Events.ResourceAdded, resources[i]); 214 this.dispatchEventToListeners(SDK.ResourceTreeModel.Events.ResourceAdded, resources[i]);
217 215
218 if (frame.isMainFrame()) 216 if (frame.isMainFrame())
(...skipping 13 matching lines...) Expand all
232 return; 230 return;
233 231
234 this._securityOriginManager.removeSecurityOrigin(frame.securityOrigin); 232 this._securityOriginManager.removeSecurityOrigin(frame.securityOrigin);
235 if (frame.parentFrame) 233 if (frame.parentFrame)
236 frame.parentFrame._removeChildFrame(frame); 234 frame.parentFrame._removeChildFrame(frame);
237 else 235 else
238 frame._remove(); 236 frame._remove();
239 } 237 }
240 238
241 /** 239 /**
240 * @param {!Protocol.Page.FrameId} frameId
241 */
242 _frameStartedLoading(frameId) {
243 // Do nothing unless cached resource tree is processed - it will overwrite e verything.
244 if (!this._cachedResourcesProcessed)
245 return;
246
247 var frame = this._frames.get(frameId);
248 if (frame && !frame.isMainFrame())
249 return;
250 if (!Common.moduleSetting('preserveConsoleLog').get())
251 this.target().consoleModel.clear();
252 }
253
254 /**
242 * @param {!Common.Event} event 255 * @param {!Common.Event} event
243 */ 256 */
244 _onRequestFinished(event) { 257 _onRequestFinished(event) {
245 if (!this._cachedResourcesProcessed) 258 if (!this._cachedResourcesProcessed)
246 return; 259 return;
247 260
248 var request = /** @type {!SDK.NetworkRequest} */ (event.data); 261 var request = /** @type {!SDK.NetworkRequest} */ (event.data);
249 if (request.failed || request.resourceType() === Common.resourceTypes.XHR) 262 if (request.failed || request.resourceType() === Common.resourceTypes.XHR)
250 return; 263 return;
251 264
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after
781 */ 794 */
782 frameDetached(frameId) { 795 frameDetached(frameId) {
783 this._resourceTreeModel._frameDetached(frameId); 796 this._resourceTreeModel._frameDetached(frameId);
784 } 797 }
785 798
786 /** 799 /**
787 * @override 800 * @override
788 * @param {!Protocol.Page.FrameId} frameId 801 * @param {!Protocol.Page.FrameId} frameId
789 */ 802 */
790 frameStartedLoading(frameId) { 803 frameStartedLoading(frameId) {
804 this._resourceTreeModel._frameStartedLoading(frameId);
791 } 805 }
792 806
793 /** 807 /**
794 * @override 808 * @override
795 * @param {!Protocol.Page.FrameId} frameId 809 * @param {!Protocol.Page.FrameId} frameId
796 */ 810 */
797 frameStoppedLoading(frameId) { 811 frameStoppedLoading(frameId) {
798 } 812 }
799 813
800 /** 814 /**
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
879 this._resourceTreeModel.dispatchEventToListeners(SDK.ResourceTreeModel.Event s.InterstitialHidden); 893 this._resourceTreeModel.dispatchEventToListeners(SDK.ResourceTreeModel.Event s.InterstitialHidden);
880 } 894 }
881 895
882 /** 896 /**
883 * @override 897 * @override
884 */ 898 */
885 navigationRequested() { 899 navigationRequested() {
886 // Frontend is not interested in when navigations are requested. 900 // Frontend is not interested in when navigations are requested.
887 } 901 }
888 }; 902 };
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698