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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/sass/SASSSourceMapFactory.js

Issue 1965223003: DevTools: liveSASS should tolerate race between iNotify and BrowserSync (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
« no previous file with comments | « third_party/WebKit/LayoutTests/inspector/sass/test-mapping-with-cache-busting-url-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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.SourceMapFactory} 7 * @implements {WebInspector.SourceMapFactory}
8 */ 8 */
9 WebInspector.SASSSourceMapFactory = function() 9 WebInspector.SASSSourceMapFactory = function()
10 { 10 {
11 this._astService = new WebInspector.ASTService(); 11 this._astService = new WebInspector.ASTService();
12 } 12 }
13 13
14 WebInspector.SASSSourceMapFactory.prototype = { 14 WebInspector.SASSSourceMapFactory.prototype = {
15 /** 15 /**
16 * @override 16 * @override
17 * @param {!WebInspector.Target} target 17 * @param {!WebInspector.Target} target
18 * @param {!WebInspector.SourceMap} sourceMap 18 * @param {!WebInspector.SourceMap} sourceMap
19 * @return {!Promise<?WebInspector.SourceMap>} 19 * @return {!Promise<?WebInspector.SourceMap>}
20 */ 20 */
21 editableSourceMap: function(target, sourceMap) 21 editableSourceMap: function(target, sourceMap)
22 { 22 {
23 var cssModel = WebInspector.CSSModel.fromTarget(target); 23 var cssModel = WebInspector.CSSModel.fromTarget(target);
24 if (!cssModel) 24 if (!cssModel)
25 return Promise.resolve(/** @type {?WebInspector.SourceMap} */(null)) ; 25 return Promise.resolve(/** @type {?WebInspector.SourceMap} */(null)) ;
26 26
27 var headerIds = cssModel.styleSheetIdsForURL(sourceMap.compiledURL()); 27 var header = cssModel.styleSheetHeaders().find(styleSheetHeader => style SheetHeader.sourceMapURL === sourceMap.url());
28 if (!headerIds || !headerIds.length) 28 if (!header)
29 return Promise.resolve(/** @type {?WebInspector.SourceMap} */(null)) ; 29 return Promise.resolve(/** @type {?WebInspector.SourceMap} */(null)) ;
30 var header = cssModel.styleSheetHeaderForId(headerIds[0]);
31 30
32 /** @type {!Map<string, !WebInspector.SASSSupport.AST>} */ 31 /** @type {!Map<string, !WebInspector.SASSSupport.AST>} */
33 var models = new Map(); 32 var models = new Map();
34 var promises = []; 33 var promises = [];
35 for (let url of sourceMap.sourceURLs()) { 34 for (let url of sourceMap.sourceURLs()) {
36 var contentProvider = sourceMap.sourceContentProvider(url, WebInspec tor.resourceTypes.SourceMapStyleSheet); 35 var contentProvider = sourceMap.sourceContentProvider(url, WebInspec tor.resourceTypes.SourceMapStyleSheet);
37 var sassPromise = contentProvider.requestContent() 36 var sassPromise = contentProvider.requestContent()
38 .then(text => this._astService.parseSCSS(url, text || "")) 37 .then(text => this._astService.parseSCSS(url, text || ""))
39 .then(ast => models.set(ast.document.url, ast)); 38 .then(ast => models.set(ast.document.url, ast));
40 promises.push(sassPromise); 39 promises.push(sassPromise);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 var sassNode = sassAST.findNodeForPosition(entry.sourceLineNumber, e ntry.sourceColumnNumber); 78 var sassNode = sassAST.findNodeForPosition(entry.sourceLineNumber, e ntry.sourceColumnNumber);
80 if (!sassNode) 79 if (!sassNode)
81 return; 80 return;
82 if (cssNode.parent && (cssNode.parent instanceof WebInspector.SASSSu pport.Property) && cssNode === cssNode.parent.name) 81 if (cssNode.parent && (cssNode.parent instanceof WebInspector.SASSSu pport.Property) && cssNode === cssNode.parent.name)
83 valid = valid && cssNode.text.trim() === sassNode.text.trim(); 82 valid = valid && cssNode.text.trim() === sassNode.text.trim();
84 map.addMapping(cssNode, sassNode); 83 map.addMapping(cssNode, sassNode);
85 } 84 }
86 }, 85 },
87 } 86 }
88 87
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/inspector/sass/test-mapping-with-cache-busting-url-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698