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

Updating GATTServer's Connect/Disconnect calls #14612

Merged
merged 1 commit into from Dec 22, 2016

Conversation

@zakorgy
Copy link
Contributor

zakorgy commented Dec 16, 2016

Added the missing Step 5.2.3 to the connect function.
Updated the disconnect function to its current state in the specification, including the clean_up_disconnected_device and the garbage_collect_the connection functions.
Added new tests for checking the invalid state of JS objects after disconnection.


  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • There are tests for these changes

This change is Reviewable

@highfive
Copy link

highfive commented Dec 16, 2016

Heads up! This PR modifies the following files:

  • @fitzgen: components/script/dom/bluetoothdevice.rs, components/script/dom/bluetoothremotegattserver.rs, components/script/dom/bluetooth.rs
  • @KiChjang: components/script/dom/bluetoothdevice.rs, components/script/dom/bluetoothremotegattserver.rs, components/script/dom/bluetooth.rs
@zakorgy
Copy link
Contributor Author

zakorgy commented Dec 16, 2016

r? @jdm

@highfive highfive assigned jdm and unassigned nox Dec 16, 2016
@bors-servo
Copy link
Contributor

bors-servo commented Dec 16, 2016

The latest upstream changes (presumably #14593) made this pull request unmergeable. Please resolve the merge conflicts.

@dati91 dati91 force-pushed the szeged:connect-disconnect-update branch from 291dec8 to 3360085 Dec 16, 2016
Copy link
Member

jdm left a comment

Do we have any plans to improve the maintainability of the tests? I'm please that we're adding so many, but it's getting really hard to review them well when each file is so similar.

}

// https://webbluetoothcg.github.io/web-bluetooth/#garbage-collect-the-connection
#[allow(unrooted_must_root)]

This comment has been minimized.

@jdm

jdm Dec 20, 2016

Member

Why is this necessary?

This comment has been minimized.

@zakorgy

zakorgy Dec 21, 2016

Author Contributor

Without this the following error shows up for line 61:

error: Expression of type std::collections::hash_map::Iter<'_, std::string::String, dom::bindings::js::MutJS<dom::bluetoothdevice::BluetoothDevice>> must be rooted, #[deny(unrooted_must_root)] on by default
  --> /home/zakorgy/servo/components/script/dom/bluetoothremotegattserver.rs:60:9
   |
60 |         for (id, device) in context.get_device_map().borrow().iter() {
   |         ^

The problem is, that device should be rooted here, but i didn't find another way to solve this correctly.


// https://webbluetoothcg.github.io/web-bluetooth/#garbage-collect-the-connection
#[allow(unrooted_must_root)]
fn garbage_collect_the_connection(&self) -> ErrorResult {

This comment has been minimized.

@jdm

jdm Dec 20, 2016

Member

This seems like it belongs on BluetoothDevice instead.

This comment has been minimized.

@zakorgy

zakorgy Dec 21, 2016

Author Contributor

I put this function here because in the specification this function is in the section of the BluetoothRemoteGATTServer methods, but it can be moved to BluetoothDevice methods as well.

if let Err(e) = self.garbage_collect_the_connection() {
promise.reject_error(promise_cx, Error::from(e));
}
promise.reject_error(promise_cx, Error::Network);

This comment has been minimized.

@jdm

jdm Dec 20, 2016

Member

The spec says to abort the steps here, otherwise we'll also resolve the promise.

@@ -0,0 +1,39 @@
<!doctype html>

This comment has been minimized.

@jdm

jdm Dec 20, 2016

Member

Given how similar this test and disconnect-invalidates-objects.html are, it would be nice to combine the with/without uuids tests in the same file rather than duplicating so much code in each of them.

@zakorgy
Copy link
Contributor Author

zakorgy commented Dec 22, 2016

I have removed the with-uuid tests, because the main goal here is not to test the with-uuid functionalities, which are already tested, and the without uuids tests also contain those cases .

@jdm
jdm approved these changes Dec 22, 2016
@jdm
Copy link
Member

jdm commented Dec 22, 2016

@bors-servo: delegate+
This can merge with r=jdm after squashing.

@bors-servo
Copy link
Contributor

bors-servo commented Dec 22, 2016

✌️ @zakorgy can now approve this pull request

@zakorgy zakorgy force-pushed the szeged:connect-disconnect-update branch from deaeb83 to 6e02cb2 Dec 22, 2016
@zakorgy
Copy link
Contributor Author

zakorgy commented Dec 22, 2016

@bors-servo: r=jdm

@bors-servo
Copy link
Contributor

bors-servo commented Dec 22, 2016

📌 Commit 6e02cb2 has been approved by jdm

@bors-servo
Copy link
Contributor

bors-servo commented Dec 22, 2016

Testing commit 6e02cb2 with merge 23590f6...

bors-servo added a commit that referenced this pull request Dec 22, 2016
Updating GATTServer's  Connect/Disconnect calls

<!-- Please describe your changes on the following line: -->
Added the missing [Step 5.2.3](master...szeged:connect-disconnect-updatediff-1dbe29f87740f5aec93f37adbecace6cR213) to the `connect` function.
Updated the [disconnect](https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattserver-disconnect) function to its current state in the specification, including the `clean_up_disconnected_device` and the `garbage_collect_the connection` functions.
Added new tests for checking the invalid state of JS objects after disconnection.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] There are tests for these changes

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/14612)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Dec 22, 2016

@bors-servo bors-servo merged commit 6e02cb2 into servo:master Dec 22, 2016
3 checks passed
3 checks passed
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
@bors-servo bors-servo mentioned this pull request Dec 22, 2016
2 of 2 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

5 participants
You can’t perform that action at this time.