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
Родитель f9572dad62
Коммит 79a8bee656
6 изменённых файлов: 24 добавлений и 21 удалений

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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