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

Unified Diff: Source/devtools/front_end/StylesSourceMapping.js

Issue 110223008: DevTools: Strip sourceURL comment from stylesheets before showing them in the editor. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Made regex global Created 7 years 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
« no previous file with comments | « Source/devtools/front_end/CSSStyleModel.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/StylesSourceMapping.js
diff --git a/Source/devtools/front_end/StylesSourceMapping.js b/Source/devtools/front_end/StylesSourceMapping.js
index 423931433367d0e6c9a0c2d843c025c6e92d65fc..341706821d3c234a89ca8ca5cd617fade88b0472 100644
--- a/Source/devtools/front_end/StylesSourceMapping.js
+++ b/Source/devtools/front_end/StylesSourceMapping.js
@@ -271,40 +271,28 @@ WebInspector.StylesSourceMapping.prototype = {
delete this._updateStyleSheetTextTimer;
}
- CSSAgent.getStyleSheetText(styleSheetId, callback.bind(this));
-
- /**
- * @param {?string} error
- * @param {string} content
- * @this {WebInspector.StylesSourceMapping}
- */
- function callback(error, content)
- {
- if (!error)
- this._innerStyleSheetChanged(styleSheetId, content);
- }
- },
-
- /**
- * @param {!CSSAgent.StyleSheetId} styleSheetId
- * @param {string} content
- */
- _innerStyleSheetChanged: function(styleSheetId, content)
- {
var header = this._cssModel.styleSheetHeaderForId(styleSheetId);
if (!header)
return;
var styleSheetURL = header.resourceURL();
if (!styleSheetURL)
return;
-
var uiSourceCode = this._workspace.uiSourceCodeForURL(styleSheetURL)
if (!uiSourceCode)
return;
+ header.requestContent(callback.bind(this, uiSourceCode));
- var styleFile = this._styleFiles.get(uiSourceCode);
- if (styleFile)
- styleFile.addRevision(content);
+ /**
+ * @param {!WebInspector.UISourceCode} uiSourceCode
+ * @param {?string} content
+ * @this {WebInspector.StylesSourceMapping}
+ */
+ function callback(uiSourceCode, content)
+ {
+ var styleFile = this._styleFiles.get(uiSourceCode);
+ if (styleFile)
+ styleFile.addRevision(content || "");
+ }
}
}
@@ -323,8 +311,6 @@ WebInspector.StyleFile = function(uiSourceCode, mapping)
WebInspector.StyleFile.updateTimeout = 200;
-WebInspector.StyleFile.sourceURLRegex = /\n[\040\t]*\/\*#[\040\t]sourceURL=[\040\t]*([^\s]*)[\040\t]*\*\/[\040\t]*$/m;
-
WebInspector.StyleFile.prototype = {
_workingCopyCommitted: function(event)
{
@@ -378,8 +364,6 @@ WebInspector.StyleFile.prototype = {
addRevision: function(content)
{
this._isAddingRevision = true;
- if (this._uiSourceCode.project().type() === WebInspector.projectTypes.FileSystem)
- content = content.replace(WebInspector.StyleFile.sourceURLRegex, "");
this._uiSourceCode.addRevision(content);
delete this._isAddingRevision;
},
« no previous file with comments | « Source/devtools/front_end/CSSStyleModel.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698