Bug 1030002 - Part 1: Use webidl attribute, CheckPermissions, for checking mobileconnection/mobilenetwork permission. r=smaug,hsinyi
authorEdgar Chen <echen@mozilla.com>
Wed, 25 Jun 2014 15:42:06 +0800
changeset 192745 6a3b870e4341ecdc5803f9f9c3c041af1fe9e734
parent 192744 f96396f4f6997fa61bc322431441b73bf82947ac
child 192746 2c0347b195387506cfb74bf30253681b5bdc6d8c
push id7651
push usercbook@mozilla.com
push dateTue, 08 Jul 2014 13:28:32 +0000
treeherderfx-team@05cfda67b9db [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug, hsinyi
bugs1030002
milestone33.0a1
Bug 1030002 - Part 1: Use webidl attribute, CheckPermissions, for checking mobileconnection/mobilenetwork permission. r=smaug,hsinyi
dom/mobileconnection/src/MobileConnection.cpp
dom/webidl/MozMobileConnection.webidl
--- a/dom/mobileconnection/src/MobileConnection.cpp
+++ b/dom/mobileconnection/src/MobileConnection.cpp
@@ -174,110 +174,106 @@ MobileConnection::UpdateData()
 
 // WebIDL interface
 
 void
 MobileConnection::GetLastKnownNetwork(nsString& aRetVal) const
 {
   aRetVal.SetIsVoid(true);
 
-  if (!mProvider ||
-      (!CheckPermission("mobilenetwork") &&
-       !CheckPermission("mobileconnection"))) {
+  if (!mProvider) {
     return;
   }
 
   mProvider->GetLastKnownNetwork(mClientId, aRetVal);
 }
 
 void
 MobileConnection::GetLastKnownHomeNetwork(nsString& aRetVal) const
 {
   aRetVal.SetIsVoid(true);
 
-  if (!mProvider ||
-      (!CheckPermission("mobilenetwork") &&
-       !CheckPermission("mobileconnection"))) {
+  if (!mProvider) {
     return;
   }
 
   mProvider->GetLastKnownHomeNetwork(mClientId, aRetVal);
 }
 
 // All fields below require the "mobileconnection" permission.
 
 MobileConnectionInfo*
 MobileConnection::Voice() const
 {
-  if (!mProvider || !CheckPermission("mobileconnection")) {
+  if (!mProvider) {
     return nullptr;
   }
 
   return mVoice;
 }
 
 MobileConnectionInfo*
 MobileConnection::Data() const
 {
-  if (!mProvider || !CheckPermission("mobileconnection")) {
+  if (!mProvider) {
     return nullptr;
   }
 
   return mData;
 }
 
 void
 MobileConnection::GetIccId(nsString& aRetVal) const
 {
   aRetVal.SetIsVoid(true);
 
-  if (!mProvider || !CheckPermission("mobileconnection")) {
+  if (!mProvider) {
     return;
   }
 
   mProvider->GetIccId(mClientId, aRetVal);
 }
 
 Nullable<MobileNetworkSelectionMode>
 MobileConnection::GetNetworkSelectionMode() const
 {
   Nullable<MobileNetworkSelectionMode> retVal =
     Nullable<MobileNetworkSelectionMode>();
 
-  if (!mProvider || !CheckPermission("mobileconnection")) {
+  if (!mProvider) {
     return retVal;
   }
 
   nsAutoString mode;
   mProvider->GetNetworkSelectionMode(mClientId, mode);
   CONVERT_STRING_TO_NULLABLE_ENUM(mode, MobileNetworkSelectionMode, retVal);
 
   return retVal;
 }
 
 Nullable<MobileRadioState>
 MobileConnection::GetRadioState() const
 {
   Nullable<MobileRadioState> retVal = Nullable<MobileRadioState>();
 
-  if (!mProvider || !CheckPermission("mobileconnection")) {
+  if (!mProvider) {
     return retVal;
   }
 
   nsAutoString state;
   mProvider->GetRadioState(mClientId, state);
   CONVERT_STRING_TO_NULLABLE_ENUM(state, MobileRadioState, retVal);
 
   return retVal;
 }
 
 void
 MobileConnection::GetSupportedNetworkTypes(nsTArray<MobileNetworkType>& aTypes) const
 {
-  if (!mProvider || !CheckPermission("mobileconnection")) {
+  if (!mProvider) {
     return;
   }
 
   nsCOMPtr<nsIVariant> variant;
   mProvider->GetSupportedNetworkTypes(mClientId,
                                       getter_AddRefs(variant));
 
   uint16_t type;
@@ -305,20 +301,16 @@ MobileConnection::GetSupportedNetworkTyp
     }
   }
   NS_Free(data);
 }
 
 already_AddRefed<DOMRequest>
 MobileConnection::GetNetworks(ErrorResult& aRv)
 {
-  if (!CheckPermission("mobileconnection")) {
-    return nullptr;
-  }
-
   if (!mProvider) {
     aRv.Throw(NS_ERROR_FAILURE);
     return nullptr;
   }
 
   nsCOMPtr<nsIDOMDOMRequest> request;
   nsresult rv = mProvider->GetNetworks(mClientId, GetOwner(),
                                        getter_AddRefs(request));
@@ -328,20 +320,16 @@ MobileConnection::GetNetworks(ErrorResul
   }
 
   return request.forget().downcast<DOMRequest>();
 }
 
 already_AddRefed<DOMRequest>
 MobileConnection::SelectNetwork(MobileNetworkInfo& aNetwork, ErrorResult& aRv)
 {
-  if (!CheckPermission("mobileconnection")) {
-    return nullptr;
-  }
-
   if (!mProvider) {
     aRv.Throw(NS_ERROR_FAILURE);
     return nullptr;
   }
 
   nsCOMPtr<nsIDOMDOMRequest> request;
   nsresult rv = mProvider->SelectNetwork(mClientId, GetOwner(), &aNetwork,
                                          getter_AddRefs(request));
@@ -351,20 +339,16 @@ MobileConnection::SelectNetwork(MobileNe
   }
 
   return request.forget().downcast<DOMRequest>();
 }
 
 already_AddRefed<DOMRequest>
 MobileConnection::SelectNetworkAutomatically(ErrorResult& aRv)
 {
-  if (!CheckPermission("mobileconnection")) {
-    return nullptr;
-  }
-
   if (!mProvider) {
     aRv.Throw(NS_ERROR_FAILURE);
     return nullptr;
   }
 
   nsCOMPtr<nsIDOMDOMRequest> request;
   nsresult rv = mProvider->SelectNetworkAutomatically(mClientId, GetOwner(),
                                                       getter_AddRefs(request));
@@ -375,20 +359,16 @@ MobileConnection::SelectNetworkAutomatic
 
   return request.forget().downcast<DOMRequest>();
 }
 
 already_AddRefed<DOMRequest>
 MobileConnection::SetPreferredNetworkType(MobilePreferredNetworkType& aType,
                                           ErrorResult& aRv)
 {
-  if (!CheckPermission("mobileconnection")) {
-    return nullptr;
-  }
-
   if (!mProvider) {
     aRv.Throw(NS_ERROR_FAILURE);
     return nullptr;
   }
 
   nsAutoString type;
   CONVERT_ENUM_TO_STRING(MobilePreferredNetworkType, aType, type);
 
@@ -401,20 +381,16 @@ MobileConnection::SetPreferredNetworkTyp
   }
 
   return request.forget().downcast<DOMRequest>();
 }
 
 already_AddRefed<DOMRequest>
 MobileConnection::GetPreferredNetworkType(ErrorResult& aRv)
 {
-  if (!CheckPermission("mobileconnection")) {
-    return nullptr;
-  }
-
   if (!mProvider) {
     aRv.Throw(NS_ERROR_FAILURE);
     return nullptr;
   }
 
   nsCOMPtr<nsIDOMDOMRequest> request;
   nsresult rv = mProvider->GetPreferredNetworkType(mClientId, GetOwner(),
                                                    getter_AddRefs(request));
@@ -425,20 +401,16 @@ MobileConnection::GetPreferredNetworkTyp
 
   return request.forget().downcast<DOMRequest>();
 }
 
 already_AddRefed<DOMRequest>
 MobileConnection::SetRoamingPreference(MobileRoamingMode& aMode,
                                        ErrorResult& aRv)
 {
-  if (!CheckPermission("mobileconnection")) {
-    return nullptr;
-  }
-
   if (!mProvider) {
     aRv.Throw(NS_ERROR_FAILURE);
     return nullptr;
   }
 
   nsAutoString mode;
   CONVERT_ENUM_TO_STRING(MobileRoamingMode, aMode, mode);
 
@@ -451,20 +423,16 @@ MobileConnection::SetRoamingPreference(M
   }
 
   return request.forget().downcast<DOMRequest>();
 }
 
 already_AddRefed<DOMRequest>
 MobileConnection::GetRoamingPreference(ErrorResult& aRv)
 {
-  if (!CheckPermission("mobileconnection")) {
-    return nullptr;
-  }
-
   if (!mProvider) {
     aRv.Throw(NS_ERROR_FAILURE);
     return nullptr;
   }
 
   nsCOMPtr<nsIDOMDOMRequest> request;
   nsresult rv = mProvider->GetRoamingPreference(mClientId, GetOwner(),
                                                 getter_AddRefs(request));
@@ -473,20 +441,16 @@ MobileConnection::GetRoamingPreference(E
   }
 
   return request.forget().downcast<DOMRequest>();
 }
 
 already_AddRefed<DOMRequest>
 MobileConnection::SetVoicePrivacyMode(bool aEnabled, ErrorResult& aRv)
 {
-  if (!CheckPermission("mobileconnection")) {
-    return nullptr;
-  }
-
   if (!mProvider) {
     aRv.Throw(NS_ERROR_FAILURE);
     return nullptr;
   }
 
   nsCOMPtr<nsIDOMDOMRequest> request;
   nsresult rv = mProvider->SetVoicePrivacyMode(mClientId, GetOwner(), aEnabled,
                                                getter_AddRefs(request));
@@ -496,20 +460,16 @@ MobileConnection::SetVoicePrivacyMode(bo
   }
 
   return request.forget().downcast<DOMRequest>();
 }
 
 already_AddRefed<DOMRequest>
 MobileConnection::GetVoicePrivacyMode(ErrorResult& aRv)
 {
-  if (!CheckPermission("mobileconnection")) {
-    return nullptr;
-  }
-
   if (!mProvider) {
     aRv.Throw(NS_ERROR_FAILURE);
     return nullptr;
   }
 
   nsCOMPtr<nsIDOMDOMRequest> request;
   nsresult rv = mProvider->GetVoicePrivacyMode(mClientId, GetOwner(),
                                                getter_AddRefs(request));
@@ -519,20 +479,16 @@ MobileConnection::GetVoicePrivacyMode(Er
   }
 
   return request.forget().downcast<DOMRequest>();
 }
 
 already_AddRefed<DOMRequest>
 MobileConnection::SendMMI(const nsAString& aMMIString, ErrorResult& aRv)
 {
-  if (!CheckPermission("mobileconnection")) {
-    return nullptr;
-  }
-
   if (!mProvider) {
     aRv.Throw(NS_ERROR_FAILURE);
     return nullptr;
   }
 
   nsCOMPtr<nsIDOMDOMRequest> request;
   nsresult rv = mProvider->SendMMI(mClientId, GetOwner(), aMMIString,
                                    getter_AddRefs(request));
@@ -542,20 +498,16 @@ MobileConnection::SendMMI(const nsAStrin
   }
 
   return request.forget().downcast<DOMRequest>();
 }
 
 already_AddRefed<DOMRequest>
 MobileConnection::CancelMMI(ErrorResult& aRv)
 {
-  if (!CheckPermission("mobileconnection")) {
-    return nullptr;
-  }
-
   if (!mProvider) {
     aRv.Throw(NS_ERROR_FAILURE);
     return nullptr;
   }
 
   nsCOMPtr<nsIDOMDOMRequest> request;
   nsresult rv = mProvider->CancelMMI(mClientId, GetOwner(),
                                      getter_AddRefs(request));
@@ -565,20 +517,16 @@ MobileConnection::CancelMMI(ErrorResult&
   }
 
   return request.forget().downcast<DOMRequest>();
 }
 
 already_AddRefed<DOMRequest>
 MobileConnection::GetCallForwardingOption(uint16_t aReason, ErrorResult& aRv)
 {
-  if (!CheckPermission("mobileconnection")) {
-    return nullptr;
-  }
-
   if (!mProvider) {
     aRv.Throw(NS_ERROR_FAILURE);
     return nullptr;
   }
 
   nsCOMPtr<nsIDOMDOMRequest> request;
   nsresult rv = mProvider->GetCallForwarding(mClientId, GetOwner(), aReason,
                                              getter_AddRefs(request));
@@ -589,20 +537,16 @@ MobileConnection::GetCallForwardingOptio
 
   return request.forget().downcast<DOMRequest>();
 }
 
 already_AddRefed<DOMRequest>
 MobileConnection::SetCallForwardingOption(const MozCallForwardingOptions& aOptions,
                                           ErrorResult& aRv)
 {
-  if (!CheckPermission("mobileconnection")) {
-    return nullptr;
-  }
-
   if (!mProvider) {
     aRv.Throw(NS_ERROR_FAILURE);
     return nullptr;
   }
 
   AutoJSAPI jsapi;
   if (!NS_WARN_IF(jsapi.Init(GetOwner()))) {
     aRv.Throw(NS_ERROR_FAILURE);
@@ -626,20 +570,16 @@ MobileConnection::SetCallForwardingOptio
 
   return request.forget().downcast<DOMRequest>();
 }
 
 already_AddRefed<DOMRequest>
 MobileConnection::GetCallBarringOption(const MozCallBarringOptions& aOptions,
                                        ErrorResult& aRv)
 {
-  if (!CheckPermission("mobileconnection")) {
-    return nullptr;
-  }
-
   if (!mProvider) {
     aRv.Throw(NS_ERROR_FAILURE);
     return nullptr;
   }
 
   AutoJSAPI jsapi;
   if (!NS_WARN_IF(jsapi.Init(GetOwner()))) {
     aRv.Throw(NS_ERROR_FAILURE);
@@ -663,20 +603,16 @@ MobileConnection::GetCallBarringOption(c
 
   return request.forget().downcast<DOMRequest>();
 }
 
 already_AddRefed<DOMRequest>
 MobileConnection::SetCallBarringOption(const MozCallBarringOptions& aOptions,
                                        ErrorResult& aRv)
 {
-  if (!CheckPermission("mobileconnection")) {
-    return nullptr;
-  }
-
   if (!mProvider) {
     aRv.Throw(NS_ERROR_FAILURE);
     return nullptr;
   }
 
   AutoJSAPI jsapi;
   if (!NS_WARN_IF(jsapi.Init(GetOwner()))) {
     aRv.Throw(NS_ERROR_FAILURE);
@@ -700,20 +636,16 @@ MobileConnection::SetCallBarringOption(c
 
   return request.forget().downcast<DOMRequest>();
 }
 
 already_AddRefed<DOMRequest>
 MobileConnection::ChangeCallBarringPassword(const MozCallBarringOptions& aOptions,
                                             ErrorResult& aRv)
 {
-  if (!CheckPermission("mobileconnection")) {
-    return nullptr;
-  }
-
   if (!mProvider) {
     aRv.Throw(NS_ERROR_FAILURE);
     return nullptr;
   }
 
   AutoJSAPI jsapi;
   if (!NS_WARN_IF(jsapi.Init(GetOwner()))) {
     aRv.Throw(NS_ERROR_FAILURE);
@@ -738,20 +670,16 @@ MobileConnection::ChangeCallBarringPassw
   }
 
   return request.forget().downcast<DOMRequest>();
 }
 
 already_AddRefed<DOMRequest>
 MobileConnection::GetCallWaitingOption(ErrorResult& aRv)
 {
-  if (!CheckPermission("mobileconnection")) {
-    return nullptr;
-  }
-
   if (!mProvider) {
     aRv.Throw(NS_ERROR_FAILURE);
     return nullptr;
   }
 
   nsCOMPtr<nsIDOMDOMRequest> request;
   nsresult rv = mProvider->GetCallWaiting(mClientId, GetOwner(),
                                           getter_AddRefs(request));
@@ -761,20 +689,16 @@ MobileConnection::GetCallWaitingOption(E
   }
 
   return request.forget().downcast<DOMRequest>();
 }
 
 already_AddRefed<DOMRequest>
 MobileConnection::SetCallWaitingOption(bool aEnabled, ErrorResult& aRv)
 {
-  if (!CheckPermission("mobileconnection")) {
-    return nullptr;
-  }
-
   if (!mProvider) {
     aRv.Throw(NS_ERROR_FAILURE);
     return nullptr;
   }
 
   nsCOMPtr<nsIDOMDOMRequest> request;
   nsresult rv = mProvider->SetCallWaiting(mClientId, GetOwner(), aEnabled,
                                           getter_AddRefs(request));
@@ -784,20 +708,16 @@ MobileConnection::SetCallWaitingOption(b
   }
 
   return request.forget().downcast<DOMRequest>();
 }
 
 already_AddRefed<DOMRequest>
 MobileConnection::GetCallingLineIdRestriction(ErrorResult& aRv)
 {
-  if (!CheckPermission("mobileconnection")) {
-    return nullptr;
-  }
-
   if (!mProvider) {
     aRv.Throw(NS_ERROR_FAILURE);
     return nullptr;
   }
 
   nsCOMPtr<nsIDOMDOMRequest> request;
   nsresult rv = mProvider->GetCallingLineIdRestriction(mClientId, GetOwner(),
                                                        getter_AddRefs(request));
@@ -808,20 +728,16 @@ MobileConnection::GetCallingLineIdRestri
 
   return request.forget().downcast<DOMRequest>();
 }
 
 already_AddRefed<DOMRequest>
 MobileConnection::SetCallingLineIdRestriction(uint16_t aMode,
                                               ErrorResult& aRv)
 {
-  if (!CheckPermission("mobileconnection")) {
-    return nullptr;
-  }
-
   if (!mProvider) {
     aRv.Throw(NS_ERROR_FAILURE);
     return nullptr;
   }
 
   nsCOMPtr<nsIDOMDOMRequest> request;
   nsresult rv = mProvider->SetCallingLineIdRestriction(mClientId,
                                                        GetOwner(),
@@ -833,20 +749,16 @@ MobileConnection::SetCallingLineIdRestri
   }
 
   return request.forget().downcast<DOMRequest>();
 }
 
 already_AddRefed<DOMRequest>
 MobileConnection::ExitEmergencyCbMode(ErrorResult& aRv)
 {
-  if (!CheckPermission("mobileconnection")) {
-    return nullptr;
-  }
-
   if (!mProvider) {
     aRv.Throw(NS_ERROR_FAILURE);
     return nullptr;
   }
 
   nsCOMPtr<nsIDOMDOMRequest> request;
   nsresult rv = mProvider->ExitEmergencyCbMode(mClientId, GetOwner(),
                                                getter_AddRefs(request));
@@ -856,20 +768,16 @@ MobileConnection::ExitEmergencyCbMode(Er
   }
 
   return request.forget().downcast<DOMRequest>();
 }
 
 already_AddRefed<DOMRequest>
 MobileConnection::SetRadioEnabled(bool aEnabled, ErrorResult& aRv)
 {
-  if (!CheckPermission("mobileconnection")) {
-    return nullptr;
-  }
-
   if (!mProvider) {
     aRv.Throw(NS_ERROR_FAILURE);
     return nullptr;
   }
 
   nsCOMPtr<nsIDOMDOMRequest> request;
   nsresult rv = mProvider->SetRadioEnabled(mClientId, GetOwner(), aEnabled,
                                            getter_AddRefs(request));
--- a/dom/webidl/MozMobileConnection.webidl
+++ b/dom/webidl/MozMobileConnection.webidl
@@ -65,97 +65,104 @@ interface MozMobileConnection : EventTar
   const long CLIR_DEFAULT     = 0;
   const long CLIR_INVOCATION  = 1;
   const long CLIR_SUPPRESSION = 2;
 
   /**
    * These two fields can be accessed by privileged applications with the
    * 'mobilenetwork' permission.
    */
+  [CheckPermissions="mobilenetwork"]
   readonly attribute DOMString lastKnownNetwork;
+  [CheckPermissions="mobilenetwork"]
   readonly attribute DOMString lastKnownHomeNetwork;
 
   /**
    * Information about the voice connection.
    */
+  [CheckPermissions="mobileconnection"]
   readonly attribute MozMobileConnectionInfo voice;
 
   /**
    * Information about the data connection.
    */
+  [CheckPermissions="mobileconnection"]
   readonly attribute MozMobileConnectionInfo data;
 
   /**
    * Integrated Circuit Card Identifier of the SIM this mobile connection
    * corresponds to.
    */
+  [CheckPermissions="mobileconnection"]
   readonly attribute DOMString? iccId;
 
   /**
    * The selection mode of the voice and data networks.
    */
+  [CheckPermissions="mobileconnection"]
   readonly attribute MobileNetworkSelectionMode? networkSelectionMode;
 
   /**
    * The current radio state.
    */
+  [CheckPermissions="mobileconnection"]
   readonly attribute MobileRadioState? radioState;
 
   /**
    * Array of network types that are supported by this radio.
    */
-  [Cached, Pure]
+  [Cached, Pure, CheckPermissions="mobileconnection"]
   readonly attribute sequence<MobileNetworkType> supportedNetworkTypes;
 
   /**
    * Search for available networks.
    *
    * @return a DOMRequest.
    *
    * If successful, the request's onsuccess will be called. And the request's
    * result will be an array of MozMobileNetworkInfo.
    *
    * Otherwise, the request's onerror will be called, and the request's error
    * will be either 'RadioNotAvailable', 'RequestNotSupported', or
    * 'GenericFailure'.
    */
-  [Throws]
+  [Throws, CheckPermissions="mobileconnection"]
   DOMRequest getNetworks();
 
   /**
    * Manually selects the passed in network, overriding the radio's current
    * selection.
    *
    * @return a DOMRequest.
    *
    * If successful, the request's onsuccess will be called.
    * Note: If the network was actually changed by this request,
    * the 'voicechange' and 'datachange' events will also be fired.
    *
    * Otherwise, the request's onerror will be called, and the request's error
    * will be either 'RadioNotAvailable', 'RequestNotSupported',
    * 'IllegalSIMorME', or 'GenericFailure'.
    */
-  [Throws]
+  [Throws, CheckPermissions="mobileconnection"]
   DOMRequest selectNetwork(MozMobileNetworkInfo network);
 
   /**
    * Tell the radio to automatically select a network.
    *
    * @return a DOMRequest.
    *
    * If successful, the request's onsuccess will be called.
    * Note: If the network was actually changed by this request, the
    * 'voicechange' and 'datachange' events will also be fired.
    *
    * Otherwise, the request's onerror will be called, and the request's error
    * will be either 'RadioNotAvailable', 'RequestNotSupported',
    * 'IllegalSIMorME', or 'GenericFailure'.
    */
-  [Throws]
+  [Throws, CheckPermissions="mobileconnection"]
   DOMRequest selectNetworkAutomatically();
 
   /**
    * Set preferred network type.
    *
    * @param type
    *        PreferredNetworkType indicates the desired preferred network type.
    *
@@ -163,17 +170,17 @@ interface MozMobileConnection : EventTar
    *
    * If successful, the request's onsuccess will be called.
    *
    * Otherwise, the request's onerror will be called, and the request's error
    * will be either 'RadioNotAvailable', 'RequestNotSupported',
    * 'InvalidParameter', 'ModeNotSupported', 'IllegalSIMorME', or
    * 'GenericFailure'.
    */
-  [Throws]
+  [Throws, CheckPermissions="mobileconnection"]
   DOMRequest setPreferredNetworkType(MobilePreferredNetworkType type);
 
   /**
    * Query current preferred network type.
    *
    * @return a DOMRequest.
    *
    * If successful, the request's onsuccess will be called. And the request's
@@ -181,50 +188,50 @@ interface MozMobileConnection : EventTar
    * The value will be either 'wcdma/gsm', 'gsm', 'wcdma', 'wcdma/gsm-auto',
    * 'cdma/evdo', 'cdma', 'evdo', 'wcdma/gsm/cdma/evdo', 'lte/cdma/evdo',
    * 'lte/wcdma/gsm', 'lte/wcdma/gsm/cdma/evdo' or 'lte'.
    *
    * Otherwise, the request's onerror will be called, and the request's error
    * will be either 'RadioNotAvailable', 'RequestNotSupported',
    * 'IllegalSIMorME', or 'GenericFailure'.
    */
-  [Throws]
+  [Throws, CheckPermissions="mobileconnection"]
   DOMRequest getPreferredNetworkType();
 
   /**
    * Set roaming preference.
    *
    * @param mode
    *        RoamingPreferenceMode indicates the desired roaming preference.
    *
    * @return a DOMRequest.
    *
    * If successful, the request's onsuccess will be called.
    *
    * Otherwise, the request's onerror will be called, and the request's error
    * will be either 'RadioNotAvailable', 'RequestNotSupported',
    * 'InvalidParameter', 'IllegalSIMorME', or 'GenericFailure'.
    */
-  [Throws]
+  [Throws, CheckPermissions="mobileconnection"]
   DOMRequest setRoamingPreference(MobileRoamingMode mode);
 
   /**
    * Query current roaming preference.
    *
    * @return a DOMRequest.
    *
    * If successful, the request's onsuccess will be called. And the request's
    * result will be a string indicating the current roaming preference.
    * The value will be either 'home', 'affiliated', or 'any'.
    *
    * Otherwise, the request's onerror will be called, and the request's error
    * will be either 'RadioNotAvailable', 'RequestNotSupported',
    * 'IllegalSIMorME', or 'GenericFailure'.
    */
-  [Throws]
+  [Throws, CheckPermissions="mobileconnection"]
   DOMRequest getRoamingPreference();
 
   /**
    * Set voice privacy preference.
    *
    * @param enabled
    *        Boolean indicates the preferred voice privacy mode used in voice
    *        scrambling in CDMA networks. 'True' means the enhanced voice security
@@ -233,32 +240,32 @@ interface MozMobileConnection : EventTar
    * @return a DOMRequest.
    *
    * If successful, the request's onsuccess will be called.
    *
    * Otherwise, the request's onerror will be called, and the request's error
    * will be either 'RadioNotAvailable', 'RequestNotSupported',
    * 'InvalidParameter', 'IllegalSIMorME', or 'GenericFailure'.
    */
-  [Throws]
+  [Throws, CheckPermissions="mobileconnection"]
   DOMRequest setVoicePrivacyMode(boolean enabled);
 
   /**
    * Query current voice privacy mode.
    *
    * @return a DOMRequest.
    *
    * If successful, the request's onsuccess will be called. And the request's
    * result will be a boolean indicating the current voice privacy mode.
    *
    * Otherwise, the request's onerror will be called, and the request's error
    * will be either 'RadioNotAvailable', 'RequestNotSupported',
    * 'IllegalSIMorME', or 'GenericFailure'.
    */
-  [Throws]
+  [Throws, CheckPermissions="mobileconnection"]
   DOMRequest getVoicePrivacyMode();
 
   /**
    * Send a MMI message.
    *
    * @param mmi
    *        DOMString containing an MMI string that can be associated to a
    *        USSD request or other RIL functionality.
@@ -275,33 +282,33 @@ interface MozMobileConnection : EventTar
    *
    * Note: In case that the MMI code requires sending an USSD request, the
    * DOMrequest 'success' event means that the RIL has successfully processed
    * and sent the USSD request to the network. The network reply will be
    * reported via 'onussdreceived' event. If the MMI code is not associated to
    * a USSD but to other RIL request its result, if one is needed, will be
    * notified via the returned DOMRequest 'success' or 'error' event.
    */
-  [Throws]
+  [Throws, CheckPermissions="mobileconnection"]
   DOMRequest sendMMI(DOMString mmi);
 
   /**
    * Cancel the current MMI request if one exists.
    *
    * @return a DOMRequest.
    *
    * If successful, the request's onsuccess will be called. And the request's
    * result will be an object containing information about the operation.
    * @see MozMMIResult for the detail of result.
    *
    * Otherwise, the request's onerror will be called, and the request's error
    * will be a DOMMMIError.
    * @see DOMMMIError for the detail of error.
    */
-  [Throws]
+  [Throws, CheckPermissions="mobileconnection"]
   DOMRequest cancelMMI();
 
   /**
    * Configures call forward options.
    *
    * @param options
    *        An object containing the call forward rule to set.
    * @see MozCallForwardingOptions for the detail of options.
@@ -309,17 +316,17 @@ interface MozMobileConnection : EventTar
    * @return a DOMRequest
    *
    * If successful, the request's onsuccess will be called.
    *
    * Otherwise, the request's onerror will be called, and the request's error
    * will be either 'RadioNotAvailable', 'RequestNotSupported',
    * 'InvalidParameter', 'IllegalSIMorME', or 'GenericFailure'.
    */
-  [Throws]
+  [Throws, CheckPermissions="mobileconnection"]
   DOMRequest setCallForwardingOption(optional MozCallForwardingOptions options);
 
   /**
    * Queries current call forward options.
    *
    * @param reason
    *        Indicates the reason the call is being forwarded. It shall be one of
    *        the MozMobileConnection.CALL_FORWARD_REASON_* values.
@@ -329,17 +336,17 @@ interface MozMobileConnection : EventTar
    * If successful, the request's onsuccess will be called. And the request's
    * result will be an array of MozCallForwardingOptions.
    * @see MozCallForwardingOptions for the detail of result.
    *
    * Otherwise, the request's onerror will be called, and the request's error
    * will be either 'RadioNotAvailable', 'RequestNotSupported',
    * 'InvalidParameter', 'IllegalSIMorME', or 'GenericFailure'.
    */
-  [Throws]
+  [Throws, CheckPermissions="mobileconnection"]
   DOMRequest getCallForwardingOption(unsigned short reason);
 
   /**
    * Configures call barring options.
    *
    * @param options
    *        An object containing the call barring rule to set.
    * @see MozCallBarringOptions for the detail of options.
@@ -347,17 +354,17 @@ interface MozMobileConnection : EventTar
    * @return a DOMRequest
    *
    * If successful, the request's onsuccess will be called.
    *
    * Otherwise, the request's onerror will be called, and the request's error
    * will be either 'RadioNotAvailable', 'RequestNotSupported',
    * 'InvalidParameter', 'IllegalSIMorME', or 'GenericFailure'.
    */
-  [Throws]
+  [Throws, CheckPermissions="mobileconnection"]
   DOMRequest setCallBarringOption(optional MozCallBarringOptions options);
 
   /**
    * Queries current call barring status.
    *
    * @param options
    *        An object containing the call barring rule to query. No need to
    *        specify 'enabled' property.
@@ -369,17 +376,17 @@ interface MozMobileConnection : EventTar
    * result will be an object of MozCallBarringOptions with correct 'enabled'
    * property indicating the status of this rule.
    * @see MozCallBarringOptions for the detail of result.
    *
    * Otherwise, the request's onerror will be called, and the request's error
    * will be either 'RadioNotAvailable', 'RequestNotSupported',
    * 'InvalidParameter', 'IllegalSIMorME', or 'GenericFailure'.
    */
-  [Throws]
+  [Throws, CheckPermissions="mobileconnection"]
   DOMRequest getCallBarringOption(optional MozCallBarringOptions options);
 
   /**
    * Change call barring facility password.
    *
    * @param options
    *        An object containing information about pin and newPin, and,
    *        this object must have both "pin" and "newPin" attributes
@@ -394,49 +401,49 @@ interface MozMobileConnection : EventTar
    * @return a DOMRequest.
    *
    * If successful, the request's onsuccess will be called.
    *
    * Otherwise, the request's onerror will be called, and the request's error
    * will be either 'RadioNotAvailable', 'RequestNotSupported',
    * 'InvalidParameter', 'IllegalSIMorME', or 'GenericFailure'.
    */
-  [Throws]
+  [Throws, CheckPermissions="mobileconnection"]
   DOMRequest changeCallBarringPassword(optional MozCallBarringOptions options);
 
   /**
    * Configures call waiting options.
    *
    * @param enabled
    *        Boolean indicates the desired call waiting status.
    *
    * @return a DOMRequest.
    *
    * If successful, the request's onsuccess will be called.
    *
    * Otherwise, the request's onerror will be called, and the request's error
    * will be either 'RadioNotAvailable', 'RequestNotSupported',
    * 'IllegalSIMorME', or 'GenericFailure'.
    */
-  [Throws]
+  [Throws, CheckPermissions="mobileconnection"]
   DOMRequest setCallWaitingOption(boolean enabled);
 
   /**
    * Queries current call waiting options.
    *
    * @return a DOMRequest
    *
    * If successful, the request's onsuccess will be called. And the request's
    * result will be a boolean indicating the call waiting status.
    *
    * Otherwise, the request's onerror will be called, and the request's error
    * will be either 'RadioNotAvailable', 'RequestNotSupported',
    * 'IllegalSIMorME', or 'GenericFailure'.
    */
-  [Throws]
+  [Throws, CheckPermissions="mobileconnection"]
   DOMRequest getCallWaitingOption();
 
   /**
    * Enables or disables the presentation of the calling line identity (CLI) to
    * the called party when originating a call.
    *
    * @param mode
    *        It shall be one of the MozMobileConnection.CLIR_* values.
@@ -444,47 +451,47 @@ interface MozMobileConnection : EventTar
    * @return a DOMRequest
    *
    * If successful, the request's onsuccess will be called.
    *
    * Otherwise, the request's onerror will be called, and the request's error
    * will be either 'RadioNotAvailable', 'RequestNotSupported',
    * 'InvalidParameter', 'IllegalSIMorME', or 'GenericFailure'.
    */
-  [Throws]
+  [Throws, CheckPermissions="mobileconnection"]
   DOMRequest setCallingLineIdRestriction(unsigned short mode);
 
   /**
    * Queries current CLIR status.
    *
    * @return a DOMRequest
    *
    * If successful, the request's onsuccess will be called. And the request's
    * result will be an object containing containing CLIR 'n' and 'm' parameter.
    * @see MozClirStatus for the detail of result.
    *
    * Otherwise, the request's onerror will be called, and the request's error
    * will be either 'RadioNotAvailable', 'RequestNotSupported',
    * 'IllegalSIMorME', or 'GenericFailure'.
    */
-  [Throws]
+  [Throws, CheckPermissions="mobileconnection"]
   DOMRequest getCallingLineIdRestriction();
 
   /**
    * Exit emergency callback mode.
    *
    * @return a DOMRequest
    *
    * If successful, the request's onsuccess will be called.
    *
    * Otherwise, the request's onerror will be called, and the request's error
    * will be either 'RadioNotAvailable', 'RequestNotSupported',
    * 'IllegalSIMorME', or 'GenericFailure'.
    */
-  [Throws]
+  [Throws, CheckPermissions="mobileconnection"]
   DOMRequest exitEmergencyCbMode();
 
   /**
    * Set radio enabled/disabled.
    *
    * @param enabled
    *        True to enable the radio.
    *
@@ -495,17 +502,17 @@ interface MozMobileConnection : EventTar
    * Otherwise, the request's onerror will be called, and the request's error
    * will be either 'InvalidStateError', 'RadioNotAvailable',
    * 'IllegalSIMorME', or 'GenericFailure'.
    *
    * Note: Request is not available when radioState is null, 'enabling', or
    * 'disabling'. Calling the function in above conditions will receive
    * 'InvalidStateError' error.
    */
-  [Throws]
+  [Throws, CheckPermissions="mobileconnection"]
   DOMRequest setRadioEnabled(boolean enabled);
 
   /**
    * The 'voicechange' event is notified whenever the voice connection object
    * changes.
    */
   attribute EventHandler onvoicechange;