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

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

Issue 2897713002: DevTools: ResourceTreeModel should not report resources twice (Closed)
Patch Set: Created 3 years, 7 months 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 | « third_party/WebKit/LayoutTests/http/tests/inspector/resource-tree/iframe-main-resource-expected.txt ('k') | 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 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 314
315 /** 315 /**
316 * @param {?SDK.ResourceTreeFrame} parentFrame 316 * @param {?SDK.ResourceTreeFrame} parentFrame
317 * @param {!Protocol.Page.FrameResourceTree} frameTreePayload 317 * @param {!Protocol.Page.FrameResourceTree} frameTreePayload
318 */ 318 */
319 _addFramesRecursively(parentFrame, frameTreePayload) { 319 _addFramesRecursively(parentFrame, frameTreePayload) {
320 var framePayload = frameTreePayload.frame; 320 var framePayload = frameTreePayload.frame;
321 var frame = new SDK.ResourceTreeFrame(this, parentFrame, framePayload.id, fr amePayload, null); 321 var frame = new SDK.ResourceTreeFrame(this, parentFrame, framePayload.id, fr amePayload, null);
322 this._addFrame(frame); 322 this._addFrame(frame);
323 323
324 var frameResource = this._createResourceFromFramePayload(
325 framePayload, framePayload.url, Common.resourceTypes.Document, framePayl oad.mimeType, null, null);
326 frame.addResource(frameResource);
327
328 for (var i = 0; frameTreePayload.childFrames && i < frameTreePayload.childFr ames.length; ++i) 324 for (var i = 0; frameTreePayload.childFrames && i < frameTreePayload.childFr ames.length; ++i)
329 this._addFramesRecursively(frame, frameTreePayload.childFrames[i]); 325 this._addFramesRecursively(frame, frameTreePayload.childFrames[i]);
330 326
331 for (var i = 0; i < frameTreePayload.resources.length; ++i) { 327 for (var i = 0; i < frameTreePayload.resources.length; ++i) {
332 var subresource = frameTreePayload.resources[i]; 328 var subresource = frameTreePayload.resources[i];
333 var resource = this._createResourceFromFramePayload( 329 var resource = this._createResourceFromFramePayload(
334 framePayload, subresource.url, Common.resourceTypes[subresource.type], subresource.mimeType, 330 framePayload, subresource.url, Common.resourceTypes[subresource.type], subresource.mimeType,
335 subresource.lastModified || null, subresource.contentSize || null); 331 subresource.lastModified || null, subresource.contentSize || null);
336 frame.addResource(resource); 332 frame.addResource(resource);
337 } 333 }
334
335 if (!frame._resourcesMap[framePayload.url]) {
336 var frameResource = this._createResourceFromFramePayload(
337 framePayload, framePayload.url, Common.resourceTypes.Document, framePa yload.mimeType, null, null);
338 frame.addResource(frameResource);
339 }
338 } 340 }
339 341
340 /** 342 /**
341 * @param {!Protocol.Page.Frame} frame 343 * @param {!Protocol.Page.Frame} frame
342 * @param {string} url 344 * @param {string} url
343 * @param {!Common.ResourceType} type 345 * @param {!Common.ResourceType} type
344 * @param {string} mimeType 346 * @param {string} mimeType
345 * @param {?number} lastModifiedTime 347 * @param {?number} lastModifiedTime
346 * @param {?number} contentSize 348 * @param {?number} contentSize
347 * @return {!SDK.Resource} 349 * @return {!SDK.Resource}
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after
897 this._resourceTreeModel.dispatchEventToListeners(SDK.ResourceTreeModel.Event s.InterstitialHidden); 899 this._resourceTreeModel.dispatchEventToListeners(SDK.ResourceTreeModel.Event s.InterstitialHidden);
898 } 900 }
899 901
900 /** 902 /**
901 * @override 903 * @override
902 */ 904 */
903 navigationRequested() { 905 navigationRequested() {
904 // Frontend is not interested in when navigations are requested. 906 // Frontend is not interested in when navigations are requested.
905 } 907 }
906 }; 908 };
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/http/tests/inspector/resource-tree/iframe-main-resource-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698