This is an automated email from the ASF dual-hosted git repository. jimjag pushed a commit to branch AOO50X in repository https://gitbox.apache.org/repos/asf/openoffice.git
commit ad3522b5546e519121b8b023e814ac007039a121 Author: Jim Jagielski <[email protected]> AuthorDate: Mon Nov 9 08:34:44 2026 -0500 rhino: upgrade to 1.7.15.1 Upstream builds only with Gradle, so the patch now adds an Ant build.xml. The XXE and toFixed patches are dropped; 1.7.15.1 has both fixes. (cherry picked from commit 54821b4fe85dee88d0b78f38f2a8d0a40d3e5ab7) --- main/external_deps.lst | 6 +- main/rhino/README | 15 +- main/rhino/makefile.mk | 8 +- main/rhino/prj/d.lst | 2 +- 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} | 481 +++++++++------------ main/rhino/rhino1_7_7_2-java-version.patch | 14 - 10 files changed, 210 insertions(+), 524 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..227b29c713 100644 --- a/main/rhino/README +++ b/main/rhino/README @@ -2,8 +2,8 @@ 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 @@ -13,14 +13,11 @@ documents, we have modified the Java source files: - 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 +Upstream builds only with Gradle, so rhino1_7_15_1.patch also adds a small +Ant build.xml that compiles src/ for Java 8 into build/js.jar. The JSR-223 +engine (org.mozilla.javascript.engine) is left out, as in the upstream +rhino jar. The patch was generated using the command: diff -ruN -Java 8 compatibility: build.properties sets target-jvm and source-level to 1.8. -Ant-based build is preserved. ES6 is the default language mode (Context.VERSION_ES6). diff --git a/main/rhino/makefile.mk b/main/rhino/makefile.mk index 5d3647d35f..cade0e3192 100644 --- a/main/rhino/makefile.mk +++ b/main/rhino/makefile.mk @@ -44,13 +44,13 @@ 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 .IF "$(JAVACISGCJ)"=="yes" JAVA_HOME= 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.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 60% rename from main/rhino/rhino1_7_7_2.patch rename to main/rhino/rhino1_7_15_1.patch index e63404c9f4..28c6e8b41a 100644 --- a/main/rhino/rhino1_7_7_2.patch +++ b/main/rhino/rhino1_7_15_1.patch @@ -1,122 +1,67 @@ -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 -+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 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-09 08:26:49 +@@ -0,0 +1,55 @@ +<?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/. --> + ++<!-- Upstream builds with Gradle only; this replaces it for the AOO build. --> +<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}"/> ++ <property name="version" value="1.7.15.1"/> ++ <property name="src.dir" value="src"/> ++ <property name="build.dir" value="build"/> ++ <property name="classes.dir" value="${build.dir}/classes"/> ++ <property name="rhino.jar" value="js.jar"/> ++ <property name="ant.build.javac.source" value="1.8"/> ++ <property name="ant.build.javac.target" value="1.8"/> + ++ <target name="init"> + <mkdir dir="${classes.dir}"/> -+ <mkdir dir="${build.dir}"/> -+ <mkdir dir="${dist.dir}"/> + </target> + + <target name="compile" depends="init"> + <javac srcdir="${src.dir}" + destdir="${classes.dir}" -+ debug="${debug}" -+ target="${target-jvm}" -+ source="${source-level}" ++ debug="on" ++ source="${ant.build.javac.source}" ++ target="${ant.build.javac.target}" + includeantruntime="false" + encoding="UTF-8"> ++ <!-- the JSR-223 engine ships as a separate rhino-engine jar upstream --> ++ <exclude name="org/mozilla/javascript/engine/**"/> + <compilerarg value="-Xlint:-options"/> ++ <compilerarg value="-nowarn"/> + </javac> + </target> + + <target name="jar" depends="compile"> -+ <jar destfile="${build.dir}/${rhino.jar}" -+ compress="${jar-compression}"> ++ <tstamp> ++ <format property="built.date" pattern="yyyy-MM-dd"/> ++ </tstamp> ++ <jar destfile="${build.dir}/${rhino.jar}" compress="true"> + <manifest> -+ <attribute name="Manifest-Version" value="1.0"/> -+ <attribute name="Implementation-Title" value="Rhino"/> -+ <attribute name="Implementation-Version" value="1.7.7.2"/> ++ <attribute name="Implementation-Title" value="Mozilla Rhino"/> ++ <attribute name="Implementation-Version" value="${version}"/> ++ <attribute name="Built-Date" value="${built.date}"/> + </manifest> + <fileset dir="${classes.dir}"/> -+ <fileset dir="${basedir}/src" includes="**/*.properties"/> ++ <fileset dir="${src.dir}" 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> -+ <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 @@ - { +diff -ruN a/b/rhino1.7.15.1/src/org/mozilla/javascript/DefiningClassLoader.java b/b/rhino1.7.15.1/src/org/mozilla/javascript/DefiningClassLoader.java +--- a/b/rhino1.7.15.1/src/org/mozilla/javascript/DefiningClassLoader.java 2026-11-09 08:26:49 ++++ b/b/rhino1.7.15.1/src/org/mozilla/javascript/DefiningClassLoader.java 2026-11-09 08:33:19 +@@ -12,12 +12,29 @@ + public class DefiningClassLoader extends ClassLoader implements GeneratedClassLoader { public DefiningClassLoader() { this.parentLoader = getClass().getClassLoader(); + init(); @@ -125,29 +70,28 @@ diff -ruN a/b/rhino1.7.7.2/src/org/mozilla/javascript/DefiningClassLoader.java a 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; -+ } ++ 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; ++ } ++ } ++ + @Override public Class<?> defineClass(String name, byte[] data) { -@@ -38,10 +61,14 @@ - { + // Use our own protection domain for the generated classes. +@@ -36,10 +53,14 @@ + public Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException { Class<?> cl = findLoadedClass(name); if (cl == null) { - if (parentLoader != null) { @@ -164,7 +108,7 @@ diff -ruN a/b/rhino1.7.7.2/src/org/mozilla/javascript/DefiningClassLoader.java a } } if (resolve) { -@@ -50,5 +77,36 @@ +@@ -48,5 +69,17 @@ return cl; } @@ -181,52 +125,32 @@ diff -ruN a/b/rhino1.7.7.2/src/org/mozilla/javascript/DefiningClassLoader.java a 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 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-09 08:26:49 ++++ b/b/rhino1.7.15.1/src/org/mozilla/javascript/tools/debugger/Dim.java 2026-11-09 08:26:49 +@@ -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,15 @@ + action.withContext(); } - /** -+ * Evaluates the given script with scope and return value. -+ */ ++ /** Evaluates the given script with scope and return value. */ + public Object evalScriptWithReturn(final String url, final String text, Scriptable scope) { + DimIProxy action = new DimIProxy(this, IPROXY_EVAL_SCRIPT_WITH_RETURN); + action.url = url; @@ -235,108 +159,102 @@ 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 +806,9 @@ + /** The Object[] result of the action. */ private Object[] objectArrayResult; - /** -+ * The Scriptable as arguments. -+ */ ++ /** The Scriptable as arguments. */ + 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 +837,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 -@@ -23,6 +23,11 @@ - String threadTitle, - String alertMessage); -+ /** -+ * Called when the interrupt loop has been exited. -+ */ -+ void exitInterrupt(); -+ + case IPROXY_STRING_IS_COMPILABLE: + booleanResult = cx.stringIsCompilableUnit(text); +diff -ruN 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-09 08:26:49 ++++ b/b/rhino1.7.15.1/src/org/mozilla/javascript/tools/debugger/GuiCallback.java 2026-11-09 08:26:49 +@@ -18,6 +18,11 @@ + void enterInterrupt(Dim.StackFrame lastFrame, String threadTitle, String alertMessage); + /** - * 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. ++ * Called when the interrupt loop has been exited. ++ */ ++ void exitInterrupt(); ++ ++ /** + * Returns whether the current thread is the GUI's event thread. This information is required to + * avoid blocking the event thread from the debugger. */ - 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 +diff -ruN 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-09 08:26:49 ++++ b/b/rhino1.7.15.1/src/org/mozilla/javascript/tools/debugger/Main.java 2026-11-09 08:26:49 @@ -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. */ +@@ -274,6 +284,41 @@ + @Deprecated + public void contextReleased(Context cx) { throw new IllegalStateException(); - } -+ ++ } ++ + // shortcut methods + + public void addWindowListener(java.awt.event.WindowListener l) { @@ -344,22 +262,22 @@ diff -ruN a/b/rhino1.7.7.2/src/org/mozilla/javascript/tools/debugger/Main.java a + } + + public void highlighLineInScriptWindow(URL url, int lineNum) { -+ debugGui.highlighLineInScriptWindow(url, lineNum); -+ } -+ ++ debugGui.highlighLineInScriptWindow(url, lineNum); ++ } ++ + public Object runScriptWindow(URL scriptUrl) throws Exception + { -+ return debugGui.runScriptWindow(scriptUrl); -+ } -+ ++ return debugGui.runScriptWindow(scriptUrl); ++ } ++ + public void openFile(URL scriptUrl, Scriptable scope, Runnable closeCallback) { -+ debugGui.openFile(scriptUrl, scope, closeCallback); -+ } -+ ++ debugGui.openFile(scriptUrl, scope, closeCallback); ++ } ++ + public void toFront() { + debugGui.toFront(); + } -+ ++ + public void showScriptWindow(URL url) { + debugGui.showScriptWindow(url); + } @@ -368,25 +286,17 @@ diff -ruN a/b/rhino1.7.7.2/src/org/mozilla/javascript/tools/debugger/Main.java a + return debugGui.isModified(url); + } + -+ public String getText(URL url) { -+ return debugGui.getText(url); -+ } ++ public String getText(URL url) { ++ return debugGui.getText(url); + } /** - * Class to consolidate all internal implementations of interfaces -@@ -408,4 +444,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 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-09 08:26:49 @@ -0,0 +1,122 @@ +/************************************************************** -+ * ++ * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information @@ -394,16 +304,16 @@ diff -ruN a/b/rhino1.7.7.2/src/org/mozilla/javascript/tools/debugger/OfficeScrip + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at -+ * ++ * + * http://www.apache.org/licenses/LICENSE-2.0 -+ * ++ * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. -+ * ++ * + *************************************************************/ + + @@ -415,7 +325,7 @@ diff -ruN a/b/rhino1.7.7.2/src/org/mozilla/javascript/tools/debugger/OfficeScrip +public class OfficeScriptInfo +{ + private Hashtable<String, SFScriptInfo> loadedSFScripts = new Hashtable<String, SFScriptInfo>(); -+ ++ + public void addScript( URL url, Scriptable scope, Runnable closeCallback ) + { + addScript( url.toString(), url, scope, closeCallback ); @@ -428,11 +338,11 @@ diff -ruN a/b/rhino1.7.7.2/src/org/mozilla/javascript/tools/debugger/OfficeScrip + { + si = new SFScriptInfo(); + si.url = url; -+ si.scope = scope; -+ si.closeCallback = closeCallback; ++ si.scope = scope; ++ si.closeCallback = closeCallback; + loadedSFScripts.put( key, si ); -+ } -+ } ++ } ++ } + + public void deleteScript( String key ) + { @@ -456,8 +366,8 @@ diff -ruN a/b/rhino1.7.7.2/src/org/mozilla/javascript/tools/debugger/OfficeScrip + result = info.scope; + } + return result; -+ } -+ ++ } ++ + public URL getScriptUrl( String key ) + { + URL result = null; @@ -467,7 +377,7 @@ diff -ruN a/b/rhino1.7.7.2/src/org/mozilla/javascript/tools/debugger/OfficeScrip + result = info.url; + } + return result; -+ } ++ } + public boolean hasScript( String key ) + { + boolean result = true; @@ -475,9 +385,9 @@ diff -ruN a/b/rhino1.7.7.2/src/org/mozilla/javascript/tools/debugger/OfficeScrip + if ( info == null ) + { + result = false; -+ } ++ } + return result; -+ } ++ } + + public void setScriptRunning( String key, boolean running ) + { @@ -507,32 +417,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 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-09 08:26:49 ++++ b/b/rhino1.7.15.1/src/org/mozilla/javascript/tools/debugger/SwingGui.java 2026-11-09 08:26:49 +@@ -48,6 +48,7 @@ + import java.io.PrintStream; + import java.io.Reader; + import java.lang.reflect.Method; +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.Collections; +@@ -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,139 @@ - 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; + } @@ -626,7 +535,7 @@ diff -ruN a/b/rhino1.7.7.2/src/org/mozilla/javascript/tools/debugger/SwingGui.ja + else + { + String url = w.getUrl(); -+ if (url != null) ++ if (url != null) + { + if (officeScripts.isScriptRunning(key)) + { @@ -663,20 +572,22 @@ 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 +2014,8 @@ + } + + /** 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, javax.swing.event.DocumentListener { - /** - * Serializable magic number. -@@ -2089,6 +2224,83 @@ - */ + /** Serializable magic number. */ + private static final long serialVersionUID = -6212382604952082370L; +@@ -1903,6 +2038,83 @@ + /** The current offset position. */ int currentPos; + boolean isModified = false; @@ -756,11 +667,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 +3382,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
