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

Implement GetAvailability for Bluetooth #15368

Merged
merged 1 commit into from Feb 13, 2017
Merged

Conversation

@dati91
Copy link
Contributor

dati91 commented Feb 3, 2017

This implements the getAvailability function from the spec.


  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • These changes fix #__ (github issue number if applicable).
  • There are tests for these changes OR
  • These changes do not require tests because _____

This change is Reviewable

@highfive
Copy link

highfive commented Feb 3, 2017

Heads up! This PR modifies the following files:

  • @fitzgen: components/script/dom/webidls/Bluetooth.webidl, components/script/dom/bluetooth.rs
  • @KiChjang: components/script/dom/webidls/Bluetooth.webidl, components/script/dom/bluetooth.rs
@bors-servo
Copy link
Contributor

bors-servo commented Feb 3, 2017

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

@zakorgy zakorgy force-pushed the szeged:get_availability branch from 72a23d3 to 87a1712 Feb 6, 2017
let sender = response_async(&p, self);
self.get_bluetooth_thread().send(
BluetoothRequest::GetAvailability(sender)).unwrap();
return p;

This comment has been minimized.

@nox

nox Feb 7, 2017

Member

return is useless.

This comment has been minimized.

@nox

nox Feb 8, 2017

Member

You still need to change this.

@@ -443,6 +443,18 @@ impl BluetoothMethods for Bluetooth {
return p;
}

#[allow(unrooted_must_root)]

This comment has been minimized.

@nox

nox Feb 7, 2017

Member

Why?

This comment has been minimized.

@dati91

dati91 Feb 8, 2017

Author Contributor

Required for the Rc<Promise>

This comment has been minimized.

@nox

nox Feb 8, 2017

Member

@jdm That sounds very weird, why does Rc<Promise> need unrooted_must_root be allowed?

This comment has been minimized.

@jdm

jdm Feb 8, 2017

Member

Because our rooting lint doesn't understand that Rc<Promise> is safe. I thought there was an issue about it, but I can't find it.

This comment has been minimized.

@nox

nox Feb 8, 2017

Member

Ok.

@@ -924,4 +927,12 @@ impl BluetoothManager {
// TODO: Implement this when supported in lower level
return Err(BluetoothError::NotSupported);
}

// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetooth-getavailability
fn get_availability(&mut self) -> BluetoothResponseResult {

This comment has been minimized.

@nox

nox Feb 7, 2017

Member

Why does this return a Result? It doesn't seem to return any error.

This comment has been minimized.

@dati91

dati91 Feb 8, 2017

Author Contributor

This is called via an async promise and the handle function requires a result, because usually a promise could fail, but this will only resolve. Step 2 - 3.

This comment has been minimized.

@nox

nox Feb 8, 2017

Member

Ok.

match self.get_adapter() {
Ok(_) => Ok(BluetoothResponse::GetAvailability(true)),
Err(_) => Ok(BluetoothResponse::GetAvailability(false)),
}

This comment has been minimized.

@nox

nox Feb 7, 2017

Member
BluetoothResponse::GetAvailability(self.get_adapter().is_ok())
@bors-servo
Copy link
Contributor

bors-servo commented Feb 7, 2017

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

@dati91 dati91 force-pushed the szeged:get_availability branch from 87a1712 to 8e2201e Feb 8, 2017
Copy link
Member

nox left a comment

Please squash and remove that superfluous return.

@@ -443,6 +443,18 @@ impl BluetoothMethods for Bluetooth {
return p;
}

#[allow(unrooted_must_root)]

This comment has been minimized.

@nox

nox Feb 8, 2017

Member

Ok.

let sender = response_async(&p, self);
self.get_bluetooth_thread().send(
BluetoothRequest::GetAvailability(sender)).unwrap();
return p;

This comment has been minimized.

@nox

nox Feb 8, 2017

Member

You still need to change this.

@nox
nox approved these changes Feb 13, 2017
@nox
Copy link
Member

nox commented Feb 13, 2017

@bors-servo
Copy link
Contributor

bors-servo commented Feb 13, 2017

📌 Commit ca7aa6b has been approved by nox

@bors-servo
Copy link
Contributor

bors-servo commented Feb 13, 2017

Testing commit ca7aa6b with merge e394334...

bors-servo added a commit that referenced this pull request Feb 13, 2017
Implement GetAvailability for Bluetooth

<!-- Please describe your changes on the following line: -->
This implements the [getAvailability](https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetooth-getavailability) function from the spec.

---
<!-- 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
- [ ] These changes fix #__ (github issue number if applicable).

<!-- Either: -->
- [X] There are tests for these changes OR
- [ ] These changes do not require tests because _____

<!-- 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/15368)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Feb 13, 2017

@bors-servo bors-servo merged commit ca7aa6b into servo:master Feb 13, 2017
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
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.