From 44532ccc9e303cce2ee612801bb7b7887915b305 Mon Sep 17 00:00:00 2001 From: Cam Walter Date: Fri, 6 Sep 2024 01:02:37 -0500 Subject: [PATCH] NativeError: Throw error if no arguments are passed to AggregateError --- rhino/src/main/java/org/mozilla/javascript/NativeError.java | 2 ++ .../org/mozilla/javascript/resources/Messages.properties | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/rhino/src/main/java/org/mozilla/javascript/NativeError.java b/rhino/src/main/java/org/mozilla/javascript/NativeError.java index 753097cd9a..d0e19e1094 100644 --- a/rhino/src/main/java/org/mozilla/javascript/NativeError.java +++ b/rhino/src/main/java/org/mozilla/javascript/NativeError.java @@ -110,6 +110,8 @@ static NativeError makeAggregate( Scriptable newArray = cx.newArray(scope, errors.toArray()); obj.defineProperty("errors", newArray, DONTENUM); } + } else { + throw ScriptRuntime.typeErrorById("msg.iterable.expected"); } return obj; } diff --git a/rhino/src/main/resources/org/mozilla/javascript/resources/Messages.properties b/rhino/src/main/resources/org/mozilla/javascript/resources/Messages.properties index abab5a262d..61e76cf109 100644 --- a/rhino/src/main/resources/org/mozilla/javascript/resources/Messages.properties +++ b/rhino/src/main/resources/org/mozilla/javascript/resources/Messages.properties @@ -972,3 +972,7 @@ msg.promise.any.toobig =\ msg.typed.array.ctor.incompatible = \ Method %TypedArray%.prototype.{0} called on incompatible receiver + +# NativeError +msg.iterable.expected =\ + Expected the first argument to be iterable \ No newline at end of file