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

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

Issue 2647153002: [DevTools] Improve context and target naming. (Closed)
Patch Set: fixed comments and sorting Created 3 years, 11 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
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 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 function framePath(frame) { 397 function framePath(frame) {
398 var currentFrame = frame; 398 var currentFrame = frame;
399 var parents = []; 399 var parents = [];
400 while (currentFrame) { 400 while (currentFrame) {
401 parents.push(currentFrame); 401 parents.push(currentFrame);
402 currentFrame = currentFrame.parentFrame; 402 currentFrame = currentFrame.parentFrame;
403 } 403 }
404 return parents.reverse(); 404 return parents.reverse();
405 } 405 }
406 406
407 if (a.target() !== b.target())
408 return SDK.ExecutionContext.comparator(a, b);
409
407 var framesA = a.frameId ? framePath(this.frameForId(a.frameId)) : []; 410 var framesA = a.frameId ? framePath(this.frameForId(a.frameId)) : [];
408 var framesB = b.frameId ? framePath(this.frameForId(b.frameId)) : []; 411 var framesB = b.frameId ? framePath(this.frameForId(b.frameId)) : [];
409 var frameA; 412 var frameA;
410 var frameB; 413 var frameB;
411 for (var i = 0;; i++) { 414 for (var i = 0;; i++) {
412 if (!framesA[i] || !framesB[i] || (framesA[i] !== framesB[i])) { 415 if (!framesA[i] || !framesB[i] || (framesA[i] !== framesB[i])) {
413 frameA = framesA[i]; 416 frameA = framesA[i];
414 frameB = framesB[i]; 417 frameB = framesB[i];
415 break; 418 break;
416 } 419 }
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
716 if (this._childFrames[i]._callForFrameResources(callback)) 719 if (this._childFrames[i]._callForFrameResources(callback))
717 return true; 720 return true;
718 } 721 }
719 return false; 722 return false;
720 } 723 }
721 724
722 /** 725 /**
723 * @return {string} 726 * @return {string}
724 */ 727 */
725 displayName() { 728 displayName() {
726 if (!this._parentFrame) 729 if (!this._parentFrame && !this._model.target().parentTarget())
727 return Common.UIString('top'); 730 return Common.UIString('top');
728 var subtitle = new Common.ParsedURL(this._url).displayName; 731 var subtitle = new Common.ParsedURL(this._url).displayName;
729 if (subtitle) { 732 if (subtitle) {
730 if (!this._name) 733 if (!this._name)
731 return subtitle; 734 return subtitle;
732 return this._name + ' (' + subtitle + ')'; 735 return this._name + ' (' + subtitle + ')';
733 } 736 }
734 return Common.UIString('<iframe>'); 737 return Common.UIString('<iframe>');
735 } 738 }
736 }; 739 };
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
883 this._resourceTreeModel.dispatchEventToListeners(SDK.ResourceTreeModel.Event s.InterstitialHidden); 886 this._resourceTreeModel.dispatchEventToListeners(SDK.ResourceTreeModel.Event s.InterstitialHidden);
884 } 887 }
885 888
886 /** 889 /**
887 * @override 890 * @override
888 */ 891 */
889 navigationRequested() { 892 navigationRequested() {
890 // Frontend is not interested in when navigations are requested. 893 // Frontend is not interested in when navigations are requested.
891 } 894 }
892 }; 895 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698