w3c / webdriver-bidi

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

Implement "owners" in workers #621

Closed jrandolf-2 closed 9 months ago

jrandolf-2 commented 9 months ago

Every dedicated worker has an outside setting that it's created under. This info is needed to understand the tree structure of dedicated workers.


Preview | Diff

jrandolf-2 commented 9 months ago

Any specific reason we're only doing this for dedicated workers? I think the same approach also works for shared workers.

@jgraham So I'm a little conflicted right now about exposing all owners. What I really want to expose is the "initial owner", not necessarily all of them. If we want to expose all of them, then we'd need events like realm.ownerAdded and realm.ownerRemoved to really capture the entire lifecycle of ownership.

What do you think about extending this to that length?

jgraham commented 9 months ago

I think dedicated workers only ever have one owner, so for that case the events don't seem necessary. For shared workers it makes more sense to me to expose the owners in the same way we do for dedicated workers, but not add lifecycle events until there's clear user demand that it does to not expose the owners because we don't also have lifecycle events.

So, for now, I'd just add the field and information to all worker types, so that we at least have a consistent basis to build from, and consider extending the support later if necessary.

jrandolf-2 commented 9 months ago

I think dedicated workers only ever have one owner, so for that case the events don't seem necessary. For shared workers it makes more sense to me to expose the owners in the same way we do for dedicated workers, but not add lifecycle events until there's clear user demand that it does to not expose the owners because we don't also have lifecycle events.

So, for now, I'd just add the field and information to all worker types, so that we at least have a consistent basis to build from, and consider extending the support later if necessary.

Done.