[devtools] _parseMap in SourceMap.js does not strictly follow specs
Also add tests for issue 611738 BUG=611738 Review-Url: https://codereview.chromium.org/2222713004 Cr-Commit-Position: refs/heads/master@{#415074}
This commit is contained in:

committed by
Commit bot

parent
96e81eec47
commit
51f1de9d92
1
AUTHORS
1
AUTHORS
@ -61,6 +61,7 @@ Ankur Verma <ankur1.verma@samsung.com>
|
||||
Anne Kao <annekao94@gmail.com>
|
||||
Anssi Hannula <anssi.hannula@iki.fi>
|
||||
Anton Obzhirov <a.obzhirov@samsung.com>
|
||||
Antonin Hildebrand <antonin.hildebrand@gmail.com>
|
||||
Antonio Gomes <a1.gomes@sisa.samsung.com>
|
||||
Anuj Kumar Sharma <anujk.sharma@samsung.com>
|
||||
Arjun Karthik <arjunkar@amazon.com>
|
||||
|
12
third_party/WebKit/LayoutTests/http/tests/inspector/compiler-script-mapping-expected.txt
vendored
12
third_party/WebKit/LayoutTests/http/tests/inspector/compiler-script-mapping-expected.txt
vendored
@ -153,3 +153,15 @@ example.js === example.js [sm]
|
||||
9 === 9
|
||||
source line 0 has no mappings.
|
||||
|
||||
Running: testNameIndexes
|
||||
1:0 > [no name assigned]
|
||||
3:0 > [no name assigned]
|
||||
3:18 > [no name assigned]
|
||||
3:4 > 'name1'
|
||||
4:0 > [no name assigned]
|
||||
4:0 > [no name assigned]
|
||||
4:4 > 'generated31465'
|
||||
4:27 > [no name assigned]
|
||||
5:0 > [no name assigned]
|
||||
5:0 > [no name assigned]
|
||||
|
||||
|
@ -475,6 +475,50 @@ function test()
|
||||
checkMapping(0, 9, "example.js", 0, 9, mapping);
|
||||
checkReverseMapping(0, 0, "example.js", 0, mapping);
|
||||
next();
|
||||
},
|
||||
|
||||
function testNameIndexes(next)
|
||||
{
|
||||
/*
|
||||
------------------------------------------------------------------------------------
|
||||
chrome_issue_611738.clj:
|
||||
(ns devtools-sample.chrome-issue-611738)
|
||||
|
||||
(defmacro m []
|
||||
`(let [generated# "value2"]))
|
||||
------------------------------------------------------------------------------------
|
||||
chrome_issue_611738.cljs:
|
||||
(ns devtools-sample.chrome-issue-611738
|
||||
(:require-macros [devtools-sample.chrome-issue-611738 :refer [m]]))
|
||||
|
||||
(let [name1 "value1"]
|
||||
(m))
|
||||
------------------------------------------------------------------------------------
|
||||
chrome_issue_611738.js:
|
||||
// Compiled by ClojureScript 1.9.89 {}
|
||||
goog.provide('devtools_sample.chrome_issue_611738');
|
||||
goog.require('cljs.core');
|
||||
var name1_31466 = "value1";
|
||||
var generated31465_31467 = "value2";
|
||||
|
||||
//# sourceMappingURL=chrome_issue_611738.js.map
|
||||
------------------------------------------------------------------------------------
|
||||
chrome_issue_611738.js.map:
|
||||
{"version":3,"file":"\/Users\/darwin\/code\/cljs-devtools-sample\/resources\/public\/_compiled\/demo\/devtools_sample\/chrome_issue_611738.js","sources":["chrome_issue_611738.cljs"],"lineCount":7,"mappings":";AAAA;;AAGA,kBAAA,dAAMA;AAAN,AACE,IAAAC,uBAAA;AAAA,AAAA","names":["name1","generated31465"]}
|
||||
------------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
var mappingPayload = {
|
||||
"sources": ["chrome_issue_611738.cljs"],
|
||||
"mappings": ";AAAA;;AAGA,kBAAA,dAAMA;AAAN,AACE,IAAAC,uBAAA;AAAA,AAAA",
|
||||
"names": ["name1", "generated31465"]
|
||||
};
|
||||
var mapping = new WebInspector.TextSourceMap("chrome_issue_611738.js", "chrome_issue_611738.js.map", mappingPayload);
|
||||
mapping.mappings().forEach(function(entry) {
|
||||
const name = entry.name ? "'" + entry.name + "'" : "[no name assigned]";
|
||||
InspectorTest.addResult(entry.lineNumber + ":" + entry.columnNumber + " > " + name);
|
||||
});
|
||||
next();
|
||||
}
|
||||
]);
|
||||
};
|
||||
|
@ -457,9 +457,13 @@ WebInspector.TextSourceMap.prototype = {
|
||||
}
|
||||
sourceLineNumber += this._decodeVLQ(stringCharIterator);
|
||||
sourceColumnNumber += this._decodeVLQ(stringCharIterator);
|
||||
if (!this._isSeparator(stringCharIterator.peek()))
|
||||
nameIndex += this._decodeVLQ(stringCharIterator);
|
||||
|
||||
if (!stringCharIterator.hasNext() || this._isSeparator(stringCharIterator.peek())) {
|
||||
this._mappings.push(new WebInspector.SourceMapEntry(lineNumber, columnNumber, sourceURL, sourceLineNumber, sourceColumnNumber));
|
||||
continue;
|
||||
}
|
||||
|
||||
nameIndex += this._decodeVLQ(stringCharIterator);
|
||||
this._mappings.push(new WebInspector.SourceMapEntry(lineNumber, columnNumber, sourceURL, sourceLineNumber, sourceColumnNumber, names[nameIndex]));
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user