w3c / webdriver-bidi

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

Emit `browsingContext.contextCreated` while subscribing to the event globally #696

Closed sadym-chromium closed 2 months ago

sadym-chromium commented 2 months ago

The spec for "remote end subscribe steps" of browsingContext.contextCreated does not respect the global subscription (contexts=null). This makes the behavior inconsistent with subscription to specific browsing contexts. Unless we want to get rid of this functionality (which is not implemented in Firefox nor in Chromium at the moment), we should fix the spec, so that the events are emitted for each existing browsing context before the global subscription command is finished.

sadym-chromium commented 2 months ago

Open question: should the events for existing browsing contexts be emitted, if the subscription is already exist?

css-meeting-bot commented 2 months ago

The Browser Testing and Tools Working Group just discussed Emit `browsingContext.contextCreated` while subscribing to the event globally.

The full IRC log of that discussion <AutomatedTester_> topic: Emit `browsingContext.contextCreated` while subscribing to the event globally
<AutomatedTester_> github: https://github.com/w3c/webdriver-bidi/issues/696
<AutomatedTester_> sadym: I noticed in the spec that we don't do this globally but we do it for the specific case
<AutomatedTester_> ... so I think this is a problem, I don't think this was intended
<AutomatedTester_> ... and do we want to re-emit the events if you subscribe again
<jgraham1> q+
<AutomatedTester_> ack next
<AutomatedTester_> jgraham1: I think this is a bug and what you have said is not the behaviour that was intended
<AutomatedTester_> ... and if the use case is not valuable then we should explain or we should fix the bug
<AutomatedTester_> ... especially since no one has implemented this then we should handle the scenario properly
<AutomatedTester_> ... and we should fix the bug
<jdescottes> q+
<AutomatedTester_> I think we should fix it if the context is null or if we don't think this usecase is valuable then we can have a further discussion here
<AutomatedTester_> ack next
<AutomatedTester_> jdescottes: I read this recently, I think this should be handled and should work today but we may want to check again
<AutomatedTester_> q?
sadym-chromium commented 2 months ago

I misread the specification: The remote end subscribe steps is called with the actual contexts returned by update the event map, which contains all the top-level contexts which are not yet subscribed to the event.