Backed out changesets 1ae920a04d36 and a12273aa858b (bug 866272) for Marionette failures.

This commit is contained in:
Ryan VanderMeulen 2013-05-03 00:12:42 -04:00
Родитель ac449d7194
Коммит a2266d7758
6 изменённых файлов: 20 добавлений и 196 удалений

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

@ -119,11 +119,6 @@ this.PermissionsTable = { geolocation: {
privileged: DENY_ACTION,
certified: ALLOW_ACTION
},
mobilenetwork: {
app: DENY_ACTION,
privileged: ALLOW_ACTION,
certified: ALLOW_ACTION
},
power: {
app: DENY_ACTION,
privileged: DENY_ACTION,

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

@ -1361,8 +1361,7 @@ Navigator::GetMozMobileConnection(nsIDOMMozMobileConnection** aMobileConnection)
nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mWindow);
NS_ENSURE_TRUE(window, NS_OK);
if (!CheckPermission("mobileconnection") &&
!CheckPermission("mobilenetwork")) {
if (!CheckPermission("mobileconnection")) {
return NS_OK;
}

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

@ -13,7 +13,7 @@ interface nsIDOMMozMobileCellInfo;
interface nsIDOMMozIccManager;
interface nsIDOMMozMobileCFInfo;
[scriptable, builtinclass, uuid(780de142-562c-4141-bd5c-5413fb1952d2)]
[scriptable, builtinclass, uuid(bde7e16c-ff1f-4c7f-b1cd-480984cbb206)]
interface nsIDOMMozMobileConnection : nsIDOMEventTarget
{
const long ICC_SERVICE_CLASS_VOICE = (1 << 0);
@ -26,13 +26,6 @@ interface nsIDOMMozMobileConnection : nsIDOMEventTarget
const long ICC_SERVICE_CLASS_PAD = (1 << 7);
const long ICC_SERVICE_CLASS_MAX = (1 << 7);
/**
* These two fields can be accessed by privileged applications with the
* 'mobilenetwork' permission.
*/
readonly attribute DOMString lastKnownNetwork;
readonly attribute DOMString lastKnownHomeNetwork;
/**
* Indicates the state of the device's ICC card.
*

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

@ -11,8 +11,6 @@
#include "nsIDOMCFStateChangeEvent.h"
#include "nsIDOMICCCardLockErrorEvent.h"
#include "GeneratedEvents.h"
#include "mozilla/Preferences.h"
#include "nsIPermissionManager.h"
#include "nsContentUtils.h"
#include "nsJSUtils.h"
@ -83,7 +81,6 @@ NS_IMPL_EVENT_HANDLER(MobileConnection, cfstatechange)
MobileConnection::MobileConnection()
{
mProvider = do_GetService(NS_RILCONTENTHELPER_CONTRACTID);
mWindow = nullptr;
// Not being able to acquire the provider isn't fatal since we check
// for it explicitly below.
@ -91,6 +88,11 @@ MobileConnection::MobileConnection()
NS_WARNING("Could not acquire nsIMobileConnectionProvider!");
return;
}
mListener = new Listener(this);
DebugOnly<nsresult> rv = mProvider->RegisterMobileConnectionMsg(mListener);
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv),
"Failed registering mobile connection messages with provider");
}
void
@ -98,18 +100,8 @@ MobileConnection::Init(nsPIDOMWindow* aWindow)
{
BindToOwner(aWindow);
mWindow = do_GetWeakReference(aWindow);
mListener = new Listener(this);
if (!CheckPermission("mobilenetwork") &&
CheckPermission("mobileconnection")) {
DebugOnly<nsresult> rv = mProvider->RegisterMobileConnectionMsg(mListener);
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv),
"Failed registering mobile connection messages with provider");
mIccManager = new icc::IccManager();
mIccManager->Init(aWindow);
}
mIccManager = new icc::IccManager();
mIccManager->Init(aWindow);
}
void
@ -130,55 +122,11 @@ MobileConnection::Shutdown()
// nsIDOMMozMobileConnection
NS_IMETHODIMP
MobileConnection::GetLastKnownNetwork(nsAString& network)
{
network.SetIsVoid(true);
if (!CheckPermission("mobilenetwork")) {
return NS_OK;
}
network = mozilla::Preferences::GetString("ril.lastKnownNetwork");
return NS_OK;
}
NS_IMETHODIMP
MobileConnection::GetLastKnownHomeNetwork(nsAString& network)
{
network.SetIsVoid(true);
if (!CheckPermission("mobilenetwork")) {
return NS_OK;
}
network = mozilla::Preferences::GetString("ril.lastKnownHomeNetwork");
return NS_OK;
}
// All fields below require the "mobileconnection" permission.
bool
MobileConnection::CheckPermission(const char* type)
{
nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mWindow);
NS_ENSURE_TRUE(window, false);
nsCOMPtr<nsIPermissionManager> permMgr =
do_GetService(NS_PERMISSIONMANAGER_CONTRACTID);
NS_ENSURE_TRUE(permMgr, false);
uint32_t permission = nsIPermissionManager::DENY_ACTION;
permMgr->TestPermissionFromWindow(window, type, &permission);
return permission == nsIPermissionManager::ALLOW_ACTION;
}
NS_IMETHODIMP
MobileConnection::GetCardState(nsAString& cardState)
{
cardState.SetIsVoid(true);
if (!mProvider || !CheckPermission("mobileconnection")) {
if (!mProvider) {
cardState.SetIsVoid(true);
return NS_OK;
}
return mProvider->GetCardState(cardState);
@ -187,9 +135,8 @@ MobileConnection::GetCardState(nsAString& cardState)
NS_IMETHODIMP
MobileConnection::GetIccInfo(nsIDOMMozMobileICCInfo** aIccInfo)
{
*aIccInfo = nullptr;
if (!mProvider || !CheckPermission("mobileconnection")) {
if (!mProvider) {
*aIccInfo = nullptr;
return NS_OK;
}
return mProvider->GetIccInfo(aIccInfo);
@ -198,9 +145,8 @@ MobileConnection::GetIccInfo(nsIDOMMozMobileICCInfo** aIccInfo)
NS_IMETHODIMP
MobileConnection::GetVoice(nsIDOMMozMobileConnectionInfo** voice)
{
*voice = nullptr;
if (!mProvider || !CheckPermission("mobileconnection")) {
if (!mProvider) {
*voice = nullptr;
return NS_OK;
}
return mProvider->GetVoiceConnectionInfo(voice);
@ -209,9 +155,8 @@ MobileConnection::GetVoice(nsIDOMMozMobileConnectionInfo** voice)
NS_IMETHODIMP
MobileConnection::GetData(nsIDOMMozMobileConnectionInfo** data)
{
*data = nullptr;
if (!mProvider) {
*data = nullptr;
return NS_OK;
}
return mProvider->GetDataConnectionInfo(data);
@ -220,10 +165,9 @@ MobileConnection::GetData(nsIDOMMozMobileConnectionInfo** data)
NS_IMETHODIMP
MobileConnection::GetNetworkSelectionMode(nsAString& networkSelectionMode)
{
networkSelectionMode.SetIsVoid(true);
if (!mProvider || !CheckPermission("mobileconnection")) {
return NS_OK;
if (!mProvider) {
networkSelectionMode.SetIsVoid(true);
return NS_OK;
}
return mProvider->GetNetworkSelectionMode(networkSelectionMode);
}
@ -231,12 +175,6 @@ MobileConnection::GetNetworkSelectionMode(nsAString& networkSelectionMode)
NS_IMETHODIMP
MobileConnection::GetIcc(nsIDOMMozIccManager** aIcc)
{
*aIcc = nullptr;
if (!CheckPermission("mobileconnection")) {
return NS_OK;
}
NS_IF_ADDREF(*aIcc = mIccManager);
return NS_OK;
}
@ -246,10 +184,6 @@ MobileConnection::GetNetworks(nsIDOMDOMRequest** request)
{
*request = nullptr;
if (!CheckPermission("mobileconnection")) {
return NS_OK;
}
if (!mProvider) {
return NS_ERROR_FAILURE;
}
@ -262,10 +196,6 @@ MobileConnection::SelectNetwork(nsIDOMMozMobileNetworkInfo* network, nsIDOMDOMRe
{
*request = nullptr;
if (!CheckPermission("mobileconnection")) {
return NS_OK;
}
if (!mProvider) {
return NS_ERROR_FAILURE;
}
@ -278,10 +208,6 @@ MobileConnection::SelectNetworkAutomatically(nsIDOMDOMRequest** request)
{
*request = nullptr;
if (!CheckPermission("mobileconnection")) {
return NS_OK;
}
if (!mProvider) {
return NS_ERROR_FAILURE;
}
@ -294,10 +220,6 @@ MobileConnection::GetCardLock(const nsAString& aLockType, nsIDOMDOMRequest** aDo
{
*aDomRequest = nullptr;
if (!CheckPermission("mobileconnection")) {
return NS_OK;
}
if (!mProvider) {
return NS_ERROR_FAILURE;
}
@ -311,10 +233,6 @@ MobileConnection::UnlockCardLock(const JS::Value& aInfo,
{
*aDomRequest = nullptr;
if (!CheckPermission("mobileconnection")) {
return NS_OK;
}
if (!mProvider) {
return NS_ERROR_FAILURE;
}
@ -328,10 +246,6 @@ MobileConnection::SetCardLock(const JS::Value& aInfo,
{
*aDomRequest = nullptr;
if (!CheckPermission("mobileconnection")) {
return NS_OK;
}
if (!mProvider) {
return NS_ERROR_FAILURE;
}
@ -343,10 +257,6 @@ NS_IMETHODIMP
MobileConnection::SendMMI(const nsAString& aMMIString,
nsIDOMDOMRequest** request)
{
if (!CheckPermission("mobileconnection")) {
return NS_OK;
}
if (!mProvider) {
return NS_ERROR_FAILURE;
}
@ -357,10 +267,6 @@ MobileConnection::SendMMI(const nsAString& aMMIString,
NS_IMETHODIMP
MobileConnection::CancelMMI(nsIDOMDOMRequest** request)
{
if (!CheckPermission("mobileconnection")) {
return NS_OK;
}
if (!mProvider) {
return NS_ERROR_FAILURE;
}
@ -374,10 +280,6 @@ MobileConnection::GetCallForwardingOption(uint16_t aReason,
{
*aRequest = nullptr;
if (!CheckPermission("mobileconnection")) {
return NS_OK;
}
if (!mProvider) {
return NS_ERROR_FAILURE;
}
@ -391,10 +293,6 @@ MobileConnection::SetCallForwardingOption(nsIDOMMozMobileCFInfo* aCFInfo,
{
*aRequest = nullptr;
if (!CheckPermission("mobileconnection")) {
return NS_OK;
}
if (!mProvider) {
return NS_ERROR_FAILURE;
}
@ -407,10 +305,6 @@ MobileConnection::GetCallWaitingOption(nsIDOMDOMRequest** aRequest)
{
*aRequest = nullptr;
if (!CheckPermission("mobileconnection")) {
return NS_OK;
}
if (!mProvider) {
return NS_ERROR_FAILURE;
}
@ -424,10 +318,6 @@ MobileConnection::SetCallWaitingOption(bool aEnabled,
{
*aRequest = nullptr;
if (!CheckPermission("mobileconnection")) {
return NS_OK;
}
if (!mProvider) {
return NS_ERROR_FAILURE;
}
@ -440,41 +330,24 @@ MobileConnection::SetCallWaitingOption(bool aEnabled,
NS_IMETHODIMP
MobileConnection::NotifyVoiceChanged()
{
if (!CheckPermission("mobileconnection") ||
!CheckPermission("mobilenetwork")) {
return NS_OK;
}
return DispatchTrustedEvent(NS_LITERAL_STRING("voicechange"));
}
NS_IMETHODIMP
MobileConnection::NotifyDataChanged()
{
if (!CheckPermission("mobileconnection")) {
return NS_OK;
}
return DispatchTrustedEvent(NS_LITERAL_STRING("datachange"));
}
NS_IMETHODIMP
MobileConnection::NotifyCardStateChanged()
{
if (!CheckPermission("mobileconnection")) {
return NS_OK;
}
return DispatchTrustedEvent(NS_LITERAL_STRING("cardstatechange"));
}
NS_IMETHODIMP
MobileConnection::NotifyIccInfoChanged()
{
if (!CheckPermission("mobileconnection")) {
return NS_OK;
}
return DispatchTrustedEvent(NS_LITERAL_STRING("iccinfochange"));
}
@ -482,10 +355,6 @@ NS_IMETHODIMP
MobileConnection::NotifyUssdReceived(const nsAString& aMessage,
bool aSessionEnded)
{
if (!CheckPermission("mobileconnection")) {
return NS_OK;
}
nsCOMPtr<nsIDOMEvent> event;
NS_NewDOMUSSDReceivedEvent(getter_AddRefs(event), this, nullptr, nullptr);
@ -501,10 +370,6 @@ MobileConnection::NotifyUssdReceived(const nsAString& aMessage,
NS_IMETHODIMP
MobileConnection::NotifyDataError(const nsAString& aMessage)
{
if (!CheckPermission("mobileconnection")) {
return NS_OK;
}
nsCOMPtr<nsIDOMEvent> event;
NS_NewDOMDataErrorEvent(getter_AddRefs(event), this, nullptr, nullptr);
@ -520,10 +385,6 @@ NS_IMETHODIMP
MobileConnection::NotifyIccCardLockError(const nsAString& aLockType,
uint32_t aRetryCount)
{
if (!CheckPermission("mobileconnection")) {
return NS_OK;
}
nsCOMPtr<nsIDOMEvent> event;
NS_NewDOMICCCardLockErrorEvent(getter_AddRefs(event), this, nullptr, nullptr);
@ -544,10 +405,6 @@ MobileConnection::NotifyCFStateChange(bool aSuccess,
unsigned short aSeconds,
unsigned short aServiceClass)
{
if (!CheckPermission("mobileconnection")) {
return NS_OK;
}
nsCOMPtr<nsIDOMEvent> event;
NS_NewDOMCFStateChangeEvent(getter_AddRefs(event), this, nullptr, nullptr);

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

@ -51,9 +51,6 @@ private:
nsCOMPtr<nsIMobileConnectionProvider> mProvider;
nsRefPtr<Listener> mListener;
nsRefPtr<icc::IccManager> mIccManager;
nsWeakPtr mWindow;
bool CheckPermission(const char* type);
};
} // namespace network

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

@ -257,8 +257,7 @@ function RadioInterfaceLayer() {
};
try {
this.rilContext.voice.lastKnownMcc =
Services.prefs.getCharPref("ril.lastKnownMcc");
this.rilContext.voice.lastKnownMcc = Services.prefs.getCharPref("ril.lastKnownMcc");
} catch (e) {}
this.voicemailInfo = {
@ -1085,14 +1084,6 @@ RadioInterfaceLayer.prototype = {
}
}
// Update lastKnownNetwork
if (message.mcc && message.mnc) {
try {
Services.prefs.setCharPref("ril.lastKnownNetwork",
message.mcc + "-" + message.mnc);
} catch (e) {}
}
voice.network = message;
if (!message.batch) {
this._sendMobileConnectionMessage("RIL:VoiceInfoChanged", voice);
@ -1797,14 +1788,6 @@ RadioInterfaceLayer.prototype = {
// when the MCC or MNC codes have changed.
this._sendMobileConnectionMessage("RIL:IccInfoChanged", message);
// Update lastKnownHomeNetwork.
if (message.mcc && message.mnc) {
try {
Services.prefs.setCharPref("ril.lastKnownHomeNetwork",
message.mcc + "-" + message.mnc);
} catch (e) {}
}
// If spn becomes available, we should check roaming again.
let oldSpn = oldIccInfo ? oldIccInfo.spn : null;
if (!oldSpn && message.spn) {