fix(maxun-core): check active execution before resetting isAborted

Move this.stopper guard to top of run() before resetting isAborted.
This ensures an in-flight execution's abort flag cannot be accidentally
cleared if run() is invoked while the interpreter is already active.
This commit is contained in:
Santosh-Prasad-Verma
2026-08-19 00:48:07 +05:30
parent 10922d114f
commit 12d931e5e7
+4 -4
View File
@@ -3222,8 +3222,11 @@ export default class Interpreter extends EventEmitter {
* for the `{$param: nameofparam}` fields.
*/
public async run(page: Page, params?: ParamType): Promise<void> {
this.log('Starting the workflow.', Level.LOG);
if (this.stopper) {
throw new Error('This Interpreter is already running a workflow. To run another workflow, please, spawn another Interpreter.');
}
this.isAborted = false;
this.log('Starting the workflow.', Level.LOG);
const context = page.context();
page.setDefaultNavigationTimeout(100000);
@@ -3239,9 +3242,6 @@ export default class Interpreter extends EventEmitter {
this.log(`Proxy authenticated...`);
}
}
if (this.stopper) {
throw new Error('This Interpreter is already running a workflow. To run another workflow, please, spawn another Interpreter.');
}
/**
* `this.workflow` with the parameters initialized.
*/