w3c / webdriver-bidi

Bidirectional WebDriver protocol for browser automation
https://w3c.github.io/webdriver-bidi/
336 stars 35 forks source link

Remove IteratorRemoteValue from the spec #691

Closed OrKoN closed 3 months ago

OrKoN commented 3 months ago

Currently, how IteratorRemoteValue is produced is not specified as per https://github.com/w3c/webdriver-bidi/issues/537

Additionally, a general iterator is any object with a next method as per https://tc39.es/ecma262/multipage/control-abstraction-objects.html#sec-iterator-interface and it is an interface that any object can implement.

Since there is currently no use case requiring serialization support of iterators, we propose removing IteratorRemoteValue from the spec.

The following use cases have been considered:

1) Evaluating an iterator from the client code (In puppeteer code):

сonst it = await page.evaluateHandle(() => produce an iterator)
await it.evaluate(it => it.next())

Conclusion: serialization as an object is sufficient, since the user knows if they are dealing with an iterator and additionally they can check for the presence of the next method if needed.

2) Logging an iterator object to console

We believe that serializing an iterator as an object would be sufficient.


Preview | Diff

sadym-chromium commented 3 months ago

@jgraham @jimevans WDYT?

OrKoN commented 3 months ago

Does anyone have any use cases in mind that would require special handing of iterators during serialzation?

whimboo commented 3 months ago

@OrKoN can you please remove or better fix all the wpt tests for iterator serialization? Those are failing at the moment on wpt.fyi. Thanks.

OrKoN commented 3 months ago

@whimboo which tests do you mean? I have updated tests in https://github.com/web-platform-tests/wpt/pull/45217 and they all pass for Firefox.

whimboo commented 3 months ago

Oh wait. I was looking at eg this test. But yeah it passes now for Firefox and as it looks like requires a bidi mapper release for Chrome to pass the test?

OrKoN commented 3 months ago

Oh wait. I was looking at eg this test. But yeah it passes now for Firefox and as it looks like requires a bidi mapper release for Chrome to pass the test?

yes, I think chromium-bidi version is not the latest in wpt.fyi. Latest results can be viewed in https://googlechromelabs.github.io/chromium-bidi/.