Merge b2g-inbound to m-c.

This commit is contained in:
Ryan VanderMeulen 2014-05-08 15:52:48 -04:00
commit 150ab7617e
40 changed files with 428 additions and 119 deletions

View File

@ -19,7 +19,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="68f7b3d4c3734a699b053cc897c1d11b8326fb93"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="4f352142a54f7f7ae2c460aad9049eda4b0edb14"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="f313e6d3aaaefe8c82eaed15912a09b120fb7260"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="ca283b9db2b151d465cfd2e19346cf58fe89e413"/>

View File

@ -17,7 +17,7 @@
</project>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="68f7b3d4c3734a699b053cc897c1d11b8326fb93"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="4f352142a54f7f7ae2c460aad9049eda4b0edb14"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="f313e6d3aaaefe8c82eaed15912a09b120fb7260"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="ce95d372e6d285725b96490afdaaf489ad8f9ca9"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="3691614d0045f7968addce45d4140fb360c3ceaf"/>

View File

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="65fba428f8d76336b33ddd9e15900357953600ba">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="68f7b3d4c3734a699b053cc897c1d11b8326fb93"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="4f352142a54f7f7ae2c460aad9049eda4b0edb14"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="f313e6d3aaaefe8c82eaed15912a09b120fb7260"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="ce95d372e6d285725b96490afdaaf489ad8f9ca9"/>

View File

@ -19,7 +19,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="68f7b3d4c3734a699b053cc897c1d11b8326fb93"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="4f352142a54f7f7ae2c460aad9049eda4b0edb14"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="f313e6d3aaaefe8c82eaed15912a09b120fb7260"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="ca283b9db2b151d465cfd2e19346cf58fe89e413"/>

View File

@ -18,7 +18,7 @@
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1f6a1fe07f81c5bc5e1d079c9b60f7f78ca2bf4f"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="68f7b3d4c3734a699b053cc897c1d11b8326fb93"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="4f352142a54f7f7ae2c460aad9049eda4b0edb14"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="f313e6d3aaaefe8c82eaed15912a09b120fb7260"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="ce95d372e6d285725b96490afdaaf489ad8f9ca9"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="3691614d0045f7968addce45d4140fb360c3ceaf"/>
@ -119,7 +119,7 @@
<!-- Flame specific things -->
<project name="device/generic/armv7-a-neon" path="device/generic/armv7-a-neon" revision="e8a318f7690092e639ba88891606f4183e846d3f"/>
<project name="device/qcom/common" path="device/qcom/common" revision="234ed34543345f58c0d4dcb1aa012de68802b9dc"/>
<project name="device-flame" path="device/t2m/flame" remote="b2g" revision="2173c7c1f90ccd28915eed1d58077311d8296ec4"/>
<project name="device-flame" path="device/t2m/flame" remote="b2g" revision="2a3f4c782daad9740f1b78766b636e0e00a0ff30"/>
<project name="kernel/msm" path="kernel" revision="1f47f3a180ed8b070f3cf3c4d11ff2523cca6c8a"/>
<project name="platform/bootable/recovery" path="bootable/recovery" revision="f2914eacee9120680a41463708bb6ee8291749fc"/>
<project name="platform/external/bluetooth/bluedroid" path="external/bluetooth/bluedroid" revision="fa892235a9bd8983f8b591129fc1a9398f64e514"/>

View File

@ -4,6 +4,6 @@
"remote": "",
"branch": ""
},
"revision": "2c31857e31048d05f9bb335d8ef2408c612195af",
"revision": "18441d7d35b6a96732575fb5c28cedfed8269fb2",
"repo_path": "/integration/gaia-central"
}

View File

@ -17,7 +17,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="68f7b3d4c3734a699b053cc897c1d11b8326fb93"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="4f352142a54f7f7ae2c460aad9049eda4b0edb14"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="f313e6d3aaaefe8c82eaed15912a09b120fb7260"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1f6a1fe07f81c5bc5e1d079c9b60f7f78ca2bf4f"/>

View File

@ -15,7 +15,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="68f7b3d4c3734a699b053cc897c1d11b8326fb93"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="4f352142a54f7f7ae2c460aad9049eda4b0edb14"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="f313e6d3aaaefe8c82eaed15912a09b120fb7260"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1f6a1fe07f81c5bc5e1d079c9b60f7f78ca2bf4f"/>

View File

@ -19,7 +19,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="68f7b3d4c3734a699b053cc897c1d11b8326fb93"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="4f352142a54f7f7ae2c460aad9049eda4b0edb14"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="f313e6d3aaaefe8c82eaed15912a09b120fb7260"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1f6a1fe07f81c5bc5e1d079c9b60f7f78ca2bf4f"/>

View File

@ -17,7 +17,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="68f7b3d4c3734a699b053cc897c1d11b8326fb93"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="4f352142a54f7f7ae2c460aad9049eda4b0edb14"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="f313e6d3aaaefe8c82eaed15912a09b120fb7260"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1f6a1fe07f81c5bc5e1d079c9b60f7f78ca2bf4f"/>

View File

@ -17,7 +17,7 @@
</project>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="68f7b3d4c3734a699b053cc897c1d11b8326fb93"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="4f352142a54f7f7ae2c460aad9049eda4b0edb14"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="f313e6d3aaaefe8c82eaed15912a09b120fb7260"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="ce95d372e6d285725b96490afdaaf489ad8f9ca9"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="3691614d0045f7968addce45d4140fb360c3ceaf"/>

View File

@ -17,7 +17,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="68f7b3d4c3734a699b053cc897c1d11b8326fb93"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="4f352142a54f7f7ae2c460aad9049eda4b0edb14"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="f313e6d3aaaefe8c82eaed15912a09b120fb7260"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1f6a1fe07f81c5bc5e1d079c9b60f7f78ca2bf4f"/>

View File

@ -357,6 +357,7 @@ RtspMediaResource::RtspMediaResource(MediaDecoder* aDecoder,
: BaseMediaResource(aDecoder, aChannel, aURI, aContentType)
, mIsConnected(false)
, mRealTime(false)
, mIsSuspend(true)
{
#ifndef NECKO_PROTOCOL_rtsp
MOZ_CRASH("Should not be called except for B2G platform");
@ -384,6 +385,28 @@ RtspMediaResource::~RtspMediaResource()
}
}
void RtspMediaResource::SetSuspend(bool aIsSuspend)
{
NS_ASSERTION(!NS_IsMainThread(), "Don't call on main thread");
RTSPMLOG("SetSuspend %d",aIsSuspend);
nsCOMPtr<nsIRunnable> runnable =
NS_NewRunnableMethodWithArg<bool>(this, &RtspMediaResource::NotifySuspend,
aIsSuspend);
NS_DispatchToMainThread(runnable);
}
void RtspMediaResource::NotifySuspend(bool aIsSuspend)
{
NS_ASSERTION(NS_IsMainThread(), "Only call on main thread");
RTSPMLOG("NotifySuspend %d",aIsSuspend);
mIsSuspend = aIsSuspend;
if (mDecoder) {
mDecoder->NotifySuspendedStatusChanged();
}
}
size_t
RtspMediaResource::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const
{
@ -638,6 +661,8 @@ RtspMediaResource::OnDisconnected(uint8_t aTrackIdx, nsresult aReason)
void RtspMediaResource::Suspend(bool aCloseImmediately)
{
NS_ASSERTION(NS_IsMainThread(), "Don't call on non-main thread");
mIsSuspend = true;
if (NS_WARN_IF(!mDecoder)) {
return;
}
@ -649,11 +674,14 @@ void RtspMediaResource::Suspend(bool aCloseImmediately)
mMediaStreamController->Suspend();
element->DownloadSuspended();
mDecoder->NotifySuspendedStatusChanged();
}
void RtspMediaResource::Resume()
{
NS_ASSERTION(NS_IsMainThread(), "Don't call on non-main thread");
mIsSuspend = false;
if (NS_WARN_IF(!mDecoder)) {
return;
}
@ -667,6 +695,7 @@ void RtspMediaResource::Resume()
element->DownloadResumed();
}
mMediaStreamController->Resume();
mDecoder->NotifySuspendedStatusChanged();
}
nsresult RtspMediaResource::Open(nsIStreamListener **aStreamListener)

View File

@ -93,6 +93,10 @@ public:
return mRealTime;
}
// Called by RtspOmxReader, dispatch a runnable to notify mDecoder.
// Other thread only.
void SetSuspend(bool aIsSuspend);
// The following methods can be called on any thread except main thread.
// Read data from track.
@ -137,8 +141,7 @@ public:
virtual void Pin() MOZ_OVERRIDE {}
virtual void Unpin() MOZ_OVERRIDE {}
// dummy
virtual bool IsSuspendedByCache() MOZ_OVERRIDE { return false; }
virtual bool IsSuspendedByCache() MOZ_OVERRIDE { return mIsSuspend; }
virtual bool IsSuspended() MOZ_OVERRIDE { return false; }
virtual bool IsTransportSeekable() MOZ_OVERRIDE { return true; }
@ -224,6 +227,8 @@ protected:
nsRefPtr<Listener> mListener;
private:
// Notify mDecoder the rtsp stream is suspend. Main thread only.
void NotifySuspend(bool aIsSuspend);
bool IsVideoEnabled();
bool IsVideo(uint8_t tracks, nsIStreamingProtocolMetaData *meta);
// These two members are created at |RtspMediaResource::OnConnected|.
@ -235,6 +240,8 @@ private:
bool mIsConnected;
// live stream
bool mRealTime;
// Indicate the rtsp controller is suspended or not. Main thread only.
bool mIsSuspend;
};
} // namespace mozilla

View File

@ -322,6 +322,7 @@ void RtspOmxReader::SetIdle() {
if (controller) {
controller->Pause();
}
mRtspResource->SetSuspend(true);
}
}
@ -333,6 +334,7 @@ void RtspOmxReader::SetActive() {
if (controller) {
controller->Play();
}
mRtspResource->SetSuspend(false);
}
// Call parent class to set OMXCodec active.

View File

@ -11,7 +11,6 @@ const Cr = Components.results;
Cu.import("resource://gre/modules/osfile.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/Task.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Promise.jsm");

View File

@ -5,11 +5,12 @@
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "BluetoothProfileController.h"
#include "BluetoothReplyRunnable.h"
#include "BluetoothA2dpManager.h"
#include "BluetoothHfpManager.h"
#include "BluetoothHidManager.h"
#include "BluetoothReplyRunnable.h"
#include "BluetoothService.h"
#include "BluetoothUtils.h"
#include "mozilla/dom/bluetooth/BluetoothTypes.h"
@ -217,6 +218,11 @@ BluetoothProfileController::StartSession()
MOZ_ASSERT(mProfilesIndex == -1);
MOZ_ASSERT(mTimer);
if (!IsBtServiceAvailable()) {
EndSession();
return;
}
if (mProfiles.Length() < 1) {
BT_LOGR("No queued profile.");
EndSession();
@ -240,6 +246,12 @@ BluetoothProfileController::EndSession()
BT_LOGR("mSuccess %d", mSuccess);
// Don't have to check profile status and retrigger session after connection
// timeout, since session is end.
if (mTimer) {
mTimer->Cancel();
}
// The action has completed, so the DOM request should be replied then invoke
// the callback.
if (mSuccess) {
@ -265,6 +277,11 @@ BluetoothProfileController::Next()
mCurrentProfileFinished = false;
if (!IsBtServiceAvailable()) {
EndSession();
return;
}
if (++mProfilesIndex >= (int)mProfiles.Length()) {
EndSession();
return;
@ -279,6 +296,13 @@ BluetoothProfileController::Next()
}
}
bool
BluetoothProfileController::IsBtServiceAvailable() const
{
BluetoothService* bs = BluetoothService::Get();
return (bs && bs->IsEnabled() && !bs->IsToggling());
}
void
BluetoothProfileController::NotifyCompletion(const nsAString& aErrorStr)
{
@ -308,6 +332,11 @@ BluetoothProfileController::GiveupAndContinue()
BT_LOGR_PROFILE(mProfiles[mProfilesIndex], ERR_OPERATION_TIMEOUT);
mProfiles[mProfilesIndex]->Reset();
Next();
if (IsBtServiceAvailable()) {
Next();
} else {
EndSession();
}
}

View File

@ -122,6 +122,9 @@ private:
// Connect/Disconnect next profile in the array
void Next();
// Is Bluetooth service available for profile connection/disconnection ?
bool IsBtServiceAvailable() const;
const bool mConnect;
nsString mDeviceAddress;
nsRefPtr<BluetoothReplyRunnable> mRunnable;

View File

@ -95,6 +95,14 @@ public:
{
MOZ_ASSERT(NS_IsMainThread());
// Bluetooth just enabled, clear profile controllers and runnable arrays.
sControllerArray.Clear();
sBondingRunnableArray.Clear();
sChangeDiscoveryRunnableArray.Clear();
sGetDeviceRunnableArray.Clear();
sSetPropertyRunnableArray.Clear();
sUnbondingRunnableArray.Clear();
// Bluetooth scan mode is NONE by default
bt_scan_mode_t mode = BT_SCAN_MODE_CONNECTABLE;
bt_property_t prop;
@ -1149,8 +1157,9 @@ NextBluetoothProfileController()
NS_ENSURE_FALSE_VOID(sControllerArray.IsEmpty());
sControllerArray.RemoveElementAt(0);
// Re-check if the task array is empty, if it's not, the next task will begin.
NS_ENSURE_FALSE_VOID(sControllerArray.IsEmpty());
sControllerArray[0]->StartSession();
if (!sControllerArray.IsEmpty()) {
sControllerArray[0]->StartSession();
}
}
static void

View File

@ -254,9 +254,9 @@ BrowserElementParent.prototype = {
"hello": this._recvHello,
"contextmenu": this._fireCtxMenuEvent,
"locationchange": this._fireEventFromMsg,
"loadstart": this._fireEventFromMsg,
"loadend": this._fireEventFromMsg,
"titlechange": this._fireEventFromMsg,
"loadstart": this._fireProfiledEventFromMsg,
"loadend": this._fireProfiledEventFromMsg,
"titlechange": this._fireProfiledEventFromMsg,
"iconchange": this._fireEventFromMsg,
"manifestchange": this._fireEventFromMsg,
"metachange": this._fireEventFromMsg,
@ -267,8 +267,8 @@ BrowserElementParent.prototype = {
"securitychange": this._fireEventFromMsg,
"error": this._fireEventFromMsg,
"scroll": this._fireEventFromMsg,
"firstpaint": this._fireEventFromMsg,
"documentfirstpaint": this._fireEventFromMsg,
"firstpaint": this._fireProfiledEventFromMsg,
"documentfirstpaint": this._fireProfiledEventFromMsg,
"nextpaint": this._recvNextPaint,
"keyevent": this._fireKeyEvent,
"showmodalprompt": this._handleShowModalPrompt,
@ -407,6 +407,16 @@ BrowserElementParent.prototype = {
return !this._frameElement.dispatchEvent(evt);
},
/**
* add profiler marker for each event fired.
*/
_fireProfiledEventFromMsg: function(data) {
if (Services.profiler !== undefined) {
Services.profiler.AddMarker(data.json.msg_name);
}
this._fireEventFromMsg(data);
},
/**
* Fire either a vanilla or a custom event, depending on the contents of
* |data|.

View File

@ -15,9 +15,11 @@ const Cu = Components.utils;
const Cc = Components.classes;
const Ci = Components.interfaces;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/IndexedDBHelper.jsm");
Cu.import("resource://gre/modules/PhoneNumberUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "PhoneNumberUtils",
"resource://gre/modules/PhoneNumberUtils.jsm");
Cu.importGlobalProperties(["indexedDB"]);
/* all exported symbols need to be bound to this on B2G - Bug 961777 */

View File

@ -15,8 +15,11 @@ this.EXPORTED_SYMBOLS = ["ContactService"];
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/ContactDB.jsm");
Cu.import("resource://gre/modules/PhoneNumberUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "ContactDB",
"resource://gre/modules/ContactDB.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "PhoneNumberUtils",
"resource://gre/modules/PhoneNumberUtils.jsm");
XPCOMUtils.defineLazyServiceGetter(this, "ppmm",
"@mozilla.org/parentprocessmessagemanager;1",

View File

@ -265,6 +265,24 @@ function ensureMobileConnection(aAdditionalPermissions, aServiceId) {
return deferred.promise;
}
/**
* Get MozMobileConnection by ServiceId
*
* @param aServiceId [optional]
* A numeric DSDS service id. Default: the one indicated in
* start*TestCommon() or 0 if not indicated.
*
* @return A MozMobileConnection.
*/
function getMozMobileConnectionByServiceId(aServiceId) {
let mobileConn = mobileConnection;
if (aServiceId !== undefined) {
mobileConn =
workingFrame.contentWindow.navigator.mozMobileConnections[aServiceId];
}
return mobileConn;
}
/**
* Wait for one named MobileConnection event.
*
@ -283,11 +301,7 @@ function ensureMobileConnection(aAdditionalPermissions, aServiceId) {
function waitForManagerEvent(aEventName, aServiceId) {
let deferred = Promise.defer();
let mobileConn = mobileConnection;
if (aServiceId !== undefined) {
mobileConn =
workingFrame.contentWindow.navigator.mozMobileConnections[aServiceId];
}
let mobileConn = getMozMobileConnectionByServiceId(aServiceId);
mobileConn.addEventListener(aEventName, function onevent(aEvent) {
mobileConn.removeEventListener(aEventName, onevent);
@ -426,11 +440,7 @@ function setDataEnabledAndWait(aEnabled, aServiceId) {
promises.push(waitForManagerEvent("datachange", aServiceId));
promises.push(setDataEnabled(aEnabled));
Promise.all(promises).then(function keepWaiting() {
let mobileConn = mobileConnection;
if (aServiceId !== undefined) {
mobileConn =
workingFrame.contentWindow.navigator.mozMobileConnections[aServiceId];
}
let mobileConn = getMozMobileConnectionByServiceId(aServiceId);
// To ignore some transient states, we only resolve that deferred promise
// when the |connected| state equals to the expected one and never rejects.
let connected = mobileConn.data.connected;
@ -445,6 +455,114 @@ function setDataEnabledAndWait(aEnabled, aServiceId) {
return deferred.promise;
}
/**
* Set radio enabling state.
*
* Resolve no matter the request succeeds or fails. Never reject.
*
* Fulfill params: (none)
*
* @param aEnabled
* A boolean state.
* @param aServiceId [optional]
* A numeric DSDS service id. Default: the one indicated in
* start*TestCommon() or 0 if not indicated.
*
* @return A deferred promise.
*/
function setRadioEnabled(aEnabled, aServiceId) {
let mobileConn = getMozMobileConnectionByServiceId(aServiceId);
let request = mobileConn.setRadioEnabled(aEnabled);
return wrapDomRequestAsPromise(request)
.then(function onsuccess() {
ok(true, "setRadioEnabled " + aEnabled + " on " + aServiceId + " success.");
}, function onerror() {
ok(false, "setRadioEnabled " + aEnabled + " on " + aServiceId + " " +
request.error.name);
});
}
/**
* Set radio enabling state and wait for "radiostatechange" event.
*
* Resolve if radio state changed to the expected one. Never reject.
*
* Fulfill params: (none)
*
* @param aEnabled
* A boolean state.
* @param aServiceId [optional]
* A numeric DSDS service id. Default: the one indicated in
* start*TestCommon() or 0 if not indicated.
*
* @return A deferred promise.
*/
function setRadioEnabledAndWait(aEnabled, aServiceId) {
let deferred = Promise.defer();
let promises = [];
promises.push(waitForManagerEvent("radiostatechange", aServiceId));
promises.push(setRadioEnabled(aEnabled, aServiceId));
Promise.all(promises).then(function keepWaiting() {
let mobileConn = getMozMobileConnectionByServiceId(aServiceId);
// To ignore some transient states, we only resolve that deferred promise
// when |radioState| equals to the expected one and never rejects.
let state = mobileConn.radioState;
aEnabled = aEnabled ? "enabled" : "disabled";
if (state == aEnabled) {
deferred.resolve();
return;
}
return waitForManagerEvent("radiostatechange", aServiceId).then(keepWaiting);
});
return deferred.promise;
}
/**
* Set CLIR (calling line id restriction).
*
* Fulfill params: (none)
* Reject params:
* 'RadioNotAvailable', 'RequestNotSupported', or 'GenericFailure'
*
* @param aMode
* A short number.
* @param aServiceId [optional]
* A numeric DSDS service id. Default: the one indicated in
* start*TestCommon() or 0 if not indicated.
*
* @return A deferred promise.
*/
function setClir(aMode, aServiceId) {
ok(true, "setClir(" + aMode + ", " + aServiceId + ")");
let mobileConn = getMozMobileConnectionByServiceId(aServiceId);
let request = mobileConn.setCallingLineIdRestriction(aMode);
return wrapDomRequestAsPromise(request);
}
/**
* Get CLIR (calling line id restriction).
*
* Fulfill params:
* CLIR mode.
* Reject params:
* 'RadioNotAvailable', 'RequestNotSupported', or 'GenericFailure'
*
* @param aServiceId [optional]
* A numeric DSDS service id. Default: the one indicated in
* start*TestCommon() or 0 if not indicated.
*
* @return A deferred promise.
*/
function getClir(aServiceId) {
ok(true, "getClir(" + aServiceId + ")");
let mobileConn = getMozMobileConnectionByServiceId(aServiceId);
let request = mobileConn.getCallingLineIdRestriction();
return wrapDomRequestAsPromise(request);
}
/**
* Set voice/data state and wait for state change.
*
@ -487,11 +605,7 @@ function setEmulatorRoamingAndWait(aRoaming, aServiceId) {
let state = (aRoaming ? "roaming" : "home");
return setEmulatorVoiceDataStateAndWait(aWhich, state, aServiceId)
.then(() => {
let mobileConn = mobileConnection;
if (aServiceId !== undefined) {
mobileConn =
workingFrame.contentWindow.navigator.mozMobileConnections[aServiceId];
}
let mobileConn = getMozMobileConnectionByServiceId(aServiceId);
is(mobileConn[aWhich].roaming, aRoaming,
aWhich + ".roaming")
});

View File

@ -27,3 +27,4 @@ qemu = true
[test_mobile_data_ipv6.js]
disabled = Bug 979137
[test_dsds_mobile_data_connection.js]
[test_mobile_clir_radio_off.js]

View File

@ -0,0 +1,36 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
MARIONETTE_TIMEOUT = 60000;
MARIONETTE_HEAD_JS = "head.js";
function testSetClirOnRadioOff(aMode) {
log("testSetClirOnRadioOff (set to mode: " + aMode + ")");
return Promise.resolve()
.then(() => setClir(aMode))
.then(() => {
ok(false, "shouldn't resolve");
}, (evt) => {
is(evt.target.error.name, "RadioNotAvailable");
});
}
function testGetClirOnRadioOff() {
log("testGetClirOnRadioOff");
return Promise.resolve()
.then(() => getClir())
.then(() => {
ok(false, "shouldn't resolve");
}, (evt) => {
is(evt.target.error.name, "RadioNotAvailable");
});
}
startTestCommon(function() {
return setRadioEnabledAndWait(false)
.then(() => testSetClirOnRadioOff(0))
.then(() => testGetClirOnRadioOff())
// Restore radio state.
.then(() => setRadioEnabledAndWait(true),
() => setRadioEnabledAnWait(true));
});

View File

@ -189,6 +189,9 @@ function getRadioDisabledState() {
function MmsConnection(aServiceId) {
this.serviceId = aServiceId;
this.radioInterface = gRil.getRadioInterface(aServiceId);
this.pendingCallbacks = [];
this.connectTimer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
this.disconnectTimer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
};
MmsConnection.prototype = {
@ -232,14 +235,14 @@ MmsConnection.prototype = {
//A queue to buffer the MMS HTTP requests when the MMS network
//is not yet connected. The buffered requests will be cleared
//if the MMS network fails to be connected within a timer.
pendingCallbacks: [],
pendingCallbacks: null,
/** MMS network connection reference count. */
refCount: 0,
connectTimer: Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer),
connectTimer: null,
disconnectTimer: Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer),
disconnectTimer: null,
/**
* Callback when |connectTimer| is timeout or cancelled by shutdown.
@ -1324,6 +1327,9 @@ SendTransaction.prototype = Object.create(CancellableTransaction.prototype, {
}
let response = MMS.PduHelper.parse(data, null);
if (DEBUG) {
debug("Parsed M-Send.conf: " + JSON.stringify(response));
}
if (!response || (response.type != MMS.MMS_PDU_TYPE_SEND_CONF)) {
callback(MMS.MMS_PDU_RESPONSE_ERROR_UNSUPPORTED_MESSAGE, null);
return;

View File

@ -11,8 +11,11 @@ Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/PhoneNumberUtils.jsm");
Cu.importGlobalProperties(["indexedDB"]);
var RIL = {};
Cu.import("resource://gre/modules/ril_consts.js", RIL);
XPCOMUtils.defineLazyGetter(this, "RIL", function () {
let obj = {};
Cu.import("resource://gre/modules/ril_consts.js", obj);
return obj;
});
const RIL_GETMESSAGESCURSOR_CID =
Components.ID("{484d1ad8-840e-4782-9dc4-9ebc4d914937}");

View File

@ -6,6 +6,4 @@ qemu=true
[test_ndef.js]
[test_nfc_enabled.js]
[test_nfc_manager_tech_discovered.js]
disabled = Bug 996426
[test_nfc_peer.js]
disabled = Bug 996426

View File

@ -8,9 +8,13 @@
this.EXPORTED_SYMBOLS = ["PhoneNumber"];
Components.utils.import("resource://gre/modules/PhoneNumberMetaData.jsm");
Components.utils.import("resource://gre/modules/PhoneNumberNormalizer.jsm");
const Cu = Components.utils;
Cu.import('resource://gre/modules/XPCOMUtils.jsm');
XPCOMUtils.defineLazyModuleGetter(this, "PHONE_NUMBER_META_DATA",
"resource://gre/modules/PhoneNumberMetaData.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "PhoneNumberNormalizer",
"resource://gre/modules/PhoneNumberNormalizer.jsm");
this.PhoneNumber = (function (dataBase) {
// Use strict in our context only - users might not want it
'use strict';

View File

@ -14,8 +14,10 @@ const Ci = Components.interfaces;
Cu.import("resource://gre/modules/Services.jsm");
Cu.import('resource://gre/modules/XPCOMUtils.jsm');
Cu.import("resource://gre/modules/PhoneNumberNormalizer.jsm");
Cu.import("resource://gre/modules/mcc_iso3166_table.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "PhoneNumberNormalizer",
"resource://gre/modules/PhoneNumberNormalizer.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "MCC_ISO3166_TABLE",
"resource://gre/modules/mcc_iso3166_table.jsm");
#ifdef MOZ_B2G_RIL
XPCOMUtils.defineLazyServiceGetter(this, "mobileConnection",
@ -196,7 +198,8 @@ this.PhoneNumberUtils = {
let inParent = Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULRuntime)
.processType == Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT;
if (inParent) {
Cu.import("resource://gre/modules/PhoneNumber.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "PhoneNumber",
"resource://gre/modules/PhoneNumber.jsm");
XPCOMUtils.defineLazyServiceGetter(this, "ppmm",
"@mozilla.org/parentprocessmessagemanager;1",
"nsIMessageListenerManager");

View File

@ -22,8 +22,11 @@ const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
let NFC = {};
Cu.import("resource://gre/modules/nfc_consts.js", NFC);
XPCOMUtils.defineLazyGetter(this, "NFC", function () {
let obj = {};
Cu.import("resource://gre/modules/nfc_consts.js", obj);
return obj;
});
Cu.import("resource://gre/modules/systemlibs.js");
const NFC_ENABLED = libcutils.property_get("ro.moz.nfc.enabled", "false") === "true";

View File

@ -23,8 +23,11 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/DOMRequestHelper.jsm");
let NFC = {};
Cu.import("resource://gre/modules/nfc_consts.js", NFC);
XPCOMUtils.defineLazyGetter(this, "NFC", function () {
let obj = {};
Cu.import("resource://gre/modules/nfc_consts.js", obj);
return obj;
});
Cu.import("resource://gre/modules/systemlibs.js");
const NFC_ENABLED = libcutils.property_get("ro.moz.nfc.enabled", "false") === "true";

View File

@ -21,8 +21,11 @@ Cu.import("resource://gre/modules/DOMRequestHelper.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
var RIL = {};
Cu.import("resource://gre/modules/ril_consts.js", RIL);
XPCOMUtils.defineLazyGetter(this, "RIL", function () {
let obj = {};
Cu.import("resource://gre/modules/ril_consts.js", obj);
return obj;
});
const NS_XPCOM_SHUTDOWN_OBSERVER_ID = "xpcom-shutdown";
@ -1378,6 +1381,13 @@ RILContentHelper.prototype = {
let request = Services.DOMRequest.createRequest(window);
let requestId = this.getRequestId(request);
let radioState = this.rilContexts[clientId].radioState;
if (radioState !== RIL.GECKO_DETAILED_RADIOSTATE_ENABLED) {
this.dispatchFireRequestError(requestId,
RIL.GECKO_ERROR_RADIO_NOT_AVAILABLE);
return request;
}
cpmm.sendAsyncMessage("RIL:GetCallingLineIdRestriction", {
clientId: clientId,
data: {
@ -1389,7 +1399,6 @@ RILContentHelper.prototype = {
},
setCallingLineIdRestriction: function(clientId, window, clirMode) {
if (window == null) {
throw Components.Exception("Can't get window object",
Cr.NS_ERROR_UNEXPECTED);
@ -1397,6 +1406,13 @@ RILContentHelper.prototype = {
let request = Services.DOMRequest.createRequest(window);
let requestId = this.getRequestId(request);
let radioState = this.rilContexts[clientId].radioState;
if (radioState !== RIL.GECKO_DETAILED_RADIOSTATE_ENABLED) {
this.dispatchFireRequestError(requestId,
RIL.GECKO_ERROR_RADIO_NOT_AVAILABLE);
return request;
}
cpmm.sendAsyncMessage("RIL:SetCallingLineIdRestriction", {
clientId: clientId,
data: {

View File

@ -24,8 +24,11 @@ Cu.import("resource://gre/modules/systemlibs.js");
Cu.import("resource://gre/modules/Promise.jsm");
Cu.import("resource://gre/modules/FileUtils.jsm");
var RIL = {};
Cu.import("resource://gre/modules/ril_consts.js", RIL);
XPCOMUtils.defineLazyGetter(this, "RIL", function () {
let obj = {};
Cu.import("resource://gre/modules/ril_consts.js", obj);
return obj;
});
// set to true in ril_consts.js to see debug messages
var DEBUG = RIL.DEBUG_RIL;
@ -96,7 +99,6 @@ const kSettingsTimezoneAutoUpdateAvailable = "time.timezone.automatic-update.ava
const NS_PREFBRANCH_PREFCHANGE_TOPIC_ID = "nsPref:changed";
const kPrefCellBroadcastDisabled = "ril.cellbroadcast.disabled";
const kPrefClirModePreference = "ril.clirMode";
const kPrefRilNumRadioInterfaces = "ril.numRadioInterfaces";
const DOM_MOBILE_MESSAGE_DELIVERY_RECEIVED = "received";
@ -1623,7 +1625,6 @@ WorkerMessenger.prototype = {
let options = {
debug: DEBUG,
cellBroadcastDisabled: false,
clirMode: RIL.CLIR_DEFAULT,
quirks: {
callstateExtraUint32:
libcutils.property_get("ro.moz.ril.callstate_extra_int", "false") === "true",
@ -1651,10 +1652,6 @@ WorkerMessenger.prototype = {
Services.prefs.getBoolPref(kPrefCellBroadcastDisabled);
} catch(e) {}
try {
options.clirMode = Services.prefs.getIntPref(kPrefClirModePreference);
} catch(e) {}
this.send(null, "setInitialOptions", options);
},
@ -3502,16 +3499,6 @@ RadioInterface.prototype = {
this.clientId, message);
},
_updateCallingLineIdRestrictionPref: function(mode) {
try {
Services.prefs.setIntPref(kPrefClirModePreference, mode);
Services.prefs.savePrefFile(null);
if (DEBUG) {
this.debug(kPrefClirModePreference + " pref is now " + mode);
}
} catch (e) {}
},
sendMMI: function(target, message) {
if (DEBUG) this.debug("SendMMI " + JSON.stringify(message));
this.workerMessenger.send("sendMMI", message, (function(response) {
@ -3519,7 +3506,6 @@ RadioInterface.prototype = {
this._sendCfStateChanged(response);
} else if (response.isSetCLIR && response.success) {
this._sendClirModeChanged(response.clirMode);
this._updateCallingLineIdRestrictionPref(response.clirMode);
}
target.sendAsyncMessage("RIL:SendMMI", {
@ -3550,7 +3536,6 @@ RadioInterface.prototype = {
this.workerMessenger.send("setCLIR", message, (function(response) {
if (response.success) {
this._sendClirModeChanged(response.clirMode);
this._updateCallingLineIdRestrictionPref(response.clirMode);
}
target.sendAsyncMessage("RIL:SetCallingLineIdRestriction", {
clientId: this.clientId,

View File

@ -53,7 +53,6 @@ if (!this.debug) {
}
let RIL_CELLBROADCAST_DISABLED;
let RIL_CLIR_MODE;
let RIL_EMERGENCY_NUMBERS;
const DEFAULT_EMERGENCY_NUMBERS = ["112", "911"];
@ -226,7 +225,6 @@ function RilObject(aContext) {
// Init properties that are only initialized once.
this.v5Legacy = RILQUIRKS_V5_LEGACY;
this.cellBroadcastDisabled = RIL_CELLBROADCAST_DISABLED;
this.clirMode = RIL_CLIR_MODE;
this._hasHangUpPendingOutgoingCall = false;
}
@ -271,11 +269,6 @@ RilObject.prototype = {
*/
cellBroadcastDisabled: false,
/**
* Global CLIR mode settings.
*/
clirMode: CLIR_DEFAULT,
/**
* Parsed Cell Broadcast search lists.
* cellBroadcastConfigs.MMI should be preserved over rild reset.
@ -1121,13 +1114,10 @@ RilObject.prototype = {
* nsIDOMMozMobileConnection interface.
*/
setCLIR: function(options) {
if (options) {
this.clirMode = options.clirMode;
}
let Buf = this.context.Buf;
Buf.newParcel(REQUEST_SET_CLIR, options);
Buf.writeInt32(1);
Buf.writeInt32(this.clirMode);
Buf.writeInt32(options.clirMode);
Buf.sendParcel();
},
@ -6489,7 +6479,6 @@ RilObject.prototype[UNSOLICITED_RESPONSE_RADIO_STATE_CHANGED] = function UNSOLIC
this.getBasebandVersion();
this.updateCellBroadcastConfig();
this.setPreferredNetworkType();
this.setCLIR();
if ((RILQUIRKS_DATA_REGISTRATION_ON_DEMAND ||
RILQUIRKS_SUBSCRIPTION_CONTROL) &&
this._attachDataRegistration) {
@ -14747,7 +14736,6 @@ let ContextPool = {
DEBUG = DEBUG_WORKER || aOptions.debug;
RIL_EMERGENCY_NUMBERS = aOptions.rilEmergencyNumbers;
RIL_CELLBROADCAST_DISABLED = aOptions.cellBroadcastDisabled;
RIL_CLIR_MODE = aOptions.clirMode;
let quirks = aOptions.quirks;
RILQUIRKS_CALLSTATE_EXTRA_UINT32 = quirks.callstateExtraUint32;

View File

@ -11,8 +11,11 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/Promise.jsm");
var RIL = {};
Cu.import("resource://gre/modules/ril_consts.js", RIL);
XPCOMUtils.defineLazyGetter(this, "RIL", function () {
let obj = {};
Cu.import("resource://gre/modules/ril_consts.js", obj);
return obj;
});
const GONK_TELEPHONYPROVIDER_CONTRACTID =
"@mozilla.org/telephony/gonktelephonyprovider;1";

View File

@ -10,6 +10,7 @@ enum WifiWPSMethod {
enum ConnectionStatus {
"connecting",
"authenticating",
"associated",
"connected",
"disconnected",
@ -53,6 +54,7 @@ dictionary NetworkProperties {
DOMString eap;
DOMString pin;
boolean dontConnect;
DOMString serverCertificate;
};
[Constructor(optional NetworkProperties properties),
@ -87,6 +89,7 @@ interface MozWifiNetwork {
attribute DOMString? eap;
attribute DOMString? pin;
attribute boolean? dontConnect;
attribute DOMString? serverCertificate;
};
[JSImplementation="@mozilla.org/mozwificonnection;1",

View File

@ -102,6 +102,7 @@ DOMWifiManager.prototype = {
"WifiManager:onconnect", "WifiManager:ondisconnect",
"WifiManager:onwpstimeout", "WifiManager:onwpsfail",
"WifiManager:onwpsoverlap", "WifiManager:connectionInfoUpdate",
"WifiManager:onauthenticating",
"WifiManager:onconnectingfailed"];
this.initDOMRequestHelper(aWindow, messages);
this._mm = Cc["@mozilla.org/childprocessmessagemanager;1"].getService(Ci.nsISyncMessageSender);
@ -365,6 +366,11 @@ DOMWifiManager.prototype = {
this._lastConnectionInfo = null;
this._fireStatusChangeEvent();
break;
case "WifiManager:onauthenticating":
this._currentNetwork = msg.network;
this._connectionStatus = "authenticating";
this._fireStatusChangeEvent();
break;
}
},

View File

@ -672,6 +672,27 @@ var WifiManager = (function() {
});
}
function handleWpaEapEvents(event) {
if (event.indexOf("CTRL-EVENT-EAP-FAILURE") !== -1) {
if (event.indexOf("EAP authentication failed") !== -1) {
notify("passwordmaybeincorrect");
}
return true;
}
if (event.indexOf("CTRL-EVENT-EAP-TLS-CERT-ERROR") !== -1) {
// Cert Error
manager.disconnect(function() {
manager.reassociate(function(){});
});
return true;
}
if (event.indexOf("CTRL-EVENT-EAP-STARTED") !== -1) {
notifyStateChange({ state: "AUTHENTICATING" });
return true;
}
return true;
}
// Handle events sent to us by the event worker.
function handleEvent(event) {
debug("Event coming in: " + event);
@ -777,12 +798,6 @@ var WifiManager = (function() {
}
return true;
}
if (eventData.indexOf("CTRL-EVENT-EAP-FAILURE") === 0) {
if (event.indexOf("EAP authentication failed") !== -1) {
notify("passwordmaybeincorrect");
}
return true;
}
if (eventData.indexOf("CTRL-EVENT-CONNECTED") === 0) {
// Format: CTRL-EVENT-CONNECTED - Connection to 00:1e:58:ec:d5:6d completed (reauth) [id=1 id_str=]
var bssid = event.split(" ")[4];
@ -804,6 +819,9 @@ var WifiManager = (function() {
notify("scanresultsavailable");
return true;
}
if (eventData.indexOf("CTRL-EVENT-EAP") === 0) {
return handleWpaEapEvents(event);
}
if (eventData.indexOf("WPS-TIMEOUT") === 0) {
notifyStateChange({ state: "WPS_TIMEOUT", BSSID: null, id: -1 });
return true;
@ -1061,7 +1079,7 @@ var WifiManager = (function() {
"ssid", "bssid", "psk", "wep_key0", "wep_key1", "wep_key2", "wep_key3",
"wep_tx_keyidx", "priority", "key_mgmt", "scan_ssid", "disabled",
"identity", "password", "auth_alg", "phase1", "phase2", "eap", "pin",
"pcsc"
"pcsc", "ca_cert"
];
manager.getNetworkConfiguration = function(config, callback) {
@ -1081,16 +1099,17 @@ var WifiManager = (function() {
var netId = config.netId;
var done = 0;
var errors = 0;
function hasValidProperty(name) {
return ((name in config) &&
config[name] != null &&
(["password", "wep_key0", "psk"].indexOf(name) !== -1 ||
config[name] !== '*'));
}
for (var n = 0; n < networkConfigurationFields.length; ++n) {
let fieldName = networkConfigurationFields[n];
if (!(fieldName in config) ||
// These fields are special: We can't retrieve them from the
// supplicant, and often we have a star in our config. In that case,
// we need to avoid overwriting the correct password with a *.
(fieldName === "password" ||
fieldName === "wep_key0" ||
fieldName === "psk") &&
config[fieldName] === '*') {
if (!hasValidProperty(fieldName)) {
++done;
} else {
wifiCommand.setNetworkVariable(netId, fieldName, config[fieldName], function(ok) {
@ -1532,7 +1551,8 @@ Network.api = {
eap: "rw",
pin: "rw",
phase1: "rw",
phase2: "rw"
phase2: "rw",
serverCertificate: "rw"
};
// Note: We never use ScanResult.prototype, so the fact that it's unrelated to
@ -1763,6 +1783,10 @@ function WifiWorker() {
pub.known = true;
if (net.scan_ssid === 1)
pub.hidden = true;
if ("ca_cert" in net && net.ca_cert &&
net.ca_cert.indexOf("keystore://WIFI_SERVERCERT_" === 0)) {
pub.serverCertificate = net.ca_cert.substr(27);
}
return pub;
};
@ -1825,15 +1849,29 @@ function WifiWorker() {
configured.auth_alg = net.auth_alg = "OPEN SHARED";
}
if ("pin" in net) {
net.pin = quote(net.pin);
function hasValidProperty(name) {
return ((name in net) && net[name] != null);
}
if ("phase1" in net)
net.phase1 = quote(net.phase1);
if (hasValidProperty("eap")) {
if (hasValidProperty("pin")) {
net.pin = quote(net.pin);
}
if ("phase2" in net)
net.phase2 = quote(net.phase2);
if (hasValidProperty("phase1"))
net.phase1 = quote(net.phase1);
if (hasValidProperty("phase2")) {
if (net.eap === "PEAP") {
net.phase2 = quote("auth=" + net.phase2);
} else { // TLS, TTLS
net.phase2 = quote("autheap=" + net.phase2);
}
}
if (hasValidProperty("serverCertificate"))
net.ca_cert = quote("keystore://WIFI_SERVERCERT_" + net.serverCertificate);
}
return net;
};
@ -2057,6 +2095,9 @@ function WifiWorker() {
case "WPS_OVERLAP_DETECTED":
self._fireEvent("onwpsoverlap", {});
break;
case "AUTHENTICATING":
self._fireEvent("onauthenticating", {network: netToDOM(self.currentNetwork)});
break;
case "SCANNING":
// If we're already scanning in the background, we don't need to worry
// about getting stuck while scanning.

View File

@ -64,6 +64,9 @@ let initTable = [
["obs", "@mozilla.org/observer-service;1", "nsIObserverService"],
["perms", "@mozilla.org/permissionmanager;1", "nsIPermissionManager"],
["prompt", "@mozilla.org/embedcomp/prompt-service;1", "nsIPromptService"],
#ifdef MOZ_ENABLE_PROFILER_SPS
["profiler", "@mozilla.org/tools/profiler;1", "nsIProfiler"],
#endif
["scriptloader", "@mozilla.org/moz/jssubscript-loader;1", "mozIJSSubScriptLoader"],
["scriptSecurityManager", "@mozilla.org/scriptsecuritymanager;1", "nsIScriptSecurityManager"],
#ifdef MOZ_TOOLKIT_SEARCH