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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 var header = /** @type {!SDK.CSSStyleSheetHeader} */ (event.data.client); | 66 var header = /** @type {!SDK.CSSStyleSheetHeader} */ (event.data.client); |
67 var sourceMap = /** @type {!SDK.SourceMap} */ (event.data.sourceMap); | 67 var sourceMap = /** @type {!SDK.SourceMap} */ (event.data.sourceMap); |
68 for (var sassURL of sourceMap.sourceURLs()) { | 68 for (var sassURL of sourceMap.sourceURLs()) { |
69 var uiSourceCode = this._project.uiSourceCodeForURL(sassURL); | 69 var uiSourceCode = this._project.uiSourceCodeForURL(sassURL); |
70 if (uiSourceCode) { | 70 if (uiSourceCode) { |
71 Bindings.NetworkProject.addFrameAttribution(uiSourceCode, header.frameId
); | 71 Bindings.NetworkProject.addFrameAttribution(uiSourceCode, header.frameId
); |
72 continue; | 72 continue; |
73 } | 73 } |
74 | 74 |
75 var contentProvider = sourceMap.sourceContentProvider(sassURL, Common.reso
urceTypes.SourceMapStyleSheet); | 75 var contentProvider = sourceMap.sourceContentProvider(sassURL, Common.reso
urceTypes.SourceMapStyleSheet); |
| 76 var mimeType = Common.ResourceType.mimeFromURL(sassURL) || contentProvider
.contentType().canonicalMimeType(); |
76 var embeddedContent = sourceMap.embeddedContentByURL(sassURL); | 77 var embeddedContent = sourceMap.embeddedContentByURL(sassURL); |
77 var metadata = | 78 var metadata = |
78 typeof embeddedContent === 'string' ? new Workspace.UISourceCodeMetada
ta(null, embeddedContent.length) : null; | 79 typeof embeddedContent === 'string' ? new Workspace.UISourceCodeMetada
ta(null, embeddedContent.length) : null; |
79 uiSourceCode = this._project.createUISourceCode(sassURL, contentProvider.c
ontentType()); | 80 uiSourceCode = this._project.createUISourceCode(sassURL, contentProvider.c
ontentType()); |
80 Bindings.NetworkProject.setInitialFrameAttribution(uiSourceCode, header.fr
ameId); | 81 Bindings.NetworkProject.setInitialFrameAttribution(uiSourceCode, header.fr
ameId); |
81 uiSourceCode[Bindings.SASSSourceMapping._sourceMapSymbol] = sourceMap; | 82 uiSourceCode[Bindings.SASSSourceMapping._sourceMapSymbol] = sourceMap; |
82 this._project.addUISourceCodeWithProvider(uiSourceCode, contentProvider, m
etadata); | 83 this._project.addUISourceCodeWithProvider(uiSourceCode, contentProvider, m
etadata, mimeType); |
83 } | 84 } |
84 Bindings.cssWorkspaceBinding.updateLocations(header); | 85 Bindings.cssWorkspaceBinding.updateLocations(header); |
85 this._sourceMapAttachedForTest(sourceMap); | 86 this._sourceMapAttachedForTest(sourceMap); |
86 } | 87 } |
87 | 88 |
88 /** | 89 /** |
89 * @param {!Common.Event} event | 90 * @param {!Common.Event} event |
90 */ | 91 */ |
91 _sourceMapDetached(event) { | 92 _sourceMapDetached(event) { |
92 var header = /** @type {!SDK.CSSStyleSheetHeader} */ (event.data.client); | 93 var header = /** @type {!SDK.CSSStyleSheetHeader} */ (event.data.client); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 return locations; | 162 return locations; |
162 } | 163 } |
163 | 164 |
164 dispose() { | 165 dispose() { |
165 this._project.dispose(); | 166 this._project.dispose(); |
166 Common.EventTarget.removeEventListeners(this._eventListeners); | 167 Common.EventTarget.removeEventListeners(this._eventListeners); |
167 } | 168 } |
168 }; | 169 }; |
169 | 170 |
170 Bindings.SASSSourceMapping._sourceMapSymbol = Symbol('sourceMap'); | 171 Bindings.SASSSourceMapping._sourceMapSymbol = Symbol('sourceMap'); |
OLD | NEW |