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

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

Issue 399643002: DevTools: Support multiple target in ScriptFormatterAction (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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 unified diff | Download patch | Annotate | Revision Log
« 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 // 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.SourceMapping} 7 * @implements {WebInspector.SourceMapping}
8 * @param {!WebInspector.Workspace} workspace 8 * @param {!WebInspector.Target} target
9 * @param {!WebInspector.DebuggerModel} debuggerModel 9 * @param {!WebInspector.ScriptFormatterEditorAction} editorAction
10 */ 10 */
11 WebInspector.FormatterScriptMapping = function(workspace, debuggerModel) 11 WebInspector.FormatterScriptMapping = function(target, editorAction)
12 { 12 {
13 this._workspace = workspace; 13 this._target = target;
14 this._debuggerModel = debuggerModel; 14 this._editorAction = editorAction;
15
16 this._init();
17
18 this._projectId = "formatter:";
19 this._projectDelegate = new WebInspector.FormatterProjectDelegate(workspace, this._projectId);
20 this._debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.Globa lObjectCleared, this._debuggerReset, this);
21 } 15 }
22 16
23 WebInspector.FormatterScriptMapping.prototype = { 17 WebInspector.FormatterScriptMapping.prototype = {
24 /** 18 /**
25 * @param {!WebInspector.RawLocation} rawLocation 19 * @param {!WebInspector.RawLocation} rawLocation
26 * @return {?WebInspector.UILocation} 20 * @return {?WebInspector.UILocation}
27 */ 21 */
28 rawLocationToUILocation: function(rawLocation) 22 rawLocationToUILocation: function(rawLocation)
29 { 23 {
30 var debuggerModelLocation = /** @type {!WebInspector.DebuggerModel.Locat ion} */ (rawLocation); 24 var debuggerModelLocation = /** @type {!WebInspector.DebuggerModel.Locat ion} */ (rawLocation);
31 var script = debuggerModelLocation.script(); 25 var script = debuggerModelLocation.script();
32 var uiSourceCode = this._uiSourceCodes.get(script); 26 var uiSourceCode = this._editorAction._uiSourceCodes.get(script);
33 if (!uiSourceCode) 27 if (!uiSourceCode)
34 return null; 28 return null;
35 29
36 var formatData = this._formatData.get(uiSourceCode); 30 var formatData = this._editorAction._formatData.get(uiSourceCode);
37 if (!formatData) 31 if (!formatData)
38 return null; 32 return null;
39 var mapping = formatData.mapping; 33 var mapping = formatData.mapping;
40 var lineNumber = debuggerModelLocation.lineNumber; 34 var lineNumber = debuggerModelLocation.lineNumber;
41 var columnNumber = debuggerModelLocation.columnNumber || 0; 35 var columnNumber = debuggerModelLocation.columnNumber || 0;
42 var formattedLocation = mapping.originalToFormatted(lineNumber, columnNu mber); 36 var formattedLocation = mapping.originalToFormatted(lineNumber, columnNu mber);
43 return uiSourceCode.uiLocation(formattedLocation[0], formattedLocation[1 ]); 37 return uiSourceCode.uiLocation(formattedLocation[0], formattedLocation[1 ]);
44 }, 38 },
45 39
46 /** 40 /**
47 * @param {!WebInspector.UISourceCode} uiSourceCode 41 * @param {!WebInspector.UISourceCode} uiSourceCode
48 * @param {number} lineNumber 42 * @param {number} lineNumber
49 * @param {number} columnNumber 43 * @param {number} columnNumber
50 * @return {?WebInspector.DebuggerModel.Location} 44 * @return {?WebInspector.DebuggerModel.Location}
51 */ 45 */
52 uiLocationToRawLocation: function(uiSourceCode, lineNumber, columnNumber) 46 uiLocationToRawLocation: function(uiSourceCode, lineNumber, columnNumber)
53 { 47 {
54 var formatData = this._formatData.get(uiSourceCode); 48 var formatData = this._editorAction._formatData.get(uiSourceCode);
55 if (!formatData) 49 if (!formatData)
56 return null; 50 return null;
57 var originalLocation = formatData.mapping.formattedToOriginal(lineNumber , columnNumber) 51 var originalLocation = formatData.mapping.formattedToOriginal(lineNumber , columnNumber);
58 return this._debuggerModel.createRawLocation(formatData.scripts[0], orig inalLocation[0], originalLocation[1]); 52 for (var i = 0; i < formatData.scripts.length; ++i) {
53 if (formatData.scripts[i].target() === this._target)
54 return this._target.debuggerModel.createRawLocation(formatData.s cripts[i], originalLocation[0], originalLocation[1])
55 }
56 return null;
59 }, 57 },
60 58
61 /** 59 /**
62 * @return {boolean} 60 * @return {boolean}
63 */ 61 */
64 isIdentity: function() 62 isIdentity: function()
65 { 63 {
66 return false; 64 return false;
67 }, 65 },
68 66
69 /** 67 /**
70 * @param {!WebInspector.UISourceCode} uiSourceCode 68 * @param {!WebInspector.UISourceCode} uiSourceCode
71 * @param {number} lineNumber 69 * @param {number} lineNumber
72 * @return {boolean} 70 * @return {boolean}
73 */ 71 */
74 uiLineHasMapping: function(uiSourceCode, lineNumber) 72 uiLineHasMapping: function(uiSourceCode, lineNumber)
75 { 73 {
76 return true; 74 return true;
77 }, 75 }
78 76
79 /**
80 * @param {!WebInspector.UISourceCode} uiSourceCode
81 * @return {!Array.<!WebInspector.Script>}
82 */
83 _scriptsForUISourceCode: function(uiSourceCode)
84 {
85 /**
86 * @param {!WebInspector.Script} script
87 * @return {boolean}
88 */
89 function isInlineScript(script)
90 {
91 return script.isInlineScript();
92 }
93
94 if (uiSourceCode.contentType() === WebInspector.resourceTypes.Document)
95 return this._debuggerModel.scriptsForSourceURL(uiSourceCode.url).fil ter(isInlineScript);
96 if (uiSourceCode.contentType() === WebInspector.resourceTypes.Script) {
97 var rawLocation = /** @type {!WebInspector.DebuggerModel.Location} */ (uiSourceCode.uiLocationToRawLocation(this._debuggerModel.target(), 0, 0));
98 return rawLocation ? [rawLocation.script()] : [];
99 }
100 return [];
101 },
102
103 _init: function()
104 {
105 /** @type {!Map.<!WebInspector.Script, !WebInspector.UISourceCode>} */
106 this._uiSourceCodes = new Map();
107 /** @type {!StringMap.<string>} */
108 this._formattedPaths = new StringMap();
109 /** @type {!Map.<!WebInspector.UISourceCode, !WebInspector.FormatterScri ptMapping.FormatData>} */
110 this._formatData = new Map();
111 },
112
113 _debuggerReset: function()
114 {
115 var formattedPaths = this._formattedPaths.values();
116 for (var i = 0; i < formattedPaths.length; ++i)
117 this._projectDelegate._removeFormatted(formattedPaths[i]);
118 this._init();
119 },
120
121 /**
122 * @param {!WebInspector.UISourceCode} uiSourceCode
123 * @param {function(?WebInspector.UISourceCode, !WebInspector.FormatterSourc eMapping=)} callback
124 */
125 _performUISourceCodeScriptFormatting: function(uiSourceCode, callback)
126 {
127 var path = this._formattedPaths.get(uiSourceCode.project().id() + ":" + uiSourceCode.path());
128 if (path) {
129 var uiSourceCodePath = path;
130 var formattedUISourceCode = this._workspace.uiSourceCode(this._proje ctId, uiSourceCodePath);
131 var formatData = formattedUISourceCode ? this._formatData.get(format tedUISourceCode) : null;
132 if (!formatData)
133 callback(null);
134 else
135 callback(formattedUISourceCode, formatData.mapping);
136 return;
137 }
138
139 uiSourceCode.requestContent(contentLoaded.bind(this));
140
141 /**
142 * @this {WebInspector.FormatterScriptMapping}
143 * @param {?string} content
144 */
145 function contentLoaded(content)
146 {
147 var formatter = WebInspector.Formatter.createFormatter(uiSourceCode. contentType());
148 formatter.formatContent(uiSourceCode.highlighterType(), content || " ", innerCallback.bind(this));
149 }
150
151 /**
152 * @this {WebInspector.FormatterScriptMapping}
153 * @param {string} formattedContent
154 * @param {!WebInspector.FormatterSourceMapping} formatterMapping
155 */
156 function innerCallback(formattedContent, formatterMapping)
157 {
158 var scripts = this._scriptsForUISourceCode(uiSourceCode);
159 if (!scripts.length) {
160 callback(null);
161 return;
162 }
163 var name;
164 if (uiSourceCode.contentType() === WebInspector.resourceTypes.Docume nt)
165 name = uiSourceCode.displayName();
166 else
167 name = uiSourceCode.name() || scripts[0].scriptId;
168 path = this._projectDelegate._addFormatted(name, uiSourceCode.url, u iSourceCode.contentType(), formattedContent);
169 var formattedUISourceCode = /** @type {!WebInspector.UISourceCode} * / (this._workspace.uiSourceCode(this._projectId, path));
170
171 var formatData = new WebInspector.FormatterScriptMapping.FormatData( uiSourceCode.project().id(), uiSourceCode.path(), formatterMapping, scripts);
172 this._formatData.put(formattedUISourceCode, formatData);
173 this._formattedPaths.put(uiSourceCode.project().id() + ":" + uiSourc eCode.path(), path);
174 for (var i = 0; i < scripts.length; ++i) {
175 this._uiSourceCodes.put(scripts[i], formattedUISourceCode);
176 scripts[i].pushSourceMapping(this);
177 }
178 formattedUISourceCode.setSourceMappingForTarget(this._debuggerModel. target(), this);
179 callback(formattedUISourceCode, formatterMapping);
180 }
181 },
182
183 /**
184 * @param {!WebInspector.UISourceCode} formattedUISourceCode
185 * @return {?WebInspector.FormatterSourceMapping}
186 */
187 _discardFormattedUISourceCodeScript: function(formattedUISourceCode)
188 {
189 var formatData = this._formatData.get(formattedUISourceCode);
190 if (!formatData)
191 return null;
192
193 this._formatData.remove(formattedUISourceCode);
194 this._formattedPaths.remove(formatData.projectId + ":" + formatData.path );
195 for (var i = 0; i < formatData.scripts.length; ++i) {
196 this._uiSourceCodes.remove(formatData.scripts[i]);
197 formatData.scripts[i].popSourceMapping();
198 }
199 this._projectDelegate._removeFormatted(formattedUISourceCode.path());
200 return formatData.mapping;
201 }
202 } 77 }
203 78
204 /** 79 /**
205 * @constructor 80 * @constructor
206 * @param {string} projectId 81 * @param {string} projectId
207 * @param {string} path 82 * @param {string} path
208 * @param {!WebInspector.FormatterSourceMapping} mapping 83 * @param {!WebInspector.FormatterSourceMapping} mapping
209 * @param {!Array.<!WebInspector.Script>} scripts 84 * @param {!Array.<!WebInspector.Script>} scripts
210 */ 85 */
211 WebInspector.FormatterScriptMapping.FormatData = function(projectId, path, mappi ng, scripts) 86 WebInspector.FormatterScriptMapping.FormatData = function(projectId, path, mappi ng, scripts)
212 { 87 {
213 this.projectId = projectId; 88 this.projectId = projectId;
214 this.path = path; 89 this.path = path;
215 this.mapping = mapping; 90 this.mapping = mapping;
216 this.scripts = scripts; 91 this.scripts= scripts;
217 } 92 }
218 93
219 /** 94 /**
220 * @constructor 95 * @constructor
221 * @param {!WebInspector.Workspace} workspace 96 * @param {!WebInspector.Workspace} workspace
222 * @param {string} id 97 * @param {string} id
223 * @extends {WebInspector.ContentProviderBasedProjectDelegate} 98 * @extends {WebInspector.ContentProviderBasedProjectDelegate}
224 */ 99 */
225 WebInspector.FormatterProjectDelegate = function(workspace, id) 100 WebInspector.FormatterProjectDelegate = function(workspace, id)
226 { 101 {
(...skipping 29 matching lines...) Expand all
256 { 131 {
257 this.removeFile(path); 132 this.removeFile(path);
258 }, 133 },
259 134
260 __proto__: WebInspector.ContentProviderBasedProjectDelegate.prototype 135 __proto__: WebInspector.ContentProviderBasedProjectDelegate.prototype
261 } 136 }
262 137
263 /** 138 /**
264 * @constructor 139 * @constructor
265 * @implements {WebInspector.SourcesView.EditorAction} 140 * @implements {WebInspector.SourcesView.EditorAction}
141 * @implements {WebInspector.TargetManager.Observer}
266 */ 142 */
267 WebInspector.ScriptFormatterEditorAction = function() 143 WebInspector.ScriptFormatterEditorAction = function()
268 { 144 {
269 this._scriptMapping = new WebInspector.FormatterScriptMapping(WebInspector.w orkspace, WebInspector.debuggerModel); 145 this._projectId = "formatter:";
146 this._projectDelegate = new WebInspector.FormatterProjectDelegate(WebInspect or.workspace, this._projectId);
147
148 /** @type {!Map.<!WebInspector.Script, !WebInspector.UISourceCode>} */
149 this._uiSourceCodes = new Map();
150 /** @type {!StringMap.<string>} */
151 this._formattedPaths = new StringMap();
152 /** @type {!Map.<!WebInspector.UISourceCode, !WebInspector.FormatterScriptMa pping.FormatData>} */
153 this._formatData = new Map();
154
155 /** @type {!Map.<!WebInspector.Target, !WebInspector.FormatterScriptMapping> } */
156 this._scriptMappingByTarget = new Map();
157 this._workspace = WebInspector.workspace;
158 WebInspector.targetManager.observeTargets(this);
270 } 159 }
271 160
272 WebInspector.ScriptFormatterEditorAction.prototype = { 161 WebInspector.ScriptFormatterEditorAction.prototype = {
273 /** 162 /**
163 * @param {!WebInspector.Target} target
164 */
165 targetAdded: function(target)
166 {
167 this._scriptMappingByTarget.put(target, new WebInspector.FormatterScript Mapping(target, this));
168 target.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events. GlobalObjectCleared, this._debuggerReset, this);
169 },
170
171 /**
172 * @param {!WebInspector.Target} target
173 */
174 targetRemoved: function(target)
175 {
176 this._scriptMappingByTarget.remove(target);
177 this._cleanForTarget(target);
178 target.debuggerModel.removeEventListener(WebInspector.DebuggerModel.Even ts.GlobalObjectCleared, this._debuggerReset, this);
179 },
180
181 /**
274 * @param {!WebInspector.Event} event 182 * @param {!WebInspector.Event} event
275 */ 183 */
276 _editorSelected: function(event) 184 _editorSelected: function(event)
277 { 185 {
278 var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (event.data ); 186 var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (event.data );
279 this._updateButton(uiSourceCode); 187 this._updateButton(uiSourceCode);
280 }, 188 },
281 189
282 /** 190 /**
283 * @param {!WebInspector.Event} event 191 * @param {!WebInspector.Event} event
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 253
346 WebInspector.notifications.dispatchEventToListeners(WebInspector.UserMet rics.UserAction, { 254 WebInspector.notifications.dispatchEventToListeners(WebInspector.UserMet rics.UserAction, {
347 action: WebInspector.UserMetrics.UserActionNames.TogglePrettyPrint, 255 action: WebInspector.UserMetrics.UserActionNames.TogglePrettyPrint,
348 enabled: true, 256 enabled: true,
349 url: uiSourceCode.originURL() 257 url: uiSourceCode.originURL()
350 }); 258 });
351 }, 259 },
352 260
353 /** 261 /**
354 * @param {!WebInspector.UISourceCode} uiSourceCode 262 * @param {!WebInspector.UISourceCode} uiSourceCode
263 * @param {!WebInspector.UISourceCode} formattedUISourceCode
264 * @param {!WebInspector.FormatterSourceMapping} mapping
265 * @private
266 */
267 _showIfNeeded: function(uiSourceCode, formattedUISourceCode, mapping)
268 {
269 if (uiSourceCode !== this._sourcesView.currentUISourceCode())
270 return;
271 var sourceFrame = this._sourcesView.viewForFile(uiSourceCode);
272 var start = [0, 0];
273 if (sourceFrame) {
274 var selection = sourceFrame.selection();
275 start = mapping.originalToFormatted(selection.startLine, selection.s tartColumn);
276 }
277 this._sourcesView.showSourceLocation(formattedUISourceCode, start[0], st art[1]);
278 this._updateButton(formattedUISourceCode);
279 },
280
281 /**
282 * @param {!WebInspector.UISourceCode} formattedUISourceCode
283 */
284 _discardFormattedUISourceCodeScript: function(formattedUISourceCode)
285 {
286 var formatData = this._formatData.get(formattedUISourceCode);
287 if (!formatData)
288 return;
289
290 this._formatData.remove(formattedUISourceCode);
291 this._formattedPaths.remove(formatData.projectId + ":" + formatData.path );
292 for (var i = 0; i < formatData.scripts.length; ++i) {
293 this._uiSourceCodes.remove(formatData.scripts[i]);
294 formatData.scripts[i].popSourceMapping();
295 }
296 this._projectDelegate._removeFormatted(formattedUISourceCode.path());
297 },
298
299 /**
300 * @param {!WebInspector.Target} target
301 */
302 _cleanForTarget: function(target)
303 {
304 var uiSourceCodes = this._formatData.keys();
305 for (var i = 0; i < uiSourceCodes.length; ++i) {
306 uiSourceCodes[i].setSourceMappingForTarget(target, null);
307 var formatData = this._formatData.get(uiSourceCodes[i]);
308 var scripts = [];
309 for (var j = 0; j < formatData.scripts.length; ++j) {
310 if (formatData.scripts[j].target() === target)
311 this._uiSourceCodes.remove(formatData.scripts[j]);
312 else
313 scripts.push(formatData.scripts[j]);
314 }
315
316 if (scripts.length)
317 formatData.scripts = scripts;
318 else {
319 this._formattedPaths.remove(formatData.projectId + ":" + formatD ata.path);
320 this._formatData.remove(uiSourceCodes[i]);
321 this._projectDelegate._removeFormatted(uiSourceCodes[i].path());
322 }
323 }
324 },
325
326 /**
327 * @param {!WebInspector.Event} event
328 */
329 _debuggerReset: function(event)
330 {
331 var debuggerModel = /** @type {!WebInspector.DebuggerModel} */ (event.ta rget);
332 this._cleanForTarget(debuggerModel.target());
333 },
334
335 /**
336 * @param {!WebInspector.UISourceCode} uiSourceCode
337 * @return {!Array.<!WebInspector.Script>}
338 */
339 _scriptsForUISourceCode: function(uiSourceCode)
340 {
341 /**
342 * @param {!WebInspector.Script} script
343 * @return {boolean}
344 */
345 function isInlineScript(script)
346 {
347 return script.isInlineScript();
348 }
349
350 if (uiSourceCode.contentType() === WebInspector.resourceTypes.Document) {
351 var debuggerModels = WebInspector.targetManager.targets().select("de buggerModel");
vsevik 2014/07/18 08:48:46 Please, no
sergeyv 2014/07/18 11:46:01 Done.
352 var scriptLists = debuggerModels.map(function(debuggerModel) { retur n debuggerModel.scriptsForSourceURL(uiSourceCode.url)});
353 var scripts = Array.prototype.concat.apply([], scriptLists);
354 return scripts.filter(isInlineScript);
355 }
356 if (uiSourceCode.contentType() === WebInspector.resourceTypes.Script) {
357 var rawLocations = (uiSourceCode.uiLocationToRawLocations(0, 0));
358 return rawLocations.map(function(rawLocation) { return rawLocation.s cript()});
359 }
360 return [];
361 },
362
363 /**
364 * @param {!WebInspector.UISourceCode} uiSourceCode
355 */ 365 */
356 _formatUISourceCodeScript: function(uiSourceCode) 366 _formatUISourceCodeScript: function(uiSourceCode)
357 { 367 {
358 this._scriptMapping._performUISourceCodeScriptFormatting(uiSourceCode, i nnerCallback.bind(this)); 368 var path = this._formattedPaths.get(uiSourceCode.project().id() + ":" + uiSourceCode.path());
369 if (path) {
370 var uiSourceCodePath = path;
371 var formattedUISourceCode = this._workspace.uiSourceCode(this._proje ctId, uiSourceCodePath);
372 var formatData = formattedUISourceCode ? this._formatData.get(format tedUISourceCode) : null;
373 if (formatData)
374 this._showIfNeeded(uiSourceCode, /** @type {!WebInspector.UISou rceCode} */ (formattedUISourceCode), formatData.mapping);
375 return;
376 }
377
378 uiSourceCode.requestContent(contentLoaded.bind(this));
359 379
360 /** 380 /**
361 * @this {WebInspector.ScriptFormatterEditorAction} 381 * @this {WebInspector.ScriptFormatterEditorAction}
362 * @param {?WebInspector.UISourceCode} formattedUISourceCode 382 * @param {?string} content
363 * @param {!WebInspector.FormatterSourceMapping=} mapping
364 */ 383 */
365 function innerCallback(formattedUISourceCode, mapping) 384 function contentLoaded(content)
366 { 385 {
367 if (!formattedUISourceCode) 386 var formatter = WebInspector.Formatter.createFormatter(uiSourceCode. contentType());
387 formatter.formatContent(uiSourceCode.highlighterType(), content || " ", innerCallback.bind(this));
388 }
389
390 /**
391 * @this {WebInspector.ScriptFormatterEditorAction}
392 * @param {string} formattedContent
393 * @param {!WebInspector.FormatterSourceMapping} formatterMapping
394 */
395 function innerCallback(formattedContent, formatterMapping)
396 {
397 var scripts = this._scriptsForUISourceCode(uiSourceCode);
398 if (!scripts.length)
368 return; 399 return;
369 if (uiSourceCode !== this._sourcesView.currentUISourceCode()) 400
370 return; 401 var name;
371 var sourceFrame = this._sourcesView.viewForFile(uiSourceCode); 402 if (uiSourceCode.contentType() === WebInspector.resourceTypes.Docume nt)
372 var start = [0, 0]; 403 name = uiSourceCode.displayName();
373 if (sourceFrame) { 404 else
374 var selection = sourceFrame.selection(); 405 name = uiSourceCode.name() || scripts[0].scriptId;
375 start = mapping.originalToFormatted(selection.startLine, selecti on.startColumn); 406 path = this._projectDelegate._addFormatted(name, uiSourceCode.url, u iSourceCode.contentType(), formattedContent);
407 var formattedUISourceCode = /** @type {!WebInspector.UISourceCode} * / (this._workspace.uiSourceCode(this._projectId, path));
408 var formatData = new WebInspector.FormatterScriptMapping.FormatData( uiSourceCode.project().id(), uiSourceCode.path(), formatterMapping, scripts);
409 this._formatData.put(formattedUISourceCode, formatData);
410 this._formattedPaths.put(uiSourceCode.project().id() + ":" + uiSourc eCode.path(), path);
411 for (var i = 0; i < scripts.length; ++i) {
412 this._uiSourceCodes.put(scripts[i], formattedUISourceCode);
413 var scriptMapping = /** @type {!WebInspector.FormatterScriptMapp ing} */(this._scriptMappingByTarget.get(scripts[i].target()));
414 scripts[i].pushSourceMapping(scriptMapping);
376 } 415 }
377 this._sourcesView.showSourceLocation(formattedUISourceCode, start[0] , start[1]); 416
378 this._updateButton(formattedUISourceCode); 417 var targets = WebInspector.targetManager.targets();
418 for (var i = 0; i < targets.length; ++i) {
419 var scriptMapping = /** @type {!WebInspector.FormatterScriptMapp ing} */(this._scriptMappingByTarget.get(targets[i]));
420 formattedUISourceCode.setSourceMappingForTarget(targets[i], scri ptMapping);
421 }
422 this._showIfNeeded(uiSourceCode, formattedUISourceCode, formatterMap ping);
379 } 423 }
380 },
381
382 /**
383 * @param {!WebInspector.UISourceCode} uiSourceCode
384 */
385 _discardFormattedUISourceCodeScript: function(uiSourceCode)
386 {
387 this._scriptMapping._discardFormattedUISourceCodeScript(uiSourceCode);
388 } 424 }
389 } 425 }
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