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

Issue 764148 link

Starred by 2 users

Issue metadata

Status: Duplicate
Merged: issue 729826
Owner:
Last visit > 30 days ago
Closed: Oct 2017
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux
Pri: 3
Type: Bug



Sign in to add a comment

Remote DevTools API crash on Debugger.setScriptSource after Debugger.scriptParsed event

Reported by justi...@gmail.com, Sep 12 2017

Issue description

Chrome Version       :	62.0.3202.9

What steps will reproduce the problem?
1. Run the attached PoC, which calls setScriptSource inside a scriptParsed event handler after the debugger is paused.

I recognize the PoC is not checking that the debugger is successfully paused before attempting to replace the script source; to be honest I'm not completely sure of the semantics of Debugger.paused, Debugger.scriptParsed, and when those events are fired. For context, I'm attempting to instrument JS as script contexts are created.

What is the expected result?
The script source should be replaced, and hopefully execute when the debugger is resumed.

What happens instead of that?
The page crashes.


 
script-src-poc.js
1.2 KB View Download
Components: Platform>DevTools
Owner: kozyatinskiy@chromium.org
Status: Assigned (was: Unconfirmed)
@justiczm - have you looked at our protocol documentation? https://chromedevtools.github.io/devtools-protocol/tot/Debugger/

@kozy - not sure if this is really a bug, but do you have any pointers for the person?
We're working on new LiveEdit implementation which will fix crash that you are observing. Current implementation of LiveEdit is not reliable.
In general you have following options:
- run some JavaScript before any JavaScript on the page: Page.addScriptToEvaluateOnNewDocument [1]
- can break (you'll get Debugger.paused event) on each new script (excluding evaluated with eval scripts): DOMDebugger.setInstrumentationBreakpoint with scriptFirstStatement. We definitely should introduce enum for this method and make it fires on script evaluated from JavaScript runtime.

[1] https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-addScriptToEvaluateOnLoad

Comment 4 by justi...@gmail.com, Sep 22 2017

Ah, DOMDebugger.setInstrumentationBreakpoint looks perfect! Thanks for the reply, I really appreciate it.
Mergedinto: 729826
Status: Duplicate (was: Assigned)

Sign in to add a comment