Issue 733690 in chromium: Exception in module inline script is reported at the wrong location

2 views
Skip to first unread message

n… via monorail

unread,
Jun 15, 2017, 12:47:25 PM6/15/17
to modul...@chromium.org
Updates:
Cc: modul...@chromium.org
Components: Platform>DevTools>JavaScript
Labels: -Priority-2 Pri-2
Owner: ----
Status: Available

Comment #3 on issue 733690 by ne...@chromium.org: Exception in module inline script is reported at the wrong location
https://bugs.chromium.org/p/chromium/issues/detail?id=733690#c3

(No comment was entered for this change.)

--
You received this message because:
1. You were specifically CC'd on the issue

You may adjust your notification preferences at:
https://bugs.chromium.org/hosting/settings

Reply to this email to add a comment.

jgru… via monorail

unread,
Jun 21, 2017, 5:06:50 AM6/21/17
to modul...@chromium.org

Comment #4 on issue 733690 by jgr...@chromium.org: Exception in module inline script is reported at the wrong location
https://bugs.chromium.org/p/chromium/issues/detail?id=733690#c4

Looks like V8 reports the correct location:

<html>
<script> // Or <script type="module">
let a;
let b;
let c;
let d;
let a;
</script>
</html>

In both cases, the parser reports the SyntaxError at position 33.

Note that this bug only affects exceptions thrown during parsing, normal runtime exceptions have the correct location:

<html>
<script> // Or <script type="module">
let a;
let b;
let c;
let d;
throw new SyntaxError(); // Correct in both cases.
</script>
</html>

The bug happens sometime between Isolate::Throw (offset reported correctly) and V8ConsoleMessage::createForException (wrong line/column nr). We end up sending the following to inspector:

global:

{
"method": "Runtime.exceptionThrown",
"params": {
"exceptionDetails": {
"columnNumber": 4,
"exception": {
"className": "SyntaxError",
"description": "SyntaxError: Identifier 'a' has already been declared",
"objectId": "{\"injectedScriptId\":3,\"id\":1}",
"preview": {
"description": "SyntaxError: Identifier 'a' has already been declared",
"overflow": false,
"properties": [
{
"name": "stack",
"type": "string",
"value": "SyntaxError: Identifier 'a' has already been declared"
},
{
"name": "message",
"type": "string",
"value": "Identifier 'a' has already been declared"
}
],
"subtype": "error",
"type": "object"
},
"subtype": "error",
"type": "object"
},
"exceptionId": 2,
"executionContextId": 3,
"lineNumber": 6,
"scriptId": "67",
"text": "Uncaught",
"url": "file:///usr/local/google/home/jgruber/html/global-syntax-error.html"
},
"timestamp": 1498035411249.1719
}
}

module:

{
"method": "Runtime.exceptionThrown",
"params": {
"exceptionDetails": {
"columnNumber": 32,
"exception": {
"className": "SyntaxError",
"description": "SyntaxError: Identifier 'a' has already been declared",
"objectId": "{\"injectedScriptId\":1,\"id\":1}",
"preview": {
"description": "SyntaxError: Identifier 'a' has already been declared",
"overflow": false,
"properties": [
{
"name": "stack",
"type": "string",
"value": "SyntaxError: Identifier 'a' has already been declared"
},
{
"name": "message",
"type": "string",
"value": "Identifier 'a' has already been declared"
}
],
"subtype": "error",
"type": "object"
},
"subtype": "error",
"type": "object"
},
"exceptionId": 1,
"executionContextId": 1,
"lineNumber": 1,
"scriptId": "33",
"text": "Uncaught",
"url": "file:///usr/local/google/home/jgruber/html/module-syntax-error.html"
},
"timestamp": 1498035256046.3418
}
}

The line: 1, column: 32 sent for modules doesn't make any sense (line 1 is only 8 chars long, including \n).

n… via monorail

unread,
Jun 21, 2017, 12:04:58 PM6/21/17
to modul...@chromium.org
Updates:
Owner: kozyatin...@chromium.org
Status: Assigned

Comment #5 on issue 733690 by ne...@chromium.org: Exception in module inline script is reported at the wrong location
https://bugs.chromium.org/p/chromium/issues/detail?id=733690#c5

Thanks a lot for the investigation. Alexey, can you take a look?

kozyatin… via monorail

unread,
Oct 12, 2017, 8:33:34 PM10/12/17
to modul...@chromium.org
Updates:
Status: Fixed

Comment #6 on issue 733690 by kozyat...@chromium.org: Exception in module inline script is reported at the wrong location
https://bugs.chromium.org/p/chromium/issues/detail?id=733690#c6

It was fixed by @adamk and is not reproducible in ToT.
Reply all
Reply to author
Forward
0 new messages