New issue
Advanced search Search tips

Issue 695244 link

Starred by 1 user

Issue metadata

Status: Assigned
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

Vulcanize errors do not reference source file

Project Member Reported by steve...@chromium.org, Feb 22 2017

Issue description

I made changes to network_summary_item.html and network_summary_item.js and got the following build error with vulcanization enabled. There is no reference to which of my changes might be the problem. I confirmed that the code builds without my changes.

I will now resort to removing my changes one by one, but it would be mice if we could reference the original source lines:


FAILED: gen/chrome/browser/resources/settings/vulcanized.unbuilt.html gen/chrome/browser/resources/settings/crisper.js 
python ../../chrome/browser/resources/vulcanize_gn.py --host md-settings --html_in_file settings.html --html_out_file vulcanized.unbuilt.html --js_out_file crisper.js --input gen/chrome/browser/resources/settings/settings_resources.pak --out_folder gen/chrome/browser/resources/settings --depfile gen/chrome/browser/resources/settings/vulcanize.d --insert_in_head \<base\ href=\"chrome://\$i18n{hostname}\"\>
../../third_party/node/linux/node-linux-x64/bin/node ../../third_party/node/node_modules/uglifyjs/bin/uglifyjs /usr/local/google/home/stevenjb/Work/chrome/src/out_daisy/Release/gen/chrome/browser/resources/settings/crisper.js --comments "/Copyright|license|LICENSE|\<\/?if/" --output /usr/local/google/home/stevenjb/Work/chrome/src/out_daisy/Release/gen/chrome/browser/resources/settings/crisper.js failed: Parse error at /usr/local/google/home/stevenjb/Work/chrome/src/out_daisy/Release/gen/chrome/browser/resources/settings/crisper.js:44633,22
Unexpected token punc «(», expected punc «:»
Error
    at new JS_Parse_Error (/usr/local/google/home/stevenjb/Work/chrome/src/third_party/node/node_modules/uglifyjs/lib/parse.js:196:18)
    at js_error (/usr/local/google/home/stevenjb/Work/chrome/src/third_party/node/node_modules/uglifyjs/lib/parse.js:204:11)
    at croak (/usr/local/google/home/stevenjb/Work/chrome/src/third_party/node/node_modules/uglifyjs/lib/parse.js:674:9)
    at token_error (/usr/local/google/home/stevenjb/Work/chrome/src/third_party/node/node_modules/uglifyjs/lib/parse.js:682:9)
    at expect_token (/usr/local/google/home/stevenjb/Work/chrome/src/third_party/node/node_modules/uglifyjs/lib/parse.js:695:9)
    at expect (/usr/local/google/home/stevenjb/Work/chrome/src/third_party/node/node_modules/uglifyjs/lib/parse.js:698:36)
    at /usr/local/google/home/stevenjb/Work/chrome/src/third_party/node/node_modules/uglifyjs/lib/parse.js:1251:13
    at /usr/local/google/home/stevenjb/Work/chrome/src/third_party/node/node_modules/uglifyjs/lib/parse.js:721:24
    at expr_atom (/usr/local/google/home/stevenjb/Work/chrome/src/third_party/node/node_modules/uglifyjs/lib/parse.js:1181:35)
    at maybe_unary (/usr/local/google/home/stevenjb/Work/chrome/src/third_party/node/node_modules/uglifyjs/lib/parse.js:1357:19)

Traceback (most recent call last):
  File "../../chrome/browser/resources/vulcanize_gn.py", line 217, in <module>
    main(sys.argv[1:])
  File "../../chrome/browser/resources/vulcanize_gn.py", line 211, in main
    _vulcanize(vulcanize_input_folder, args)
  File "../../chrome/browser/resources/vulcanize_gn.py", line 176, in _vulcanize
    '--output', js_out_path])
  File "../../third_party/node/node.py", line 28, in RunNode
    raise
TypeError: exceptions must be old-style classes or derived from BaseException, not NoneType

 

Comment 1 by dpa...@chromium.org, Feb 22 2017

The error is coming from the invocation of uglifyjs which only operates on the concatenated crisper.js file, so there is no way I can think of to easily map the error back to the source file that caused it.

Comment 2 by dpa...@chromium.org, Feb 22 2017

BTW, you can open crisper.js from within the out/gen folder and go to line 44633. This will show you the code causing the error, and from there you can deduce the file. Still manual, but you don't have to relplay your changes 1 by one.
Well, in this case there weren't that many changes, and it was my classic blunder of using C style function declarations in a Polymer object (which of course clang is fine with because it's valid ES6).

It would be -nice- if we could correlate crisper.js lines to source lines somewhere and do a lookup, or maybe at least output a snippet from the crisper.js file, but I understand that falls pretty deep into the "nice to have" category. That said, I doubt I will be the last person to file a bug like this...

Comment 4 by dbeam@chromium.org, Feb 22 2017

this is almost certainly a `for ( of )`

Comment 5 by dbeam@chromium.org, Feb 22 2017

and i am certainly wrong ^
:) You had the right idea though.

Comment 7 by dpa...@chromium.org, Feb 23 2017

Agreed that probably more people will hit this, and it is a nice to have. But what would be even nicer is if we did not expect uglifyjs to throw any errors, and it does not limit us from using ES6. I think we should focus more there (upgrading our deps to an ES6 friendly minimizer/uglifier), than polishing the existing non ES6 friendly tools.
sgtm, feel free to dupe this to an issue tracking ES6 support in vulcanize
:)

Sign in to add a comment