Skip to content

Instantly share code, notes, and snippets.

@darky
Last active May 31, 2016 10:17
Show Gist options
  • Save darky/73feb95a991419b56c17dba795b26e1c to your computer and use it in GitHub Desktop.
Save darky/73feb95a991419b56c17dba795b26e1c to your computer and use it in GitHub Desktop.
Run chrome with --remote-debugging-port=9222 | Open tab with your project and there devtools | Open new tab localhost:9222 and there to devtools of devtools prev tab | Inject in Console below code | Refresh devtools
WebInspector.TextSourceMap.prototype._parseMap = function(map, lineNumber, columnNumber) {
var sourceIndex = 0;
var sourceLineNumber = 0;
var sourceColumnNumber = 0;
var nameIndex = 0;
var sources = [];
var names = map.names || [];
var sourceRoot = map.sourceRoot || "";
if (sourceRoot && !sourceRoot.endsWith("/"))
sourceRoot += "/";
for (var i = 0; i < map.sources.length; ++i) {
var href = sourceRoot + map.sources[i];
var url = WebInspector.ParsedURL.completeURL(this._sourceMappingURL, href) || href;
var hasSource = map.sourcesContent && map.sourcesContent[i];
// if (url === this._compiledURL && hasSource)
// url += WebInspector.UIString(" [sm]");
sources.push(url);
this._sources[url] = true;
if (hasSource)
this._sourceContentByURL[url] = map.sourcesContent[i];
}
var stringCharIterator = new WebInspector.TextSourceMap.StringCharIterator(map.mappings);
var sourceURL = sources[sourceIndex];
while (true) {
if (stringCharIterator.peek() === ",")
stringCharIterator.next();
else {
while (stringCharIterator.peek() === ";") {
lineNumber += 1;
columnNumber = 0;
stringCharIterator.next();
}
if (!stringCharIterator.hasNext())
break;
}
columnNumber += this._decodeVLQ(stringCharIterator);
if (!stringCharIterator.hasNext() || this._isSeparator(stringCharIterator.peek())) {
this._mappings.push(new WebInspector.SourceMapEntry(lineNumber,columnNumber));
continue;
}
var sourceIndexDelta = this._decodeVLQ(stringCharIterator);
if (sourceIndexDelta) {
sourceIndex += sourceIndexDelta;
sourceURL = sources[sourceIndex];
}
sourceLineNumber += this._decodeVLQ(stringCharIterator);
sourceColumnNumber += this._decodeVLQ(stringCharIterator);
if (!this._isSeparator(stringCharIterator.peek()))
nameIndex += this._decodeVLQ(stringCharIterator);
this._mappings.push(new WebInspector.SourceMapEntry(lineNumber,columnNumber,sourceURL,sourceLineNumber,sourceColumnNumber,names[nameIndex]));
}
for (var i = 0; i < this._mappings.length; ++i) {
var mapping = this._mappings[i];
var url = mapping.sourceURL;
if (!url)
continue;if (!this._reverseMappingsBySourceURL.has(url))
this._reverseMappingsBySourceURL.set(url, []);
var reverseMappings = this._reverseMappingsBySourceURL.get(url);
reverseMappings.push(mapping);
}
}
WebInspector.FileSystemWorkspaceBinding._scriptExtensions.add('ls')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment