mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-16 22:38:34 +02:00
Use a dedicated ScriptDeath type to signal script termination instead of WorkerScript
Problem with throwing WorkerScript is that the termination signal object can pass through user code, which permits user to modify that object and all parts of the game state accessible through it.
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
* Stops an actively-running script (represented by a WorkerScript object)
|
||||
* and removes it from the global pool of active scripts.
|
||||
*/
|
||||
import { ScriptDeath } from "./ScriptDeath";
|
||||
import { WorkerScript } from "./WorkerScript";
|
||||
import { workerScripts } from "./WorkerScripts";
|
||||
import { WorkerScriptStartStopEventEmitter } from "./WorkerScriptStartStopEventEmitter";
|
||||
@@ -139,7 +140,7 @@ function killNetscriptDelay(workerScript: WorkerScript): void {
|
||||
if (workerScript.delay) {
|
||||
clearTimeout(workerScript.delay);
|
||||
if (workerScript.delayReject) {
|
||||
workerScript.delayReject(workerScript);
|
||||
workerScript.delayReject(new ScriptDeath(workerScript));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user