aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--components/script/dom/bluetooth.rs10
-rw-r--r--components/script/dom/bluetoothdevice.rs28
-rw-r--r--components/script/dom/bluetoothremotegattcharacteristic.rs14
-rw-r--r--components/script/dom/bluetoothremotegattdescriptor.rs8
-rw-r--r--components/script/dom/bluetoothremotegattserver.rs8
-rw-r--r--components/script/dom/bluetoothremotegattservice.rs8
6 files changed, 38 insertions, 38 deletions
diff --git a/components/script/dom/bluetooth.rs b/components/script/dom/bluetooth.rs
index dcbb398a4ee..ce4e15103f4 100644
--- a/components/script/dom/bluetooth.rs
+++ b/components/script/dom/bluetooth.rs
@@ -15,7 +15,7 @@ use dom::bindings::codegen::Bindings::EventHandlerBinding::EventHandlerNonNull;
use dom::bindings::codegen::UnionTypes::StringOrUnsignedLong;
use dom::bindings::error::Error::{self, Network, NotFound, Security, Type};
use dom::bindings::error::Fallible;
-use dom::bindings::js::{MutJS, Root};
+use dom::bindings::js::{JS, Root};
use dom::bindings::refcounted::{Trusted, TrustedPromise};
use dom::bindings::reflector::{DomObject, reflect_dom_object};
use dom::bindings::str::DOMString;
@@ -83,7 +83,7 @@ impl<T: AsyncBluetoothListener + DomObject> BluetoothContext<T> {
#[dom_struct]
pub struct Bluetooth {
eventtarget: EventTarget,
- device_instance_map: DOMRefCell<HashMap<String, MutJS<BluetoothDevice>>>,
+ device_instance_map: DOMRefCell<HashMap<String, JS<BluetoothDevice>>>,
}
impl Bluetooth {
@@ -104,7 +104,7 @@ impl Bluetooth {
self.global().as_window().bluetooth_thread()
}
- pub fn get_device_map(&self) -> &DOMRefCell<HashMap<String, MutJS<BluetoothDevice>>> {
+ pub fn get_device_map(&self) -> &DOMRefCell<HashMap<String, JS<BluetoothDevice>>> {
&self.device_instance_map
}
@@ -466,13 +466,13 @@ impl AsyncBluetoothListener for Bluetooth {
BluetoothResponse::RequestDevice(device) => {
let mut device_instance_map = self.device_instance_map.borrow_mut();
if let Some(existing_device) = device_instance_map.get(&device.id.clone()) {
- return promise.resolve_native(promise_cx, &existing_device.get());
+ return promise.resolve_native(promise_cx, &**existing_device);
}
let bt_device = BluetoothDevice::new(&self.global(),
DOMString::from(device.id.clone()),
device.name.map(DOMString::from),
&self);
- device_instance_map.insert(device.id, MutJS::new(&bt_device));
+ device_instance_map.insert(device.id, JS::from_ref(&bt_device));
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetooth-requestdevice
// Step 5.
promise.resolve_native(promise_cx, &bt_device);
diff --git a/components/script/dom/bluetoothdevice.rs b/components/script/dom/bluetoothdevice.rs
index d56970c0d98..cd3d3dc07fa 100644
--- a/components/script/dom/bluetoothdevice.rs
+++ b/components/script/dom/bluetoothdevice.rs
@@ -12,7 +12,7 @@ use dom::bindings::codegen::Bindings::EventHandlerBinding::EventHandlerNonNull;
use dom::bindings::error::Error;
use dom::bindings::error::ErrorResult;
use dom::bindings::inheritance::Castable;
-use dom::bindings::js::{MutJS, MutNullableJS, Root};
+use dom::bindings::js::{JS, MutNullableJS, Root};
use dom::bindings::reflector::{DomObject, reflect_dom_object};
use dom::bindings::str::DOMString;
use dom::bluetooth::{AsyncBluetoothListener, Bluetooth, response_async};
@@ -37,10 +37,10 @@ pub struct BluetoothDevice {
id: DOMString,
name: Option<DOMString>,
gatt: MutNullableJS<BluetoothRemoteGATTServer>,
- context: MutJS<Bluetooth>,
- attribute_instance_map: (DOMRefCell<HashMap<String, MutJS<BluetoothRemoteGATTService>>>,
- DOMRefCell<HashMap<String, MutJS<BluetoothRemoteGATTCharacteristic>>>,
- DOMRefCell<HashMap<String, MutJS<BluetoothRemoteGATTDescriptor>>>),
+ context: JS<Bluetooth>,
+ attribute_instance_map: (DOMRefCell<HashMap<String, JS<BluetoothRemoteGATTService>>>,
+ DOMRefCell<HashMap<String, JS<BluetoothRemoteGATTCharacteristic>>>,
+ DOMRefCell<HashMap<String, JS<BluetoothRemoteGATTDescriptor>>>),
watching_advertisements: Cell<bool>,
}
@@ -54,7 +54,7 @@ impl BluetoothDevice {
id: id,
name: name,
gatt: Default::default(),
- context: MutJS::new(context),
+ context: JS::from_ref(context),
attribute_instance_map: (DOMRefCell::new(HashMap::new()),
DOMRefCell::new(HashMap::new()),
DOMRefCell::new(HashMap::new())),
@@ -75,7 +75,7 @@ impl BluetoothDevice {
}
fn get_context(&self) -> Root<Bluetooth> {
- self.context.get()
+ Root::from_ref(&self.context)
}
pub fn get_or_create_service(&self,
@@ -85,14 +85,14 @@ impl BluetoothDevice {
let (ref service_map_ref, _, _) = self.attribute_instance_map;
let mut service_map = service_map_ref.borrow_mut();
if let Some(existing_service) = service_map.get(&service.instance_id) {
- return existing_service.get();
+ return Root::from_ref(&existing_service);
}
let bt_service = BluetoothRemoteGATTService::new(&server.global(),
&server.Device(),
DOMString::from(service.uuid.clone()),
service.is_primary,
service.instance_id.clone());
- service_map.insert(service.instance_id.clone(), MutJS::new(&bt_service));
+ service_map.insert(service.instance_id.clone(), JS::from_ref(&bt_service));
return bt_service;
}
@@ -103,7 +103,7 @@ impl BluetoothDevice {
let (_, ref characteristic_map_ref, _) = self.attribute_instance_map;
let mut characteristic_map = characteristic_map_ref.borrow_mut();
if let Some(existing_characteristic) = characteristic_map.get(&characteristic.instance_id) {
- return existing_characteristic.get();
+ return Root::from_ref(&existing_characteristic);
}
let properties =
BluetoothCharacteristicProperties::new(&service.global(),
@@ -121,7 +121,7 @@ impl BluetoothDevice {
DOMString::from(characteristic.uuid.clone()),
&properties,
characteristic.instance_id.clone());
- characteristic_map.insert(characteristic.instance_id.clone(), MutJS::new(&bt_characteristic));
+ characteristic_map.insert(characteristic.instance_id.clone(), JS::from_ref(&bt_characteristic));
return bt_characteristic;
}
@@ -139,13 +139,13 @@ impl BluetoothDevice {
let (_, _, ref descriptor_map_ref) = self.attribute_instance_map;
let mut descriptor_map = descriptor_map_ref.borrow_mut();
if let Some(existing_descriptor) = descriptor_map.get(&descriptor.instance_id) {
- return existing_descriptor.get();
+ return Root::from_ref(&existing_descriptor);
}
let bt_descriptor = BluetoothRemoteGATTDescriptor::new(&characteristic.global(),
characteristic,
DOMString::from(descriptor.uuid.clone()),
descriptor.instance_id.clone());
- descriptor_map.insert(descriptor.instance_id.clone(), MutJS::new(&bt_descriptor));
+ descriptor_map.insert(descriptor.instance_id.clone(), JS::from_ref(&bt_descriptor));
return bt_descriptor;
}
@@ -193,7 +193,7 @@ impl BluetoothDevice {
for (id, device) in context.get_device_map().borrow().iter() {
// Step 2.1 - 2.2.
if id == &self.Id().to_string() {
- if device.get().Gatt().Connected() {
+ if device.Gatt().Connected() {
return Ok(());
}
// TODO: Step 2.3: Implement activeAlgorithms internal slot for BluetoothRemoteGATTServer.
diff --git a/components/script/dom/bluetoothremotegattcharacteristic.rs b/components/script/dom/bluetoothremotegattcharacteristic.rs
index b4b9941343b..7e72bb57a98 100644
--- a/components/script/dom/bluetoothremotegattcharacteristic.rs
+++ b/components/script/dom/bluetoothremotegattcharacteristic.rs
@@ -16,7 +16,7 @@ use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServiceBinding::Bluetoo
use dom::bindings::codegen::Bindings::EventHandlerBinding::EventHandlerNonNull;
use dom::bindings::error::Error::{self, InvalidModification, Network, NotSupported, Security};
use dom::bindings::inheritance::Castable;
-use dom::bindings::js::{MutJS, Root};
+use dom::bindings::js::{JS, Root};
use dom::bindings::reflector::{DomObject, reflect_dom_object};
use dom::bindings::str::{ByteString, DOMString};
use dom::bluetooth::{AsyncBluetoothListener, get_gatt_children, response_async};
@@ -38,9 +38,9 @@ pub const MAXIMUM_ATTRIBUTE_LENGTH: usize = 512;
#[dom_struct]
pub struct BluetoothRemoteGATTCharacteristic {
eventtarget: EventTarget,
- service: MutJS<BluetoothRemoteGATTService>,
+ service: JS<BluetoothRemoteGATTService>,
uuid: DOMString,
- properties: MutJS<BluetoothCharacteristicProperties>,
+ properties: JS<BluetoothCharacteristicProperties>,
value: DOMRefCell<Option<ByteString>>,
instance_id: String,
}
@@ -53,9 +53,9 @@ impl BluetoothRemoteGATTCharacteristic {
-> BluetoothRemoteGATTCharacteristic {
BluetoothRemoteGATTCharacteristic {
eventtarget: EventTarget::new_inherited(),
- service: MutJS::new(service),
+ service: JS::from_ref(service),
uuid: uuid,
- properties: MutJS::new(properties),
+ properties: JS::from_ref(properties),
value: DOMRefCell::new(None),
instance_id: instance_id,
}
@@ -87,12 +87,12 @@ impl BluetoothRemoteGATTCharacteristic {
impl BluetoothRemoteGATTCharacteristicMethods for BluetoothRemoteGATTCharacteristic {
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattcharacteristic-properties
fn Properties(&self) -> Root<BluetoothCharacteristicProperties> {
- self.properties.get()
+ Root::from_ref(&self.properties)
}
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattcharacteristic-service
fn Service(&self) -> Root<BluetoothRemoteGATTService> {
- self.service.get()
+ Root::from_ref(&self.service)
}
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattcharacteristic-uuid
diff --git a/components/script/dom/bluetoothremotegattdescriptor.rs b/components/script/dom/bluetoothremotegattdescriptor.rs
index b96a20c4a21..5290c096d3a 100644
--- a/components/script/dom/bluetoothremotegattdescriptor.rs
+++ b/components/script/dom/bluetoothremotegattdescriptor.rs
@@ -13,7 +13,7 @@ use dom::bindings::codegen::Bindings::BluetoothRemoteGATTDescriptorBinding::Blue
use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServerBinding::BluetoothRemoteGATTServerMethods;
use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServiceBinding::BluetoothRemoteGATTServiceMethods;
use dom::bindings::error::Error::{self, InvalidModification, Network, Security};
-use dom::bindings::js::{MutJS, Root};
+use dom::bindings::js::{JS, Root};
use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object};
use dom::bindings::str::{ByteString, DOMString};
use dom::bluetooth::{AsyncBluetoothListener, response_async};
@@ -28,7 +28,7 @@ use std::rc::Rc;
#[dom_struct]
pub struct BluetoothRemoteGATTDescriptor {
reflector_: Reflector,
- characteristic: MutJS<BluetoothRemoteGATTCharacteristic>,
+ characteristic: JS<BluetoothRemoteGATTCharacteristic>,
uuid: DOMString,
value: DOMRefCell<Option<ByteString>>,
instance_id: String,
@@ -41,7 +41,7 @@ impl BluetoothRemoteGATTDescriptor {
-> BluetoothRemoteGATTDescriptor {
BluetoothRemoteGATTDescriptor {
reflector_: Reflector::new(),
- characteristic: MutJS::new(characteristic),
+ characteristic: JS::from_ref(characteristic),
uuid: uuid,
value: DOMRefCell::new(None),
instance_id: instance_id,
@@ -72,7 +72,7 @@ impl BluetoothRemoteGATTDescriptor {
impl BluetoothRemoteGATTDescriptorMethods for BluetoothRemoteGATTDescriptor {
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattdescriptor-characteristic
fn Characteristic(&self) -> Root<BluetoothRemoteGATTCharacteristic> {
- self.characteristic.get()
+ Root::from_ref(&self.characteristic)
}
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattdescriptor-uuid
diff --git a/components/script/dom/bluetoothremotegattserver.rs b/components/script/dom/bluetoothremotegattserver.rs
index e81aae08abe..11e0528f5be 100644
--- a/components/script/dom/bluetoothremotegattserver.rs
+++ b/components/script/dom/bluetoothremotegattserver.rs
@@ -8,7 +8,7 @@ use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServerBinding;
use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServerBinding::BluetoothRemoteGATTServerMethods;
use dom::bindings::error::Error;
use dom::bindings::error::ErrorResult;
-use dom::bindings::js::{MutJS, Root};
+use dom::bindings::js::{JS, Root};
use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object};
use dom::bluetooth::{AsyncBluetoothListener, get_gatt_children, response_async};
use dom::bluetoothdevice::BluetoothDevice;
@@ -24,7 +24,7 @@ use std::rc::Rc;
#[dom_struct]
pub struct BluetoothRemoteGATTServer {
reflector_: Reflector,
- device: MutJS<BluetoothDevice>,
+ device: JS<BluetoothDevice>,
connected: Cell<bool>,
}
@@ -32,7 +32,7 @@ impl BluetoothRemoteGATTServer {
pub fn new_inherited(device: &BluetoothDevice) -> BluetoothRemoteGATTServer {
BluetoothRemoteGATTServer {
reflector_: Reflector::new(),
- device: MutJS::new(device),
+ device: JS::from_ref(device),
connected: Cell::new(false),
}
}
@@ -55,7 +55,7 @@ impl BluetoothRemoteGATTServer {
impl BluetoothRemoteGATTServerMethods for BluetoothRemoteGATTServer {
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattserver-device
fn Device(&self) -> Root<BluetoothDevice> {
- self.device.get()
+ Root::from_ref(&self.device)
}
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattserver-connected
diff --git a/components/script/dom/bluetoothremotegattservice.rs b/components/script/dom/bluetoothremotegattservice.rs
index 304cbb7d5b9..da06678da0b 100644
--- a/components/script/dom/bluetoothremotegattservice.rs
+++ b/components/script/dom/bluetoothremotegattservice.rs
@@ -9,7 +9,7 @@ use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServiceBinding;
use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServiceBinding::BluetoothRemoteGATTServiceMethods;
use dom::bindings::codegen::Bindings::EventHandlerBinding::EventHandlerNonNull;
use dom::bindings::error::Error;
-use dom::bindings::js::{MutJS, Root};
+use dom::bindings::js::{JS, Root};
use dom::bindings::reflector::reflect_dom_object;
use dom::bindings::str::DOMString;
use dom::bluetooth::{AsyncBluetoothListener, get_gatt_children};
@@ -25,7 +25,7 @@ use std::rc::Rc;
#[dom_struct]
pub struct BluetoothRemoteGATTService {
eventtarget: EventTarget,
- device: MutJS<BluetoothDevice>,
+ device: JS<BluetoothDevice>,
uuid: DOMString,
is_primary: bool,
instance_id: String,
@@ -39,7 +39,7 @@ impl BluetoothRemoteGATTService {
-> BluetoothRemoteGATTService {
BluetoothRemoteGATTService {
eventtarget: EventTarget::new_inherited(),
- device: MutJS::new(device),
+ device: JS::from_ref(device),
uuid: uuid,
is_primary: is_primary,
instance_id: instance_id,
@@ -68,7 +68,7 @@ impl BluetoothRemoteGATTService {
impl BluetoothRemoteGATTServiceMethods for BluetoothRemoteGATTService {
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattservice-device
fn Device(&self) -> Root<BluetoothDevice> {
- self.device.get()
+ Root::from_ref(&self.device)
}
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattservice-isprimary