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

Unified Diff: third_party/WebKit/Source/devtools/front_end/sources/SourcesNavigator.js

Issue 2186753002: [DevTools] Track URL through the target (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: InspectedURLChanged now sends target and not just URL Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698