зеркало из https://github.com/mozilla/gecko-dev.git
I removed unused Context argument from various SomeObject.init methods to decrease code bloat.
This commit is contained in:
Родитель
5e7a43bfe2
Коммит
8e479120c0
|
@ -48,7 +48,7 @@ public class BaseFunction extends IdScriptableObject implements Function
|
|||
|
||||
private static final Object FUNCTION_TAG = new Object();
|
||||
|
||||
static void init(Context cx, Scriptable scope, boolean sealed)
|
||||
static void init(Scriptable scope, boolean sealed)
|
||||
{
|
||||
BaseFunction obj = new BaseFunction();
|
||||
obj.isPrototypePropertyImmune = true;
|
||||
|
|
|
@ -64,7 +64,7 @@ public class NativeArray extends IdScriptableObject
|
|||
|
||||
private static final Object ARRAY_TAG = new Object();
|
||||
|
||||
static void init(Context cx, Scriptable scope, boolean sealed)
|
||||
static void init(Scriptable scope, boolean sealed)
|
||||
{
|
||||
NativeArray obj = new NativeArray();
|
||||
obj.exportAsJSClass(MAX_PROTOTYPE_ID, scope, sealed);
|
||||
|
|
|
@ -46,7 +46,7 @@ final class NativeBoolean extends IdScriptableObject
|
|||
{
|
||||
private static final Object BOOLEAN_TAG = new Object();
|
||||
|
||||
static void init(Context cx, Scriptable scope, boolean sealed)
|
||||
static void init(Scriptable scope, boolean sealed)
|
||||
{
|
||||
NativeBoolean obj = new NativeBoolean(false);
|
||||
obj.exportAsJSClass(MAX_PROTOTYPE_ID, scope, sealed);
|
||||
|
|
|
@ -47,7 +47,7 @@ public final class NativeCall extends IdScriptableObject
|
|||
{
|
||||
private static final Object CALL_TAG = new Object();
|
||||
|
||||
static void init(Context cx, Scriptable scope, boolean sealed)
|
||||
static void init(Scriptable scope, boolean sealed)
|
||||
{
|
||||
NativeCall obj = new NativeCall();
|
||||
obj.exportAsJSClass(MAX_PROTOTYPE_ID, scope, sealed);
|
||||
|
|
|
@ -54,7 +54,7 @@ final class NativeDate extends IdScriptableObject
|
|||
|
||||
private static final String js_NaN_date_str = "Invalid Date";
|
||||
|
||||
static void init(Context cx, Scriptable scope, boolean sealed)
|
||||
static void init(Scriptable scope, boolean sealed)
|
||||
{
|
||||
NativeDate obj = new NativeDate();
|
||||
// Set the value of the prototype Date to NaN ('invalid date');
|
||||
|
|
|
@ -47,7 +47,7 @@ final class NativeError extends IdScriptableObject
|
|||
{
|
||||
private static final Object ERROR_TAG = new Object();
|
||||
|
||||
static void init(Context cx, Scriptable scope, boolean sealed)
|
||||
static void init(Scriptable scope, boolean sealed)
|
||||
{
|
||||
NativeError obj = new NativeError();
|
||||
ScriptableObject.putProperty(obj, "name", "Error");
|
||||
|
|
|
@ -46,7 +46,7 @@ final class NativeMath extends IdScriptableObject
|
|||
{
|
||||
private static final Object MATH_TAG = new Object();
|
||||
|
||||
static void init(Context cx, Scriptable scope, boolean sealed)
|
||||
static void init(Scriptable scope, boolean sealed)
|
||||
{
|
||||
NativeMath obj = new NativeMath();
|
||||
obj.activatePrototypeMap(MAX_ID);
|
||||
|
|
|
@ -50,7 +50,7 @@ final class NativeNumber extends IdScriptableObject
|
|||
|
||||
private static final int MAX_PRECISION = 100;
|
||||
|
||||
static void init(Context cx, Scriptable scope, boolean sealed)
|
||||
static void init(Scriptable scope, boolean sealed)
|
||||
{
|
||||
NativeNumber obj = new NativeNumber(0.0);
|
||||
obj.exportAsJSClass(MAX_PROTOTYPE_ID, scope, sealed);
|
||||
|
|
|
@ -46,7 +46,7 @@ public class NativeObject extends IdScriptableObject
|
|||
{
|
||||
private static final Object OBJECT_TAG = new Object();
|
||||
|
||||
public static void init(Context cx, Scriptable scope, boolean sealed)
|
||||
static void init(Scriptable scope, boolean sealed)
|
||||
{
|
||||
NativeObject obj = new NativeObject();
|
||||
obj.exportAsJSClass(MAX_PROTOTYPE_ID, scope, sealed);
|
||||
|
|
|
@ -59,7 +59,7 @@ class NativeScript extends BaseFunction
|
|||
{
|
||||
private static final Object SCRIPT_TAG = new Object();
|
||||
|
||||
static void init(Context cx, Scriptable scope, boolean sealed)
|
||||
static void init(Scriptable scope, boolean sealed)
|
||||
{
|
||||
NativeScript obj = new NativeScript(null);
|
||||
obj.exportAsJSClass(MAX_PROTOTYPE_ID, scope, sealed);
|
||||
|
|
|
@ -54,7 +54,7 @@ final class NativeString extends IdScriptableObject
|
|||
|
||||
private static final Object STRING_TAG = new Object();
|
||||
|
||||
static void init(Context cx, Scriptable scope, boolean sealed)
|
||||
static void init(Scriptable scope, boolean sealed)
|
||||
{
|
||||
NativeString obj = new NativeString("");
|
||||
obj.exportAsJSClass(MAX_PROTOTYPE_ID, scope, sealed);
|
||||
|
|
|
@ -44,7 +44,8 @@ package org.mozilla.javascript;
|
|||
*/
|
||||
public class NativeWith implements Scriptable, IdFunctionCall {
|
||||
|
||||
static void init(Context cx, Scriptable scope, boolean sealed) {
|
||||
static void init(Scriptable scope, boolean sealed)
|
||||
{
|
||||
NativeWith obj = new NativeWith();
|
||||
|
||||
obj.setParentScope(scope);
|
||||
|
|
|
@ -130,8 +130,8 @@ public class ScriptRuntime {
|
|||
scope.associateValue(LIBRARY_SCOPE_KEY, scope);
|
||||
(new ClassCache()).associate(scope);
|
||||
|
||||
BaseFunction.init(cx, scope, sealed);
|
||||
NativeObject.init(cx, scope, sealed);
|
||||
BaseFunction.init(scope, sealed);
|
||||
NativeObject.init(scope, sealed);
|
||||
|
||||
Scriptable objectProto = ScriptableObject.getObjectPrototype(scope);
|
||||
|
||||
|
@ -144,19 +144,19 @@ public class ScriptRuntime {
|
|||
scope.setPrototype(objectProto);
|
||||
|
||||
// must precede NativeGlobal since it's needed therein
|
||||
NativeError.init(cx, scope, sealed);
|
||||
NativeError.init(scope, sealed);
|
||||
NativeGlobal.init(cx, scope, sealed);
|
||||
|
||||
NativeArray.init(cx, scope, sealed);
|
||||
NativeString.init(cx, scope, sealed);
|
||||
NativeBoolean.init(cx, scope, sealed);
|
||||
NativeNumber.init(cx, scope, sealed);
|
||||
NativeDate.init(cx, scope, sealed);
|
||||
NativeMath.init(cx, scope, sealed);
|
||||
NativeArray.init(scope, sealed);
|
||||
NativeString.init(scope, sealed);
|
||||
NativeBoolean.init(scope, sealed);
|
||||
NativeNumber.init(scope, sealed);
|
||||
NativeDate.init(scope, sealed);
|
||||
NativeMath.init(scope, sealed);
|
||||
|
||||
NativeWith.init(cx, scope, sealed);
|
||||
NativeCall.init(cx, scope, sealed);
|
||||
NativeScript.init(cx, scope, sealed);
|
||||
NativeWith.init(scope, sealed);
|
||||
NativeCall.init(scope, sealed);
|
||||
NativeScript.init(scope, sealed);
|
||||
|
||||
boolean withXml = cx.hasFeature(Context.FEATURE_E4X);
|
||||
|
||||
|
@ -169,7 +169,7 @@ public class ScriptRuntime {
|
|||
new LazilyLoadedCtor(scope, topProperty, className, sealed);
|
||||
}
|
||||
|
||||
Continuation.init(cx, scope, sealed);
|
||||
Continuation.init(scope, sealed);
|
||||
|
||||
return scope;
|
||||
}
|
||||
|
@ -669,10 +669,11 @@ public class ScriptRuntime {
|
|||
|
||||
static String defaultObjectToString(Scriptable obj)
|
||||
{
|
||||
return "[object " + obj.getClassName() + "]";
|
||||
return "[object " + obj.getClassName() + ']';
|
||||
}
|
||||
|
||||
public static String toString(Object[] args, int index) {
|
||||
public static String toString(Object[] args, int index)
|
||||
{
|
||||
return (index < args.length) ? toString(args[index]) : "undefined";
|
||||
}
|
||||
|
||||
|
@ -2418,8 +2419,9 @@ public class ScriptRuntime {
|
|||
}
|
||||
}
|
||||
|
||||
public static Object toPrimitive(Object val) {
|
||||
if (val == null || !(val instanceof Scriptable)) {
|
||||
private static Object toPrimitive(Object val)
|
||||
{
|
||||
if (!(val instanceof Scriptable)) {
|
||||
return val;
|
||||
}
|
||||
Scriptable s = (Scriptable)val;
|
||||
|
@ -2707,13 +2709,7 @@ public class ScriptRuntime {
|
|||
Constructor globalClassCtor = globalClass.getConstructor(parm);
|
||||
Object[] arg = { cx };
|
||||
return (ScriptableObject) globalClassCtor.newInstance(arg);
|
||||
} catch (NoSuchMethodException e) {
|
||||
// fall through...
|
||||
} catch (InvocationTargetException e) {
|
||||
// fall through...
|
||||
} catch (IllegalAccessException e) {
|
||||
// fall through...
|
||||
} catch (InstantiationException e) {
|
||||
} catch (Exception e) {
|
||||
// fall through...
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ public final class Continuation extends IdScriptableObject implements Function
|
|||
|
||||
private Object implementation;
|
||||
|
||||
public static void init(Context cx, Scriptable scope, boolean sealed)
|
||||
public static void init(Scriptable scope, boolean sealed)
|
||||
{
|
||||
Continuation obj = new Continuation();
|
||||
obj.exportAsJSClass(MAX_PROTOTYPE_ID, scope, sealed);
|
||||
|
|
Загрузка…
Ссылка в новой задаче