This is an automated email from the ASF dual-hosted git repository. jimjag pushed a commit to branch rhino-upgrade in repository https://gitbox.apache.org/repos/asf/openoffice.git
commit f4e04fb368952be2bb231a4de5c4ae01a9a93361 Author: Jim Jagielski <[email protected]> AuthorDate: Fri Nov 6 14:56:41 2026 -0500 rhino: upgrade to 1.7.15.1 1.7.15.1 is the newest release that still targets Java 8; 1.8.0 and later need Java 11. Upstream builds with Gradle now, so the patch adds its own build.xml and build.properties. js.jar is everything under src except the JSR-223 engine, which matches what Gradle's jar task produces. The XXE and toFixed patches are dropped, since upstream handles both (secure XML parsing is on by default, toFixed uses DecimalFormatter). The debugger changes and the DefiningClassLoader context loader fallback are ported to the reformatted sources. Built through dmake with JDK 8. The ES6 smoke tests pass, and the Rhino calls the script provider and editor make compile and run. Yes, this is fragile, but the best we can do without Gradle. --- main/external_deps.lst | 6 +- main/rhino/README | 17 +- main/rhino/makefile.mk | 12 +- main/rhino/prj/d.lst | 2 +- .../rhino/rhino-1.7.15.1-definingclassloader.patch | 62 +++ main/rhino/rhino-1.7.7.2-definingclassloader.patch | 66 --- main/rhino/rhino-1.7.7.2-main.patch | 38 -- main/rhino/rhino-1.7.7.2-tofixed-fix.patch | 43 -- main/rhino/rhino-1.7.7.2-xxe-fix.patch | 61 --- .../{rhino1_7_7_2.patch => rhino1_7_15_1.patch} | 441 ++++++++------------- main/rhino/rhino1_7_7_2-java-version.patch | 14 - 11 files changed, 237 insertions(+), 525 deletions(-) diff --git a/main/external_deps.lst b/main/external_deps.lst index 2f754194b5..4e02cbfad0 100644 --- a/main/external_deps.lst +++ b/main/external_deps.lst @@ -305,9 +305,9 @@ if (ENABLE_CATEGORY_B==YES && SYSTEM_HUNSPELL!=YES) URL2 = $(OOO_EXTRAS)$(MD5)-$(name) if (ENABLE_CATEGORY_B==YES && SOLAR_JAVA==TRUE && ENABLE_JAVASCRIPT==YES) - MD5 = afcf570784ebd919c1d484a6d0d3fcd6 - name = rhino1_7_7_2.zip - URL1 = https://github.com/mozilla/rhino/releases/download/Rhino1_7_7_2_Release/rhino-1.7.7.2.zip + MD5 = b98c6c3ec884277f253028abf91d257b + name = rhino1_7_15_1.zip + URL1 = https://github.com/mozilla/rhino/releases/download/Rhino1_7_15_1_Release/rhino-1.7.15.1.zip URL2 = $(OOO_EXTRAS)$(MD5)-$(name) if (ENABLE_CATEGORY_B==YES && ENABLE_NSS_MODULE==YES) diff --git a/main/rhino/README b/main/rhino/README index c077e63aa1..6225ef37fd 100644 --- a/main/rhino/README +++ b/main/rhino/README @@ -2,25 +2,28 @@ The Scripting Framework makes use of the Rhino (http://www.mozilla.org/rhino/) JavaScript interpreter, available under the Mozilla Public License 2.0 (http://www.mozilla.org/MPL/2.0/). -Rhino version: 1.7.7.2 -Source archive: https://github.com/mozilla/rhino/releases/download/Rhino1_7_7_2_Release/rhino-1.7.7.2.zip +Rhino version: 1.7.15.1 +Source archive: https://github.com/mozilla/rhino/releases/download/Rhino1_7_15_1_Release/rhino-1.7.15.1.zip Checksum: (see external_deps.lst) In addition, to support the debugging of scripts contained in OpenOffice.org documents, we have modified the Java source files: - GuiCallback.java (added exitInterrupt method) -- Main.java (added AOO-specific shortcut methods, nullified console I/O) +- Main.java (added AOO-specific shortcut methods, console I/O falls back to System streams) - Dim.java (added evalScriptWithReturn, changed default URL from "<stdin>" to "document") - SwingGui.java (AOO-specific debugger GUI modifications) - OfficeScriptInfo.java (new AOO-specific class) -- toolsrc/build.xml (excluded system rhino.jar from bootstrap classpath) - DefiningClassLoader.java (modified class loading to check thread context class loader) The Rhino source tarball is unpacked and patched with the modified code. The Rhino Jar file (js.jar) is then built and delivered to the solver. The file -rhino1_7_7_2.patch contains the changes made in order to build Rhino. The patch -was generated using the command: diff -wurN +rhino1_7_15_1.patch adds the Ant build files and the debugger changes above, and +rhino-1.7.15.1-definingclassloader.patch holds the DefiningClassLoader change. +Upstream builds with Gradle; the AOO build uses the Ant build.xml added by the +patch, which packages js.jar the same way Gradle's jar task does (all of src +minus the JSR-223 engine). The patches were generated with: diff -ruN Java 8 compatibility: build.properties sets target-jvm and source-level to 1.8. -Ant-based build is preserved. +Rhino 1.8.0 and later require Java 11, so 1.7.15.1 is the newest release usable +with the Java 8 floor. ES6 is the default language mode (Context.VERSION_ES6). diff --git a/main/rhino/makefile.mk b/main/rhino/makefile.mk index 5d3647d35f..69a7a6736a 100644 --- a/main/rhino/makefile.mk +++ b/main/rhino/makefile.mk @@ -44,20 +44,20 @@ all: #.IF "$(DISABLE_RHINO)" == "" -TARFILE_NAME=rhino1_7_7_2 -TARFILE_MD5=afcf570784ebd919c1d484a6d0d3fcd6 -TARFILE_ROOTDIR=rhino1.7.7.2 +TARFILE_NAME=rhino1_7_15_1 +TARFILE_MD5=b98c6c3ec884277f253028abf91d257b +TARFILE_ROOTDIR=rhino1.7.15.1 ADDITIONAL_FILES= -PATCH_FILES=rhino1_7_7_2.patch rhino-1.7.7.2-definingclassloader.patch rhino1_7_7_2-java-version.patch rhino-1.7.7.2-main.patch rhino-1.7.7.2-xxe-fix.patch rhino-1.7.7.2-tofixed-fix.patch +PATCH_FILES=rhino1_7_15_1.patch rhino-1.7.15.1-definingclassloader.patch .IF "$(JAVACISGCJ)"=="yes" JAVA_HOME= .EXPORT : JAVA_HOME -BUILD_ACTION=$(ANT) -Dbuild.label="build-$(RSCREVISION)" -Dbuild.compiler=gcj -Dno-xmlbeans=true jar +BUILD_ACTION=$(ANT) -Dbuild.compiler=gcj jar .ELSE -BUILD_ACTION=$(ANT) -Dbuild.label="build-$(RSCREVISION)" -Dno-xmlbeans=true jar +BUILD_ACTION=$(ANT) jar .ENDIF # --- Targets ------------------------------------------------------ diff --git a/main/rhino/prj/d.lst b/main/rhino/prj/d.lst index 434f0a496c..4b1fd22c9e 100644 --- a/main/rhino/prj/d.lst +++ b/main/rhino/prj/d.lst @@ -1 +1 @@ -..\%__SRC%\misc\build\rhino1.7.7.2\build\js.jar %_DEST%\bin%_EXT%\js.jar +..\%__SRC%\misc\build\rhino1.7.15.1\build\js.jar %_DEST%\bin%_EXT%\js.jar diff --git a/main/rhino/rhino-1.7.15.1-definingclassloader.patch b/main/rhino/rhino-1.7.15.1-definingclassloader.patch new file mode 100644 index 0000000000..66c8d41417 --- /dev/null +++ b/main/rhino/rhino-1.7.15.1-definingclassloader.patch @@ -0,0 +1,62 @@ +--- a/b/rhino1.7.15.1/src/org/mozilla/javascript/DefiningClassLoader.java 2026-11-06 14:50:16 ++++ b/b/rhino1.7.15.1/src/org/mozilla/javascript/DefiningClassLoader.java 2026-11-06 14:50:17 +@@ -12,12 +12,26 @@ + public class DefiningClassLoader extends ClassLoader implements GeneratedClassLoader { + public DefiningClassLoader() { + this.parentLoader = getClass().getClassLoader(); ++ init(); + } + + public DefiningClassLoader(ClassLoader parentLoader) { + this.parentLoader = parentLoader; ++ init(); + } + ++ private void init() { ++ try { ++ this.contextLoader = Thread.currentThread().getContextClassLoader(); ++ } catch (SecurityException ex) { ++ // No access to the context class loader, use the parent only. ++ this.contextLoader = null; ++ } ++ if (this.contextLoader == this.parentLoader) { ++ this.contextLoader = null; ++ } ++ } ++ + @Override + public Class<?> defineClass(String name, byte[] data) { + // Use our own protection domain for the generated classes. +@@ -36,10 +50,14 @@ + public Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException { + Class<?> cl = findLoadedClass(name); + if (cl == null) { +- if (parentLoader != null) { +- cl = parentLoader.loadClass(name); ++ if (contextLoader == null) { ++ cl = loadFromParent(name); + } else { +- cl = findSystemClass(name); ++ try { ++ cl = loadFromParent(name); ++ } catch (ClassNotFoundException ex) { ++ cl = contextLoader.loadClass(name); ++ } + } + } + if (resolve) { +@@ -48,5 +66,14 @@ + return cl; + } + ++ private Class<?> loadFromParent(String name) throws ClassNotFoundException { ++ if (parentLoader != null) { ++ return parentLoader.loadClass(name); ++ } ++ return findSystemClass(name); ++ } ++ + private final ClassLoader parentLoader; ++ ++ private ClassLoader contextLoader; + } diff --git a/main/rhino/rhino-1.7.7.2-definingclassloader.patch b/main/rhino/rhino-1.7.7.2-definingclassloader.patch deleted file mode 100644 index eb2c2f5b5f..0000000000 --- a/main/rhino/rhino-1.7.7.2-definingclassloader.patch +++ /dev/null @@ -1,66 +0,0 @@ ---- a/b/rhino1.7.7.2/src/org/mozilla/javascript/DefiningClassLoader.java -+++ b/b/rhino1.7.7.2/src/org/mozilla/javascript/DefiningClassLoader.java -@@ -4,9 +4,6 @@ - - package org.mozilla.javascript; - --import java.lang.reflect.Method; --import java.lang.reflect.InvocationTargetException; -- - /** - * Load generated classes. - * -@@ -27,19 +24,16 @@ - - private void init() { - this.contextLoader = null; -- if (method_getContextClassLoader != null) { -- try { -- this.contextLoader = (ClassLoader) -- method_getContextClassLoader.invoke( -- Thread.currentThread(), -- ScriptRuntime.emptyArgs); -- } catch (IllegalAccessException ex) { -- } catch (InvocationTargetException ex) { -- } catch (SecurityException ex) { -- } -- if (this.contextLoader == this.parentLoader) { -- this.contextLoader = null; -- } -+ try { -+ this.contextLoader = Thread.currentThread().getContextClassLoader(); -+ } catch (SecurityException ex) { -+ /* Context class loader access denied in restricted -+ environments (e.g. applets, sandboxed class loaders). -+ Fall back to the parent class loader only. */ -+ this.contextLoader = null; -+ } -+ if (this.contextLoader == this.parentLoader) { -+ this.contextLoader = null; - } - } - -@@ -90,23 +84,4 @@ - private final ClassLoader parentLoader; - - private ClassLoader contextLoader; -- -- // We'd like to use "Thread.getContextClassLoader", but -- // that's only available on Java2. -- private static Method method_getContextClassLoader; -- -- static { -- try { -- // Don't use "Thread.class": that performs the lookup -- // in the class initializer, which doesn't allow us to -- // catch possible security exceptions. -- Class threadClass = Class.forName("java.lang.Thread"); -- method_getContextClassLoader = -- threadClass.getDeclaredMethod("getContextClassLoader", -- new Class[0]); -- } catch (ClassNotFoundException e) { -- } catch (NoSuchMethodException e) { -- } catch (SecurityException e) { -- } -- } - } diff --git a/main/rhino/rhino-1.7.7.2-main.patch b/main/rhino/rhino-1.7.7.2-main.patch deleted file mode 100644 index a67cd42d2b..0000000000 --- a/main/rhino/rhino-1.7.7.2-main.patch +++ /dev/null @@ -1,38 +0,0 @@ ---- a/b/rhino1.7.7.2/src/org/mozilla/javascript/tools/debugger/Main.java -+++ b/b/rhino1.7.7.2/src/org/mozilla/javascript/tools/debugger/Main.java -@@ -127,7 +127,10 @@ - * Console window. - */ - public InputStream getIn() { -- return null;//return debugGui.getConsole().getIn(); -+ if (debugGui != null && debugGui.getConsole() != null) { -+ return debugGui.getConsole().getIn(); -+ } -+ return System.in; - } - - /** -@@ -135,7 +138,10 @@ - * Console window. - */ - public PrintStream getOut() { -- return null;//return debugGui.getConsole().getOut(); -+ if (debugGui != null && debugGui.getConsole() != null) { -+ return debugGui.getConsole().getOut(); -+ } -+ return System.out; - } - - /** -@@ -143,7 +149,10 @@ - * Console window. - */ - public PrintStream getErr() { -- return null;//return debugGui.getConsole().getErr(); -+ if (debugGui != null && debugGui.getConsole() != null) { -+ return debugGui.getConsole().getErr(); -+ } -+ return System.err; - } - - /** diff --git a/main/rhino/rhino-1.7.7.2-tofixed-fix.patch b/main/rhino/rhino-1.7.7.2-tofixed-fix.patch deleted file mode 100644 index ddc9b08270..0000000000 --- a/main/rhino/rhino-1.7.7.2-tofixed-fix.patch +++ /dev/null @@ -1,43 +0,0 @@ - ---- a/b/rhino1.7.7.2/src/org/mozilla/javascript/DToA.java 1969-12-31 19:00:00.000000000 -0500 -+++ b/rhino1.7.7.2/src/org/mozilla/javascript/DToA.java 2026-11-03 00:00:00.000000000 -0500 -@@ -1141,6 +1141,40 @@ - if (mode == DTOSTR_FIXED && (d >= 1e21 || d <= -1e21)) - mode = DTOSTR_STANDARD; /* Change mode here rather than below because the buffer may not be large enough to hold a large integer. */ - -+ /* Fast path: if the fixed-point result rounds to zero, return immediately -+ without invoking the arbitrary-precision JS_dtoa path. This bounds the -+ cost of toFixed for tiny and subnormal values. -+ -+ toFixed(precision) rounds to zero exactly when abs(d) < 0.5 * 10^(-precision) -+ (the boundary rounds away from zero per ECMAScript round-half-up). We test -+ the equivalent condition abs(d) < 0.5 * 10^(-precision) rather than computing -+ abs(d) * 10^precision < 0.5, so the multiplication cannot overflow and the -+ comparison remains well conditioned for every legal precision value -+ (num_to restricts precision to [-20,100], hence 10^(-precision) is always a -+ normal double and never underflows to zero). -+ -+ Proof that JS_dtoa is bounded when this test does not fire: -+ When abs(d) >= 0.5 * 10^(-precision), we have -+ k = floor(log10(abs(d))) >= -precision - 1 -+ hence, in JS_dtoa's fixed mode, ilim = precision + k + 1 >= 0. Since -+ values with abs(d) >= 1e21 are switched to standard mode above, k <= 20 -+ and ilim <= precision + 21 <= 121. pow5mult exponents are bounded by -+ ~324 (smallest positive subnormal). The digit-emission loop runs at most -+ ~121 iterations. No pathological computation can occur. */ -+ if (mode == DTOSTR_FIXED && !Double.isNaN(d) && !Double.isInfinite(d)) { -+ double threshold = 0.5 * Math.pow(10.0, -precision); -+ if (Math.abs(d) < threshold) { -+ boolean negative = (d < 0); -+ if (precision <= 0) { -+ buffer.append(negative ? "-0" : "0"); -+ } else { -+ buffer.append(negative ? "-0." : "0."); -+ for (int i = 0; i < precision; i++) buffer.append('0'); -+ } -+ return; -+ } -+ } -+ - decPt = JS_dtoa(d, dtoaModes[mode], mode >= DTOSTR_FIXED, precision, sign, buffer); - nDigits = buffer.length(); diff --git a/main/rhino/rhino-1.7.7.2-xxe-fix.patch b/main/rhino/rhino-1.7.7.2-xxe-fix.patch deleted file mode 100644 index 780b03c7c1..0000000000 --- a/main/rhino/rhino-1.7.7.2-xxe-fix.patch +++ /dev/null @@ -1,61 +0,0 @@ ---- a/b/rhino1.7.7.2/src/org/mozilla/javascript/xmlimpl/XmlProcessor.java -+++ b/b/rhino1.7.7.2/src/org/mozilla/javascript/xmlimpl/XmlProcessor.java -@@ -43,7 +43,9 @@ - this.dom = javax.xml.parsers.DocumentBuilderFactory.newInstance(); - this.dom.setNamespaceAware(true); - this.dom.setIgnoringComments(false); -+ configureDomFactory(this.dom); - this.xform = javax.xml.transform.TransformerFactory.newInstance(); -+ configureTransformerFactory(this.xform); - int poolSize = Runtime.getRuntime().availableProcessors() * 2; - this.documentBuilderPool = new LinkedBlockingDeque<DocumentBuilder>(poolSize); - } -@@ -75,7 +77,9 @@ - this.dom = javax.xml.parsers.DocumentBuilderFactory.newInstance(); - this.dom.setNamespaceAware(true); - this.dom.setIgnoringComments(false); -+ configureDomFactory(this.dom); - this.xform = javax.xml.transform.TransformerFactory.newInstance(); -+ configureTransformerFactory(this.xform); - int poolSize = Runtime.getRuntime().availableProcessors() * 2; - this.documentBuilderPool = new LinkedBlockingDeque<DocumentBuilder>(poolSize); - } -@@ -148,6 +152,24 @@ - private javax.xml.parsers.DocumentBuilderFactory getDomFactory() { - return dom; - } -+ private static void configureDomFactory(javax.xml.parsers.DocumentBuilderFactory f) { -+ try { f.setFeature("http://xml.org/sax/features/external-general-entities", false); } catch (javax.xml.parsers.ParserConfigurationException e) { throw new RuntimeException(e); } -+ try { f.setFeature("http://xml.org/sax/features/external-parameter-entities", false); } catch (javax.xml.parsers.ParserConfigurationException e) { throw new RuntimeException(e); } -+ try { f.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false); } catch (javax.xml.parsers.ParserConfigurationException e) { throw new RuntimeException(e); } -+ /* setXIncludeAware(false) is defense-in-depth: if unsupported, external-general-entities, -+ external-parameter-entities, load-external-dtd, and ACCESS_EXTERNAL_DTD still block -+ all external resource access via XInclude. */ -+ try { f.setXIncludeAware(false); } catch (UnsupportedOperationException e) { /* ignore */ } -+ try { f.setFeature(javax.xml.XMLConstants.FEATURE_SECURE_PROCESSING, true); } catch (javax.xml.parsers.ParserConfigurationException e) { throw new RuntimeException(e); } -+ try { f.setAttribute(javax.xml.XMLConstants.ACCESS_EXTERNAL_DTD, ""); } catch (IllegalArgumentException e) { /* ignore */ } -+ try { f.setAttribute(javax.xml.XMLConstants.ACCESS_EXTERNAL_SCHEMA, ""); } catch (IllegalArgumentException e) { /* ignore */ } -+ } -+ -+ private static void configureTransformerFactory(javax.xml.transform.TransformerFactory f) { -+ try { f.setFeature(javax.xml.XMLConstants.FEATURE_SECURE_PROCESSING, true); } catch (javax.xml.transform.TransformerConfigurationException e) { throw new RuntimeException(e); } -+ try { f.setAttribute(javax.xml.XMLConstants.ACCESS_EXTERNAL_STYLESHEET, ""); } catch (IllegalArgumentException e) { /* ignore */ } -+ try { f.setAttribute(javax.xml.XMLConstants.ACCESS_EXTERNAL_DTD, ""); } catch (IllegalArgumentException e) { /* ignore */ } -+ } - - // Get from pool, or create one without locking, if needed. - private DocumentBuilder getDocumentBuilderFromPool() -@@ -157,6 +179,14 @@ - builder = getDomFactory().newDocumentBuilder(); - } - builder.setErrorHandler(errorHandler); -+ /* Entity resolver returns empty input for all external references. This is -+ defense-in-depth: the factory features above already block external access, -+ so if resolver installation fails the mandatory controls still prevent XXE. */ -+ builder.setEntityResolver(new org.xml.sax.EntityResolver() { -+ public org.xml.sax.InputSource resolveEntity(String publicId, String systemId) { -+ return new org.xml.sax.InputSource(new java.io.StringReader("")); -+ } -+ }); - return builder; - } diff --git a/main/rhino/rhino1_7_7_2.patch b/main/rhino/rhino1_7_15_1.patch similarity index 58% rename from main/rhino/rhino1_7_7_2.patch rename to main/rhino/rhino1_7_15_1.patch index e63404c9f4..d98165f85d 100644 --- a/main/rhino/rhino1_7_7_2.patch +++ b/main/rhino/rhino1_7_15_1.patch @@ -1,42 +1,47 @@ -diff -ruN a/b/rhino1.7.7.2/build.properties a/b/rhino1.7.7.2/build.properties ---- a/b/rhino1.7.7.2/build.properties 2026-10-31 20:42:49.489534187 -0500 -+++ a/b/rhino1.7.7.2/build.properties 2026-10-31 20:42:49.840321657 -0500 -@@ -23,4 +23,4 @@ - source-level: 1.6 - - # jar generation settings --jar-compression: true +diff -ruN -x build -x DefiningClassLoader.java a/b/rhino1.7.15.1/build.properties b/b/rhino1.7.15.1/build.properties +--- a/b/rhino1.7.15.1/build.properties 1969-12-31 19:00:00 ++++ b/b/rhino1.7.15.1/build.properties 2026-11-06 14:50:16 +@@ -0,0 +1,20 @@ ++# 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/. ++ ++name: rhino ++version: 1.7.15.1 ++ ++build.dir: build ++rhino.jar: js.jar ++ ++# compilation destination ++classes: ${build.dir}/classes ++ ++# compilation settings ++debug: on ++target-jvm: 1.8 ++source-level: 1.8 ++ ++# jar generation settings +jar-compression: true -\ No newline at end of file -diff -ruN a/b/rhino1.7.7.2/build.xml a/b/rhino1.7.7.2/build.xml ---- a/b/rhino1.7.7.2/build.xml 1969-12-31 19:00:00.000000000 -0500 -+++ b/b/rhino1.7.7.2/build.xml 2026-11-03 00:00:00.000000000 -0500 -@@ -0,0 +1,87 @@ +diff -ruN -x build -x DefiningClassLoader.java a/b/rhino1.7.15.1/build.xml b/b/rhino1.7.15.1/build.xml +--- a/b/rhino1.7.15.1/build.xml 1969-12-31 19:00:00 ++++ b/b/rhino1.7.15.1/build.xml 2026-11-06 14:50:16 +@@ -0,0 +1,51 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- 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/. --> + ++<!-- Ant replacement for the upstream Gradle build. Builds js.jar the same ++ way Gradle's "jar" task does: everything under src, minus the JSR-223 ++ engine. --> +<project name="rhino" default="jar" basedir="."> + -+ <target name="init"> -+ <property file="build.properties"/> -+ <property name="src.dir" value="src"/> -+ <property name="build.dir" value="${build.dir}"/> -+ <property name="classes.dir" value="${classes}"/> -+ <property name="rhino.jar" value="${rhino.jar}"/> -+ <property name="small-rhino.jar" value="${small-rhino.jar}"/> -+ <property name="dist.dir" value="${dist.dir}"/> -+ <property name="dist.name" value="${dist.name}"/> -+ -+ <mkdir dir="${classes.dir}"/> -+ <mkdir dir="${build.dir}"/> -+ <mkdir dir="${dist.dir}"/> -+ </target> ++ <property file="build.properties"/> + -+ <target name="compile" depends="init"> -+ <javac srcdir="${src.dir}" -+ destdir="${classes.dir}" ++ <target name="compile"> ++ <mkdir dir="${classes}"/> ++ <javac srcdir="src" ++ destdir="${classes}" + debug="${debug}" + target="${target-jvm}" + source="${source-level}" @@ -51,180 +56,52 @@ diff -ruN a/b/rhino1.7.7.2/build.xml a/b/rhino1.7.7.2/build.xml + compress="${jar-compression}"> + <manifest> + <attribute name="Manifest-Version" value="1.0"/> ++ <attribute name="Main-Class" value="org.mozilla.javascript.tools.shell.Main"/> ++ <attribute name="Automatic-Module-Name" value="org.mozilla.rhino"/> + <attribute name="Implementation-Title" value="Rhino"/> -+ <attribute name="Implementation-Version" value="1.7.7.2"/> ++ <attribute name="Implementation-Version" value="${version}"/> + </manifest> -+ <fileset dir="${classes.dir}"/> -+ <fileset dir="${basedir}/src" includes="**/*.properties"/> -+ </jar> -+ </target> -+ -+ <target name="small-jar" depends="compile"> -+ <jar destfile="${build.dir}/${small-rhino.jar}" -+ compress="${jar-compression}"> -+ <manifest> -+ <attribute name="Manifest-Version" value="1.0"/> -+ <attribute name="Implementation-Title" value="Rhino"/> -+ <attribute name="Implementation-Version" value="1.7.7.2"/> -+ </manifest> -+ <fileset dir="${classes.dir}"> -+ <exclude name="**/tools/**"/> -+ <exclude name="**/debugger/**"/> -+ <exclude name="**/shell/**"/> -+ <exclude name="**/jsc/**"/> -+ <exclude name="**/idswitch/**"/> -+ <exclude name="**/classfile/**"/> ++ <fileset dir="${classes}"> ++ <exclude name="org/mozilla/javascript/engine/**"/> ++ </fileset> ++ <fileset dir="src"> ++ <exclude name="**/*.java"/> ++ <exclude name="org/mozilla/javascript/engine/**"/> ++ <exclude name="META-INF/services/**"/> + </fileset> -+ <fileset dir="${basedir}/src" includes="**/*.properties"/> + </jar> + </target> + -+ <target name="dist" depends="jar, small-jar"> -+ <mkdir dir="${dist.dir}/${dist.name}/lib"/> -+ <copy file="${build.dir}/${rhino.jar}" -+ tofile="${dist.dir}/${dist.name}/lib/${rhino.jar}"/> -+ <copy file="${build.dir}/${small-rhino.jar}" -+ tofile="${dist.dir}/${dist.name}/lib/${small-rhino.jar}"/> -+ <copy file="LICENSE.txt" -+ todir="${dist.dir}/${dist.name}"/> -+ <copy file="README.md" -+ todir="${dist.dir}/${dist.name}"/> -+ <copy file="RELEASE-NOTES.md" -+ todir="${dist.dir}/${dist.name}"/> -+ </target> -+ + <target name="clean"> + <delete dir="${build.dir}"/> -+ <delete dir="${dist.dir}"/> + </target> + +</project> -+ -+</project> -\ No newline at end of file -diff -ruN a/b/rhino1.7.7.2/src/org/mozilla/javascript/DefiningClassLoader.java a/b/rhino1.7.7.2/src/org/mozilla/javascript/DefiningClassLoader.java ---- a/b/rhino1.7.7.2/src/org/mozilla/javascript/DefiningClassLoader.java 2026-10-31 20:42:49.607742394 -0500 -+++ a/b/rhino1.7.7.2/src/org/mozilla/javascript/DefiningClassLoader.java 2026-10-31 20:42:49.766998760 -0500 -@@ -4,6 +4,9 @@ - - package org.mozilla.javascript; - -+import java.lang.reflect.Method; -+import java.lang.reflect.InvocationTargetException; -+ - /** - * Load generated classes. - * -@@ -14,10 +17,30 @@ - { - public DefiningClassLoader() { - this.parentLoader = getClass().getClassLoader(); -+ init(); - } - - public DefiningClassLoader(ClassLoader parentLoader) { - this.parentLoader = parentLoader; -+ init(); -+ } -+ -+ private void init() { -+ this.contextLoader = null; -+ if (method_getContextClassLoader != null) { -+ try { -+ this.contextLoader = (ClassLoader) -+ method_getContextClassLoader.invoke( -+ Thread.currentThread(), -+ ScriptRuntime.emptyArgs); -+ } catch (IllegalAccessException ex) { -+ } catch (InvocationTargetException ex) { -+ } catch (SecurityException ex) { -+ } -+ if (this.contextLoader == this.parentLoader) { -+ this.contextLoader = null; -+ } -+ } - } - - public Class<?> defineClass(String name, byte[] data) { -@@ -38,10 +61,14 @@ - { - Class<?> cl = findLoadedClass(name); - if (cl == null) { -- if (parentLoader != null) { -- cl = parentLoader.loadClass(name); -+ if (contextLoader == null) { -+ cl = loadFromParent(name); - } else { -- cl = findSystemClass(name); -+ try { -+ cl = loadFromParent(name); -+ } catch (ClassNotFoundException ex) { -+ cl = contextLoader.loadClass(name); -+ } - } - } - if (resolve) { -@@ -50,5 +77,36 @@ - return cl; - } - -+ private Class loadFromParent(String name) -+ throws ClassNotFoundException -+ { -+ if (parentLoader != null) { -+ return parentLoader.loadClass(name); -+ } else { -+ return findSystemClass(name); -+ } -+ } -+ - private final ClassLoader parentLoader; -+ -+ private ClassLoader contextLoader; -+ -+ // We'd like to use "Thread.getContextClassLoader", but -+ // that's only available on Java2. -+ private static Method method_getContextClassLoader; -+ -+ static { -+ try { -+ // Don't use "Thread.class": that performs the lookup -+ // in the class initializer, which doesn't allow us to -+ // catch possible security exceptions. -+ Class threadClass = Class.forName("java.lang.Thread"); -+ method_getContextClassLoader = -+ threadClass.getDeclaredMethod("getContextClassLoader", -+ new Class[0]); -+ } catch (ClassNotFoundException e) { -+ } catch (NoSuchMethodException e) { -+ } catch (SecurityException e) { -+ } -+ } - } -diff -ruN a/b/rhino1.7.7.2/src/org/mozilla/javascript/tools/debugger/Dim.java a/b/rhino1.7.7.2/src/org/mozilla/javascript/tools/debugger/Dim.java ---- a/b/rhino1.7.7.2/src/org/mozilla/javascript/tools/debugger/Dim.java 2026-10-31 20:42:49.648044642 -0500 -+++ a/b/rhino1.7.7.2/src/org/mozilla/javascript/tools/debugger/Dim.java 2026-10-31 20:42:49.791085088 -0500 -@@ -34,6 +34,7 @@ +diff -ruN -x build -x DefiningClassLoader.java a/b/rhino1.7.15.1/src/org/mozilla/javascript/tools/debugger/Dim.java b/b/rhino1.7.15.1/src/org/mozilla/javascript/tools/debugger/Dim.java +--- a/b/rhino1.7.15.1/src/org/mozilla/javascript/tools/debugger/Dim.java 2026-11-06 14:50:16 ++++ b/b/rhino1.7.15.1/src/org/mozilla/javascript/tools/debugger/Dim.java 2026-11-06 14:50:17 +@@ -53,6 +53,7 @@ private static final int IPROXY_OBJECT_TO_STRING = 5; private static final int IPROXY_OBJECT_PROPERTY = 6; private static final int IPROXY_OBJECT_IDS = 7; + private static final int IPROXY_EVAL_SCRIPT_WITH_RETURN = 8; - /** - * Interface to the debugger GUI. -@@ -398,7 +399,7 @@ - */ + /** Interface to the debugger GUI. */ + private GuiCallback callback; +@@ -335,7 +336,7 @@ private String getNormalizedUrl(DebuggableScript fnOrScript) { String url = fnOrScript.getSourceName(); -- if (url == null) { url = "<stdin>"; } -+ if (url == null) { url = "document"; } - else { + if (url == null) { +- url = "<stdin>"; ++ url = "document"; + } else { // Not to produce window for eval from different lines, // strip line numbers, i.e. replace all #[0-9]+\(eval\) by -@@ -587,6 +588,17 @@ +@@ -498,6 +499,17 @@ + action.withContext(); } - /** ++ /** + * Evaluates the given script with scope and return value. + */ + public Object evalScriptWithReturn(final String url, final String text, Scriptable scope) { @@ -235,49 +112,46 @@ diff -ruN a/b/rhino1.7.7.2/src/org/mozilla/javascript/tools/debugger/Dim.java a/ + return contextFactory.call(action); + } + -+ /** - * Converts the given script object to a string. - */ + /** Converts the given script object to a string. */ public String objectToString(Object object) { -@@ -931,6 +943,11 @@ + DimIProxy action = new DimIProxy(this, IPROXY_OBJECT_TO_STRING); +@@ -796,6 +808,9 @@ + /** The Object[] result of the action. */ private Object[] objectArrayResult; - /** -+ * The Scriptable as arguments. -+ */ ++ /** The scope to evaluate in, for IPROXY_EVAL_SCRIPT_WITH_RETURN. */ + private Scriptable scope; + -+ /** - * Creates a new DimIProxy. - */ + /** Creates a new DimIProxy. */ private DimIProxy(Dim dim, int type) { -@@ -962,6 +979,20 @@ - } - break; - -+ case IPROXY_EVAL_SCRIPT_WITH_RETURN: -+ if (this.scope != null) { -+ return cx.evaluateString(this.scope, text, url, 1, null); -+ } else { -+ Scriptable sc = null; -+ if (dim.scopeProvider != null) { -+ sc = dim.scopeProvider.getScope(); -+ } -+ if (sc == null) { -+ sc = new ImporterTopLevel(cx); + this.dim = dim; +@@ -824,6 +839,20 @@ + cx.evaluateString(scope, text, url, 1, null); + } + break; ++ ++ case IPROXY_EVAL_SCRIPT_WITH_RETURN: ++ if (this.scope != null) { ++ return cx.evaluateString(this.scope, text, url, 1, null); ++ } else { ++ Scriptable sc = null; ++ if (dim.scopeProvider != null) { ++ sc = dim.scopeProvider.getScope(); ++ } ++ if (sc == null) { ++ sc = new ImporterTopLevel(cx); ++ } ++ return cx.evaluateString(sc, text, url, 1, null); + } -+ return cx.evaluateString(sc, text, url, 1, null); -+ } -+ - case IPROXY_STRING_IS_COMPILABLE: - booleanResult = cx.stringIsCompilableUnit(text); - break; -diff -ruN a/b/rhino1.7.7.2/src/org/mozilla/javascript/tools/debugger/GuiCallback.java a/b/rhino1.7.7.2/src/org/mozilla/javascript/tools/debugger/GuiCallback.java ---- a/b/rhino1.7.7.2/src/org/mozilla/javascript/tools/debugger/GuiCallback.java 2026-10-31 20:42:49.649184458 -0500 -+++ a/b/rhino1.7.7.2/src/org/mozilla/javascript/tools/debugger/GuiCallback.java 2026-10-31 20:42:49.791267690 -0500 + + case IPROXY_STRING_IS_COMPILABLE: + booleanResult = cx.stringIsCompilableUnit(text); +diff -ruN -x build -x DefiningClassLoader.java a/b/rhino1.7.15.1/src/org/mozilla/javascript/tools/debugger/GuiCallback.java b/b/rhino1.7.15.1/src/org/mozilla/javascript/tools/debugger/GuiCallback.java +--- a/b/rhino1.7.15.1/src/org/mozilla/javascript/tools/debugger/GuiCallback.java 2026-11-06 14:50:16 ++++ b/b/rhino1.7.15.1/src/org/mozilla/javascript/tools/debugger/GuiCallback.java 2026-11-06 14:50:17 @@ -23,6 +23,11 @@ - String threadTitle, - String alertMessage); + */ + boolean isGuiEventThread(); + /** + * Called when the interrupt loop has been exited. @@ -285,55 +159,51 @@ diff -ruN a/b/rhino1.7.7.2/src/org/mozilla/javascript/tools/debugger/GuiCallback + void exitInterrupt(); + /** - * Returns whether the current thread is the GUI's event thread. - * This information is required to avoid blocking the event thread -@@ -35,4 +40,4 @@ - * is necessary when the GUI event thread itself has been stopped. - */ - void dispatchNextGuiEvent() throws InterruptedException; --} -+} -\ No newline at end of file -diff -ruN a/b/rhino1.7.7.2/src/org/mozilla/javascript/tools/debugger/Main.java a/b/rhino1.7.7.2/src/org/mozilla/javascript/tools/debugger/Main.java ---- a/b/rhino1.7.7.2/src/org/mozilla/javascript/tools/debugger/Main.java 2026-10-31 20:42:49.648814653 -0500 -+++ a/b/rhino1.7.7.2/src/org/mozilla/javascript/tools/debugger/Main.java 2026-10-31 20:42:49.791202989 -0500 + * Processes the next GUI event. This manual pumping of GUI events is necessary when the GUI + * event thread itself has been stopped. +diff -ruN -x build -x DefiningClassLoader.java a/b/rhino1.7.15.1/src/org/mozilla/javascript/tools/debugger/Main.java b/b/rhino1.7.15.1/src/org/mozilla/javascript/tools/debugger/Main.java +--- a/b/rhino1.7.15.1/src/org/mozilla/javascript/tools/debugger/Main.java 2026-11-06 14:50:16 ++++ b/b/rhino1.7.15.1/src/org/mozilla/javascript/tools/debugger/Main.java 2026-11-06 14:50:17 @@ -8,6 +8,7 @@ import java.io.InputStream; import java.io.PrintStream; +import java.net.URL; - import javax.swing.JFrame; + import org.mozilla.javascript.Context; + import org.mozilla.javascript.ContextFactory; +@@ -99,17 +100,26 @@ -@@ -126,7 +127,7 @@ - * Console window. - */ + /** Returns an {@link InputStream} for stdin from the debugger's internal Console window. */ public InputStream getIn() { - return debugGui.getConsole().getIn(); -+ return null;//return debugGui.getConsole().getIn(); ++ if (debugGui != null && debugGui.getConsole() != null) { ++ return debugGui.getConsole().getIn(); ++ } ++ return System.in; } - /** -@@ -134,7 +135,7 @@ - * Console window. - */ + /** Returns a {@link PrintStream} for stdout to the debugger's internal Console window. */ public PrintStream getOut() { - return debugGui.getConsole().getOut(); -+ return null;//return debugGui.getConsole().getOut(); ++ if (debugGui != null && debugGui.getConsole() != null) { ++ return debugGui.getConsole().getOut(); ++ } ++ return System.out; } - /** -@@ -142,7 +143,7 @@ - * Console window. - */ + /** Returns a {@link PrintStream} for stderr in the Debugger's internal Console window. */ public PrintStream getErr() { - return debugGui.getConsole().getErr(); -+ return null;//return debugGui.getConsole().getErr(); ++ if (debugGui != null && debugGui.getConsole() != null) { ++ return debugGui.getConsole().getErr(); ++ } ++ return System.err; } - /** -@@ -349,6 +350,41 @@ - { + /** Packs the debugger GUI frame. */ +@@ -275,6 +285,41 @@ + public void contextReleased(Context cx) { throw new IllegalStateException(); } + @@ -373,17 +243,17 @@ diff -ruN a/b/rhino1.7.7.2/src/org/mozilla/javascript/tools/debugger/Main.java a + } /** - * Class to consolidate all internal implementations of interfaces -@@ -408,4 +444,4 @@ + * Class to consolidate all internal implementations of interfaces to avoid class generation +@@ -323,4 +368,4 @@ return scope; } } -} +} \ No newline at end of file -diff -ruN a/b/rhino1.7.7.2/src/org/mozilla/javascript/tools/debugger/OfficeScriptInfo.java a/b/rhino1.7.7.2/src/org/mozilla/javascript/tools/debugger/OfficeScriptInfo.java ---- a/b/rhino1.7.7.2/src/org/mozilla/javascript/tools/debugger/OfficeScriptInfo.java 1969-12-31 19:00:00.000000000 -0500 -+++ a/b/rhino1.7.7.2/src/org/mozilla/javascript/tools/debugger/OfficeScriptInfo.java 2026-10-31 20:42:49.792418706 -0500 +diff -ruN -x build -x DefiningClassLoader.java a/b/rhino1.7.15.1/src/org/mozilla/javascript/tools/debugger/OfficeScriptInfo.java b/b/rhino1.7.15.1/src/org/mozilla/javascript/tools/debugger/OfficeScriptInfo.java +--- a/b/rhino1.7.15.1/src/org/mozilla/javascript/tools/debugger/OfficeScriptInfo.java 1969-12-31 19:00:00 ++++ b/b/rhino1.7.15.1/src/org/mozilla/javascript/tools/debugger/OfficeScriptInfo.java 2026-11-06 14:50:17 @@ -0,0 +1,122 @@ +/************************************************************** + * @@ -507,32 +377,31 @@ diff -ruN a/b/rhino1.7.7.2/src/org/mozilla/javascript/tools/debugger/OfficeScrip + Runnable closeCallback; + } +} -diff -ruN a/b/rhino1.7.7.2/src/org/mozilla/javascript/tools/debugger/SwingGui.java a/b/rhino1.7.7.2/src/org/mozilla/javascript/tools/debugger/SwingGui.java ---- a/b/rhino1.7.7.2/src/org/mozilla/javascript/tools/debugger/SwingGui.java 2026-10-31 20:42:49.648303446 -0500 -+++ a/b/rhino1.7.7.2/src/org/mozilla/javascript/tools/debugger/SwingGui.java 2026-10-31 20:42:49.792500007 -0500 -@@ -32,6 +32,8 @@ - import java.awt.Toolkit; - import java.awt.event.*; - +diff -ruN -x build -x DefiningClassLoader.java a/b/rhino1.7.15.1/src/org/mozilla/javascript/tools/debugger/SwingGui.java b/b/rhino1.7.15.1/src/org/mozilla/javascript/tools/debugger/SwingGui.java +--- a/b/rhino1.7.15.1/src/org/mozilla/javascript/tools/debugger/SwingGui.java 2026-11-06 14:50:16 ++++ b/b/rhino1.7.15.1/src/org/mozilla/javascript/tools/debugger/SwingGui.java 2026-11-06 14:50:17 +@@ -54,6 +54,7 @@ + import java.util.Comparator; + import java.util.EventObject; + import java.util.HashMap; +import java.net.URL; -+ import java.util.List; - import java.util.ArrayList; - import java.util.Arrays; -@@ -47,6 +49,7 @@ - import java.lang.reflect.Method; - + import java.util.Map; + import java.util.Properties; +@@ -108,6 +109,7 @@ + import javax.swing.tree.DefaultTreeCellRenderer; + import javax.swing.tree.TreePath; import org.mozilla.javascript.Kit; +import org.mozilla.javascript.Scriptable; import org.mozilla.javascript.SecurityUtilities; + import org.mozilla.javascript.tools.debugger.treetable.JTreeTable; + import org.mozilla.javascript.tools.debugger.treetable.TreeTableModel; +@@ -116,7 +118,138 @@ - import org.mozilla.javascript.tools.shell.ConsoleTextArea; -@@ -59,6 +62,138 @@ - * GUI for the Rhino debugger. - */ + /** GUI for the Rhino debugger. */ public class SwingGui extends JFrame implements GuiCallback { + private boolean sourceEditingEnabled = true; -+ + + public boolean isSourceEditingEnabled() { + return sourceEditingEnabled; + } @@ -663,20 +532,20 @@ diff -ruN a/b/rhino1.7.7.2/src/org/mozilla/javascript/tools/debugger/SwingGui.ja + return null; + } + + /** Serializable magic number. */ + private static final long serialVersionUID = -8217029773456711621L; - /** - * Serializable magic number. -@@ -2052,7 +2187,7 @@ - /** - * An internal frame for script files. - */ +@@ -1880,7 +2013,7 @@ + } + + /** An internal frame for script files. */ -class FileWindow extends JInternalFrame implements ActionListener { -+class FileWindow extends JInternalFrame implements ActionListener, javax.swing.event.DocumentListener { ++class FileWindow extends JInternalFrame implements ActionListener, DocumentListener { - /** - * Serializable magic number. -@@ -2089,6 +2224,83 @@ - */ + /** Serializable magic number. */ + private static final long serialVersionUID = -6212382604952082370L; +@@ -1903,6 +2036,83 @@ + /** The current offset position. */ int currentPos; + boolean isModified = false; @@ -756,11 +625,11 @@ diff -ruN a/b/rhino1.7.7.2/src/org/mozilla/javascript/tools/debugger/SwingGui.ja + return debugGui.isSourceEditingEnabled(); + } + - /** - * Loads the file. - */ -@@ -3546,4 +3758,5 @@ - + /** Loads the file. */ + void load() { + String url = getUrl(); +@@ -3170,4 +3380,5 @@ + throw new IllegalArgumentException(String.valueOf(type)); } } + diff --git a/main/rhino/rhino1_7_7_2-java-version.patch b/main/rhino/rhino1_7_7_2-java-version.patch deleted file mode 100644 index dda3155f76..0000000000 --- a/main/rhino/rhino1_7_7_2-java-version.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- a/b/rhino1.7.7.2/build.properties -+++ b/b/rhino1.7.7.2/build.properties -@@ -19,8 +19,8 @@ - - # compilation settings - debug: on --target-jvm: 1.6 --source-level: 1.6 -+target-jvm: 1.8 -+source-level: 1.8 - - # jar generation settings - jar-compression: true -\ No newline at end of file
