Bug 842186 - Update instances of jsval to JS::Value in .cpp and .h files within the toolkit and netwerk directories. r=jwalden

--HG--
extra : rebase_source : bba8b8f21faa148a64731299bd74bf89c1314822
This commit is contained in:
Jose Cortes 2013-03-06 13:16:46 -08:00
parent fb1c53df39
commit c430aa26aa
10 changed files with 59 additions and 57 deletions

View File

@ -62,7 +62,7 @@ Dashboard::GetSocketsDispatch()
nsresult
Dashboard::GetSockets()
{
jsval val;
JS::Value val;
JSContext* cx = nsContentUtils::GetSafeJSContext();
JSAutoRequest request(cx);
@ -138,7 +138,7 @@ Dashboard::GetHttpDispatch()
nsresult
Dashboard::GetHttpConnections()
{
jsval val;
JS::Value val;
JSContext* cx = nsContentUtils::GetSafeJSContext();
JSAutoRequest request(cx);
@ -288,7 +288,7 @@ Dashboard::RequestWebsocketConnections(NetDashboardCallback* cb)
nsresult
Dashboard::GetWebSocketConnections()
{
jsval val;
JS::Value val;
JSString* jsstring;
JSContext* cx = nsContentUtils::GetSafeJSContext();
JSAutoRequest request(cx);
@ -362,7 +362,7 @@ Dashboard::GetDnsInfoDispatch()
nsresult
Dashboard::GetDNSCacheEntries()
{
jsval val;
JS::Value val;
JSContext* cx = nsContentUtils::GetSafeJSContext();
JSAutoRequest request(cx);

View File

@ -381,7 +381,7 @@ bool PACResolveToString(const nsCString &aHostName,
// dnsResolve(host) javascript implementation
static
JSBool PACDnsResolve(JSContext *cx, unsigned int argc, jsval *vp)
JSBool PACDnsResolve(JSContext *cx, unsigned int argc, JS::Value *vp)
{
if (NS_IsMainThread()) {
NS_WARNING("DNS Resolution From PAC on Main Thread. How did that happen?");
@ -410,7 +410,7 @@ JSBool PACDnsResolve(JSContext *cx, unsigned int argc, jsval *vp)
// myIpAddress() javascript implementation
static
JSBool PACMyIpAddress(JSContext *cx, unsigned int argc, jsval *vp)
JSBool PACMyIpAddress(JSContext *cx, unsigned int argc, JS::Value *vp)
{
if (NS_IsMainThread()) {
NS_WARNING("DNS Resolution From PAC on Main Thread. How did that happen?");
@ -427,7 +427,7 @@ JSBool PACMyIpAddress(JSContext *cx, unsigned int argc, jsval *vp)
// proxyAlert(msg) javascript implementation
static
JSBool PACProxyAlert(JSContext *cx, unsigned int argc, jsval *vp)
JSBool PACProxyAlert(JSContext *cx, unsigned int argc, JS::Value *vp)
{
JSString *arg1 = nullptr;
if (!JS_ConvertArguments(cx, argc, JS_ARGV(cx, vp), "S", &arg1))
@ -640,8 +640,8 @@ ProxyAutoConfig::GetProxyForURI(const nsCString &aTestURI,
js::RootedValue uriValue(cx, STRING_TO_JSVAL(uriString));
js::RootedValue hostValue(cx, STRING_TO_JSVAL(hostString));
jsval argv[2] = { uriValue, hostValue };
jsval rval;
JS::Value argv[2] = { uriValue, hostValue };
JS::Value rval;
JSBool ok = JS_CallFunctionName(cx, mJSRuntime->Global(),
"FindProxyForURL", 2, argv, &rval);
@ -728,7 +728,7 @@ ProxyAutoConfig::SrcAddress(const NetAddr *remoteAddress, nsCString &localAddres
bool
ProxyAutoConfig::MyIPAddressTryHost(const nsCString &hostName,
unsigned int timeout,
jsval *vp)
JS::Value *vp)
{
NetAddr remoteAddress;
nsAutoCString localDottedDecimal;
@ -745,7 +745,7 @@ ProxyAutoConfig::MyIPAddressTryHost(const nsCString &hostName,
}
bool
ProxyAutoConfig::MyIPAddress(jsval *vp)
ProxyAutoConfig::MyIPAddress(JS::Value *vp)
{
nsAutoCString remoteDottedDecimal;
nsAutoCString localDottedDecimal;

View File

@ -37,7 +37,7 @@ public:
const nsCString &aPACScript);
void Shutdown();
void GC();
bool MyIPAddress(jsval *vp);
bool MyIPAddress(JS::Value *vp);
bool ResolveAddress(const nsCString &aHostName,
NetAddr *aNetAddr, unsigned int aTimeout);
@ -87,7 +87,7 @@ private:
bool SrcAddress(const NetAddr *remoteAddress, nsCString &localAddress);
bool MyIPAddressTryHost(const nsCString &hostName, unsigned int timeout,
jsval *vp);
JS::Value *vp);
JSRuntimeWrapper *mJSRuntime;
bool mJSNeedsSetup;

View File

@ -66,7 +66,7 @@ Module::~Module()
static JSBool
SealObjectAndPrototype(JSContext* cx, JSObject* parent, const char* name)
{
jsval prop;
JS::Value prop;
if (!JS_GetProperty(cx, parent, name, &prop))
return false;
@ -91,7 +91,7 @@ InitAndSealCTypesClass(JSContext* cx, JSObject* global)
return false;
// Set callbacks for charset conversion and such.
jsval ctypes;
JS::Value ctypes;
if (!JS_GetProperty(cx, global, "ctypes", &ctypes))
return false;
@ -116,8 +116,8 @@ Module::Call(nsIXPConnectWrappedNative* wrapper,
JSContext* cx,
JSObject* obj,
uint32_t argc,
jsval* argv,
jsval* vp,
JS::Value* argv,
JS::Value* vp,
bool* _retval)
{
JSObject* targetObj = nullptr;

View File

@ -41,7 +41,7 @@ Module::~Module()
static JSBool
SealObjectAndPrototype(JSContext* cx, JSObject* parent, const char* name)
{
jsval prop;
JS::Value prop;
if (!JS_GetProperty(cx, parent, name, &prop))
return false;
@ -82,8 +82,8 @@ Module::Call(nsIXPConnectWrappedNative* wrapper,
JSContext* cx,
JSObject* obj,
uint32_t argc,
jsval* argv,
jsval* vp,
JS::Value* argv,
JS::Value* vp,
bool* _retval)
{
JSObject* targetObj = nullptr;

View File

@ -231,7 +231,7 @@ GetURIFromJSObject(JSContext* aCtx,
JSObject* aObject,
const char* aProperty)
{
jsval uriVal;
JS::Value uriVal;
JSBool rc = JS_GetProperty(aCtx, aObject, aProperty, &uriVal);
NS_ENSURE_TRUE(rc, nullptr);
@ -266,7 +266,7 @@ GetStringFromJSObject(JSContext* aCtx,
const char* aProperty,
nsString& _string)
{
jsval val;
JS::Value val;
JSBool rc = JS_GetProperty(aCtx, aObject, aProperty, &val);
if (!rc || JSVAL_IS_VOID(val) ||
!(JSVAL_IS_NULL(val) || JSVAL_IS_STRING(val))) {
@ -307,7 +307,7 @@ GetIntFromJSObject(JSContext* aCtx,
const char* aProperty,
IntType* _int)
{
jsval value;
JS::Value value;
JSBool rc = JS_GetProperty(aCtx, aObject, aProperty, &value);
NS_ENSURE_TRUE(rc, NS_ERROR_UNEXPECTED);
if (JSVAL_IS_VOID(value)) {
@ -348,7 +348,7 @@ GetJSObjectFromArray(JSContext* aCtx,
NS_PRECONDITION(JS_IsArrayObject(aCtx, aArray),
"Must provide an object that is an array!");
jsval value;
JS::Value value;
JSBool rc = JS_GetElement(aCtx, aArray, aIndex, &value);
NS_ENSURE_TRUE(rc, NS_ERROR_UNEXPECTED);
NS_ENSURE_ARG(!JSVAL_IS_PRIMITIVE(value));
@ -2537,7 +2537,7 @@ History::RemoveAllDownloads()
//// mozIAsyncHistory
NS_IMETHODIMP
History::UpdatePlaces(const jsval& aPlaceInfos,
History::UpdatePlaces(const JS::Value& aPlaceInfos,
mozIVisitInfoCallback* aCallback,
JSContext* aCtx)
{
@ -2598,7 +2598,7 @@ History::UpdatePlaces(const jsval& aPlaceInfos,
JSObject* visits = NULL;
{
jsval visitsVal;
JS::Value visitsVal;
JSBool rc = JS_GetProperty(aCtx, info, "visits", &visitsVal);
NS_ENSURE_TRUE(rc, NS_ERROR_UNEXPECTED);
if (!JSVAL_IS_PRIMITIVE(visitsVal)) {

View File

@ -71,7 +71,7 @@ PlaceInfo::GetFrecency(int64_t* _frecency)
NS_IMETHODIMP
PlaceInfo::GetVisits(JSContext* aContext,
jsval* _visits)
JS::Value* _visits)
{
// TODO bug 625913 when we use this in situations that have more than one
// visit here, we will likely want to make this cache the value.
@ -93,7 +93,7 @@ PlaceInfo::GetVisits(JSContext* aContext,
JSObject* jsobj;
rv = wrapper->GetJSObject(&jsobj);
NS_ENSURE_SUCCESS(rv, rv);
jsval wrappedVisit = OBJECT_TO_JSVAL(jsobj);
JS::Value wrappedVisit = OBJECT_TO_JSVAL(jsobj);
JSBool rc = JS_SetElement(aContext, visits, idx, &wrappedVisit);
NS_ENSURE_TRUE(rc, NS_ERROR_UNEXPECTED);

View File

@ -42,8 +42,8 @@ Module::Call(nsIXPConnectWrappedNative* wrapper,
JSContext* cx,
JSObject* obj,
uint32_t argc,
jsval* argv,
jsval* vp,
JS::Value* argv,
JS::Value* vp,
bool* _retval)
{
JSObject* global = JS_GetGlobalForScopeChain(cx);

View File

@ -289,7 +289,7 @@ private:
bool AddSQLInfo(JSContext *cx, JSObject *rootObj, bool mainThread,
bool privateSQL);
bool GetSQLStats(JSContext *cx, jsval *ret, bool includePrivateSql);
bool GetSQLStats(JSContext *cx, JS::Value *ret, bool includePrivateSql);
// Like GetHistogramById, but returns the underlying C++ object, not the JS one.
nsresult GetHistogramByName(const nsACString &name, Histogram **ret);
@ -615,14 +615,14 @@ IsEmpty(const Histogram *h)
}
JSBool
JSHistogram_Add(JSContext *cx, unsigned argc, jsval *vp)
JSHistogram_Add(JSContext *cx, unsigned argc, JS::Value *vp)
{
if (!argc) {
JS_ReportError(cx, "Expected one argument");
return JS_FALSE;
}
jsval v = JS_ARGV(cx, vp)[0];
JS::Value v = JS_ARGV(cx, vp)[0];
if (!(JSVAL_IS_NUMBER(v) || JSVAL_IS_BOOLEAN(v))) {
JS_ReportError(cx, "Not a number");
@ -647,7 +647,7 @@ JSHistogram_Add(JSContext *cx, unsigned argc, jsval *vp)
}
JSBool
JSHistogram_Snapshot(JSContext *cx, unsigned argc, jsval *vp)
JSHistogram_Snapshot(JSContext *cx, unsigned argc, JS::Value *vp)
{
JSObject *obj = JS_THIS_OBJECT(cx, vp);
if (!obj) {
@ -676,7 +676,7 @@ JSHistogram_Snapshot(JSContext *cx, unsigned argc, jsval *vp)
}
JSBool
JSHistogram_Clear(JSContext *cx, unsigned argc, jsval *vp)
JSHistogram_Clear(JSContext *cx, unsigned argc, JS::Value *vp)
{
JSObject *obj = JS_THIS_OBJECT(cx, vp);
if (!obj) {
@ -689,7 +689,7 @@ JSHistogram_Clear(JSContext *cx, unsigned argc, jsval *vp)
}
nsresult
WrapAndReturnHistogram(Histogram *h, JSContext *cx, jsval *ret)
WrapAndReturnHistogram(Histogram *h, JSContext *cx, JS::Value *ret)
{
static JSClass JSHistogram_class = {
"JSHistogram", /* name */
@ -974,7 +974,9 @@ TelemetryImpl::~TelemetryImpl() {
}
NS_IMETHODIMP
TelemetryImpl::NewHistogram(const nsACString &name, uint32_t min, uint32_t max, uint32_t bucketCount, uint32_t histogramType, JSContext *cx, jsval *ret)
TelemetryImpl::NewHistogram(const nsACString &name, uint32_t min, uint32_t max,
uint32_t bucketCount, uint32_t histogramType,
JSContext *cx, JS::Value *ret)
{
Histogram *h;
nsresult rv = HistogramGet(PromiseFlatCString(name).get(), min, max, bucketCount, histogramType, &h);
@ -995,8 +997,8 @@ TelemetryImpl::ReflectSQL(const SlowSQLEntryType *entry,
return true;
const nsACString &sql = entry->GetKey();
jsval hitCount = UINT_TO_JSVAL(stat->hitCount);
jsval totalTime = UINT_TO_JSVAL(stat->totalTime);
JS::Value hitCount = UINT_TO_JSVAL(stat->hitCount);
JS::Value totalTime = UINT_TO_JSVAL(stat->totalTime);
JSObject *arrayObj = JS_NewArrayObject(cx, 0, nullptr);
if (!arrayObj) {
@ -1095,7 +1097,7 @@ TelemetryImpl::GetHistogramByName(const nsACString &name, Histogram **ret)
NS_IMETHODIMP
TelemetryImpl::HistogramFrom(const nsACString &name, const nsACString &existing_name,
JSContext *cx, jsval *ret)
JSContext *cx, JS::Value *ret)
{
Histogram *existing;
nsresult rv = GetHistogramByName(existing_name, &existing);
@ -1235,7 +1237,7 @@ TelemetryImpl::RegisterAddonHistogram(const nsACString &id,
NS_IMETHODIMP
TelemetryImpl::GetAddonHistogram(const nsACString &id, const nsACString &name,
JSContext *cx, jsval *ret)
JSContext *cx, JS::Value *ret)
{
AddonEntryType *addonEntry = mAddonMap.GetEntry(id);
// The given id has not been registered.
@ -1278,7 +1280,7 @@ TelemetryImpl::UnregisterAddonHistograms(const nsACString &id)
}
NS_IMETHODIMP
TelemetryImpl::GetHistogramSnapshots(JSContext *cx, jsval *ret)
TelemetryImpl::GetHistogramSnapshots(JSContext *cx, JS::Value *ret)
{
JSObject *root_obj = JS_NewObject(cx, NULL, NULL, NULL);
if (!root_obj)
@ -1422,7 +1424,7 @@ TelemetryImpl::AddonReflector(AddonEntryType *entry,
}
NS_IMETHODIMP
TelemetryImpl::GetAddonHistogramSnapshots(JSContext *cx, jsval *ret)
TelemetryImpl::GetAddonHistogramSnapshots(JSContext *cx, JS::Value *ret)
{
*ret = JSVAL_VOID;
JSObject *obj = JS_NewObject(cx, NULL, NULL, NULL);
@ -1439,7 +1441,7 @@ TelemetryImpl::GetAddonHistogramSnapshots(JSContext *cx, jsval *ret)
}
bool
TelemetryImpl::GetSQLStats(JSContext *cx, jsval *ret, bool includePrivateSql)
TelemetryImpl::GetSQLStats(JSContext *cx, JS::Value *ret, bool includePrivateSql)
{
JSObject *root_obj = JS_NewObject(cx, NULL, NULL, NULL);
if (!root_obj)
@ -1458,7 +1460,7 @@ TelemetryImpl::GetSQLStats(JSContext *cx, jsval *ret, bool includePrivateSql)
}
NS_IMETHODIMP
TelemetryImpl::GetSlowSQL(JSContext *cx, jsval *ret)
TelemetryImpl::GetSlowSQL(JSContext *cx, JS::Value *ret)
{
if (GetSQLStats(cx, ret, false))
return NS_OK;
@ -1466,7 +1468,7 @@ TelemetryImpl::GetSlowSQL(JSContext *cx, jsval *ret)
}
NS_IMETHODIMP
TelemetryImpl::GetDebugSlowSQL(JSContext *cx, jsval *ret)
TelemetryImpl::GetDebugSlowSQL(JSContext *cx, JS::Value *ret)
{
bool revealPrivateSql =
Preferences::GetBool("toolkit.telemetry.debugSlowSql", false);
@ -1476,7 +1478,7 @@ TelemetryImpl::GetDebugSlowSQL(JSContext *cx, jsval *ret)
}
NS_IMETHODIMP
TelemetryImpl::GetChromeHangs(JSContext *cx, jsval *ret)
TelemetryImpl::GetChromeHangs(JSContext *cx, JS::Value *ret)
{
MutexAutoLock hangReportMutex(mHangReportsMutex);
@ -1501,7 +1503,7 @@ TelemetryImpl::GetChromeHangs(JSContext *cx, jsval *ret)
const size_t length = stacks.GetStackCount();
for (size_t i = 0; i < length; ++i) {
jsval duration = INT_TO_JSVAL(mHangReports.GetDuration(i));
JS::Value duration = INT_TO_JSVAL(mHangReports.GetDuration(i));
if (!JS_SetElement(cx, durationArray, i, &duration)) {
return NS_ERROR_FAILURE;
}
@ -1538,7 +1540,7 @@ CreateJSStackObject(JSContext *cx, const CombinedStacks &stacks) {
if (!moduleInfoArray) {
return nullptr;
}
jsval val = OBJECT_TO_JSVAL(moduleInfoArray);
JS::Value val = OBJECT_TO_JSVAL(moduleInfoArray);
if (!JS_SetElement(cx, moduleArray, moduleIndex, &val)) {
return nullptr;
}
@ -1585,7 +1587,7 @@ CreateJSStackObject(JSContext *cx, const CombinedStacks &stacks) {
return nullptr;
}
jsval pcArrayVal = OBJECT_TO_JSVAL(pcArray);
JS::Value pcArrayVal = OBJECT_TO_JSVAL(pcArray);
if (!JS_SetElement(cx, reportArray, i, &pcArrayVal)) {
return nullptr;
}
@ -1600,15 +1602,15 @@ CreateJSStackObject(JSContext *cx, const CombinedStacks &stacks) {
}
int modIndex = (std::numeric_limits<uint16_t>::max() == frame.mModIndex) ?
-1 : frame.mModIndex;
jsval modIndexVal = INT_TO_JSVAL(modIndex);
JS::Value modIndexVal = INT_TO_JSVAL(modIndex);
if (!JS_SetElement(cx, framePair, 0, &modIndexVal)) {
return nullptr;
}
jsval mOffsetVal = INT_TO_JSVAL(frame.mOffset);
JS::Value mOffsetVal = INT_TO_JSVAL(frame.mOffset);
if (!JS_SetElement(cx, framePair, 1, &mOffsetVal)) {
return nullptr;
}
jsval framePairVal = OBJECT_TO_JSVAL(framePair);
JS::Value framePairVal = OBJECT_TO_JSVAL(framePair);
if (!JS_SetElement(cx, pcArray, pcIndex, &framePairVal)) {
return nullptr;
}
@ -1752,7 +1754,7 @@ TelemetryImpl::ReadLateWritesStacks()
}
NS_IMETHODIMP
TelemetryImpl::GetLateWrites(JSContext *cx, jsval *ret)
TelemetryImpl::GetLateWrites(JSContext *cx, JS::Value *ret)
{
// The user must call AsyncReadTelemetryData first. We return an empty list
// instead of reporting a failure so that the rest of telemetry can uniformly
@ -1784,7 +1786,7 @@ TelemetryImpl::GetLateWrites(JSContext *cx, jsval *ret)
}
NS_IMETHODIMP
TelemetryImpl::GetRegisteredHistograms(JSContext *cx, jsval *ret)
TelemetryImpl::GetRegisteredHistograms(JSContext *cx, JS::Value *ret)
{
size_t count = ArrayLength(gHistograms);
JSObject *info = JS_NewObject(cx, NULL, NULL, NULL);
@ -1808,7 +1810,7 @@ TelemetryImpl::GetRegisteredHistograms(JSContext *cx, jsval *ret)
}
NS_IMETHODIMP
TelemetryImpl::GetHistogramById(const nsACString &name, JSContext *cx, jsval *ret)
TelemetryImpl::GetHistogramById(const nsACString &name, JSContext *cx, JS::Value *ret)
{
Histogram *h;
nsresult rv = GetHistogramByName(name, &h);

View File

@ -726,7 +726,7 @@ XRE_SendTestShellCommand(JSContext* aCx,
tsp->SendPTestShellCommandConstructor(command));
NS_ENSURE_TRUE(callback, false);
jsval callbackVal = *reinterpret_cast<jsval*>(aCallback);
JS::Value callbackVal = *reinterpret_cast<JS::Value*>(aCallback);
NS_ENSURE_TRUE(callback->SetCallback(aCx, callbackVal), false);
return true;