Bug 172410 - Value for iterator property is wrong for maplike interfaces
Summary: Value for iterator property is wrong for maplike interfaces
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Bindings (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL: https://heycam.github.io/webidl/#es-m...
Keywords: WebExposed
Depends on:
Blocks:
 
Reported: 2017-05-19 22:05 PDT by Chris Dumez
Modified: 2017-05-20 12:14 PDT (History)
4 users (show)

See Also:


Attachments
WIP Patch (3.76 KB, patch)
2017-05-19 22:10 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (6.94 KB, patch)
2017-05-20 08:42 PDT, Chris Dumez
sam: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Dumez 2017-05-19 22:05:06 PDT
Value for iterator property is wrong for maplike interfaces.

Value for iterator property is wrong for maplike interfaces. The iterator property is supposed to have the same value as the 'entries' property but we currently use the value of the 'values' property.

Specification:
- https://heycam.github.io/webidl/#es-map-entries
- https://heycam.github.io/webidl/#es-iterator
Comment 1 Chris Dumez 2017-05-19 22:10:27 PDT
Created attachment 310760 [details]
WIP Patch

This should be testable via the RTCStatsReport interface. I'll look into it tomorrow.
Comment 2 Build Bot 2017-05-19 22:12:18 PDT
Attachment 310760 [details] did not pass style-queue:


ERROR: Source/WebCore/ChangeLog:8:  You should remove the 'No new tests' and either add and list tests, or explain why no new tests were possible.  [changelog/nonewtests] [5]
Total errors found: 1 in 4 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Chris Dumez 2017-05-20 08:37:32 PDT
Confirmed that:
Object.getOwnPropertyDescriptor(RTCStatsReport.prototype, Symbol.iterator).value === Object.getOwnPropertyDescriptor(RTCStatsReport.prototype, 'entries').value

in Firefox.

This does not work in WebKit because RTCStatsReport is wrongly marked as NoInterfaceObject :/
Comment 4 Chris Dumez 2017-05-20 08:42:08 PDT
Created attachment 310772 [details]
Patch
Comment 5 Sam Weinig 2017-05-20 11:57:59 PDT
Comment on attachment 310772 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=310772&action=review

> Source/WebCore/Modules/mediastream/RTCStatsReport.idl:27
> +// FIXME: This should not be marked as [NoInterfaceObject].
>  [

Why not just do it now?

> Source/WebCore/bindings/scripts/CodeGeneratorJS.pm:3469
>          if (InterfaceNeedsIterator($interface)) {
>              AddToImplIncludes("<builtins/BuiltinNames.h>");
> -            if (IsKeyValueIterableInterface($interface)) {
> +            if (IsKeyValueIterableInterface($interface) or $interface->mapLike) {

While you are in the neighborhood (not really, but whatever), consider removing the comment:

    # FIXME: This should return 1 for maplike once we support them.
    return 1 if $interface->mapLike;

in InterfaceNeedsIterator()
Comment 6 Chris Dumez 2017-05-20 12:11:59 PDT
(In reply to Sam Weinig from comment #5)
> Comment on attachment 310772 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=310772&action=review
> 
> > Source/WebCore/Modules/mediastream/RTCStatsReport.idl:27
> > +// FIXME: This should not be marked as [NoInterfaceObject].
> >  [
> 
> Why not just do it now?

Seems unrelated but I will follow up on this ASAP.

> 
> > Source/WebCore/bindings/scripts/CodeGeneratorJS.pm:3469
> >          if (InterfaceNeedsIterator($interface)) {
> >              AddToImplIncludes("<builtins/BuiltinNames.h>");
> > -            if (IsKeyValueIterableInterface($interface)) {
> > +            if (IsKeyValueIterableInterface($interface) or $interface->mapLike) {
> 
> While you are in the neighborhood (not really, but whatever), consider
> removing the comment:
> 
>     # FIXME: This should return 1 for maplike once we support them.
>     return 1 if $interface->mapLike;
> 
> in InterfaceNeedsIterator()

Oh right, this should actually say setlike, not maplike.
Comment 7 Chris Dumez 2017-05-20 12:14:20 PDT
Committed r217188: <http://trac.webkit.org/changeset/217188>