| 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 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 if (this._scriptForSourceMap.get(sourceMap)) { | 222 if (this._scriptForSourceMap.get(sourceMap)) { |
| 223 this._sourceMapForScriptId.set(script.scriptId, sourceMap); | 223 this._sourceMapForScriptId.set(script.scriptId, sourceMap); |
| 224 this._debuggerWorkspaceBinding.updateLocations(script); | 224 this._debuggerWorkspaceBinding.updateLocations(script); |
| 225 return; | 225 return; |
| 226 } | 226 } |
| 227 | 227 |
| 228 this._sourceMapForScriptId.set(script.scriptId, sourceMap); | 228 this._sourceMapForScriptId.set(script.scriptId, sourceMap); |
| 229 this._scriptForSourceMap.set(sourceMap, script); | 229 this._scriptForSourceMap.set(sourceMap, script); |
| 230 | 230 |
| 231 // Report sources. | 231 // Report sources. |
| 232 var sourceURLs = sourceMap.sourceURLs(); | |
| 233 var missingSources = []; | 232 var missingSources = []; |
| 234 for (var i = 0; i < sourceURLs.length; ++i) { | 233 for (var sourceURL of sourceMap.sourceURLs()) { |
| 235 var sourceURL = sourceURLs[i]; | |
| 236 if (this._sourceMapForURL.get(sourceURL)) | 234 if (this._sourceMapForURL.get(sourceURL)) |
| 237 continue; | 235 continue; |
| 238 this._sourceMapForURL.set(sourceURL, sourceMap); | 236 this._sourceMapForURL.set(sourceURL, sourceMap); |
| 239 var uiSourceCode = this._networkMapping.uiSourceCodeForScriptURL(sou
rceURL, script); | 237 var uiSourceCode = this._networkMapping.uiSourceCodeForScriptURL(sou
rceURL, script); |
| 240 if (!uiSourceCode) { | 238 if (!uiSourceCode) { |
| 241 var contentProvider = sourceMap.sourceContentProvider(sourceURL,
WebInspector.resourceTypes.SourceMapScript); | 239 var contentProvider = sourceMap.sourceContentProvider(sourceURL,
WebInspector.resourceTypes.SourceMapScript); |
| 242 uiSourceCode = this._networkProject.addFile(contentProvider, Web
Inspector.ResourceTreeFrame.fromScript(script), script.isContentScript()); | 240 uiSourceCode = this._networkProject.addFile(contentProvider, Web
Inspector.ResourceTreeFrame.fromScript(script), script.isContentScript()); |
| 243 uiSourceCode[WebInspector.CompilerScriptMapping._originSymbol] =
script.sourceURL; | 241 uiSourceCode[WebInspector.CompilerScriptMapping._originSymbol] =
script.sourceURL; |
| 244 } | 242 } |
| 245 if (uiSourceCode) { | 243 if (uiSourceCode) { |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 { | 354 { |
| 357 /** | 355 /** |
| 358 * @param {!WebInspector.TextSourceMap} sourceMap | 356 * @param {!WebInspector.TextSourceMap} sourceMap |
| 359 * @this {WebInspector.CompilerScriptMapping} | 357 * @this {WebInspector.CompilerScriptMapping} |
| 360 */ | 358 */ |
| 361 function unbindSourceMapSources(sourceMap) | 359 function unbindSourceMapSources(sourceMap) |
| 362 { | 360 { |
| 363 var script = this._scriptForSourceMap.get(sourceMap); | 361 var script = this._scriptForSourceMap.get(sourceMap); |
| 364 if (!script) | 362 if (!script) |
| 365 return; | 363 return; |
| 366 var sourceURLs = sourceMap.sourceURLs(); | 364 for (var sourceURL of sourceMap.sourceURLs()) { |
| 367 for (var i = 0; i < sourceURLs.length; ++i) { | 365 var uiSourceCode = this._networkMapping.uiSourceCodeForScriptURL
(sourceURL, script); |
| 368 var uiSourceCode = this._networkMapping.uiSourceCodeForScriptURL
(sourceURLs[i], script); | |
| 369 if (uiSourceCode) | 366 if (uiSourceCode) |
| 370 this._unbindUISourceCode(uiSourceCode); | 367 this._unbindUISourceCode(uiSourceCode); |
| 371 } | 368 } |
| 372 } | 369 } |
| 373 | 370 |
| 374 this._sourceMapForURL.valuesArray().forEach(unbindSourceMapSources.bind(
this)); | 371 this._sourceMapForURL.valuesArray().forEach(unbindSourceMapSources.bind(
this)); |
| 375 | 372 |
| 376 this._sourceMapLoadingPromises.clear(); | 373 this._sourceMapLoadingPromises.clear(); |
| 377 this._sourceMapForScriptId.clear() | 374 this._sourceMapForScriptId.clear() |
| 378 this._scriptForSourceMap.clear(); | 375 this._scriptForSourceMap.clear(); |
| 379 this._sourceMapForURL.clear(); | 376 this._sourceMapForURL.clear(); |
| 380 }, | 377 }, |
| 381 | 378 |
| 382 dispose: function() | 379 dispose: function() |
| 383 { | 380 { |
| 384 WebInspector.EventTarget.removeEventListeners(this._eventListeners); | 381 WebInspector.EventTarget.removeEventListeners(this._eventListeners); |
| 385 this._debuggerReset(); | 382 this._debuggerReset(); |
| 386 this._stubProject.dispose(); | 383 this._stubProject.dispose(); |
| 387 } | 384 } |
| 388 } | 385 } |
| 389 | 386 |
| 390 /** | 387 /** |
| 391 * @param {!WebInspector.Target} target | 388 * @param {!WebInspector.Target} target |
| 392 * @return {string} | 389 * @return {string} |
| 393 */ | 390 */ |
| 394 WebInspector.CompilerScriptMapping.projectIdForTarget = function(target) | 391 WebInspector.CompilerScriptMapping.projectIdForTarget = function(target) |
| 395 { | 392 { |
| 396 return "compiler-script-project:" + target.id(); | 393 return "compiler-script-project:" + target.id(); |
| 397 } | 394 } |
| OLD | NEW |