Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (101)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (309)
Collections:
Other Resources:
Rhino JavaScript Java Library Source Code
Rhino JavaScript Java Library is an open-source implementation of JavaScript written entirely in Java.
Rhino JavaScript Java Library Source Code files are provided in binary package (rhino-1.7.14.zip).
You can also browse the source code below:
✍: FYIcenter.com
⏎ org/mozilla/javascript/InterpretedFunction.java
/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ package org.mozilla.javascript; import org.mozilla.javascript.debug.DebuggableScript; final class InterpretedFunction extends NativeFunction implements Script { private static final long serialVersionUID = 541475680333911468L; InterpreterData idata; SecurityController securityController; Object securityDomain; private InterpretedFunction(InterpreterData idata, Object staticSecurityDomain) { this.idata = idata; // Always get Context from the current thread to // avoid security breaches via passing mangled Context instances // with bogus SecurityController Context cx = Context.getContext(); SecurityController sc = cx.getSecurityController(); Object dynamicDomain; if (sc != null) { dynamicDomain = sc.getDynamicSecurityDomain(staticSecurityDomain); } else { if (staticSecurityDomain != null) { throw new IllegalArgumentException(); } dynamicDomain = null; } this.securityController = sc; this.securityDomain = dynamicDomain; } private InterpretedFunction(InterpretedFunction parent, int index) { this.idata = parent.idata.itsNestedFunctions[index]; this.securityController = parent.securityController; this.securityDomain = parent.securityDomain; } /** Create script from compiled bytecode. */ static InterpretedFunction createScript(InterpreterData idata, Object staticSecurityDomain) { InterpretedFunction f; f = new InterpretedFunction(idata, staticSecurityDomain); return f; } /** Create function compiled from Function(...) constructor. */ static InterpretedFunction createFunction( Context cx, Scriptable scope, InterpreterData idata, Object staticSecurityDomain) { InterpretedFunction f; f = new InterpretedFunction(idata, staticSecurityDomain); f.initScriptFunction(cx, scope, f.idata.isES6Generator); return f; } /** Create function embedded in script or another function. */ static InterpretedFunction createFunction( Context cx, Scriptable scope, InterpretedFunction parent, int index) { InterpretedFunction f = new InterpretedFunction(parent, index); f.initScriptFunction(cx, scope, f.idata.isES6Generator); return f; } @Override public String getFunctionName() { return (idata.itsName == null) ? "" : idata.itsName; } /** * Calls the function. * * @param cx the current context * @param scope the scope used for the call * @param thisObj the value of "this" * @param args function arguments. Must not be null. You can use {@link ScriptRuntime#emptyArgs} * to pass empty arguments. * @return the result of the function call. */ @Override public Object call(Context cx, Scriptable scope, Scriptable thisObj, Object[] args) { if (!ScriptRuntime.hasTopCall(cx)) { return ScriptRuntime.doTopCall(this, cx, scope, thisObj, args, idata.isStrict); } return Interpreter.interpret(this, cx, scope, thisObj, args); } @Override public Object exec(Context cx, Scriptable scope) { if (!isScript()) { // Can only be applied to scripts throw new IllegalStateException(); } Object ret; if (!ScriptRuntime.hasTopCall(cx)) { // It will go through "call" path. but they are equivalent ret = ScriptRuntime.doTopCall( this, cx, scope, scope, ScriptRuntime.emptyArgs, idata.isStrict); } else { ret = Interpreter.interpret(this, cx, scope, scope, ScriptRuntime.emptyArgs); } cx.processMicrotasks(); return ret; } public boolean isScript() { return idata.itsFunctionType == 0; } @Override public String getEncodedSource() { return Interpreter.getEncodedSource(idata); } @Override public DebuggableScript getDebuggableView() { return idata; } @Override public Object resumeGenerator( Context cx, Scriptable scope, int operation, Object state, Object value) { return Interpreter.resumeGenerator(cx, scope, operation, state, value); } @Override protected int getLanguageVersion() { return idata.languageVersion; } @Override protected int getParamCount() { return idata.argCount; } @Override protected int getParamAndVarCount() { return idata.argNames.length; } @Override protected String getParamOrVarName(int index) { return idata.argNames[index]; } @Override protected boolean getParamOrVarConst(int index) { return idata.argIsConst[index]; } boolean hasFunctionNamed(String name) { for (int f = 0; f < idata.getFunctionCount(); f++) { InterpreterData functionData = (InterpreterData) idata.getFunction(f); if (!functionData.declaredAsFunctionExpression && name.equals(functionData.getFunctionName())) { return false; } } return true; } }
⏎ org/mozilla/javascript/InterpretedFunction.java
Or download all of them as a single archive file:
File name: rhino-1.7.14-sources.jar File size: 1029165 bytes Release date: 2022-01-06 Download
⇒ Example code to Test rhino-runtime-1.7.14.jar
⇐ Download Rhino JavaScript Binary Package
2022-05-03, 35437👍, 1💬
Popular Posts:
What Is fop.jar? I got it from the fop-2.7-bin.zip. fop.jar in fop-2.7-bin.zip is the JAR file for F...
commons-io-2.6-sources.j aris the source JAR file for Apache Commons IO 2.6, which is a library of u...
JDK 11 jdk.internal.le.jmod is the JMOD file for JDK 11 Internal Line Editing module. JDK 11 Interna...
Apache Avalon began in 1999 as the Java Apache Server Framework and in late 2002 separated from the ...
How to merge two JAR files with "jar" commands? I am tired of specifying multiple JAR files in the c...