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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 } | 70 } |
71 | 71 |
72 /** | 72 /** |
73 * @param {!SDK.Script} script | 73 * @param {!SDK.Script} script |
74 */ | 74 */ |
75 _addStubUISourceCode(script) { | 75 _addStubUISourceCode(script) { |
76 var stubUISourceCode = this._stubProject.addContentProvider( | 76 var stubUISourceCode = this._stubProject.addContentProvider( |
77 script.sourceURL + ':sourcemap', | 77 script.sourceURL + ':sourcemap', |
78 Common.StaticContentProvider.fromString( | 78 Common.StaticContentProvider.fromString( |
79 script.sourceURL, Common.resourceTypes.Script, | 79 script.sourceURL, Common.resourceTypes.Script, |
80 '\n\n\n\n\n// Please wait a bit.\n// Compiled script is not shown wh
ile source map is being loaded!')); | 80 '\n\n\n\n\n// Please wait a bit.\n// Compiled script is not shown wh
ile source map is being loaded!'), |
| 81 'text/javascript'); |
81 this._stubUISourceCodes.set(script, stubUISourceCode); | 82 this._stubUISourceCodes.set(script, stubUISourceCode); |
82 } | 83 } |
83 | 84 |
84 /** | 85 /** |
85 * @param {!SDK.Script} script | 86 * @param {!SDK.Script} script |
86 */ | 87 */ |
87 _removeStubUISourceCode(script) { | 88 _removeStubUISourceCode(script) { |
88 var uiSourceCode = this._stubUISourceCodes.get(script); | 89 var uiSourceCode = this._stubUISourceCodes.get(script); |
89 this._stubUISourceCodes.delete(script); | 90 this._stubUISourceCodes.delete(script); |
90 this._stubProject.removeFile(uiSourceCode.url()); | 91 this._stubProject.removeFile(uiSourceCode.url()); |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 script[Bindings.CompilerScriptMapping._frameIdSymbol] = frameId; | 263 script[Bindings.CompilerScriptMapping._frameIdSymbol] = frameId; |
263 var project = script.isContentScript() ? this._contentScriptsProject : this.
_regularProject; | 264 var project = script.isContentScript() ? this._contentScriptsProject : this.
_regularProject; |
264 for (var sourceURL of sourceMap.sourceURLs()) { | 265 for (var sourceURL of sourceMap.sourceURLs()) { |
265 var uiSourceCode = project.uiSourceCodeForURL(sourceURL); | 266 var uiSourceCode = project.uiSourceCodeForURL(sourceURL); |
266 if (uiSourceCode) { | 267 if (uiSourceCode) { |
267 Bindings.NetworkProject.addFrameAttribution(uiSourceCode, frameId); | 268 Bindings.NetworkProject.addFrameAttribution(uiSourceCode, frameId); |
268 continue; | 269 continue; |
269 } | 270 } |
270 | 271 |
271 var contentProvider = sourceMap.sourceContentProvider(sourceURL, Common.re
sourceTypes.SourceMapScript); | 272 var contentProvider = sourceMap.sourceContentProvider(sourceURL, Common.re
sourceTypes.SourceMapScript); |
| 273 var mimeType = Common.ResourceType.mimeFromURL(sourceURL) || contentProvid
er.contentType().canonicalMimeType(); |
272 var embeddedContent = sourceMap.embeddedContentByURL(sourceURL); | 274 var embeddedContent = sourceMap.embeddedContentByURL(sourceURL); |
273 var metadata = | 275 var metadata = |
274 typeof embeddedContent === 'string' ? new Workspace.UISourceCodeMetada
ta(null, embeddedContent.length) : null; | 276 typeof embeddedContent === 'string' ? new Workspace.UISourceCodeMetada
ta(null, embeddedContent.length) : null; |
275 uiSourceCode = project.createUISourceCode(sourceURL, contentProvider.conte
ntType()); | 277 uiSourceCode = project.createUISourceCode(sourceURL, contentProvider.conte
ntType()); |
276 uiSourceCode[Bindings.CompilerScriptMapping._sourceMapSymbol] = sourceMap; | 278 uiSourceCode[Bindings.CompilerScriptMapping._sourceMapSymbol] = sourceMap; |
277 Bindings.NetworkProject.setInitialFrameAttribution(uiSourceCode, frameId); | 279 Bindings.NetworkProject.setInitialFrameAttribution(uiSourceCode, frameId); |
278 project.addUISourceCodeWithProvider(uiSourceCode, contentProvider, metadat
a); | 280 project.addUISourceCodeWithProvider(uiSourceCode, contentProvider, metadat
a, mimeType); |
279 this._debuggerWorkspaceBinding.setSourceMapping(this._debuggerModel, uiSou
rceCode, this); | 281 this._debuggerWorkspaceBinding.setSourceMapping(this._debuggerModel, uiSou
rceCode, this); |
280 } | 282 } |
281 this._debuggerWorkspaceBinding.updateLocations(script); | 283 this._debuggerWorkspaceBinding.updateLocations(script); |
282 } | 284 } |
283 | 285 |
284 /** | 286 /** |
285 * @override | 287 * @override |
286 * @return {boolean} | 288 * @return {boolean} |
287 */ | 289 */ |
288 isIdentity() { | 290 isIdentity() { |
(...skipping 16 matching lines...) Expand all Loading... |
305 dispose() { | 307 dispose() { |
306 Common.EventTarget.removeEventListeners(this._eventListeners); | 308 Common.EventTarget.removeEventListeners(this._eventListeners); |
307 this._regularProject.dispose(); | 309 this._regularProject.dispose(); |
308 this._contentScriptsProject.dispose(); | 310 this._contentScriptsProject.dispose(); |
309 this._stubProject.dispose(); | 311 this._stubProject.dispose(); |
310 } | 312 } |
311 }; | 313 }; |
312 | 314 |
313 Bindings.CompilerScriptMapping._frameIdSymbol = Symbol('Bindings.CompilerScriptM
apping._frameIdSymbol'); | 315 Bindings.CompilerScriptMapping._frameIdSymbol = Symbol('Bindings.CompilerScriptM
apping._frameIdSymbol'); |
314 Bindings.CompilerScriptMapping._sourceMapSymbol = Symbol('Bindings.CompilerScrip
tMapping._sourceMapSymbol'); | 316 Bindings.CompilerScriptMapping._sourceMapSymbol = Symbol('Bindings.CompilerScrip
tMapping._sourceMapSymbol'); |
OLD | NEW |