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

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

Issue 2779703004: DevTools: carefully cleanup CSS sourcemaps (Closed)
Patch Set: fix tests Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/devtools/front_end/bindings/SASSSourceMapping.js
diff --git a/third_party/WebKit/Source/devtools/front_end/bindings/SASSSourceMapping.js b/third_party/WebKit/Source/devtools/front_end/bindings/SASSSourceMapping.js
index f7f9507e992356c1760e94384e3a0ba82bf0ed7f..d7da206316411d5886d147e2d9c88ea3bd1dce13 100644
--- a/third_party/WebKit/Source/devtools/front_end/bindings/SASSSourceMapping.js
+++ b/third_party/WebKit/Source/devtools/front_end/bindings/SASSSourceMapping.js
@@ -49,6 +49,9 @@ Bindings.SASSSourceMapping = class {
this._sourceMapManager.addEventListener(
SDK.SourceMapManager.Events.SourceMapChanged, this._sourceMapChanged, this)
];
+
+ /** @type {!Multimap<string, !SDK.CSSStyleSheetHeader>} */
+ this._frameIdToHeaders = new Multimap();
}
/**
@@ -61,8 +64,15 @@ Bindings.SASSSourceMapping = class {
* @param {!Common.Event} event
*/
_sourceMapAttached(event) {
- var header = /** @type {!SDK.CSSStyleSheetHeader} */ (event.data);
- var sourceMap = this._sourceMapManager.sourceMapForClient(header);
+ var header = /** @type {!SDK.CSSStyleSheetHeader} */ (event.data.client);
+ var sourceMap = /** @type {!SDK.SourceMap} */ (event.data.sourceMap);
+ if (this._frameIdToHeaders.has(header.frameId)) {
+ this._frameIdToHeaders.set(header.frameId, header);
+ this._sourceMapAttachedForTest(sourceMap);
+ return;
+ }
+ this._frameIdToHeaders.set(header.frameId, header);
+
for (var sassURL of sourceMap.sourceURLs()) {
var contentProvider = sourceMap.sourceContentProvider(sassURL, Common.resourceTypes.SourceMapStyleSheet);
var embeddedContent = sourceMap.embeddedContentByURL(sassURL);
@@ -77,7 +87,13 @@ Bindings.SASSSourceMapping = class {
* @param {!Common.Event} event
*/
_sourceMapDetached(event) {
- var header = /** @type {!SDK.CSSStyleSheetHeader} */ (event.data);
+ var header = /** @type {!SDK.CSSStyleSheetHeader} */ (event.data.client);
+ this._frameIdToHeaders.remove(header.frameId, header);
+ if (this._frameIdToHeaders.has(header.frameId))
+ return;
+ var sourceMap = /** @type {!SDK.SourceMap} */ (event.data.sourceMap);
+ for (var sassURL of sourceMap.sourceURLs())
+ this._networkProject.removeSourceMapFile(sassURL, header.frameId, false);
Bindings.cssWorkspaceBinding.updateLocations(header);
}

Powered by Google App Engine
This is Rietveld 408576698