OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 if (this._scriptForSourceMap.get(sourceMap)) { | 225 if (this._scriptForSourceMap.get(sourceMap)) { |
226 this._sourceMapForScriptId.set(script.scriptId, sourceMap); | 226 this._sourceMapForScriptId.set(script.scriptId, sourceMap); |
227 this._debuggerWorkspaceBinding.updateLocations(script); | 227 this._debuggerWorkspaceBinding.updateLocations(script); |
228 return; | 228 return; |
229 } | 229 } |
230 | 230 |
231 this._sourceMapForScriptId.set(script.scriptId, sourceMap); | 231 this._sourceMapForScriptId.set(script.scriptId, sourceMap); |
232 this._scriptForSourceMap.set(sourceMap, script); | 232 this._scriptForSourceMap.set(sourceMap, script); |
233 | 233 |
234 // Report sources. | 234 // Report sources. |
235 var sourceURLs = sourceMap.sourceURLs(); | |
236 var missingSources = []; | 235 var missingSources = []; |
237 for (var i = 0; i < sourceURLs.length; ++i) { | 236 for (var sourceURL of sourceMap.sourceURLs()) { |
238 var sourceURL = sourceURLs[i]; | |
239 if (this._sourceMapForURL.get(sourceURL)) | 237 if (this._sourceMapForURL.get(sourceURL)) |
240 continue; | 238 continue; |
241 this._sourceMapForURL.set(sourceURL, sourceMap); | 239 this._sourceMapForURL.set(sourceURL, sourceMap); |
242 var uiSourceCode = this._networkMapping.uiSourceCodeForScriptURL(sou
rceURL, script); | 240 var uiSourceCode = this._networkMapping.uiSourceCodeForScriptURL(sou
rceURL, script); |
243 if (!uiSourceCode) { | 241 if (!uiSourceCode) { |
244 var contentProvider = sourceMap.sourceContentProvider(sourceURL,
WebInspector.resourceTypes.SourceMapScript); | 242 var contentProvider = sourceMap.sourceContentProvider(sourceURL,
WebInspector.resourceTypes.SourceMapScript); |
245 uiSourceCode = this._networkProject.addFile(contentProvider, Web
Inspector.ResourceTreeFrame.fromScript(script), script.isContentScript()); | 243 uiSourceCode = this._networkProject.addFile(contentProvider, Web
Inspector.ResourceTreeFrame.fromScript(script), script.isContentScript()); |
246 uiSourceCode[WebInspector.CompilerScriptMapping._originSymbol] =
script.sourceURL; | 244 uiSourceCode[WebInspector.CompilerScriptMapping._originSymbol] =
script.sourceURL; |
247 } | 245 } |
248 if (uiSourceCode) { | 246 if (uiSourceCode) { |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 { | 361 { |
364 /** | 362 /** |
365 * @param {!WebInspector.TextSourceMap} sourceMap | 363 * @param {!WebInspector.TextSourceMap} sourceMap |
366 * @this {WebInspector.CompilerScriptMapping} | 364 * @this {WebInspector.CompilerScriptMapping} |
367 */ | 365 */ |
368 function unbindSourceMapSources(sourceMap) | 366 function unbindSourceMapSources(sourceMap) |
369 { | 367 { |
370 var script = this._scriptForSourceMap.get(sourceMap); | 368 var script = this._scriptForSourceMap.get(sourceMap); |
371 if (!script) | 369 if (!script) |
372 return; | 370 return; |
373 var sourceURLs = sourceMap.sourceURLs(); | 371 for (var sourceURL of sourceMap.sourceURLs()) { |
374 for (var i = 0; i < sourceURLs.length; ++i) { | 372 var uiSourceCode = this._networkMapping.uiSourceCodeForScriptURL
(sourceURL, script); |
375 var uiSourceCode = this._networkMapping.uiSourceCodeForScriptURL
(sourceURLs[i], script); | |
376 if (uiSourceCode) | 373 if (uiSourceCode) |
377 this._unbindUISourceCode(uiSourceCode); | 374 this._unbindUISourceCode(uiSourceCode); |
378 } | 375 } |
379 } | 376 } |
380 | 377 |
381 this._sourceMapForURL.valuesArray().forEach(unbindSourceMapSources.bind(
this)); | 378 this._sourceMapForURL.valuesArray().forEach(unbindSourceMapSources.bind(
this)); |
382 | 379 |
383 this._sourceMapLoadingPromises.clear(); | 380 this._sourceMapLoadingPromises.clear(); |
384 this._sourceMapForScriptId.clear() | 381 this._sourceMapForScriptId.clear() |
385 this._scriptForSourceMap.clear(); | 382 this._scriptForSourceMap.clear(); |
386 this._sourceMapForURL.clear(); | 383 this._sourceMapForURL.clear(); |
387 }, | 384 }, |
388 | 385 |
389 dispose: function() | 386 dispose: function() |
390 { | 387 { |
391 WebInspector.EventTarget.removeEventListeners(this._eventListeners); | 388 WebInspector.EventTarget.removeEventListeners(this._eventListeners); |
392 this._debuggerReset(); | 389 this._debuggerReset(); |
393 this._stubProject.dispose(); | 390 this._stubProject.dispose(); |
394 } | 391 } |
395 } | 392 } |
396 | 393 |
397 /** | 394 /** |
398 * @param {!WebInspector.Target} target | 395 * @param {!WebInspector.Target} target |
399 * @return {string} | 396 * @return {string} |
400 */ | 397 */ |
401 WebInspector.CompilerScriptMapping.projectIdForTarget = function(target) | 398 WebInspector.CompilerScriptMapping.projectIdForTarget = function(target) |
402 { | 399 { |
403 return "compiler-script-project:" + target.id(); | 400 return "compiler-script-project:" + target.id(); |
404 } | 401 } |
OLD | NEW |