зеркало из https://github.com/mozilla/rhino.git
Update references from deprecated to new methods.
ScriptableObject.getProperty methods have been replaced by Scriptable.getProperty. Also remove redundant super interface Scriptable from classes which implement SymbolScriptable.
This commit is contained in:
Родитель
872049aaae
Коммит
519cb58d71
|
@ -7,7 +7,6 @@ import org.mozilla.javascript.Context;
|
||||||
import org.mozilla.javascript.Function;
|
import org.mozilla.javascript.Function;
|
||||||
import org.mozilla.javascript.ScriptRuntime;
|
import org.mozilla.javascript.ScriptRuntime;
|
||||||
import org.mozilla.javascript.Scriptable;
|
import org.mozilla.javascript.Scriptable;
|
||||||
import org.mozilla.javascript.ScriptableObject;
|
|
||||||
import org.openjdk.jmh.annotations.*;
|
import org.openjdk.jmh.annotations.*;
|
||||||
|
|
||||||
@OutputTimeUnit(TimeUnit.NANOSECONDS)
|
@OutputTimeUnit(TimeUnit.NANOSECONDS)
|
||||||
|
@ -43,21 +42,21 @@ public class MathBenchmark {
|
||||||
try (FileReader rdr = new FileReader("testsrc/benchmarks/micro/math-benchmarks.js")) {
|
try (FileReader rdr = new FileReader("testsrc/benchmarks/micro/math-benchmarks.js")) {
|
||||||
cx.evaluateReader(scope, rdr, "math-benchmarks.js", 1, null);
|
cx.evaluateReader(scope, rdr, "math-benchmarks.js", 1, null);
|
||||||
}
|
}
|
||||||
addConstantInts = (Function) ScriptableObject.getProperty(scope, "addConstantInts");
|
addConstantInts = (Function) Scriptable.getProperty(scope, "addConstantInts");
|
||||||
addIntAndConstant = (Function) ScriptableObject.getProperty(scope, "addIntAndConstant");
|
addIntAndConstant = (Function) Scriptable.getProperty(scope, "addIntAndConstant");
|
||||||
addTwoInts = (Function) ScriptableObject.getProperty(scope, "addTwoInts");
|
addTwoInts = (Function) Scriptable.getProperty(scope, "addTwoInts");
|
||||||
addConstantFloats = (Function) ScriptableObject.getProperty(scope, "addConstantFloats");
|
addConstantFloats = (Function) Scriptable.getProperty(scope, "addConstantFloats");
|
||||||
addTwoFloats = (Function) ScriptableObject.getProperty(scope, "addTwoFloats");
|
addTwoFloats = (Function) Scriptable.getProperty(scope, "addTwoFloats");
|
||||||
addStringsInLoop = (Function) ScriptableObject.getProperty(scope, "addStringsInLoop");
|
addStringsInLoop = (Function) Scriptable.getProperty(scope, "addStringsInLoop");
|
||||||
addMixedStrings = (Function) ScriptableObject.getProperty(scope, "addMixedStrings");
|
addMixedStrings = (Function) Scriptable.getProperty(scope, "addMixedStrings");
|
||||||
subtractInts = (Function) ScriptableObject.getProperty(scope, "subtractInts");
|
subtractInts = (Function) Scriptable.getProperty(scope, "subtractInts");
|
||||||
subtractFloats = (Function) ScriptableObject.getProperty(scope, "subtractFloats");
|
subtractFloats = (Function) Scriptable.getProperty(scope, "subtractFloats");
|
||||||
subtractTwoFloats = (Function) ScriptableObject.getProperty(scope, "subtractTwoFloats");
|
subtractTwoFloats = (Function) Scriptable.getProperty(scope, "subtractTwoFloats");
|
||||||
bitwiseAnd = (Function) ScriptableObject.getProperty(scope, "bitwiseAnd");
|
bitwiseAnd = (Function) Scriptable.getProperty(scope, "bitwiseAnd");
|
||||||
bitwiseOr = (Function) ScriptableObject.getProperty(scope, "bitwiseOr");
|
bitwiseOr = (Function) Scriptable.getProperty(scope, "bitwiseOr");
|
||||||
bitwiseLsh = (Function) ScriptableObject.getProperty(scope, "bitwiseLsh");
|
bitwiseLsh = (Function) Scriptable.getProperty(scope, "bitwiseLsh");
|
||||||
bitwiseRsh = (Function) ScriptableObject.getProperty(scope, "bitwiseRsh");
|
bitwiseRsh = (Function) Scriptable.getProperty(scope, "bitwiseRsh");
|
||||||
bitwiseSignedRsh = (Function) ScriptableObject.getProperty(scope, "bitwiseSignedRsh");
|
bitwiseSignedRsh = (Function) Scriptable.getProperty(scope, "bitwiseSignedRsh");
|
||||||
}
|
}
|
||||||
|
|
||||||
@TearDown(Level.Trial)
|
@TearDown(Level.Trial)
|
||||||
|
|
|
@ -7,7 +7,6 @@ import java.util.concurrent.TimeUnit;
|
||||||
import org.mozilla.javascript.Context;
|
import org.mozilla.javascript.Context;
|
||||||
import org.mozilla.javascript.Function;
|
import org.mozilla.javascript.Function;
|
||||||
import org.mozilla.javascript.Scriptable;
|
import org.mozilla.javascript.Scriptable;
|
||||||
import org.mozilla.javascript.ScriptableObject;
|
|
||||||
import org.mozilla.javascript.tools.shell.Global;
|
import org.mozilla.javascript.tools.shell.Global;
|
||||||
import org.openjdk.jmh.annotations.*;
|
import org.openjdk.jmh.annotations.*;
|
||||||
|
|
||||||
|
@ -72,7 +71,7 @@ public class ObjectBenchmark {
|
||||||
@OperationsPerInvocation(1000)
|
@OperationsPerInvocation(1000)
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public void createFields(FieldTestState state) {
|
public void createFields(FieldTestState state) {
|
||||||
Function create = (Function) ScriptableObject.getProperty(state.scope, "createObject");
|
Function create = (Function) Scriptable.getProperty(state.scope, "createObject");
|
||||||
create.call(state.cx, state.scope, null, new Object[] {count, state.strings, state.ints});
|
create.call(state.cx, state.scope, null, new Object[] {count, state.strings, state.ints});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,11 +79,11 @@ public class ObjectBenchmark {
|
||||||
@OperationsPerInvocation(1000)
|
@OperationsPerInvocation(1000)
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public void accessFields(FieldTestState state) {
|
public void accessFields(FieldTestState state) {
|
||||||
Function create = (Function) ScriptableObject.getProperty(state.scope, "createObject");
|
Function create = (Function) Scriptable.getProperty(state.scope, "createObject");
|
||||||
Object o =
|
Object o =
|
||||||
create.call(
|
create.call(
|
||||||
state.cx, state.scope, null, new Object[] {1, state.strings, state.ints});
|
state.cx, state.scope, null, new Object[] {1, state.strings, state.ints});
|
||||||
Function access = (Function) ScriptableObject.getProperty(state.scope, "accessObject");
|
Function access = (Function) Scriptable.getProperty(state.scope, "accessObject");
|
||||||
access.call(
|
access.call(
|
||||||
state.cx, state.scope, null, new Object[] {count, o, state.strings, state.ints});
|
state.cx, state.scope, null, new Object[] {count, o, state.strings, state.ints});
|
||||||
}
|
}
|
||||||
|
@ -93,11 +92,11 @@ public class ObjectBenchmark {
|
||||||
@OperationsPerInvocation(1000)
|
@OperationsPerInvocation(1000)
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public void iterateFields(FieldTestState state) {
|
public void iterateFields(FieldTestState state) {
|
||||||
Function create = (Function) ScriptableObject.getProperty(state.scope, "createObject");
|
Function create = (Function) Scriptable.getProperty(state.scope, "createObject");
|
||||||
Object o =
|
Object o =
|
||||||
create.call(
|
create.call(
|
||||||
state.cx, state.scope, null, new Object[] {1, state.strings, state.ints});
|
state.cx, state.scope, null, new Object[] {1, state.strings, state.ints});
|
||||||
Function iterate = (Function) ScriptableObject.getProperty(state.scope, "iterateObject");
|
Function iterate = (Function) Scriptable.getProperty(state.scope, "iterateObject");
|
||||||
iterate.call(state.cx, state.scope, null, new Object[] {count, o});
|
iterate.call(state.cx, state.scope, null, new Object[] {count, o});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,12 +104,11 @@ public class ObjectBenchmark {
|
||||||
@OperationsPerInvocation(1000)
|
@OperationsPerInvocation(1000)
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public void ownKeysFields(FieldTestState state) {
|
public void ownKeysFields(FieldTestState state) {
|
||||||
Function create = (Function) ScriptableObject.getProperty(state.scope, "createObject");
|
Function create = (Function) Scriptable.getProperty(state.scope, "createObject");
|
||||||
Object o =
|
Object o =
|
||||||
create.call(
|
create.call(
|
||||||
state.cx, state.scope, null, new Object[] {1, state.strings, state.ints});
|
state.cx, state.scope, null, new Object[] {1, state.strings, state.ints});
|
||||||
Function iterate =
|
Function iterate = (Function) Scriptable.getProperty(state.scope, "iterateOwnKeysObject");
|
||||||
(Function) ScriptableObject.getProperty(state.scope, "iterateOwnKeysObject");
|
|
||||||
iterate.call(state.cx, state.scope, null, new Object[] {count, o});
|
iterate.call(state.cx, state.scope, null, new Object[] {count, o});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,11 +116,11 @@ public class ObjectBenchmark {
|
||||||
@OperationsPerInvocation(1000)
|
@OperationsPerInvocation(1000)
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public void deleteFields(FieldTestState state) {
|
public void deleteFields(FieldTestState state) {
|
||||||
Function create = (Function) ScriptableObject.getProperty(state.scope, "createObject");
|
Function create = (Function) Scriptable.getProperty(state.scope, "createObject");
|
||||||
Object o =
|
Object o =
|
||||||
create.call(
|
create.call(
|
||||||
state.cx, state.scope, null, new Object[] {1, state.strings, state.ints});
|
state.cx, state.scope, null, new Object[] {1, state.strings, state.ints});
|
||||||
Function delete = (Function) ScriptableObject.getProperty(state.scope, "deleteObject");
|
Function delete = (Function) Scriptable.getProperty(state.scope, "deleteObject");
|
||||||
delete.call(
|
delete.call(
|
||||||
state.cx, state.scope, null, new Object[] {count, o, state.strings, state.ints});
|
state.cx, state.scope, null, new Object[] {count, o, state.strings, state.ints});
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,6 @@ import org.mozilla.javascript.Context;
|
||||||
import org.mozilla.javascript.Function;
|
import org.mozilla.javascript.Function;
|
||||||
import org.mozilla.javascript.ScriptRuntime;
|
import org.mozilla.javascript.ScriptRuntime;
|
||||||
import org.mozilla.javascript.Scriptable;
|
import org.mozilla.javascript.Scriptable;
|
||||||
import org.mozilla.javascript.ScriptableObject;
|
|
||||||
import org.openjdk.jmh.annotations.*;
|
import org.openjdk.jmh.annotations.*;
|
||||||
|
|
||||||
@OutputTimeUnit(TimeUnit.NANOSECONDS)
|
@OutputTimeUnit(TimeUnit.NANOSECONDS)
|
||||||
|
@ -35,11 +34,11 @@ public class PropertyBenchmark {
|
||||||
new FileReader("testsrc/benchmarks/micro/property-benchmarks.js")) {
|
new FileReader("testsrc/benchmarks/micro/property-benchmarks.js")) {
|
||||||
cx.evaluateReader(scope, rdr, "property-benchmarks.js", 1, null);
|
cx.evaluateReader(scope, rdr, "property-benchmarks.js", 1, null);
|
||||||
}
|
}
|
||||||
create = (Function) ScriptableObject.getProperty(scope, "createObject");
|
create = (Function) Scriptable.getProperty(scope, "createObject");
|
||||||
createFieldByField =
|
createFieldByField =
|
||||||
(Function) ScriptableObject.getProperty(scope, "createObjectFieldByField");
|
(Function) Scriptable.getProperty(scope, "createObjectFieldByField");
|
||||||
getName = (Function) ScriptableObject.getProperty(scope, "getName");
|
getName = (Function) Scriptable.getProperty(scope, "getName");
|
||||||
check = (Function) ScriptableObject.getProperty(scope, "check");
|
check = (Function) Scriptable.getProperty(scope, "check");
|
||||||
|
|
||||||
object = create.call(cx, scope, null, new Object[] {"testing"});
|
object = create.call(cx, scope, null, new Object[] {"testing"});
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,6 @@ import java.util.concurrent.TimeUnit;
|
||||||
import org.mozilla.javascript.Callable;
|
import org.mozilla.javascript.Callable;
|
||||||
import org.mozilla.javascript.Context;
|
import org.mozilla.javascript.Context;
|
||||||
import org.mozilla.javascript.Scriptable;
|
import org.mozilla.javascript.Scriptable;
|
||||||
import org.mozilla.javascript.ScriptableObject;
|
|
||||||
import org.openjdk.jmh.annotations.*;
|
import org.openjdk.jmh.annotations.*;
|
||||||
|
|
||||||
@OutputTimeUnit(TimeUnit.MICROSECONDS)
|
@OutputTimeUnit(TimeUnit.MICROSECONDS)
|
||||||
|
@ -18,7 +17,7 @@ public class V8Benchmark {
|
||||||
Scriptable scope;
|
Scriptable scope;
|
||||||
|
|
||||||
Callable getFunc(String name) {
|
Callable getFunc(String name) {
|
||||||
Object f = ScriptableObject.getProperty(scope, name);
|
Object f = Scriptable.getProperty(scope, name);
|
||||||
if (!(f instanceof Callable)) {
|
if (!(f instanceof Callable)) {
|
||||||
throw new RuntimeException("Benchmark function " + name + " not found");
|
throw new RuntimeException("Benchmark function " + name + " not found");
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
import org.mozilla.javascript.Context;
|
import org.mozilla.javascript.Context;
|
||||||
import org.mozilla.javascript.Function;
|
import org.mozilla.javascript.Function;
|
||||||
import org.mozilla.javascript.Scriptable;
|
import org.mozilla.javascript.Scriptable;
|
||||||
import org.mozilla.javascript.ScriptableObject;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Example of controlling the JavaScript execution engine.
|
* Example of controlling the JavaScript execution engine.
|
||||||
|
@ -57,7 +56,7 @@ public class Control {
|
||||||
System.out.println("obj.b[1] == " + b.get(1, b));
|
System.out.println("obj.b[1] == " + b.get(1, b));
|
||||||
|
|
||||||
// Should print {a:1, b:["x", "y"]}
|
// Should print {a:1, b:["x", "y"]}
|
||||||
Function fn = (Function) ScriptableObject.getProperty(obj, "toString");
|
Function fn = (Function) Scriptable.getProperty(obj, "toString");
|
||||||
System.out.println(fn.call(cx, scope, obj, new Object[0]));
|
System.out.println(fn.call(cx, scope, obj, new Object[0]));
|
||||||
} finally {
|
} finally {
|
||||||
Context.exit();
|
Context.exit();
|
||||||
|
|
|
@ -31,16 +31,16 @@ public class CounterTest {
|
||||||
|
|
||||||
Scriptable testCounter = cx.newObject(scope, "Counter");
|
Scriptable testCounter = cx.newObject(scope, "Counter");
|
||||||
|
|
||||||
Object count = ScriptableObject.getProperty(testCounter, "count");
|
Object count = Scriptable.getProperty(testCounter, "count");
|
||||||
System.out.println("count = " + count);
|
System.out.println("count = " + count);
|
||||||
|
|
||||||
count = ScriptableObject.getProperty(testCounter, "count");
|
count = Scriptable.getProperty(testCounter, "count");
|
||||||
System.out.println("count = " + count);
|
System.out.println("count = " + count);
|
||||||
|
|
||||||
ScriptableObject.callMethod(testCounter, "resetCount", new Object[0]);
|
ScriptableObject.callMethod(testCounter, "resetCount", new Object[0]);
|
||||||
System.out.println("resetCount");
|
System.out.println("resetCount");
|
||||||
|
|
||||||
count = ScriptableObject.getProperty(testCounter, "count");
|
count = Scriptable.getProperty(testCounter, "count");
|
||||||
System.out.println("count = " + count);
|
System.out.println("count = " + count);
|
||||||
} finally {
|
} finally {
|
||||||
Context.exit();
|
Context.exit();
|
||||||
|
|
|
@ -188,7 +188,7 @@ public class RhinoScriptEngine extends AbstractScriptEngine implements Compilabl
|
||||||
localThis = Context.toObject(thiz, scope);
|
localThis = Context.toObject(thiz, scope);
|
||||||
}
|
}
|
||||||
|
|
||||||
Object f = ScriptableObject.getProperty(localThis, name);
|
Object f = Scriptable.getProperty(localThis, name);
|
||||||
if (f == Scriptable.NOT_FOUND) {
|
if (f == Scriptable.NOT_FOUND) {
|
||||||
throw new NoSuchMethodException(name);
|
throw new NoSuchMethodException(name);
|
||||||
}
|
}
|
||||||
|
@ -306,7 +306,7 @@ public class RhinoScriptEngine extends AbstractScriptEngine implements Compilabl
|
||||||
if (m.getDeclaringClass() == Object.class) {
|
if (m.getDeclaringClass() == Object.class) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
Object methodObj = ScriptableObject.getProperty(scope, m.getName());
|
Object methodObj = Scriptable.getProperty(scope, m.getName());
|
||||||
if (!(methodObj instanceof Callable)) {
|
if (!(methodObj instanceof Callable)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -547,14 +547,14 @@ public class Dim {
|
||||||
} else if (name.equals("__parent__")) {
|
} else if (name.equals("__parent__")) {
|
||||||
result = scriptable.getParentScope();
|
result = scriptable.getParentScope();
|
||||||
} else {
|
} else {
|
||||||
result = ScriptableObject.getProperty(scriptable, name);
|
result = Scriptable.getProperty(scriptable, name);
|
||||||
if (result == ScriptableObject.NOT_FOUND) {
|
if (result == ScriptableObject.NOT_FOUND) {
|
||||||
result = Undefined.instance;
|
result = Undefined.instance;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
int index = ((Integer) id).intValue();
|
int index = ((Integer) id).intValue();
|
||||||
result = ScriptableObject.getProperty(scriptable, index);
|
result = Scriptable.getProperty(scriptable, index);
|
||||||
if (result == ScriptableObject.NOT_FOUND) {
|
if (result == ScriptableObject.NOT_FOUND) {
|
||||||
result = Undefined.instance;
|
result = Undefined.instance;
|
||||||
}
|
}
|
||||||
|
|
|
@ -363,16 +363,16 @@ public class Global extends ImporterTopLevel {
|
||||||
|
|
||||||
public String[] getPrompts(Context cx) {
|
public String[] getPrompts(Context cx) {
|
||||||
if (ScriptableObject.hasProperty(this, "prompts")) {
|
if (ScriptableObject.hasProperty(this, "prompts")) {
|
||||||
Object promptsJS = ScriptableObject.getProperty(this, "prompts");
|
Object promptsJS = Scriptable.getProperty(this, "prompts");
|
||||||
if (promptsJS instanceof Scriptable) {
|
if (promptsJS instanceof Scriptable) {
|
||||||
Scriptable s = (Scriptable) promptsJS;
|
Scriptable s = (Scriptable) promptsJS;
|
||||||
if (ScriptableObject.hasProperty(s, 0) && ScriptableObject.hasProperty(s, 1)) {
|
if (ScriptableObject.hasProperty(s, 0) && ScriptableObject.hasProperty(s, 1)) {
|
||||||
Object elem0 = ScriptableObject.getProperty(s, 0);
|
Object elem0 = Scriptable.getProperty(s, 0);
|
||||||
if (elem0 instanceof Function) {
|
if (elem0 instanceof Function) {
|
||||||
elem0 = ((Function) elem0).call(cx, this, s, new Object[0]);
|
elem0 = ((Function) elem0).call(cx, this, s, new Object[0]);
|
||||||
}
|
}
|
||||||
prompts[0] = Context.toString(elem0);
|
prompts[0] = Context.toString(elem0);
|
||||||
Object elem1 = ScriptableObject.getProperty(s, 1);
|
Object elem1 = Scriptable.getProperty(s, 1);
|
||||||
if (elem1 instanceof Function) {
|
if (elem1 instanceof Function) {
|
||||||
elem1 = ((Function) elem1).call(cx, this, s, new Object[0]);
|
elem1 = ((Function) elem1).call(cx, this, s, new Object[0]);
|
||||||
}
|
}
|
||||||
|
@ -616,7 +616,7 @@ public class Global extends ImporterTopLevel {
|
||||||
if (args[L - 1] instanceof Scriptable) {
|
if (args[L - 1] instanceof Scriptable) {
|
||||||
params = (Scriptable) args[L - 1];
|
params = (Scriptable) args[L - 1];
|
||||||
--L;
|
--L;
|
||||||
Object envObj = ScriptableObject.getProperty(params, "env");
|
Object envObj = Scriptable.getProperty(params, "env");
|
||||||
if (envObj != Scriptable.NOT_FOUND) {
|
if (envObj != Scriptable.NOT_FOUND) {
|
||||||
if (envObj == null) {
|
if (envObj == null) {
|
||||||
environment = new String[0];
|
environment = new String[0];
|
||||||
|
@ -632,11 +632,11 @@ public class Global extends ImporterTopLevel {
|
||||||
String key;
|
String key;
|
||||||
if (keyObj instanceof String) {
|
if (keyObj instanceof String) {
|
||||||
key = (String) keyObj;
|
key = (String) keyObj;
|
||||||
val = ScriptableObject.getProperty(envHash, key);
|
val = Scriptable.getProperty(envHash, key);
|
||||||
} else {
|
} else {
|
||||||
int ikey = ((Number) keyObj).intValue();
|
int ikey = ((Number) keyObj).intValue();
|
||||||
key = Integer.toString(ikey);
|
key = Integer.toString(ikey);
|
||||||
val = ScriptableObject.getProperty(envHash, ikey);
|
val = Scriptable.getProperty(envHash, ikey);
|
||||||
}
|
}
|
||||||
if (val == ScriptableObject.NOT_FOUND) {
|
if (val == ScriptableObject.NOT_FOUND) {
|
||||||
val = Undefined.instance;
|
val = Undefined.instance;
|
||||||
|
@ -645,16 +645,16 @@ public class Global extends ImporterTopLevel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Object wdObj = ScriptableObject.getProperty(params, "dir");
|
Object wdObj = Scriptable.getProperty(params, "dir");
|
||||||
if (wdObj != Scriptable.NOT_FOUND) {
|
if (wdObj != Scriptable.NOT_FOUND) {
|
||||||
wd = new File(ScriptRuntime.toString(wdObj));
|
wd = new File(ScriptRuntime.toString(wdObj));
|
||||||
}
|
}
|
||||||
|
|
||||||
Object inObj = ScriptableObject.getProperty(params, "input");
|
Object inObj = Scriptable.getProperty(params, "input");
|
||||||
if (inObj != Scriptable.NOT_FOUND) {
|
if (inObj != Scriptable.NOT_FOUND) {
|
||||||
in = toInputStream(inObj);
|
in = toInputStream(inObj);
|
||||||
}
|
}
|
||||||
outObj = ScriptableObject.getProperty(params, "output");
|
outObj = Scriptable.getProperty(params, "output");
|
||||||
if (outObj != Scriptable.NOT_FOUND) {
|
if (outObj != Scriptable.NOT_FOUND) {
|
||||||
out = toOutputStream(outObj);
|
out = toOutputStream(outObj);
|
||||||
if (out == null) {
|
if (out == null) {
|
||||||
|
@ -662,7 +662,7 @@ public class Global extends ImporterTopLevel {
|
||||||
out = outBytes;
|
out = outBytes;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
errObj = ScriptableObject.getProperty(params, "err");
|
errObj = Scriptable.getProperty(params, "err");
|
||||||
if (errObj != Scriptable.NOT_FOUND) {
|
if (errObj != Scriptable.NOT_FOUND) {
|
||||||
err = toOutputStream(errObj);
|
err = toOutputStream(errObj);
|
||||||
if (err == null) {
|
if (err == null) {
|
||||||
|
@ -670,7 +670,7 @@ public class Global extends ImporterTopLevel {
|
||||||
err = errBytes;
|
err = errBytes;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Object addArgsObj = ScriptableObject.getProperty(params, "args");
|
Object addArgsObj = Scriptable.getProperty(params, "args");
|
||||||
if (addArgsObj != Scriptable.NOT_FOUND) {
|
if (addArgsObj != Scriptable.NOT_FOUND) {
|
||||||
Scriptable s = Context.toObject(addArgsObj, getTopLevelScope(thisObj));
|
Scriptable s = Context.toObject(addArgsObj, getTopLevelScope(thisObj));
|
||||||
addArgs = cx.getElements(s);
|
addArgs = cx.getElements(s);
|
||||||
|
|
|
@ -648,7 +648,7 @@ public class Main {
|
||||||
Object result = unhandled.get(0);
|
Object result = unhandled.get(0);
|
||||||
String msg = "Unhandled rejected promise: " + Context.toString(result);
|
String msg = "Unhandled rejected promise: " + Context.toString(result);
|
||||||
if (result instanceof Scriptable) {
|
if (result instanceof Scriptable) {
|
||||||
Object stack = ScriptableObject.getProperty((Scriptable) result, "stack");
|
Object stack = Scriptable.getProperty((Scriptable) result, "stack");
|
||||||
if (stack != null && stack != Scriptable.NOT_FOUND) {
|
if (stack != null && stack != Scriptable.NOT_FOUND) {
|
||||||
msg += '\n' + Context.toString(stack);
|
msg += '\n' + Context.toString(stack);
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ class XMLCtor extends IdFunctionObject {
|
||||||
for (int i = 1; i <= MAX_INSTANCE_ID; ++i) {
|
for (int i = 1; i <= MAX_INSTANCE_ID; ++i) {
|
||||||
int id = super.getMaxInstanceId() + i;
|
int id = super.getMaxInstanceId() + i;
|
||||||
String name = getInstanceIdName(id);
|
String name = getInstanceIdName(id);
|
||||||
Object value = ScriptableObject.getProperty(source, name);
|
Object value = Scriptable.getProperty(source, name);
|
||||||
if (value == Scriptable.NOT_FOUND) {
|
if (value == Scriptable.NOT_FOUND) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,6 @@ import org.mozilla.javascript.Context;
|
||||||
import org.mozilla.javascript.Function;
|
import org.mozilla.javascript.Function;
|
||||||
import org.mozilla.javascript.ScriptRuntime;
|
import org.mozilla.javascript.ScriptRuntime;
|
||||||
import org.mozilla.javascript.Scriptable;
|
import org.mozilla.javascript.Scriptable;
|
||||||
import org.mozilla.javascript.ScriptableObject;
|
|
||||||
import org.mozilla.javascript.Undefined;
|
import org.mozilla.javascript.Undefined;
|
||||||
import org.mozilla.javascript.xml.XMLObject;
|
import org.mozilla.javascript.xml.XMLObject;
|
||||||
|
|
||||||
|
@ -772,7 +771,7 @@ class XMLList extends XMLObjectImpl implements Function {
|
||||||
if (sobj != null) {
|
if (sobj != null) {
|
||||||
thisObj = sobj;
|
thisObj = sobj;
|
||||||
if (!(sobj instanceof XMLObject)) {
|
if (!(sobj instanceof XMLObject)) {
|
||||||
func = ScriptableObject.getProperty(sobj, methodName);
|
func = Scriptable.getProperty(sobj, methodName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -189,7 +189,7 @@ public class AbstractEcmaObjectOperations {
|
||||||
7. If IsConstructor(S) is true, return S.
|
7. If IsConstructor(S) is true, return S.
|
||||||
8. Throw a TypeError exception.
|
8. Throw a TypeError exception.
|
||||||
*/
|
*/
|
||||||
Object constructor = ScriptableObject.getProperty(s, "constructor");
|
Object constructor = Scriptable.getProperty(s, "constructor");
|
||||||
if (constructor == Scriptable.NOT_FOUND || Undefined.isUndefined(constructor)) {
|
if (constructor == Scriptable.NOT_FOUND || Undefined.isUndefined(constructor)) {
|
||||||
return defaultConstructor;
|
return defaultConstructor;
|
||||||
}
|
}
|
||||||
|
@ -197,7 +197,7 @@ public class AbstractEcmaObjectOperations {
|
||||||
throw ScriptRuntime.typeErrorById(
|
throw ScriptRuntime.typeErrorById(
|
||||||
"msg.arg.not.object", ScriptRuntime.typeof(constructor));
|
"msg.arg.not.object", ScriptRuntime.typeof(constructor));
|
||||||
}
|
}
|
||||||
Object species = ScriptableObject.getProperty((Scriptable) constructor, SymbolKey.SPECIES);
|
Object species = Scriptable.getProperty((Scriptable) constructor, SymbolKey.SPECIES);
|
||||||
if (species == Scriptable.NOT_FOUND || species == null || Undefined.isUndefined(species)) {
|
if (species == Scriptable.NOT_FOUND || species == null || Undefined.isUndefined(species)) {
|
||||||
return defaultConstructor;
|
return defaultConstructor;
|
||||||
}
|
}
|
||||||
|
|
|
@ -372,12 +372,12 @@ final class Arguments extends IdScriptableObject {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Object newValue = getProperty(desc, "value");
|
Object newValue = Scriptable.getProperty(desc, "value");
|
||||||
if (newValue == NOT_FOUND) return;
|
if (newValue == NOT_FOUND) return;
|
||||||
|
|
||||||
replaceArg(index, newValue);
|
replaceArg(index, newValue);
|
||||||
|
|
||||||
if (isFalse(getProperty(desc, "writable"))) {
|
if (isFalse(Scriptable.getProperty(desc, "writable"))) {
|
||||||
removeArg(index);
|
removeArg(index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -177,9 +177,9 @@ public class ArrayLikeAbstractOperations {
|
||||||
// same as NativeArray::getElem, but without converting NOT_FOUND to undefined
|
// same as NativeArray::getElem, but without converting NOT_FOUND to undefined
|
||||||
static Object getRawElem(Scriptable target, long index) {
|
static Object getRawElem(Scriptable target, long index) {
|
||||||
if (index > Integer.MAX_VALUE) {
|
if (index > Integer.MAX_VALUE) {
|
||||||
return ScriptableObject.getProperty(target, Long.toString(index));
|
return Scriptable.getProperty(target, Long.toString(index));
|
||||||
}
|
}
|
||||||
return ScriptableObject.getProperty(target, (int) index);
|
return Scriptable.getProperty(target, (int) index);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static long toSliceIndex(double value, long length) {
|
public static long toSliceIndex(double value, long length) {
|
||||||
|
|
|
@ -47,7 +47,7 @@ public class BaseFunction extends IdScriptableObject implements Function {
|
||||||
obj.exportAsJSClass(MAX_PROTOTYPE_ID, scope, sealed);
|
obj.exportAsJSClass(MAX_PROTOTYPE_ID, scope, sealed);
|
||||||
// The "GeneratorFunction" name actually never appears in the global scope.
|
// The "GeneratorFunction" name actually never appears in the global scope.
|
||||||
// Return it here so it can be cached as a "builtin"
|
// Return it here so it can be cached as a "builtin"
|
||||||
return ScriptableObject.getProperty(scope, GENERATOR_FUNCTION_CLASS);
|
return Scriptable.getProperty(scope, GENERATOR_FUNCTION_CLASS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BaseFunction() {}
|
public BaseFunction() {}
|
||||||
|
@ -95,7 +95,7 @@ public class BaseFunction extends IdScriptableObject implements Function {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean hasInstance(Scriptable instance) {
|
public boolean hasInstance(Scriptable instance) {
|
||||||
Object protoProp = ScriptableObject.getProperty(this, "prototype");
|
Object protoProp = Scriptable.getProperty(this, "prototype");
|
||||||
if (protoProp instanceof Scriptable) {
|
if (protoProp instanceof Scriptable) {
|
||||||
return ScriptRuntime.jsDelegatesTo(instance, (Scriptable) protoProp);
|
return ScriptRuntime.jsDelegatesTo(instance, (Scriptable) protoProp);
|
||||||
}
|
}
|
||||||
|
|
|
@ -141,9 +141,7 @@ public final class ES6Generator extends IdScriptableObject {
|
||||||
delegee = null;
|
delegee = null;
|
||||||
// Return a result to the original generator
|
// Return a result to the original generator
|
||||||
return resumeLocal(
|
return resumeLocal(
|
||||||
cx,
|
cx, scope, Scriptable.getProperty(nextResult, ES6Iterator.VALUE_PROPERTY));
|
||||||
scope,
|
|
||||||
ScriptableObject.getProperty(nextResult, ES6Iterator.VALUE_PROPERTY));
|
|
||||||
}
|
}
|
||||||
// Otherwise, we have a normal result and should continue
|
// Otherwise, we have a normal result and should continue
|
||||||
return nextResult;
|
return nextResult;
|
||||||
|
|
|
@ -350,11 +350,11 @@ final class EqualObjectGraphs {
|
||||||
|
|
||||||
private static Object getValue(final Scriptable s, final Object id) {
|
private static Object getValue(final Scriptable s, final Object id) {
|
||||||
if (id instanceof Symbol) {
|
if (id instanceof Symbol) {
|
||||||
return ScriptableObject.getProperty(s, (Symbol) id);
|
return Scriptable.getProperty(s, (Symbol) id);
|
||||||
} else if (id instanceof Integer) {
|
} else if (id instanceof Integer) {
|
||||||
return ScriptableObject.getProperty(s, (Integer) id);
|
return Scriptable.getProperty(s, (Integer) id);
|
||||||
} else if (id instanceof String) {
|
} else if (id instanceof String) {
|
||||||
return ScriptableObject.getProperty(s, (String) id);
|
return Scriptable.getProperty(s, (String) id);
|
||||||
} else {
|
} else {
|
||||||
throw new ClassCastException();
|
throw new ClassCastException();
|
||||||
}
|
}
|
||||||
|
|
|
@ -866,7 +866,7 @@ public abstract class IdScriptableObject extends ScriptableObject implements IdF
|
||||||
ScriptableObject current = getOwnPropertyDescriptor(cx, key);
|
ScriptableObject current = getOwnPropertyDescriptor(cx, key);
|
||||||
checkPropertyChange(name, current, desc);
|
checkPropertyChange(name, current, desc);
|
||||||
int attr = (info >>> 16);
|
int attr = (info >>> 16);
|
||||||
Object value = getProperty(desc, "value");
|
Object value = Scriptable.getProperty(desc, "value");
|
||||||
if (value != NOT_FOUND && ((attr & READONLY) == 0 || (attr & PERMANENT) == 0)) {
|
if (value != NOT_FOUND && ((attr & READONLY) == 0 || (attr & PERMANENT) == 0)) {
|
||||||
Object currentValue = getInstanceIdValue(id);
|
Object currentValue = getInstanceIdValue(id);
|
||||||
if (!sameValue(value, currentValue)) {
|
if (!sameValue(value, currentValue)) {
|
||||||
|
@ -888,7 +888,7 @@ public abstract class IdScriptableObject extends ScriptableObject implements IdF
|
||||||
ScriptableObject current = getOwnPropertyDescriptor(cx, key);
|
ScriptableObject current = getOwnPropertyDescriptor(cx, key);
|
||||||
checkPropertyChange(name, current, desc);
|
checkPropertyChange(name, current, desc);
|
||||||
int attr = prototypeValues.getAttributes(id);
|
int attr = prototypeValues.getAttributes(id);
|
||||||
Object value = getProperty(desc, "value");
|
Object value = Scriptable.getProperty(desc, "value");
|
||||||
if (value != NOT_FOUND && (attr & READONLY) == 0) {
|
if (value != NOT_FOUND && (attr & READONLY) == 0) {
|
||||||
Object currentValue = prototypeValues.get(id);
|
Object currentValue = prototypeValues.get(id);
|
||||||
if (!sameValue(value, currentValue)) {
|
if (!sameValue(value, currentValue)) {
|
||||||
|
|
|
@ -121,7 +121,7 @@ public class InterfaceAdapter {
|
||||||
} else {
|
} else {
|
||||||
Scriptable s = (Scriptable) target;
|
Scriptable s = (Scriptable) target;
|
||||||
String methodName = method.getName();
|
String methodName = method.getName();
|
||||||
Object value = ScriptableObject.getProperty(s, methodName);
|
Object value = Scriptable.getProperty(s, methodName);
|
||||||
if (value == Scriptable.NOT_FOUND) {
|
if (value == Scriptable.NOT_FOUND) {
|
||||||
// We really should throw an error here, but for the sake of
|
// We really should throw an error here, but for the sake of
|
||||||
// compatibility with JavaAdapter we silently ignore undefined
|
// compatibility with JavaAdapter we silently ignore undefined
|
||||||
|
|
|
@ -74,7 +74,7 @@ public class IteratorLikeIterable implements Iterable<Object>, Closeable {
|
||||||
// This will throw if "val" is not an object.
|
// This will throw if "val" is not an object.
|
||||||
// "getObjectPropNoWarn" won't, so do this as follows.
|
// "getObjectPropNoWarn" won't, so do this as follows.
|
||||||
Object doneval =
|
Object doneval =
|
||||||
ScriptableObject.getProperty(
|
Scriptable.getProperty(
|
||||||
ScriptableObject.ensureScriptable(val), ES6Iterator.DONE_PROPERTY);
|
ScriptableObject.ensureScriptable(val), ES6Iterator.DONE_PROPERTY);
|
||||||
if (doneval == Scriptable.NOT_FOUND) {
|
if (doneval == Scriptable.NOT_FOUND) {
|
||||||
doneval = Undefined.instance;
|
doneval = Undefined.instance;
|
||||||
|
|
|
@ -285,10 +285,10 @@ public final class JavaAdapter implements IdFunctionCall {
|
||||||
for (int i = 0; i != ids.length; ++i) {
|
for (int i = 0; i != ids.length; ++i) {
|
||||||
if (!(ids[i] instanceof String)) continue;
|
if (!(ids[i] instanceof String)) continue;
|
||||||
String id = (String) ids[i];
|
String id = (String) ids[i];
|
||||||
Object value = ScriptableObject.getProperty(obj, id);
|
Object value = Scriptable.getProperty(obj, id);
|
||||||
if (value instanceof Function) {
|
if (value instanceof Function) {
|
||||||
Function f = (Function) value;
|
Function f = (Function) value;
|
||||||
int length = ScriptRuntime.toInt32(ScriptableObject.getProperty(f, "length"));
|
int length = ScriptRuntime.toInt32(Scriptable.getProperty(f, "length"));
|
||||||
if (length < 0) {
|
if (length < 0) {
|
||||||
length = 0;
|
length = 0;
|
||||||
}
|
}
|
||||||
|
@ -508,7 +508,7 @@ public final class JavaAdapter implements IdFunctionCall {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Function getFunction(Scriptable obj, String functionName) {
|
public static Function getFunction(Scriptable obj, String functionName) {
|
||||||
Object x = ScriptableObject.getProperty(obj, functionName);
|
Object x = Scriptable.getProperty(obj, functionName);
|
||||||
if (x == Scriptable.NOT_FOUND) {
|
if (x == Scriptable.NOT_FOUND) {
|
||||||
// This method used to swallow the exception from calling
|
// This method used to swallow the exception from calling
|
||||||
// an undefined method. People have come to depend on this
|
// an undefined method. People have come to depend on this
|
||||||
|
|
|
@ -947,7 +947,7 @@ public class NativeArray extends IdScriptableObject implements List {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Object iteratorProp = ScriptableObject.getProperty(items, SymbolKey.ITERATOR);
|
Object iteratorProp = Scriptable.getProperty(items, SymbolKey.ITERATOR);
|
||||||
if (!(items instanceof NativeArray)
|
if (!(items instanceof NativeArray)
|
||||||
&& (iteratorProp != Scriptable.NOT_FOUND)
|
&& (iteratorProp != Scriptable.NOT_FOUND)
|
||||||
&& !Undefined.isUndefined(iteratorProp)) {
|
&& !Undefined.isUndefined(iteratorProp)) {
|
||||||
|
@ -1114,7 +1114,7 @@ public class NativeArray extends IdScriptableObject implements List {
|
||||||
return ((Number) lengthFunc.call(cx, obj, obj, ScriptRuntime.emptyArgs)).longValue();
|
return ((Number) lengthFunc.call(cx, obj, obj, ScriptRuntime.emptyArgs)).longValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
Object len = ScriptableObject.getProperty(obj, "length");
|
Object len = Scriptable.getProperty(obj, "length");
|
||||||
if (len == Scriptable.NOT_FOUND) {
|
if (len == Scriptable.NOT_FOUND) {
|
||||||
// toUint32(undefined) == 0
|
// toUint32(undefined) == 0
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1706,7 +1706,7 @@ public class NativeArray extends IdScriptableObject implements List {
|
||||||
// First, look for the new @@isConcatSpreadable test as per ECMAScript 6 and up
|
// First, look for the new @@isConcatSpreadable test as per ECMAScript 6 and up
|
||||||
if (val instanceof Scriptable) {
|
if (val instanceof Scriptable) {
|
||||||
final Object spreadable =
|
final Object spreadable =
|
||||||
ScriptableObject.getProperty((Scriptable) val, SymbolKey.IS_CONCAT_SPREADABLE);
|
Scriptable.getProperty((Scriptable) val, SymbolKey.IS_CONCAT_SPREADABLE);
|
||||||
if ((spreadable != Scriptable.NOT_FOUND) && !Undefined.isUndefined(spreadable)) {
|
if ((spreadable != Scriptable.NOT_FOUND) && !Undefined.isUndefined(spreadable)) {
|
||||||
// If @@isConcatSpreadable was undefined, we have to fall back to testing for an
|
// If @@isConcatSpreadable was undefined, we have to fall back to testing for an
|
||||||
// array.
|
// array.
|
||||||
|
@ -1871,7 +1871,7 @@ public class NativeArray extends IdScriptableObject implements List {
|
||||||
for (int i = (int) start; i < length; i++) {
|
for (int i = (int) start; i < length; i++) {
|
||||||
Object val = na.dense[i];
|
Object val = na.dense[i];
|
||||||
if (val == NOT_FOUND && proto != null) {
|
if (val == NOT_FOUND && proto != null) {
|
||||||
val = ScriptableObject.getProperty(proto, i);
|
val = Scriptable.getProperty(proto, i);
|
||||||
}
|
}
|
||||||
if (val != NOT_FOUND && ScriptRuntime.shallowEq(val, compareTo)) {
|
if (val != NOT_FOUND && ScriptRuntime.shallowEq(val, compareTo)) {
|
||||||
return Long.valueOf(i);
|
return Long.valueOf(i);
|
||||||
|
@ -1923,7 +1923,7 @@ public class NativeArray extends IdScriptableObject implements List {
|
||||||
for (int i = (int) start; i >= 0; i--) {
|
for (int i = (int) start; i >= 0; i--) {
|
||||||
Object val = na.dense[i];
|
Object val = na.dense[i];
|
||||||
if (val == NOT_FOUND && proto != null) {
|
if (val == NOT_FOUND && proto != null) {
|
||||||
val = ScriptableObject.getProperty(proto, i);
|
val = Scriptable.getProperty(proto, i);
|
||||||
}
|
}
|
||||||
if (val != NOT_FOUND && ScriptRuntime.shallowEq(val, compareTo)) {
|
if (val != NOT_FOUND && ScriptRuntime.shallowEq(val, compareTo)) {
|
||||||
return Long.valueOf(i);
|
return Long.valueOf(i);
|
||||||
|
@ -1949,7 +1949,8 @@ public class NativeArray extends IdScriptableObject implements List {
|
||||||
Object compareTo = args.length > 0 ? args[0] : Undefined.instance;
|
Object compareTo = args.length > 0 ? args[0] : Undefined.instance;
|
||||||
|
|
||||||
Scriptable o = ScriptRuntime.toObject(cx, scope, thisObj);
|
Scriptable o = ScriptRuntime.toObject(cx, scope, thisObj);
|
||||||
long len = ScriptRuntime.toLength(new Object[] {getProperty(thisObj, "length")}, 0);
|
long len =
|
||||||
|
ScriptRuntime.toLength(new Object[] {Scriptable.getProperty(thisObj, "length")}, 0);
|
||||||
if (len == 0) return Boolean.FALSE;
|
if (len == 0) return Boolean.FALSE;
|
||||||
|
|
||||||
long k;
|
long k;
|
||||||
|
@ -1970,7 +1971,7 @@ public class NativeArray extends IdScriptableObject implements List {
|
||||||
for (int i = (int) k; i < len; i++) {
|
for (int i = (int) k; i < len; i++) {
|
||||||
Object elementK = na.dense[i];
|
Object elementK = na.dense[i];
|
||||||
if (elementK == NOT_FOUND && proto != null) {
|
if (elementK == NOT_FOUND && proto != null) {
|
||||||
elementK = ScriptableObject.getProperty(proto, i);
|
elementK = Scriptable.getProperty(proto, i);
|
||||||
}
|
}
|
||||||
if (elementK == NOT_FOUND) {
|
if (elementK == NOT_FOUND) {
|
||||||
elementK = Undefined.instance;
|
elementK = Undefined.instance;
|
||||||
|
|
|
@ -300,7 +300,7 @@ final class NativeDate extends IdScriptableObject {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Object toISO = ScriptableObject.getProperty(o, toISOString);
|
Object toISO = Scriptable.getProperty(o, toISOString);
|
||||||
if (toISO == NOT_FOUND) {
|
if (toISO == NOT_FOUND) {
|
||||||
throw ScriptRuntime.typeErrorById(
|
throw ScriptRuntime.typeErrorById(
|
||||||
"msg.function.not.found.in",
|
"msg.function.not.found.in",
|
||||||
|
|
|
@ -117,7 +117,7 @@ final class NativeError extends IdScriptableObject {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void installCause(NativeObject options, NativeError obj) {
|
static void installCause(NativeObject options, NativeError obj) {
|
||||||
Object cause = ScriptableObject.getProperty(options, "cause");
|
Object cause = Scriptable.getProperty(options, "cause");
|
||||||
if (cause != NOT_FOUND) {
|
if (cause != NOT_FOUND) {
|
||||||
ScriptableObject.putProperty(obj, "cause", cause);
|
ScriptableObject.putProperty(obj, "cause", cause);
|
||||||
obj.setAttributes("cause", DONTENUM);
|
obj.setAttributes("cause", DONTENUM);
|
||||||
|
@ -290,14 +290,14 @@ final class NativeError extends IdScriptableObject {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Object js_toString(Scriptable thisObj) {
|
private static Object js_toString(Scriptable thisObj) {
|
||||||
Object nameObj = ScriptableObject.getProperty(thisObj, "name");
|
Object nameObj = Scriptable.getProperty(thisObj, "name");
|
||||||
String name;
|
String name;
|
||||||
if (nameObj == NOT_FOUND || Undefined.isUndefined(nameObj)) {
|
if (nameObj == NOT_FOUND || Undefined.isUndefined(nameObj)) {
|
||||||
name = "Error";
|
name = "Error";
|
||||||
} else {
|
} else {
|
||||||
name = ScriptRuntime.toString(nameObj);
|
name = ScriptRuntime.toString(nameObj);
|
||||||
}
|
}
|
||||||
Object msgObj = ScriptableObject.getProperty(thisObj, "message");
|
Object msgObj = Scriptable.getProperty(thisObj, "message");
|
||||||
String msg;
|
String msg;
|
||||||
if (msgObj == NOT_FOUND || Undefined.isUndefined(msgObj)) {
|
if (msgObj == NOT_FOUND || Undefined.isUndefined(msgObj)) {
|
||||||
msg = "";
|
msg = "";
|
||||||
|
@ -315,10 +315,10 @@ final class NativeError extends IdScriptableObject {
|
||||||
|
|
||||||
private static String js_toSource(Context cx, Scriptable scope, Scriptable thisObj) {
|
private static String js_toSource(Context cx, Scriptable scope, Scriptable thisObj) {
|
||||||
// Emulation of SpiderMonkey behavior
|
// Emulation of SpiderMonkey behavior
|
||||||
Object name = ScriptableObject.getProperty(thisObj, "name");
|
Object name = Scriptable.getProperty(thisObj, "name");
|
||||||
Object message = ScriptableObject.getProperty(thisObj, "message");
|
Object message = Scriptable.getProperty(thisObj, "message");
|
||||||
Object fileName = ScriptableObject.getProperty(thisObj, "fileName");
|
Object fileName = Scriptable.getProperty(thisObj, "fileName");
|
||||||
Object lineNumber = ScriptableObject.getProperty(thisObj, "lineNumber");
|
Object lineNumber = Scriptable.getProperty(thisObj, "lineNumber");
|
||||||
|
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append("(new ");
|
sb.append("(new ");
|
||||||
|
|
|
@ -96,10 +96,9 @@ public class NativeGlobal implements Serializable, IdFunctionCall {
|
||||||
with the 'name' property set to the name of the error.
|
with the 'name' property set to the name of the error.
|
||||||
*/
|
*/
|
||||||
Scriptable nativeError =
|
Scriptable nativeError =
|
||||||
ScriptableObject.ensureScriptable(ScriptableObject.getProperty(scope, "Error"));
|
ScriptableObject.ensureScriptable(Scriptable.getProperty(scope, "Error"));
|
||||||
Scriptable nativeErrorProto =
|
Scriptable nativeErrorProto =
|
||||||
ScriptableObject.ensureScriptable(
|
ScriptableObject.ensureScriptable(Scriptable.getProperty(nativeError, "prototype"));
|
||||||
ScriptableObject.getProperty(nativeError, "prototype"));
|
|
||||||
|
|
||||||
for (TopLevel.NativeErrors error : TopLevel.NativeErrors.values()) {
|
for (TopLevel.NativeErrors error : TopLevel.NativeErrors.values()) {
|
||||||
if (error == TopLevel.NativeErrors.Error) {
|
if (error == TopLevel.NativeErrors.Error) {
|
||||||
|
|
|
@ -255,14 +255,14 @@ public final class NativeJSON extends ScriptableObject {
|
||||||
int keyInt = 0;
|
int keyInt = 0;
|
||||||
if (key instanceof String) {
|
if (key instanceof String) {
|
||||||
keyString = (String) key;
|
keyString = (String) key;
|
||||||
value = getProperty(holder, keyString);
|
value = Scriptable.getProperty(holder, keyString);
|
||||||
} else {
|
} else {
|
||||||
keyInt = ((Number) key).intValue();
|
keyInt = ((Number) key).intValue();
|
||||||
value = getProperty(holder, keyInt);
|
value = Scriptable.getProperty(holder, keyInt);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (value instanceof Scriptable && hasProperty((Scriptable) value, "toJSON")) {
|
if (value instanceof Scriptable && hasProperty((Scriptable) value, "toJSON")) {
|
||||||
Object toJSON = getProperty((Scriptable) value, "toJSON");
|
Object toJSON = Scriptable.getProperty((Scriptable) value, "toJSON");
|
||||||
if (toJSON instanceof Callable) {
|
if (toJSON instanceof Callable) {
|
||||||
value =
|
value =
|
||||||
callMethod(
|
callMethod(
|
||||||
|
@ -276,7 +276,7 @@ public final class NativeJSON extends ScriptableObject {
|
||||||
} else if (value instanceof BigInteger) {
|
} else if (value instanceof BigInteger) {
|
||||||
Scriptable bigInt = ScriptRuntime.toObject(state.cx, state.scope, value);
|
Scriptable bigInt = ScriptRuntime.toObject(state.cx, state.scope, value);
|
||||||
if (hasProperty(bigInt, "toJSON")) {
|
if (hasProperty(bigInt, "toJSON")) {
|
||||||
Object toJSON = getProperty(bigInt, "toJSON");
|
Object toJSON = Scriptable.getProperty(bigInt, "toJSON");
|
||||||
if (toJSON instanceof Callable) {
|
if (toJSON instanceof Callable) {
|
||||||
value =
|
value =
|
||||||
callMethod(
|
callMethod(
|
||||||
|
|
|
@ -31,7 +31,7 @@ import java.util.Objects;
|
||||||
* @see NativeJavaPackage
|
* @see NativeJavaPackage
|
||||||
* @see NativeJavaClass
|
* @see NativeJavaClass
|
||||||
*/
|
*/
|
||||||
public class NativeJavaObject implements Scriptable, SymbolScriptable, Wrapper, Serializable {
|
public class NativeJavaObject implements SymbolScriptable, Wrapper, Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = -6948590651130498591L;
|
private static final long serialVersionUID = -6948590651130498591L;
|
||||||
|
|
||||||
|
|
|
@ -174,7 +174,7 @@ public class NativeObject extends IdScriptableObject implements Map {
|
||||||
if (thisObj == null) {
|
if (thisObj == null) {
|
||||||
throw ScriptRuntime.notFunctionError(null);
|
throw ScriptRuntime.notFunctionError(null);
|
||||||
}
|
}
|
||||||
Object toString = ScriptableObject.getProperty(thisObj, "toString");
|
Object toString = Scriptable.getProperty(thisObj, "toString");
|
||||||
if (!(toString instanceof Callable)) {
|
if (!(toString instanceof Callable)) {
|
||||||
throw ScriptRuntime.notFunctionError(toString);
|
throw ScriptRuntime.notFunctionError(toString);
|
||||||
}
|
}
|
||||||
|
|
|
@ -616,7 +616,7 @@ public class NativePromise extends ScriptableObject {
|
||||||
}
|
}
|
||||||
|
|
||||||
Scriptable sresolution = ScriptableObject.ensureScriptable(resolution);
|
Scriptable sresolution = ScriptableObject.ensureScriptable(resolution);
|
||||||
Object thenObj = ScriptableObject.getProperty(sresolution, "then");
|
Object thenObj = Scriptable.getProperty(sresolution, "then");
|
||||||
if (!(thenObj instanceof Callable)) {
|
if (!(thenObj instanceof Callable)) {
|
||||||
return promise.fulfillPromise(cx, scope, resolution);
|
return promise.fulfillPromise(cx, scope, resolution);
|
||||||
}
|
}
|
||||||
|
|
|
@ -474,7 +474,7 @@ final class NativeString extends IdScriptableObject {
|
||||||
Scriptable arg0 = (Scriptable) args[0];
|
Scriptable arg0 = (Scriptable) args[0];
|
||||||
if (reProxy.isRegExp(arg0)) {
|
if (reProxy.isRegExp(arg0)) {
|
||||||
if (ScriptableObject.isTrue(
|
if (ScriptableObject.isTrue(
|
||||||
ScriptableObject.getProperty(arg0, SymbolKey.MATCH))) {
|
Scriptable.getProperty(arg0, SymbolKey.MATCH))) {
|
||||||
throw ScriptRuntime.typeErrorById(
|
throw ScriptRuntime.typeErrorById(
|
||||||
"msg.first.arg.not.regexp",
|
"msg.first.arg.not.regexp",
|
||||||
String.class.getSimpleName(),
|
String.class.getSimpleName(),
|
||||||
|
|
|
@ -12,7 +12,7 @@ import java.io.Serializable;
|
||||||
* This class implements the object lookup required for the <code>with</code> statement. It simply
|
* This class implements the object lookup required for the <code>with</code> statement. It simply
|
||||||
* delegates every action to its prototype except for operations on its parent.
|
* delegates every action to its prototype except for operations on its parent.
|
||||||
*/
|
*/
|
||||||
public class NativeWith implements Scriptable, SymbolScriptable, IdFunctionCall, Serializable {
|
public class NativeWith implements SymbolScriptable, IdFunctionCall, Serializable {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
static void init(Scriptable scope, boolean sealed) {
|
static void init(Scriptable scope, boolean sealed) {
|
||||||
|
|
|
@ -1125,7 +1125,7 @@ public class ScriptRuntime {
|
||||||
// Wrapped Java objects won't have "toSource" and will report
|
// Wrapped Java objects won't have "toSource" and will report
|
||||||
// errors for get()s of nonexistent name, so use has() first
|
// errors for get()s of nonexistent name, so use has() first
|
||||||
if (ScriptableObject.hasProperty(obj, "toSource")) {
|
if (ScriptableObject.hasProperty(obj, "toSource")) {
|
||||||
Object v = ScriptableObject.getProperty(obj, "toSource");
|
Object v = Scriptable.getProperty(obj, "toSource");
|
||||||
if (v instanceof Function) {
|
if (v instanceof Function) {
|
||||||
Function f = (Function) v;
|
Function f = (Function) v;
|
||||||
return toString(f.call(cx, scope, obj, emptyArgs));
|
return toString(f.call(cx, scope, obj, emptyArgs));
|
||||||
|
@ -1471,7 +1471,7 @@ public class ScriptRuntime {
|
||||||
for (; ; ) {
|
for (; ; ) {
|
||||||
Scriptable parent = scope.getParentScope();
|
Scriptable parent = scope.getParentScope();
|
||||||
if (parent == null) {
|
if (parent == null) {
|
||||||
nsObject = ScriptableObject.getProperty(scope, DEFAULT_NS_TAG);
|
nsObject = Scriptable.getProperty(scope, DEFAULT_NS_TAG);
|
||||||
if (nsObject == Scriptable.NOT_FOUND) {
|
if (nsObject == Scriptable.NOT_FOUND) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -1488,11 +1488,11 @@ public class ScriptRuntime {
|
||||||
|
|
||||||
public static Object getTopLevelProp(Scriptable scope, String id) {
|
public static Object getTopLevelProp(Scriptable scope, String id) {
|
||||||
scope = ScriptableObject.getTopLevelScope(scope);
|
scope = ScriptableObject.getTopLevelScope(scope);
|
||||||
return ScriptableObject.getProperty(scope, id);
|
return Scriptable.getProperty(scope, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Function getExistingCtor(Context cx, Scriptable scope, String constructorName) {
|
public static Function getExistingCtor(Context cx, Scriptable scope, String constructorName) {
|
||||||
Object ctorVal = ScriptableObject.getProperty(scope, constructorName);
|
Object ctorVal = Scriptable.getProperty(scope, constructorName);
|
||||||
if (ctorVal instanceof Function) {
|
if (ctorVal instanceof Function) {
|
||||||
return (Function) ctorVal;
|
return (Function) ctorVal;
|
||||||
}
|
}
|
||||||
|
@ -1698,14 +1698,14 @@ public class ScriptRuntime {
|
||||||
if (obj instanceof XMLObject) {
|
if (obj instanceof XMLObject) {
|
||||||
result = ((XMLObject) obj).get(cx, elem);
|
result = ((XMLObject) obj).get(cx, elem);
|
||||||
} else if (isSymbol(elem)) {
|
} else if (isSymbol(elem)) {
|
||||||
result = ScriptableObject.getProperty(obj, (Symbol) elem);
|
result = Scriptable.getProperty(obj, (Symbol) elem);
|
||||||
} else {
|
} else {
|
||||||
StringIdOrIndex s = toStringIdOrIndex(elem);
|
StringIdOrIndex s = toStringIdOrIndex(elem);
|
||||||
if (s.stringId == null) {
|
if (s.stringId == null) {
|
||||||
int index = s.index;
|
int index = s.index;
|
||||||
result = ScriptableObject.getProperty(obj, index);
|
result = Scriptable.getProperty(obj, index);
|
||||||
} else {
|
} else {
|
||||||
result = ScriptableObject.getProperty(obj, s.stringId);
|
result = Scriptable.getProperty(obj, s.stringId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1741,7 +1741,7 @@ public class ScriptRuntime {
|
||||||
|
|
||||||
public static Object getObjectProp(Scriptable obj, String property, Context cx) {
|
public static Object getObjectProp(Scriptable obj, String property, Context cx) {
|
||||||
|
|
||||||
Object result = ScriptableObject.getProperty(obj, property);
|
Object result = Scriptable.getProperty(obj, property);
|
||||||
if (result == Scriptable.NOT_FOUND) {
|
if (result == Scriptable.NOT_FOUND) {
|
||||||
if (cx.hasFeature(Context.FEATURE_STRICT_MODE)) {
|
if (cx.hasFeature(Context.FEATURE_STRICT_MODE)) {
|
||||||
Context.reportWarning(
|
Context.reportWarning(
|
||||||
|
@ -1765,7 +1765,7 @@ public class ScriptRuntime {
|
||||||
if (sobj == null) {
|
if (sobj == null) {
|
||||||
throw undefReadError(obj, property);
|
throw undefReadError(obj, property);
|
||||||
}
|
}
|
||||||
Object result = ScriptableObject.getProperty(sobj, property);
|
Object result = Scriptable.getProperty(sobj, property);
|
||||||
if (result == Scriptable.NOT_FOUND) {
|
if (result == Scriptable.NOT_FOUND) {
|
||||||
return Undefined.instance;
|
return Undefined.instance;
|
||||||
}
|
}
|
||||||
|
@ -1798,7 +1798,7 @@ public class ScriptRuntime {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Object getObjectIndex(Scriptable obj, int index, Context cx) {
|
public static Object getObjectIndex(Scriptable obj, int index, Context cx) {
|
||||||
Object result = ScriptableObject.getProperty(obj, index);
|
Object result = Scriptable.getProperty(obj, index);
|
||||||
if (result == Scriptable.NOT_FOUND) {
|
if (result == Scriptable.NOT_FOUND) {
|
||||||
result = Undefined.instance;
|
result = Undefined.instance;
|
||||||
}
|
}
|
||||||
|
@ -2054,7 +2054,7 @@ public class ScriptRuntime {
|
||||||
firstXMLObject = xmlObj;
|
firstXMLObject = xmlObj;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
result = ScriptableObject.getProperty(withObj, name);
|
result = Scriptable.getProperty(withObj, name);
|
||||||
if (result != Scriptable.NOT_FOUND) {
|
if (result != Scriptable.NOT_FOUND) {
|
||||||
// function this should be the target object of with
|
// function this should be the target object of with
|
||||||
thisObj = withObj;
|
thisObj = withObj;
|
||||||
|
@ -2076,7 +2076,7 @@ public class ScriptRuntime {
|
||||||
} else {
|
} else {
|
||||||
// Can happen if Rhino embedding decided that nested
|
// Can happen if Rhino embedding decided that nested
|
||||||
// scopes are useful for what ever reasons.
|
// scopes are useful for what ever reasons.
|
||||||
result = ScriptableObject.getProperty(scope, name);
|
result = Scriptable.getProperty(scope, name);
|
||||||
if (result != Scriptable.NOT_FOUND) {
|
if (result != Scriptable.NOT_FOUND) {
|
||||||
thisObj = scope;
|
thisObj = scope;
|
||||||
break;
|
break;
|
||||||
|
@ -2116,7 +2116,7 @@ public class ScriptRuntime {
|
||||||
if (cx.useDynamicScope) {
|
if (cx.useDynamicScope) {
|
||||||
scope = checkDynamicScope(cx.topCallScope, scope);
|
scope = checkDynamicScope(cx.topCallScope, scope);
|
||||||
}
|
}
|
||||||
return ScriptableObject.getProperty(scope, name);
|
return Scriptable.getProperty(scope, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2263,7 +2263,7 @@ public class ScriptRuntime {
|
||||||
public static Scriptable toIterator(
|
public static Scriptable toIterator(
|
||||||
Context cx, Scriptable scope, Scriptable obj, boolean keyOnly) {
|
Context cx, Scriptable scope, Scriptable obj, boolean keyOnly) {
|
||||||
if (ScriptableObject.hasProperty(obj, NativeIterator.ITERATOR_PROPERTY_NAME)) {
|
if (ScriptableObject.hasProperty(obj, NativeIterator.ITERATOR_PROPERTY_NAME)) {
|
||||||
Object v = ScriptableObject.getProperty(obj, NativeIterator.ITERATOR_PROPERTY_NAME);
|
Object v = Scriptable.getProperty(obj, NativeIterator.ITERATOR_PROPERTY_NAME);
|
||||||
if (!(v instanceof Callable)) {
|
if (!(v instanceof Callable)) {
|
||||||
throw typeErrorById("msg.invalid.iterator");
|
throw typeErrorById("msg.invalid.iterator");
|
||||||
}
|
}
|
||||||
|
@ -2343,7 +2343,7 @@ public class ScriptRuntime {
|
||||||
throw typeErrorById("msg.not.iterable", toString(x.obj));
|
throw typeErrorById("msg.not.iterable", toString(x.obj));
|
||||||
}
|
}
|
||||||
|
|
||||||
Object iterator = ScriptableObject.getProperty(x.obj, SymbolKey.ITERATOR);
|
Object iterator = Scriptable.getProperty(x.obj, SymbolKey.ITERATOR);
|
||||||
if (!(iterator instanceof Callable)) {
|
if (!(iterator instanceof Callable)) {
|
||||||
throw typeErrorById("msg.not.iterable", toString(x.obj));
|
throw typeErrorById("msg.not.iterable", toString(x.obj));
|
||||||
}
|
}
|
||||||
|
@ -2374,7 +2374,7 @@ public class ScriptRuntime {
|
||||||
if (x.enumType == ENUMERATE_VALUES_IN_ORDER) {
|
if (x.enumType == ENUMERATE_VALUES_IN_ORDER) {
|
||||||
return enumNextInOrder(x, cx);
|
return enumNextInOrder(x, cx);
|
||||||
}
|
}
|
||||||
Object v = ScriptableObject.getProperty(x.iterator, "next");
|
Object v = Scriptable.getProperty(x.iterator, "next");
|
||||||
if (!(v instanceof Callable)) return Boolean.FALSE;
|
if (!(v instanceof Callable)) return Boolean.FALSE;
|
||||||
Callable f = (Callable) v;
|
Callable f = (Callable) v;
|
||||||
try {
|
try {
|
||||||
|
@ -2416,7 +2416,7 @@ public class ScriptRuntime {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Boolean enumNextInOrder(IdEnumeration enumObj, Context cx) {
|
private static Boolean enumNextInOrder(IdEnumeration enumObj, Context cx) {
|
||||||
Object v = ScriptableObject.getProperty(enumObj.iterator, ES6Iterator.NEXT_METHOD);
|
Object v = Scriptable.getProperty(enumObj.iterator, ES6Iterator.NEXT_METHOD);
|
||||||
if (!(v instanceof Callable)) {
|
if (!(v instanceof Callable)) {
|
||||||
throw notFunctionError(enumObj.iterator, ES6Iterator.NEXT_METHOD);
|
throw notFunctionError(enumObj.iterator, ES6Iterator.NEXT_METHOD);
|
||||||
}
|
}
|
||||||
|
@ -2424,12 +2424,11 @@ public class ScriptRuntime {
|
||||||
Scriptable scope = enumObj.iterator.getParentScope();
|
Scriptable scope = enumObj.iterator.getParentScope();
|
||||||
Object r = f.call(cx, scope, enumObj.iterator, emptyArgs);
|
Object r = f.call(cx, scope, enumObj.iterator, emptyArgs);
|
||||||
Scriptable iteratorResult = toObject(cx, scope, r);
|
Scriptable iteratorResult = toObject(cx, scope, r);
|
||||||
Object done = ScriptableObject.getProperty(iteratorResult, ES6Iterator.DONE_PROPERTY);
|
Object done = Scriptable.getProperty(iteratorResult, ES6Iterator.DONE_PROPERTY);
|
||||||
if (done != Scriptable.NOT_FOUND && toBoolean(done)) {
|
if (done != Scriptable.NOT_FOUND && toBoolean(done)) {
|
||||||
return Boolean.FALSE;
|
return Boolean.FALSE;
|
||||||
}
|
}
|
||||||
enumObj.currentId =
|
enumObj.currentId = Scriptable.getProperty(iteratorResult, ES6Iterator.VALUE_PROPERTY);
|
||||||
ScriptableObject.getProperty(iteratorResult, ES6Iterator.VALUE_PROPERTY);
|
|
||||||
return Boolean.TRUE;
|
return Boolean.TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2593,7 +2592,7 @@ public class ScriptRuntime {
|
||||||
if (thisObj == null) {
|
if (thisObj == null) {
|
||||||
throw undefCallError(obj, String.valueOf(elem));
|
throw undefCallError(obj, String.valueOf(elem));
|
||||||
}
|
}
|
||||||
value = ScriptableObject.getProperty(thisObj, (Symbol) elem);
|
value = Scriptable.getProperty(thisObj, (Symbol) elem);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
StringIdOrIndex s = toStringIdOrIndex(elem);
|
StringIdOrIndex s = toStringIdOrIndex(elem);
|
||||||
|
@ -2606,7 +2605,7 @@ public class ScriptRuntime {
|
||||||
throw undefCallError(obj, String.valueOf(elem));
|
throw undefCallError(obj, String.valueOf(elem));
|
||||||
}
|
}
|
||||||
|
|
||||||
value = ScriptableObject.getProperty(thisObj, s.index);
|
value = Scriptable.getProperty(thisObj, s.index);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(value instanceof Callable)) {
|
if (!(value instanceof Callable)) {
|
||||||
|
@ -2649,9 +2648,9 @@ public class ScriptRuntime {
|
||||||
throw undefCallError(obj, property);
|
throw undefCallError(obj, property);
|
||||||
}
|
}
|
||||||
|
|
||||||
Object value = ScriptableObject.getProperty(thisObj, property);
|
Object value = Scriptable.getProperty(thisObj, property);
|
||||||
if (!(value instanceof Callable)) {
|
if (!(value instanceof Callable)) {
|
||||||
Object noSuchMethod = ScriptableObject.getProperty(thisObj, "__noSuchMethod__");
|
Object noSuchMethod = Scriptable.getProperty(thisObj, "__noSuchMethod__");
|
||||||
if (noSuchMethod instanceof Callable)
|
if (noSuchMethod instanceof Callable)
|
||||||
value = new NoSuchMethodShim((Callable) noSuchMethod, property);
|
value = new NoSuchMethodShim((Callable) noSuchMethod, property);
|
||||||
}
|
}
|
||||||
|
@ -4640,7 +4639,7 @@ public class ScriptRuntime {
|
||||||
}
|
}
|
||||||
Object[] result = new Object[len];
|
Object[] result = new Object[len];
|
||||||
for (int i = 0; i < len; i++) {
|
for (int i = 0; i < len; i++) {
|
||||||
Object elem = ScriptableObject.getProperty(object, i);
|
Object elem = Scriptable.getProperty(object, i);
|
||||||
result[i] = (elem == Scriptable.NOT_FOUND) ? Undefined.instance : elem;
|
result[i] = (elem == Scriptable.NOT_FOUND) ? Undefined.instance : elem;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -106,7 +106,7 @@ public interface Scriptable {
|
||||||
* @param start the object in which the lookup began
|
* @param start the object in which the lookup began
|
||||||
* @return true if and only if the named property is found in the object
|
* @return true if and only if the named property is found in the object
|
||||||
* @see org.mozilla.javascript.Scriptable#get(String, Scriptable)
|
* @see org.mozilla.javascript.Scriptable#get(String, Scriptable)
|
||||||
* @see org.mozilla.javascript.ScriptableObject#getProperty(Scriptable, String)
|
* @see org.mozilla.javascript.Scriptable#getProperty(Scriptable, String)
|
||||||
*/
|
*/
|
||||||
boolean has(String name, Scriptable start);
|
boolean has(String name, Scriptable start);
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ public interface Scriptable {
|
||||||
* @param start the object in which the lookup began
|
* @param start the object in which the lookup began
|
||||||
* @return true if and only if the indexed property is found in the object
|
* @return true if and only if the indexed property is found in the object
|
||||||
* @see org.mozilla.javascript.Scriptable#get(int, Scriptable)
|
* @see org.mozilla.javascript.Scriptable#get(int, Scriptable)
|
||||||
* @see org.mozilla.javascript.ScriptableObject#getProperty(Scriptable, int)
|
* @see org.mozilla.javascript.Scriptable#getProperty(Scriptable, int)
|
||||||
*/
|
*/
|
||||||
boolean has(int index, Scriptable start);
|
boolean has(int index, Scriptable start);
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,7 @@ import org.mozilla.javascript.debug.DebuggableObject;
|
||||||
* @author Norris Boyd
|
* @author Norris Boyd
|
||||||
*/
|
*/
|
||||||
public abstract class ScriptableObject
|
public abstract class ScriptableObject
|
||||||
implements Scriptable, SymbolScriptable, Serializable, DebuggableObject, ConstProperties {
|
implements SymbolScriptable, Serializable, DebuggableObject, ConstProperties {
|
||||||
|
|
||||||
private static final long serialVersionUID = 2829861078851942586L;
|
private static final long serialVersionUID = 2829861078851942586L;
|
||||||
|
|
||||||
|
@ -789,7 +789,7 @@ public abstract class ScriptableObject
|
||||||
} else {
|
} else {
|
||||||
methodName = "valueOf";
|
methodName = "valueOf";
|
||||||
}
|
}
|
||||||
Object v = getProperty(object, methodName);
|
Object v = Scriptable.getProperty(object, methodName);
|
||||||
if (!(v instanceof Function)) continue;
|
if (!(v instanceof Function)) continue;
|
||||||
Function fun = (Function) v;
|
Function fun = (Function) v;
|
||||||
if (cx == null) {
|
if (cx == null) {
|
||||||
|
@ -1056,7 +1056,7 @@ public abstract class ScriptableObject
|
||||||
String className = proto.getClassName();
|
String className = proto.getClassName();
|
||||||
|
|
||||||
// check for possible redefinition
|
// check for possible redefinition
|
||||||
Object existing = getProperty(getTopLevelScope(scope), className);
|
Object existing = Scriptable.getProperty(getTopLevelScope(scope), className);
|
||||||
if (existing instanceof BaseFunction) {
|
if (existing instanceof BaseFunction) {
|
||||||
Object existingProto = ((BaseFunction) existing).getPrototypeProperty();
|
Object existingProto = ((BaseFunction) existing).getPrototypeProperty();
|
||||||
if (existingProto != null && clazz.equals(existingProto.getClass())) {
|
if (existingProto != null && clazz.equals(existingProto.getClass())) {
|
||||||
|
@ -1640,11 +1640,11 @@ public abstract class ScriptableObject
|
||||||
fslot = new AccessorSlot(slot);
|
fslot = new AccessorSlot(slot);
|
||||||
slot = fslot;
|
slot = fslot;
|
||||||
}
|
}
|
||||||
Object getter = getProperty(desc, "get");
|
Object getter = Scriptable.getProperty(desc, "get");
|
||||||
if (getter != NOT_FOUND) {
|
if (getter != NOT_FOUND) {
|
||||||
fslot.getter = new AccessorSlot.FunctionGetter(getter);
|
fslot.getter = new AccessorSlot.FunctionGetter(getter);
|
||||||
}
|
}
|
||||||
Object setter = getProperty(desc, "set");
|
Object setter = Scriptable.getProperty(desc, "set");
|
||||||
if (setter != NOT_FOUND) {
|
if (setter != NOT_FOUND) {
|
||||||
fslot.setter = new AccessorSlot.FunctionSetter(setter);
|
fslot.setter = new AccessorSlot.FunctionSetter(setter);
|
||||||
}
|
}
|
||||||
|
@ -1654,7 +1654,7 @@ public abstract class ScriptableObject
|
||||||
// Replace a non-base slot with a regular slot
|
// Replace a non-base slot with a regular slot
|
||||||
slot = new Slot(slot);
|
slot = new Slot(slot);
|
||||||
}
|
}
|
||||||
Object value = getProperty(desc, "value");
|
Object value = Scriptable.getProperty(desc, "value");
|
||||||
if (value != NOT_FOUND) {
|
if (value != NOT_FOUND) {
|
||||||
slot.value = value;
|
slot.value = value;
|
||||||
} else if (existing == null) {
|
} else if (existing == null) {
|
||||||
|
@ -1749,11 +1749,11 @@ public abstract class ScriptableObject
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void checkPropertyDefinition(ScriptableObject desc) {
|
protected void checkPropertyDefinition(ScriptableObject desc) {
|
||||||
Object getter = getProperty(desc, "get");
|
Object getter = Scriptable.getProperty(desc, "get");
|
||||||
if (getter != NOT_FOUND && getter != Undefined.instance && !(getter instanceof Callable)) {
|
if (getter != NOT_FOUND && getter != Undefined.instance && !(getter instanceof Callable)) {
|
||||||
throw ScriptRuntime.notFunctionError(getter);
|
throw ScriptRuntime.notFunctionError(getter);
|
||||||
}
|
}
|
||||||
Object setter = getProperty(desc, "set");
|
Object setter = Scriptable.getProperty(desc, "set");
|
||||||
if (setter != NOT_FOUND && setter != Undefined.instance && !(setter instanceof Callable)) {
|
if (setter != NOT_FOUND && setter != Undefined.instance && !(setter instanceof Callable)) {
|
||||||
throw ScriptRuntime.notFunctionError(setter);
|
throw ScriptRuntime.notFunctionError(setter);
|
||||||
}
|
}
|
||||||
|
@ -1767,10 +1767,10 @@ public abstract class ScriptableObject
|
||||||
if (!isExtensible()) throw ScriptRuntime.typeErrorById("msg.not.extensible");
|
if (!isExtensible()) throw ScriptRuntime.typeErrorById("msg.not.extensible");
|
||||||
} else {
|
} else {
|
||||||
if (isFalse(current.get("configurable", current))) {
|
if (isFalse(current.get("configurable", current))) {
|
||||||
if (isTrue(getProperty(desc, "configurable")))
|
if (isTrue(Scriptable.getProperty(desc, "configurable")))
|
||||||
throw ScriptRuntime.typeErrorById("msg.change.configurable.false.to.true", id);
|
throw ScriptRuntime.typeErrorById("msg.change.configurable.false.to.true", id);
|
||||||
if (isTrue(current.get("enumerable", current))
|
if (isTrue(current.get("enumerable", current))
|
||||||
!= isTrue(getProperty(desc, "enumerable")))
|
!= isTrue(Scriptable.getProperty(desc, "enumerable")))
|
||||||
throw ScriptRuntime.typeErrorById(
|
throw ScriptRuntime.typeErrorById(
|
||||||
"msg.change.enumerable.with.configurable.false", id);
|
"msg.change.enumerable.with.configurable.false", id);
|
||||||
boolean isData = isDataDescriptor(desc);
|
boolean isData = isDataDescriptor(desc);
|
||||||
|
@ -1779,21 +1779,25 @@ public abstract class ScriptableObject
|
||||||
// no further validation required for generic descriptor
|
// no further validation required for generic descriptor
|
||||||
} else if (isData && isDataDescriptor(current)) {
|
} else if (isData && isDataDescriptor(current)) {
|
||||||
if (isFalse(current.get("writable", current))) {
|
if (isFalse(current.get("writable", current))) {
|
||||||
if (isTrue(getProperty(desc, "writable")))
|
if (isTrue(Scriptable.getProperty(desc, "writable")))
|
||||||
throw ScriptRuntime.typeErrorById(
|
throw ScriptRuntime.typeErrorById(
|
||||||
"msg.change.writable.false.to.true.with.configurable.false",
|
"msg.change.writable.false.to.true.with.configurable.false",
|
||||||
id);
|
id);
|
||||||
|
|
||||||
if (!sameValue(getProperty(desc, "value"), current.get("value", current)))
|
if (!sameValue(
|
||||||
|
Scriptable.getProperty(desc, "value"),
|
||||||
|
current.get("value", current)))
|
||||||
throw ScriptRuntime.typeErrorById(
|
throw ScriptRuntime.typeErrorById(
|
||||||
"msg.change.value.with.writable.false", id);
|
"msg.change.value.with.writable.false", id);
|
||||||
}
|
}
|
||||||
} else if (isAccessor && isAccessorDescriptor(current)) {
|
} else if (isAccessor && isAccessorDescriptor(current)) {
|
||||||
if (!sameValue(getProperty(desc, "set"), current.get("set", current)))
|
if (!sameValue(
|
||||||
|
Scriptable.getProperty(desc, "set"), current.get("set", current)))
|
||||||
throw ScriptRuntime.typeErrorById(
|
throw ScriptRuntime.typeErrorById(
|
||||||
"msg.change.setter.with.configurable.false", id);
|
"msg.change.setter.with.configurable.false", id);
|
||||||
|
|
||||||
if (!sameValue(getProperty(desc, "get"), current.get("get", current)))
|
if (!sameValue(
|
||||||
|
Scriptable.getProperty(desc, "get"), current.get("get", current)))
|
||||||
throw ScriptRuntime.typeErrorById(
|
throw ScriptRuntime.typeErrorById(
|
||||||
"msg.change.getter.with.configurable.false", id);
|
"msg.change.getter.with.configurable.false", id);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1845,7 +1849,7 @@ public abstract class ScriptableObject
|
||||||
}
|
}
|
||||||
|
|
||||||
protected int applyDescriptorToAttributeBitset(int attributes, ScriptableObject desc) {
|
protected int applyDescriptorToAttributeBitset(int attributes, ScriptableObject desc) {
|
||||||
Object enumerable = getProperty(desc, "enumerable");
|
Object enumerable = Scriptable.getProperty(desc, "enumerable");
|
||||||
if (enumerable != NOT_FOUND) {
|
if (enumerable != NOT_FOUND) {
|
||||||
attributes =
|
attributes =
|
||||||
ScriptRuntime.toBoolean(enumerable)
|
ScriptRuntime.toBoolean(enumerable)
|
||||||
|
@ -1853,7 +1857,7 @@ public abstract class ScriptableObject
|
||||||
: attributes | DONTENUM;
|
: attributes | DONTENUM;
|
||||||
}
|
}
|
||||||
|
|
||||||
Object writable = getProperty(desc, "writable");
|
Object writable = Scriptable.getProperty(desc, "writable");
|
||||||
if (writable != NOT_FOUND) {
|
if (writable != NOT_FOUND) {
|
||||||
attributes =
|
attributes =
|
||||||
ScriptRuntime.toBoolean(writable)
|
ScriptRuntime.toBoolean(writable)
|
||||||
|
@ -1861,7 +1865,7 @@ public abstract class ScriptableObject
|
||||||
: attributes | READONLY;
|
: attributes | READONLY;
|
||||||
}
|
}
|
||||||
|
|
||||||
Object configurable = getProperty(desc, "configurable");
|
Object configurable = Scriptable.getProperty(desc, "configurable");
|
||||||
if (configurable != NOT_FOUND) {
|
if (configurable != NOT_FOUND) {
|
||||||
attributes =
|
attributes =
|
||||||
ScriptRuntime.toBoolean(configurable)
|
ScriptRuntime.toBoolean(configurable)
|
||||||
|
@ -1990,7 +1994,7 @@ public abstract class ScriptableObject
|
||||||
*/
|
*/
|
||||||
public static Scriptable getClassPrototype(Scriptable scope, String className) {
|
public static Scriptable getClassPrototype(Scriptable scope, String className) {
|
||||||
scope = getTopLevelScope(scope);
|
scope = getTopLevelScope(scope);
|
||||||
Object ctor = getProperty(scope, className);
|
Object ctor = Scriptable.getProperty(scope, className);
|
||||||
Object proto;
|
Object proto;
|
||||||
if (ctor instanceof BaseFunction) {
|
if (ctor instanceof BaseFunction) {
|
||||||
proto = ((BaseFunction) ctor).getPrototypeProperty();
|
proto = ((BaseFunction) ctor).getPrototypeProperty();
|
||||||
|
@ -2154,7 +2158,7 @@ public abstract class ScriptableObject
|
||||||
* @since 1.7R3
|
* @since 1.7R3
|
||||||
*/
|
*/
|
||||||
public static <T> T getTypedProperty(Scriptable s, int index, Class<T> type) {
|
public static <T> T getTypedProperty(Scriptable s, int index, Class<T> type) {
|
||||||
Object val = getProperty(s, index);
|
Object val = Scriptable.getProperty(s, index);
|
||||||
if (val == Scriptable.NOT_FOUND) {
|
if (val == Scriptable.NOT_FOUND) {
|
||||||
val = null;
|
val = null;
|
||||||
}
|
}
|
||||||
|
@ -2194,7 +2198,7 @@ public abstract class ScriptableObject
|
||||||
* @since 1.7R3
|
* @since 1.7R3
|
||||||
*/
|
*/
|
||||||
public static <T> T getTypedProperty(Scriptable s, String name, Class<T> type) {
|
public static <T> T getTypedProperty(Scriptable s, String name, Class<T> type) {
|
||||||
Object val = getProperty(s, name);
|
Object val = Scriptable.getProperty(s, name);
|
||||||
if (val == Scriptable.NOT_FOUND) {
|
if (val == Scriptable.NOT_FOUND) {
|
||||||
val = null;
|
val = null;
|
||||||
}
|
}
|
||||||
|
@ -2432,7 +2436,7 @@ public abstract class ScriptableObject
|
||||||
* @param args the arguments for the call
|
* @param args the arguments for the call
|
||||||
*/
|
*/
|
||||||
public static Object callMethod(Context cx, Scriptable obj, String methodName, Object[] args) {
|
public static Object callMethod(Context cx, Scriptable obj, String methodName, Object[] args) {
|
||||||
Object funObj = getProperty(obj, methodName);
|
Object funObj = Scriptable.getProperty(obj, methodName);
|
||||||
if (!(funObj instanceof Function)) {
|
if (!(funObj instanceof Function)) {
|
||||||
throw ScriptRuntime.notFunctionError(obj, methodName);
|
throw ScriptRuntime.notFunctionError(obj, methodName);
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,7 +101,7 @@ public class TopLevel extends IdScriptableObject {
|
||||||
public void cacheBuiltins(Scriptable scope, boolean sealed) {
|
public void cacheBuiltins(Scriptable scope, boolean sealed) {
|
||||||
ctors = new EnumMap<>(Builtins.class);
|
ctors = new EnumMap<>(Builtins.class);
|
||||||
for (Builtins builtin : Builtins.values()) {
|
for (Builtins builtin : Builtins.values()) {
|
||||||
Object value = ScriptableObject.getProperty(this, builtin.name());
|
Object value = Scriptable.getProperty(this, builtin.name());
|
||||||
if (value instanceof BaseFunction) {
|
if (value instanceof BaseFunction) {
|
||||||
ctors.put(builtin, (BaseFunction) value);
|
ctors.put(builtin, (BaseFunction) value);
|
||||||
} else if (builtin == Builtins.GeneratorFunction) {
|
} else if (builtin == Builtins.GeneratorFunction) {
|
||||||
|
@ -114,7 +114,7 @@ public class TopLevel extends IdScriptableObject {
|
||||||
}
|
}
|
||||||
errors = new EnumMap<>(NativeErrors.class);
|
errors = new EnumMap<>(NativeErrors.class);
|
||||||
for (NativeErrors error : NativeErrors.values()) {
|
for (NativeErrors error : NativeErrors.values()) {
|
||||||
Object value = ScriptableObject.getProperty(this, error.name());
|
Object value = Scriptable.getProperty(this, error.name());
|
||||||
if (value instanceof BaseFunction) {
|
if (value instanceof BaseFunction) {
|
||||||
errors.put(error, (BaseFunction) value);
|
errors.put(error, (BaseFunction) value);
|
||||||
}
|
}
|
||||||
|
|
|
@ -329,7 +329,7 @@ public class Require extends BaseFunction {
|
||||||
moduleScript.getScript().exec(cx, executionScope);
|
moduleScript.getScript().exec(cx, executionScope);
|
||||||
executeOptionalScript(postExec, cx, executionScope);
|
executeOptionalScript(postExec, cx, executionScope);
|
||||||
return ScriptRuntime.toObject(
|
return ScriptRuntime.toObject(
|
||||||
cx, nativeScope, ScriptableObject.getProperty(moduleObject, "exports"));
|
cx, nativeScope, Scriptable.getProperty(moduleObject, "exports"));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void executeOptionalScript(
|
private static void executeOptionalScript(
|
||||||
|
|
|
@ -56,7 +56,7 @@ public abstract class ModuleSourceProviderBase implements ModuleSourceProvider,
|
||||||
|
|
||||||
private ModuleSource loadFromPathArray(String moduleId, Scriptable paths, Object validator)
|
private ModuleSource loadFromPathArray(String moduleId, Scriptable paths, Object validator)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
final long llength = ScriptRuntime.toUint32(ScriptableObject.getProperty(paths, "length"));
|
final long llength = ScriptRuntime.toUint32(Scriptable.getProperty(paths, "length"));
|
||||||
// Yeah, I'll ignore entries beyond Integer.MAX_VALUE; so sue me.
|
// Yeah, I'll ignore entries beyond Integer.MAX_VALUE; so sue me.
|
||||||
int ilength = llength > Integer.MAX_VALUE ? Integer.MAX_VALUE : (int) llength;
|
int ilength = llength > Integer.MAX_VALUE ? Integer.MAX_VALUE : (int) llength;
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,6 @@ import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.StringTokenizer;
|
import java.util.StringTokenizer;
|
||||||
import org.mozilla.javascript.Scriptable;
|
import org.mozilla.javascript.Scriptable;
|
||||||
import org.mozilla.javascript.ScriptableObject;
|
|
||||||
import org.mozilla.javascript.UniqueTag;
|
import org.mozilla.javascript.UniqueTag;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -150,7 +149,7 @@ public class ScriptableOutputStream extends ObjectOutputStream {
|
||||||
Object result = scope;
|
Object result = scope;
|
||||||
while (st.hasMoreTokens()) {
|
while (st.hasMoreTokens()) {
|
||||||
String s = st.nextToken();
|
String s = st.nextToken();
|
||||||
result = ScriptableObject.getProperty((Scriptable) result, s);
|
result = Scriptable.getProperty((Scriptable) result, s);
|
||||||
if (result == null || !(result instanceof Scriptable)) break;
|
if (result == null || !(result instanceof Scriptable)) break;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -614,7 +614,7 @@ public abstract class NativeTypedArrayView<T> extends NativeArrayBufferView
|
||||||
return Undefined.instance;
|
return Undefined.instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
return getProperty(thisObj, (int) k);
|
return Scriptable.getProperty(thisObj, (int) k);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Scriptable typedArraySpeciesCreate(
|
private Scriptable typedArraySpeciesCreate(
|
||||||
|
|
|
@ -46,7 +46,7 @@ public abstract class XMLLib {
|
||||||
|
|
||||||
// Ensure lazily initialization of real XML library instance
|
// Ensure lazily initialization of real XML library instance
|
||||||
// which is done on first access to XML property
|
// which is done on first access to XML property
|
||||||
ScriptableObject.getProperty(so, "XML");
|
Scriptable.getProperty(so, "XML");
|
||||||
|
|
||||||
return (XMLLib) so.getAssociatedValue(XML_LIB_KEY);
|
return (XMLLib) so.getAssociatedValue(XML_LIB_KEY);
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,6 @@ import org.mozilla.javascript.Callable;
|
||||||
import org.mozilla.javascript.Context;
|
import org.mozilla.javascript.Context;
|
||||||
import org.mozilla.javascript.Script;
|
import org.mozilla.javascript.Script;
|
||||||
import org.mozilla.javascript.Scriptable;
|
import org.mozilla.javascript.Scriptable;
|
||||||
import org.mozilla.javascript.ScriptableObject;
|
|
||||||
|
|
||||||
public class Bug482203Test {
|
public class Bug482203Test {
|
||||||
|
|
||||||
|
@ -27,7 +26,7 @@ public class Bug482203Test {
|
||||||
script.exec(cx, scope);
|
script.exec(cx, scope);
|
||||||
int counter = 0;
|
int counter = 0;
|
||||||
for (; ; ) {
|
for (; ; ) {
|
||||||
Object cont = ScriptableObject.getProperty(scope, "c");
|
Object cont = Scriptable.getProperty(scope, "c");
|
||||||
if (cont == null) {
|
if (cont == null) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -35,7 +34,7 @@ public class Bug482203Test {
|
||||||
((Callable) cont).call(cx, scope, scope, new Object[] {null});
|
((Callable) cont).call(cx, scope, scope, new Object[] {null});
|
||||||
}
|
}
|
||||||
assertEquals(counter, 5);
|
assertEquals(counter, 5);
|
||||||
assertEquals(Double.valueOf(3), ScriptableObject.getProperty(scope, "result"));
|
assertEquals(Double.valueOf(3), Scriptable.getProperty(scope, "result"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,7 +49,7 @@ public class Bug482203Test {
|
||||||
cx.executeScriptWithContinuations(script, scope);
|
cx.executeScriptWithContinuations(script, scope);
|
||||||
int counter = 0;
|
int counter = 0;
|
||||||
for (; ; ) {
|
for (; ; ) {
|
||||||
Object cont = ScriptableObject.getProperty(scope, "c");
|
Object cont = Scriptable.getProperty(scope, "c");
|
||||||
if (cont == null) {
|
if (cont == null) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -58,7 +57,7 @@ public class Bug482203Test {
|
||||||
cx.resumeContinuation(cont, scope, null);
|
cx.resumeContinuation(cont, scope, null);
|
||||||
}
|
}
|
||||||
assertEquals(counter, 5);
|
assertEquals(counter, 5);
|
||||||
assertEquals(Double.valueOf(3), ScriptableObject.getProperty(scope, "result"));
|
assertEquals(Double.valueOf(3), Scriptable.getProperty(scope, "result"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,7 +72,7 @@ public class IterableTest {
|
||||||
@Override
|
@Override
|
||||||
public Object get(Symbol key, Scriptable start) {
|
public Object get(Symbol key, Scriptable start) {
|
||||||
if (SymbolKey.ITERATOR.equals(key)) {
|
if (SymbolKey.ITERATOR.equals(key)) {
|
||||||
return ScriptableObject.getProperty(
|
return Scriptable.getProperty(
|
||||||
ScriptableObject.getArrayPrototype(scope), SymbolKey.ITERATOR);
|
ScriptableObject.getArrayPrototype(scope), SymbolKey.ITERATOR);
|
||||||
}
|
}
|
||||||
throw new IllegalStateException();
|
throw new IllegalStateException();
|
||||||
|
|
|
@ -102,7 +102,7 @@ public class PrimitiveTypeScopeResolutionTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object readPropFoo(final Scriptable s) {
|
public Object readPropFoo(final Scriptable s) {
|
||||||
return ScriptableObject.getProperty(s, "foo");
|
return Scriptable.getProperty(s, "foo");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -79,9 +79,9 @@ public class WrapFactoryTest {
|
||||||
cx.evaluateString(scope, script, "", 1, null);
|
cx.evaluateString(scope, script, "", 1, null);
|
||||||
|
|
||||||
// evaluate result
|
// evaluate result
|
||||||
assertEquals(result, ScriptableObject.getProperty(scope, "result"));
|
assertEquals(result, Scriptable.getProperty(scope, "result"));
|
||||||
assertEquals(mapResult, ScriptableObject.getProperty(scope, "mapResult"));
|
assertEquals(mapResult, Scriptable.getProperty(scope, "mapResult"));
|
||||||
assertEquals(getResult, ScriptableObject.getProperty(scope, "getResult"));
|
assertEquals(getResult, Scriptable.getProperty(scope, "getResult"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче