mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Merge b2g-inbound to m-c.
This commit is contained in:
commit
845b5be3c5
@ -280,7 +280,6 @@ pref("layers.offmainthreadcomposition.async-animations", true);
|
||||
pref("layers.async-video.enabled", true);
|
||||
pref("layers.async-pan-zoom.enabled", true);
|
||||
pref("gfx.content.azure.backends", "cairo");
|
||||
pref("layers.composer2d.enabled", true);
|
||||
#endif
|
||||
|
||||
// Web Notifications
|
||||
@ -619,9 +618,11 @@ pref("ui.useOverlayScrollbars", 1);
|
||||
|
||||
// Enable the ProcessPriorityManager, and give processes with no visible
|
||||
// documents a 1s grace period before they're eligible to be marked as
|
||||
// background.
|
||||
// background. Background processes that are perceivable due to playing
|
||||
// media are given a longer grace period to accomodate changing tracks, etc.
|
||||
pref("dom.ipc.processPriorityManager.enabled", true);
|
||||
pref("dom.ipc.processPriorityManager.backgroundGracePeriodMS", 1000);
|
||||
pref("dom.ipc.processPriorityManager.backgroundPerceivableGracePeriodMS", 5000);
|
||||
pref("dom.ipc.processPriorityManager.temporaryPriorityLockMS", 5000);
|
||||
|
||||
// Number of different background levels for background processes. We use
|
||||
|
@ -597,9 +597,38 @@ SettingsListener.observe("debug.paint-flashing.enabled", false, function(value)
|
||||
SettingsListener.observe("layers.draw-borders", false, function(value) {
|
||||
Services.prefs.setBoolPref("layers.draw-borders", value);
|
||||
});
|
||||
SettingsListener.observe("layers.composer2d.enabled", true, function(value) {
|
||||
Services.prefs.setBoolPref("layers.composer2d.enabled", value);
|
||||
});
|
||||
|
||||
(function Composer2DSettingToPref() {
|
||||
//layers.composer.enabled can be enabled in three ways
|
||||
//In order of precedence they are:
|
||||
//
|
||||
//1. mozSettings "layers.composer.enabled"
|
||||
//2. a gecko pref "layers.composer.enabled"
|
||||
//3. presence of ro.display.colorfill at the Gonk level
|
||||
|
||||
var req = navigator.mozSettings.createLock().get('layers.composer2d.enabled');
|
||||
req.onsuccess = function() {
|
||||
if (typeof(req.result['layers.composer2d.enabled']) === 'undefined') {
|
||||
var enabled = false;
|
||||
if (Services.prefs.getPrefType('layers.composer2d.enabled') == Ci.nsIPrefBranch.PREF_BOOL) {
|
||||
enabled = Services.prefs.getBoolPref('layers.composer2d.enabled');
|
||||
} else {
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
enabled = (libcutils.property_get('ro.display.colorfill') === '1');
|
||||
#endif
|
||||
}
|
||||
navigator.mozSettings.createLock().set({'layers.composer2d.enabled': enabled });
|
||||
}
|
||||
|
||||
SettingsListener.observe("layers.composer2d.enabled", true, function(value) {
|
||||
Services.prefs.setBoolPref("layers.composer2d.enabled", value);
|
||||
});
|
||||
};
|
||||
req.onerror = function() {
|
||||
dump("Error configuring layers.composer2d.enabled setting");
|
||||
};
|
||||
|
||||
})();
|
||||
|
||||
// ================ Accessibility ============
|
||||
SettingsListener.observe("accessibility.screenreader", false, function(value) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
{
|
||||
"revision": "35ba072bcabf79e9c32776e9322c41e0020c9264",
|
||||
"revision": "a4c7ffc5619edd7e87fd763bd8a32291f4d394ac",
|
||||
"repo_path": "/integration/gaia-central"
|
||||
}
|
||||
|
@ -816,8 +816,8 @@ void
|
||||
BluetoothA2dpManager::UpdateMetaData(const nsAString& aTitle,
|
||||
const nsAString& aArtist,
|
||||
const nsAString& aAlbum,
|
||||
uint32_t aMediaNumber,
|
||||
uint32_t aTotalMediaCount,
|
||||
uint64_t aMediaNumber,
|
||||
uint64_t aTotalMediaCount,
|
||||
uint32_t aDuration)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
@ -905,7 +905,7 @@ BluetoothA2dpManager::UpdatePlayStatus(uint32_t aDuration,
|
||||
/*
|
||||
* This function handles RegisterNotification request from
|
||||
* AvrcpRegisterNotificationCallback, which updates current
|
||||
* track/status/position status.
|
||||
* track/status/position status in the INTERRIM response.
|
||||
*
|
||||
* aParam is only valid when position changed
|
||||
*/
|
||||
@ -925,16 +925,34 @@ BluetoothA2dpManager::UpdateRegisterNotification(int aEventId, int aParam)
|
||||
param.play_status = (btrc_play_status_t)mPlayStatus;
|
||||
break;
|
||||
case BTRC_EVT_TRACK_CHANGE:
|
||||
// In AVRCP 1.3 and 1.4, the identifier parameter of EVENT_TRACK_CHANGED
|
||||
// is different.
|
||||
// AVRCP 1.4: If no track is selected, we shall return 0xFFFFFFFFFFFFFFFF,
|
||||
// otherwise return 0x0 in the INTERRIM response. The expanded text in
|
||||
// version 1.4 is to allow for new UID feature. As for AVRCP 1.3, we shall
|
||||
// return 0xFFFFFFFF. Since PTS enforces to check this part to comply with
|
||||
// the most updated spec.
|
||||
mTrackChangedNotifyType = BTRC_NOTIFICATION_TYPE_INTERIM;
|
||||
// needs to convert to network big endian format since track stores
|
||||
// as uint8[8]. 56 = 8 * (BTRC_UID_SIZE -1)
|
||||
for (int i = 0; i < BTRC_UID_SIZE; ++i) {
|
||||
param.track[i] = (mMediaNumber >> (56 - 8 * i));
|
||||
// as uint8[8]. 56 = 8 * (BTRC_UID_SIZE -1).
|
||||
for (int index = 0; index < BTRC_UID_SIZE; ++index) {
|
||||
// We cannot easily check if a track is selected, so whenever A2DP is
|
||||
// streaming, we assume a track is selected.
|
||||
if (mSinkState == BluetoothA2dpManager::SinkState::SINK_PLAYING) {
|
||||
param.track[index] = 0x0;
|
||||
} else {
|
||||
param.track[index] = 0xFF;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case BTRC_EVT_PLAY_POS_CHANGED:
|
||||
// If no track is selected, return 0xFFFFFFFF in the INTERIM response
|
||||
mPlayPosChangedNotifyType = BTRC_NOTIFICATION_TYPE_INTERIM;
|
||||
param.song_pos = mPosition;
|
||||
if (mSinkState == BluetoothA2dpManager::SinkState::SINK_PLAYING) {
|
||||
param.song_pos = mPosition;
|
||||
} else {
|
||||
param.song_pos = 0xFFFFFFFF;
|
||||
}
|
||||
mPlaybackInterval = aParam;
|
||||
break;
|
||||
default:
|
||||
@ -971,13 +989,13 @@ BluetoothA2dpManager::GetPosition()
|
||||
return mPosition;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
uint64_t
|
||||
BluetoothA2dpManager::GetMediaNumber()
|
||||
{
|
||||
return mMediaNumber;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
uint64_t
|
||||
BluetoothA2dpManager::GetTotalMediaNumber()
|
||||
{
|
||||
return mTotalMediaCount;
|
||||
|
@ -45,8 +45,8 @@ public:
|
||||
void UpdateMetaData(const nsAString& aTitle,
|
||||
const nsAString& aArtist,
|
||||
const nsAString& aAlbum,
|
||||
uint32_t aMediaNumber,
|
||||
uint32_t aTotalMediaCount,
|
||||
uint64_t aMediaNumber,
|
||||
uint64_t aTotalMediaCount,
|
||||
uint32_t aDuration);
|
||||
void UpdatePlayStatus(uint32_t aDuration,
|
||||
uint32_t aPosition,
|
||||
@ -56,8 +56,8 @@ public:
|
||||
uint32_t GetDuration();
|
||||
ControlPlayStatus GetPlayStatus();
|
||||
uint32_t GetPosition();
|
||||
uint32_t GetMediaNumber();
|
||||
uint32_t GetTotalMediaNumber();
|
||||
uint64_t GetMediaNumber();
|
||||
uint64_t GetTotalMediaNumber();
|
||||
void GetTitle(nsAString& aTitle);
|
||||
void GetArtist(nsAString& aArtist);
|
||||
private:
|
||||
@ -80,8 +80,8 @@ private:
|
||||
nsString mArtist;
|
||||
nsString mTitle;
|
||||
uint32_t mDuration;
|
||||
uint32_t mMediaNumber;
|
||||
uint32_t mTotalMediaCount;
|
||||
uint64_t mMediaNumber;
|
||||
uint64_t mTotalMediaCount;
|
||||
uint32_t mPosition;
|
||||
/*
|
||||
* mPlaybackInterval specifies the time interval (in seconds) at which
|
||||
|
@ -390,8 +390,8 @@ void
|
||||
BluetoothA2dpManager::UpdateMetaData(const nsAString& aTitle,
|
||||
const nsAString& aArtist,
|
||||
const nsAString& aAlbum,
|
||||
uint32_t aMediaNumber,
|
||||
uint32_t aTotalMediaCount,
|
||||
uint64_t aMediaNumber,
|
||||
uint64_t aTotalMediaCount,
|
||||
uint32_t aDuration)
|
||||
{
|
||||
mTitle.Assign(aTitle);
|
||||
@ -436,7 +436,7 @@ BluetoothA2dpManager::GetPosition()
|
||||
return mPosition;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
uint64_t
|
||||
BluetoothA2dpManager::GetMediaNumber()
|
||||
{
|
||||
return mMediaNumber;
|
||||
|
@ -46,8 +46,8 @@ public:
|
||||
void UpdateMetaData(const nsAString& aTitle,
|
||||
const nsAString& aArtist,
|
||||
const nsAString& aAlbum,
|
||||
uint32_t aMediaNumber,
|
||||
uint32_t aTotalMediaCount,
|
||||
uint64_t aMediaNumber,
|
||||
uint64_t aTotalMediaCount,
|
||||
uint32_t aDuration);
|
||||
void UpdatePlayStatus(uint32_t aDuration,
|
||||
uint32_t aPosition,
|
||||
@ -56,7 +56,7 @@ public:
|
||||
uint32_t GetDuration();
|
||||
ControlPlayStatus GetPlayStatus();
|
||||
uint32_t GetPosition();
|
||||
uint32_t GetMediaNumber();
|
||||
uint64_t GetMediaNumber();
|
||||
void GetTitle(nsAString& aTitle);
|
||||
|
||||
private:
|
||||
@ -79,8 +79,8 @@ private:
|
||||
nsString mArtist;
|
||||
nsString mTitle;
|
||||
uint32_t mDuration;
|
||||
uint32_t mMediaNumber;
|
||||
uint32_t mTotalMediaCount;
|
||||
uint64_t mMediaNumber;
|
||||
uint64_t mTotalMediaCount;
|
||||
uint32_t mPosition;
|
||||
ControlPlayStatus mPlayStatus;
|
||||
};
|
||||
|
@ -2370,6 +2370,7 @@ BluetoothDBusService::SetProperty(BluetoothObjectType aType,
|
||||
int type;
|
||||
int tmp_int;
|
||||
void* val;
|
||||
const char* tempStr;
|
||||
nsCString str;
|
||||
if (aValue.value().type() == BluetoothValue::Tuint32_t) {
|
||||
tmp_int = aValue.value().get_uint32_t();
|
||||
@ -2377,7 +2378,7 @@ BluetoothDBusService::SetProperty(BluetoothObjectType aType,
|
||||
type = DBUS_TYPE_UINT32;
|
||||
} else if (aValue.value().type() == BluetoothValue::TnsString) {
|
||||
str = NS_ConvertUTF16toUTF8(aValue.value().get_nsString());
|
||||
const char* tempStr = str.get();
|
||||
tempStr = str.get();
|
||||
val = &tempStr;
|
||||
type = DBUS_TYPE_STRING;
|
||||
} else if (aValue.value().type() == BluetoothValue::Tbool) {
|
||||
|
@ -807,7 +807,16 @@ ParticularProcessPriorityManager::ResetPriority()
|
||||
ProcessPriority processPriority = ComputePriority();
|
||||
if (mPriority == PROCESS_PRIORITY_UNKNOWN ||
|
||||
mPriority > processPriority) {
|
||||
ScheduleResetPriority("backgroundGracePeriodMS");
|
||||
// Apps set at a perceivable background priority are often playing media.
|
||||
// Most media will have short gaps while changing tracks between songs,
|
||||
// switching videos, etc. Give these apps a longer grace period so they
|
||||
// can get their next track started, if there is one, before getting
|
||||
// downgraded.
|
||||
if (mPriority == PROCESS_PRIORITY_BACKGROUND_PERCEIVABLE) {
|
||||
ScheduleResetPriority("backgroundPerceivableGracePeriodMS");
|
||||
} else {
|
||||
ScheduleResetPriority("backgroundGracePeriodMS");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -803,6 +803,10 @@ bool TabParent::SendRealTouchEvent(WidgetTouchEvent& event)
|
||||
ScrollableLayerGuid guid;
|
||||
MaybeForwardEventToRenderFrame(event, &guid, &e);
|
||||
|
||||
if (mIsDestroyed) {
|
||||
return false;
|
||||
}
|
||||
|
||||
MapEventCoordinatesForChildProcess(mChildProcessOffsetAtTouchStart, &e);
|
||||
|
||||
return (e.message == NS_TOUCH_MOVE) ?
|
||||
|
@ -33,16 +33,13 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(MobileConnectionArray)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
MobileConnectionArray::MobileConnectionArray(nsPIDOMWindow* aWindow)
|
||||
: mWindow(aWindow)
|
||||
: mWindow(aWindow), mInitialized(false)
|
||||
{
|
||||
int32_t numRil = mozilla::Preferences::GetInt("ril.numRadioInterfaces", 1);
|
||||
uint32_t numRil = mozilla::Preferences::GetUint("ril.numRadioInterfaces", 1);
|
||||
MOZ_ASSERT(numRil > 0);
|
||||
|
||||
for (int32_t id = 0; id < numRil; id++) {
|
||||
nsRefPtr<MobileConnection> mobileConnection = new MobileConnection(id);
|
||||
mobileConnection->Init(aWindow);
|
||||
mMobileConnections.AppendElement(mobileConnection);
|
||||
}
|
||||
bool ret = mMobileConnections.SetLength(numRil);
|
||||
MOZ_ASSERT(ret);
|
||||
|
||||
SetIsDOMBinding();
|
||||
}
|
||||
@ -52,12 +49,27 @@ MobileConnectionArray::~MobileConnectionArray()
|
||||
DropConnections();
|
||||
}
|
||||
|
||||
void
|
||||
MobileConnectionArray::Init()
|
||||
{
|
||||
mInitialized = true;
|
||||
|
||||
for (uint32_t id = 0; id < mMobileConnections.Length(); id++) {
|
||||
nsRefPtr<MobileConnection> mobileConnection = new MobileConnection(id);
|
||||
mobileConnection->Init(mWindow);
|
||||
mMobileConnections[id] = mobileConnection;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
MobileConnectionArray::DropConnections()
|
||||
{
|
||||
for (uint32_t i = 0; i < mMobileConnections.Length(); i++) {
|
||||
mMobileConnections[i]->Shutdown();
|
||||
if (mInitialized) {
|
||||
for (uint32_t i = 0; i < mMobileConnections.Length(); i++) {
|
||||
mMobileConnections[i]->Shutdown();
|
||||
}
|
||||
}
|
||||
|
||||
mMobileConnections.Clear();
|
||||
}
|
||||
|
||||
@ -75,7 +87,7 @@ MobileConnectionArray::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope)
|
||||
}
|
||||
|
||||
nsIDOMMozMobileConnection*
|
||||
MobileConnectionArray::Item(uint32_t aIndex) const
|
||||
MobileConnectionArray::Item(uint32_t aIndex)
|
||||
{
|
||||
bool unused;
|
||||
return IndexedGetter(aIndex, unused);
|
||||
@ -88,8 +100,12 @@ MobileConnectionArray::Length() const
|
||||
}
|
||||
|
||||
nsIDOMMozMobileConnection*
|
||||
MobileConnectionArray::IndexedGetter(uint32_t aIndex, bool& aFound) const
|
||||
MobileConnectionArray::IndexedGetter(uint32_t aIndex, bool& aFound)
|
||||
{
|
||||
if (!mInitialized) {
|
||||
Init();
|
||||
}
|
||||
|
||||
aFound = false;
|
||||
aFound = aIndex < mMobileConnections.Length();
|
||||
|
||||
|
@ -34,18 +34,24 @@ public:
|
||||
|
||||
// WebIDL
|
||||
nsIDOMMozMobileConnection*
|
||||
Item(uint32_t aIndex) const;
|
||||
Item(uint32_t aIndex);
|
||||
|
||||
uint32_t
|
||||
Length() const;
|
||||
|
||||
nsIDOMMozMobileConnection*
|
||||
IndexedGetter(uint32_t aIndex, bool& aFound) const;
|
||||
IndexedGetter(uint32_t aIndex, bool& aFound);
|
||||
|
||||
private:
|
||||
~MobileConnectionArray();
|
||||
|
||||
void DropConnections();
|
||||
void
|
||||
Init();
|
||||
|
||||
void
|
||||
DropConnections();
|
||||
|
||||
bool mInitialized;
|
||||
|
||||
nsCOMPtr<nsPIDOMWindow> mWindow;
|
||||
nsTArray<nsRefPtr<MobileConnection>> mMobileConnections;
|
||||
|
@ -20,3 +20,4 @@ disabled = Bug 808783
|
||||
[test_call_barring_change_password.js]
|
||||
[test_mobile_set_radio.js]
|
||||
[test_mobile_last_known_network.js]
|
||||
[test_mobile_connections_array_uninitialized.js]
|
||||
|
@ -0,0 +1,32 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
MARIONETTE_TIMEOUT = 1000;
|
||||
|
||||
SpecialPowers.addPermission("mobileconnection", true, document);
|
||||
|
||||
// Permission changes can't change existing Navigator.prototype
|
||||
// objects, so grab our objects from a new Navigator
|
||||
let ifr = document.createElement("iframe");
|
||||
let connections;
|
||||
|
||||
ifr.onload = function() {
|
||||
connections = ifr.contentWindow.navigator.mozMobileConnections;
|
||||
|
||||
// mozMobileConnections hasn't been initialized yet.
|
||||
ok(connections);
|
||||
is(connections.length, 1);
|
||||
|
||||
ifr.parentNode.removeChild(ifr);
|
||||
ifr = null;
|
||||
connections = null;
|
||||
|
||||
SpecialPowers.gc();
|
||||
cleanUp();
|
||||
};
|
||||
document.body.appendChild(ifr);
|
||||
|
||||
function cleanUp() {
|
||||
SpecialPowers.removePermission("mobileconnection", document);
|
||||
finish();
|
||||
}
|
@ -8,6 +8,8 @@ const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
|
||||
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/NetUtil.jsm");
|
||||
Cu.import("resource://gre/modules/FileUtils.jsm");
|
||||
|
||||
const NETWORKSERVICE_CONTRACTID = "@mozilla.org/network/service;1";
|
||||
const NETWORKSERVICE_CID = Components.ID("{c14cabaf-bb8e-470d-a2f1-2cb6de6c5e5c}");
|
||||
@ -52,7 +54,7 @@ function NetworkService() {
|
||||
this.worker = new ChromeWorker("resource://gre/modules/net_worker.js");
|
||||
this.worker.onmessage = this.handleWorkerMessage.bind(this);
|
||||
this.worker.onerror = function onerror(event) {
|
||||
if(DEBUG) debug("Received error from worker: " + event.filename +
|
||||
if(DEBUG) debug("Received error from worker: " + event.filename +
|
||||
":" + event.lineno + ": " + event.message + "\n");
|
||||
// Prevent the event from bubbling any further.
|
||||
event.preventDefault();
|
||||
@ -107,18 +109,37 @@ NetworkService.prototype = {
|
||||
|
||||
getNetworkInterfaceStats: function(networkName, callback) {
|
||||
if(DEBUG) debug("getNetworkInterfaceStats for " + networkName);
|
||||
let file = new FileUtils.File("/proc/net/dev");
|
||||
|
||||
let params = {
|
||||
cmd: "getNetworkInterfaceStats",
|
||||
ifname: networkName
|
||||
};
|
||||
if (!file) {
|
||||
callback.networkStatsAvailable(false, -1, -1, new Date());
|
||||
return;
|
||||
}
|
||||
|
||||
params.report = true;
|
||||
params.isAsync = true;
|
||||
NetUtil.asyncFetch(file, function(inputStream, status) {
|
||||
let result = {
|
||||
success: true, // netd always return success even interface doesn't exist.
|
||||
rxBytes: 0,
|
||||
txBytes: 0
|
||||
};
|
||||
result.date = new Date();
|
||||
|
||||
this.controlMessage(params, function(result) {
|
||||
let success = !isError(result.resultCode);
|
||||
callback.networkStatsAvailable(success, result.rxBytes,
|
||||
if (Components.isSuccessCode(status)) {
|
||||
// Find record for corresponding interface.
|
||||
let statExpr = / +(\S+): +(\d+) +\d+ +\d+ +\d+ +\d+ +\d+ +\d+ +\d+ +(\d+) +\d+ +\d+ +\d+ +\d+ +\d+ +\d+ +\d+/;
|
||||
let data = NetUtil.readInputStreamToString(inputStream,
|
||||
inputStream.available()).split("\n");
|
||||
for (let i = 2; i < data.length; i++) {
|
||||
let parseResult = statExpr.exec(data[i]);
|
||||
if (parseResult && parseResult[1] === networkName) {
|
||||
result.rxBytes = parseInt(parseResult[2], 10);
|
||||
result.txBytes = parseInt(parseResult[3], 10);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
callback.networkStatsAvailable(result.success, result.rxBytes,
|
||||
result.txBytes, result.date);
|
||||
});
|
||||
},
|
||||
|
@ -2771,13 +2771,28 @@ RadioInterface.prototype = {
|
||||
break;
|
||||
case kNetworkInterfaceStateChangedTopic:
|
||||
let network = subject.QueryInterface(Ci.nsINetworkInterface);
|
||||
if (network.state == Ci.nsINetworkInterface.NETWORK_STATE_CONNECTED) {
|
||||
// Check SNTP when we have data connection, this may not take
|
||||
// effect immediately before the setting get enabled.
|
||||
if (this._sntp.isExpired()) {
|
||||
this._sntp.request();
|
||||
if (network.state != Ci.nsINetworkInterface.NETWORK_STATE_CONNECTED) {
|
||||
return;
|
||||
}
|
||||
|
||||
// SNTP can only update when we have mobile or Wifi connections.
|
||||
if (network.type != Ci.nsINetworkInterface.NETWORK_TYPE_WIFI &&
|
||||
network.type != Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If the network comes from RIL, make sure the RIL service is matched.
|
||||
if (subject instanceof Ci.nsIRilNetworkInterface) {
|
||||
network = subject.QueryInterface(Ci.nsIRilNetworkInterface);
|
||||
if (network.serviceId != this.clientId) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// SNTP won't update unless the SNTP is already expired.
|
||||
if (this._sntp.isExpired()) {
|
||||
this._sntp.request();
|
||||
}
|
||||
break;
|
||||
case kScreenStateChangedTopic:
|
||||
this.workerMessenger.send("setScreenState", { on: (data === "on") });
|
||||
|
@ -142,19 +142,6 @@ function usbTetheringSuccess(params) {
|
||||
return true;
|
||||
}
|
||||
|
||||
function networkInterfaceStatsFail(params) {
|
||||
// Notify the main thread.
|
||||
postMessage(params);
|
||||
return true;
|
||||
}
|
||||
|
||||
function networkInterfaceStatsSuccess(params) {
|
||||
// Notify the main thread.
|
||||
params.txBytes = parseFloat(params.resultReason);
|
||||
postMessage(params);
|
||||
return true;
|
||||
}
|
||||
|
||||
function networkInterfaceAlarmFail(params) {
|
||||
// Notify the main thread.
|
||||
postMessage(params);
|
||||
@ -607,18 +594,6 @@ function stopSoftAP(params, callback) {
|
||||
return doCommand(command, callback);
|
||||
}
|
||||
|
||||
function getRxBytes(params, callback) {
|
||||
let command = "interface readrxcounter " + params.ifname;
|
||||
return doCommand(command, callback);
|
||||
}
|
||||
|
||||
function getTxBytes(params, callback) {
|
||||
params.rxBytes = parseFloat(params.resultReason);
|
||||
|
||||
let command = "interface readtxcounter " + params.ifname;
|
||||
return doCommand(command, callback);
|
||||
}
|
||||
|
||||
function enableAlarm(params, callback) {
|
||||
let command = "bandwidth enable";
|
||||
return doCommand(command, callback);
|
||||
@ -933,24 +908,6 @@ function setUSBTethering(params) {
|
||||
return true;
|
||||
}
|
||||
|
||||
let gNetworkInterfaceStatsChain = [getRxBytes,
|
||||
getTxBytes,
|
||||
networkInterfaceStatsSuccess];
|
||||
|
||||
/**
|
||||
* handling main thread's get network interface stats request
|
||||
*/
|
||||
function getNetworkInterfaceStats(params) {
|
||||
debug("getNetworkInterfaceStats: " + params.ifname);
|
||||
|
||||
params.rxBytes = -1;
|
||||
params.txBytes = -1;
|
||||
params.date = new Date();
|
||||
|
||||
chain(params, gNetworkInterfaceStatsChain, networkInterfaceStatsFail);
|
||||
return true;
|
||||
}
|
||||
|
||||
let gNetworkInterfaceEnableAlarmChain = [enableAlarm,
|
||||
setQuota,
|
||||
setAlarm,
|
||||
|
@ -508,7 +508,7 @@ class Marionette(object):
|
||||
gecko_path=gecko_path,
|
||||
busybox=busybox)
|
||||
|
||||
def __del__(self):
|
||||
def cleanup(self):
|
||||
if self.emulator:
|
||||
self.emulator.close()
|
||||
if self.instance:
|
||||
@ -516,6 +516,9 @@ class Marionette(object):
|
||||
for qemu in self.extra_emulators:
|
||||
qemu.emulator.close()
|
||||
|
||||
def __del__(self):
|
||||
self.cleanup()
|
||||
|
||||
@staticmethod
|
||||
def is_port_available(port, host=''):
|
||||
port = int(port)
|
||||
|
@ -746,7 +746,9 @@ class BaseMarionetteTestRunner(object):
|
||||
if self.marionette.instance:
|
||||
self.marionette.instance.close()
|
||||
self.marionette.instance = None
|
||||
del self.marionette
|
||||
|
||||
self.marionette.cleanup()
|
||||
|
||||
for run_tests in self.mixin_run_tests:
|
||||
run_tests(tests)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user