mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Merge b-i to m-c.
This commit is contained in:
commit
32a532796f
@ -1,4 +1,4 @@
|
||||
{
|
||||
"revision": "6ce2fe088a1113ac761dfa1f6a6a09fb7f38f787",
|
||||
"revision": "979add320adbf777379cfd1044978392c576aaf8",
|
||||
"repo_path": "/integration/gaia-central"
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ protected:
|
||||
// The lock protects mVideoDecoderSlots and mVideoCodecRequestQueue called
|
||||
// from multiple threads.
|
||||
Mutex mLock;
|
||||
typedef Vector<sp<IBinder> > Fifo;
|
||||
typedef List<sp<IBinder> > Fifo;
|
||||
// Queue of media resource requests.
|
||||
// Hold IMediaResourceManagerClient that requesting a media resource as IBinder.
|
||||
Fifo mVideoCodecRequestQueue;
|
||||
|
@ -98,6 +98,7 @@ extern bool gBluetoothDebugFlag;
|
||||
// Bluetooth address format: xx:xx:xx:xx:xx:xx (or xx_xx_xx_xx_xx_xx)
|
||||
#define BLUETOOTH_ADDRESS_LENGTH 17
|
||||
#define BLUETOOTH_ADDRESS_NONE "00:00:00:00:00:00"
|
||||
#define BLUETOOTH_ADDRESS_BYTES 6
|
||||
|
||||
BEGIN_BLUETOOTH_NAMESPACE
|
||||
|
||||
|
@ -63,15 +63,19 @@ private:
|
||||
*/
|
||||
static bluetooth_device_t* sBtDevice;
|
||||
static const bt_interface_t* sBtInterface;
|
||||
static bool sIsBtEnabled = false;
|
||||
static bool sAdapterDiscoverable = false;
|
||||
static bool sIsBtEnabled = false;
|
||||
static nsString sAdapterBdAddress;
|
||||
static nsString sAdapterBdName;
|
||||
static uint32_t sAdapterDiscoverableTimeout;
|
||||
static InfallibleTArray<nsString> sAdapterBondedAddressArray;
|
||||
static InfallibleTArray<BluetoothNamedValue> sRemoteDevicesPack;
|
||||
static nsTArray<nsRefPtr<BluetoothReplyRunnable> > sBondingRunnableArray;
|
||||
static nsTArray<nsRefPtr<BluetoothReplyRunnable> > sChangeDiscoveryRunnableArray;
|
||||
static nsTArray<nsRefPtr<BluetoothReplyRunnable> > sGetPairedDeviceRunnableArray;
|
||||
static nsTArray<nsRefPtr<BluetoothReplyRunnable> > sSetPropertyRunnableArray;
|
||||
static nsTArray<nsRefPtr<BluetoothReplyRunnable> > sUnbondingRunnableArray;
|
||||
static nsTArray<int> sRequestedDeviceCountArray;
|
||||
|
||||
/**
|
||||
* Static callback functions
|
||||
@ -168,7 +172,8 @@ AdapterStateChangeCallback(bt_state_t aStatus)
|
||||
signalName = NS_LITERAL_STRING("Disabled");
|
||||
}
|
||||
|
||||
BluetoothSignal signal(signalName, NS_LITERAL_STRING(KEY_MANAGER), BluetoothValue(true));
|
||||
BluetoothSignal signal(signalName, NS_LITERAL_STRING(KEY_MANAGER),
|
||||
BluetoothValue(true));
|
||||
nsRefPtr<DistributeBluetoothSignalTask>
|
||||
t = new DistributeBluetoothSignalTask(signal);
|
||||
if (NS_FAILED(NS_DispatchToMainThread(t))) {
|
||||
@ -251,13 +256,30 @@ AdapterPropertiesChangeCallback(bt_status_t aStatus, int aNumProperties,
|
||||
BluetoothNamedValue(NS_LITERAL_STRING("DiscoverableTimeout"),
|
||||
propertyValue));
|
||||
} else if (p.type == BT_PROPERTY_ADAPTER_BONDED_DEVICES) {
|
||||
//FIXME: This will be implemented in the later patchset
|
||||
return;
|
||||
// We have to cache addresses of bonded devices. Unlike BlueZ,
|
||||
// bluedroid would not send an another BT_PROPERTY_ADAPTER_BONDED_DEVICES
|
||||
// event after bond completed
|
||||
bt_bdaddr_t* deviceBdAddressTypes = (bt_bdaddr_t*)p.val;
|
||||
int numOfAddresses = p.len / BLUETOOTH_ADDRESS_BYTES;
|
||||
BT_LOGD("Adapter property: BONDED_DEVICES. Count: %d", numOfAddresses);
|
||||
|
||||
// Whenever reloading paired devices, force refresh
|
||||
sAdapterBondedAddressArray.Clear();
|
||||
|
||||
for (int index = 0; index < numOfAddresses; index++) {
|
||||
nsAutoString deviceBdAddress;
|
||||
BdAddressTypeToString(deviceBdAddressTypes + index, deviceBdAddress);
|
||||
sAdapterBondedAddressArray.AppendElement(deviceBdAddress);
|
||||
}
|
||||
|
||||
propertyValue = sAdapterBondedAddressArray;
|
||||
propertiesArray.AppendElement(
|
||||
BluetoothNamedValue(NS_LITERAL_STRING("Devices"), propertyValue));
|
||||
} else if (p.type == BT_PROPERTY_UUIDS) {
|
||||
//FIXME: This will be implemented in the later patchset
|
||||
return;
|
||||
} else {
|
||||
BT_LOGR("Unhandled adapter property type: %d", p.type);
|
||||
BT_LOGD("Unhandled adapter property type: %d", p.type);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -279,6 +301,12 @@ AdapterPropertiesChangeCallback(bt_status_t aStatus, int aNumProperties,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* RemoteDevicePropertiesChangeCallback will be called, as the
|
||||
* following conditions:
|
||||
* 1. When BT is turning on, bluedroid automatically execute this callback
|
||||
* 2. When get_remote_device_properties()
|
||||
*/
|
||||
static void
|
||||
RemoteDevicePropertiesChangeCallback(bt_status_t aStatus,
|
||||
bt_bdaddr_t *aBdAddress,
|
||||
@ -287,32 +315,62 @@ RemoteDevicePropertiesChangeCallback(bt_status_t aStatus,
|
||||
{
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
|
||||
// First, get remote device bd_address since it will be the key of
|
||||
// return name value pair.
|
||||
if (sRequestedDeviceCountArray.IsEmpty()) {
|
||||
MOZ_ASSERT(sGetPairedDeviceRunnableArray.IsEmpty());
|
||||
return;
|
||||
}
|
||||
|
||||
sRequestedDeviceCountArray[0]--;
|
||||
|
||||
InfallibleTArray<BluetoothNamedValue> props;
|
||||
|
||||
nsString remoteDeviceBdAddress;
|
||||
BdAddressTypeToString(aBdAddress, remoteDeviceBdAddress);
|
||||
|
||||
InfallibleTArray<BluetoothNamedValue> deviceProperties;
|
||||
props.AppendElement(
|
||||
BluetoothNamedValue(NS_LITERAL_STRING("Address"), remoteDeviceBdAddress));
|
||||
|
||||
for (int i = 0; i < aNumProperties; ++i) {
|
||||
bt_property_t p = aProperties[i];
|
||||
|
||||
if (p.type == BT_PROPERTY_BDNAME) {
|
||||
BluetoothValue propertyValue = NS_ConvertUTF8toUTF16((char*)p.val);
|
||||
deviceProperties.AppendElement(
|
||||
props.AppendElement(
|
||||
BluetoothNamedValue(NS_LITERAL_STRING("Name"), propertyValue));
|
||||
} else if (p.type == BT_PROPERTY_CLASS_OF_DEVICE) {
|
||||
uint32_t cod = *(uint32_t*)p.val;
|
||||
deviceProperties.AppendElement(
|
||||
props.AppendElement(
|
||||
BluetoothNamedValue(NS_LITERAL_STRING("Class"), BluetoothValue(cod)));
|
||||
|
||||
nsString icon;
|
||||
ClassToIcon(cod, icon);
|
||||
deviceProperties.AppendElement(
|
||||
props.AppendElement(
|
||||
BluetoothNamedValue(NS_LITERAL_STRING("Icon"), BluetoothValue(icon)));
|
||||
} else {
|
||||
BT_LOGR("Other non-handled device properties. Type: %d", p.type);
|
||||
BT_LOGD("Other non-handled device properties. Type: %d", p.type);
|
||||
}
|
||||
}
|
||||
|
||||
// Use address as the index
|
||||
sRemoteDevicesPack.AppendElement(
|
||||
BluetoothNamedValue(remoteDeviceBdAddress, props));
|
||||
|
||||
if (sRequestedDeviceCountArray[0] == 0) {
|
||||
MOZ_ASSERT(!sGetPairedDeviceRunnableArray.IsEmpty());
|
||||
|
||||
if (sGetPairedDeviceRunnableArray.IsEmpty()) {
|
||||
BT_LOGR("No runnable to return");
|
||||
return;
|
||||
}
|
||||
|
||||
DispatchBluetoothReply(sGetPairedDeviceRunnableArray[0],
|
||||
sRemoteDevicesPack, EmptyString());
|
||||
|
||||
// After firing it, clean up cache
|
||||
sRemoteDevicesPack.Clear();
|
||||
|
||||
sRequestedDeviceCountArray.RemoveElementAt(0);
|
||||
sGetPairedDeviceRunnableArray.RemoveElementAt(0);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
@ -444,20 +502,38 @@ BondStateChangedCallback(bt_status_t aStatus, bt_bdaddr_t* aRemoteBdAddress,
|
||||
{
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
|
||||
if (aState == BT_BOND_STATE_BONDING) {
|
||||
//We don't need to handle bonding state
|
||||
return;
|
||||
}
|
||||
|
||||
bool bonded = (aState == BT_BOND_STATE_BONDED);
|
||||
nsAutoString remoteAddress;
|
||||
BdAddressTypeToString(aRemoteBdAddress, remoteAddress);
|
||||
bool bonded;
|
||||
|
||||
if (aState == BT_BOND_STATE_BONDING) {
|
||||
// We don't need to handle bonding state
|
||||
return;
|
||||
} else if (aState == BT_BOND_STATE_NONE) {
|
||||
bonded = false;
|
||||
sAdapterBondedAddressArray.RemoveElement(remoteAddress);
|
||||
} else if (aState == BT_BOND_STATE_BONDED) {
|
||||
bonded = true;
|
||||
sAdapterBondedAddressArray.AppendElement(remoteAddress);
|
||||
}
|
||||
|
||||
// Update bonded address list to BluetoothAdapter
|
||||
InfallibleTArray<BluetoothNamedValue> propertiesChangeArray;
|
||||
propertiesChangeArray.AppendElement(
|
||||
BluetoothNamedValue(NS_LITERAL_STRING("Devices"),
|
||||
sAdapterBondedAddressArray));
|
||||
BluetoothValue value(propertiesChangeArray);
|
||||
BluetoothSignal signal(NS_LITERAL_STRING("PropertyChanged"),
|
||||
NS_LITERAL_STRING(KEY_ADAPTER),
|
||||
BluetoothValue(propertiesChangeArray));
|
||||
NS_DispatchToMainThread(new DistributeBluetoothSignalTask(signal));
|
||||
|
||||
// Update bonding status to gaia
|
||||
InfallibleTArray<BluetoothNamedValue> propertiesArray;
|
||||
propertiesArray.AppendElement(
|
||||
BluetoothNamedValue(NS_LITERAL_STRING("address"), remoteAddress));
|
||||
propertiesArray.AppendElement(
|
||||
BluetoothNamedValue(NS_LITERAL_STRING("status"), bonded));
|
||||
|
||||
BluetoothSignal newSignal(NS_LITERAL_STRING(PAIRED_STATUS_CHANGED_ID),
|
||||
NS_LITERAL_STRING(KEY_ADAPTER),
|
||||
BluetoothValue(propertiesArray));
|
||||
@ -634,6 +710,10 @@ BluetoothServiceBluedroid::GetDefaultAdapterPathInternal(
|
||||
v.get_ArrayOfBluetoothNamedValue().AppendElement(
|
||||
BluetoothNamedValue(NS_LITERAL_STRING("Name"), sAdapterBdName));
|
||||
|
||||
v.get_ArrayOfBluetoothNamedValue().AppendElement(
|
||||
BluetoothNamedValue(NS_LITERAL_STRING("Devices"),
|
||||
sAdapterBondedAddressArray));
|
||||
|
||||
nsAutoString replyError;
|
||||
DispatchBluetoothReply(runnable.get(), v, replyError);
|
||||
|
||||
@ -646,8 +726,12 @@ nsresult
|
||||
BluetoothServiceBluedroid::GetConnectedDevicePropertiesInternal(
|
||||
uint16_t aProfileId, BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
return NS_OK;
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
//FIXME: This will be implemented in later patches
|
||||
DispatchBluetoothReply(aRunnable, BluetoothValue(true), EmptyString());
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
@ -656,6 +740,34 @@ BluetoothServiceBluedroid::GetPairedDevicePropertiesInternal(
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
if (!IsReady()) {
|
||||
NS_NAMED_LITERAL_STRING(errorStr, "Bluetooth service is not ready yet!");
|
||||
DispatchBluetoothReply(aRunnable, BluetoothValue(), errorStr);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
int requestedDeviceCount = aDeviceAddress.Length();
|
||||
if (requestedDeviceCount == 0) {
|
||||
InfallibleTArray<BluetoothNamedValue> emptyArr;
|
||||
DispatchBluetoothReply(aRunnable, BluetoothValue(emptyArr), EmptyString());
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
for (int i = 0; i < requestedDeviceCount; i++) {
|
||||
// Retrieve all properties of devices
|
||||
bt_bdaddr_t addressType;
|
||||
StringToBdAddressType(aDeviceAddress[i], &addressType);
|
||||
int ret = sBtInterface->get_remote_device_properties(&addressType);
|
||||
if (ret != BT_STATUS_SUCCESS) {
|
||||
DispatchBluetoothReply(aRunnable, BluetoothValue(true),
|
||||
NS_LITERAL_STRING("GetPairedDeviceFailed"));
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
sRequestedDeviceCountArray.AppendElement(requestedDeviceCount);
|
||||
sGetPairedDeviceRunnableArray.AppendElement(aRunnable);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -1290,6 +1290,14 @@ ContentChild::RecvCycleCollect()
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef MOZ_NUWA_PROCESS
|
||||
static void
|
||||
OnFinishNuwaPreparation ()
|
||||
{
|
||||
MakeNuwaProcess();
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
PreloadSlowThings()
|
||||
{
|
||||
@ -1297,6 +1305,18 @@ PreloadSlowThings()
|
||||
nsLayoutStylesheetCache::UserContentSheet();
|
||||
|
||||
TabChild::PreloadSlowThings();
|
||||
|
||||
#ifdef MOZ_NUWA_PROCESS
|
||||
// After preload of slow things, start freezing threads.
|
||||
if (IsNuwaProcess()) {
|
||||
// Perform GC before freezing the Nuwa process to reduce memory usage.
|
||||
ContentChild::GetSingleton()->RecvGarbageCollect();
|
||||
|
||||
MessageLoop::current()->
|
||||
PostTask(FROM_HERE,
|
||||
NewRunnableFunction(OnFinishNuwaPreparation));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -450,7 +450,7 @@ function RILContentHelper() {
|
||||
this.updateDebugFlag();
|
||||
|
||||
this.numClients = gNumRadioInterfaces;
|
||||
debug("Number of clients: " + this.numClients);
|
||||
if (DEBUG) debug("Number of clients: " + this.numClients);
|
||||
|
||||
this.rilContexts = [];
|
||||
this.voicemailInfos = [];
|
||||
@ -605,7 +605,7 @@ RILContentHelper.prototype = {
|
||||
let rilContext =
|
||||
cpmm.sendSyncMessage("RIL:GetRilContext", {clientId: cId})[0];
|
||||
if (!rilContext) {
|
||||
debug("Received null rilContext from chrome process.");
|
||||
if (DEBUG) debug("Received null rilContext from chrome process.");
|
||||
continue;
|
||||
}
|
||||
this.rilContexts[cId].cardState = rilContext.cardState;
|
||||
@ -910,7 +910,7 @@ RILContentHelper.prototype = {
|
||||
},
|
||||
|
||||
sendMMI: function sendMMI(clientId, window, mmi) {
|
||||
debug("Sending MMI " + mmi);
|
||||
if (DEBUG) debug("Sending MMI " + mmi);
|
||||
if (!window) {
|
||||
throw Components.Exception("Can't get window object",
|
||||
Cr.NS_ERROR_UNEXPECTED);
|
||||
@ -932,7 +932,7 @@ RILContentHelper.prototype = {
|
||||
},
|
||||
|
||||
cancelMMI: function cancelMMI(clientId, window) {
|
||||
debug("Cancel MMI");
|
||||
if (DEBUG) debug("Cancel MMI");
|
||||
if (!window) {
|
||||
throw Components.Exception("Can't get window object",
|
||||
Cr.NS_ERROR_UNEXPECTED);
|
||||
@ -1443,7 +1443,7 @@ RILContentHelper.prototype = {
|
||||
},
|
||||
|
||||
registerMobileConnectionMsg: function registerMobileConnectionMsg(clientId, listener) {
|
||||
debug("Registering for mobile connection related messages");
|
||||
if (DEBUG) debug("Registering for mobile connection related messages");
|
||||
this.registerListener("_mobileConnectionListeners", clientId, listener);
|
||||
cpmm.sendAsyncMessage("RIL:RegisterMobileConnectionMsg");
|
||||
},
|
||||
@ -1453,7 +1453,7 @@ RILContentHelper.prototype = {
|
||||
},
|
||||
|
||||
registerVoicemailMsg: function registerVoicemailMsg(listener) {
|
||||
debug("Registering for voicemail-related messages");
|
||||
if (DEBUG) debug("Registering for voicemail-related messages");
|
||||
// To follow the listener registration scheme, we add a dummy clientId 0.
|
||||
// All voicemail events are routed to listener for client id 0.
|
||||
// See |handleVoicemailNotification|.
|
||||
@ -1469,7 +1469,7 @@ RILContentHelper.prototype = {
|
||||
},
|
||||
|
||||
registerCellBroadcastMsg: function registerCellBroadcastMsg(listener) {
|
||||
debug("Registering for Cell Broadcast related messages");
|
||||
if (DEBUG) debug("Registering for Cell Broadcast related messages");
|
||||
//TODO: Bug 921326 - Cellbroadcast API: support multiple sim cards
|
||||
this.registerListener("_cellBroadcastListeners", 0, listener);
|
||||
cpmm.sendAsyncMessage("RIL:RegisterCellBroadcastMsg");
|
||||
@ -1481,7 +1481,7 @@ RILContentHelper.prototype = {
|
||||
},
|
||||
|
||||
registerIccMsg: function registerIccMsg(clientId, listener) {
|
||||
debug("Registering for ICC related messages");
|
||||
if (DEBUG) debug("Registering for ICC related messages");
|
||||
this.registerListener("_iccListeners", clientId, listener);
|
||||
cpmm.sendAsyncMessage("RIL:RegisterIccMsg");
|
||||
},
|
||||
@ -1574,7 +1574,9 @@ RILContentHelper.prototype = {
|
||||
|
||||
receiveMessage: function receiveMessage(msg) {
|
||||
let request;
|
||||
debug("Received message '" + msg.name + "': " + JSON.stringify(msg.json));
|
||||
if (DEBUG) {
|
||||
debug("Received message '" + msg.name + "': " + JSON.stringify(msg.json));
|
||||
}
|
||||
|
||||
let data = msg.json.data;
|
||||
let clientId = msg.json.clientId;
|
||||
@ -1783,9 +1785,11 @@ RILContentHelper.prototype = {
|
||||
},
|
||||
|
||||
handleGetAvailableNetworks: function handleGetAvailableNetworks(message) {
|
||||
debug("handleGetAvailableNetworks: " + JSON.stringify(message));
|
||||
if (DEBUG) debug("handleGetAvailableNetworks: " + JSON.stringify(message));
|
||||
if (message.errorMsg) {
|
||||
debug("Received error from getAvailableNetworks: " + message.errorMsg);
|
||||
if (DEBUG) {
|
||||
debug("Received error from getAvailableNetworks: " + message.errorMsg);
|
||||
}
|
||||
this.fireRequestError(message.requestId, message.errorMsg);
|
||||
return;
|
||||
}
|
||||
@ -1946,7 +1950,7 @@ RILContentHelper.prototype = {
|
||||
},
|
||||
|
||||
handleSendCancelMMI: function handleSendCancelMMI(message) {
|
||||
debug("handleSendCancelMMI " + JSON.stringify(message));
|
||||
if (DEBUG) debug("handleSendCancelMMI " + JSON.stringify(message));
|
||||
let request = this.takeRequest(message.requestId);
|
||||
let requestWindow = this._windowsMap[message.requestId];
|
||||
delete this._windowsMap[message.requestId];
|
||||
@ -2013,7 +2017,7 @@ RILContentHelper.prototype = {
|
||||
try {
|
||||
handler.apply(listener, args);
|
||||
} catch (e) {
|
||||
debug("listener for " + name + " threw an exception: " + e);
|
||||
if (DEBUG) debug("listener for " + name + " threw an exception: " + e);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -9905,20 +9905,19 @@ let StkCommandParamsFactory = {
|
||||
|
||||
processSetupCall: function processSetupCall(cmdDetails, ctlvs) {
|
||||
let call = {};
|
||||
let iter = Iterator(ctlvs);
|
||||
|
||||
for (let i = 0; i < ctlvs.length; i++) {
|
||||
let ctlv = ctlvs[i];
|
||||
if (ctlv.tag == COMPREHENSIONTLV_TAG_ALPHA_ID) {
|
||||
if (!call.confirmMessage) {
|
||||
call.confirmMessage = ctlv.value.identifier;
|
||||
} else {
|
||||
call.callMessage = ctlv.value.identifier;
|
||||
break;
|
||||
}
|
||||
}
|
||||
let ctlv = StkProactiveCmdHelper.searchForNextTag(COMPREHENSIONTLV_TAG_ALPHA_ID, iter);
|
||||
if (ctlv) {
|
||||
call.confirmMessage = ctlv.value.identifier;
|
||||
}
|
||||
|
||||
let ctlv = StkProactiveCmdHelper.searchForTag(COMPREHENSIONTLV_TAG_ADDRESS, ctlvs);
|
||||
ctlv = StkProactiveCmdHelper.searchForNextTag(COMPREHENSIONTLV_TAG_ALPHA_ID, iter);
|
||||
if (ctlv) {
|
||||
call.callMessage = ctlv.value.identifier;
|
||||
}
|
||||
|
||||
ctlv = StkProactiveCmdHelper.searchForTag(COMPREHENSIONTLV_TAG_ADDRESS, ctlvs);
|
||||
if (!ctlv) {
|
||||
RIL.sendStkTerminalResponse({
|
||||
command: cmdDetails,
|
||||
@ -10430,8 +10429,12 @@ let StkProactiveCmdHelper = {
|
||||
},
|
||||
|
||||
searchForTag: function searchForTag(tag, ctlvs) {
|
||||
for (let i = 0; i < ctlvs.length; i++) {
|
||||
let ctlv = ctlvs[i];
|
||||
let iter = Iterator(ctlvs);
|
||||
return this.searchForNextTag(tag, iter);
|
||||
},
|
||||
|
||||
searchForNextTag: function searchForNextTag(tag, iter) {
|
||||
for (let [index, ctlv] in iter) {
|
||||
if ((ctlv.tag & ~COMPREHENSIONTLV_FLAG_CR) == tag) {
|
||||
return ctlv;
|
||||
}
|
||||
|
@ -342,6 +342,47 @@ add_test(function test_write_length() {
|
||||
});
|
||||
|
||||
// Test Proactive commands.
|
||||
/**
|
||||
* Verify Proactive command helper : searchForNextTag
|
||||
*/
|
||||
add_test(function test_stk_proactive_command_search_next_tag() {
|
||||
let worker = newUint8Worker();
|
||||
let pduHelper = worker.GsmPDUHelper;
|
||||
let berHelper = worker.BerTlvHelper;
|
||||
let stkHelper = worker.StkProactiveCmdHelper;
|
||||
|
||||
let tag_test = [
|
||||
0xD0,
|
||||
0x3C,
|
||||
0x85, 0x0A, 0x61, 0x6C, 0x70, 0x68, 0x61, 0x20, 0x69, 0x64, 0x20, 0x31,
|
||||
0x85, 0x0A, 0x61, 0x6C, 0x70, 0x68, 0x61, 0x20, 0x69, 0x64, 0x20, 0x32,
|
||||
0x85, 0x0A, 0x61, 0x6C, 0x70, 0x68, 0x61, 0x20, 0x69, 0x64, 0x20, 0x33,
|
||||
0x85, 0x0A, 0x61, 0x6C, 0x70, 0x68, 0x61, 0x20, 0x69, 0x64, 0x20, 0x34,
|
||||
0x85, 0x0A, 0x61, 0x6C, 0x70, 0x68, 0x61, 0x20, 0x69, 0x64, 0x20, 0x35];
|
||||
|
||||
for (let i = 0; i < tag_test.length; i++) {
|
||||
pduHelper.writeHexOctet(tag_test[i]);
|
||||
}
|
||||
|
||||
let berTlv = berHelper.decode(tag_test.length);
|
||||
let iter = Iterator(berTlv.value);
|
||||
let tlv = stkHelper.searchForNextTag(COMPREHENSIONTLV_TAG_ALPHA_ID, iter);
|
||||
do_check_eq(tlv.value.identifier, "alpha id 1");
|
||||
|
||||
tlv = stkHelper.searchForNextTag(COMPREHENSIONTLV_TAG_ALPHA_ID, iter);
|
||||
do_check_eq(tlv.value.identifier, "alpha id 2");
|
||||
|
||||
tlv = stkHelper.searchForNextTag(COMPREHENSIONTLV_TAG_ALPHA_ID, iter);
|
||||
do_check_eq(tlv.value.identifier, "alpha id 3");
|
||||
|
||||
tlv = stkHelper.searchForNextTag(COMPREHENSIONTLV_TAG_ALPHA_ID, iter);
|
||||
do_check_eq(tlv.value.identifier, "alpha id 4");
|
||||
|
||||
tlv = stkHelper.searchForNextTag(COMPREHENSIONTLV_TAG_ALPHA_ID, iter);
|
||||
do_check_eq(tlv.value.identifier, "alpha id 5");
|
||||
|
||||
run_next_test();
|
||||
});
|
||||
|
||||
/**
|
||||
* Verify Proactive Command : Refresh
|
||||
|
@ -77,11 +77,6 @@
|
||||
using mozilla::_ipdltest::IPDLUnitTestProcessChild;
|
||||
#endif // ifdef MOZ_IPDL_TESTS
|
||||
|
||||
#ifdef MOZ_NUWA_PROCESS
|
||||
#include "nsITimer.h"
|
||||
#define NUWA_PREPARATION_TIME 1000
|
||||
#endif
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
using mozilla::ipc::BrowserProcessSubThread;
|
||||
@ -107,13 +102,6 @@ static NS_DEFINE_CID(kAppShellCID, NS_APPSHELL_CID);
|
||||
static const PRUnichar kShellLibraryName[] = L"shell32.dll";
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_NUWA_PROCESS
|
||||
extern "C" {
|
||||
void PrepareNuwaProcess() __attribute__((weak));
|
||||
void MakeNuwaProcess() __attribute__((weak));
|
||||
};
|
||||
#endif
|
||||
|
||||
nsresult
|
||||
XRE_LockProfileDirectory(nsIFile* aDirectory,
|
||||
nsISupports* *aLockObject)
|
||||
@ -277,16 +265,6 @@ SetTaskbarGroupId(const nsString& aId)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_NUWA_PROCESS
|
||||
void
|
||||
OnFinishNuwaPreparation(nsITimer *aTimer, void *aClosure)
|
||||
{
|
||||
NS_ASSERTION(MakeNuwaProcess != nullptr,
|
||||
"MakeNuwaProcess() is not available!");
|
||||
MakeNuwaProcess();
|
||||
}
|
||||
#endif
|
||||
|
||||
nsresult
|
||||
XRE_InitChildProcess(int aArgc,
|
||||
char* aArgv[],
|
||||
@ -534,19 +512,6 @@ XRE_InitChildProcess(int aArgc,
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
#ifdef MOZ_NUWA_PROCESS
|
||||
nsCOMPtr<nsITimer> timer;
|
||||
if (aProcess == GeckoProcessType_Content &&
|
||||
CommandLine::ForCurrentProcess()->HasSwitch(L"nuwa")) {
|
||||
// Wait the Nuwa process for NUWA_PREPARATION_TIME ms.
|
||||
timer = do_CreateInstance(NS_TIMER_CONTRACTID);
|
||||
rv = timer->InitWithFuncCallback(OnFinishNuwaPreparation,
|
||||
nullptr,
|
||||
NUWA_PREPARATION_TIME,
|
||||
nsITimer::TYPE_ONE_SHOT);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Run the UI event loop on the main thread.
|
||||
uiMessageLoop.MessageLoop::Run();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user