mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-22 23:53:48 +01:00
Fix #3037: wrap user-supplied atExit function so that we can't accidentally leak game objects as 'this'
This commit is contained in:
parent
ee887de151
commit
66ceff4e33
@ -2279,7 +2279,7 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS {
|
||||
if (typeof f !== "function") {
|
||||
throw makeRuntimeErrorMsg("atExit", "argument should be function");
|
||||
}
|
||||
workerScript.atExit = f;
|
||||
workerScript.atExit = () => { f(); }; // Wrap the user function to prevent WorkerScript leaking as 'this'
|
||||
},
|
||||
mv: function (host: string, source: string, destination: string): void {
|
||||
updateDynamicRam("mv", getRamCost(Player, "mv"));
|
||||
|
Loading…
Reference in New Issue
Block a user