Bug 925916 - Handlify a few things in bluetooth, r=smaug

This commit is contained in:
Steve Fink 2013-10-16 10:44:50 -07:00
parent c1f29cf1a0
commit fca158bdf5
5 changed files with 18 additions and 16 deletions

View File

@ -67,9 +67,9 @@ public:
MOZ_ASSERT(aReq && aAdapterPtr);
}
virtual bool ParseSuccessfulReply(JS::Value* aValue)
virtual bool ParseSuccessfulReply(JS::MutableHandle<JS::Value> aValue)
{
*aValue = JSVAL_VOID;
aValue.setUndefined();
const BluetoothValue& v = mReply->get_BluetoothReplySuccess().value();
if (v.type() != BluetoothValue::TArrayOfBluetoothNamedValue) {
@ -113,7 +113,7 @@ public:
return false;
}
aValue->setObject(*JsDevices);
aValue.setObject(*JsDevices);
return true;
}
@ -136,9 +136,9 @@ public:
MOZ_ASSERT(aReq);
}
virtual bool ParseSuccessfulReply(JS::Value* aValue)
virtual bool ParseSuccessfulReply(JS::MutableHandle<JS::Value> aValue)
{
*aValue = JSVAL_VOID;
aValue.setUndefined();
const BluetoothValue& v = mReply->get_BluetoothReplySuccess().value();
if (v.type() != BluetoothValue::Tbool) {
@ -147,7 +147,7 @@ public:
return false;
}
aValue->setBoolean(v.get_bool());
aValue.setBoolean(v.get_bool());
return true;
}

View File

@ -42,9 +42,9 @@ public:
}
bool
ParseSuccessfulReply(JS::Value* aValue)
ParseSuccessfulReply(JS::MutableHandle<JS::Value> aValue)
{
*aValue = JSVAL_VOID;
aValue.setUndefined();
const BluetoothValue& v = mReply->get_BluetoothReplySuccess().value();
if (v.type() != BluetoothValue::TArrayOfBluetoothNamedValue) {

View File

@ -32,7 +32,7 @@ BluetoothReplyRunnable::~BluetoothReplyRunnable()
{}
nsresult
BluetoothReplyRunnable::FireReply(const JS::Value& aVal)
BluetoothReplyRunnable::FireReply(JS::Handle<JS::Value> aVal)
{
nsCOMPtr<nsIDOMRequestService> rs =
do_GetService(DOMREQUEST_SERVICE_CONTRACTID);
@ -62,10 +62,12 @@ BluetoothReplyRunnable::Run()
nsresult rv;
AutoSafeJSContext cx;
JS::Rooted<JS::Value> v(cx, JSVAL_VOID);
if (mReply->type() != BluetoothReply::TBluetoothReplySuccess) {
rv = FireReply(JSVAL_VOID);
rv = FireReply(v);
} else {
JS::Value v;
if (!ParseSuccessfulReply(&v)) {
rv = FireErrorString();
} else {

View File

@ -37,7 +37,7 @@ public:
protected:
virtual ~BluetoothReplyRunnable();
virtual bool ParseSuccessfulReply(JS::Value* aValue) = 0;
virtual bool ParseSuccessfulReply(JS::MutableHandle<JS::Value> aValue) = 0;
// This is an autoptr so we don't have to bring the ipdl include into the
// header. We assume we'll only be running this once and it should die on
@ -45,7 +45,7 @@ protected:
nsAutoPtr<BluetoothReply> mReply;
private:
nsresult FireReply(const JS::Value& aVal);
nsresult FireReply(JS::Handle<JS::Value> aVal);
nsresult FireErrorString();
nsCOMPtr<nsIDOMDOMRequest> mDOMRequest;
@ -59,9 +59,9 @@ public:
~BluetoothVoidReplyRunnable();
protected:
virtual bool ParseSuccessfulReply(JS::Value* aValue) MOZ_OVERRIDE
virtual bool ParseSuccessfulReply(JS::MutableHandle<JS::Value> aValue) MOZ_OVERRIDE
{
*aValue = JSVAL_VOID;
aValue.setUndefined();
return true;
}
};

View File

@ -65,7 +65,7 @@ public:
}
virtual bool
ParseSuccessfulReply(JS::Value* aValue) MOZ_OVERRIDE
ParseSuccessfulReply(JS::MutableHandle<JS::Value> aValue) MOZ_OVERRIDE
{
MOZ_CRASH("This should never be called!");
}