servo: Merge #14428 - Add missing connection check for disconnect (from dati91:connected); r=jdm
authorAttila Dusnoki <dati91@gmail.com>
Tue, 06 Dec 2016 10:14:28 -0800
changeset 340283 6ffd1a4215b0828a25abb90b8848b0145aa3d7ac
parent 340282 aedda7ae9a21024b39e4589c9f1abdbaf12b6136
child 340284 7d8be1b5c36a92e162454f3435ecf96d22f32634
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 #14428 - Add missing connection check for disconnect (from dati91:connected); r=jdm <!-- Please describe your changes on the following line: --> --- <!-- 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 <!-- Either: --> - [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. --> Source-Repo: https://github.com/servo/servo Source-Revision: 73b6e705b4e18f53f36c8af98543dc2819764ef5
servo/components/script/dom/bluetoothremotegattserver.rs
--- a/servo/components/script/dom/bluetoothremotegattserver.rs
+++ b/servo/components/script/dom/bluetoothremotegattserver.rs
@@ -85,17 +85,20 @@ impl BluetoothRemoteGATTServerMethods fo
         // Step 5: return promise.
         return p;
     }
 
     // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattserver-disconnect
     fn Disconnect(&self) -> ErrorResult {
         // TODO: Step 1: Implement activeAlgorithms internal slot for BluetoothRemoteGATTServer.
 
-        // TODO: Step 2: Check if this.connected is false here too.
+        // Step 2.
+        if !self.Connected() {
+            return Ok(());
+        }
         let (sender, receiver) = ipc::channel().unwrap();
         self.get_bluetooth_thread().send(
             BluetoothRequest::GATTServerDisconnect(String::from(self.Device().Id()), sender)).unwrap();
         let server = receiver.recv().unwrap();
 
         // TODO: Step 3: Implement the `clean up the disconnected device` algorithm.
 
         // TODO: Step 4: Implement representedDevice internal slot for BluetoothDevice.