Package org.mozilla.javascript

Examples of org.mozilla.javascript.Scriptable


            }
           
            public Object invoke(Object thisArg) throws Exception {
                org.mozilla.javascript.Context.enter();
                try {
                    Scriptable thisObj;
                    if (!(thisArg instanceof Scriptable)) {
                        thisObj = org.mozilla.javascript.Context.toObject(thisArg, scope);
                    } else {
                        thisObj = (Scriptable)thisArg;
                    }
View Full Code Here


            }
           
            public Object invoke(Object thisArg, Object rhs) throws Exception {
                org.mozilla.javascript.Context.enter();
                try {
                    Scriptable thisObj;
                    Object arg = rhs;
                    if (!(thisArg instanceof Scriptable)) {
                        thisObj = org.mozilla.javascript.Context.toObject(thisArg, scope);
                    } else {
                        thisObj = (Scriptable)thisArg;
View Full Code Here

        Context.setCachingEnabled(true)// enable caching again
        // entering a context
        Context ctx = enterContext();
        try {
            try {
                Scriptable scriptable = ctx.initStandardObjects(null, false);
                ScriptableObject.defineClass(scriptable, WindowWrapper.class);
            } catch (Exception e) {
                // cannot happen
            }
            // we now have the window object as the global object from the
View Full Code Here

        try {
            if (name.equals(BIND_NAME_WINDOW) && object instanceof Window) {
                ((WindowWrapper)globalObject).window = (Window)object;
            } else {
                Scriptable jsObject =  Context.toObject(object, globalObject);
                globalObject.put(name, globalObject, jsObject);
            }

        } finally {
            Context.exit();
View Full Code Here

    public void bindObject(String name, Object object) {
        Context ctx = enterContext();

        ctx.setWrapHandler(wrapHandler);
        try {
            Scriptable jsObject =  Context.toObject(object, globalObject);
            globalObject.put(name, globalObject, jsObject);
        } finally {
            Context.exit();
        }
View Full Code Here

        Context cx = Context.enter();
        try {

            Object xml = cx.getWrapFactory().wrap(cx, scope, xmlObject, XmlObject.class);
            Scriptable jsXML = cx.newObject(scope, "XML", new Object[] { xml });

            return jsXML;

        } finally {
            Context.exit();
View Full Code Here

     */
    public Object invoke(String functionName, Object[] args, Class responseClass, Map contexts) {
        Context cx = Context.enter();
        try {
            Function function = getFunction(scriptScope, functionName);
            Scriptable invocationScope = getInvocationScope(cx, contexts);
            Object[] jsArgs = processArgs(functionName, args, invocationScope);
            Object jsResponse = function.call(cx, invocationScope, invocationScope, jsArgs);
            Object response = processResponse(functionName, jsResponse, responseClass);
            return response;
        } finally {
View Full Code Here

     * shared scope otherwise a new scope is created to hold the context objects. Any new variables the executing script
     * might define will go in the sharedScope. This new scope is just to hold the wire specific context objects.
     */
    protected Scriptable getInvocationScope(Context cx, Map contexts) {

        Scriptable scope;
        if (contexts == null || contexts.size() == 0) {
            scope = sharedScope;
        } else {
            scope = cx.newObject(sharedScope);
            scope.setPrototype(sharedScope);
            scope.setParentScope(null);
            addContexts(scope, contexts);
        }

        return scope;
    }
View Full Code Here

    public Object jsFunction_load(String filename) throws JavaScriptException
    {
        org.mozilla.javascript.Context cx =
            org.mozilla.javascript.Context.getCurrentContext();
        try {
            Scriptable scope = getParentScope();
            Script script = interpreter.compileScript(cx, environment, filename);
            return script.exec(cx, scope);
        } catch (JavaScriptException e) {
            throw e;
        } catch (Exception e) {
View Full Code Here

    }

    public int getLength() {
        Object obj = getBaseValue();
        if (obj instanceof Scriptable) {
            Scriptable node = (Scriptable)obj;
            if (node instanceof NativeArray) {
                return (int)((NativeArray)node).jsGet_length();
            }
            if (ScriptableObject.hasProperty(node, "length")) {
                Object val = ScriptableObject.getProperty(node, "length");
View Full Code Here

TOP

Related Classes of org.mozilla.javascript.Scriptable

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.