Skip to content

Commit

Permalink
WriteValue should return undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
dati91 committed Nov 28, 2016
1 parent 4dbca05 commit 50a5639
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
5 changes: 2 additions & 3 deletions components/script/dom/bluetoothremotegattcharacteristic.rs
Expand Up @@ -300,9 +300,8 @@ impl AsyncBluetoothListener for BluetoothRemoteGATTCharacteristic {
promise.resolve_native(promise_cx, &value);
},
BluetoothResponse::WriteValue(result) => {
let value = ByteString::new(result);
*self.value.borrow_mut() = Some(value.clone());
promise.resolve_native(promise_cx, &value);
*self.value.borrow_mut() = Some(ByteString::new(result));
promise.resolve_native(promise_cx, &());
},
BluetoothResponse::EnableNotification(_result) => {
promise.resolve_native(promise_cx, self);
Expand Down
5 changes: 2 additions & 3 deletions components/script/dom/bluetoothremotegattdescriptor.rs
Expand Up @@ -137,9 +137,8 @@ impl AsyncBluetoothListener for BluetoothRemoteGATTDescriptor {
promise.resolve_native(promise_cx, &value);
},
BluetoothResponse::WriteValue(result) => {
let value = ByteString::new(result);
*self.value.borrow_mut() = Some(value.clone());
promise.resolve_native(promise_cx, &value);
*self.value.borrow_mut() = Some(ByteString::new(result));
promise.resolve_native(promise_cx, &());
},
_ => promise.reject_error(promise_cx, Error::Type("Something went wrong...".to_owned())),
}
Expand Down
Expand Up @@ -13,6 +13,7 @@
.then(device => device.gatt.connect())
.then(gattServer => gattServer.getPrimaryService(generic_access.name))
.then(service => service.getCharacteristic(device_name.name))
.then(characteristic => characteristic.writeValue(new Uint8Array(1)));
.then(characteristic => characteristic.writeValue(new Uint8Array(1)))
.then(result => assert_equals(result, undefined));
}, 'A regular write request to a writable characteristic should succeed.');
</script>
Expand Up @@ -14,6 +14,7 @@
.then(gattServer => gattServer.getPrimaryService(generic_access.name))
.then(service => service.getCharacteristic(device_name.name))
.then(characteristic => characteristic.getDescriptor(number_of_digitals.name))
.then(descriptor => descriptor.writeValue(new Uint8Array(1)));
.then(descriptor => descriptor.writeValue(new Uint8Array(1)))
.then(result => assert_equals(result, undefined));
}, 'A regular write request to a writable descriptor should succeed.');
</script>

0 comments on commit 50a5639

Please sign in to comment.