Skip to content

Commit

Permalink
patch from mozilla#1287
Browse files Browse the repository at this point in the history
  • Loading branch information
rbri committed Jan 4, 2023
1 parent 259d63f commit 21a4e0b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/org/mozilla/javascript/BoundFunction.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,15 @@ public BoundFunction(

@Override
public Object call(Context cx, Scriptable scope, Scriptable thisObj, Object[] extraArgs) {
Scriptable callThis = boundThis != null ? boundThis : ScriptRuntime.getTopCallScope(cx);
// Scriptable callThis = boundThis != null ? boundThis : ScriptRuntime.getTopCallScope(cx);
// see https://github.com/mozilla/rhino/pull/1287
Scriptable callThis = boundThis;
if (callThis == null && ScriptRuntime.hasTopCall(cx)) {
callThis = ScriptRuntime.getTopCallScope(cx);
}
if (callThis == null) {
callThis = getTopLevelScope(scope);
}
return targetFunction.call(cx, scope, callThis, concat(boundArgs, extraArgs));
}

Expand Down

0 comments on commit 21a4e0b

Please sign in to comment.