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