After the previous commit the array prototype methods were not found
during njs_object_traverse() invocation. As the result the exceptions in
Array.prototype methods were reported with a backtrace containing "native
(native)" instead of a proper function name.
}
}
- njs_assert(njs_is_string(&key));
+ if (njs_slow_path(!njs_is_string(&key))) {
+ /* Skipping special properties (e.g. array index properties). */
+ return NJS_OK;
+ }
+
njs_string_get(&key, &name);
if (njs_slow_path((p + name.length + 3) > end)) {
}
if (njs_is_object(&value)
- && !njs_is_array(&value)
&& !njs_traverse_visited(&visited, &value))
{
ret = njs_traverse_visit(&visited, &value);
prop->type = NJS_PROPERTY_REF;
}
+ njs_set_number(&prop->name, index);
+
prop->writable = 1;
prop->enumerable = 1;
prop->configurable = 1;
" at f (:1)\n"
" at main (:1)\n") },
+ { njs_str("[].concat({}.a.a)" ENTER),
+ njs_str("TypeError: cannot get property \"a\" of undefined\n"
+ " at Array.prototype.concat (native)\n"
+ " at main (:1)\n") },
+
{ njs_str("''.repeat(-1)" ENTER),
njs_str("RangeError\n"
" at String.prototype.repeat (native)\n"