| Index: third_party/WebKit/Source/devtools/front_end/sdk/ResourceTreeModel.js
|
| diff --git a/third_party/WebKit/Source/devtools/front_end/sdk/ResourceTreeModel.js b/third_party/WebKit/Source/devtools/front_end/sdk/ResourceTreeModel.js
|
| index 8f5b5c556d952f8684ed0ecc65228cfba2d22711..035b4ac10cc57e420402d17232bd6be3f1a443e2 100644
|
| --- a/third_party/WebKit/Source/devtools/front_end/sdk/ResourceTreeModel.js
|
| +++ b/third_party/WebKit/Source/devtools/front_end/sdk/ResourceTreeModel.js
|
| @@ -55,6 +55,8 @@ WebInspector.ResourceTreeModel = function(target, networkManager)
|
| this._inspectedPageURL = "";
|
| this._pendingReloadOptions = null;
|
| this._reloadSuspensionCount = 0;
|
| +
|
| + target.runtimeModel.setExecutionContextComparator(this._executionContextComparator.bind(this));
|
| }
|
|
|
| WebInspector.ResourceTreeModel.EventTypes = {
|
| @@ -486,6 +488,49 @@ WebInspector.ResourceTreeModel.prototype = {
|
| callback(url, data || null, errors);
|
| }
|
| },
|
| + /**
|
| + * @param {!WebInspector.ExecutionContext} a
|
| + * @param {!WebInspector.ExecutionContext} b
|
| + * @return {number}
|
| + */
|
| + _executionContextComparator: function(a,b)
|
| + {
|
| + /**
|
| + * @param {!WebInspector.ResourceTreeFrame} frame
|
| + */
|
| + function framePath(frame)
|
| + {
|
| + var currentFrame = frame;
|
| + var parents = [];
|
| + while (currentFrame) {
|
| + parents.push(currentFrame);
|
| + currentFrame = currentFrame.parentFrame;
|
| + }
|
| + return parents.reverse();
|
| + }
|
| +
|
| + var framesA = a.frameId ? framePath(this.frameForId(a.frameId)) : [];
|
| + var framesB = b.frameId ? framePath(this.frameForId(b.frameId)) : [];
|
| + var frameA;
|
| + var frameB;
|
| + for (var i = 0; ; i++) {
|
| + if (!framesA[i] || !framesB[i] || (framesA[i] !== framesB[i])) {
|
| + frameA = framesA[i];
|
| + frameB = framesB[i];
|
| + break;
|
| + }
|
| + }
|
| + if (!frameA && frameB)
|
| + return -1;
|
| +
|
| + if (!frameB && frameA)
|
| + return 1;
|
| +
|
| + if (frameA && frameB) {
|
| + return frameA.id.localeCompare(frameB.id);
|
| + }
|
| + return WebInspector.ExecutionContext.comparator(a,b);
|
| + },
|
|
|
| __proto__: WebInspector.SDKModel.prototype
|
| }
|
|
|