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

Enforce that the current realm is connected while running GATT procedures. #209

Merged
merged 2 commits into from
Mar 9, 2016

Conversation

jyasskin
Copy link
Member

@jyasskin jyasskin commented Feb 2, 2016

This change makes it so that a disconnect() call takes effect immediately and
prevents any subsequent changes to member variables from a returning GATT
procedure, even if the GATT procedure started before the disconnection. It also
forces all active requests to fail with a NetworkError so that no remnants of
the connection keep running after it's terminated.

This reverses the readValue() promise and event order from #175, in order to
avoid needing to perform a microtask checkpoint inside the algorithm.

Fixes #114 and #171.

Preview at https://rawgit.com/jyasskin/web-bluetooth-1/enforce-connectedness/index.html.

@jyasskin
Copy link
Member Author

jyasskin commented Feb 3, 2016

@yrliou @BruceSunMozilla this PR affects how you'll implement disconnection.

even if the UA stays connected the whole time
and the {{BluetoothRemoteGATTServer}} is subsequently re-connected before they finish.
We wrap the returned {{Promise}} to accomplish this.
</span>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we put the note in a separate paragraph?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

…ures.

This change makes it so that a disconnect() call takes effect immediately and
prevents any subsequent changes to member variables from a returning GATT
procedure, even if the GATT procedure started before the disconnection. It also
forces all active requests to fail with a NetworkError so that no remnants of
the connection keep running after it's terminated.

This reverses the readValue() promise and event order from WebBluetoothCG#175, in order to
avoid needing to perform a microtask checkpoint inside the algorithm.

Fixes WebBluetoothCG#114. Fixes WebBluetoothCG#171.
@g-ortuno
Copy link
Contributor

g-ortuno commented Mar 9, 2016

lgtm

jyasskin added a commit that referenced this pull request Mar 9, 2016
Enforce that the current realm is connected while running GATT procedures.
@jyasskin jyasskin merged commit abb1c91 into WebBluetoothCG:gh-pages Mar 9, 2016
@jyasskin jyasskin deleted the enforce-connectedness branch March 9, 2016 18:23
@Emill
Copy link

Emill commented Jan 15, 2017

As discussed in #274 (comment), I don't like the order "fire event then resolve promise" since that makes it impossible to distinguish notifications from read responses.

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 this pull request may close these issues.

None yet

3 participants