mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 13:51:41 +00:00
Merge b2g-inbound to m-c.
This commit is contained in:
commit
52ab5ad2dc
@ -1,4 +1,4 @@
|
||||
{
|
||||
"revision": "7343851c97c278a338434d2632098a263e19bbb6",
|
||||
"revision": "d5f4a104c0b79b8fe13b7883dd531249ed251146",
|
||||
"repo_path": "/integration/gaia-central"
|
||||
}
|
||||
|
@ -56,7 +56,9 @@ MOZ_TOOLKIT_SEARCH=
|
||||
MOZ_PLACES=
|
||||
MOZ_B2G=1
|
||||
|
||||
#MOZ_NUWA_PROCESS=1
|
||||
if test "$OS_TARGET" = "Android"; then
|
||||
MOZ_NUWA_PROCESS=1
|
||||
fi
|
||||
MOZ_FOLD_LIBS=1
|
||||
|
||||
MOZ_JSDOWNLOADS=1
|
||||
|
@ -25,7 +25,7 @@ public:
|
||||
}
|
||||
|
||||
static BluetoothHidManager* Get();
|
||||
~BluetoothHidManager();
|
||||
virtual ~BluetoothHidManager();
|
||||
|
||||
// HID-specific functions
|
||||
void HandleInputPropertyChanged(const BluetoothSignal& aSignal);
|
||||
|
@ -187,9 +187,9 @@ BluetoothProfileController::Next()
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MOZ_ASSERT(!mDeviceAddress.IsEmpty());
|
||||
MOZ_ASSERT(mProfilesIndex < mProfiles.Length());
|
||||
MOZ_ASSERT(mProfilesIndex < (int)mProfiles.Length());
|
||||
|
||||
if (++mProfilesIndex < mProfiles.Length()) {
|
||||
if (++mProfilesIndex < (int)mProfiles.Length()) {
|
||||
BT_LOGR_PROFILE(mProfiles[mProfilesIndex], "");
|
||||
|
||||
if (mConnect) {
|
||||
|
@ -26,6 +26,7 @@ public:
|
||||
NS_DECL_NSIICCLISTENER
|
||||
|
||||
IccListener() { }
|
||||
virtual ~IccListener() { }
|
||||
|
||||
bool Listen(bool aStart);
|
||||
void SetOwner(BluetoothRilListener *aOwner);
|
||||
@ -42,6 +43,7 @@ public:
|
||||
|
||||
MobileConnectionListener(uint32_t aClientId)
|
||||
: mClientId(aClientId) { }
|
||||
virtual ~MobileConnectionListener() { }
|
||||
|
||||
bool Listen(bool aStart);
|
||||
|
||||
@ -56,6 +58,7 @@ public:
|
||||
NS_DECL_NSITELEPHONYLISTENER
|
||||
|
||||
TelephonyListener() { }
|
||||
virtual ~TelephonyListener() { }
|
||||
|
||||
bool Listen(bool aStart);
|
||||
};
|
||||
|
@ -172,20 +172,6 @@ public:
|
||||
const BluetoothNamedValue& aValue,
|
||||
BluetoothReplyRunnable* aRunnable) = 0;
|
||||
|
||||
/**
|
||||
* Get the path of a device
|
||||
*
|
||||
* @param aAdapterPath Path to the Adapter that's communicating with the device
|
||||
* @param aDeviceAddress Device address (XX:XX:XX:XX:XX:XX format)
|
||||
* @param aDevicePath Return value of path
|
||||
*
|
||||
* @return True if path set correctly, false otherwise
|
||||
*/
|
||||
virtual bool
|
||||
GetDevicePath(const nsAString& aAdapterPath,
|
||||
const nsAString& aDeviceAddress,
|
||||
nsAString& aDevicePath) = 0;
|
||||
|
||||
virtual nsresult
|
||||
CreatePairedDeviceInternal(const nsAString& aAddress,
|
||||
int aTimeout,
|
||||
@ -195,12 +181,6 @@ public:
|
||||
RemoveDeviceInternal(const nsAString& aObjectPath,
|
||||
BluetoothReplyRunnable* aRunnable) = 0;
|
||||
|
||||
virtual nsresult
|
||||
GetScoSocket(const nsAString& aObjectPath,
|
||||
bool aAuth,
|
||||
bool aEncrypt,
|
||||
mozilla::ipc::UnixSocketConsumer* aConsumer) = 0;
|
||||
|
||||
/**
|
||||
* Get corresponding service channel of specific service on remote device.
|
||||
* It's usually the very first step of establishing an outbound connection.
|
||||
|
@ -95,7 +95,7 @@ GetAddressFromObjectPath(const nsAString& aObjectPath)
|
||||
nsString address(aObjectPath);
|
||||
int addressHead = address.RFind("/") + 5;
|
||||
|
||||
MOZ_ASSERT(addressHead + BLUETOOTH_ADDRESS_LENGTH == address.Length());
|
||||
MOZ_ASSERT(addressHead + BLUETOOTH_ADDRESS_LENGTH == (int)address.Length());
|
||||
|
||||
address.Cut(0, addressHead);
|
||||
address.ReplaceChar('_', ':');
|
||||
|
@ -32,7 +32,7 @@ public:
|
||||
};
|
||||
|
||||
static BluetoothA2dpManager* Get();
|
||||
~BluetoothA2dpManager();
|
||||
virtual ~BluetoothA2dpManager();
|
||||
void ResetA2dp();
|
||||
void ResetAvrcp();
|
||||
|
||||
|
@ -84,7 +84,7 @@ public:
|
||||
}
|
||||
|
||||
static BluetoothHfpManager* Get();
|
||||
~BluetoothHfpManager();
|
||||
virtual ~BluetoothHfpManager();
|
||||
|
||||
bool ConnectSco();
|
||||
bool DisconnectSco();
|
||||
|
@ -261,7 +261,7 @@ BluetoothOppManager::ConnectInternal(const nsAString& aDeviceAddress)
|
||||
}
|
||||
|
||||
mSocket =
|
||||
new BluetoothSocket(this, BluetoothSocketType::RFCOMM, true, true);
|
||||
new BluetoothSocket(this, BluetoothSocketType::RFCOMM, false, true);
|
||||
mSocket->Connect(aDeviceAddress, -1);
|
||||
}
|
||||
|
||||
@ -295,7 +295,7 @@ BluetoothOppManager::Listen()
|
||||
}
|
||||
|
||||
mServerSocket =
|
||||
new BluetoothSocket(this, BluetoothSocketType::RFCOMM, true, true);
|
||||
new BluetoothSocket(this, BluetoothSocketType::RFCOMM, false, true);
|
||||
|
||||
if (!mServerSocket->Listen(BluetoothReservedChannels::CHANNEL_OPUSH)) {
|
||||
BT_WARNING("[OPP] Can't listen on RFCOMM socket!");
|
||||
@ -315,7 +315,7 @@ BluetoothOppManager::StartSendingNextFile()
|
||||
|
||||
MOZ_ASSERT(!IsConnected());
|
||||
MOZ_ASSERT(!mBatches.IsEmpty());
|
||||
MOZ_ASSERT(mBatches[0].mBlobs.Length() > mCurrentBlobIndex + 1);
|
||||
MOZ_ASSERT((int)mBatches[0].mBlobs.Length() > mCurrentBlobIndex + 1);
|
||||
|
||||
mBlob = mBatches[0].mBlobs[++mCurrentBlobIndex];
|
||||
|
||||
|
@ -45,7 +45,7 @@ public:
|
||||
static const int DEFAULT_OPP_CHANNEL = 10;
|
||||
static const int MAX_PACKET_LENGTH = 0xFFFE;
|
||||
|
||||
~BluetoothOppManager();
|
||||
virtual ~BluetoothOppManager();
|
||||
static BluetoothOppManager* Get();
|
||||
void ClientDataHandler(mozilla::ipc::UnixSocketRawData* aMessage);
|
||||
void ServerDataHandler(mozilla::ipc::UnixSocketRawData* aMessage);
|
||||
|
@ -965,13 +965,6 @@ BluetoothServiceBluedroid::StopDiscoveryInternal(
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
BluetoothServiceBluedroid::GetDevicePropertiesInternal(
|
||||
const BluetoothSignal& aSignal)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
BluetoothServiceBluedroid::SetProperty(BluetoothObjectType aType,
|
||||
const BluetoothNamedValue& aValue,
|
||||
@ -1033,56 +1026,6 @@ BluetoothServiceBluedroid::SetProperty(BluetoothObjectType aType,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
bool
|
||||
BluetoothServiceBluedroid::GetDevicePath(const nsAString& aAdapterPath,
|
||||
const nsAString& aDeviceAddress,
|
||||
nsAString& aDevicePath)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
BluetoothServiceBluedroid::AddServiceRecords(const char* serviceName,
|
||||
unsigned long long uuidMsb,
|
||||
unsigned long long uuidLsb,
|
||||
int channel)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
BluetoothServiceBluedroid::RemoveServiceRecords(const char* serviceName,
|
||||
unsigned long long uuidMsb,
|
||||
unsigned long long uuidLsb,
|
||||
int channel)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
BluetoothServiceBluedroid::AddReservedServicesInternal(
|
||||
const nsTArray<uint32_t>& aServices,
|
||||
nsTArray<uint32_t>& aServiceHandlesContainer)
|
||||
{
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
bool
|
||||
BluetoothServiceBluedroid::RemoveReservedServicesInternal(
|
||||
const nsTArray<uint32_t>& aServiceHandles)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
nsresult
|
||||
BluetoothServiceBluedroid::GetScoSocket(
|
||||
const nsAString& aObjectPath, bool aAuth, bool aEncrypt,
|
||||
mozilla::ipc::UnixSocketConsumer* aConsumer)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
BluetoothServiceBluedroid::GetServiceChannel(
|
||||
const nsAString& aDeviceAddress,
|
||||
|
@ -49,44 +49,11 @@ public:
|
||||
virtual nsresult StartDiscoveryInternal(BluetoothReplyRunnable* aRunnable);
|
||||
virtual nsresult StopDiscoveryInternal(BluetoothReplyRunnable* aRunnable);
|
||||
|
||||
virtual nsresult
|
||||
GetDevicePropertiesInternal(const BluetoothSignal& aSignal);
|
||||
|
||||
virtual nsresult
|
||||
SetProperty(BluetoothObjectType aType,
|
||||
const BluetoothNamedValue& aValue,
|
||||
BluetoothReplyRunnable* aRunnable);
|
||||
|
||||
virtual bool
|
||||
GetDevicePath(const nsAString& aAdapterPath,
|
||||
const nsAString& aDeviceAddress,
|
||||
nsAString& aDevicePath);
|
||||
|
||||
static bool
|
||||
AddServiceRecords(const char* serviceName,
|
||||
unsigned long long uuidMsb,
|
||||
unsigned long long uuidLsb,
|
||||
int channel);
|
||||
|
||||
static bool
|
||||
RemoveServiceRecords(const char* serviceName,
|
||||
unsigned long long uuidMsb,
|
||||
unsigned long long uuidLsb,
|
||||
int channel);
|
||||
|
||||
static bool
|
||||
AddReservedServicesInternal(const nsTArray<uint32_t>& aServices,
|
||||
nsTArray<uint32_t>& aServiceHandlesContainer);
|
||||
|
||||
static bool
|
||||
RemoveReservedServicesInternal(const nsTArray<uint32_t>& aServiceHandles);
|
||||
|
||||
virtual nsresult
|
||||
GetScoSocket(const nsAString& aObjectPath,
|
||||
bool aAuth,
|
||||
bool aEncrypt,
|
||||
mozilla::ipc::UnixSocketConsumer* aConsumer);
|
||||
|
||||
virtual nsresult
|
||||
GetServiceChannel(const nsAString& aDeviceAddress,
|
||||
const nsAString& aServiceUuid,
|
||||
|
@ -33,7 +33,7 @@ public:
|
||||
};
|
||||
|
||||
static BluetoothA2dpManager* Get();
|
||||
~BluetoothA2dpManager();
|
||||
virtual ~BluetoothA2dpManager();
|
||||
void ResetA2dp();
|
||||
void ResetAvrcp();
|
||||
|
||||
|
@ -1018,7 +1018,7 @@ BluetoothHfpManager::ReceiveSocketData(BluetoothSocket* aSocket,
|
||||
|
||||
for (uint8_t i = 0; i < atCommandValues.Length(); i++) {
|
||||
CINDType indicatorType = (CINDType) (i + 1);
|
||||
if (indicatorType >= ArrayLength(sCINDItems)) {
|
||||
if (indicatorType >= (int)ArrayLength(sCINDItems)) {
|
||||
// Ignore excess parameters at the end
|
||||
break;
|
||||
}
|
||||
@ -1802,15 +1802,8 @@ BluetoothHfpManager::ConnectSco(BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
if (sInShutdown) {
|
||||
BT_WARNING("ConnecteSco called while in shutdown!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!IsConnected()) {
|
||||
BT_WARNING("BluetoothHfpManager is not connected");
|
||||
return false;
|
||||
}
|
||||
NS_ENSURE_TRUE(!sInShutdown, false);
|
||||
NS_ENSURE_TRUE(IsConnected(), false);
|
||||
|
||||
SocketConnectionStatus status = mScoSocket->GetConnectionStatus();
|
||||
if (status == SocketConnectionStatus::SOCKET_CONNECTED ||
|
||||
@ -1828,16 +1821,14 @@ BluetoothHfpManager::ConnectSco(BluetoothReplyRunnable* aRunnable)
|
||||
return false;
|
||||
}
|
||||
|
||||
// Stop listening
|
||||
mScoSocket->Disconnect();
|
||||
|
||||
mScoRunnable = aRunnable;
|
||||
|
||||
BluetoothService* bs = BluetoothService::Get();
|
||||
NS_ENSURE_TRUE(bs, false);
|
||||
nsresult rv = bs->GetScoSocket(mDeviceAddress, true, false, mScoSocket);
|
||||
|
||||
mScoSocket->Connect(NS_ConvertUTF16toUTF8(mDeviceAddress), -1);
|
||||
mScoSocketStatus = mScoSocket->GetConnectionStatus();
|
||||
return NS_SUCCEEDED(rv);
|
||||
|
||||
mScoRunnable = aRunnable;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -331,7 +331,7 @@ BluetoothOppManager::StartSendingNextFile()
|
||||
|
||||
MOZ_ASSERT(!IsConnected());
|
||||
MOZ_ASSERT(!mBatches.IsEmpty());
|
||||
MOZ_ASSERT(mBatches[0].mBlobs.Length() > mCurrentBlobIndex + 1);
|
||||
MOZ_ASSERT((int)mBatches[0].mBlobs.Length() > mCurrentBlobIndex + 1);
|
||||
|
||||
mBlob = mBatches[0].mBlobs[++mCurrentBlobIndex];
|
||||
|
||||
|
@ -45,7 +45,7 @@ public:
|
||||
static const int DEFAULT_OPP_CHANNEL = 10;
|
||||
static const int MAX_PACKET_LENGTH = 0xFFFE;
|
||||
|
||||
~BluetoothOppManager();
|
||||
virtual ~BluetoothOppManager();
|
||||
static BluetoothOppManager* Get();
|
||||
void ClientDataHandler(mozilla::ipc::UnixSocketRawData* aMessage);
|
||||
void ServerDataHandler(mozilla::ipc::UnixSocketRawData* aMessage);
|
||||
|
@ -174,7 +174,7 @@ static const char* sBluetoothDBusSignals[] =
|
||||
static nsRefPtr<RawDBusConnection> gThreadConnection;
|
||||
|
||||
// Only A2DP and HID are authorized.
|
||||
static nsTArray<uint32_t> sAuthorizedServiceClass;
|
||||
static nsTArray<BluetoothServiceClass> sAuthorizedServiceClass;
|
||||
|
||||
// The object path of adpater which should be updated after switching Bluetooth.
|
||||
static nsString sAdapterPath;
|
||||
@ -2366,7 +2366,7 @@ BluetoothDBusService::SetProperty(BluetoothObjectType aType,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(aType < ArrayLength(sBluetoothDBusIfaces));
|
||||
MOZ_ASSERT(aType < (int)ArrayLength(sBluetoothDBusIfaces));
|
||||
MOZ_ASSERT(!sAdapterPath.IsEmpty());
|
||||
const char* interface = sBluetoothDBusIfaces[aType];
|
||||
|
||||
@ -2439,15 +2439,6 @@ BluetoothDBusService::SetProperty(BluetoothObjectType aType,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
bool
|
||||
BluetoothDBusService::GetDevicePath(const nsAString& aAdapterPath,
|
||||
const nsAString& aDeviceAddress,
|
||||
nsAString& aDevicePath)
|
||||
{
|
||||
aDevicePath = GetObjectPathFromAddress(aAdapterPath, aDeviceAddress);
|
||||
return true;
|
||||
}
|
||||
|
||||
nsresult
|
||||
BluetoothDBusService::CreatePairedDeviceInternal(
|
||||
const nsAString& aDeviceAddress,
|
||||
@ -2979,32 +2970,6 @@ BluetoothDBusService::UpdateSdpRecords(const nsAString& aDeviceAddress,
|
||||
DBUS_TYPE_INVALID);
|
||||
}
|
||||
|
||||
nsresult
|
||||
BluetoothDBusService::GetScoSocket(const nsAString& aAddress,
|
||||
bool aAuth,
|
||||
bool aEncrypt,
|
||||
mozilla::ipc::UnixSocketConsumer* aConsumer)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
if (!mConnection || !gThreadConnection) {
|
||||
NS_ERROR("Bluetooth service not started yet!");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
BluetoothUnixSocketConnector* c =
|
||||
new BluetoothUnixSocketConnector(BluetoothSocketType::SCO, -1,
|
||||
aAuth, aEncrypt);
|
||||
|
||||
if (!aConsumer->ConnectSocket(c, NS_ConvertUTF16toUTF8(aAddress).get())) {
|
||||
nsAutoString replyError;
|
||||
replyError.AssignLiteral("SocketConnectionError");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothDBusService::SendFile(const nsAString& aDeviceAddress,
|
||||
BlobParent* aBlobParent,
|
||||
|
@ -54,21 +54,6 @@ public:
|
||||
const BluetoothNamedValue& aValue,
|
||||
BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE;
|
||||
|
||||
virtual bool
|
||||
GetDevicePath(const nsAString& aAdapterPath,
|
||||
const nsAString& aDeviceAddress,
|
||||
nsAString& aDevicePath) MOZ_OVERRIDE;
|
||||
|
||||
static bool
|
||||
AddReservedServicesInternal(const nsTArray<uint32_t>& aServices,
|
||||
nsTArray<uint32_t>& aServiceHandlesContainer);
|
||||
|
||||
virtual nsresult
|
||||
GetScoSocket(const nsAString& aObjectPath,
|
||||
bool aAuth,
|
||||
bool aEncrypt,
|
||||
mozilla::ipc::UnixSocketConsumer* aConsumer) MOZ_OVERRIDE;
|
||||
|
||||
virtual nsresult
|
||||
GetServiceChannel(const nsAString& aDeviceAddress,
|
||||
const nsAString& aServiceUuid,
|
||||
|
@ -148,25 +148,6 @@ BluetoothServiceChildProcess::SetProperty(BluetoothObjectType aType,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
bool
|
||||
BluetoothServiceChildProcess::GetDevicePath(const nsAString& aAdapterPath,
|
||||
const nsAString& aDeviceAddress,
|
||||
nsAString& aDevicePath)
|
||||
{
|
||||
// XXXbent Right now this is adapted from BluetoothDBusService's
|
||||
// GetObjectPathFromAddress. This is basically a sync call that cannot
|
||||
// be forwarded to the parent process without blocking. Hopefully this
|
||||
// can be reworked.
|
||||
nsAutoString path(aAdapterPath);
|
||||
path.AppendLiteral("/dev_");
|
||||
path.Append(aDeviceAddress);
|
||||
path.ReplaceChar(':', '_');
|
||||
|
||||
aDevicePath = path;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
nsresult
|
||||
BluetoothServiceChildProcess::CreatePairedDeviceInternal(
|
||||
const nsAString& aAddress,
|
||||
@ -188,16 +169,6 @@ BluetoothServiceChildProcess::RemoveDeviceInternal(
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
BluetoothServiceChildProcess::GetScoSocket(
|
||||
const nsAString& aObjectPath,
|
||||
bool aAuth,
|
||||
bool aEncrypt,
|
||||
mozilla::ipc::UnixSocketConsumer* aConsumer)
|
||||
{
|
||||
MOZ_CRASH("This should never be called!");
|
||||
}
|
||||
|
||||
nsresult
|
||||
BluetoothServiceChildProcess::GetServiceChannel(const nsAString& aDeviceAddress,
|
||||
const nsAString& aServiceUuid,
|
||||
|
@ -66,11 +66,6 @@ public:
|
||||
const BluetoothNamedValue& aValue,
|
||||
BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE;
|
||||
|
||||
virtual bool
|
||||
GetDevicePath(const nsAString& aAdapterPath,
|
||||
const nsAString& aDeviceAddress,
|
||||
nsAString& aDevicePath) MOZ_OVERRIDE;
|
||||
|
||||
virtual nsresult
|
||||
CreatePairedDeviceInternal(const nsAString& aAddress,
|
||||
int aTimeout,
|
||||
@ -80,12 +75,6 @@ public:
|
||||
RemoveDeviceInternal(const nsAString& aObjectPath,
|
||||
BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE;
|
||||
|
||||
virtual nsresult
|
||||
GetScoSocket(const nsAString& aObjectPath,
|
||||
bool aAuth,
|
||||
bool aEncrypt,
|
||||
mozilla::ipc::UnixSocketConsumer* aConsumer) MOZ_OVERRIDE;
|
||||
|
||||
virtual nsresult
|
||||
GetServiceChannel(const nsAString& aDeviceAddress,
|
||||
const nsAString& aServiceUuid,
|
||||
|
@ -400,7 +400,7 @@ ContactManager.prototype = {
|
||||
},
|
||||
|
||||
_convertContacts: function(aContacts) {
|
||||
let contacts = [];
|
||||
let contacts = new this._window.Array();
|
||||
for (let i in aContacts) {
|
||||
contacts.push(this._convertContact(aContacts[i]));
|
||||
}
|
||||
|
@ -1348,17 +1348,6 @@ PreloadSlowThings()
|
||||
|
||||
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
|
||||
@ -1369,15 +1358,32 @@ ContentChild::RecvAppInfo(const nsCString& version, const nsCString& buildID,
|
||||
mAppInfo.buildID.Assign(buildID);
|
||||
mAppInfo.name.Assign(name);
|
||||
mAppInfo.UAName.Assign(UAName);
|
||||
|
||||
if (!Preferences::GetBool("dom.ipc.processPrelaunch.enabled", false)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// If we're part of the mozbrowser machinery, go ahead and start
|
||||
// preloading things. We can only do this for mozbrowser because
|
||||
// PreloadSlowThings() may set the docshell of the first TabChild
|
||||
// inactive, and we can only safely restore it to active from
|
||||
// BrowserElementChild.js.
|
||||
if ((mIsForApp || mIsForBrowser) &&
|
||||
Preferences::GetBool("dom.ipc.processPrelaunch.enabled", false)) {
|
||||
if ((mIsForApp || mIsForBrowser)
|
||||
#ifdef MOZ_NUWA_PROCESS
|
||||
&& !IsNuwaProcess()
|
||||
#endif
|
||||
) {
|
||||
PreloadSlowThings();
|
||||
}
|
||||
|
||||
#ifdef MOZ_NUWA_PROCESS
|
||||
if (IsNuwaProcess()) {
|
||||
ContentChild::GetSingleton()->RecvGarbageCollect();
|
||||
MessageLoop::current()->PostTask(
|
||||
FROM_HERE, NewRunnableFunction(OnFinishNuwaPreparation));
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1249,93 +1249,13 @@ ContentParent::ContentParent(mozIApplication* aApp,
|
||||
|
||||
Open(mSubprocess->GetChannel(), mSubprocess->GetOwnedChildProcessHandle());
|
||||
|
||||
// Set the subprocess's priority. We do this early on because we're likely
|
||||
// /lowering/ the process's CPU and memory priority, which it has inherited
|
||||
// from this process.
|
||||
//
|
||||
// This call can cause us to send IPC messages to the child process, so it
|
||||
// must come after the Open() call above.
|
||||
ProcessPriorityManager::SetProcessPriority(this, aInitialPriority);
|
||||
|
||||
// NB: internally, this will send an IPC message to the child
|
||||
// process to get it to create the CompositorChild. This
|
||||
// message goes through the regular IPC queue for this
|
||||
// channel, so delivery will happen-before any other messages
|
||||
// we send. The CompositorChild must be created before any
|
||||
// PBrowsers are created, because they rely on the Compositor
|
||||
// already being around. (Creation is async, so can't happen
|
||||
// on demand.)
|
||||
bool useOffMainThreadCompositing = !!CompositorParent::CompositorLoop();
|
||||
if (useOffMainThreadCompositing) {
|
||||
DebugOnly<bool> opened = PCompositor::Open(this);
|
||||
MOZ_ASSERT(opened);
|
||||
|
||||
if (Preferences::GetBool("layers.async-video.enabled",false)) {
|
||||
opened = PImageBridge::Open(this);
|
||||
MOZ_ASSERT(opened);
|
||||
}
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIChromeRegistry> registrySvc = nsChromeRegistry::GetService();
|
||||
nsChromeRegistryChrome* chromeRegistry =
|
||||
static_cast<nsChromeRegistryChrome*>(registrySvc.get());
|
||||
chromeRegistry->SendRegisteredChrome(this);
|
||||
mMessageManager = nsFrameMessageManager::NewProcessMessageManager(this);
|
||||
|
||||
if (gAppData) {
|
||||
nsCString version(gAppData->version);
|
||||
nsCString buildID(gAppData->buildID);
|
||||
nsCString name(gAppData->name);
|
||||
nsCString UAName(gAppData->UAName);
|
||||
|
||||
// Sending all information to content process.
|
||||
unused << SendAppInfo(version, buildID, name, UAName);
|
||||
}
|
||||
|
||||
nsStyleSheetService *sheetService = nsStyleSheetService::GetInstance();
|
||||
if (sheetService) {
|
||||
// This looks like a lot of work, but in a normal browser session we just
|
||||
// send two loads.
|
||||
|
||||
nsCOMArray<nsIStyleSheet>& agentSheets = *sheetService->AgentStyleSheets();
|
||||
for (uint32_t i = 0; i < agentSheets.Length(); i++) {
|
||||
URIParams uri;
|
||||
SerializeURI(agentSheets[i]->GetSheetURI(), uri);
|
||||
unused << SendLoadAndRegisterSheet(uri, nsIStyleSheetService::AGENT_SHEET);
|
||||
}
|
||||
|
||||
nsCOMArray<nsIStyleSheet>& userSheets = *sheetService->UserStyleSheets();
|
||||
for (uint32_t i = 0; i < userSheets.Length(); i++) {
|
||||
URIParams uri;
|
||||
SerializeURI(userSheets[i]->GetSheetURI(), uri);
|
||||
unused << SendLoadAndRegisterSheet(uri, nsIStyleSheetService::USER_SHEET);
|
||||
}
|
||||
|
||||
nsCOMArray<nsIStyleSheet>& authorSheets = *sheetService->AuthorStyleSheets();
|
||||
for (uint32_t i = 0; i < authorSheets.Length(); i++) {
|
||||
URIParams uri;
|
||||
SerializeURI(authorSheets[i]->GetSheetURI(), uri);
|
||||
unused << SendLoadAndRegisterSheet(uri, nsIStyleSheetService::AUTHOR_SHEET);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef MOZ_CONTENT_SANDBOX
|
||||
// Bug 921817. We enable the sandbox in RecvSetProcessPrivileges,
|
||||
// which is where a preallocated process drops unnecessary privileges,
|
||||
// but a non-preallocated process will already have changed its
|
||||
// uid/gid/etc immediately after forking. Thus, we send this message,
|
||||
// which is otherwise a no-op, to sandbox it at an appropriate point
|
||||
// during startup.
|
||||
if (aOSPrivileges != base::PRIVILEGES_INHERIT) {
|
||||
if (!SendSetProcessPrivileges(base::PRIVILEGES_INHERIT)) {
|
||||
KillHard();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
InitInternal(aInitialPriority,
|
||||
true, /* Setup off-main thread compositing */
|
||||
true /* Send registered chrome */);
|
||||
}
|
||||
|
||||
#ifdef MOZ_NUWA_PROCESS
|
||||
static const FileDescriptor*
|
||||
static const mozilla::ipc::FileDescriptor*
|
||||
FindFdProtocolFdMapping(const nsTArray<ProtocolFdMapping>& aFds,
|
||||
ProtocolId aProtoId)
|
||||
{
|
||||
@ -1401,8 +1321,9 @@ ContentParent::ContentParent(ContentParent* aTemplate,
|
||||
priority = PROCESS_PRIORITY_FOREGROUND;
|
||||
}
|
||||
|
||||
ProcessPriorityManager::SetProcessPriority(this, priority);
|
||||
mMessageManager = nsFrameMessageManager::NewProcessMessageManager(this);
|
||||
InitInternal(priority,
|
||||
false, /* Setup Off-main thread compositing */
|
||||
false /* Send registered chrome */);
|
||||
}
|
||||
#endif // MOZ_NUWA_PROCESS
|
||||
|
||||
@ -1432,6 +1353,101 @@ ContentParent::~ContentParent()
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ContentParent::InitInternal(ProcessPriority aInitialPriority,
|
||||
bool aSetupOffMainThreadCompositing,
|
||||
bool aSendRegisteredChrome)
|
||||
{
|
||||
// Set the subprocess's priority. We do this early on because we're likely
|
||||
// /lowering/ the process's CPU and memory priority, which it has inherited
|
||||
// from this process.
|
||||
//
|
||||
// This call can cause us to send IPC messages to the child process, so it
|
||||
// must come after the Open() call above.
|
||||
ProcessPriorityManager::SetProcessPriority(this, aInitialPriority);
|
||||
|
||||
if (aSetupOffMainThreadCompositing) {
|
||||
// NB: internally, this will send an IPC message to the child
|
||||
// process to get it to create the CompositorChild. This
|
||||
// message goes through the regular IPC queue for this
|
||||
// channel, so delivery will happen-before any other messages
|
||||
// we send. The CompositorChild must be created before any
|
||||
// PBrowsers are created, because they rely on the Compositor
|
||||
// already being around. (Creation is async, so can't happen
|
||||
// on demand.)
|
||||
bool useOffMainThreadCompositing = !!CompositorParent::CompositorLoop();
|
||||
if (useOffMainThreadCompositing) {
|
||||
DebugOnly<bool> opened = PCompositor::Open(this);
|
||||
MOZ_ASSERT(opened);
|
||||
|
||||
if (Preferences::GetBool("layers.async-video.enabled",false)) {
|
||||
opened = PImageBridge::Open(this);
|
||||
MOZ_ASSERT(opened);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (aSendRegisteredChrome) {
|
||||
nsCOMPtr<nsIChromeRegistry> registrySvc = nsChromeRegistry::GetService();
|
||||
nsChromeRegistryChrome* chromeRegistry =
|
||||
static_cast<nsChromeRegistryChrome*>(registrySvc.get());
|
||||
chromeRegistry->SendRegisteredChrome(this);
|
||||
}
|
||||
|
||||
mMessageManager = nsFrameMessageManager::NewProcessMessageManager(this);
|
||||
|
||||
if (gAppData) {
|
||||
nsCString version(gAppData->version);
|
||||
nsCString buildID(gAppData->buildID);
|
||||
nsCString name(gAppData->name);
|
||||
nsCString UAName(gAppData->UAName);
|
||||
|
||||
// Sending all information to content process.
|
||||
unused << SendAppInfo(version, buildID, name, UAName);
|
||||
}
|
||||
|
||||
nsStyleSheetService *sheetService = nsStyleSheetService::GetInstance();
|
||||
if (sheetService) {
|
||||
// This looks like a lot of work, but in a normal browser session we just
|
||||
// send two loads.
|
||||
|
||||
nsCOMArray<nsIStyleSheet>& agentSheets = *sheetService->AgentStyleSheets();
|
||||
for (uint32_t i = 0; i < agentSheets.Length(); i++) {
|
||||
URIParams uri;
|
||||
SerializeURI(agentSheets[i]->GetSheetURI(), uri);
|
||||
unused << SendLoadAndRegisterSheet(uri, nsIStyleSheetService::AGENT_SHEET);
|
||||
}
|
||||
|
||||
nsCOMArray<nsIStyleSheet>& userSheets = *sheetService->UserStyleSheets();
|
||||
for (uint32_t i = 0; i < userSheets.Length(); i++) {
|
||||
URIParams uri;
|
||||
SerializeURI(userSheets[i]->GetSheetURI(), uri);
|
||||
unused << SendLoadAndRegisterSheet(uri, nsIStyleSheetService::USER_SHEET);
|
||||
}
|
||||
|
||||
nsCOMArray<nsIStyleSheet>& authorSheets = *sheetService->AuthorStyleSheets();
|
||||
for (uint32_t i = 0; i < authorSheets.Length(); i++) {
|
||||
URIParams uri;
|
||||
SerializeURI(authorSheets[i]->GetSheetURI(), uri);
|
||||
unused << SendLoadAndRegisterSheet(uri, nsIStyleSheetService::AUTHOR_SHEET);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef MOZ_CONTENT_SANDBOX
|
||||
// Bug 921817. We enable the sandbox in RecvSetProcessPrivileges,
|
||||
// which is where a preallocated process drops unnecessary privileges,
|
||||
// but a non-preallocated process will already have changed its
|
||||
// uid/gid/etc immediately after forking. Thus, we send this message,
|
||||
// which is otherwise a no-op, to sandbox it at an appropriate point
|
||||
// during startup.
|
||||
if (mOSPrivileges != base::PRIVILEGES_INHERIT) {
|
||||
if (!SendSetProcessPrivileges(base::PRIVILEGES_INHERIT)) {
|
||||
KillHard();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool
|
||||
ContentParent::IsAlive()
|
||||
{
|
||||
|
@ -265,6 +265,11 @@ private:
|
||||
// The common initialization for the constructors.
|
||||
void InitializeMembers();
|
||||
|
||||
// The common initialization logic shared by all constuctors.
|
||||
void InitInternal(ProcessPriority aPriority,
|
||||
bool aSetupOffMainThreadCompositing,
|
||||
bool aSendRegisteredChrome);
|
||||
|
||||
virtual ~ContentParent();
|
||||
|
||||
void Init();
|
||||
|
@ -88,6 +88,7 @@ private:
|
||||
void ObserveProcessShutdown(nsISupports* aSubject);
|
||||
|
||||
bool mEnabled;
|
||||
bool mShutdown;
|
||||
nsRefPtr<ContentParent> mPreallocatedAppProcess;
|
||||
};
|
||||
|
||||
@ -114,6 +115,7 @@ PreallocatedProcessManagerImpl::PreallocatedProcessManagerImpl()
|
||||
, mPreallocateAppProcessTask(nullptr)
|
||||
, mIsNuwaReady(false)
|
||||
#endif
|
||||
, mShutdown(false)
|
||||
{}
|
||||
|
||||
void
|
||||
@ -124,6 +126,8 @@ PreallocatedProcessManagerImpl::Init()
|
||||
if (os) {
|
||||
os->AddObserver(this, "ipc:content-shutdown",
|
||||
/* weakRef = */ false);
|
||||
os->AddObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID,
|
||||
/* weakRef = */ false);
|
||||
}
|
||||
RereadPrefs();
|
||||
}
|
||||
@ -138,6 +142,8 @@ PreallocatedProcessManagerImpl::Observe(nsISupports* aSubject,
|
||||
} else if (!strcmp("nsPref:changed", aTopic)) {
|
||||
// The only other observer we registered was for our prefs.
|
||||
RereadPrefs();
|
||||
} else if (!strcmp(NS_XPCOM_SHUTDOWN_OBSERVER_ID, aTopic)) {
|
||||
mShutdown = true;
|
||||
} else {
|
||||
MOZ_ASSERT(false);
|
||||
}
|
||||
@ -240,7 +246,7 @@ PreallocatedProcessManagerImpl::DelayedNuwaFork()
|
||||
mPreallocateAppProcessTask = nullptr;
|
||||
|
||||
if (!mIsNuwaReady) {
|
||||
if (!mPreallocatedAppProcess) {
|
||||
if (!mPreallocatedAppProcess && !mShutdown) {
|
||||
mPreallocatedAppProcess = ContentParent::RunNuwaProcess();
|
||||
}
|
||||
// else mPreallocatedAppProcess is starting. It will NuwaFork() when ready.
|
||||
@ -281,6 +287,15 @@ PreallocatedProcessManagerImpl::PublishSpareProcess(ContentParent* aContent)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
if (Preferences::GetBool("dom.ipc.processPriorityManager.testMode")) {
|
||||
AutoJSContext cx;
|
||||
nsCOMPtr<nsIMessageBroadcaster> ppmm =
|
||||
do_GetService("@mozilla.org/parentprocessmessagemanager;1");
|
||||
nsresult rv = ppmm->BroadcastAsyncMessage(
|
||||
NS_LITERAL_STRING("TEST-ONLY:nuwa-add-new-process"),
|
||||
JSVAL_NULL, JSVAL_NULL, cx, 1);
|
||||
}
|
||||
|
||||
if (!mNuwaForkWaitTasks.IsEmpty()) {
|
||||
mNuwaForkWaitTasks.ElementAt(0)->Cancel();
|
||||
mNuwaForkWaitTasks.RemoveElementAt(0);
|
||||
@ -312,6 +327,14 @@ PreallocatedProcessManagerImpl::OnNuwaReady()
|
||||
ProcessPriorityManager::SetProcessPriority(mPreallocatedAppProcess,
|
||||
hal::PROCESS_PRIORITY_FOREGROUND);
|
||||
mIsNuwaReady = true;
|
||||
if (Preferences::GetBool("dom.ipc.processPriorityManager.testMode")) {
|
||||
AutoJSContext cx;
|
||||
nsCOMPtr<nsIMessageBroadcaster> ppmm =
|
||||
do_GetService("@mozilla.org/parentprocessmessagemanager;1");
|
||||
nsresult rv = ppmm->BroadcastAsyncMessage(
|
||||
NS_LITERAL_STRING("TEST-ONLY:nuwa-ready"),
|
||||
JSVAL_NULL, JSVAL_NULL, cx, 1);
|
||||
}
|
||||
NuwaFork();
|
||||
}
|
||||
|
||||
|
2
dom/ipc/tests/mochitest.ini
Normal file
2
dom/ipc/tests/mochitest.ini
Normal file
@ -0,0 +1,2 @@
|
||||
[test_NuwaProcessCreation.html]
|
||||
run-if = toolkit == 'gonk'
|
@ -5,4 +5,5 @@
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
MOCHITEST_CHROME_MANIFESTS += ['chrome.ini']
|
||||
MOCHITEST_MANIFESTS += ['mochitest.ini']
|
||||
|
||||
|
99
dom/ipc/tests/test_NuwaProcessCreation.html
Normal file
99
dom/ipc/tests/test_NuwaProcessCreation.html
Normal file
@ -0,0 +1,99 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
Test if Nuwa process created successfully.
|
||||
-->
|
||||
<head>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<script type="application/javascript;version=1.7">
|
||||
"use strict";
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
function TestLoader() {}
|
||||
|
||||
TestLoader.prototype = {
|
||||
_waitingTask: 0,
|
||||
onTestReady: null,
|
||||
unlockTestReady: function() {
|
||||
this._waitingTask--;
|
||||
this._maybeLoadTest();
|
||||
},
|
||||
lockTestReady: function() {
|
||||
this._waitingTask++;
|
||||
},
|
||||
_maybeLoadTest: function() {
|
||||
if (this._waitingTask == 0) {
|
||||
this.onTestReady();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var testLoader = new TestLoader();
|
||||
testLoader.lockTestReady();
|
||||
window.addEventListener('load', function() {
|
||||
testLoader.unlockTestReady();
|
||||
});
|
||||
|
||||
function setPref(pref, value) {
|
||||
testLoader.lockTestReady();
|
||||
if (value !== undefined && value !== null) {
|
||||
SpecialPowers.pushPrefEnv({'set': [[pref, value]]}, function() { testLoader.unlockTestReady(); });
|
||||
} else {
|
||||
SpecialPowers.pushPrefEnv({'clear': [[pref]]}, function() { testLoader.unlockTestReady(); });
|
||||
}
|
||||
}
|
||||
|
||||
setPref('dom.ipc.processPriorityManager.testMode', true);
|
||||
setPref('dom.ipc.processPriorityManager.enabled', true);
|
||||
setPref('dom.ipc.processPriorityManager.backgroundLRUPoolLevels', 2);
|
||||
|
||||
function runTest()
|
||||
{
|
||||
// Shutdown preallocated process.
|
||||
SpecialPowers.setBoolPref('dom.ipc.processPrelaunch.enabled', false);
|
||||
let cpmm = SpecialPowers.Cc["@mozilla.org/childprocessmessagemanager;1"]
|
||||
.getService(SpecialPowers.Ci.nsISyncMessageSender);
|
||||
let seenNuwaReady = false;
|
||||
let msgHandler = {
|
||||
receiveMessage: function receiveMessage(msg) {
|
||||
msg = SpecialPowers.wrap(msg);
|
||||
if (msg.name == 'TEST-ONLY:nuwa-ready') {
|
||||
ok(true, "Got nuwa-ready");
|
||||
is(seenNuwaReady, false, "Already received nuwa ready");
|
||||
seenNuwaReady = true;
|
||||
} else if (msg.name == 'TEST-ONLY:nuwa-add-new-process') {
|
||||
ok(true, "Got nuwa-add-new-process");
|
||||
is(seenNuwaReady, true, "Receive nuwa-add-new-process before nuwa-ready");
|
||||
testEnd();
|
||||
}
|
||||
}
|
||||
};
|
||||
let timeout = setTimeout(function() {
|
||||
ok(false, "Nuwa process is not launched");
|
||||
testEnd();
|
||||
}, 60000);
|
||||
|
||||
function testEnd() {
|
||||
cpmm.removeMessageListener("TEST-ONLY:nuwa-ready", msgHandler);
|
||||
cpmm.removeMessageListener("TEST-ONLY:nuwa-add-new-process", msgHandler);
|
||||
clearTimeout(timeout);
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
cpmm.addMessageListener("TEST-ONLY:nuwa-ready", msgHandler);
|
||||
cpmm.addMessageListener("TEST-ONLY:nuwa-add-new-process", msgHandler);
|
||||
|
||||
|
||||
// Setting this pref to true should cause us to prelaunch a process.
|
||||
SpecialPowers.setBoolPref('dom.ipc.processPrelaunch.enabled', true);
|
||||
}
|
||||
|
||||
testLoader.onTestReady = runTest;
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -7,3 +7,9 @@ ifdef MOZ_WEBRTC_LEAKING_TESTS
|
||||
MOCHITEST_FILES += \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
ifdef MOZ_B2G_CAMERA
|
||||
MOCHITEST_FILES += \
|
||||
test_getUserMedia_permission.html \
|
||||
$(NULL)
|
||||
endif
|
||||
|
75
dom/media/tests/mochitest/test_getUserMedia_permission.html
Normal file
75
dom/media/tests/mochitest/test_getUserMedia_permission.html
Normal file
@ -0,0 +1,75 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=853356
|
||||
-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>mozGetUserMedia Permission Test</title>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="application/javascript" src="head.js"></script>
|
||||
<script type="application/javascript" src="mediaStreamPlayback.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=853356">Display camera/microphone permission acquisition prompt</a>
|
||||
<script type="application/javascript">
|
||||
|
||||
var gCount = 0;
|
||||
var gTests = [
|
||||
{
|
||||
constraints: {video: true, audio: false}
|
||||
}
|
||||
,
|
||||
{
|
||||
constraints: {video: false, audio: true}
|
||||
}
|
||||
,
|
||||
{
|
||||
constraints: {video: true, audio: true},
|
||||
}
|
||||
];
|
||||
|
||||
function gUM(data) {
|
||||
var gum_success = function (stream) {
|
||||
SimpleTest.info("TEST-INFO | Got succss callback for " + JSON.stringify(data.constraints));
|
||||
|
||||
var hasAudioTrack = stream.getAudioTracks().length > 0;
|
||||
var hasVideoTrack = stream.getVideoTracks().length > 0;
|
||||
|
||||
is(data.constraints.audio, hasAudioTrack, "Request audio track:" +
|
||||
data.constraints.audio + " contain audio track:" + hasAudioTrack);
|
||||
is(data.constraints.video, hasVideoTrack, "Request video track:" +
|
||||
data.constraints.video + " contain audio track:" + hasVideoTrack);
|
||||
gCount++;
|
||||
if (gCount < gTests.length) {
|
||||
gUM(gTests[gCount]);
|
||||
} else {
|
||||
SimpleTest.finish();
|
||||
}
|
||||
}
|
||||
|
||||
var gum_fail = function () {
|
||||
ok(false, "permission not granted for " + JSON.stringify(data.constraints));
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
SimpleTest.info("TEST-INFO | Call getUserMedia for " + JSON.stringify(data.constraints));
|
||||
navigator.mozGetUserMedia(data.constraints, gum_success, gum_fail);
|
||||
}
|
||||
|
||||
SpecialPowers.pushPrefEnv({"set": [["media.navigator.permission.disabled", false]]},
|
||||
function () {
|
||||
SpecialPowers.addPermission('video-capture',
|
||||
Ci.nsIPermissionManager.ALLOW_ACTION, document);
|
||||
SpecialPowers.addPermission('audio-capture',
|
||||
Ci.nsIPermissionManager.ALLOW_ACTION, document);
|
||||
|
||||
gUM(gTests[gCount]);
|
||||
});
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
@ -924,6 +924,7 @@ MobileMessageDatabaseService.prototype = {
|
||||
// Participant store cursor iteration done.
|
||||
if (!invalidParticipantIds.length) {
|
||||
next();
|
||||
return;
|
||||
}
|
||||
|
||||
// Find affected thread.
|
||||
|
@ -19,7 +19,6 @@
|
||||
#include "mozilla/Monitor.h"
|
||||
#include "mozilla/FileUtils.h"
|
||||
#include "nsString.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsXULAppAPI.h"
|
||||
|
||||
@ -43,13 +42,15 @@ class UnixSocketImpl : public MessageLoopForIO::Watcher
|
||||
{
|
||||
public:
|
||||
UnixSocketImpl(UnixSocketConsumer* aConsumer, UnixSocketConnector* aConnector,
|
||||
const nsACString& aAddress)
|
||||
const nsACString& aAddress,
|
||||
SocketConnectionStatus aConnectionStatus)
|
||||
: mConsumer(aConsumer)
|
||||
, mIOLoop(nullptr)
|
||||
, mConnector(aConnector)
|
||||
, mShuttingDownOnIOThread(false)
|
||||
, mAddress(aAddress)
|
||||
, mDelayedConnectTask(nullptr)
|
||||
, mConnectionStatus(aConnectionStatus)
|
||||
{
|
||||
}
|
||||
|
||||
@ -245,6 +246,12 @@ private:
|
||||
* Task member for delayed connect task. Should only be access on main thread.
|
||||
*/
|
||||
CancelableTask* mDelayedConnectTask;
|
||||
|
||||
/**
|
||||
* Socket connection status. Duplicate from UnixSocketConsumer. Should only
|
||||
* be accessed on I/O thread.
|
||||
*/
|
||||
SocketConnectionStatus mConnectionStatus;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
@ -525,6 +532,7 @@ UnixSocketImpl::Accept()
|
||||
nsRefPtr<OnSocketEventTask> t =
|
||||
new OnSocketEventTask(this, OnSocketEventTask::CONNECT_ERROR);
|
||||
NS_DispatchToMainThread(t);
|
||||
mConnectionStatus = SOCKET_DISCONNECTED;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -562,6 +570,7 @@ UnixSocketImpl::Connect()
|
||||
nsRefPtr<OnSocketEventTask> t =
|
||||
new OnSocketEventTask(this, OnSocketEventTask::CONNECT_ERROR);
|
||||
NS_DispatchToMainThread(t);
|
||||
mConnectionStatus = SOCKET_DISCONNECTED;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -578,6 +587,7 @@ UnixSocketImpl::Connect()
|
||||
nsRefPtr<OnSocketEventTask> t =
|
||||
new OnSocketEventTask(this, OnSocketEventTask::CONNECT_ERROR);
|
||||
NS_DispatchToMainThread(t);
|
||||
mConnectionStatus = SOCKET_DISCONNECTED;
|
||||
return;
|
||||
}
|
||||
if (-1 == fcntl(mFd.get(), F_SETFL, current_opts & ~O_NONBLOCK)) {
|
||||
@ -586,6 +596,7 @@ UnixSocketImpl::Connect()
|
||||
nsRefPtr<OnSocketEventTask> t =
|
||||
new OnSocketEventTask(this, OnSocketEventTask::CONNECT_ERROR);
|
||||
NS_DispatchToMainThread(t);
|
||||
mConnectionStatus = SOCKET_DISCONNECTED;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -609,6 +620,7 @@ UnixSocketImpl::Connect()
|
||||
nsRefPtr<OnSocketEventTask> t =
|
||||
new OnSocketEventTask(this, OnSocketEventTask::CONNECT_ERROR);
|
||||
NS_DispatchToMainThread(t);
|
||||
mConnectionStatus = SOCKET_DISCONNECTED;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -624,6 +636,7 @@ UnixSocketImpl::Connect()
|
||||
nsRefPtr<OnSocketEventTask> t =
|
||||
new OnSocketEventTask(this, OnSocketEventTask::CONNECT_SUCCESS);
|
||||
NS_DispatchToMainThread(t);
|
||||
mConnectionStatus = SOCKET_CONNECTED;
|
||||
|
||||
SetUpIO();
|
||||
}
|
||||
@ -720,8 +733,7 @@ UnixSocketImpl::OnFileCanReadWithoutBlocking(int aFd)
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
MOZ_ASSERT(!mShuttingDownOnIOThread);
|
||||
|
||||
SocketConnectionStatus status = mConsumer->GetConnectionStatus();
|
||||
if (status == SOCKET_CONNECTED) {
|
||||
if (mConnectionStatus == SOCKET_CONNECTED) {
|
||||
// Read all of the incoming data.
|
||||
while (true) {
|
||||
nsAutoPtr<UnixSocketRawData> incoming(new UnixSocketRawData(MAX_READ_SIZE));
|
||||
@ -764,9 +776,7 @@ UnixSocketImpl::OnFileCanReadWithoutBlocking(int aFd)
|
||||
}
|
||||
|
||||
MOZ_CRASH("We returned early");
|
||||
}
|
||||
|
||||
if (status == SOCKET_LISTENING) {
|
||||
} else if (mConnectionStatus == SOCKET_LISTENING) {
|
||||
int client_fd = accept(mFd.get(), (struct sockaddr*)&mAddr, &mAddrSize);
|
||||
|
||||
if (client_fd < 0) {
|
||||
@ -791,6 +801,7 @@ UnixSocketImpl::OnFileCanReadWithoutBlocking(int aFd)
|
||||
nsRefPtr<OnSocketEventTask> t =
|
||||
new OnSocketEventTask(this, OnSocketEventTask::CONNECT_SUCCESS);
|
||||
NS_DispatchToMainThread(t);
|
||||
mConnectionStatus = SOCKET_CONNECTED;
|
||||
|
||||
SetUpIO();
|
||||
}
|
||||
@ -803,8 +814,7 @@ UnixSocketImpl::OnFileCanWriteWithoutBlocking(int aFd)
|
||||
MOZ_ASSERT(!mShuttingDownOnIOThread);
|
||||
|
||||
MOZ_ASSERT(aFd >= 0);
|
||||
SocketConnectionStatus status = mConsumer->GetConnectionStatus();
|
||||
if (status == SOCKET_CONNECTED) {
|
||||
if (mConnectionStatus == SOCKET_CONNECTED) {
|
||||
// Try to write the bytes of mCurrentRilRawData. If all were written, continue.
|
||||
//
|
||||
// Otherwise, save the byte position of the next byte to write
|
||||
@ -845,7 +855,7 @@ UnixSocketImpl::OnFileCanWriteWithoutBlocking(int aFd)
|
||||
mOutgoingQ.RemoveElementAt(0);
|
||||
delete data;
|
||||
}
|
||||
} else if (status == SOCKET_CONNECTING) {
|
||||
} else if (mConnectionStatus == SOCKET_CONNECTING) {
|
||||
int error, ret;
|
||||
socklen_t len = sizeof(error);
|
||||
ret = getsockopt(mFd.get(), SOL_SOCKET, SO_ERROR, &error, &len);
|
||||
@ -856,6 +866,7 @@ UnixSocketImpl::OnFileCanWriteWithoutBlocking(int aFd)
|
||||
nsRefPtr<OnSocketEventTask> t =
|
||||
new OnSocketEventTask(this, OnSocketEventTask::CONNECT_ERROR);
|
||||
NS_DispatchToMainThread(t);
|
||||
mConnectionStatus = SOCKET_DISCONNECTED;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -864,6 +875,7 @@ UnixSocketImpl::OnFileCanWriteWithoutBlocking(int aFd)
|
||||
nsRefPtr<OnSocketEventTask> t =
|
||||
new OnSocketEventTask(this, OnSocketEventTask::CONNECT_ERROR);
|
||||
NS_DispatchToMainThread(t);
|
||||
mConnectionStatus = SOCKET_DISCONNECTED;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -873,12 +885,14 @@ UnixSocketImpl::OnFileCanWriteWithoutBlocking(int aFd)
|
||||
nsRefPtr<OnSocketEventTask> t =
|
||||
new OnSocketEventTask(this, OnSocketEventTask::CONNECT_ERROR);
|
||||
NS_DispatchToMainThread(t);
|
||||
mConnectionStatus = SOCKET_DISCONNECTED;
|
||||
return;
|
||||
}
|
||||
|
||||
nsRefPtr<OnSocketEventTask> t =
|
||||
new OnSocketEventTask(this, OnSocketEventTask::CONNECT_SUCCESS);
|
||||
NS_DispatchToMainThread(t);
|
||||
mConnectionStatus = SOCKET_CONNECTED;
|
||||
|
||||
SetUpIO();
|
||||
}
|
||||
@ -935,7 +949,7 @@ UnixSocketConsumer::ConnectSocket(UnixSocketConnector* aConnector,
|
||||
}
|
||||
|
||||
nsCString addr(aAddress);
|
||||
mImpl = new UnixSocketImpl(this, connector.forget(), addr);
|
||||
mImpl = new UnixSocketImpl(this, connector.forget(), addr, SOCKET_CONNECTING);
|
||||
MessageLoop* ioLoop = XRE_GetIOMessageLoop();
|
||||
mConnectionStatus = SOCKET_CONNECTING;
|
||||
if (aDelayMs > 0) {
|
||||
@ -961,7 +975,8 @@ UnixSocketConsumer::ListenSocket(UnixSocketConnector* aConnector)
|
||||
return false;
|
||||
}
|
||||
|
||||
mImpl = new UnixSocketImpl(this, connector.forget(), EmptyCString());
|
||||
mImpl = new UnixSocketImpl(this, connector.forget(), EmptyCString(),
|
||||
SOCKET_LISTENING);
|
||||
mConnectionStatus = SOCKET_LISTENING;
|
||||
XRE_GetIOMessageLoop()->PostTask(FROM_HERE,
|
||||
new SocketAcceptTask(mImpl));
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "nsString.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "mozilla/RefPtr.h"
|
||||
#include "nsThreadUtils.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace ipc {
|
||||
@ -165,6 +166,7 @@ public:
|
||||
|
||||
SocketConnectionStatus GetConnectionStatus() const
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
return mConnectionStatus;
|
||||
}
|
||||
|
||||
|
@ -661,8 +661,7 @@ def run_tests_remote(tests, prefix, options):
|
||||
Test.CacheDir = posixpath.join(options.remote_test_root, '.js-cache')
|
||||
dm.mkDir(Test.CacheDir)
|
||||
|
||||
for path in os.listdir(JS_TESTS_DIR):
|
||||
dm.pushDir(os.path.join(JS_TESTS_DIR, path), posixpath.join(jit_tests_dir, 'tests', path))
|
||||
dm.pushDir(JS_TESTS_DIR, posixpath.join(jit_tests_dir, 'tests'), timeout=600)
|
||||
|
||||
dm.pushDir(os.path.dirname(TEST_DIR), options.remote_test_root, timeout=600)
|
||||
prefix[0] = os.path.join(options.remote_test_root, 'js')
|
||||
|
@ -14,6 +14,9 @@
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsIAsyncVerifyRedirectCallback.h"
|
||||
#include "nsISystemProxySettings.h"
|
||||
#ifdef MOZ_NUWA_PROCESS
|
||||
#include "ipc/Nuwa.h"
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
using namespace mozilla;
|
||||
@ -674,6 +677,13 @@ nsPACMan::NamePACThread()
|
||||
{
|
||||
NS_ABORT_IF_FALSE(!NS_IsMainThread(), "wrong thread");
|
||||
PR_SetCurrentThreadName("Proxy Resolution");
|
||||
#ifdef MOZ_NUWA_PROCESS
|
||||
if (IsNuwaProcess()) {
|
||||
NS_ASSERTION(NuwaMarkCurrentThread != nullptr,
|
||||
"NuwaMarkCurrentThread is undefined!");
|
||||
NuwaMarkCurrentThread(nullptr, nullptr);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -207,7 +207,16 @@ void RTSPSource::performPlay(int64_t playTimeUs) {
|
||||
if (mState == PAUSING) {
|
||||
playTimeUs = mLatestPausedUnit;
|
||||
}
|
||||
LOGI("performPlay : %lld", playTimeUs);
|
||||
|
||||
int64_t duration = 0;
|
||||
getDuration(&duration);
|
||||
MOZ_ASSERT(playTimeUs < duration,
|
||||
"Should never receive an out of bounds play time!");
|
||||
if (playTimeUs >= duration) {
|
||||
return;
|
||||
}
|
||||
|
||||
LOGI("performPlay : duration=%lld playTimeUs=%lld", duration, playTimeUs);
|
||||
mState = PLAYING;
|
||||
mHandler->play(playTimeUs);
|
||||
}
|
||||
@ -238,13 +247,22 @@ void RTSPSource::performSeek(int64_t seekTimeUs) {
|
||||
if (mState != PLAYING && mState != PAUSING) {
|
||||
return;
|
||||
}
|
||||
LOGI("performSeek: %llu", seekTimeUs);
|
||||
|
||||
int64_t duration = 0;
|
||||
getDuration(&duration);
|
||||
MOZ_ASSERT(seekTimeUs < duration,
|
||||
"Should never receive an out of bounds seek time!");
|
||||
if (seekTimeUs >= duration) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < mTracks.size(); ++i) {
|
||||
TrackInfo *info = &mTracks.editItemAt(i);
|
||||
info->mLatestPausedUnit = 0;
|
||||
mLatestPausedUnit = 0;
|
||||
}
|
||||
|
||||
LOGI("performSeek: %llu", seekTimeUs);
|
||||
mState = SEEKING;
|
||||
mHandler->seek(seekTimeUs);
|
||||
}
|
||||
|
@ -81,6 +81,8 @@
|
||||
ALLOW_SYSCALL(fstat64), \
|
||||
ALLOW_SYSCALL(stat64), \
|
||||
ALLOW_SYSCALL(lstat64), \
|
||||
ALLOW_SYSCALL(socketpair), \
|
||||
ALLOW_SYSCALL(sendmsg), \
|
||||
ALLOW_SYSCALL(sigprocmask),
|
||||
#elif defined(__i386__)
|
||||
#define SECCOMP_WHITELIST_ARCH_TOREMOVE \
|
||||
@ -89,7 +91,9 @@
|
||||
ALLOW_SYSCALL(lstat64), \
|
||||
ALLOW_SYSCALL(sigprocmask),
|
||||
#else
|
||||
#define SECCOMP_WHITELIST_ARCH_TOREMOVE
|
||||
#define SECCOMP_WHITELIST_ARCH_TOREMOVE \
|
||||
ALLOW_SYSCALL(socketpair), \
|
||||
ALLOW_SYSCALL(sendmsg),
|
||||
#endif
|
||||
|
||||
/* Architecture-specific syscalls for desktop linux */
|
||||
@ -252,8 +256,6 @@
|
||||
ALLOW_SYSCALL(access), \
|
||||
ALLOW_SYSCALL(unlink), \
|
||||
ALLOW_SYSCALL(fsync), \
|
||||
ALLOW_SYSCALL(socketpair), \
|
||||
ALLOW_SYSCALL(sendmsg), \
|
||||
/* Should remove all of the following in the future, if possible */ \
|
||||
ALLOW_SYSCALL(getpriority), \
|
||||
ALLOW_SYSCALL(setpriority), \
|
||||
|
@ -12,6 +12,9 @@
|
||||
#include "mozilla/Telemetry.h"
|
||||
#include "mozilla/ThreadHangStats.h"
|
||||
#include "mozilla/ThreadLocal.h"
|
||||
#ifdef MOZ_NUWA_PROCESS
|
||||
#include "ipc/Nuwa.h"
|
||||
#endif
|
||||
|
||||
#include "prinrval.h"
|
||||
#include "prthread.h"
|
||||
@ -32,6 +35,15 @@ private:
|
||||
static void MonitorThread(void* aData)
|
||||
{
|
||||
PR_SetCurrentThreadName("BgHangManager");
|
||||
|
||||
#ifdef MOZ_NUWA_PROCESS
|
||||
if (IsNuwaProcess()) {
|
||||
NS_ASSERTION(NuwaMarkCurrentThread != nullptr,
|
||||
"NuwaMarkCurrentThread is undefined!");
|
||||
NuwaMarkCurrentThread(nullptr, nullptr);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* We do not hold a reference to BackgroundHangManager here
|
||||
because the monitor thread only exists as long as the
|
||||
BackgroundHangManager instance exists. We stop the monitor
|
||||
|
Loading…
Reference in New Issue
Block a user