зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1388855 - Simplify source map URL extraction in stylesheet actor; r=gl
MozReview-Commit-ID: 3WeNugNx7M --HG-- extra : rebase_source : 972c3faa9b2636f059043fbb3b12f7fbe922c6c4
This commit is contained in:
Родитель
c355a3b8b9
Коммит
eabdd82c6a
|
@ -548,12 +548,11 @@ var StyleSheetActor = protocol.ActorClassWithSpec(styleSheetSpec, {
|
|||
_fetchSourceMap: function () {
|
||||
let deferred = defer();
|
||||
|
||||
this._getText().then(sheetContent => {
|
||||
let url = this._extractSourceMapUrl(sheetContent);
|
||||
let url = this.rawSheet.sourceMapURL;
|
||||
if (!url) {
|
||||
// no source map for this stylesheet
|
||||
deferred.resolve(null);
|
||||
return;
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
url = normalize(url, this.safeHref);
|
||||
|
@ -582,7 +581,6 @@ var StyleSheetActor = protocol.ActorClassWithSpec(styleSheetSpec, {
|
|||
}, deferred.reject);
|
||||
|
||||
this._sourceMap = map;
|
||||
}, deferred.reject);
|
||||
|
||||
return deferred.promise;
|
||||
},
|
||||
|
@ -613,26 +611,6 @@ var StyleSheetActor = protocol.ActorClassWithSpec(styleSheetSpec, {
|
|||
: base;
|
||||
},
|
||||
|
||||
/**
|
||||
* Get the source map url specified in the text of a stylesheet.
|
||||
*
|
||||
* @param {string} content
|
||||
* The text of the style sheet.
|
||||
* @return {string}
|
||||
* Url of source map.
|
||||
*/
|
||||
_extractSourceMapUrl: function (content) {
|
||||
// If a SourceMap response header was saved on the style sheet, use it.
|
||||
if (this.rawSheet.sourceMapURL) {
|
||||
return this.rawSheet.sourceMapURL;
|
||||
}
|
||||
let matches = /sourceMappingURL\=([^\s\*]*)/.exec(content);
|
||||
if (matches) {
|
||||
return matches[1];
|
||||
}
|
||||
return null;
|
||||
},
|
||||
|
||||
/**
|
||||
* Protocol method that gets the location in the original source of a
|
||||
* line, column pair in this stylesheet, if its source mapped, otherwise
|
||||
|
|
Загрузка…
Ссылка в новой задаче