Skip to content

Commit

Permalink
Skip importing same class twice (fixes mozilla#1463)
Browse files Browse the repository at this point in the history
  • Loading branch information
rPraml committed Oct 4, 2024
1 parent d2e2921 commit a7de078
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,10 @@ private static void importClass(Scriptable scope, NativeJavaClass cl) {
String s = cl.getClassObject().getName();
String n = s.substring(s.lastIndexOf('.') + 1);
Object val = scope.get(n, scope);
if (val != NOT_FOUND && val != cl) {
if (val != NOT_FOUND) {
if (val.equals(cl)) {
return; // do not redefine same class
}
throw Context.reportRuntimeErrorById("msg.prop.defined", n);
}
// defineProperty(n, cl, DONTENUM);
Expand Down

0 comments on commit a7de078

Please sign in to comment.