Package org.mozilla.javascript

Examples of org.mozilla.javascript.Function.call()


                self.runtime.enqueueTask(new ScriptTask() {
                    @Override
                    public void execute(Context cx, Scriptable scope)
                    {
                        if (cb != null) {
                            cb.call(cx, cb, self, ScriptRuntime.emptyArgs);
                        }
                        self.clearPin();
                    }
                }, domain);
            }
View Full Code Here


            if (log.isDebugEnabled()) {
                log.debug("Error closing inbound SSLEngine: {}", ssle);
            }
        }
        if (cb != null) {
            cb.call(cx, thisObj, thisObj, ScriptRuntime.emptyArgs);
        }
        // Force the "unwrap" callback to deliver EOF to the other side in Node.js land
        self.doUnwrap(cx);
        // And run the regular encode loop because we still want to (futily) wrap in this case.
        self.encodeLoop(cx);
View Full Code Here

        if (result.bytesProduced() > 0) {
            // Deliver write callback in JavaScript after we are happy with reading
            deliverWriteBuffer(cx, wasShutdown, writeCallback);
        } else if (writeCallback != null) {
            writeCallback.call(cx, this, this, ScriptRuntime.emptyArgs);
        }

        return (result.getStatus() == SSLEngineResult.Status.OK);
    }
View Full Code Here

            if (self.inflating) {
                try {
                    self.inflate(cx, chunk, flushFlag, cb);
                } catch (DataFormatException e) {
                    cb.call(cx, thisObj, thisObj,
                            new Object[] { Utils.makeErrorObject(cx, thisObj, e.getMessage()) });
                }
            } else {
                self.deflate(cx, chunk, flushFlag, cb);
            }
View Full Code Here

        {
            if (callback != null) {
                // Set to null first because the callback might end up right back here...
                Function cb = callback;
                callback = null;
                cb.call(cx, cb, scope, ScriptRuntime.emptyArgs);
            }
        }

        void deliverCallback(Context cx, Scriptable scope, Scriptable err)
        {
View Full Code Here

        void deliverCallback(Context cx, Scriptable scope, Scriptable err)
        {
            if (callback != null) {
                Function cb = callback;
                callback = null;
                cb.call(cx, cb, scope, new Object[] { err });
            }
        }
    }
}
View Full Code Here

        private void deliverWriteCallback(Context cx, Scriptable req, String err)
        {
            Object onComplete = ScriptableObject.getProperty(req, "oncomplete");
            if ((onComplete != null) && !Undefined.instance.equals(onComplete)) {
                Function afterWrite = (Function)onComplete;
                afterWrite.call(cx, afterWrite, this,
                                new Object[] { (err == null ? Undefined.instance : err), this, req });
            }
        }

        @Override
View Full Code Here

            } catch (GeneralSecurityException gse) {
                if (callback == null) {
                    throw Utils.makeError(cx, thisObj, gse.toString());
                } else {
                    callback.call(cx, thisObj, null,
                                  new Object[] { Utils.makeErrorObject(cx, thisObj, gse.toString()) });
                    return null;
                }
            }
View Full Code Here

            Buffer.BufferImpl keyBuf = Buffer.BufferImpl.newBuffer(cx, thisObj, key.getEncoded());
            if (callback == null) {
                return keyBuf;
            }
            callback.call(cx, thisObj, null,
                          new Object[] { Context.getUndefinedValue(), keyBuf });
            return null;
        }

        private void setRuntime(NodeRuntime runtime) {
View Full Code Here

                Object[] args = new Object[1];
                Scriptable scope = getTopLevelScope(this);
                Scriptable thisObj = scope;
                Context cx = Context.getCurrentContext();
                args[0] = this;
                fun.call(cx, scope, thisObj, args);
            } catch (Exception exc) {
                throw Context.reportRuntimeError(exc.getMessage());
            }
        }
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.