Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upUpdate WebBluetooth to use Promises #13428
Conversation
highfive
commented
Sep 26, 2016
|
Heads up! This PR modifies the following files:
|
highfive
commented
Sep 26, 2016
|
r? @jdm |
|
Great improvement! |
| pub fn result_to_promise<T: ToJSValConvertible>(global_ref: GlobalRef, | ||
| bluetooth_result: Fallible<T>) | ||
| -> Fallible<Rc<Promise>> { | ||
| match bluetooth_result { |
This comment has been minimized.
This comment has been minimized.
jdm
Sep 26, 2016
Member
let p = Promise::new(global_ref);
match bluetooth_result {
Ok(v) => p.resolve_native(v),
Err(e) => p.reject_error(e),
}| } | ||
|
|
||
| #[allow(unrooted_must_root)] | ||
| #[allow(unsafe_code)] |
This comment has been minimized.
This comment has been minimized.
| #[allow(unsafe_code)] | ||
| pub fn result_to_promise<T: ToJSValConvertible>(global_ref: GlobalRef, | ||
| bluetooth_result: Fallible<T>) | ||
| -> Fallible<Rc<Promise>> { |
This comment has been minimized.
This comment has been minimized.
| @@ -23,9 +23,8 @@ interface Bluetooth { | |||
| // [SecureContext] | |||
| // readonly attribute BluetoothDevice? referringDevice; | |||
| // [SecureContext] | |||
| // Promise<BluetoothDevice> requestDevice(RequestDeviceOptions options); | |||
| [Throws] | |||
This comment has been minimized.
This comment has been minimized.
jdm
Sep 26, 2016
•
Member
This doesn't need to be here anymore, or most (all?) of the other ones in other bluetooth webidl files.
This comment has been minimized.
This comment has been minimized.
dati91
Sep 26, 2016
Author
Contributor
Do you mean we should remove the Throws/Fallible from the return types?
This comment has been minimized.
This comment has been minimized.
jdm
Sep 26, 2016
Member
Specifically, the [Throws] annotation, since none of the methods throw an exception any more.
|
@bors-servo: delegate+ |
|
|
|
|
|
@bors-servo: r- |
|
@bors-servo: r=jdm |
|
|
Update WebBluetooth to use Promises <!-- Please describe your changes on the following line: --> Initial patch to support promises in WebBluetooth. This will allow us to use the expected syntax in webpages. --- <!-- 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/13428) <!-- Reviewable:end -->
|
|
|
@bors-servo: retry |
Update WebBluetooth to use Promises <!-- Please describe your changes on the following line: --> Initial patch to support promises in WebBluetooth. This will allow us to use the expected syntax in webpages. --- <!-- 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/13428) <!-- Reviewable:end -->
|
|
|
@bors-servo retry |
1 similar comment
|
@bors-servo retry |
Update WebBluetooth to use Promises <!-- Please describe your changes on the following line: --> Initial patch to support promises in WebBluetooth. This will allow us to use the expected syntax in webpages. --- <!-- 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/13428) <!-- Reviewable:end -->
|
|
dati91 commentedSep 26, 2016
•
edited by larsbergstrom
Initial patch to support promises in WebBluetooth.
This will allow us to use the expected syntax in webpages.
./mach build -ddoes not report any errors./mach test-tidydoes not report any errorsThis change is