w3c / webdriver-bidi

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

Handle `log.entryAdded` ownership #214

Open sadym-chromium opened 2 years ago

sadym-chromium commented 2 years ago

Follow up after https://github.com/w3c/webdriver-bidi/pull/206

As a BiDi user, I want to be able to use arguments of the event log.entryAdded. Currently there is no way to do it, as the ownership model for such events is none, meaning only copy of the arguments is sent, without strong reference.

Consider adding ownership parameter to session.subscribe method, or set a global flag for such a behaviour.

css-meeting-bot commented 2 years ago

The Browser Testing and Tools Working Group just discussed Ownership of data passed back from events.

The full IRC log of that discussion <jgraham> Topic: Ownership of data passed back from events
<jgraham> Github: https://github.com/w3c/webdriver-bidi/issues/214
<foolip> q?
<jgraham> foolip: Related to ownership of values returned from script evaluation commands. For those we have a model where you can opt in to getting into ownership. For events we don't have an opt-in mechansim, so you can't keep these alive or guarantee to access them later. Could add an option in ssession.subscribe which allows to opt-in to ownership.
<jgraham> q+
<foolip> ack jgraham
<jgraham> jgraham: CDP has strong ownership here by default, and there's a magic object group that you use to release all these handles. We shouldn't do that; with better object serialisation you don't always need to take a strong reference. We probably don't want to use session.subscribe because that can refer to lots of commands / modules. Could have module-level config commands or something.
<jgraham> foolip: Puppeteer seems to leak these by default, so that suggests we don't want to adopt the same design. Is the proposal to add a command like `log.setOwnership`?
<jgraham> jgraham: Maybe log.configure({ownership})