Skip to content

Instantly share code, notes, and snippets.

@darky
Last active May 31, 2016 10:08
Show Gist options
  • Save darky/13986f4b0e8895e5c0327941fb13ff74 to your computer and use it in GitHub Desktop.
Save darky/13986f4b0e8895e5c0327941fb13ff74 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.SourceMap.prototype._parseMap = function(map, lineNumber, columnNumber)
{
var sourceIndex = 0;
var sourceLineNumber = 0;
var sourceColumnNumber = 0;
var nameIndex = 0;
var sources = [];
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.SourceMap.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.SourceMap.Entry(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.SourceMap.Entry(lineNumber,columnNumber,sourceURL,sourceLineNumber,sourceColumnNumber));
}
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.ResourceScriptFile.prototype._isDiverged = function()
{
if (this._uiSourceCode.isDirty())
return true;
if (!this._script)
return false;
if (typeof this._scriptSource === "undefined")
return false;
// if (!this._uiSourceCode.workingCopy().startsWith(this._scriptSource.trimRight()))
// return true;
var suffix = this._uiSourceCode.workingCopy().substr(this._scriptSource.length);
return !!suffix.length && !suffix.match(WebInspector.Script.sourceURLRegex);
}
WebInspector.FileSystemWorkspaceBinding._scriptExtensions.add('ls')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment