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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 if (this._scriptForSourceMap.get(sourceMap)) { | 142 if (this._scriptForSourceMap.get(sourceMap)) { |
143 this._sourceMapForScriptId[script.scriptId] = sourceMap; | 143 this._sourceMapForScriptId[script.scriptId] = sourceMap; |
144 this._debuggerWorkspaceBinding.updateLocations(script); | 144 this._debuggerWorkspaceBinding.updateLocations(script); |
145 return; | 145 return; |
146 } | 146 } |
147 | 147 |
148 this._sourceMapForScriptId[script.scriptId] = sourceMap; | 148 this._sourceMapForScriptId[script.scriptId] = sourceMap; |
149 this._scriptForSourceMap.set(sourceMap, script); | 149 this._scriptForSourceMap.set(sourceMap, script); |
150 | 150 |
151 var sourceURLs = sourceMap.sources(); | 151 var sourceURLs = sourceMap.sources(); |
| 152 var missingSources = []; |
152 for (var i = 0; i < sourceURLs.length; ++i) { | 153 for (var i = 0; i < sourceURLs.length; ++i) { |
153 var sourceURL = sourceURLs[i]; | 154 var sourceURL = sourceURLs[i]; |
154 if (this._sourceMapForURL.get(sourceURL)) | 155 if (this._sourceMapForURL.get(sourceURL)) |
155 continue; | 156 continue; |
156 this._sourceMapForURL.set(sourceURL, sourceMap); | 157 this._sourceMapForURL.set(sourceURL, sourceMap); |
157 if (!this._workspace.hasMappingForURL(sourceURL) && !this._works
pace.uiSourceCodeForURL(sourceURL)) { | 158 if (!this._workspace.hasMappingForURL(sourceURL) && !this._works
pace.uiSourceCodeForURL(sourceURL)) { |
158 var contentProvider = sourceMap.sourceContentProvider(source
URL, WebInspector.resourceTypes.Script); | 159 var contentProvider = sourceMap.sourceContentProvider(source
URL, WebInspector.resourceTypes.Script); |
159 this._networkWorkspaceBinding.addFileForURL(sourceURL, conte
ntProvider, script.isContentScript()); | 160 this._networkWorkspaceBinding.addFileForURL(sourceURL, conte
ntProvider, script.isContentScript()); |
160 } | 161 } |
161 var uiSourceCode = this._workspace.uiSourceCodeForURL(sourceURL)
; | 162 var uiSourceCode = this._workspace.uiSourceCodeForURL(sourceURL)
; |
162 if (uiSourceCode) | 163 if (uiSourceCode) { |
163 this._bindUISourceCode(uiSourceCode); | 164 this._bindUISourceCode(uiSourceCode); |
164 else | 165 } else { |
165 WebInspector.console.error(WebInspector.UIString("Failed to
locate workspace file mapped to URL %s from source map %s", sourceURL, sourceMap
.url())); | 166 if (missingSources.length < 3) |
| 167 missingSources.push(sourceURL); |
| 168 else if (missingSources.peekLast() !== "\u2026") |
| 169 missingSources.push("\u2026"); |
| 170 } |
166 } | 171 } |
| 172 if (missingSources.length) { |
| 173 WebInspector.console.warn( |
| 174 WebInspector.UIString("Source map %s points to the files mis
sing from the workspace: [%s]", |
| 175 sourceMap.url(), missingSources.join("
, "))); |
| 176 } |
| 177 |
167 this._debuggerWorkspaceBinding.updateLocations(script); | 178 this._debuggerWorkspaceBinding.updateLocations(script); |
168 } | 179 } |
169 }, | 180 }, |
170 | 181 |
171 /** | 182 /** |
172 * @return {boolean} | 183 * @return {boolean} |
173 */ | 184 */ |
174 isIdentity: function() | 185 isIdentity: function() |
175 { | 186 { |
176 return false; | 187 return false; |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 this._sourceMapForScriptId = {}; | 308 this._sourceMapForScriptId = {}; |
298 this._scriptForSourceMap.clear(); | 309 this._scriptForSourceMap.clear(); |
299 this._sourceMapForURL.clear(); | 310 this._sourceMapForURL.clear(); |
300 }, | 311 }, |
301 | 312 |
302 dispose: function() | 313 dispose: function() |
303 { | 314 { |
304 this._workspace.removeEventListener(WebInspector.Workspace.Events.UISour
ceCodeAdded, this._uiSourceCodeAddedToWorkspace, this); | 315 this._workspace.removeEventListener(WebInspector.Workspace.Events.UISour
ceCodeAdded, this._uiSourceCodeAddedToWorkspace, this); |
305 } | 316 } |
306 } | 317 } |
OLD | NEW |