setScriptSource method
Edits JavaScript source live.
In general, functions that are currently on the stack can not be edited with
a single exception: If the edited function is the top-most stack frame and
that is the only activation of that function on the stack. In this case
the live edit will be successful and a Debugger.restartFrame
for the
top-most function is automatically triggered.
scriptId
Id of the script to edit.
scriptSource
New content of the script.
dryRun
If true the change will not actually be applied. Dry run may be used to get result
description without actually modifying the code.
allowTopFrameEditing
If true, then scriptSource
is allowed to change the function on top of the stack
as long as the top-most stack frame is the only activation of that function.
Implementation
Future<SetScriptSourceResult> setScriptSource(
runtime.ScriptId scriptId, String scriptSource,
{bool? dryRun, bool? allowTopFrameEditing}) async {
var result = await _client.send('Debugger.setScriptSource', {
'scriptId': scriptId,
'scriptSource': scriptSource,
if (dryRun != null) 'dryRun': dryRun,
if (allowTopFrameEditing != null)
'allowTopFrameEditing': allowTopFrameEditing,
});
return SetScriptSourceResult.fromJson(result);
}