Index: src/bootstrapper.cc |
diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc |
index 9d67e627e5e69f151dea840e172d4179dab79cef..991af0954799c3151021042c41f3d870711910fe 100644 |
--- a/src/bootstrapper.cc |
+++ b/src/bootstrapper.cc |
@@ -1440,9 +1440,17 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object, |
factory->NewStringFromAsciiChecked("String Iterator"), |
static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY)); |
- InstallFunction(string_iterator_prototype, "next", JS_OBJECT_TYPE, |
- JSObject::kHeaderSize, MaybeHandle<JSObject>(), |
- Builtins::kStringIteratorPrototypeNext); |
+ Handle<JSFunction> next = |
+ InstallFunction(string_iterator_prototype, "next", JS_OBJECT_TYPE, |
+ JSObject::kHeaderSize, MaybeHandle<JSObject>(), |
+ Builtins::kStringIteratorPrototypeNext); |
+ |
+ // Set the expected parameters for %StringIteratorPrototype%.next to 0 (not |
+ // including the receiver), as required by the builtin. |
+ next->shared()->set_internal_formal_parameter_count(0); |
+ |
+ // Set the length for the function to satisfy ECMA-262. |
+ next->shared()->set_length(0); |
Handle<JSFunction> string_iterator_function = CreateFunction( |
isolate, factory->NewStringFromAsciiChecked("StringIterator"), |