New issue
Advanced search Search tips

Issue 864296 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Sep 20
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

DevTools: infinite scriptFailedToParse triggered by JS "compile" errors

Project Member Reported by l...@chromium.org, Jul 17

Issue description

Setup Workspaces with a mapped script that has a "compile" error, e.g. `
function a() {
    const b = 1;
    const b = 2;
}
`

If the user has set a breakpoint inside this function, DevTools' BreakpointManager tries to `getPossibleBreakpoints()`, which "compiles" the script, but fails due to the double `const`.  Even though we load the source in Sources panel, the failure generates a `Debugger.scriptFailedToParse` event that leads to an infinite loop of `scriptFailedToParse`.  Visually, the user sees flashing breakpoints, and a flashing green dot.  

GIF: https://imgur.com/a/HeYW9I0

What steps will reproduce the problem?
(1) Setup workspaces and load a site with the script above
(2) Set a breakpoint within the function with 2 consts
(3) Open the file in DevTools' sources panel

What is the expected result?
No flashing

What happens instead?
Flashing
 
Project Member

Comment 1 by bugdroid1@chromium.org, Sep 5

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/0e743fb703d753762a8e15ef64c9751090ff3587

commit 0e743fb703d753762a8e15ef64c9751090ff3587
Author: Joel Einbinder <einbinder@chromium.org>
Date: Wed Sep 05 17:10:48 2018

DevTools: Fix flickering scripts with damaged functions

When a script has a function with multiple const declarations for the
same variable, ex:
function hey(){
  const duplicate = 0;
  const duplicate = 1;
}
The script that contains this function will parse correctly, but
when the function `hey` is run a scriptFailedParse event will be
emitted. DevTools only ever expects to get one script parsing
event per scriptId, and this causes flickering of the script in
the Sources panel.

This patch swallows subsequent script parsing events for a script.

Bug:  864296 
Change-Id: I55a2e865b665e8fe1283a3dd19e9f152d0982b97
Reviewed-on: https://chromium-review.googlesource.com/1140782
Commit-Queue: Joel Einbinder <einbinder@chromium.org>
Reviewed-by: Aleksey Kozyatinskiy <kozyatinskiy@chromium.org>
Reviewed-by: Andrey Lushnikov <lushnikov@chromium.org>
Cr-Commit-Position: refs/heads/master@{#588901}
[add] https://crrev.com/0e743fb703d753762a8e15ef64c9751090ff3587/third_party/WebKit/LayoutTests/http/tests/devtools/sources/debugger/script-lazily-failed-to-parse-expected.txt
[add] https://crrev.com/0e743fb703d753762a8e15ef64c9751090ff3587/third_party/WebKit/LayoutTests/http/tests/devtools/sources/debugger/script-lazily-failed-to-parse.js
[modify] https://crrev.com/0e743fb703d753762a8e15ef64c9751090ff3587/third_party/blink/renderer/devtools/front_end/sdk/DebuggerModel.js

Status: Fixed (was: Assigned)

Sign in to add a comment