Auto merge of #15367 - szeged:bluetooth-webidl, r=nox

Update WebBluetooth webidl files

<!-- Please describe your changes on the following line: -->
Update the WebBluetooth related webidl files with the `[SameObject]` extended attribute, and unify the indentation in these files.

---
<!-- 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. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/15367)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-02-03 08:56:33 -08:00 committed by GitHub
commit b3ae74b5c9
10 changed files with 48 additions and 45 deletions

View file

@ -5,9 +5,9 @@
// https://webbluetoothcg.github.io/web-bluetooth/#bluetooth // https://webbluetoothcg.github.io/web-bluetooth/#bluetooth
dictionary BluetoothDataFilterInit { dictionary BluetoothDataFilterInit {
// BufferSource dataPrefix; // BufferSource dataPrefix;
sequence<octet> dataPrefix; sequence<octet> dataPrefix;
// BufferSource mask; // BufferSource mask;
sequence<octet> mask; sequence<octet> mask;
}; };
@ -15,9 +15,9 @@ dictionary BluetoothLEScanFilterInit {
sequence<BluetoothServiceUUID> services; sequence<BluetoothServiceUUID> services;
DOMString name; DOMString name;
DOMString namePrefix; DOMString namePrefix;
// Maps unsigned shorts to BluetoothDataFilters. // Maps unsigned shorts to BluetoothDataFilters.
MozMap<BluetoothDataFilterInit> manufacturerData; MozMap<BluetoothDataFilterInit> manufacturerData;
// Maps BluetoothServiceUUIDs to BluetoothDataFilters. // Maps BluetoothServiceUUIDs to BluetoothDataFilters.
MozMap<BluetoothDataFilterInit> serviceData; MozMap<BluetoothDataFilterInit> serviceData;
}; };
@ -29,20 +29,16 @@ dictionary RequestDeviceOptions {
[Pref="dom.bluetooth.enabled"] [Pref="dom.bluetooth.enabled"]
interface Bluetooth : EventTarget { interface Bluetooth : EventTarget {
// [SecureContext] // [SecureContext]
// readonly attribute BluetoothDevice? referringDevice; // Promise<boolean> getAvailability();
[SecureContext]
attribute EventHandler onavailabilitychanged; attribute EventHandler onavailabilitychanged;
// [SecureContext] // [SecureContext, SameObject]
// Promise<boolean> getAvailability(); // readonly attribute BluetoothDevice? referringDevice;
// [SecureContext]
// attribute EventHandler onavailabilitychanged;
// [SecureContext]
// readonly attribute BluetoothDevice? referringDevice;
[SecureContext] [SecureContext]
Promise<BluetoothDevice> requestDevice(optional RequestDeviceOptions options); Promise<BluetoothDevice> requestDevice(optional RequestDeviceOptions options);
}; };
// Bluetooth implements EventTarget;
// Bluetooth implements BluetoothDeviceEventHandlers; // Bluetooth implements BluetoothDeviceEventHandlers;
// Bluetooth implements CharacteristicEventHandlers; // Bluetooth implements CharacteristicEventHandlers;
// Bluetooth implements ServiceEventHandlers; // Bluetooth implements ServiceEventHandlers;

View file

@ -12,13 +12,16 @@ interface BluetoothServiceDataMap {
};*/ };*/
[Pref="dom.bluetooth.enabled", Constructor(DOMString type, BluetoothAdvertisingEventInit init)] [Pref="dom.bluetooth.enabled", Constructor(DOMString type, BluetoothAdvertisingEventInit init)]
interface BluetoothAdvertisingEvent : Event { interface BluetoothAdvertisingEvent : Event {
[SameObject]
readonly attribute BluetoothDevice device; readonly attribute BluetoothDevice device;
// readonly attribute FrozenArray<UUID> uuids; // readonly attribute FrozenArray<UUID> uuids;
readonly attribute DOMString? name; readonly attribute DOMString? name;
readonly attribute unsigned short? appearance; readonly attribute unsigned short? appearance;
readonly attribute byte? txPower; readonly attribute byte? txPower;
readonly attribute byte? rssi; readonly attribute byte? rssi;
// [SameObject]
// readonly attribute BluetoothManufacturerDataMap manufacturerData; // readonly attribute BluetoothManufacturerDataMap manufacturerData;
// [SameObject]
// readonly attribute BluetoothServiceDataMap serviceData; // readonly attribute BluetoothServiceDataMap serviceData;
}; };
dictionary BluetoothAdvertisingEventInit : EventInit { dictionary BluetoothAdvertisingEventInit : EventInit {

View file

@ -6,13 +6,13 @@
[Pref="dom.bluetooth.enabled"] [Pref="dom.bluetooth.enabled"]
interface BluetoothCharacteristicProperties { interface BluetoothCharacteristicProperties {
readonly attribute boolean broadcast; readonly attribute boolean broadcast;
readonly attribute boolean read; readonly attribute boolean read;
readonly attribute boolean writeWithoutResponse; readonly attribute boolean writeWithoutResponse;
readonly attribute boolean write; readonly attribute boolean write;
readonly attribute boolean notify; readonly attribute boolean notify;
readonly attribute boolean indicate; readonly attribute boolean indicate;
readonly attribute boolean authenticatedSignedWrites; readonly attribute boolean authenticatedSignedWrites;
readonly attribute boolean reliableWrite; readonly attribute boolean reliableWrite;
readonly attribute boolean writableAuxiliaries; readonly attribute boolean writableAuxiliaries;
}; };

View file

@ -6,13 +6,13 @@
[Pref="dom.bluetooth.enabled"] [Pref="dom.bluetooth.enabled"]
interface BluetoothDevice : EventTarget { interface BluetoothDevice : EventTarget {
readonly attribute DOMString id; readonly attribute DOMString id;
readonly attribute DOMString? name; readonly attribute DOMString? name;
readonly attribute BluetoothRemoteGATTServer gatt; readonly attribute BluetoothRemoteGATTServer gatt;
Promise<void> watchAdvertisements(); Promise<void> watchAdvertisements();
void unwatchAdvertisements(); void unwatchAdvertisements();
readonly attribute boolean watchingAdvertisements; readonly attribute boolean watchingAdvertisements;
}; };
[NoInterfaceObject] [NoInterfaceObject]

View file

@ -6,6 +6,7 @@
[Pref="dom.bluetooth.enabled"] [Pref="dom.bluetooth.enabled"]
interface BluetoothRemoteGATTCharacteristic : EventTarget { interface BluetoothRemoteGATTCharacteristic : EventTarget {
[SameObject]
readonly attribute BluetoothRemoteGATTService service; readonly attribute BluetoothRemoteGATTService service;
readonly attribute DOMString uuid; readonly attribute DOMString uuid;
readonly attribute BluetoothCharacteristicProperties properties; readonly attribute BluetoothCharacteristicProperties properties;

View file

@ -6,6 +6,7 @@
[Pref="dom.bluetooth.enabled"] [Pref="dom.bluetooth.enabled"]
interface BluetoothRemoteGATTDescriptor { interface BluetoothRemoteGATTDescriptor {
[SameObject]
readonly attribute BluetoothRemoteGATTCharacteristic characteristic; readonly attribute BluetoothRemoteGATTCharacteristic characteristic;
readonly attribute DOMString uuid; readonly attribute DOMString uuid;
readonly attribute ByteString? value; readonly attribute ByteString? value;

View file

@ -6,6 +6,7 @@
[Pref="dom.bluetooth.enabled"] [Pref="dom.bluetooth.enabled"]
interface BluetoothRemoteGATTServer { interface BluetoothRemoteGATTServer {
[SameObject]
readonly attribute BluetoothDevice device; readonly attribute BluetoothDevice device;
readonly attribute boolean connected; readonly attribute boolean connected;
Promise<BluetoothRemoteGATTServer> connect(); Promise<BluetoothRemoteGATTServer> connect();

View file

@ -6,14 +6,15 @@
[Pref="dom.bluetooth.enabled"] [Pref="dom.bluetooth.enabled"]
interface BluetoothRemoteGATTService : EventTarget { interface BluetoothRemoteGATTService : EventTarget {
readonly attribute BluetoothDevice device; [SameObject]
readonly attribute DOMString uuid; readonly attribute BluetoothDevice device;
readonly attribute boolean isPrimary; readonly attribute DOMString uuid;
Promise<BluetoothRemoteGATTCharacteristic> getCharacteristic(BluetoothCharacteristicUUID characteristic); readonly attribute boolean isPrimary;
Promise<sequence<BluetoothRemoteGATTCharacteristic>> Promise<BluetoothRemoteGATTCharacteristic> getCharacteristic(BluetoothCharacteristicUUID characteristic);
getCharacteristics(optional BluetoothCharacteristicUUID characteristic); Promise<sequence<BluetoothRemoteGATTCharacteristic>>
Promise<BluetoothRemoteGATTService> getIncludedService(BluetoothServiceUUID service); getCharacteristics(optional BluetoothCharacteristicUUID characteristic);
Promise<sequence<BluetoothRemoteGATTService>> getIncludedServices(optional BluetoothServiceUUID service); Promise<BluetoothRemoteGATTService> getIncludedService(BluetoothServiceUUID service);
Promise<sequence<BluetoothRemoteGATTService>> getIncludedServices(optional BluetoothServiceUUID service);
}; };
[NoInterfaceObject] [NoInterfaceObject]

View file

@ -6,13 +6,13 @@
[Pref="dom.bluetooth.enabled"] [Pref="dom.bluetooth.enabled"]
interface BluetoothUUID { interface BluetoothUUID {
[Throws] [Throws]
static UUID getService(BluetoothServiceUUID name); static UUID getService(BluetoothServiceUUID name);
[Throws] [Throws]
static UUID getCharacteristic(BluetoothCharacteristicUUID name); static UUID getCharacteristic(BluetoothCharacteristicUUID name);
[Throws] [Throws]
static UUID getDescriptor(BluetoothDescriptorUUID name); static UUID getDescriptor(BluetoothDescriptorUUID name);
static UUID canonicalUUID([EnforceRange] unsigned long alias); static UUID canonicalUUID([EnforceRange] unsigned long alias);
}; };
typedef DOMString UUID; typedef DOMString UUID;

View file

@ -28,7 +28,7 @@ interface NavigatorID {
// https://webbluetoothcg.github.io/web-bluetooth/#navigator-extensions // https://webbluetoothcg.github.io/web-bluetooth/#navigator-extensions
partial interface Navigator { partial interface Navigator {
readonly attribute Bluetooth bluetooth; [SameObject, Pref="dom.bluetooth.enabled"] readonly attribute Bluetooth bluetooth;
}; };
// https://w3c.github.io/ServiceWorker/#navigator-service-worker // https://w3c.github.io/ServiceWorker/#navigator-service-worker