Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
147 commits
Select commit Hold shift + click to select a range
ccacfb4
Make `Scriptable` and `VarScope` separate descendants of `PropHolder`.
aardvark179 Dec 31, 2025
6ad83c0
Remove old `NativeWith` implementation.
aardvark179 Jan 16, 2026
0b0b3c9
General tidy up.
aardvark179 May 4, 2026
7b91f56
Fix up after rebase.
aardvark179 May 11, 2026
2da0fd9
Tidy up serial version ids.
aardvark179 Apr 29, 2026
8b36549
Convert `BaseFunction` to descriptor.
aardvark179 Feb 2, 2026
998e1d5
Convert `NativeString` to descriptors.
aardvark179 Jan 15, 2026
42999fc
Convert `NativeNumber` to descriptors.
aardvark179 Jan 15, 2026
2dc6c61
Move `NativeMath` to descriptors.
aardvark179 Jan 16, 2026
f873f4c
Convert `NativeJSON` to descriptors.
aardvark179 Jan 16, 2026
183d61c
Convert `NativeScript` to descriptors.
aardvark179 Jan 16, 2026
1f06df0
Move `NativeIterator` to be based on descriptors.
aardvark179 Jan 19, 2026
5cb7c60
Convert `NativeGlobal` to descriptor.
aardvark179 Jan 21, 2026
b665488
Convert error initialisation to descriptors.
aardvark179 Jan 21, 2026
25974c9
Global fixup.
aardvark179 Feb 6, 2026
d67e7ba
Convert `ArrayBuffer` to descriptors.
aardvark179 Jan 27, 2026
9dded0c
Move typed array to descriptor.
aardvark179 Jan 28, 2026
b5f51bb
Update test 262 properties.
aardvark179 Feb 3, 2026
71f1a61
Move `NativeDataView` to descriptors.
aardvark179 Jan 28, 2026
a7c21d6
Removing unused methods
aardvark179 Jan 29, 2026
32ed6da
Convert `NativeMap` to descriptor.
aardvark179 Jan 29, 2026
6b62e7f
Move `NativeSet` to descriptors.
aardvark179 Jan 29, 2026
4eca668
Move `NativePromise` to descriptors.
aardvark179 Jan 29, 2026
0cf8506
Move `NativeWeakMap` to descriptor.
aardvark179 Jan 29, 2026
dd33552
Move `NativeWeakSet` to descriptors.
aardvark179 Jan 29, 2026
da490f1
Convert `NativeBigInt` to descriptor.
aardvark179 Jan 30, 2026
e4863b6
Convert `NativeProxy` to descriptor.
aardvark179 Jan 30, 2026
e5fc1dc
Convert `NativeReflect` to descriptors.
aardvark179 Jan 30, 2026
e2c57cf
Convert `NativeContinuation` to descriptor.
aardvark179 Feb 4, 2026
96342db
Convert `NativeGenerator` to descriptor.
aardvark179 Feb 4, 2026
bcdc2c7
Spotless.
aardvark179 Feb 18, 2026
d7fd202
Convert `NativeCallSite` to descriptors.
aardvark179 Feb 26, 2026
b6dfd76
Convert `ES6Iteratorz` to descriptors.
aardvark179 Feb 4, 2026
04c0369
Update 262 properties.
aardvark179 Mar 19, 2026
26ce578
Convert `thisObj` to be `Object` not `Scriptable`.
aardvark179 Feb 12, 2026
95580c6
Update test 262 properties.
aardvark179 Mar 11, 2026
cbe4689
Implement runtime semantics of new target.
aardvark179 Feb 12, 2026
373f04e
Expose `new.target` in the language.
aardvark179 Mar 3, 2026
3d36175
Enable `new.target` in 262 tests.
aardvark179 Mar 11, 2026
e49cb3f
Fix new.target binding in arrow functions.
aardvark179 May 7, 2026
e338875
Update 262 properties.
aardvark179 May 7, 2026
ed7dd79
Expose $262 in shell for ease of exploratory testing.
aardvark179 Feb 19, 2026
1c97bf4
Refactor away from `WithScope` for catching exceptions.
aardvark179 Mar 2, 2026
9b6457a
Update 262 properties.
aardvark179 Mar 11, 2026
d10a74f
Fix up scoping in the compiler.
aardvark179 Mar 13, 2026
6e46856
Update test 262 properties.
aardvark179 Mar 17, 2026
c1fa7b8
Improve spec compliance with strict mode block function declarations.
aardvark179 Mar 31, 2026
e01c3ce
Update 262 properties.
aardvark179 Mar 31, 2026
f66d045
Separate out legacy behaviour for symbol definitions.
aardvark179 Apr 1, 2026
7409051
Add scope tests and some fixup round moving symbols between scopes.
aardvark179 May 5, 2026
a17722a
Fix various destructuring issues.
aardvark179 Mar 12, 2026
8dbea45
Update 262 properties.
aardvark179 Mar 12, 2026
946eff1
Add support for `async` to 262 test runner.
aardvark179 Mar 6, 2026
8f84585
Initial async parsing support.
aardvark179 Mar 4, 2026
5c564bb
Initial 262 properties update.
aardvark179 Mar 4, 2026
19b5e73
Enable `async-function`s in 262 tests and update properties.
aardvark179 Mar 4, 2026
9796945
Await proof of concept implementation.
aardvark179 Mar 6, 2026
0d7aab9
Update 262 properties.
aardvark179 Mar 12, 2026
e61ac44
Add disallow default arguments for rest parameters.
aardvark179 Apr 12, 2026
165a162
Update 262 properties.
aardvark179 Apr 12, 2026
d4199ef
Refactor `BodyCodeGen` for some sanity.
aardvark179 Apr 21, 2026
2d907db
Fix finally handling in subsidiary methods.
aardvark179 Apr 22, 2026
64f3d0e
Start to improve iterator stuff.
aardvark179 Apr 22, 2026
a5c3408
Implement a bunch of iterator methods.
aardvark179 Apr 22, 2026
ca0395d
Fix iterator constructor prototype.
aardvark179 Apr 23, 2026
69e696f
Fix some array elision cases in destructuring.
aardvark179 Apr 13, 2026
06cc685
Fix some array destructuring tests.
aardvark179 Apr 13, 2026
587bd33
Destructuring fix WIP.
aardvark179 Apr 16, 2026
675d5bb
Better object handling.
aardvark179 Apr 16, 2026
014c378
Async iterator support.
aardvark179 Apr 17, 2026
ea0ab9b
Async generator support.
aardvark179 Apr 17, 2026
a2e24ca
Refactor literals onto function descriptors.
aardvark179 Apr 17, 2026
ec33de6
Fix order of destructuring and returning iterator in generators.
aardvark179 Apr 20, 2026
e875eb7
Fix object coercion on iterator done.
aardvark179 Apr 20, 2026
e9f59ad
Handle abrupt iterator close.
aardvark179 Apr 22, 2026
c8fa600
Fixed some bugs in abrupt iterator closure.
aardvark179 Apr 22, 2026
c405870
Spotless!
aardvark179 Apr 30, 2026
4151943
More fixes.
aardvark179 Apr 22, 2026
f5db92b
Update test 262 properties.
aardvark179 Apr 30, 2026
47304b9
Fix iterator helpers.
aardvark179 May 1, 2026
fc29d89
Update 262 properties.
aardvark179 May 1, 2026
b47d8cb
Small fixes to function name handling.
aardvark179 Apr 13, 2026
426066e
Update 262 properties.
aardvark179 May 1, 2026
4dc57b3
Fix names for arrow functions in assignments.
aardvark179 Apr 20, 2026
0be15a8
Update 262 properties.
aardvark179 May 1, 2026
92bb00d
Destructuring fixes.
aardvark179 Apr 23, 2026
86ecb7e
Update 262 properties.
aardvark179 May 1, 2026
bdbbaff
Fix class comp. bugs. Clearly other stack calc issues, but this works.
aardvark179 Apr 22, 2026
6e93c58
Updte 262 properties.
aardvark179 May 1, 2026
0fa774f
Revert "Fixed some bugs in abrupt iterator closure."
aardvark179 May 2, 2026
ffa4326
Fix try finally in the interpreter.
aardvark179 May 4, 2026
e63a512
Close to fixing the compiler.
aardvark179 May 6, 2026
e4036bc
Spotless, and refactor JSR to fewer places.
aardvark179 May 6, 2026
6fef247
Create copy of a tree, because finally handling is hard.
aardvark179 May 6, 2026
46a4b93
Closer to fully working finally cases.
aardvark179 May 7, 2026
3d55533
Add diagnostic output for exception blocks in bytecode.
aardvark179 May 7, 2026
f8d023e
Fix where we generate copies of the finally block.
aardvark179 May 7, 2026
0921fd8
Update 262 properties.
aardvark179 May 7, 2026
bfdf76b
Add a test for cloning nodes trees.
aardvark179 May 7, 2026
5ed5e67
Fix 262 properties.
aardvark179 May 8, 2026
7055a9e
Small fixes round async and async generator prototypes.
aardvark179 May 8, 2026
e2bb96e
Update 262 properties.
aardvark179 May 8, 2026
bea7db0
Another prototype fix.
aardvark179 May 8, 2026
453c9db
Update 262 properties.
aardvark179 May 8, 2026
08af5e8
Fix compiled async arrow function activations.
aardvark179 May 9, 2026
2329fad
Update 262 properties.
aardvark179 May 9, 2026
e43ed74
Only assign savedHomeObject local if it hasn't already been created.
aardvark179 May 9, 2026
95a9a49
Update 262 properties.
aardvark179 May 9, 2026
961a1ae
Prefer async iterator for async generator yield star.
aardvark179 Apr 24, 2026
d6c559b
Update 262 properties.
aardvark179 May 9, 2026
5301897
Initial class support.
aardvark179 Apr 8, 2026
5bc70c5
Make classes print the right thing for `toString()`.
aardvark179 Apr 9, 2026
a71f882
Initial support for methods.
aardvark179 Apr 9, 2026
a1a8b0a
Enable class tests in 262 tests.
aardvark179 Apr 8, 2026
40914be
Initial support for static methods.
aardvark179 Apr 9, 2026
8b0eead
Start to add fields.
aardvark179 Apr 10, 2026
1289f70
Support calculated field name.
aardvark179 Apr 10, 2026
9dadc49
Support for static fields.
aardvark179 Apr 10, 2026
ba8a5e2
Fix parsing of generator methods.
aardvark179 Apr 12, 2026
9380e16
Suppress inaccurate strict mode side effects warning.
aardvark179 Apr 14, 2026
f8cff05
Fix how properties are created for static members.
aardvark179 Apr 14, 2026
5897815
Some support for private fields.
aardvark179 Apr 18, 2026
d1b4693
More static fields fixes.
aardvark179 Apr 18, 2026
7c5cf0e
More fixes.
aardvark179 Apr 19, 2026
a19c49c
Start moving key calculation to class declaration time.
aardvark179 Apr 20, 2026
a709001
Fix issues round class initialisation and private fields.
aardvark179 Apr 20, 2026
c7c8253
Fix for some forbidden names.
aardvark179 Apr 20, 2026
fa77129
Fix some super behaviour.
aardvark179 Apr 23, 2026
7a3aa05
Fix parsing of method names.
aardvark179 Apr 23, 2026
da608df
Work on getters and setters for classes.
aardvark179 Apr 23, 2026
cb3886e
Fix to allow `static constructor()` method.
aardvark179 Apr 23, 2026
e059841
Fix broken test.
aardvark179 Apr 23, 2026
f5df4aa
Private getters and setters.
aardvark179 Apr 23, 2026
6f79d21
Support computed getter and setter names.
aardvark179 Apr 24, 2026
d3945eb
Change the type name.
aardvark179 Apr 28, 2026
4ef0be1
Refactoring fields WIP.
aardvark179 Apr 27, 2026
f7f2efc
Enable public and private field tests.
aardvark179 May 9, 2026
5062449
Small refactor to fix stack issues in generators.
aardvark179 Apr 26, 2026
63b3277
Update 262 properties.
aardvark179 May 9, 2026
4abbccd
Fix parsing of numerical getters and setters.
aardvark179 May 9, 2026
b0d463f
Update 262 properties.
aardvark179 May 9, 2026
b73854b
Fix parsing issues round generators.
aardvark179 May 11, 2026
23fea88
Add debug function to print java stack.
aardvark179 May 11, 2026
76a1584
Fix generator next caching and delegation.
aardvark179 May 11, 2026
2483a28
Async generator fixes.
aardvark179 May 11, 2026
479064a
Another corner case fix.
aardvark179 May 11, 2026
e549e6c
Update 262 properties.
aardvark179 May 11, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -334,12 +334,11 @@ public Object dumbLambdaClassMethods(DumbLambdaState state) {

private static class DumbLambdaClass extends ScriptableObject {

private static Object noop(Context cx, VarScope scope, Scriptable thisObj, Object[] args) {
private static Object noop(Context cx, VarScope scope, Object thisObj, Object[] args) {
return Undefined.instance;
}

private static Object setValue(
Context cx, VarScope scope, Scriptable thisObj, Object[] args) {
private static Object setValue(Context cx, VarScope scope, Object thisObj, Object[] args) {
if (args.length < 1) {
throw ScriptRuntime.throwError(cx, scope, "Not enough args");
}
Expand All @@ -349,8 +348,7 @@ private static Object setValue(
return Undefined.instance;
}

private static Object getValue(
Context cx, VarScope scope, Scriptable thisObj, Object[] args) {
private static Object getValue(Context cx, VarScope scope, Object thisObj, Object[] args) {
DumbLambdaClass self =
LambdaConstructor.convertThisObject(thisObj, DumbLambdaClass.class);
return self.value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import javax.script.ScriptContext;
import org.mozilla.javascript.Context;
import org.mozilla.javascript.ScriptRuntime;
import org.mozilla.javascript.Scriptable;
import org.mozilla.javascript.ScriptableObject;
import org.mozilla.javascript.TopLevel;
import org.mozilla.javascript.Undefined;
Expand Down Expand Up @@ -48,7 +47,7 @@ void register(Context cx, TopLevel scope, ScriptContext sc) {
ScriptableObject.DONTENUM | ScriptableObject.READONLY);
}

private static Object print(Context cx, VarScope scope, Scriptable thisObj, Object[] args) {
private static Object print(Context cx, VarScope scope, Object thisObj, Object[] args) {
try {
Builtins self = getSelf(scope);
for (Object arg : args) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -980,7 +980,7 @@ public static class StackFrame implements DebugFrame {
private VarScope scope;

/** The 'this' object. */
private Scriptable thisObj;
private Object thisObj;

/** Whether this frame represents a function (vs a top-level script). */
private boolean isFunction;
Expand All @@ -1006,7 +1006,7 @@ private StackFrame(Context cx, Dim dim, FunctionSource fsource, boolean isFuncti

/** Called when the stack frame is entered. */
@Override
public void onEnter(Context cx, VarScope scope, Scriptable thisObj, Object[] args) {
public void onEnter(Context cx, VarScope scope, Object thisObj, Object[] args) {
contextData.pushFrame(this);
this.scope = scope;
this.thisObj = thisObj;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ public class Global extends ImporterTopLevel {
"load",
"loadClass",
"print",
"printJavaStack",
"quit",
"readline",
"readFile",
Expand Down Expand Up @@ -155,6 +156,10 @@ public void init(Context cx) {
history = (NativeArray) cx.newArray(this, 0);
defineProperty("history", history, ScriptableObject.DONTENUM);

// Initialize Test262 support
Test262 proto262 = Test262.init(cx, this, Test262.RealmMode.STANDARD);
Test262.install(this, proto262, Test262.RealmMode.STANDARD);

initialized = true;
}

Expand Down Expand Up @@ -221,6 +226,16 @@ public static Object print(Context cx, Scriptable thisObj, Object[] args, Functi
return doPrint(args, funObj, true);
}

public static void printJavaStack(Context cx, Scriptable thisObj, Object[] args, Function funObj) {
Console c = getInstance(funObj).getConsole();
var stack = new Error().getStackTrace();
for (int i = 0; i < stack.length; i++) {
String s = stack[i].toString();
c.println(s);
}
c.println();
}

/** Print just as in "print," but without the trailing newline. */
public static Object write(Context cx, Scriptable thisObj, Object[] args, Function funObj) {
return doPrint(args, funObj, false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import org.mozilla.javascript.Context;
import org.mozilla.javascript.GeneratedClassLoader;
import org.mozilla.javascript.Script;
import org.mozilla.javascript.Scriptable;
import org.mozilla.javascript.VarScope;

public class JavaPolicySecurity extends SecurityProxy {
Expand Down Expand Up @@ -205,7 +204,7 @@ public Object callWithDomain(
Context cx,
Callable callable,
VarScope scope,
Scriptable thisObj,
Object thisObj,
Object[] args) {
return doAction(securityDomain, () -> callable.call(cx, scope, thisObj, args));
}
Expand All @@ -216,7 +215,7 @@ public Object callWithDomain(
Context cx,
Script script,
VarScope scope,
Scriptable thisObj,
Object thisObj,
Object[] args) {
return doAction(securityDomain, () -> script.exec(cx, scope, thisObj));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

package org.mozilla.javascript.tools.shell;

import org.mozilla.javascript.Context;
import org.mozilla.javascript.ScopeObject;
import org.mozilla.javascript.ScriptRuntime;
import org.mozilla.javascript.Scriptable;
import org.mozilla.javascript.ScriptableObject;
import org.mozilla.javascript.SymbolKey;
import org.mozilla.javascript.TopLevel;
import org.mozilla.javascript.Undefined;
import org.mozilla.javascript.VarScope;
import org.mozilla.javascript.typedarrays.NativeArrayBuffer;

/**
* Implements the $262 object required by the Test262 ECMAScript conformance test suite.
*
* <p>This class provides the host-defined functions specified by Test262 for testing ECMAScript
* implementations. It supports creating new realms, evaluating scripts, and accessing global
* objects.
*
* @see <a href="https://github.com/tc39/test262/blob/main/INTERPRETING.md#host-defined-functions">
* Test262 Host-Defined Functions</a>
*/
public class Test262 extends ScriptableObject {

/** Enum to control how realms are initialized. */
public enum RealmMode {
/** Uses initSafeStandardObjects - restricts Java access for sandboxing (used in tests) */
SAFE,
/** Uses initStandardObjects - full access to Java integration (used in shell) */
STANDARD
}

private RealmMode realmMode;

public Test262() {
super();
}

Test262(VarScope scope, Scriptable prototype, RealmMode mode) {
super(scope, prototype);
this.realmMode = mode;
}

/**
* Initialize the $262 prototype object with all Test262 host-defined functions.
*
* @param cx the current Context
* @param scope the scope to install the prototype in
* @param mode the realm mode (SAFE for tests, STANDARD for shell)
* @return the initialized $262 prototype
*/
public static Test262 init(Context cx, VarScope scope, RealmMode mode) {
Test262 proto = new Test262();
proto.realmMode = mode;
proto.setPrototype(getObjectPrototype(scope));
proto.setParentScope(scope);

proto.defineProperty(scope, "gc", 0, Test262::gc);
proto.defineProperty(scope, "createRealm", 0, Test262::createRealm);
proto.defineProperty(scope, "evalScript", 1, Test262::evalScript);
proto.defineProperty(scope, "detachArrayBuffer", 0, Test262::detachArrayBuffer);

proto.defineProperty(cx, scope, "global", Test262::getGlobal, null, DONTENUM | READONLY);
proto.defineProperty(cx, scope, "agent", Test262::getAgent, null, DONTENUM | READONLY);

proto.defineProperty(SymbolKey.TO_STRING_TAG, "__262__", DONTENUM | READONLY);

ScriptableObject.defineProperty(scope, "__262__", proto, DONTENUM);
return proto;
}

/**
* Install a $262 instance into a scope.
*
* @param scope the scope to install into
* @param parentScope the parent scope for the $262 instance
* @param mode the realm mode
* @return the installed $262 instance
*/
public static Test262 install(ScopeObject scope, Scriptable parentScope, RealmMode mode) {
Test262 instance = new Test262(scope, parentScope, mode);

scope.put("$262", scope, instance);
scope.setAttributes("$262", ScriptableObject.DONTENUM);

return instance;
}

private static Object gc(Context cx, VarScope scope, Object thisObj, Object[] args) {
System.gc();
return Undefined.instance;
}

public static Object evalScript(Context cx, VarScope scope, Object thisObj, Object[] args) {
if (args.length == 0) {
throw ScriptRuntime.throwError(cx, scope, "not enough args");
}
String source = Context.toString(args[0]);
return cx.evaluateString(scope, source, "<evalScript>", 1, null);
}

public static Object getGlobal(Scriptable scriptable) {
return ((TopLevel) scriptable.getParentScope()).getGlobalThis();
}

public static Test262 createRealm(Context cx, VarScope scope, Object thisObj, Object[] args) {
// Get the realm mode from the parent $262 instance
Test262 parent = (Test262) ScriptRuntime.toObject(scope, thisObj);
RealmMode mode = parent.realmMode;

// Create realm based on mode
TopLevel realm;
if (mode == RealmMode.SAFE) {
realm = cx.initSafeStandardObjects(new TopLevel());
} else {
realm = cx.initStandardObjects(new TopLevel());
}

return install(realm, ScriptRuntime.toObject(realm, thisObj).getPrototype(), mode);
}

public static Object detachArrayBuffer(
Context cx, VarScope scope, Object thisObj, Object[] args) {
Scriptable buf = ScriptRuntime.toObject(scope, args[0]);
if (buf instanceof NativeArrayBuffer) {
((NativeArrayBuffer) buf).detach();
}
return Undefined.instance;
}

public static Object getAgent(Scriptable scriptable) {
throw new UnsupportedOperationException("$262.agent property not yet implemented");
}

@Override
public String getClassName() {
return "__262__";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import org.mozilla.javascript.Function;
import org.mozilla.javascript.LambdaFunction;
import org.mozilla.javascript.ScriptRuntime;
import org.mozilla.javascript.Scriptable;
import org.mozilla.javascript.ScriptableObject;
import org.mozilla.javascript.Undefined;
import org.mozilla.javascript.VarScope;
Expand All @@ -29,19 +28,14 @@ public class Timers {
public void install(VarScope scope) {
LambdaFunction setTimeout =
new LambdaFunction(
scope,
"setTimeout",
1,
(Context lcx, VarScope lscope, Scriptable thisObj, Object[] args) ->
setTimeout(args));
scope, "setTimeout", 1, (lcx, lscope, thisObj, args) -> setTimeout(args));
ScriptableObject.defineProperty(scope, "setTimeout", setTimeout, ScriptableObject.DONTENUM);
LambdaFunction clearTimeout =
new LambdaFunction(
scope,
"clearTimeout",
1,
(Context lcx, VarScope lscope, Scriptable thisObj, Object[] args) ->
clearTimeout(args));
(lcx, lscope, thisObj, args) -> clearTimeout(args));
ScriptableObject.defineProperty(
scope, "clearTimeout", clearTimeout, ScriptableObject.DONTENUM);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public final class XMLLibImpl extends XMLLib implements Serializable {
// EXPERIMENTAL Java interface
//

private static final long serialVersionUID = 1L;
private static final long serialVersionUID = -6301237868232033480L;

/** This experimental interface is undocumented. */
public static org.w3c.dom.Node toDomNode(Object xmlObject) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,7 @@ private XMLList getPropertyList(XMLName name) {
}

private Object applyOrCall(
boolean isApply, Context cx, VarScope scope, Scriptable thisObj, Object[] args) {
boolean isApply, Context cx, VarScope scope, Object thisObj, Object[] args) {
String methodName = isApply ? "apply" : "call";
if (!(thisObj instanceof XMLList) || ((XMLList) thisObj).targetProperty == null)
throw ScriptRuntime.typeErrorById("msg.isnt.function", methodName);
Expand Down Expand Up @@ -797,7 +797,7 @@ public Scriptable getExtraMethodSource(Context cx) {
}

@Override
public Object call(Context cx, VarScope scope, Scriptable thisObj, Object[] args) {
public Object call(Context cx, VarScope scope, Object thisObj, Object[] args) {
// This XMLList is being called as a Function.
// Let's find the real Function object.
if (targetProperty == null) throw ScriptRuntime.notFunctionError(this);
Expand All @@ -812,7 +812,7 @@ public Object call(Context cx, VarScope scope, Scriptable thisObj, Object[] args
throw ScriptRuntime.typeErrorById("msg.incompat.call", methodName);
}
Object func = null;
Scriptable sobj = thisObj;
Scriptable sobj = ScriptRuntime.toObject(getDeclarationScope(), thisObj);

while (sobj instanceof XMLObject) {
XMLObject xmlObject = (XMLObject) sobj;
Expand All @@ -839,4 +839,9 @@ public Object call(Context cx, VarScope scope, Scriptable thisObj, Object[] args
public Scriptable construct(Context cx, VarScope scope, Object[] args) {
throw ScriptRuntime.typeErrorById("msg.not.ctor", "XMLList");
}

@Override
public Scriptable construct(Context cx, Object nt, VarScope s, Object thisObj, Object[] args) {
throw ScriptRuntime.typeErrorById("msg.not.ctor", "XMLList");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import org.w3c.dom.UserDataHandler;

class XmlNode implements Serializable {
private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 7498300745525888082L;

private static final String XML_NAMESPACES_NAMESPACE_URI = "http://www.w3.org/2000/xmlns/";

Expand Down
Loading