Support for source map sections?

35 views
Skip to first unread message

charles....@gmail.com

unread,
Jul 15, 2015, 10:58:20 AM7/15/15
to google-chrome-...@googlegroups.com
I'm having trouble trying to get source map sections working with Chrome.  Using the simple javascrit file sayHello.js:

/*
 * Simple function to say hello
 */

function sayHello() {
 
var hello = "hello";
  console
.log(hello);
 
return hello;
}
 

and the minified version which specifies the source map url:

function sayHello(){console.log("hello");return"hello"};
//# sourceMappingURL=./sayHello.map

and the sayHello.map file generated by Closure (with sourcesContent added)

{
"version":3,
"file":"",
"lineCount":1,
"mappings":"AAGAA,QAASA,SAAQ,EAAG,CAElBC,OAAAC,IAAA,CADYC,OACZ,CACA,OAFYA,OADM;",
"sources":["sayHello.js"],
"sourcesContent":["\/*\r\n * Simple function to say hello\r\n *\/\r\nfunction sayHello() {\r\n  var hello = \"hello\";\r\n  console.log(hello);\r\n  return hello;\r\n}\r\n"],
"names":["sayHello","console","log","hello"]
}

Chrome correctly shows the sayHello.js source file in the resources tree and I can debug using the source. 

However, if I modify the map to use the sections format described here:

{
"version" : 3,
"sections" : [
{"offest" : {"line":0, "column":0}, "map":{
"version":3,
"file":"",
"lineCount":1,
"mappings":"AAGAA,QAASA,SAAQ,EAAG,CAElBC,OAAAC,IAAA,CADYC,OACZ,CACA,OAFYA,OADM;",
"sources":["sayHello.js"],
"sourcesContent":["\/*\r\n * Simple function to say hello\r\n *\/\r\nfunction sayHello() {\r\n  var hello = \"hello\";\r\n  console.log(hello);\r\n  return hello;\r\n}\r\n"],
"names":["sayHello","console","log","hello"]
}}]}

then the source is no longer available in the debugger.  Is this a bug or am I mis-interpreting the spec?

Reply all
Reply to author
Forward
0 new messages