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

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

Issue 2434853003: DevTools: [Sources] sourcesNavigator should not rely on existance of main target (Closed)
Patch Set: Created 4 years, 2 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 | « no previous file | 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 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 10 *
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 /** 52 /**
53 * @param {!WebInspector.Event} event 53 * @param {!WebInspector.Event} event
54 */ 54 */
55 _inspectedURLChanged: function(event) 55 _inspectedURLChanged: function(event)
56 { 56 {
57 var mainTarget = WebInspector.targetManager.mainTarget(); 57 var mainTarget = WebInspector.targetManager.mainTarget();
58 if (event.data !== mainTarget) 58 if (event.data !== mainTarget)
59 return; 59 return;
60 var inspectedURL = mainTarget && mainTarget.inspectedURL(); 60 var inspectedURL = mainTarget && mainTarget.inspectedURL();
61 if (!inspectedURL) 61 if (!inspectedURL)
62 return 62 return;
63 for (var node of this._uiSourceCodeNodes.valuesArray()) { 63 for (var node of this._uiSourceCodeNodes.valuesArray()) {
64 var uiSourceCode = node.uiSourceCode(); 64 var uiSourceCode = node.uiSourceCode();
65 if (uiSourceCode.url() === inspectedURL) 65 if (uiSourceCode.url() === inspectedURL)
66 this.revealUISourceCode(uiSourceCode, true); 66 this.revealUISourceCode(uiSourceCode, true);
67 } 67 }
68 }, 68 },
69 69
70 /** 70 /**
71 * @override 71 * @override
72 * @param {!WebInspector.UISourceCode} uiSourceCode 72 * @param {!WebInspector.UISourceCode} uiSourceCode
73 */ 73 */
74 uiSourceCodeAdded: function(uiSourceCode) 74 uiSourceCodeAdded: function(uiSourceCode)
75 { 75 {
76 var inspectedPageURL = WebInspector.targetManager.mainTarget().inspected URL(); 76 var mainTarget = WebInspector.targetManager.mainTarget();
77 if (uiSourceCode.url() === inspectedPageURL) 77 var inspectedURL = mainTarget && mainTarget.inspectedURL();
78 if (!inspectedURL)
79 return;
80 if (uiSourceCode.url() === inspectedURL)
78 this.revealUISourceCode(uiSourceCode, true); 81 this.revealUISourceCode(uiSourceCode, true);
79 }, 82 },
80 83
81 /** 84 /**
82 * @override 85 * @override
83 * @param {!Event} event 86 * @param {!Event} event
84 */ 87 */
85 handleContextMenu: function(event) 88 handleContextMenu: function(event)
86 { 89 {
87 var contextMenu = new WebInspector.ContextMenu(event); 90 var contextMenu = new WebInspector.ContextMenu(event);
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 this.revealUISourceCode(uiSourceCode, true); 133 this.revealUISourceCode(uiSourceCode, true);
131 } 134 }
132 }, 135 },
133 136
134 /** 137 /**
135 * @override 138 * @override
136 * @param {!WebInspector.UISourceCode} uiSourceCode 139 * @param {!WebInspector.UISourceCode} uiSourceCode
137 */ 140 */
138 uiSourceCodeAdded: function(uiSourceCode) 141 uiSourceCodeAdded: function(uiSourceCode)
139 { 142 {
140 var inspectedPageURL = WebInspector.targetManager.mainTarget().inspected URL(); 143 var mainTarget = WebInspector.targetManager.mainTarget();
141 if (uiSourceCode.url() === inspectedPageURL) 144 var inspectedURL = mainTarget && mainTarget.inspectedURL();
145 if (!inspectedURL)
146 return;
147 if (uiSourceCode.url() === inspectedURL)
142 this.revealUISourceCode(uiSourceCode, true); 148 this.revealUISourceCode(uiSourceCode, true);
143 }, 149 },
144 150
145 __proto__: WebInspector.NavigatorView.prototype 151 __proto__: WebInspector.NavigatorView.prototype
146 } 152 }
147 153
148 /** 154 /**
149 * @constructor 155 * @constructor
150 * @extends {WebInspector.NavigatorView} 156 * @extends {WebInspector.NavigatorView}
151 */ 157 */
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 /** 296 /**
291 * @override 297 * @override
292 */ 298 */
293 sourceDeleted: function(uiSourceCode) 299 sourceDeleted: function(uiSourceCode)
294 { 300 {
295 this._handleRemoveSnippet(uiSourceCode); 301 this._handleRemoveSnippet(uiSourceCode);
296 }, 302 },
297 303
298 __proto__: WebInspector.NavigatorView.prototype 304 __proto__: WebInspector.NavigatorView.prototype
299 } 305 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698