servo: Merge #11636 - Fix an incorect behavior, when converting optional services (from szeged:optservicesfix); r=jdm
authorzakorgyula <gyula.zakor@gmail.com>
Wed, 08 Jun 2016 10:42:42 -0500
changeset 339042 013e1611353e25b110ff1a8cfaa21c57e57b011c
parent 339041 4afb98ad3ad4dcd784ec251b90f03b99ce2c7f05
child 339043 f6301dc2bd580878b70ec4b9d633382afdc83317
push id31307
push usergszorc@mozilla.com
push dateSat, 04 Feb 2017 00:59:06 +0000
treeherdermozilla-central@94079d43835f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjdm
servo: Merge #11636 - Fix an incorect behavior, when converting optional services (from szeged:optservicesfix); r=jdm As specified in https://webbluetoothcg.github.io/web-bluetooth/#ref-for-blacklisted-2 if any service in the optionalServices are blacklisted, there is no need to throw an error (just remove the service). In this case we don't add the service to the result of conversion. <!-- 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: --> - [ ] There are tests for these changes OR - [X] These changes do not require tests because there are no webbluetooth test api implementation yet. <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: a8b3a07ea2498cb6dcddf6251c71d384153ba9a7
servo/components/script/dom/bluetooth.rs
--- a/servo/components/script/dom/bluetooth.rs
+++ b/servo/components/script/dom/bluetooth.rs
@@ -120,20 +120,19 @@ fn convert_request_device_options(option
     for filter in &options.filters {
         filters.push(try!(canonicalize_filter(&filter, global)));
     }
 
     let mut optional_services = vec!();
     if let Some(ref opt_services) = options.optionalServices {
         for opt_service in opt_services {
             let uuid = try!(BluetoothUUID::GetService(global, opt_service.clone())).to_string();
-            if uuid_is_blacklisted(uuid.as_ref(), Blacklist::All) {
-                return Err(Security)
+            if !uuid_is_blacklisted(uuid.as_ref(), Blacklist::All) {
+                optional_services.push(uuid);
             }
-            optional_services.push(uuid);
         }
     }
 
     Ok(RequestDeviceoptions::new(BluetoothScanfilterSequence::new(filters),
                                  ServiceUUIDSequence::new(optional_services)))
 }
 
 impl BluetoothMethods for Bluetooth {