public Scriptable getPrototype() { if (prototype == null && javaObject instanceof String) { return ScriptableObject.getClassPrototype(parent, "String"); } return prototype; }
/** * Get the Object.prototype property. * See ECMA 15.2.4. */ public static Scriptable getObjectPrototype(Scriptable scope) { return getClassPrototype(scope, "Object"); }
/** * Get the Function.prototype property. * See ECMA 15.3.4. */ public static Scriptable getFunctionPrototype(Scriptable scope) { return getClassPrototype(scope, "Function"); }
/** * Get the Function.prototype property. * See ECMA 15.3.4. */ public static Scriptable getFunctionPrototype(Scriptable scope) { return getClassPrototype(scope, "Function"); }
public Scriptable getPrototype() { if (prototype == null && javaObject instanceof String) { return ScriptableObject.getClassPrototype(parent, "String"); } return prototype; }
/** * Get the Object.prototype property. * See ECMA 15.2.4. */ public static Scriptable getObjectPrototype(Scriptable scope) { return getClassPrototype(scope, "Object"); }
public static Scriptable getClassPrototype(Scriptable scope, String className) { return ScriptableObject.getClassPrototype(scope, className); }
@Override public Scriptable getPrototype() { if (prototype == null) { prototype = ScriptableObject.getClassPrototype(this.getParentScope(), "Array"); } return prototype; }
public Scriptable getPrototype() { if (prototype == null) { prototype = ScriptableObject.getClassPrototype(this.getParentScope(), "Array"); } return prototype; }
public static void setObjectProtoAndParent(ScriptableObject object, Scriptable scope) { // Compared with function it always sets the scope to top scope scope = ScriptableObject.getTopLevelScope(scope); object.setParentScope(scope); Scriptable proto = ScriptableObject.getClassPrototype(scope, object.getClassName()); object.setPrototype(proto); }
public static void setObjectProtoAndParent(ScriptableObject object, Scriptable scope) { // Compared with function it always sets the scope to top scope scope = ScriptableObject.getTopLevelScope(scope); object.setParentScope(scope); Scriptable proto = ScriptableObject.getClassPrototype(scope, object.getClassName()); object.setPrototype(proto); }
public static void setObjectProtoAndParent(ScriptableObject object, Scriptable scope) { // Compared with function it always sets the scope to top scope scope = ScriptableObject.getTopLevelScope(scope); object.setParentScope(scope); Scriptable proto = ScriptableObject.getClassPrototype(scope, object.getClassName()); object.setPrototype(proto); }
public static void setObjectProtoAndParent(ScriptableObject object, Scriptable scope) { // Compared with function it always sets the scope to top scope scope = ScriptableObject.getTopLevelScope(scope); object.setParentScope(scope); Scriptable proto = ScriptableObject.getClassPrototype(scope, object.getClassName()); object.setPrototype(proto); }
public static void setObjectProtoAndParent(ScriptableObject object, Scriptable scope) { // Compared with function it always sets the scope to top scope scope = ScriptableObject.getTopLevelScope(scope); object.setParentScope(scope); Scriptable proto = ScriptableObject.getClassPrototype(scope, object.getClassName()); object.setPrototype(proto); }
public static void setObjectProtoAndParent(ScriptableObject object, Scriptable scope) { // Compared with function it always sets the scope to top scope scope = ScriptableObject.getTopLevelScope(scope); object.setParentScope(scope); Scriptable proto = ScriptableObject.getClassPrototype(scope, object.getClassName()); object.setPrototype(proto); }
public void setupPackages(ClassLoader cl) throws Exception { final String JAVA_PACKAGE = "JavaPackage"; if (classLoader != cl) { classLoader = cl; Scriptable newPackages = new NativeJavaPackage("", cl); newPackages.setParentScope(this); newPackages.setPrototype(ScriptableObject.getClassPrototype(this, JAVA_PACKAGE)); super.put("Packages", this, newPackages); for (int i = 0; i < BUILTIN_PACKAGES.length; i++) { String pkgName = BUILTIN_PACKAGES[i]; Scriptable pkg = new NativeJavaPackage(pkgName, cl); pkg.setParentScope(this); pkg.setPrototype(ScriptableObject.getClassPrototype(this, JAVA_PACKAGE)); super.put(pkgName, this, pkg); } } }
public PageLocal createPageLocal() { PageLocalImpl pageLocal = new PageLocalImpl(); pageLocal.setPrototype(ScriptableObject.getClassPrototype(scope, pageLocal.getClassName())); pageLocal.setParentScope(scope); pageLocal.setPageLocalScope(this); return pageLocal; } }
public Object getObject() { Scriptable newPackages; Context.enter(); try { final String JAVA_PACKAGE = "JavaPackage"; ClassLoader cl = Thread.currentThread().getContextClassLoader(); // FIXME - NativeJavaPackage is an internal class which we should not use newPackages = new NativeJavaPackage( "", cl ); newPackages.setParentScope( getScope() ); newPackages.setPrototype( ScriptableObject.getClassPrototype( getScope(), JAVA_PACKAGE ) ); //objectModel.put( "Packages", newPackages ); //objectModel.put( "java", ScriptableObject.getProperty( getScope(), "java" ) ); } finally { Context.exit(); } return newPackages; }
static Object newWithSpecial(Context cx, Scriptable scope, Object[] args) { ScriptRuntime.checkDeprecated(cx, "With"); scope = ScriptableObject.getTopLevelScope(scope); NativeWith thisObj = new NativeWith(); thisObj.setPrototype(args.length == 0 ? ScriptableObject.getClassPrototype(scope, "Object") : ScriptRuntime.toObject(cx, scope, args[0])); thisObj.setParentScope(scope); return thisObj; }
static Object newWithSpecial(Context cx, Scriptable scope, Object[] args) { ScriptRuntime.checkDeprecated(cx, "With"); scope = ScriptableObject.getTopLevelScope(scope); NativeWith thisObj = new NativeWith(); thisObj.setPrototype(args.length == 0 ? ScriptableObject.getClassPrototype(scope, "Object") : ScriptRuntime.toObject(cx, scope, args[0])); thisObj.setParentScope(scope); return thisObj; }