Skip to content

XS: next on the String, Map, and Set iterator prototypes is non-configurable #1686

Description

@d01c2

Build environment: macOS 26.5.2

Moddable SDK version:

  • Installed via jsvu, so there is no SDK source tree / git describe.
  • Engine reports: XS 17.9.1, slot 32 bytes, ID 4 bytes

Target device: desktop (host xs)

Description
The next method of %StringIteratorPrototype%, %MapIteratorPrototype% and %SetIteratorPrototype% is created as a non-configurable property.

Unless its own definition states otherwise, a built-in data property has the attributes { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true }. %StringIteratorPrototype%.next, %MapIteratorPrototype%.next and %SetIteratorPrototype%.next state no attributes of their own, so the default applies and all three must be configurable.

Steps to Reproduce

$ xst -e 'print(Object.getOwnPropertyDescriptor(Object.getPrototypeOf(""[Symbol.iterator]()), "next").configurable)'
false

Expected behavior
true.

For comparison, V8 (15.4.18):

$ v8 -e 'print(Object.getOwnPropertyDescriptor(Object.getPrototypeOf(""[Symbol.iterator]()), "next").configurable)'
true

Other information
The Map and Set iterator prototypes behave the same way:

$ xst -e 'print(Object.getOwnPropertyDescriptor(Object.getPrototypeOf(new Map()[Symbol.iterator]()), "next").configurable)'
false
$ xst -e 'print(Object.getOwnPropertyDescriptor(Object.getPrototypeOf(new Set()[Symbol.iterator]()), "next").configurable)'
false

The remaining iterator prototypes are correct. %ArrayIteratorPrototype%, %RegExpStringIteratorPrototype%, %GeneratorPrototype%, %IteratorHelperPrototype% and %WrapForValidIteratorPrototype% all report configurable: true, so only these three differ.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions