Bug 1174071 - Remove 'required' keyword for Bluetooth*EventInit dictionary members. r=btian, r=bz

This commit is contained in:
Jocelyn Liu 2015-06-15 17:11:18 +08:00
parent b5cbf8882e
commit ab9c9c3221
6 changed files with 24 additions and 21 deletions

View File

@ -92,13 +92,16 @@ BluetoothLeDeviceEvent::Constructor(
e->mDevice = aEventInitDict.mDevice; e->mDevice = aEventInitDict.mDevice;
e->mRssi = aEventInitDict.mRssi; e->mRssi = aEventInitDict.mRssi;
aEventInitDict.mScanRecord.ComputeLengthAndData(); if (!aEventInitDict.mScanRecord.IsNull()) {
const uint8_t* data = aEventInitDict.mScanRecord.Data(); const auto& scanRecord = aEventInitDict.mScanRecord.Value();
size_t length = aEventInitDict.mScanRecord.Length(); scanRecord.ComputeLengthAndData();
e->mScanRecord = ArrayBuffer::Create(aGlobal.Context(), length, data); e->mScanRecord = ArrayBuffer::Create(aGlobal.Context(),
if (!e->mScanRecord) { scanRecord.Length(),
aRv.Throw(NS_ERROR_OUT_OF_MEMORY); scanRecord.Data());
return nullptr; if (!e->mScanRecord) {
aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
return nullptr;
}
} }
e->SetTrusted(trusted); e->SetTrusted(trusted);
@ -106,7 +109,7 @@ BluetoothLeDeviceEvent::Constructor(
} }
BluetoothDevice* BluetoothDevice*
BluetoothLeDeviceEvent::Device() const BluetoothLeDeviceEvent::GetDevice() const
{ {
return mDevice; return mDevice;
} }

View File

@ -47,7 +47,7 @@ public:
const BluetoothLeDeviceEventInit& aEventInitDict, const BluetoothLeDeviceEventInit& aEventInitDict,
ErrorResult& aRv); ErrorResult& aRv);
BluetoothDevice* Device() const; BluetoothDevice* GetDevice() const;
int16_t Rssi() const; int16_t Rssi() const;

View File

@ -15,5 +15,5 @@ interface BluetoothAttributeEvent : Event
dictionary BluetoothAttributeEventInit : EventInit dictionary BluetoothAttributeEventInit : EventInit
{ {
required sequence<DOMString> attrs; sequence<DOMString> attrs = [];
}; };

View File

@ -9,10 +9,10 @@
optional BluetoothGattCharacteristicEventInit eventInitDict)] optional BluetoothGattCharacteristicEventInit eventInitDict)]
interface BluetoothGattCharacteristicEvent : Event interface BluetoothGattCharacteristicEvent : Event
{ {
readonly attribute BluetoothGattCharacteristic characteristic; readonly attribute BluetoothGattCharacteristic? characteristic;
}; };
dictionary BluetoothGattCharacteristicEventInit : EventInit dictionary BluetoothGattCharacteristicEventInit : EventInit
{ {
required BluetoothGattCharacteristic characteristic; BluetoothGattCharacteristic? characteristic = null;
}; };

View File

@ -8,15 +8,15 @@
Constructor(DOMString type, optional BluetoothLeDeviceEventInit eventInitDict)] Constructor(DOMString type, optional BluetoothLeDeviceEventInit eventInitDict)]
interface BluetoothLeDeviceEvent : Event interface BluetoothLeDeviceEvent : Event
{ {
readonly attribute BluetoothDevice device; readonly attribute BluetoothDevice? device;
readonly attribute short rssi; readonly attribute short rssi;
[Throws] [Throws]
readonly attribute ArrayBuffer scanRecord; readonly attribute ArrayBuffer? scanRecord;
}; };
dictionary BluetoothLeDeviceEventInit : EventInit dictionary BluetoothLeDeviceEventInit : EventInit
{ {
required BluetoothDevice device; BluetoothDevice? device = null;
short rssi = 0; short rssi = 0;
required ArrayBuffer scanRecord; ArrayBuffer? scanRecord = null;
}; };

View File

@ -9,12 +9,12 @@
optional BluetoothPairingEventInit eventInitDict)] optional BluetoothPairingEventInit eventInitDict)]
interface BluetoothPairingEvent : Event interface BluetoothPairingEvent : Event
{ {
readonly attribute DOMString deviceName; readonly attribute DOMString deviceName;
readonly attribute BluetoothPairingHandle handle; readonly attribute BluetoothPairingHandle? handle;
}; };
dictionary BluetoothPairingEventInit : EventInit dictionary BluetoothPairingEventInit : EventInit
{ {
required DOMString deviceName; DOMString deviceName = "";
required BluetoothPairingHandle handle; BluetoothPairingHandle? handle = null;
}; };