Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(238)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/bindings/SASSSourceMapping.js

Issue 2889013002: DevTools: introduce uiSourceCode.mimeType() method (Closed)
Patch Set: address comments Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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');
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698