Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"current settings object's relevant global object" is not defined #593

Open
Ms2ger opened this issue Sep 16, 2022 · 4 comments · May be fixed by #595
Open

"current settings object's relevant global object" is not defined #593

Ms2ger opened this issue Sep 16, 2022 · 4 comments · May be fixed by #595

Comments

@Ms2ger
Copy link

Ms2ger commented Sep 16, 2022

https://webbluetoothcg.github.io/web-bluetooth/#handling-visibility-change
https://webbluetoothcg.github.io/web-bluetooth/#handling-full-activity-loss

There's two occurrences of "current settings object's relevant global object" in the spec, but a settings object doesn't have a "relevant global object", only a "global object".

Using "current global object" is also an option.

However, I'm not sure how using the "current" anything works here.

@reillyeon
Copy link
Contributor

The intent of this text is to attach these steps to the "loss of visibility" or "loss of full activity" event on any document. It feels like it should be something like,

When the user agent determines that a document is no longer fully active, it must run these steps:

  1. Let document be that document.
  2. ...

The abort all active watchAdvertisements algorithm should really be taking the document (or the document's navigator.bluetooth instance) as a parameter.

Does that make sense? Can you suggest the proper way to create such an event listener?

@Ms2ger
Copy link
Author

Ms2ger commented Sep 20, 2022

Thanks! The <object> spec does something similar:

Whenever one of the following conditions occur:
...

...
(do some stuff)

so I'm guessing something like what you quoted would be fine.

CC @annevk

@annevk
Copy link

annevk commented Sep 20, 2022

Yeah, probably. Getting some of this formalized better is a long-standing issue of the HTML standard.

@reillyeon
Copy link
Contributor

What do you think of this?

When a document's visibility state changes,

  1. Let document be the document.
  2. Let global be document's relevant global object.
  3. Queue a task on the Bluetooth event source with global and the following steps,
    1. If document’s visibility state is not "visible", then abort all active watchAdvertisements operations on global.

I'm unsure when I want to use the "document" concept vs. the "Document" interface.

To get the Bluetooth instance from a document it seems like I should go through the associated Navigator (given global) and define a similar "associated Bluetooth" concept which is used in the getter steps for the "bluetooth" attribute in the Navigator partial interface.

reillyeon added a commit that referenced this issue Oct 3, 2022
This change fixes the steps for handling visibility change and loss of
full activity to find the global object for the Document which
experienced the event and from there identify the Bluetooth object for
which we need to take action.

This introduces the concept of an "associated Bluetooth", similar to an
"associated Document" and adds a "Bluetooth task source" which is now
used whenever queuing a task.

Fixed #593.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants