Bug 842186 - Replace use of jsval with JS::Value in h and cpp files in the dom/network/ dom/camera/ and dom/devicestorage/ directories. r=jwalden

--HG--
extra : rebase_source : f765875c5597feb55c9eda3d8a3224fc22ad02fb
This commit is contained in:
Jose Cortes 2013-04-02 16:17:52 -07:00
Родитель 0281a0b5d4
Коммит 55924de20e
10 изменённых файлов: 44 добавлений и 34 удалений

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

@ -35,7 +35,7 @@ RecorderVideoProfile::GetJsObject(JSContext* aCx, JSObject** aObject)
NS_ENSURE_TRUE(codec, NS_ERROR_FAILURE);
JSString* s = JS_NewStringCopyZ(aCx, codec);
jsval v = STRING_TO_JSVAL(s);
JS::Value v = STRING_TO_JSVAL(s);
if (!JS_SetProperty(aCx, o, "codec", &v)) {
return NS_ERROR_FAILURE;
}
@ -96,7 +96,7 @@ RecorderAudioProfile::GetJsObject(JSContext* aCx, JSObject** aObject)
NS_ENSURE_TRUE(codec, NS_ERROR_FAILURE);
JSString* s = JS_NewStringCopyZ(aCx, codec);
jsval v = STRING_TO_JSVAL(s);
JS::Value v = STRING_TO_JSVAL(s);
if (!JS_SetProperty(aCx, o, "codec", &v)) {
return NS_ERROR_FAILURE;
}
@ -183,7 +183,7 @@ RecorderProfileManager::GetJsObject(JSContext* aCx, JSObject** aObject) const
JSObject* p;
nsresult rv = profile->GetJsObject(aCx, &p);
NS_ENSURE_SUCCESS(rv, rv);
jsval v = OBJECT_TO_JSVAL(p);
JS::Value v = OBJECT_TO_JSVAL(p);
if (!JS_SetProperty(aCx, o, profileName, &v)) {
return NS_ERROR_FAILURE;

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

@ -179,7 +179,7 @@ public:
}
JSString* s = JS_NewStringCopyZ(aCx, format);
jsval v = STRING_TO_JSVAL(s);
JS::Value v = STRING_TO_JSVAL(s);
if (!JS_SetProperty(aCx, o, "format", &v)) {
return NS_ERROR_FAILURE;
}

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

@ -43,7 +43,7 @@ ParseZoomRatioItemAndAdd(JSContext* aCx, JSObject* aArray, uint32_t aIndex, cons
d /= 100;
#endif
jsval v = JS_NumberValue(d);
JS::Value v = JS_NumberValue(d);
if (!JS_SetElement(aCx, aArray, aIndex, &v)) {
return NS_ERROR_FAILURE;
@ -66,7 +66,7 @@ ParseStringItemAndAdd(JSContext* aCx, JSObject* aArray, uint32_t aIndex, const c
return NS_ERROR_OUT_OF_MEMORY;
}
jsval v = STRING_TO_JSVAL(s);
JS::Value v = STRING_TO_JSVAL(s);
if (!JS_SetElement(aCx, aArray, aIndex, &v)) {
return NS_ERROR_FAILURE;
}
@ -84,8 +84,8 @@ ParseDimensionItemAndAdd(JSContext* aCx, JSObject* aArray, uint32_t aIndex, cons
aEnd = nullptr;
}
jsval w = INT_TO_JSVAL(strtol(aStart, &x, 10));
jsval h = INT_TO_JSVAL(strtol(x + 1, aEnd, 10));
JS::Value w = INT_TO_JSVAL(strtol(aStart, &x, 10));
JS::Value h = INT_TO_JSVAL(strtol(x + 1, aEnd, 10));
JSObject* o = JS_NewObject(aCx, nullptr, nullptr, nullptr);
if (!o) {
@ -99,7 +99,7 @@ ParseDimensionItemAndAdd(JSContext* aCx, JSObject* aArray, uint32_t aIndex, cons
return NS_ERROR_FAILURE;
}
jsval v = OBJECT_TO_JSVAL(o);
JS::Value v = OBJECT_TO_JSVAL(o);
if (!JS_SetElement(aCx, aArray, aIndex, &v)) {
return NS_ERROR_FAILURE;
}
@ -364,7 +364,7 @@ DOMCameraCapabilities::GetVideoSizes(JSContext* cx, JS::Value* aVideoSizes)
for (uint32_t i = 0; i < sizes.Length(); ++i) {
JSObject* o = JS_NewObject(cx, nullptr, nullptr, nullptr);
jsval v = INT_TO_JSVAL(sizes[i].width);
JS::Value v = INT_TO_JSVAL(sizes[i].width);
if (!JS_SetProperty(cx, o, "width", &v)) {
return NS_ERROR_FAILURE;
}

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

@ -50,7 +50,7 @@ nsDOMCameraManager::GetListOfCameras(JSContext* cx, JS::Value* _retval)
}
JSString* v;
jsval jv;
JS::Value jv;
switch (info.facing) {
case CAMERA_FACING_BACK:

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

@ -51,7 +51,7 @@ DeviceStorageRequestChild::Recv__delete__(const DeviceStorageResponseValue& aVal
case DeviceStorageResponseValue::TSuccessResponse:
{
jsval result = StringToJsval(mRequest->GetOwner(), mFile->mPath);
JS::Value result = StringToJsval(mRequest->GetOwner(), mFile->mPath);
mRequest->FireSuccess(result);
break;
}
@ -63,7 +63,8 @@ DeviceStorageRequestChild::Recv__delete__(const DeviceStorageResponseValue& aVal
nsCOMPtr<nsIDOMBlob> blob = actor->GetBlob();
nsCOMPtr<nsIDOMFile> file = do_QueryInterface(blob);
jsval result = InterfaceToJsval(mRequest->GetOwner(), file, &NS_GET_IID(nsIDOMFile));
JS::Value result = InterfaceToJsval(mRequest->GetOwner(), file,
&NS_GET_IID(nsIDOMFile));
mRequest->FireSuccess(result);
break;
}
@ -71,7 +72,7 @@ DeviceStorageRequestChild::Recv__delete__(const DeviceStorageResponseValue& aVal
case DeviceStorageResponseValue::TFreeSpaceStorageResponse:
{
FreeSpaceStorageResponse r = aValue;
jsval result = JS_NumberValue(double(r.freeBytes()));
JS::Value result = JS_NumberValue(double(r.freeBytes()));
mRequest->FireSuccess(result);
break;
}
@ -79,7 +80,7 @@ DeviceStorageRequestChild::Recv__delete__(const DeviceStorageResponseValue& aVal
case DeviceStorageResponseValue::TUsedSpaceStorageResponse:
{
UsedSpaceStorageResponse r = aValue;
jsval result = JS_NumberValue(double(r.usedBytes()));
JS::Value result = JS_NumberValue(double(r.usedBytes()));
mRequest->FireSuccess(result);
break;
}
@ -87,7 +88,7 @@ DeviceStorageRequestChild::Recv__delete__(const DeviceStorageResponseValue& aVal
case DeviceStorageResponseValue::TAvailableStorageResponse:
{
AvailableStorageResponse r = aValue;
jsval result = StringToJsval(mRequest->GetOwner(), r.mountState());
JS::Value result = StringToJsval(mRequest->GetOwner(), r.mountState());
mRequest->FireSuccess(result);
break;
}

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

@ -811,7 +811,8 @@ nsDOMDeviceStorage::SetRootDirectoryForType(const nsAString& aType, const nsAStr
mStorageType = aType;
}
jsval InterfaceToJsval(nsPIDOMWindow* aWindow, nsISupports* aObject, const nsIID* aIID)
JS::Value
InterfaceToJsval(nsPIDOMWindow* aWindow, nsISupports* aObject, const nsIID* aIID)
{
nsCOMPtr<nsIScriptGlobalObject> sgo = do_QueryInterface(aWindow);
if (!sgo) {
@ -828,7 +829,7 @@ jsval InterfaceToJsval(nsPIDOMWindow* aWindow, nsISupports* aObject, const nsIID
return JSVAL_NULL;
}
jsval someJsVal;
JS::Value someJsVal;
nsresult rv = nsContentUtils::WrapNative(cx,
JS_GetGlobalObject(cx),
aObject,
@ -841,7 +842,8 @@ jsval InterfaceToJsval(nsPIDOMWindow* aWindow, nsISupports* aObject, const nsIID
return someJsVal;
}
jsval nsIFileToJsval(nsPIDOMWindow* aWindow, DeviceStorageFile* aFile)
JS::Value
nsIFileToJsval(nsPIDOMWindow* aWindow, DeviceStorageFile* aFile)
{
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
NS_ASSERTION(aWindow, "Null Window");
@ -860,7 +862,7 @@ jsval nsIFileToJsval(nsPIDOMWindow* aWindow, DeviceStorageFile* aFile)
return InterfaceToJsval(aWindow, blob, &NS_GET_IID(nsIDOMBlob));
}
jsval StringToJsval(nsPIDOMWindow* aWindow, nsAString& aString)
JS::Value StringToJsval(nsPIDOMWindow* aWindow, nsAString& aString)
{
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
NS_ASSERTION(aWindow, "Null Window");
@ -882,7 +884,7 @@ jsval StringToJsval(nsPIDOMWindow* aWindow, nsAString& aString)
JSAutoRequest ar(cx);
jsval result = JSVAL_NULL;
JS::Value result = JSVAL_NULL;
if (!xpc::StringToJsval(cx, aString, &result)) {
return JSVAL_NULL;
}
@ -1045,7 +1047,7 @@ ContinueCursorEvent::Run()
nsRefPtr<DeviceStorageFile> file = GetNextFile();
nsDOMDeviceStorageCursor* cursor = static_cast<nsDOMDeviceStorageCursor*>(mRequest.get());
jsval val = nsIFileToJsval(cursor->GetOwner(), file);
JS::Value val = nsIFileToJsval(cursor->GetOwner(), file);
if (file) {
cursor->mOkToCallContinue = true;
@ -1270,7 +1272,7 @@ public:
}
#endif
jsval result = StringToJsval(mRequest->GetOwner(), state);
JS::Value result = StringToJsval(mRequest->GetOwner(), state);
mRequest->FireSuccess(result);
mRequest = nullptr;
return NS_OK;
@ -1308,7 +1310,7 @@ public:
{
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
jsval result = JSVAL_NULL;
JS::Value result = JSVAL_NULL;
nsPIDOMWindow* window = mRequest->GetOwner();
if (mFile) {

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

@ -130,9 +130,14 @@ private:
};
//helpers
jsval StringToJsval(nsPIDOMWindow* aWindow, nsAString& aString);
jsval nsIFileToJsval(nsPIDOMWindow* aWindow, DeviceStorageFile* aFile);
jsval InterfaceToJsval(nsPIDOMWindow* aWindow, nsISupports* aObject, const nsIID* aIID);
JS::Value
StringToJsval(nsPIDOMWindow* aWindow, nsAString& aString);
JS::Value
nsIFileToJsval(nsPIDOMWindow* aWindow, DeviceStorageFile* aFile);
JS::Value
InterfaceToJsval(nsPIDOMWindow* aWindow, nsISupports* aObject, const nsIID* aIID);
#ifdef MOZ_WIDGET_GONK
nsresult GetSDCardStatus(nsAString& aPath, nsAString& aState);

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

@ -228,7 +228,8 @@ MobileConnection::GetCardLock(const nsAString& aLockType, nsIDOMDOMRequest** aDo
}
NS_IMETHODIMP
MobileConnection::UnlockCardLock(const jsval& aInfo, nsIDOMDOMRequest** aDomRequest)
MobileConnection::UnlockCardLock(const JS::Value& aInfo,
nsIDOMDOMRequest** aDomRequest)
{
*aDomRequest = nullptr;
@ -240,7 +241,8 @@ MobileConnection::UnlockCardLock(const jsval& aInfo, nsIDOMDOMRequest** aDomRequ
}
NS_IMETHODIMP
MobileConnection::SetCardLock(const jsval& aInfo, nsIDOMDOMRequest** aDomRequest)
MobileConnection::SetCardLock(const JS::Value& aInfo,
nsIDOMDOMRequest** aDomRequest)
{
*aDomRequest = nullptr;

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

@ -19,7 +19,7 @@ namespace IPC {
bool
DeserializeUint8Array(JSRawObject aObj,
const InfallibleTArray<uint8_t>& aBuffer,
jsval* aVal)
JS::Value* aVal)
{
JSContext* cx = nsContentUtils::GetSafeJSContext();
JSAutoRequest ar(cx);
@ -135,7 +135,7 @@ TCPSocketChild::RecvCallback(const nsString& aType,
const SendableData& data = aData.get_SendableData();
if (data.type() == SendableData::TArrayOfuint8_t) {
jsval val;
JS::Value val;
IPC::DeserializeUint8Array(mSocketObj, data.get_ArrayOfuint8_t(), &val);
rv = mSocket->CallListenerArrayBuffer(aType, val);

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

@ -16,7 +16,7 @@ namespace IPC {
extern bool
DeserializeUint8Array(JSRawObject aObj,
const InfallibleTArray<uint8_t>& aBuffer,
jsval* aVal);
JS::Value* aVal);
}
@ -96,7 +96,7 @@ TCPSocketParent::RecvData(const SendableData& aData)
nsresult rv;
switch (aData.type()) {
case SendableData::TArrayOfuint8_t: {
jsval val;
JS::Value val;
IPC::DeserializeUint8Array(mIntermediaryObj, aData.get_ArrayOfuint8_t(), &val);
rv = mIntermediary->SendArrayBuffer(val);
NS_ENSURE_SUCCESS(rv, true);
@ -171,7 +171,7 @@ TCPSocketParent::SendCallback(const nsAString& aType, const JS::Value& aDataVal,
uint32_t lineNumber = 0;
uint32_t columnNumber = 0;
jsval val;
JS::Value val;
if (!JS_GetProperty(aCx, obj, "message", &val)) {
NS_ERROR("No message property on supposed error object");
} else if (JSVAL_IS_STRING(val)) {