/** * @see org.mozilla.javascript.Scriptable#setParentScope */ public void setParentScope(Scriptable parent) { obj.setParentScope(parent); } /**
/** * @see org.mozilla.javascript.Scriptable#setParentScope */ public void setParentScope(Scriptable parent) { obj.setParentScope(parent); } /**
/** * @see org.mozilla.javascript.Scriptable#setParentScope */ public void setParentScope(Scriptable parent) { obj.setParentScope(parent); } /**
/** * @see org.mozilla.javascript.Scriptable#setParentScope */ public void setParentScope(Scriptable parent) { obj.setParentScope(parent); } /**
/** * @see org.mozilla.javascript.Scriptable#setParentScope */ public void setParentScope(Scriptable parent) { obj.setParentScope(parent); } /**
/** * @see org.mozilla.javascript.Scriptable#setParentScope */ public void setParentScope(Scriptable parent) { obj.setParentScope(parent); } /**
Scriptable scope = context.newObject(global); scope.setPrototype(global); scope.setParentScope(null); NativeJavaTopPackage $packages = (NativeJavaTopPackage) global.get("Packages"); NativeJavaPackage $java = (NativeJavaPackage) $packages.get("java"); NativeJavaPackage $java_io = (NativeJavaPackage) $java.get("io"); ProxyNativeJavaPackage proxy$java = new ProxyNativeJavaPackage($java); ProxyNativeJavaPackage proxy$java_io = new ProxyNativeJavaPackage($java_io); proxy$java_io.put("File", scope, get(scope, "Packages." + PseudoFile.class.getName())); proxy$java_io.put("FileInputStream", scope, get(scope, "Packages." + PseudoFileInputStream.class.getName())); proxy$java_io.put("FileOutputStream", scope, get(scope, "Packages." + PseudoFileOutputStream.class.getName())); proxy$java.put("io", scope, proxy$java_io); scope.put("java", scope, proxy$java);
@Override public Object call(Context cx, Scriptable scope, Scriptable thisObj, Object[] args) { if ( args.length != 3 && args.length != 2 ) { throw new IllegalArgumentException(); } String code = (String) Context.toString(args[0]); Scriptable vmContext = (Scriptable) args[1]; String scriptName = (String) (args.length > 2 ? args[2] : "_RunInConext_NoName" ); ScriptableObject.putProperty(vmContext, "window", vmContext); vmContext.setParentScope(scope ); return cx.evaluateString(vmContext, code, scriptName, 0, null); } }
private Scriptable getScope(Scriptable rootScope) { Scriptable scope; Context ctx = Context.enter(); try { scope = ctx.newObject(rootScope); scope.setPrototype(rootScope); scope.setParentScope(null); } catch (Exception e) { throw new RuntimeException("Exception", e); } finally { Context.exit(); } return scope; }
void initAsConstructor(Scriptable scope, Scriptable prototype) { ScriptRuntime.setFunctionProtoAndParent(this, scope); setImmunePrototypeProperty(prototype); prototype.setParentScope(this); defineProperty(prototype, "constructor", this, ScriptableObject.DONTENUM | ScriptableObject.PERMANENT | ScriptableObject.READONLY); setParentScope(scope); }
void initAsConstructor(Scriptable scope, Scriptable prototype) { ScriptRuntime.setFunctionProtoAndParent(this, scope); setImmunePrototypeProperty(prototype); prototype.setParentScope(this); defineProperty(prototype, "constructor", this, ScriptableObject.DONTENUM | ScriptableObject.PERMANENT | ScriptableObject.READONLY); setParentScope(scope); }
void initAsConstructor(Scriptable scope, Scriptable prototype) { ScriptRuntime.setFunctionProtoAndParent(this, scope); setImmunePrototypeProperty(prototype); prototype.setParentScope(this); defineProperty(prototype, "constructor", this, ScriptableObject.DONTENUM | ScriptableObject.PERMANENT | ScriptableObject.READONLY); setParentScope(scope); }
void initAsConstructor(Scriptable scope, Scriptable prototype) { ScriptRuntime.setFunctionProtoAndParent(this, scope); setImmunePrototypeProperty(prototype); prototype.setParentScope(this); defineProperty(prototype, "constructor", this, ScriptableObject.DONTENUM | ScriptableObject.PERMANENT | ScriptableObject.READONLY); setParentScope(scope); }
@Override public Scriptable registerExports(Context cx, Scriptable global, NodeRuntime runtime) throws InvocationTargetException, IllegalAccessException, InstantiationException { Scriptable exp = cx.newObject(global); exp.setPrototype(global); exp.setParentScope(null); ScriptableObject.defineClass(exp, ContextImpl.class); ScriptableObject.defineClass(exp, ScriptImpl.class); return exp; }
void initAsConstructor(Scriptable scope, Scriptable prototype) { ScriptRuntime.setFunctionProtoAndParent(this, scope); setImmunePrototypeProperty(prototype); prototype.setParentScope(this); defineProperty(prototype, "constructor", this, ScriptableObject.DONTENUM | ScriptableObject.PERMANENT | ScriptableObject.READONLY); setParentScope(scope); }
void initAsConstructor(Scriptable scope, Scriptable prototype) { ScriptRuntime.setFunctionProtoAndParent(this, scope); setImmunePrototypeProperty(prototype); prototype.setParentScope(this); defineProperty(prototype, "constructor", this, ScriptableObject.DONTENUM | ScriptableObject.PERMANENT | ScriptableObject.READONLY); setParentScope(scope); }
/** * Creates new script object. * The default implementation of {@link #construct} uses the method to * to get the value for <tt>thisObj</tt> argument when invoking * {@link #call}. * The methos is allowed to return <tt>null</tt> to indicate that * {@link #call} will create a new object itself. In this case * {@link #construct} will set scope and prototype on the result * {@link #call} unless they are already set. */ public Scriptable createObject(Context cx, Scriptable scope) { Scriptable newInstance = new NativeObject(); newInstance.setPrototype(getClassPrototype()); newInstance.setParentScope(getParentScope()); return newInstance; }
/** * Creates new script object. * The default implementation of {@link #construct} uses the method to * to get the value for <tt>thisObj</tt> argument when invoking * {@link #call}. * The methos is allowed to return <tt>null</tt> to indicate that * {@link #call} will create a new object itself. In this case * {@link #construct} will set scope and prototype on the result * {@link #call} unless they are already set. */ public Scriptable createObject(Context cx, Scriptable scope) { Scriptable newInstance = new NativeObject(); newInstance.setPrototype(getClassPrototype()); newInstance.setParentScope(getParentScope()); return newInstance; }
private static Scriptable getScope() { if (RequestUtils.getRequest() != null) { if (RequestUtils.getAttribute(SCOPE_ATTRIBUTE) == null) { Context cx = Context.enter(); Scriptable requestScope = cx.newObject(scope); requestScope.setPrototype(scope); requestScope.setParentScope(null); RequestUtils.setAttribute(SCOPE_ATTRIBUTE, requestScope); Context.exit(); } return (Scriptable) RequestUtils.getAttribute(SCOPE_ATTRIBUTE); } return scope; }
private static Scriptable getScope() { if (RequestUtils.getRequest() != null) { if (RequestUtils.getAttribute(SCOPE_ATTRIBUTE) == null) { Context cx = Context.enter(); Scriptable requestScope = cx.newObject(scope); requestScope.setPrototype(scope); requestScope.setParentScope(null); RequestUtils.setAttribute(SCOPE_ATTRIBUTE, requestScope); Context.exit(); } return (Scriptable) RequestUtils.getAttribute(SCOPE_ATTRIBUTE); } return scope; }