Bug 1070083 - Part 2: Don't use AutoSafeJSContext because it is already deprecated. r=bholley

This commit is contained in:
Edgar Chen 2014-09-24 10:04:40 +08:00
Родитель 0eab9c585e
Коммит 7d498f73d2
3 изменённых файлов: 56 добавлений и 8 удалений

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

@ -117,7 +117,7 @@ MobileConnectionInfo::Update(nsIMobileConnectionInfo* aInfo)
CONVERT_STRING_TO_NULLABLE_ENUM(type, MobileConnectionType, mType);
// Update mSignalStrength
AutoSafeJSContext cx;
AutoJSContext cx;
JS::Rooted<JS::Value> signalStrength(cx, JSVAL_VOID);
aInfo->GetSignalStrength(&signalStrength);
if (signalStrength.isNumber()) {

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

@ -11,7 +11,7 @@
#include "mozilla/dom/MobileNetworkInfo.h"
#include "mozilla/dom/MozMobileConnectionBinding.h"
using mozilla::AutoSafeJSContext;
using mozilla::AutoJSContext;
using mozilla::dom::MobileNetworkInfo;
using mozilla::dom::MobileCellInfo;
using mozilla::dom::MobileConnectionInfo;
@ -261,7 +261,7 @@ struct ParamTraits<nsIMobileConnectionInfo*>
return;
}
AutoSafeJSContext cx;
AutoJSContext cx;
nsString pString;
bool pBool;
nsCOMPtr<nsIMobileNetworkInfo> pNetworkInfo;
@ -330,7 +330,7 @@ struct ParamTraits<nsIMobileConnectionInfo*>
return true;
}
AutoSafeJSContext cx;
AutoJSContext cx;
nsString state;
bool connected;
bool emergencyOnly;

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

@ -423,7 +423,19 @@ MobileConnectionRequestParent::DoRequest(const SetCallForwardingRequest& aReques
{
NS_ENSURE_TRUE(mMobileConnection, false);
AutoSafeJSContext cx;
// There are cases (bug 1070083) where this is called with no JS on the stack.
// And since mobileConnectionService might be JS-Implemented, so we just
// create it in the System-Principaled Junk Scope. We are going to get rid of
// the "jsval" used in MobileConnection's interface in bug 1047196, after that
// we don't need these things.
// Note that using xpc::PrivilegedJunkScope requires explicit case-by-case
// approval from the XPConnect module owner (bholley).
AutoJSAPI jsapi;
if (NS_WARN_IF(!jsapi.Init(xpc::PrivilegedJunkScope()))) {
return false;
}
JSContext* cx = jsapi.cx();
JS::Rooted<JS::Value> options(cx);
if (!ToJSValue(cx, aRequest.options(), &options)) {
JS_ClearPendingException(cx);
@ -446,7 +458,19 @@ MobileConnectionRequestParent::DoRequest(const SetCallBarringRequest& aRequest)
{
NS_ENSURE_TRUE(mMobileConnection, false);
AutoSafeJSContext cx;
// There are cases (bug 1070083) where this is called with no JS on the stack.
// And since mobileConnectionService might be JS-Implemented, so we just
// create it in the System-Principaled Junk Scope. We are going to get rid of
// the "jsval" used in MobileConnection's interface in bug 1047196, after that
// we don't need these things.
// Note that using xpc::PrivilegedJunkScope requires explicit case-by-case
// approval from the XPConnect module owner (bholley).
AutoJSAPI jsapi;
if (NS_WARN_IF(!jsapi.Init(xpc::PrivilegedJunkScope()))) {
return false;
}
JSContext* cx = jsapi.cx();
JS::Rooted<JS::Value> options(cx);
if (!ToJSValue(cx, aRequest.options(), &options)) {
JS_ClearPendingException(cx);
@ -461,7 +485,19 @@ MobileConnectionRequestParent::DoRequest(const GetCallBarringRequest& aRequest)
{
NS_ENSURE_TRUE(mMobileConnection, false);
AutoSafeJSContext cx;
// There are cases (bug 1070083) where this is called with no JS on the stack.
// And since mobileConnectionService might be JS-Implemented, so we just
// create it in the System-Principaled Junk Scope. We are going to get rid of
// the "jsval" used in MobileConnection's interface in bug 1047196, after that
// we don't need these things.
// Note that using xpc::PrivilegedJunkScope requires explicit case-by-case
// approval from the XPConnect module owner (bholley).
AutoJSAPI jsapi;
if (NS_WARN_IF(!jsapi.Init(xpc::PrivilegedJunkScope()))) {
return false;
}
JSContext* cx = jsapi.cx();
JS::Rooted<JS::Value> options(cx);
if (!ToJSValue(cx, aRequest.options(), &options)) {
JS_ClearPendingException(cx);
@ -476,7 +512,19 @@ MobileConnectionRequestParent::DoRequest(const ChangeCallBarringPasswordRequest&
{
NS_ENSURE_TRUE(mMobileConnection, false);
AutoSafeJSContext cx;
// There are cases (bug 1070083) where this is called with no JS on the stack.
// And since mobileConnectionService might be JS-Implemented, so we just
// create it in the System-Principaled Junk Scope. We are going to get rid of
// the "jsval" used in MobileConnection's interface in bug 1047196, after that
// we don't need these things.
// Note that using xpc::PrivilegedJunkScope requires explicit case-by-case
// approval from the XPConnect module owner (bholley).
AutoJSAPI jsapi;
if (NS_WARN_IF(!jsapi.Init(xpc::PrivilegedJunkScope()))) {
return false;
}
JSContext* cx = jsapi.cx();
JS::Rooted<JS::Value> options(cx);
if (!ToJSValue(cx, aRequest.options(), &options)) {
JS_ClearPendingException(cx);