diff options
author | zakorgy <zakorgy@inf.u-szeged.hu> | 2016-04-22 12:49:38 +0200 |
---|---|---|
committer | Attila Dusnoki <dati91@gmail.com> | 2016-05-03 11:35:30 +0200 |
commit | 402bc552cae3840993e10def211c16440e5bc005 (patch) | |
tree | b0ffa93c4a955f583810df2f9e6d4f6a269db11c /components/script | |
parent | 76d6685d7f982bef2642a6356ecab358178d4184 (diff) | |
download | servo-402bc552cae3840993e10def211c16440e5bc005.tar.gz servo-402bc552cae3840993e10def211c16440e5bc005.zip |
Replace the union types with the correct typedefs in the webidl files and the API classes.
Diffstat (limited to 'components/script')
7 files changed, 21 insertions, 21 deletions
diff --git a/components/script/dom/bluetoothremotegattcharacteristic.rs b/components/script/dom/bluetoothremotegattcharacteristic.rs index 19e78e09f84..1a0e9c02010 100644 --- a/components/script/dom/bluetoothremotegattcharacteristic.rs +++ b/components/script/dom/bluetoothremotegattcharacteristic.rs @@ -9,7 +9,6 @@ use dom::bindings::codegen::Bindings::BluetoothRemoteGATTCharacteristicBinding:: BluetoothRemoteGATTCharacteristicMethods; use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServerBinding::BluetoothRemoteGATTServerMethods; use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServiceBinding::BluetoothRemoteGATTServiceMethods; -use dom::bindings::codegen::UnionTypes::StringOrUnsignedLong; use dom::bindings::error::Error::{Network, Type}; use dom::bindings::error::{Fallible, ErrorResult}; use dom::bindings::global::GlobalRef; @@ -19,7 +18,7 @@ use dom::bindings::str::ByteString; use dom::bluetoothcharacteristicproperties::BluetoothCharacteristicProperties; use dom::bluetoothremotegattdescriptor::BluetoothRemoteGATTDescriptor; use dom::bluetoothremotegattservice::BluetoothRemoteGATTService; -use dom::bluetoothuuid::BluetoothUUID; +use dom::bluetoothuuid::{BluetoothDescriptorUUID, BluetoothUUID}; use ipc_channel::ipc::{self, IpcSender}; use net_traits::bluetooth_thread::{BluetoothMethodMsg, BluetoothObjectMsg}; use util::str::DOMString; @@ -94,7 +93,7 @@ impl BluetoothRemoteGATTCharacteristicMethods for BluetoothRemoteGATTCharacteris } // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattcharacteristic-getdescriptor - fn GetDescriptor(&self, descriptor: StringOrUnsignedLong) -> Fallible<Root<BluetoothRemoteGATTDescriptor>> { + fn GetDescriptor(&self, descriptor: BluetoothDescriptorUUID) -> Fallible<Root<BluetoothRemoteGATTDescriptor>> { let uuid: String = match BluetoothUUID::GetDescriptor(self.global().r(), descriptor.clone()) { Ok(domstring) => domstring.to_string(), Err(error) => return Err(error), @@ -124,7 +123,7 @@ impl BluetoothRemoteGATTCharacteristicMethods for BluetoothRemoteGATTCharacteris // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattcharacteristic-getdescriptors fn GetDescriptors(&self, - descriptor: Option<StringOrUnsignedLong>) + descriptor: Option<BluetoothDescriptorUUID>) -> Fallible<Vec<Root<BluetoothRemoteGATTDescriptor>>> { let mut uuid: Option<String> = None; if let Some(d)= descriptor { diff --git a/components/script/dom/bluetoothremotegattserver.rs b/components/script/dom/bluetoothremotegattserver.rs index a6c6f42769f..f34261eb54b 100644 --- a/components/script/dom/bluetoothremotegattserver.rs +++ b/components/script/dom/bluetoothremotegattserver.rs @@ -5,7 +5,6 @@ use dom::bindings::codegen::Bindings::BluetoothDeviceBinding::BluetoothDeviceMethods; use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServerBinding; use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServerBinding::BluetoothRemoteGATTServerMethods; -use dom::bindings::codegen::UnionTypes::StringOrUnsignedLong; use dom::bindings::error::Error::Type; use dom::bindings::error::{Fallible, ErrorResult}; use dom::bindings::global::GlobalRef; @@ -13,7 +12,7 @@ use dom::bindings::js::{JS, MutHeap, Root}; use dom::bindings::reflector::{Reflectable, Reflector, reflect_dom_object}; use dom::bluetoothdevice::BluetoothDevice; use dom::bluetoothremotegattservice::BluetoothRemoteGATTService; -use dom::bluetoothuuid::BluetoothUUID; +use dom::bluetoothuuid::{BluetoothServiceUUID, BluetoothUUID}; use ipc_channel::ipc::{self, IpcSender}; use net_traits::bluetooth_thread::{BluetoothMethodMsg, BluetoothObjectMsg}; use std::cell::Cell; @@ -106,7 +105,7 @@ impl BluetoothRemoteGATTServerMethods for BluetoothRemoteGATTServer { } // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattserver-getprimaryservice - fn GetPrimaryService(&self, service: StringOrUnsignedLong) -> Fallible<Root<BluetoothRemoteGATTService>> { + fn GetPrimaryService(&self, service: BluetoothServiceUUID) -> Fallible<Root<BluetoothRemoteGATTService>> { let uuid: String = match BluetoothUUID::GetService(self.global().r(), service.clone()) { Ok(domstring) => domstring.to_string(), Err(error) => return Err(error), @@ -138,7 +137,7 @@ impl BluetoothRemoteGATTServerMethods for BluetoothRemoteGATTServer { // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattserver-getprimaryservices fn GetPrimaryServices(&self, - service: Option<StringOrUnsignedLong>) + service: Option<BluetoothServiceUUID>) -> Fallible<Vec<Root<BluetoothRemoteGATTService>>> { let mut uuid: Option<String> = None; if let Some(s)= service { diff --git a/components/script/dom/bluetoothremotegattservice.rs b/components/script/dom/bluetoothremotegattservice.rs index 77820521552..c8d46c29904 100644 --- a/components/script/dom/bluetoothremotegattservice.rs +++ b/components/script/dom/bluetoothremotegattservice.rs @@ -4,7 +4,6 @@ use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServiceBinding; use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServiceBinding::BluetoothRemoteGATTServiceMethods; -use dom::bindings::codegen::UnionTypes::StringOrUnsignedLong; use dom::bindings::error::Error::Type; use dom::bindings::error::Fallible; use dom::bindings::global::GlobalRef; @@ -13,7 +12,7 @@ use dom::bindings::reflector::{Reflectable, Reflector, reflect_dom_object}; use dom::bluetoothcharacteristicproperties::BluetoothCharacteristicProperties; use dom::bluetoothdevice::BluetoothDevice; use dom::bluetoothremotegattcharacteristic::BluetoothRemoteGATTCharacteristic; -use dom::bluetoothuuid::BluetoothUUID; +use dom::bluetoothuuid::{BluetoothCharacteristicUUID, BluetoothUUID}; use ipc_channel::ipc::{self, IpcSender}; use net_traits::bluetooth_thread::{BluetoothMethodMsg, BluetoothObjectMsg}; use util::str::DOMString; @@ -86,7 +85,7 @@ impl BluetoothRemoteGATTServiceMethods for BluetoothRemoteGATTService { // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattservice-getcharacteristic fn GetCharacteristic(&self, - characteristic: StringOrUnsignedLong) + characteristic: BluetoothCharacteristicUUID) -> Fallible<Root<BluetoothRemoteGATTCharacteristic>> { let uuid: String = match BluetoothUUID::GetCharacteristic(self.global().r(), characteristic.clone()) { Ok(domstring) => domstring.to_string(), @@ -137,7 +136,7 @@ impl BluetoothRemoteGATTServiceMethods for BluetoothRemoteGATTService { // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattservice-getcharacteristics fn GetCharacteristics(&self, - characteristic: Option<StringOrUnsignedLong>) + characteristic: Option<BluetoothCharacteristicUUID>) -> Fallible<Vec<Root<BluetoothRemoteGATTCharacteristic>>> { let mut uuid: Option<String> = None; if let Some(c)= characteristic { diff --git a/components/script/dom/bluetoothuuid.rs b/components/script/dom/bluetoothuuid.rs index e916c6ebded..d4ed2b5e6a7 100644 --- a/components/script/dom/bluetoothuuid.rs +++ b/components/script/dom/bluetoothuuid.rs @@ -11,6 +11,9 @@ use regex::Regex; use util::str::DOMString; pub type UUID = DOMString; +pub type BluetoothServiceUUID = StringOrUnsignedLong; +pub type BluetoothCharacteristicUUID = StringOrUnsignedLong; +pub type BluetoothDescriptorUUID = StringOrUnsignedLong; // https://webbluetoothcg.github.io/web-bluetooth/#bluetoothuuid #[dom_struct] @@ -274,7 +277,7 @@ impl BluetoothUUID { } // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothuuid-getservice - pub fn GetService(globalref: GlobalRef, name: StringOrUnsignedLong) -> Fallible<UUID> { + pub fn GetService(globalref: GlobalRef, name: BluetoothServiceUUID) -> Fallible<UUID> { BluetoothUUID::resolve_uuid_name(globalref, name, BLUETOOTH_ASSIGNED_SERVICES, @@ -282,7 +285,7 @@ impl BluetoothUUID { } // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothuuid-getcharacteristic - pub fn GetCharacteristic(globalref: GlobalRef, name: StringOrUnsignedLong) -> Fallible<UUID> { + pub fn GetCharacteristic(globalref: GlobalRef, name: BluetoothCharacteristicUUID) -> Fallible<UUID> { BluetoothUUID::resolve_uuid_name(globalref, name, BLUETOOTH_ASSIGNED_CHARCTERISTICS, @@ -290,7 +293,7 @@ impl BluetoothUUID { } // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothuuid-getdescriptor - pub fn GetDescriptor(globalref: GlobalRef, name: StringOrUnsignedLong) -> Fallible<UUID> { + pub fn GetDescriptor(globalref: GlobalRef, name: BluetoothDescriptorUUID) -> Fallible<UUID> { BluetoothUUID::resolve_uuid_name(globalref, name, BLUETOOTH_ASSIGNED_DESCRIPTORS, diff --git a/components/script/dom/webidls/BluetoothRemoteGATTCharacteristic.webidl b/components/script/dom/webidls/BluetoothRemoteGATTCharacteristic.webidl index 294e00e1b85..2f721203ee1 100644 --- a/components/script/dom/webidls/BluetoothRemoteGATTCharacteristic.webidl +++ b/components/script/dom/webidls/BluetoothRemoteGATTCharacteristic.webidl @@ -11,9 +11,9 @@ interface BluetoothRemoteGATTCharacteristic { readonly attribute BluetoothCharacteristicProperties properties; readonly attribute ByteString? value; [Throws] - BluetoothRemoteGATTDescriptor getDescriptor((DOMString or unsigned long) descriptor); + BluetoothRemoteGATTDescriptor getDescriptor(BluetoothDescriptorUUID descriptor); [Throws] - sequence<BluetoothRemoteGATTDescriptor> getDescriptors(optional (DOMString or unsigned long) descriptor); + sequence<BluetoothRemoteGATTDescriptor> getDescriptors(optional BluetoothDescriptorUUID descriptor); //Promise<BluetoothRemoteGATTDescriptor> getDescriptor(BluetoothDescriptorUUID descriptor); //Promise<sequence<BluetoothRemoteGATTDescriptor>> //getDescriptors(optional BluetoothDescriptorUUID descriptor); diff --git a/components/script/dom/webidls/BluetoothRemoteGATTServer.webidl b/components/script/dom/webidls/BluetoothRemoteGATTServer.webidl index 835a6444103..1d48a19a173 100644 --- a/components/script/dom/webidls/BluetoothRemoteGATTServer.webidl +++ b/components/script/dom/webidls/BluetoothRemoteGATTServer.webidl @@ -13,9 +13,9 @@ interface BluetoothRemoteGATTServer { [Throws] void disconnect(); [Throws] - BluetoothRemoteGATTService getPrimaryService((DOMString or unsigned long) service); + BluetoothRemoteGATTService getPrimaryService(BluetoothServiceUUID service); [Throws] - sequence<BluetoothRemoteGATTService> getPrimaryServices(optional (DOMString or unsigned long) service); + sequence<BluetoothRemoteGATTService> getPrimaryServices(optional BluetoothServiceUUID service); //Promise<BluetoothRemoteGATTService> getPrimaryService(BluetoothServiceUUID service); //Promise<sequence<BluetoothRemoteGATTService>>getPrimaryServices(optional BluetoothServiceUUID service); //Promise<BluetoothRemoteGATTServer> connect(); diff --git a/components/script/dom/webidls/BluetoothRemoteGATTService.webidl b/components/script/dom/webidls/BluetoothRemoteGATTService.webidl index e6673f69397..3a41865de1e 100644 --- a/components/script/dom/webidls/BluetoothRemoteGATTService.webidl +++ b/components/script/dom/webidls/BluetoothRemoteGATTService.webidl @@ -10,10 +10,10 @@ interface BluetoothRemoteGATTService { readonly attribute DOMString uuid; readonly attribute boolean isPrimary; [Throws] - BluetoothRemoteGATTCharacteristic getCharacteristic((DOMString or unsigned long) characteristic); + BluetoothRemoteGATTCharacteristic getCharacteristic(BluetoothCharacteristicUUID characteristic); [Throws] sequence<BluetoothRemoteGATTCharacteristic> getCharacteristics - (optional (DOMString or unsigned long) characteristic); + (optional BluetoothCharacteristicUUID characteristic); //Promise<BluetoothRemoteGATTCharacteristic>getCharacteristic(BluetoothCharacteristicUUID characteristic); //Promise<sequence<BluetoothRemoteGATTCharacteristic>> //getCharacteristics(optional BluetoothCharacteristicUUID characteristic); |