Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Uncaught SyntaxError: Unexpected token 'debugger' (at home.ui-0.js:353714:52)

56 views
Skip to first unread message

David Nouls

unread,
Jan 6, 2025, 5:28:47 AMJan 6
to GWT Users
Since a few weeks I am now seeing an error in Chrome:
Uncaught SyntaxError: Unexpected token 'debugger' (at home.ui-0.js:353714:52)

This happens when I do a draft compilation in pretty mode on my application. Not when I do a production build.

Related to this piece of generated code:
ogcs.debugger_1 = function debugger_1(){
  var stackIndex;
  $stack_0[stackIndex = ++$stackDepth_0] = ogcs.debugger_1;
  ($location_0[stackIndex] = 'GWT.java:' + '54' , ogcs).$clinit_GWT_2();
  if (($location_0[stackIndex] = 'GWT.java:' + '56' , ogcs).isScript_2() && !ogcs.isProdMode_0()) {
    $location_0[stackIndex] = 'GWT.java:' + '57' , debugger;
  }
  $stackDepth_0 = stackIndex - 1;
}

For some reason, the debugger symbol is unknown at the moment that my application is being loaded. 

Yet, when I inspect the debugger object in Dev Tools, the object exists.

Is this a known issue when using GWT 2.11 with newer versions of Chrome? It used to work just fine on the same version of GWT. The only thing that changed is the version of Chrome.


Colin Alworth

unread,
Jan 6, 2025, 10:51:54 AMJan 6
to GWT Users
Thanks - it looks like the "debugger" statement can't be nested within a comma expression, unlike every other one-line statement in JS that I'm aware of... Can you file this so we can look into what Chrome's specific rules are here, when this might have changed, etc?

Consider turning off emulated stack traces when using draft - it will speed up your builds quite a bit, and dramatically shrink your output, and will run quite a bit faster. For the same reasons you might want to think about leaving it off in production, and using other means of getting good stack traces (and speeding up your app - emulated stack traces are pretty awful for size and performance.

Jens

unread,
Jan 6, 2025, 11:36:02 AMJan 6
to GWT Users
You get the same exception in Safari and Firefox. So it is not really Chrome specific. 

If I read it correctly then COMMA is an operator that works on expressions but "debugger" is a statement. Thus JS parser fails with an exception. 

I assume something else has changed in your setup which now reveals the issue.

-- J.

Colin Alworth

unread,
Jan 6, 2025, 11:38:26 AMJan 6
to GWT Users
Thank you, my mistake. I've also confirmed others have had this issue (though not with GWT afaict) going back at least 10 years, which definitely seems to confirm it isn't a recent change in Chrome.
Reply all
Reply to author
Forward
0 new messages