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

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

Issue 2376583002: DevTools: remove WI.NetworkMapping.networkURL (Closed)
Patch Set: do not blackbox fs uiSourceCodes 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @constructor 6 * @constructor
7 * @implements {WebInspector.DebuggerSourceMapping} 7 * @implements {WebInspector.DebuggerSourceMapping}
8 * @param {!WebInspector.DebuggerModel} debuggerModel 8 * @param {!WebInspector.DebuggerModel} debuggerModel
9 * @param {!WebInspector.ScriptFormatterEditorAction} editorAction 9 * @param {!WebInspector.ScriptFormatterEditorAction} editorAction
10 */ 10 */
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 152
153 /** 153 /**
154 * @param {!WebInspector.Event} event 154 * @param {!WebInspector.Event} event
155 */ 155 */
156 _editorSelected: function(event) 156 _editorSelected: function(event)
157 { 157 {
158 var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (event.data ); 158 var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (event.data );
159 this._updateButton(uiSourceCode); 159 this._updateButton(uiSourceCode);
160 160
161 var path = uiSourceCode.project().id() + ":" + uiSourceCode.url(); 161 var path = uiSourceCode.project().id() + ":" + uiSourceCode.url();
162 var networkURL = WebInspector.networkMapping.networkURL(uiSourceCode); 162 if (this._isFormatableScript(uiSourceCode) && this._pathsToFormatOnLoad. has(path) && !this._formattedPaths.get(path))
163 if (this._isFormatableScript(uiSourceCode) && networkURL && this._pathsT oFormatOnLoad.has(path) && !this._formattedPaths.get(path))
164 this._formatUISourceCodeScript(uiSourceCode); 163 this._formatUISourceCodeScript(uiSourceCode);
165 }, 164 },
166 165
167 /** 166 /**
168 * @param {!WebInspector.Event} event 167 * @param {!WebInspector.Event} event
169 */ 168 */
170 _editorClosed: function(event) 169 _editorClosed: function(event)
171 { 170 {
172 var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (event.data .uiSourceCode); 171 var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (event.data .uiSourceCode);
173 var wasSelected = /** @type {boolean} */ (event.data.wasSelected); 172 var wasSelected = /** @type {boolean} */ (event.data.wasSelected);
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 * @return {boolean} 315 * @return {boolean}
317 */ 316 */
318 function isInlineScript(script) 317 function isInlineScript(script)
319 { 318 {
320 return script.isInlineScript() && !script.hasSourceURL; 319 return script.isInlineScript() && !script.hasSourceURL;
321 } 320 }
322 321
323 if (uiSourceCode.contentType() === WebInspector.resourceTypes.Document) { 322 if (uiSourceCode.contentType() === WebInspector.resourceTypes.Document) {
324 var scripts = []; 323 var scripts = [];
325 var debuggerModels = WebInspector.DebuggerModel.instances(); 324 var debuggerModels = WebInspector.DebuggerModel.instances();
326 for (var i = 0; i < debuggerModels.length; ++i) { 325 for (var i = 0; i < debuggerModels.length; ++i)
327 var networkURL = WebInspector.networkMapping.networkURL(uiSource Code); 326 scripts.pushAll(debuggerModels[i].scriptsForSourceURL(uiSourceCo de.url()));
328 scripts.pushAll(debuggerModels[i].scriptsForSourceURL(networkURL ));
329 }
330 return scripts.filter(isInlineScript); 327 return scripts.filter(isInlineScript);
331 } 328 }
332 if (uiSourceCode.contentType().isScript()) { 329 if (uiSourceCode.contentType().isScript()) {
333 var rawLocations = WebInspector.debuggerWorkspaceBinding.uiLocationT oRawLocations(uiSourceCode, 0, 0); 330 var rawLocations = WebInspector.debuggerWorkspaceBinding.uiLocationT oRawLocations(uiSourceCode, 0, 0);
334 return rawLocations.map(function(rawLocation) { return rawLocation.s cript(); }); 331 return rawLocations.map(function(rawLocation) { return rawLocation.s cript(); });
335 } 332 }
336 return []; 333 return [];
337 }, 334 },
338 335
339 /** 336 /**
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 385
389 var targets = WebInspector.targetManager.targets(); 386 var targets = WebInspector.targetManager.targets();
390 for (var i = 0; i < targets.length; ++i) { 387 for (var i = 0; i < targets.length; ++i) {
391 var scriptMapping = /** @type {!WebInspector.FormatterScriptMapp ing} */(this._scriptMappingByTarget.get(targets[i])); 388 var scriptMapping = /** @type {!WebInspector.FormatterScriptMapp ing} */(this._scriptMappingByTarget.get(targets[i]));
392 WebInspector.debuggerWorkspaceBinding.setSourceMapping(targets[i ], formattedUISourceCode, scriptMapping); 389 WebInspector.debuggerWorkspaceBinding.setSourceMapping(targets[i ], formattedUISourceCode, scriptMapping);
393 } 390 }
394 this._showIfNeeded(uiSourceCode, formattedUISourceCode, formatterMap ping); 391 this._showIfNeeded(uiSourceCode, formattedUISourceCode, formatterMap ping);
395 } 392 }
396 } 393 }
397 } 394 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698