Bug 842186 - Replace use of jsval with JS::Value in dom/base. r=jwalden

From 1a684ed61615d32965201e55335478d5f403ac4a Mon Sep 17 00:00:00 2001
 cpp files in the dom/base/ directory. r=jwalden
---
 dom/base/Crypto.cpp                     |  3 +-
 dom/base/DOMRequest.cpp                 | 12 +++---
 dom/base/DOMRequest.h                   |  4 +-
 dom/base/Navigator.cpp                  | 10 ++---
 dom/base/nsDOMJSUtils.h                 |  6 +--
 dom/base/nsDOMWindowUtils.cpp           | 20 ++++-----
 dom/base/nsGlobalWindow.cpp             | 24 +++++------
 dom/base/nsIJSNativeInitializer.h       |  4 +-
 dom/base/nsJSEnvironment.cpp            | 73 +++++++++++++++++----------------
 dom/base/nsJSEnvironment.h              |  8 ++--
 dom/base/nsJSTimeoutHandler.cpp         |  4 +-
 dom/base/nsJSUtils.h                    |  2 +-
 dom/base/nsStructuredCloneContainer.cpp | 10 ++---
 13 files changed, 91 insertions(+), 89 deletions(-)

--HG--
extra : rebase_source : af1420550a745aba9fd6c20297ac3cd0075f5ead
This commit is contained in:
Jose Cortes 2013-04-11 18:52:10 -04:00
Родитель 47222a1461
Коммит 1068414e39
13 изменённых файлов: 87 добавлений и 85 удалений

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

@ -40,7 +40,8 @@ Crypto::~Crypto()
}
NS_IMETHODIMP
Crypto::GetRandomValues(const jsval& aData, JSContext *cx, jsval* _retval)
Crypto::GetRandomValues(const JS::Value& aData, JSContext *cx,
JS::Value* _retval)
{
NS_ABORT_IF_FALSE(NS_IsMainThread(), "Called on the wrong thread");

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

@ -101,7 +101,7 @@ DOMRequest::GetReadyState(nsAString& aReadyState)
}
NS_IMETHODIMP
DOMRequest::GetResult(jsval* aResult)
DOMRequest::GetResult(JS::Value* aResult)
{
*aResult = Result();
return NS_OK;
@ -115,7 +115,7 @@ DOMRequest::GetError(nsIDOMDOMError** aError)
}
void
DOMRequest::FireSuccess(jsval aResult)
DOMRequest::FireSuccess(JS::Value aResult)
{
NS_ASSERTION(!mDone, "mDone shouldn't have been set to true already!");
NS_ASSERTION(!mError, "mError shouldn't have been set!");
@ -219,7 +219,7 @@ DOMRequestService::CreateCursor(nsIDOMWindow* aWindow,
NS_IMETHODIMP
DOMRequestService::FireSuccess(nsIDOMDOMRequest* aRequest,
const jsval& aResult)
const JS::Value& aResult)
{
NS_ENSURE_STATE(aRequest);
static_cast<DOMRequest*>(aRequest)->FireSuccess(aResult);
@ -241,7 +241,7 @@ class FireSuccessAsyncTask : public nsRunnable
{
public:
FireSuccessAsyncTask(DOMRequest* aRequest,
const jsval& aResult) :
const JS::Value& aResult) :
mReq(aRequest),
mResult(aResult)
{
@ -276,7 +276,7 @@ public:
}
private:
nsRefPtr<DOMRequest> mReq;
jsval mResult;
JS::Value mResult;
};
class FireErrorAsyncTask : public nsRunnable
@ -302,7 +302,7 @@ private:
NS_IMETHODIMP
DOMRequestService::FireSuccessAsync(nsIDOMDOMRequest* aRequest,
const jsval& aResult)
const JS::Value& aResult)
{
NS_ENSURE_STATE(aRequest);
nsCOMPtr<nsIRunnable> asyncTask =

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

@ -22,7 +22,7 @@ class DOMRequest : public nsDOMEventTargetHelper,
public nsIDOMDOMRequest
{
protected:
jsval mResult;
JS::Value mResult;
nsCOMPtr<nsIDOMDOMError> mError;
bool mDone;
bool mRooted;
@ -69,7 +69,7 @@ public:
IMPL_EVENT_HANDLER(error)
void FireSuccess(jsval aResult);
void FireSuccess(JS::Value aResult);
void FireError(const nsAString& aError);
void FireError(nsresult aError);

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

@ -697,13 +697,13 @@ VibrateWindowListener::RemoveListener()
}
/**
* Converts a jsval into a vibration duration, checking that the duration is in
* Converts a JS::Value into a vibration duration, checking that the duration is in
* bounds (non-negative and not larger than sMaxVibrateMS).
*
* Returns true on success, false on failure.
*/
bool
GetVibrationDurationFromJsval(const jsval& aJSVal, JSContext* cx,
GetVibrationDurationFromJsval(const JS::Value& aJSVal, JSContext* cx,
int32_t* aOut)
{
return JS_ValueToInt32(cx, aJSVal, aOut) &&
@ -755,7 +755,7 @@ Navigator::RemoveIdleObserver(nsIIdleObserver* aIdleObserver)
}
NS_IMETHODIMP
Navigator::Vibrate(const jsval& aPattern, JSContext* cx)
Navigator::Vibrate(const JS::Value& aPattern, JSContext* cx)
{
nsCOMPtr<nsPIDOMWindow> win = do_QueryReferent(mWindow);
NS_ENSURE_TRUE(win, NS_OK);
@ -795,7 +795,7 @@ Navigator::Vibrate(const jsval& aPattern, JSContext* cx)
pattern.SetLength(length);
for (uint32_t i = 0; i < length; ++i) {
jsval v;
JS::Value v;
int32_t pv;
if (JS_GetElement(cx, obj, i, &v) &&
GetVibrationDurationFromJsval(v, cx, &pv)) {
@ -1441,7 +1441,7 @@ Navigator::EnsureMessagesManager()
NS_ENSURE_TRUE(gpi, NS_ERROR_FAILURE);
// We don't do anything with the return value.
jsval prop_val = JSVAL_VOID;
JS::Value prop_val = JSVAL_VOID;
rv = gpi->Init(window, &prop_val);
NS_ENSURE_SUCCESS(rv, rv);

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

@ -45,11 +45,11 @@ GetScriptContextPrincipalFromJSContext(JSContext *cx)
return scx;
}
// A factory function for turning a jsval argv into an nsIArray
// A factory function for turning a JS::Value argv into an nsIArray
// but also supports an effecient way of extracting the original argv.
// Bug 312003 describes why this must be "void *", but argv will be cast to
// jsval* and the args are found at:
// ((jsval*)aArgv)[0], ..., ((jsval*)aArgv)[aArgc - 1]
// JS::Value* and the args are found at:
// ((JS::Value*)aArgv)[0], ..., ((JS::Value*)aArgv)[aArgc - 1]
// The resulting object will take a copy of the array, and ensure each
// element is rooted.
// Optionally, aArgv may be NULL, in which case the array is allocated and

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

@ -2666,8 +2666,8 @@ GetXPConnectNative(JSContext* aCx, JSObject* aObj) {
}
static nsresult
GetFileOrBlob(const nsAString& aName, const jsval& aBlobParts,
const jsval& aParameters, JSContext* aCx,
GetFileOrBlob(const nsAString& aName, const JS::Value& aBlobParts,
const JS::Value& aParameters, JSContext* aCx,
uint8_t aOptionalArgCount, nsISupports** aResult)
{
if (!nsContentUtils::IsCallerChrome()) {
@ -2689,7 +2689,7 @@ GetFileOrBlob(const nsAString& aName, const jsval& aBlobParts,
nsDOMMultipartFile* domFile =
static_cast<nsDOMMultipartFile*>(static_cast<nsIDOMFile*>(file.get()));
jsval args[2] = { aBlobParts, aParameters };
JS::Value args[2] = { aBlobParts, aParameters };
rv = domFile->InitBlob(aCx, aOptionalArgCount, args, GetXPConnectNative);
NS_ENSURE_SUCCESS(rv, rv);
@ -2699,8 +2699,8 @@ GetFileOrBlob(const nsAString& aName, const jsval& aBlobParts,
}
NS_IMETHODIMP
nsDOMWindowUtils::GetFile(const nsAString& aName, const jsval& aBlobParts,
const jsval& aParameters, JSContext* aCx,
nsDOMWindowUtils::GetFile(const nsAString& aName, const JS::Value& aBlobParts,
const JS::Value& aParameters, JSContext* aCx,
uint8_t aOptionalArgCount, nsIDOMFile** aResult)
{
if (!nsContentUtils::IsCallerChrome()) {
@ -2719,9 +2719,9 @@ nsDOMWindowUtils::GetFile(const nsAString& aName, const jsval& aBlobParts,
}
NS_IMETHODIMP
nsDOMWindowUtils::GetBlob(const jsval& aBlobParts, const jsval& aParameters,
JSContext* aCx, uint8_t aOptionalArgCount,
nsIDOMBlob** aResult)
nsDOMWindowUtils::GetBlob(const JS::Value& aBlobParts,
const JS::Value& aParameters, JSContext* aCx,
uint8_t aOptionalArgCount, nsIDOMBlob** aResult)
{
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
@ -2739,7 +2739,7 @@ nsDOMWindowUtils::GetBlob(const jsval& aBlobParts, const jsval& aParameters,
}
NS_IMETHODIMP
nsDOMWindowUtils::GetFileId(const jsval& aFile, JSContext* aCx,
nsDOMWindowUtils::GetFileId(const JS::Value& aFile, JSContext* aCx,
int64_t* aResult)
{
if (!nsContentUtils::IsCallerChrome()) {
@ -2928,7 +2928,7 @@ nsDOMWindowUtils::GetPaintingSuppressed(bool *aPaintingSuppressed)
}
NS_IMETHODIMP
nsDOMWindowUtils::GetPlugins(JSContext* cx, jsval* aPlugins)
nsDOMWindowUtils::GetPlugins(JSContext* cx, JS::Value* aPlugins)
{
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;

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

@ -6442,7 +6442,7 @@ nsGlobalWindow::OpenDialog(const nsAString& aUrl, const nsAString& aName,
NS_ENSURE_SUCCESS(rv, rv);
uint32_t argc;
jsval *argv = nullptr;
JS::Value *argv = nullptr;
// XXX - need to get this as nsISupports?
ncc->GetArgc(&argc);
@ -6625,7 +6625,7 @@ PostMessageReadStructuredClone(JSContext* cx,
if (JS_ReadBytes(reader, &supports, sizeof(supports))) {
JSObject* global = JS_GetGlobalForScopeChain(cx);
if (global) {
jsval val;
JS::Value val;
nsCOMPtr<nsIXPConnectJSObjectHolder> wrapper;
if (NS_SUCCEEDED(nsContentUtils::WrapNative(cx, global, supports,
&val,
@ -6763,7 +6763,7 @@ PostMessageEvent::Run()
}
// Deserialize the structured clone data
jsval messageData;
JS::Value messageData;
{
JSAutoRequest ar(cx);
StructuredCloneInfo scInfo;
@ -6818,9 +6818,9 @@ PostMessageEvent::Run()
}
NS_IMETHODIMP
nsGlobalWindow::PostMessageMoz(const jsval& aMessage,
nsGlobalWindow::PostMessageMoz(const JS::Value& aMessage,
const nsAString& aOrigin,
const jsval& aTransfer,
const JS::Value& aTransfer,
JSContext* aCx)
{
FORWARD_TO_OUTER(PostMessageMoz, (aMessage, aOrigin, aTransfer, aCx),
@ -6906,7 +6906,7 @@ nsGlobalWindow::PostMessageMoz(const jsval& aMessage,
providedOrigin,
nsContentUtils::IsCallerChrome());
// We *must* clone the data here, or the jsval could be modified
// We *must* clone the data here, or the JS::Value could be modified
// by script
JSAutoStructuredCloneBuffer buffer;
StructuredCloneInfo scInfo;
@ -11803,13 +11803,13 @@ nsGlobalWindow::DisableNetworkEvent(uint32_t aType)
#define EVENT(name_, id_, type_, struct_) \
NS_IMETHODIMP nsGlobalWindow::GetOn##name_(JSContext *cx, \
jsval *vp) { \
JS::Value *vp) { \
EventHandlerNonNull* h = GetOn##name_(); \
vp->setObjectOrNull(h ? h->Callable() : nullptr); \
return NS_OK; \
} \
NS_IMETHODIMP nsGlobalWindow::SetOn##name_(JSContext *cx, \
const jsval &v) { \
const JS::Value &v) { \
JSObject *obj = mJSObject; \
if (!obj) { \
/* Just silently do nothing */ \
@ -11831,7 +11831,7 @@ nsGlobalWindow::DisableNetworkEvent(uint32_t aType)
}
#define ERROR_EVENT(name_, id_, type_, struct_) \
NS_IMETHODIMP nsGlobalWindow::GetOn##name_(JSContext *cx, \
jsval *vp) { \
JS::Value *vp) { \
nsEventListenerManager *elm = GetListenerManager(false); \
if (elm) { \
OnErrorEventHandlerNonNull* h = elm->GetOnErrorEventHandler(); \
@ -11844,7 +11844,7 @@ nsGlobalWindow::DisableNetworkEvent(uint32_t aType)
return NS_OK; \
} \
NS_IMETHODIMP nsGlobalWindow::SetOn##name_(JSContext *cx, \
const jsval &v) { \
const JS::Value &v) { \
nsEventListenerManager *elm = GetListenerManager(true); \
if (!elm) { \
return NS_ERROR_OUT_OF_MEMORY; \
@ -11868,7 +11868,7 @@ nsGlobalWindow::DisableNetworkEvent(uint32_t aType)
}
#define BEFOREUNLOAD_EVENT(name_, id_, type_, struct_) \
NS_IMETHODIMP nsGlobalWindow::GetOn##name_(JSContext *cx, \
jsval *vp) { \
JS::Value *vp) { \
nsEventListenerManager *elm = GetListenerManager(false); \
if (elm) { \
BeforeUnloadEventHandlerNonNull* h = \
@ -11882,7 +11882,7 @@ nsGlobalWindow::DisableNetworkEvent(uint32_t aType)
return NS_OK; \
} \
NS_IMETHODIMP nsGlobalWindow::SetOn##name_(JSContext *cx, \
const jsval &v) { \
const JS::Value &v) { \
nsEventListenerManager *elm = GetListenerManager(true); \
if (!elm) { \
return NS_ERROR_OUT_OF_MEMORY; \

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

@ -17,7 +17,7 @@
* A JavaScript specific interface used to initialize new
* native objects, created as a result of calling a
* JavaScript constructor. The arguments are passed in
* their raw form as jsval's.
* their raw form as JS::Value's.
*/
class nsIJSNativeInitializer : public nsISupports {
@ -29,7 +29,7 @@ public:
* constructor and the parameters passed into the JavaScript constructor.
*/
NS_IMETHOD Initialize(nsISupports* aOwner, JSContext *cx, JSObject *obj,
uint32_t argc, jsval *argv) = 0;
uint32_t argc, JS::Value *argv) = 0;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsIJSNativeInitializer,

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

@ -260,11 +260,11 @@ public:
void SetCapacity(JSContext *cx, size_t capacity) {
vals.SetCapacity(capacity);
// Values must be safe for the GC to inspect (they must not contain garbage).
memset(vals.Elements(), 0, vals.Capacity() * sizeof(jsval));
memset(vals.Elements(), 0, vals.Capacity() * sizeof(JS::Value));
resetRooter(cx);
}
jsval *Elements() {
JS::Value *Elements() {
return vals.Elements();
}
@ -273,7 +273,7 @@ private:
avr.changeArray(vals.Elements(), vals.Length());
}
nsAutoTArray<jsval, 16> vals;
nsAutoTArray<JS::Value, 16> vals;
JS::AutoArrayRooter avr;
};
@ -1431,7 +1431,7 @@ nsJSContext::ExecuteScript(JSScript* aScriptObject,
// The result of evaluation, used only if there were no errors. This need
// not be a GC root currently, provided we run the GC only from the
// operation callback or from ScriptEvaluated.
jsval val;
JS::Value val;
if (!JS_ExecuteScript(mContext, aScopeObject, aScriptObject, &val)) {
ReportPendingException();
}
@ -1481,7 +1481,7 @@ nsJSContext::JSObjectFromInterface(nsISupports* aTarget, JSObject* aScope, JSObj
// Get the jsobject associated with this target
// We don't wrap here because we trust the JS engine to wrap the target
// later.
jsval v;
JS::Value v;
nsresult rv = nsContentUtils::WrapNative(mContext, aScope, aTarget, &v);
NS_ENSURE_SUCCESS(rv, rv);
@ -1663,7 +1663,7 @@ nsresult
nsJSContext::SetProperty(JSObject* aTarget, const char* aPropName, nsISupports* aArgs)
{
uint32_t argc;
jsval *argv = nullptr;
JS::Value *argv = nullptr;
nsCxPusher pusher;
pusher.Push(mContext);
@ -1675,7 +1675,7 @@ nsJSContext::SetProperty(JSObject* aTarget, const char* aPropName, nsISupports*
ConvertSupportsTojsvals(aArgs, GetNativeGlobal(), &argc, &argv, tempStorage);
NS_ENSURE_SUCCESS(rv, rv);
jsval vargs;
JS::Value vargs;
// got the arguments, now attach them.
@ -1705,7 +1705,7 @@ nsresult
nsJSContext::ConvertSupportsTojsvals(nsISupports *aArgs,
JSObject *aScope,
uint32_t *aArgc,
jsval **aArgv,
JS::Value **aArgv,
Maybe<nsRootedJSValueArray> &aTempStorage)
{
nsresult rv = NS_OK;
@ -1744,12 +1744,12 @@ nsJSContext::ConvertSupportsTojsvals(nsISupports *aArgs,
// Use the caller's auto guards to release and unroot.
aTempStorage.construct(mContext);
aTempStorage.ref().SetCapacity(mContext, argCount);
jsval *argv = aTempStorage.ref().Elements();
JS::Value *argv = aTempStorage.ref().Elements();
if (argsArray) {
for (uint32_t argCtr = 0; argCtr < argCount && NS_SUCCEEDED(rv); argCtr++) {
nsCOMPtr<nsISupports> arg;
jsval *thisval = argv + argCtr;
JS::Value *thisval = argv + argCtr;
argsArray->QueryElementAt(argCtr, NS_GET_IID(nsISupports),
getter_AddRefs(arg));
if (!arg) {
@ -1775,7 +1775,7 @@ nsJSContext::ConvertSupportsTojsvals(nsISupports *aArgs,
"Don't pass nsISupportsPrimitives - use nsIVariant!");
#endif
nsCOMPtr<nsIXPConnectJSObjectHolder> wrapper;
jsval v;
JS::Value v;
rv = nsContentUtils::WrapNative(mContext, aScope, arg, &v,
getter_AddRefs(wrapper));
if (NS_SUCCEEDED(rv)) {
@ -1802,7 +1802,7 @@ nsJSContext::ConvertSupportsTojsvals(nsISupports *aArgs,
// This really should go into xpconnect somewhere...
nsresult
nsJSContext::AddSupportsPrimitiveTojsvals(nsISupports *aArg, jsval *aArgv)
nsJSContext::AddSupportsPrimitiveTojsvals(nsISupports *aArg, JS::Value *aArgv)
{
NS_PRECONDITION(aArg, "Empty arg");
@ -1976,7 +1976,7 @@ nsJSContext::AddSupportsPrimitiveTojsvals(nsISupports *aArg, jsval *aArgv)
nsCOMPtr<nsIXPConnectJSObjectHolder> wrapper;
JSObject *global = xpc_UnmarkGrayObject(::JS_GetGlobalObject(cx));
jsval v;
JS::Value v;
nsresult rv = nsContentUtils::WrapNative(cx, global,
data, iid, &v,
getter_AddRefs(wrapper));
@ -2026,7 +2026,7 @@ CheckUniversalXPConnectForTraceMalloc(JSContext *cx)
}
static JSBool
TraceMallocDisable(JSContext *cx, unsigned argc, jsval *vp)
TraceMallocDisable(JSContext *cx, unsigned argc, JS::Value *vp)
{
if (!CheckUniversalXPConnectForTraceMalloc(cx))
return JS_FALSE;
@ -2037,7 +2037,7 @@ TraceMallocDisable(JSContext *cx, unsigned argc, jsval *vp)
}
static JSBool
TraceMallocEnable(JSContext *cx, unsigned argc, jsval *vp)
TraceMallocEnable(JSContext *cx, unsigned argc, JS::Value *vp)
{
if (!CheckUniversalXPConnectForTraceMalloc(cx))
return JS_FALSE;
@ -2048,7 +2048,7 @@ TraceMallocEnable(JSContext *cx, unsigned argc, jsval *vp)
}
static JSBool
TraceMallocOpenLogFile(JSContext *cx, unsigned argc, jsval *vp)
TraceMallocOpenLogFile(JSContext *cx, unsigned argc, JS::Value *vp)
{
int fd;
JSString *str;
@ -2076,7 +2076,7 @@ TraceMallocOpenLogFile(JSContext *cx, unsigned argc, jsval *vp)
}
static JSBool
TraceMallocChangeLogFD(JSContext *cx, unsigned argc, jsval *vp)
TraceMallocChangeLogFD(JSContext *cx, unsigned argc, JS::Value *vp)
{
if (!CheckUniversalXPConnectForTraceMalloc(cx))
return JS_FALSE;
@ -2098,7 +2098,7 @@ TraceMallocChangeLogFD(JSContext *cx, unsigned argc, jsval *vp)
}
static JSBool
TraceMallocCloseLogFD(JSContext *cx, unsigned argc, jsval *vp)
TraceMallocCloseLogFD(JSContext *cx, unsigned argc, JS::Value *vp)
{
if (!CheckUniversalXPConnectForTraceMalloc(cx))
return JS_FALSE;
@ -2114,7 +2114,7 @@ TraceMallocCloseLogFD(JSContext *cx, unsigned argc, jsval *vp)
}
static JSBool
TraceMallocLogTimestamp(JSContext *cx, unsigned argc, jsval *vp)
TraceMallocLogTimestamp(JSContext *cx, unsigned argc, JS::Value *vp)
{
if (!CheckUniversalXPConnectForTraceMalloc(cx))
return JS_FALSE;
@ -2131,7 +2131,7 @@ TraceMallocLogTimestamp(JSContext *cx, unsigned argc, jsval *vp)
}
static JSBool
TraceMallocDumpAllocations(JSContext *cx, unsigned argc, jsval *vp)
TraceMallocDumpAllocations(JSContext *cx, unsigned argc, JS::Value *vp)
{
if (!CheckUniversalXPConnectForTraceMalloc(cx))
return JS_FALSE;
@ -2174,7 +2174,7 @@ namespace dmd {
// how to use DMD.
static JSBool
ReportAndDump(JSContext *cx, unsigned argc, jsval *vp)
ReportAndDump(JSContext *cx, unsigned argc, JS::Value *vp)
{
JSString *str = JS_ValueToString(cx, argc ? JS_ARGV(cx, vp)[0] : JSVAL_VOID);
if (!str)
@ -2228,7 +2228,7 @@ void NS_JProfStopProfiling();
void NS_JProfClearCircular();
static JSBool
JProfStartProfilingJS(JSContext *cx, unsigned argc, jsval *vp)
JProfStartProfilingJS(JSContext *cx, unsigned argc, JS::Value *vp)
{
NS_JProfStartProfiling();
return JS_TRUE;
@ -2270,7 +2270,7 @@ void NS_JProfStartProfiling()
}
static JSBool
JProfStopProfilingJS(JSContext *cx, unsigned argc, jsval *vp)
JProfStopProfilingJS(JSContext *cx, unsigned argc, JS::Value *vp)
{
NS_JProfStopProfiling();
return JS_TRUE;
@ -2284,7 +2284,7 @@ NS_JProfStopProfiling()
}
static JSBool
JProfClearCircularJS(JSContext *cx, unsigned argc, jsval *vp)
JProfClearCircularJS(JSContext *cx, unsigned argc, JS::Value *vp)
{
NS_JProfClearCircular();
return JS_TRUE;
@ -2298,7 +2298,7 @@ NS_JProfClearCircular()
}
static JSBool
JProfSaveCircularJS(JSContext *cx, unsigned argc, jsval *vp)
JProfSaveCircularJS(JSContext *cx, unsigned argc, JS::Value *vp)
{
// Not ideal...
NS_JProfStopProfiling();
@ -3400,7 +3400,7 @@ NS_DOMReadStructuredClone(JSContext* cx,
// Construct the ImageData.
nsRefPtr<ImageData> imageData = new ImageData(width, height,
dataArray.toObject());
// Wrap it in a jsval.
// Wrap it in a JS::Value.
JSObject* global = JS_GetGlobalForScopeChain(cx);
if (!global) {
return nullptr;
@ -3626,7 +3626,8 @@ nsresult NS_CreateJSRuntime(nsIScriptRuntime **aRuntime)
// on-the-fly.
class nsJSArgArray MOZ_FINAL : public nsIJSArgArray {
public:
nsJSArgArray(JSContext *aContext, uint32_t argc, jsval *argv, nsresult *prv);
nsJSArgArray(JSContext *aContext, uint32_t argc, JS::Value *argv,
nsresult *prv);
~nsJSArgArray();
// nsISupports
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
@ -3643,11 +3644,11 @@ public:
protected:
JSContext *mContext;
jsval *mArgv;
JS::Value *mArgv;
uint32_t mArgc;
};
nsJSArgArray::nsJSArgArray(JSContext *aContext, uint32_t argc, jsval *argv,
nsJSArgArray::nsJSArgArray(JSContext *aContext, uint32_t argc, JS::Value *argv,
nsresult *prv) :
mContext(aContext),
mArgv(nullptr),
@ -3656,7 +3657,7 @@ nsJSArgArray::nsJSArgArray(JSContext *aContext, uint32_t argc, jsval *argv,
// copy the array - we don't know its lifetime, and ours is tied to xpcom
// refcounting. Alloc zero'd array so cleanup etc is safe.
if (argc) {
mArgv = (jsval *) PR_CALLOC(argc * sizeof(jsval));
mArgv = (JS::Value *) PR_CALLOC(argc * sizeof(JS::Value));
if (!mArgv) {
*prv = NS_ERROR_OUT_OF_MEMORY;
return;
@ -3703,9 +3704,9 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsJSArgArray)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(nsJSArgArray)
jsval *argv = tmp->mArgv;
JS::Value *argv = tmp->mArgv;
if (argv) {
jsval *end;
JS::Value *end;
for (end = argv + tmp->mArgc; argv < end; ++argv) {
if (JSVAL_IS_GCTHING(*argv))
NS_IMPL_CYCLE_COLLECTION_TRACE_JS_CALLBACK(JSVAL_TO_GCTHING(*argv),
@ -3771,7 +3772,7 @@ nsresult NS_CreateJSArgv(JSContext *aContext, uint32_t argc, void *argv,
{
nsresult rv;
nsJSArgArray *ret = new nsJSArgArray(aContext, argc,
static_cast<jsval *>(argv), &rv);
static_cast<JS::Value *>(argv), &rv);
if (ret == nullptr)
return NS_ERROR_OUT_OF_MEMORY;
if (NS_FAILED(rv)) {

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

@ -163,10 +163,10 @@ protected:
nsresult ConvertSupportsTojsvals(nsISupports *aArgs,
JSObject *aScope,
uint32_t *aArgc,
jsval **aArgv,
JS::Value **aArgv,
mozilla::Maybe<nsRootedJSValueArray> &aPoolRelease);
nsresult AddSupportsPrimitiveTojsvals(nsISupports *aArg, jsval *aArgv);
nsresult AddSupportsPrimitiveTojsvals(nsISupports *aArg, JS::Value *aArgv);
// given an nsISupports object (presumably an event target or some other
// DOM object), get (or create) the JSObject wrapping it.
@ -306,8 +306,8 @@ class nsIJSArgArray : public nsIArray
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IJSARGARRAY_IID)
// Bug 312003 describes why this must be "void **", but after calling argv
// may be cast to jsval* and the args found at:
// ((jsval*)argv)[0], ..., ((jsval*)argv)[argc - 1]
// may be cast to JS::Value* and the args found at:
// ((JS::Value*)argv)[0], ..., ((JS::Value*)argv)[argc - 1]
virtual nsresult GetArgs(uint32_t *argc, void **argv) = 0;
};

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

@ -180,7 +180,7 @@ nsJSScriptTimeoutHandler::Init(nsGlobalWindow *aWindow, bool *aIsInterval,
NS_ENSURE_SUCCESS(rv, rv);
uint32_t argc;
jsval *argv = nullptr;
JS::Value *argv = nullptr;
ncc->GetArgc(&argc);
ncc->GetArgvPtr(&argv);

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

@ -112,7 +112,7 @@ public:
return JS_TRUE;
}
JSBool init(JSContext* aContext, const jsval &v)
JSBool init(JSContext* aContext, const JS::Value &v)
{
return init(aContext, JSVAL_TO_STRING(v));
}

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

@ -44,9 +44,9 @@ nsStructuredCloneContainer::InitFromVariant(nsIVariant *aData, JSContext *aCx)
NS_ENSURE_ARG_POINTER(aData);
NS_ENSURE_ARG_POINTER(aCx);
// First, try to extract a jsval from the variant |aData|. This works only
// First, try to extract a JS::Value from the variant |aData|. This works only
// if the variant implements GetAsJSVal.
jsval jsData;
JS::Value jsData;
nsresult rv = aData->GetAsJSVal(&jsData);
NS_ENSURE_SUCCESS(rv, NS_ERROR_UNEXPECTED);
@ -113,8 +113,8 @@ nsStructuredCloneContainer::DeserializeToVariant(JSContext *aCx,
NS_ENSURE_ARG_POINTER(aData);
*aData = nullptr;
// Deserialize to a jsval.
jsval jsStateObj;
// Deserialize to a JS::Value.
JS::Value jsStateObj;
JSBool hasTransferable = false;
bool success = JS_ReadStructuredClone(aCx, mData, mSize, mVersion,
&jsStateObj, nullptr, nullptr) &&
@ -124,7 +124,7 @@ nsStructuredCloneContainer::DeserializeToVariant(JSContext *aCx,
MOZ_ASSERT(!hasTransferable);
NS_ENSURE_STATE(success && !hasTransferable);
// Now wrap the jsval as an nsIVariant.
// Now wrap the JS::Value as an nsIVariant.
nsCOMPtr<nsIVariant> varStateObj;
nsCOMPtr<nsIXPConnect> xpconnect = do_GetService(nsIXPConnect::GetCID());
NS_ENSURE_STATE(xpconnect);