New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 733690 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Last visit > 30 days ago
Closed: Oct 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 2
Type: Bug


Previous locations:
v8:6498


Sign in to add a comment

Exception in module inline script is reported at the wrong location

Project Member Reported by neis@chromium.org, Jun 15 2017

Issue description

See screenshot.
 
Screenshot 2017-06-15 at 18.40.00.png
289 KB View Download

Comment 1 by neis@chromium.org, Jun 15 2017

Cc: kozyatinskiy@chromium.org neis@chromium.org jgruber@chromium.org
Labels: Priority-2
Owner: ----
Status: Available (was: Assigned)
The exception is shown to occur at the closing bracket of the script element, rather than in one of the "let x" declarations. Works fine for classic scripts.

Comment 2 by neis@chromium.org, Jun 15 2017

Project: chromium
Moved issue v8:6498 to now be  issue chromium:733690 .

Comment 3 by neis@chromium.org, Jun 15 2017

Cc: module-dev@chromium.org
Components: Platform>DevTools>JavaScript
Labels: -Priority-2 Pri-2
Owner: ----
Status: Available (was: Assigned)
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).

Comment 5 by neis@chromium.org, Jun 21 2017

Owner: kozyatinskiy@chromium.org
Status: Assigned (was: Available)
Thanks a lot for the investigation. Alexey, can you take a look?
Status: Fixed (was: Assigned)
It was fixed by @adamk and is not reproducible in ToT.

Sign in to add a comment