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

Annotations for WebBluetooth functions #14407

Merged
merged 3 commits into from Dec 1, 2016
Merged

Conversation

@zakorgy
Copy link
Contributor

zakorgy commented Nov 29, 2016

  1. Moved the convert_request_device_options function steps into request_bluetooth_devices function, to stay consistent with the current specification.
  2. Updated the existing step annotations for the requestDevice and related methods.
  3. Added step annotations for the implemented WebBluetooth methods.

  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • These changes fix #14324, #12614

This change is Reviewable

@highfive
Copy link

highfive commented Nov 29, 2016

Heads up! This PR modifies the following files:

  • @fitzgen: components/script/dom/bluetoothremotegattserver.rs, components/script/dom/bluetoothremotegattservice.rs, components/script/dom/bluetooth.rs, components/script/dom/bluetoothremotegattdescriptor.rs, components/script/dom/bluetoothremotegattcharacteristic.rs, components/script/dom/bluetoothdevice.rs
  • @KiChjang: components/script/dom/bluetoothremotegattserver.rs, components/script/dom/bluetoothremotegattservice.rs, components/script/dom/bluetooth.rs, components/script/dom/bluetoothremotegattdescriptor.rs, components/script/dom/bluetoothremotegattcharacteristic.rs, components/script/dom/bluetoothdevice.rs
@highfive
Copy link

highfive commented Nov 29, 2016

warning Warning warning

  • These commits modify script code, but no tests are modified. Please consider adding a test!
@zakorgy
Copy link
Contributor Author

zakorgy commented Nov 29, 2016

r? @jdm

Copy link
Member

jdm left a comment

This is a great improvement! Thanks!

let manufacturer_id = match u16::from_str(key.as_ref()) {
Ok(id) => id,
Err(err) => return Err(Type(format!("{} {} {}", KEY_CONVERSION_ERROR, key, err))),
};

// Step 7.3: This step is missing,
// because we don't necesarry need to make the conversion to an IDL value.

This comment has been minimized.

Copy link
@jdm

jdm Nov 29, 2016

Member

No need to convert to IDL values since this is only used by native code.

if uuid_is_blocklisted(service.as_ref(), Blocklist::All) {
return Err(Security);
}

// Step 9.6: This step is missing,
// because we don't need necesarry to make the conversion to an IDL value.

This comment has been minimized.

Copy link
@jdm

jdm Nov 29, 2016

Member

No need to convert to IDL values since this is only used by native code.

@@ -636,18 +639,22 @@ impl BluetoothManager {
thread::sleep(Duration::from_millis(CONNECTION_TIMEOUT_MS));
},
}
// TODO: Step 5.1.4: Use the excahnge MTU procedure.

This comment has been minimized.

Copy link
@jdm

jdm Nov 29, 2016

Member

exchange

@@ -664,10 +671,12 @@ impl BluetoothManager {
}
}

// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattserver-getprimaryservice

This comment has been minimized.

Copy link
@jdm
fn get_primary_service(&mut self,
device_id: String,
uuid: String,
sender: IpcSender<BluetoothResponseResult>) {
// Step 2.5.

This comment has been minimized.

Copy link
@jdm
@@ -851,10 +892,12 @@ impl BluetoothManager {
return drop(sender.send(Err(BluetoothError::NotFound)));
}

// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattservice-getcharacteristics

This comment has been minimized.

if !self.cached_characteristics.contains_key(&characteristic_id) {
return drop(sender.send(Err(BluetoothError::InvalidState)));
}
let mut adapter = get_adapter_or_return_error!(self, sender);
let descriptors = self.get_gatt_descriptors_by_uuid(&mut adapter, &characteristic_id, &uuid);

// Step 7: If its argument is empty, throws a NotFoundError.
if descriptors.is_empty() {
return drop(sender.send(Err(BluetoothError::NotFound)));
}

This comment has been minimized.

Copy link
@jdm

jdm Nov 29, 2016

Member

Remove this.

if characteristics_vec.is_empty() {
return drop(sender.send(Err(BluetoothError::NotFound)));
}

return drop(sender.send(Ok(BluetoothResponse::GetCharacteristics(characteristics_vec))));
}

// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattcharacteristic-getdescriptor

This comment has been minimized.

@@ -922,10 +977,12 @@ impl BluetoothManager {
return drop(sender.send(Err(BluetoothError::NotFound)));
}

// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattcharacteristic-getdescriptors

This comment has been minimized.

@@ -934,9 +991,13 @@ impl BluetoothManager {
Some(id) => self.get_gatt_descriptors_by_uuid(&mut adapter, &characteristic_id, &id),
None => self.get_and_cache_gatt_descriptors(&mut adapter, &characteristic_id),
};

// Step 7: If its argument is empty, throws a NotFoundError.
if descriptors.is_empty() {
return drop(sender.send(Err(BluetoothError::NotFound)));
}

This comment has been minimized.

Copy link
@jdm

jdm Nov 29, 2016

Member

Remove this.

@bors-servo
Copy link
Contributor

bors-servo commented Nov 29, 2016

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

@dati91
Copy link
Contributor

dati91 commented Nov 29, 2016

@jdm How should I number the steps? e.g. Step 2.7 which is the 7. step in gattchildren, or Step 7. but then i need to resolve the numbering in the dom side somehow, because there will be 2 Step 1

I realize this thing is a bit unfortunate, but i could move up the gattchildren implementation in my todo list if you prefer :)

@jdm
Copy link
Member

jdm commented Nov 29, 2016

@dati91 I would add a comment like // Subsequent steps are relative to https://webbluetoothcg.github.io/web-bluetooth/#getgattchildren

@dati91 dati91 force-pushed the szeged:annotations branch from d652245 to 5cc0117 Nov 29, 2016
@jdm
Copy link
Member

jdm commented Nov 29, 2016

@bors-servo: delegate+
Squash the latest commits into a9237d6 and this can merge.

@bors-servo
Copy link
Contributor

bors-servo commented Nov 29, 2016

✌️ @zakorgy can now approve this pull request

@zakorgy
Copy link
Contributor Author

zakorgy commented Nov 30, 2016

@bors-servo r=jdm

@bors-servo
Copy link
Contributor

bors-servo commented Nov 30, 2016

📌 Commit 8dd100f has been approved by jdm

bors-servo added a commit that referenced this pull request Nov 30, 2016
Annotations for WebBluetooth functions

<!-- Please describe your changes on the following line: -->
1. Moved the `convert_request_device_options` function steps into `request_bluetooth_devices` function, to stay consistent with the current specification.
2. Updated the existing step annotations for the requestDevice and related methods.
3. Added step annotations for the implemented WebBluetooth methods.

---
<!-- 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] These changes fix  #14324, #12614

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

bors-servo commented Nov 30, 2016

💔 Test failed - android

@zakorgy
Copy link
Contributor Author

zakorgy commented Nov 30, 2016

@bors-servo
Copy link
Contributor

bors-servo commented Nov 30, 2016

Trying commit 8dd100f with merge f2ca433...

bors-servo added a commit that referenced this pull request Nov 30, 2016
Annotations for WebBluetooth functions

<!-- Please describe your changes on the following line: -->
1. Moved the `convert_request_device_options` function steps into `request_bluetooth_devices` function, to stay consistent with the current specification.
2. Updated the existing step annotations for the requestDevice and related methods.
3. Added step annotations for the implemented WebBluetooth methods.

---
<!-- 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] These changes fix  #14324, #12614

<!-- 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/14407)
<!-- Reviewable:end -->
@jdm
Copy link
Member

jdm commented Nov 30, 2016

@zakorgy That's just servo/saltfs#545. You should be able to retry like usual.

@bors-servo
Copy link
Contributor

bors-servo commented Nov 30, 2016

@bors-servo
Copy link
Contributor

bors-servo commented Nov 30, 2016

Testing commit 8dd100f with merge 9a902a7...

bors-servo added a commit that referenced this pull request Nov 30, 2016
Annotations for WebBluetooth functions

<!-- Please describe your changes on the following line: -->
1. Moved the `convert_request_device_options` function steps into `request_bluetooth_devices` function, to stay consistent with the current specification.
2. Updated the existing step annotations for the requestDevice and related methods.
3. Added step annotations for the implemented WebBluetooth methods.

---
<!-- 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] These changes fix  #14324, #12614

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

bors-servo commented Nov 30, 2016

💔 Test failed - linux-rel-css

@KiChjang
Copy link
Member

KiChjang commented Nov 30, 2016

@bors-servo
Copy link
Contributor

bors-servo commented Nov 30, 2016

Previous build results for arm32, arm64, linux-dev, linux-rel-wpt, mac-dev-unit, mac-rel-css, mac-rel-wpt1, mac-rel-wpt2, windows-dev are reusable. Rebuilding only linux-rel-css...

@bors-servo
Copy link
Contributor

bors-servo commented Nov 30, 2016

💔 Test failed - linux-rel-css

@KiChjang
Copy link
Member

KiChjang commented Nov 30, 2016

@bors-servo
Copy link
Contributor

bors-servo commented Dec 1, 2016

Testing commit 8dd100f with merge 16199b4...

bors-servo added a commit that referenced this pull request Dec 1, 2016
Annotations for WebBluetooth functions

<!-- Please describe your changes on the following line: -->
1. Moved the `convert_request_device_options` function steps into `request_bluetooth_devices` function, to stay consistent with the current specification.
2. Updated the existing step annotations for the requestDevice and related methods.
3. Added step annotations for the implemented WebBluetooth methods.

---
<!-- 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] These changes fix  #14324, #12614

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

bors-servo commented Dec 1, 2016

@bors-servo bors-servo merged commit 8dd100f into servo:master Dec 1, 2016
2 of 3 checks passed
2 of 3 checks passed
continuous-integration/appveyor/pr AppVeyor build failed
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.

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