New issue
Advanced search Search tips

Issue 793204 link

Starred by 4 users

Issue metadata

Status: Available
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 2
Type: Bug


Participants' hotlists:
Hotlist-Bindings-IDLCompiler


Sign in to add a comment

Incorrect @@toStringTag for IDL iterator objects and prototypes

Reported by timothygu99@gmail.com, Dec 8 2017

Issue description

UserAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.70 Safari/537.36

Steps to reproduce the problem:
const it = new URLSearchParams().keys();
console.log(Object.prototype.toString.call(it));
console.log(Object.prototype.toString.call(Object.getPrototypeOf(it)));
console.log(Object.getPrototypeOf(it)[Symbol.toStringTag]);

What is the expected behavior?
Per requirements for "class strings" in

- https://heycam.github.io/webidl/#es-default-iterator-object
- https://heycam.github.io/webidl/#es-iterator-prototype-object

the following should be printed:

[object URLSearchParams Iterator]
[object URLSearchParams Iterator]
URLSearchParams Iterator

What went wrong?
The following are printed:

[object Iterator]
[object Iterator]
Iterator

Did this work before? No 

Does this work in other browsers? N/A

Chrome version: 64.0.3278.0  Channel: dev
OS Version: 
Flash Version: 

Even before the recently merged https://github.com/heycam/webidl/pull/483, the following should have been printed:

[object URLSearchParamsIterator]
[object URLSearchParamsIterator]
URLSearchParamsIterator

In other words, @@toStringTag have never really been correctly implemented for iterator objects (and their prototypes).

https://github.com/heycam/webidl/pull/483 brings the class strings for iterator objects (and their prototypes) in line with ECMAScript builtins, like Map and Set (Object.getPrototypeOf(new Map().keys())[Symbol.toStringTag] === "Map Iterator").
 
Labels: -OS-Linux
Status: Available (was: Unconfirmed)
Confirming. AFAICS our code to create Iterator objects does not pass any information about its corresponding interface, so we end up calling V8DOMConfiguration::SetClassString() with just "Iterator".
By the way, is this being tested in WPT via idlharness.js or something?
@raphael I don't believe it is included in WPT, because its behavior hadn't been fully sorted out. It looks like it's going to be an easy fix though.
Cc: timothygu@chromium.org
Cc: peria@chromium.org yukishiino@chromium.org
Labels: Hotlist-Bindings-IDLCompiler
Owner: peria@chromium.org

Sign in to add a comment