Skip to content

Commit 9ce9445

Browse files
committed
add context parameter to the new AbstractEcmaObjectOperations methods
1 parent 46f0fb5 commit 9ce9445

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

rhino/src/main/java/org/mozilla/javascript/AbstractEcmaObjectOperations.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -358,8 +358,9 @@ static long lengthOfArrayLike(Context cx, Scriptable o) {
358358
* <p>https://262.ecma-international.org/12.0/#sec-iscompatiblepropertydescriptor
359359
*/
360360
static boolean isCompatiblePropertyDescriptor(
361-
boolean extensible, ScriptableObject desc, ScriptableObject current) {
361+
Context cx, boolean extensible, ScriptableObject desc, ScriptableObject current) {
362362
return validateAndApplyPropertyDescriptor(
363+
cx,
363364
Undefined.SCRIPTABLE_UNDEFINED,
364365
Undefined.SCRIPTABLE_UNDEFINED,
365366
extensible,
@@ -373,6 +374,7 @@ static boolean isCompatiblePropertyDescriptor(
373374
* <p>https://262.ecma-international.org/12.0/#sec-validateandapplypropertydescriptor
374375
*/
375376
static boolean validateAndApplyPropertyDescriptor(
377+
Context cx,
376378
Scriptable o,
377379
Scriptable p,
378380
boolean extensible,
@@ -469,7 +471,7 @@ static boolean validateAndApplyPropertyDescriptor(
469471
*
470472
* <p>https://262.ecma-international.org/12.0/#sec-isconstructor
471473
*/
472-
static boolean isConstructor(Object argument) {
474+
static boolean isConstructor(Context cx, Object argument) {
473475
/*
474476
The abstract operation IsConstructor takes argument argument (an ECMAScript language value).
475477
It determines if argument is a function object with a [[Construct]] internal method.

rhino/src/main/java/org/mozilla/javascript/NativeProxy.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1036,7 +1036,7 @@ public boolean defineOwnProperty(Context cx, Object id, ScriptableObject desc) {
10361036
}
10371037
} else {
10381038
if (!AbstractEcmaObjectOperations.isCompatiblePropertyDescriptor(
1039-
extensibleTarget, desc, targetDesc)) {
1039+
cx, extensibleTarget, desc, targetDesc)) {
10401040
throw ScriptRuntime.typeError(
10411041
"proxy can't define an incompatible property descriptor");
10421042
}

rhino/src/main/java/org/mozilla/javascript/NativeReflect.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ private static Scriptable construct(
142142
Integer.toString(args.length));
143143
}
144144

145-
if (!AbstractEcmaObjectOperations.isConstructor(args[0])) {
145+
if (!AbstractEcmaObjectOperations.isConstructor(cx, args[0])) {
146146
throw ScriptRuntime.typeErrorById("msg.not.ctor", ScriptRuntime.typeof(args[0]));
147147
}
148148

@@ -151,7 +151,7 @@ private static Scriptable construct(
151151
return ctor.construct(cx, scope, ScriptRuntime.emptyArgs);
152152
}
153153

154-
if (args.length > 2 && !AbstractEcmaObjectOperations.isConstructor(args[2])) {
154+
if (args.length > 2 && !AbstractEcmaObjectOperations.isConstructor(cx, args[2])) {
155155
throw ScriptRuntime.typeErrorById("msg.not.ctor", ScriptRuntime.typeof(args[2]));
156156
}
157157

0 commit comments

Comments
 (0)