Chromium Code Reviews| Index: third_party/WebKit/Source/devtools/front_end/sources/SourcesNavigator.js |
| diff --git a/third_party/WebKit/Source/devtools/front_end/sources/SourcesNavigator.js b/third_party/WebKit/Source/devtools/front_end/sources/SourcesNavigator.js |
| index 137a2abff6e8d49f2dcafeb677306e782c46400d..7868530a5356db5cb3d21573aabcf6eba0ca3eb6 100644 |
| --- a/third_party/WebKit/Source/devtools/front_end/sources/SourcesNavigator.js |
| +++ b/third_party/WebKit/Source/devtools/front_end/sources/SourcesNavigator.js |
| @@ -159,17 +159,22 @@ WebInspector.SourcesNavigatorView.prototype = { |
| }, |
| /** |
| + * @param {!WebInspector.UISourceCode} uiSourceCode |
| + */ |
| + _revealIfMainTarget: function(uiSourceCode) |
|
dgozman
2016/07/27 20:24:23
Let's inline this back.
eostroukhov-old
2016/07/27 21:39:46
Done.
|
| + { |
| + var mainTarget = WebInspector.targetManager.mainTarget(); |
| + var inspectedURL = mainTarget && mainTarget.inspectedURL(); |
| + if (inspectedURL && WebInspector.networkMapping.networkURL(uiSourceCode) === inspectedURL) |
| + this.revealUISourceCode(uiSourceCode, true); |
| + }, |
| + |
| + /** |
| * @param {!WebInspector.Event} event |
| */ |
| _inspectedURLChanged: function(event) |
| { |
|
dgozman
2016/07/27 20:24:23
Early return if event.data is not a main target.
eostroukhov-old
2016/07/27 21:39:46
Done.
|
| - var nodes = this._uiSourceCodeNodes.valuesArray(); |
| - for (var i = 0; i < nodes.length; ++i) { |
| - var uiSourceCode = nodes[i].uiSourceCode(); |
| - var inspectedPageURL = WebInspector.targetManager.inspectedPageURL(); |
| - if (inspectedPageURL && WebInspector.networkMapping.networkURL(uiSourceCode) === inspectedPageURL) |
| - this.revealUISourceCode(uiSourceCode, true); |
| - } |
| + this._uiSourceCodeNodes.valuesArray().forEach((node) => this._revealIfMainTarget(node.uiSourceCode())); |
|
dgozman
2016/07/27 20:24:23
Using forEach here could be slow compared to old-s
eostroukhov-old
2016/07/27 21:39:46
Done.
|
| }, |
| /** |
| @@ -178,9 +183,7 @@ WebInspector.SourcesNavigatorView.prototype = { |
| */ |
| uiSourceCodeAdded: function(uiSourceCode) |
| { |
| - var inspectedPageURL = WebInspector.targetManager.inspectedPageURL(); |
| - if (inspectedPageURL && WebInspector.networkMapping.networkURL(uiSourceCode) === inspectedPageURL) |
| - this.revealUISourceCode(uiSourceCode, true); |
| + this._revealIfMainTarget(uiSourceCode); |
| }, |
| __proto__: WebInspector.NavigatorView.prototype |