Chromium Code Reviews| OLD | NEW |
|---|---|
| 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.Workspace} workspace |
| 9 * @param {!WebInspector.DebuggerModel} debuggerModel | 9 * @param {!WebInspector.DebuggerModel} debuggerModel |
| 10 */ | 10 */ |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 66 { | 66 { |
| 67 return false; | 67 return false; |
| 68 }, | 68 }, |
| 69 | 69 |
| 70 /** | 70 /** |
| 71 * @param {!WebInspector.UISourceCode} uiSourceCode | 71 * @param {!WebInspector.UISourceCode} uiSourceCode |
| 72 * @return {!Array.<!WebInspector.Script>} | 72 * @return {!Array.<!WebInspector.Script>} |
| 73 */ | 73 */ |
| 74 _scriptsForUISourceCode: function(uiSourceCode) | 74 _scriptsForUISourceCode: function(uiSourceCode) |
| 75 { | 75 { |
| 76 var isInlineScript; | 76 if (uiSourceCode.contentType() === WebInspector.resourceTypes.Document) |
| 77 switch (uiSourceCode.contentType()) { | 77 return this._debuggerModel.scriptsForSourceURL(uiSourceCode.url); |
|
vsevik
2014/03/26 09:02:34
Please keep the inline filter.
pfeldman
2014/03/26 09:24:37
But this does not add any value. Why would we?
| |
| 78 case WebInspector.resourceTypes.Document: | 78 if (uiSourceCode.contentType() === WebInspector.resourceTypes.Script) { |
| 79 isInlineScript = true; | 79 var rawLocation = uiSourceCode.uiLocationToRawLocation(0, 0); |
| 80 break; | 80 return rawLocation ? [this._debuggerModel.scriptForId(rawLocation.sc riptId)] : []; |
|
aandrey
2014/03/25 19:33:54
can return [undefined]
pfeldman
2014/03/25 20:01:40
I don't think so - uiSourceCode here is using defa
| |
| 81 case WebInspector.resourceTypes.Script: | |
| 82 isInlineScript = false; | |
| 83 break; | |
| 84 default: | |
| 85 return []; | |
| 86 } | 81 } |
| 87 var scripts = this._debuggerModel.scriptsForSourceURL(uiSourceCode.url); | 82 return []; |
| 88 | |
| 89 function filterOutIncorrectInlineType(script) | |
| 90 { | |
| 91 return script.isInlineScript() === isInlineScript; | |
| 92 } | |
| 93 | |
| 94 return scripts.filter(filterOutIncorrectInlineType); | |
| 95 }, | 83 }, |
| 96 | 84 |
| 97 _init: function() | 85 _init: function() |
| 98 { | 86 { |
| 99 /** @type {!Map.<!WebInspector.Script, !WebInspector.UISourceCode>} */ | 87 /** @type {!Map.<!WebInspector.Script, !WebInspector.UISourceCode>} */ |
| 100 this._uiSourceCodes = new Map(); | 88 this._uiSourceCodes = new Map(); |
| 101 /** @type {!StringMap.<string>} */ | 89 /** @type {!StringMap.<string>} */ |
| 102 this._formattedPaths = new StringMap(); | 90 this._formattedPaths = new StringMap(); |
| 103 /** @type {!Map.<!WebInspector.UISourceCode, !WebInspector.FormatterScri ptMapping.FormatData>} */ | 91 /** @type {!Map.<!WebInspector.UISourceCode, !WebInspector.FormatterScri ptMapping.FormatData>} */ |
| 104 this._formatData = new Map(); | 92 this._formatData = new Map(); |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 380 }, | 368 }, |
| 381 | 369 |
| 382 /** | 370 /** |
| 383 * @param {!WebInspector.UISourceCode} uiSourceCode | 371 * @param {!WebInspector.UISourceCode} uiSourceCode |
| 384 */ | 372 */ |
| 385 _discardFormattedUISourceCodeScript: function(uiSourceCode) | 373 _discardFormattedUISourceCodeScript: function(uiSourceCode) |
| 386 { | 374 { |
| 387 this._scriptMapping._discardFormattedUISourceCodeScript(uiSourceCode); | 375 this._scriptMapping._discardFormattedUISourceCodeScript(uiSourceCode); |
| 388 } | 376 } |
| 389 } | 377 } |
| OLD | NEW |