Skip to content

Commit d43cbd7

Browse files
committed
fix apply() argumentsList not being Array
1 parent 7019ec0 commit d43cbd7

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

lib/node/node-wsh.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,10 @@ export class WindowsScriptingHost extends EventEmitter {
6161
return undefined;
6262
},
6363

64-
apply( target, thisArg, argumentList) {
64+
apply( target, thisArg, argumentsList) {
6565
const encodedTarget = this.wsh.#encode( target.proxy);
6666
const encodedThisArg = this.wsh.#encode( thisArg);
67-
const encodedArgumentList = this.wsh.#encode( argumentList);
67+
const encodedArgumentList = this.wsh.#encode( [ ...argumentsList]); // argumentsList may not be instanceof Array
6868
const output = JSON.parse( this.wsh.#syncline.exchange( JSON.stringify( [ 'apply', encodedTarget, encodedThisArg, encodedArgumentList])));
6969
switch( output[ 0]) {
7070
case 'value': return this.wsh.#decode( output[ 1]);
@@ -73,9 +73,9 @@ export class WindowsScriptingHost extends EventEmitter {
7373
}
7474
},
7575

76-
construct( target, argumentList) {
76+
construct( target, argumentsList) {
7777
const encodedTarget = this.wsh.#encode( target.proxy);
78-
const encodedArgumentList = this.wsh.#encode( argumentList);
78+
const encodedArgumentList = this.wsh.#encode( [ ...argumentsList]); // argumentsList may not be instanceof Array
7979
const output = JSON.parse( this.wsh.#syncline.exchange( JSON.stringify( [ 'construct', encodedTarget, encodedArgumentList])));
8080
switch( output[ 0]) {
8181
case 'value': return this.wsh.#decode( output[ 1]);

0 commit comments

Comments
 (0)