Open renovate[bot] opened 10 months ago
Copied from https://github.com/antville/helma/pull/39#issuecomment-1554574060:
Currently throwing exception trying to access cleanly installed welcome app:
[ERROR] [welcome-1] GET:favicon.ico org.mozilla.javascript.EvaluatorException: Wrapped java.lang.NullPointerException (/Users/tobi/Desktop/helma/modules/tools/Global/helma.Inspector.js#304)
org.mozilla.javascript.EvaluatorException: Wrapped java.lang.NullPointerException (/Users/tobi/Desktop/helma/modules/tools/Global/helma.Inspector.js#304)
at helma.scripting.rhino.RhinoCore.getValidPrototype(RhinoCore.java:448)
at helma.scripting.rhino.RhinoCore.getNodeWrapper(RhinoCore.java:695)
at helma.scripting.rhino.RhinoCore$WrapMaker.wrap(RhinoCore.java:1136)
at org.mozilla.javascript.ScriptRuntime.toObject(ScriptRuntime.java:1258)
at org.mozilla.javascript.ScriptRuntime.toObject(ScriptRuntime.java:1176)
at org.mozilla.javascript.Context.toObject(Context.java:1640)
at helma.scripting.rhino.RhinoEngine.setGlobals(RhinoEngine.java:203)
at helma.framework.core.RequestEvaluator.initGlobals(RequestEvaluator.java:1008)
at helma.framework.core.RequestEvaluator.run(RequestEvaluator.java:222)
at java.base/java.lang.Thread.run(Thread.java:829)
The Rhino commit causing the exception is https://github.com/mozilla/rhino/commit/73a8b29d795af5c828d67334e75e46f4e3d2d183 – found via git bisect
.
A work-around is patching MemberBox.java with an NP check:
diff --git a/src/org/mozilla/javascript/MemberBox.java b/src/org/mozilla/javascript/MemberBox.java
index a24d4743..e97a2811 100644
--- a/src/org/mozilla/javascript/MemberBox.java
+++ b/src/org/mozilla/javascript/MemberBox.java
@@ -202,10 +202,13 @@ final class MemberBox implements Serializable {
if (target instanceof Delegator) {
target = ((Delegator) target).getDelegee();
}
- for (int i = 0; i < args.length; ++i) {
- if (args[i] instanceof Delegator) {
- args[i] = ((Delegator) args[i]).getDelegee();
- }
+
+ if (args != null) {
+ for (int i = 0; i < args.length; ++i) {
+ if (args[i] instanceof Delegator) {
+ args[i] = ((Delegator) args[i]).getDelegee();
+ }
+ }
}
try {
Digging deeper, there is a weird inconsistency between Context.emptyArgs
and ScriptRuntime.emptyArgs
: although the former is set to the latter in Context.java and ScriptRuntime.java, resp., both are not the same in JavaMembers.java:
// Context.java
public static final Object[] emptyArgs = ScriptRuntime.emptyArgs;
// ScriptRuntime.java
public static final Object[] emptyArgs = new Object[0];
// JavaMembers.java
rval = bp.getter.invoke(javaObject, Context.emptyArgs);
// Context.emptyArgs != ScriptRuntime.emptyArgs 🤷
At this point, Context.emptyArgs
is indeed null
, while ScriptRuntime.emptyArgs
is not! This can be used as an alternative work-around here:
diff --git a/src/org/mozilla/javascript/JavaMembers.java b/src/org/mozilla/javascript/JavaMembers.java
index f9c457b0..58fc8f3b 100644
--- a/src/org/mozilla/javascript/JavaMembers.java
+++ b/src/org/mozilla/javascript/JavaMembers.java
@@ -100,7 +100,7 @@ class JavaMembers {
if (member instanceof BeanProperty) {
BeanProperty bp = (BeanProperty) member;
if (bp.getter == null) return Scriptable.NOT_FOUND;
- rval = bp.getter.invoke(javaObject, Context.emptyArgs);
+ rval = bp.getter.invoke(javaObject, ScriptRuntime.emptyArgs);
type = bp.getter.method().getReturnType();
} else {
Field field = (Field) member;
It begs the question if this is a Rhino issue, or if there is some Helma code causing this…
This PR contains the following updates:
1.7.13
->1.7.15
Release Notes
mozilla/rhino (org.mozilla:rhino)
### [`v1.7.15`](https://togithub.com/mozilla/rhino/blob/HEAD/RELEASE-NOTES.md#Rhino-1715) #### May 3, 2024 Highlights of this release include: - Basic support for "rest parameters" - Improvements in Unicode support - "Symbol.species" implemented in many places - More correct property ordering in many places - And many more improvements and bug fixes This release includes committs from 29 different committers. Thanks to you all for your help! ### [`v1.7.14`](https://togithub.com/mozilla/rhino/blob/HEAD/RELEASE-NOTES.md#Rhino-1714) #### January 6, 2022Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
â™» Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR has been generated by Mend Renovate. View repository job log here.