зеркало из https://github.com/mozilla/gecko-dev.git
bug 723517 - Drop cx argumrent from JS_GetClass(cx, obj). r=luke
This commit is contained in:
Родитель
8989c4b971
Коммит
17db9a067b
|
@ -339,7 +339,7 @@ nsSecurityNameSet::InitializeNameSet(nsIScriptContext* aScriptContext)
|
|||
JSAutoRequest ar(cx);
|
||||
while ((proto = JS_GetPrototype(cx, obj)) != nsnull)
|
||||
obj = proto;
|
||||
JSClass *objectClass = JS_GET_CLASS(cx, obj);
|
||||
JSClass *objectClass = JS_GetClass(obj);
|
||||
|
||||
jsval v;
|
||||
if (!JS_GetProperty(cx, global, "netscape", &v))
|
||||
|
|
|
@ -111,7 +111,7 @@ XBLFinalize(JSContext *cx, JSObject *obj)
|
|||
static_cast<nsXBLDocumentInfo*>(::JS_GetPrivate(cx, obj));
|
||||
NS_RELEASE(docInfo);
|
||||
|
||||
nsXBLJSClass* c = static_cast<nsXBLJSClass*>(::JS_GET_CLASS(cx, obj));
|
||||
nsXBLJSClass* c = static_cast<nsXBLJSClass*>(::JS_GetClass(obj));
|
||||
c->Drop();
|
||||
}
|
||||
|
||||
|
@ -149,7 +149,7 @@ XBLResolve(JSContext *cx, JSObject *obj, jsid id, uintN flags,
|
|||
}
|
||||
|
||||
// We have this field. Time to install it. Get our node.
|
||||
JSClass* nodeClass = ::JS_GET_CLASS(cx, origObj);
|
||||
JSClass* nodeClass = ::JS_GetClass(origObj);
|
||||
if (!nodeClass) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
@ -1093,7 +1093,7 @@ nsXBLBinding::ChangeDocument(nsIDocument* aOldDocument, nsIDocument* aNewDocumen
|
|||
break;
|
||||
}
|
||||
|
||||
JSClass* clazz = ::JS_GET_CLASS(cx, proto);
|
||||
JSClass* clazz = ::JS_GetClass(proto);
|
||||
if (!clazz ||
|
||||
(~clazz->flags &
|
||||
(JSCLASS_HAS_PRIVATE | JSCLASS_PRIVATE_IS_NSISUPPORTS)) ||
|
||||
|
|
|
@ -121,7 +121,7 @@ nsXBLDocGlobalObject::doCheckAccess(JSContext *cx, JSObject *obj, jsid id, PRUin
|
|||
|
||||
// Make sure to actually operate on our object, and not some object further
|
||||
// down on the proto chain.
|
||||
while (JS_GET_CLASS(cx, obj) != &nsXBLDocGlobalObject::gSharedGlobalClass) {
|
||||
while (JS_GetClass(obj) != &nsXBLDocGlobalObject::gSharedGlobalClass) {
|
||||
obj = ::JS_GetPrototype(cx, obj);
|
||||
if (!obj) {
|
||||
::JS_ReportError(cx, "Invalid access to a global object property.");
|
||||
|
@ -129,7 +129,7 @@ nsXBLDocGlobalObject::doCheckAccess(JSContext *cx, JSObject *obj, jsid id, PRUin
|
|||
}
|
||||
}
|
||||
|
||||
nsresult rv = ssm->CheckPropertyAccess(cx, obj, JS_GET_CLASS(cx, obj)->name,
|
||||
nsresult rv = ssm->CheckPropertyAccess(cx, obj, JS_GetClass(obj)->name,
|
||||
id, accessType);
|
||||
return NS_SUCCEEDED(rv);
|
||||
}
|
||||
|
|
|
@ -4898,7 +4898,7 @@ nsDOMClassInfo::PostCreatePrototype(JSContext * cx, JSObject * proto)
|
|||
}
|
||||
|
||||
NS_ASSERTION(::JS_GetPrototype(cx, proto) &&
|
||||
JS_GET_CLASS(cx, ::JS_GetPrototype(cx, proto)) == sObjectClass,
|
||||
JS_GetClass(::JS_GetPrototype(cx, proto)) == sObjectClass,
|
||||
"Hmm, somebody did something evil?");
|
||||
|
||||
#ifdef DEBUG
|
||||
|
@ -5288,7 +5288,7 @@ nsWindowSH::InvalidateGlobalScopePolluter(JSContext *cx, JSObject *obj)
|
|||
JSAutoRequest ar(cx);
|
||||
|
||||
while ((proto = ::JS_GetPrototype(cx, obj))) {
|
||||
if (JS_GET_CLASS(cx, proto) == &sGlobalScopePolluterClass) {
|
||||
if (JS_GetClass(proto) == &sGlobalScopePolluterClass) {
|
||||
nsIHTMLDocument *doc = (nsIHTMLDocument *)::JS_GetPrivate(cx, proto);
|
||||
|
||||
NS_IF_RELEASE(doc);
|
||||
|
@ -5330,7 +5330,7 @@ nsWindowSH::InstallGlobalScopePolluter(JSContext *cx, JSObject *obj,
|
|||
// scope polluter (right before Object.prototype).
|
||||
|
||||
while ((proto = ::JS_GetPrototype(cx, o))) {
|
||||
if (JS_GET_CLASS(cx, proto) == sObjectClass) {
|
||||
if (JS_GetClass(proto) == sObjectClass) {
|
||||
// Set the global scope polluters prototype to Object.prototype
|
||||
::JS_SplicePrototype(cx, gsp, proto);
|
||||
|
||||
|
@ -5447,7 +5447,7 @@ nsWindowSH::GetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
|||
// only do that if the JSClass name is one that is likely to be a
|
||||
// window object.
|
||||
|
||||
const char *name = JS_GET_CLASS(cx, JSVAL_TO_OBJECT(*vp))->name;
|
||||
const char *name = JS_GetClass(JSVAL_TO_OBJECT(*vp))->name;
|
||||
|
||||
// The list of Window class names here need to be kept in sync
|
||||
// with the actual class names! The class name
|
||||
|
@ -5906,7 +5906,7 @@ nsDOMConstructor::HasInstance(nsIXPConnectWrappedNative *wrapper,
|
|||
dom_obj = wrapped_obj;
|
||||
}
|
||||
|
||||
JSClass *dom_class = JS_GET_CLASS(cx, dom_obj);
|
||||
JSClass *dom_class = JS_GetClass(dom_obj);
|
||||
if (!dom_class) {
|
||||
NS_ERROR("nsDOMConstructor::HasInstance can't get class.");
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
|
@ -6305,7 +6305,7 @@ ResolvePrototype(nsIXPConnect *aXPConnect, nsGlobalWindow *aWin, JSContext *cx,
|
|||
|
||||
if (proto &&
|
||||
(!xpc_proto_proto ||
|
||||
JS_GET_CLASS(cx, xpc_proto_proto) == sObjectClass)) {
|
||||
JS_GetClass(xpc_proto_proto) == sObjectClass)) {
|
||||
if (!JS_WrapObject(cx, &proto) ||
|
||||
!JS_SetPrototype(cx, dot_prototype, proto)) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
|
@ -8977,7 +8977,7 @@ nsHTMLDocumentSH::CallToGetPropMapper(JSContext *cx, uintN argc, jsval *vp)
|
|||
// another method, use the document.all callee object as self.
|
||||
JSObject *self;
|
||||
if (JSVAL_IS_OBJECT(JS_CALLEE(cx, vp)) &&
|
||||
::JS_GetClass(cx, JSVAL_TO_OBJECT(JS_CALLEE(cx, vp))) == &sHTMLDocumentAllClass) {
|
||||
::JS_GetClass(JSVAL_TO_OBJECT(JS_CALLEE(cx, vp))) == &sHTMLDocumentAllClass) {
|
||||
self = JSVAL_TO_OBJECT(JS_CALLEE(cx, vp));
|
||||
} else {
|
||||
self = JS_THIS_OBJECT(cx, vp);
|
||||
|
@ -8998,7 +8998,7 @@ nsHTMLDocumentSH::CallToGetPropMapper(JSContext *cx, uintN argc, jsval *vp)
|
|||
static inline JSObject *
|
||||
GetDocumentAllHelper(JSContext *cx, JSObject *obj)
|
||||
{
|
||||
while (obj && JS_GET_CLASS(cx, obj) != &sHTMLDocumentAllHelperClass) {
|
||||
while (obj && JS_GetClass(obj) != &sHTMLDocumentAllHelperClass) {
|
||||
obj = ::JS_GetPrototype(cx, obj);
|
||||
}
|
||||
|
||||
|
@ -9697,7 +9697,7 @@ nsHTMLPluginObjElementSH::SetupProtoChain(nsIXPConnectWrappedNative *wrapper,
|
|||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
if (pi_proto && JS_GET_CLASS(cx, pi_proto) != sObjectClass) {
|
||||
if (pi_proto && JS_GetClass(pi_proto) != sObjectClass) {
|
||||
// The plugin wrapper has a proto that's not Object.prototype, set
|
||||
// 'pi.__proto__.__proto__' to the original 'this.__proto__'
|
||||
if (pi_proto != my_proto && !::JS_SetPrototype(cx, pi_proto, my_proto)) {
|
||||
|
|
|
@ -1526,7 +1526,7 @@ nsDOMWindowUtils::GetClassName(const JS::Value& aObject, JSContext* aCx, char**
|
|||
return NS_ERROR_XPC_BAD_CONVERT_JS;
|
||||
}
|
||||
|
||||
*aName = NS_strdup(JS_GET_CLASS(aCx, JSVAL_TO_OBJECT(aObject))->name);
|
||||
*aName = NS_strdup(JS_GetClass(JSVAL_TO_OBJECT(aObject))->name);
|
||||
NS_ABORT_IF_FALSE(*aName, "NS_strdup should be infallible.");
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -2195,7 +2195,7 @@ nsJSContext::GetGlobalObject()
|
|||
}
|
||||
#endif
|
||||
|
||||
JSClass *c = JS_GET_CLASS(mContext, global);
|
||||
JSClass *c = JS_GetClass(global);
|
||||
|
||||
if (!c || ((~c->flags) & (JSCLASS_HAS_PRIVATE |
|
||||
JSCLASS_PRIVATE_IS_NSISUPPORTS))) {
|
||||
|
|
|
@ -109,7 +109,7 @@ nsJSUtils::GetStaticScriptGlobal(JSContext* aContext, JSObject* aObj)
|
|||
glob = JS_GetGlobalForObject(aContext, glob);
|
||||
NS_ABORT_IF_FALSE(glob, "Infallible returns null");
|
||||
|
||||
clazz = JS_GET_CLASS(aContext, glob);
|
||||
clazz = JS_GetClass(glob);
|
||||
|
||||
if (!clazz ||
|
||||
!(clazz->flags & JSCLASS_HAS_PRIVATE) ||
|
||||
|
|
|
@ -1038,7 +1038,7 @@ IDBObjectStore::StructuredCloneWriteCallback(JSContext* aCx,
|
|||
StructuredCloneWriteInfo* cloneWriteInfo =
|
||||
reinterpret_cast<StructuredCloneWriteInfo*>(aClosure);
|
||||
|
||||
if (JS_GET_CLASS(aCx, aObj) == &gDummyPropClass) {
|
||||
if (JS_GetClass(aObj) == &gDummyPropClass) {
|
||||
NS_ASSERTION(cloneWriteInfo->mOffsetToKeyProp == 0,
|
||||
"We should not have been here before!");
|
||||
cloneWriteInfo->mOffsetToKeyProp = js_GetSCOffset(aWriter);
|
||||
|
|
|
@ -1067,7 +1067,7 @@ nsJSObjWrapper::GetNewOrUsed(NPP npp, JSContext *cx, JSObject *obj)
|
|||
// class and private from the JSObject, neither of which cares about
|
||||
// compartments.
|
||||
|
||||
JSClass *clazz = JS_GET_CLASS(cx, obj);
|
||||
JSClass *clazz = JS_GetClass(obj);
|
||||
|
||||
if (clazz == &sNPObjectJSWrapperClass) {
|
||||
// obj is one of our own, its private data is the NPObject we're
|
||||
|
@ -1156,7 +1156,7 @@ nsJSObjWrapper::GetNewOrUsed(NPP npp, JSContext *cx, JSObject *obj)
|
|||
static NPObject *
|
||||
GetNPObject(JSContext *cx, JSObject *obj)
|
||||
{
|
||||
while (obj && JS_GET_CLASS(cx, obj) != &sNPObjectJSWrapperClass) {
|
||||
while (obj && JS_GetClass(obj) != &sNPObjectJSWrapperClass) {
|
||||
obj = ::JS_GetPrototype(cx, obj);
|
||||
}
|
||||
|
||||
|
@ -1392,7 +1392,7 @@ static JSBool
|
|||
CallNPMethodInternal(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
|
||||
jsval *rval, bool ctorCall)
|
||||
{
|
||||
while (obj && JS_GET_CLASS(cx, obj) != &sNPObjectJSWrapperClass) {
|
||||
while (obj && JS_GetClass(obj) != &sNPObjectJSWrapperClass) {
|
||||
obj = ::JS_GetPrototype(cx, obj);
|
||||
}
|
||||
|
||||
|
@ -1702,7 +1702,7 @@ NPObjWrapper_Convert(JSContext *cx, JSObject *obj, JSType hint, jsval *vp)
|
|||
}
|
||||
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_CANT_CONVERT_TO,
|
||||
JS_GET_CLASS(cx, obj)->name,
|
||||
JS_GetClass(obj)->name,
|
||||
hint == JSTYPE_VOID
|
||||
? "primitive type"
|
||||
: hint == JSTYPE_NUMBER
|
||||
|
@ -2075,7 +2075,7 @@ nsJSNPRuntime::OnPluginDestroy(NPP npp)
|
|||
// more than one of the plugin's scriptable objects on the prototype
|
||||
// chain).
|
||||
while (obj && (proto = ::JS_GetPrototype(cx, obj))) {
|
||||
if (JS_GET_CLASS(cx, proto) == &sNPObjectJSWrapperClass) {
|
||||
if (JS_GetClass(proto) == &sNPObjectJSWrapperClass) {
|
||||
// We found an NPObject on the proto chain, get its prototype...
|
||||
proto = ::JS_GetPrototype(cx, proto);
|
||||
|
||||
|
@ -2174,7 +2174,7 @@ CreateNPObjectMember(NPP npp, JSContext *cx, JSObject *obj, NPObject* npobj,
|
|||
// npobjWrapper is the JSObject through which we make sure we don't
|
||||
// outlive the underlying NPObject, so make sure it points to the
|
||||
// real JSObject wrapper for the NPObject.
|
||||
while (JS_GET_CLASS(cx, obj) != &sNPObjectJSWrapperClass) {
|
||||
while (JS_GetClass(obj) != &sNPObjectJSWrapperClass) {
|
||||
obj = ::JS_GetPrototype(cx, obj);
|
||||
}
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ inline
|
|||
bool
|
||||
EnsureObjectIsEventTarget(JSContext* aCx, JSObject* aObj, char* aFunctionName)
|
||||
{
|
||||
JSClass* classPtr = JS_GET_CLASS(aCx, aObj);
|
||||
JSClass* classPtr = JS_GetClass(aObj);
|
||||
if (ClassIsWorker(classPtr) || ClassIsWorkerGlobalScope(classPtr) ||
|
||||
ClassIsXMLHttpRequest(classPtr)) {
|
||||
return true;
|
||||
|
|
|
@ -220,7 +220,7 @@ protected:
|
|||
}
|
||||
JS_ReportErrorNumber(aCx, js_GetErrorMessage, NULL,
|
||||
JSMSG_INCOMPATIBLE_PROTO, sClass.name, aFunctionName,
|
||||
JS_GET_CLASS(aCx, aObj)->name);
|
||||
JS_GetClass(aObj)->name);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -275,7 +275,7 @@ private:
|
|||
static void
|
||||
Finalize(JSContext* aCx, JSObject* aObj)
|
||||
{
|
||||
JS_ASSERT(IsThisClass(JS_GET_CLASS(aCx, aObj)));
|
||||
JS_ASSERT(IsThisClass(JS_GetClass(aObj)));
|
||||
delete GetJSPrivateSafeish<Event>(aCx, aObj);
|
||||
}
|
||||
|
||||
|
@ -526,7 +526,7 @@ private:
|
|||
static MessageEvent*
|
||||
GetInstancePrivate(JSContext* aCx, JSObject* aObj, const char* aFunctionName)
|
||||
{
|
||||
JSClass* classPtr = JS_GET_CLASS(aCx, aObj);
|
||||
JSClass* classPtr = JS_GetClass(aObj);
|
||||
if (IsThisClass(classPtr)) {
|
||||
return GetJSPrivateSafeish<MessageEvent>(aCx, aObj);
|
||||
}
|
||||
|
@ -568,7 +568,7 @@ private:
|
|||
static void
|
||||
Finalize(JSContext* aCx, JSObject* aObj)
|
||||
{
|
||||
JS_ASSERT(IsThisClass(JS_GET_CLASS(aCx, aObj)));
|
||||
JS_ASSERT(IsThisClass(JS_GetClass(aObj)));
|
||||
MessageEvent* priv = GetJSPrivateSafeish<MessageEvent>(aCx, aObj);
|
||||
if (priv) {
|
||||
JS_free(aCx, priv->mData);
|
||||
|
@ -751,7 +751,7 @@ private:
|
|||
static ErrorEvent*
|
||||
GetInstancePrivate(JSContext* aCx, JSObject* aObj, const char* aFunctionName)
|
||||
{
|
||||
JSClass* classPtr = JS_GET_CLASS(aCx, aObj);
|
||||
JSClass* classPtr = JS_GetClass(aObj);
|
||||
if (IsThisClass(classPtr)) {
|
||||
return GetJSPrivateSafeish<ErrorEvent>(aCx, aObj);
|
||||
}
|
||||
|
@ -792,7 +792,7 @@ private:
|
|||
static void
|
||||
Finalize(JSContext* aCx, JSObject* aObj)
|
||||
{
|
||||
JS_ASSERT(IsThisClass(JS_GET_CLASS(aCx, aObj)));
|
||||
JS_ASSERT(IsThisClass(JS_GetClass(aObj)));
|
||||
delete GetJSPrivateSafeish<ErrorEvent>(aCx, aObj);
|
||||
}
|
||||
|
||||
|
@ -939,7 +939,7 @@ private:
|
|||
static ProgressEvent*
|
||||
GetInstancePrivate(JSContext* aCx, JSObject* aObj, const char* aFunctionName)
|
||||
{
|
||||
JSClass* classPtr = JS_GET_CLASS(aCx, aObj);
|
||||
JSClass* classPtr = JS_GetClass(aObj);
|
||||
if (classPtr == &sClass) {
|
||||
return GetJSPrivateSafeish<ProgressEvent>(aCx, aObj);
|
||||
}
|
||||
|
@ -978,7 +978,7 @@ private:
|
|||
static void
|
||||
Finalize(JSContext* aCx, JSObject* aObj)
|
||||
{
|
||||
JS_ASSERT(JS_GET_CLASS(aCx, aObj) == &sClass);
|
||||
JS_ASSERT(JS_GetClass(aObj) == &sClass);
|
||||
delete GetJSPrivateSafeish<ProgressEvent>(aCx, aObj);
|
||||
}
|
||||
|
||||
|
@ -1054,7 +1054,7 @@ Event*
|
|||
Event::GetPrivate(JSContext* aCx, JSObject* aObj)
|
||||
{
|
||||
if (aObj) {
|
||||
JSClass* classPtr = JS_GET_CLASS(aCx, aObj);
|
||||
JSClass* classPtr = JS_GetClass(aObj);
|
||||
if (IsThisClass(classPtr) ||
|
||||
MessageEvent::IsThisClass(classPtr) ||
|
||||
ErrorEvent::IsThisClass(classPtr) ||
|
||||
|
|
|
@ -113,7 +113,7 @@ private:
|
|||
static void
|
||||
Finalize(JSContext* aCx, JSObject* aObj)
|
||||
{
|
||||
JS_ASSERT(JS_GET_CLASS(aCx, aObj) == &sClass);
|
||||
JS_ASSERT(JS_GetClass(aObj) == &sClass);
|
||||
delete GetJSPrivateSafeish<DOMException>(aCx, aObj);
|
||||
}
|
||||
|
||||
|
@ -125,7 +125,7 @@ private:
|
|||
return false;
|
||||
}
|
||||
|
||||
JSClass* classPtr = JS_GET_CLASS(aCx, obj);
|
||||
JSClass* classPtr = JS_GetClass(obj);
|
||||
if (classPtr != &sClass) {
|
||||
JS_ReportErrorNumber(aCx, js_GetErrorMessage, NULL,
|
||||
JSMSG_INCOMPATIBLE_PROTO, sClass.name, "toString",
|
||||
|
@ -164,7 +164,7 @@ private:
|
|||
|
||||
int32 slot = JSID_TO_INT(aIdval);
|
||||
|
||||
JSClass* classPtr = JS_GET_CLASS(aCx, aObj);
|
||||
JSClass* classPtr = JS_GetClass(aObj);
|
||||
|
||||
if (classPtr != &sClass || !GetJSPrivateSafeish<DOMException>(aCx, aObj)) {
|
||||
JS_ReportErrorNumber(aCx, js_GetErrorMessage, NULL,
|
||||
|
@ -329,7 +329,7 @@ private:
|
|||
static void
|
||||
Finalize(JSContext* aCx, JSObject* aObj)
|
||||
{
|
||||
JS_ASSERT(JS_GET_CLASS(aCx, aObj) == &sClass);
|
||||
JS_ASSERT(JS_GetClass(aObj) == &sClass);
|
||||
delete GetJSPrivateSafeish<FileException>(aCx, aObj);
|
||||
}
|
||||
|
||||
|
@ -340,7 +340,7 @@ private:
|
|||
|
||||
int32 slot = JSID_TO_INT(aIdval);
|
||||
|
||||
JSClass* classPtr = JS_GET_CLASS(aCx, aObj);
|
||||
JSClass* classPtr = JS_GetClass(aObj);
|
||||
|
||||
if (classPtr != &sClass || !GetJSPrivateSafeish<FileException>(aCx, aObj)) {
|
||||
JS_ReportErrorNumber(aCx, js_GetErrorMessage, NULL,
|
||||
|
|
|
@ -108,7 +108,7 @@ private:
|
|||
|
||||
JS_ReportErrorNumber(aCx, js_GetErrorMessage, NULL,
|
||||
JSMSG_INCOMPATIBLE_PROTO, sClass.name, aFunctionName,
|
||||
JS_GET_CLASS(aCx, aObj)->name);
|
||||
JS_GetClass(aObj)->name);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -123,7 +123,7 @@ private:
|
|||
static void
|
||||
Finalize(JSContext* aCx, JSObject* aObj)
|
||||
{
|
||||
JS_ASSERT(JS_GET_CLASS(aCx, aObj) == &sClass);
|
||||
JS_ASSERT(JS_GetClass(aObj) == &sClass);
|
||||
|
||||
nsIDOMBlob* blob = GetPrivate(aCx, aObj);
|
||||
NS_IF_RELEASE(blob);
|
||||
|
@ -272,7 +272,7 @@ public:
|
|||
GetPrivate(JSContext* aCx, JSObject* aObj)
|
||||
{
|
||||
if (aObj) {
|
||||
JSClass* classPtr = JS_GET_CLASS(aCx, aObj);
|
||||
JSClass* classPtr = JS_GetClass(aObj);
|
||||
if (classPtr == &sClass) {
|
||||
nsISupports* priv = static_cast<nsISupports*>(JS_GetPrivate(aCx, aObj));
|
||||
nsCOMPtr<nsIDOMFile> file = do_QueryInterface(priv);
|
||||
|
@ -300,7 +300,7 @@ private:
|
|||
|
||||
JS_ReportErrorNumber(aCx, js_GetErrorMessage, NULL,
|
||||
JSMSG_INCOMPATIBLE_PROTO, sClass.name, aFunctionName,
|
||||
JS_GET_CLASS(aCx, aObj)->name);
|
||||
JS_GetClass(aObj)->name);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -315,7 +315,7 @@ private:
|
|||
static void
|
||||
Finalize(JSContext* aCx, JSObject* aObj)
|
||||
{
|
||||
JS_ASSERT(JS_GET_CLASS(aCx, aObj) == &sClass);
|
||||
JS_ASSERT(JS_GetClass(aObj) == &sClass);
|
||||
|
||||
nsIDOMFile* file = GetPrivate(aCx, aObj);
|
||||
NS_IF_RELEASE(file);
|
||||
|
@ -389,7 +389,7 @@ nsIDOMBlob*
|
|||
Blob::GetPrivate(JSContext* aCx, JSObject* aObj)
|
||||
{
|
||||
if (aObj) {
|
||||
JSClass* classPtr = JS_GET_CLASS(aCx, aObj);
|
||||
JSClass* classPtr = JS_GetClass(aObj);
|
||||
if (classPtr == &sClass || classPtr == File::Class()) {
|
||||
nsISupports* priv = static_cast<nsISupports*>(JS_GetPrivate(aCx, aObj));
|
||||
nsCOMPtr<nsIDOMBlob> blob = do_QueryInterface(priv);
|
||||
|
|
|
@ -88,7 +88,7 @@ GetDOMBlobFromJSObject(JSContext* aCx, JSObject* aObj) {
|
|||
}
|
||||
|
||||
JS_ReportErrorNumber(aCx, js_GetErrorMessage, NULL, JSMSG_UNEXPECTED_TYPE,
|
||||
aObj ? JS_GET_CLASS(aCx, aObj)->name : "Object", "not a Blob.");
|
||||
aObj ? JS_GetClass(aObj)->name : "Object", "not a Blob.");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -113,7 +113,7 @@ public:
|
|||
GetPrivate(JSContext* aCx, JSObject* aObj)
|
||||
{
|
||||
if (aObj) {
|
||||
JSClass* classPtr = JS_GET_CLASS(aCx, aObj);
|
||||
JSClass* classPtr = JS_GetClass(aObj);
|
||||
if (classPtr == &sClass) {
|
||||
FileReaderSyncPrivate* fileReader =
|
||||
GetJSPrivateSafeish<FileReaderSyncPrivate>(aCx, aObj);
|
||||
|
@ -134,7 +134,7 @@ private:
|
|||
|
||||
JS_ReportErrorNumber(aCx, js_GetErrorMessage, NULL,
|
||||
JSMSG_INCOMPATIBLE_PROTO, sClass.name, aFunctionName,
|
||||
JS_GET_CLASS(aCx, aObj)->name);
|
||||
JS_GetClass(aObj)->name);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -161,7 +161,7 @@ private:
|
|||
static void
|
||||
Finalize(JSContext* aCx, JSObject* aObj)
|
||||
{
|
||||
JS_ASSERT(JS_GET_CLASS(aCx, aObj) == &sClass);
|
||||
JS_ASSERT(JS_GetClass(aObj) == &sClass);
|
||||
FileReaderSyncPrivate* fileReader =
|
||||
GetJSPrivateSafeish<FileReaderSyncPrivate>(aCx, aObj);
|
||||
NS_IF_RELEASE(fileReader);
|
||||
|
|
|
@ -140,7 +140,7 @@ private:
|
|||
static void
|
||||
Finalize(JSContext* aCx, JSObject* aObj)
|
||||
{
|
||||
JS_ASSERT(JS_GET_CLASS(aCx, aObj) == &sClass);
|
||||
JS_ASSERT(JS_GetClass(aObj) == &sClass);
|
||||
delete static_cast<Location*>(JS_GetPrivate(aCx, aObj));
|
||||
}
|
||||
|
||||
|
@ -152,7 +152,7 @@ private:
|
|||
return false;
|
||||
}
|
||||
|
||||
JSClass* classPtr = JS_GET_CLASS(aCx, obj);
|
||||
JSClass* classPtr = JS_GetClass(obj);
|
||||
if (classPtr != &sClass) {
|
||||
JS_ReportErrorNumber(aCx, js_GetErrorMessage, NULL,
|
||||
JSMSG_INCOMPATIBLE_PROTO, sClass.name, "toString",
|
||||
|
@ -173,7 +173,7 @@ private:
|
|||
static JSBool
|
||||
GetProperty(JSContext* aCx, JSObject* aObj, jsid aIdval, jsval* aVp)
|
||||
{
|
||||
JSClass* classPtr = JS_GET_CLASS(aCx, aObj);
|
||||
JSClass* classPtr = JS_GetClass(aObj);
|
||||
if (classPtr != &sClass) {
|
||||
JS_ReportErrorNumber(aCx, js_GetErrorMessage, NULL,
|
||||
JSMSG_INCOMPATIBLE_PROTO, sClass.name, "GetProperty",
|
||||
|
|
|
@ -151,14 +151,14 @@ private:
|
|||
static void
|
||||
Finalize(JSContext* aCx, JSObject* aObj)
|
||||
{
|
||||
JS_ASSERT(JS_GET_CLASS(aCx, aObj) == &sClass);
|
||||
JS_ASSERT(JS_GetClass(aObj) == &sClass);
|
||||
delete static_cast<Navigator*>(JS_GetPrivate(aCx, aObj));
|
||||
}
|
||||
|
||||
static JSBool
|
||||
GetProperty(JSContext* aCx, JSObject* aObj, jsid aIdval, jsval* aVp)
|
||||
{
|
||||
JSClass* classPtr = JS_GET_CLASS(aCx, aObj);
|
||||
JSClass* classPtr = JS_GetClass(aObj);
|
||||
if (classPtr != &sClass) {
|
||||
JS_ReportErrorNumber(aCx, js_GetErrorMessage, NULL,
|
||||
JSMSG_INCOMPATIBLE_PROTO, sClass.name, "GetProperty",
|
||||
|
|
|
@ -241,7 +241,7 @@ private:
|
|||
static void
|
||||
Finalize(JSContext* aCx, JSObject* aObj)
|
||||
{
|
||||
JS_ASSERT(JS_GET_CLASS(aCx, aObj) == &sClass);
|
||||
JS_ASSERT(JS_GetClass(aObj) == &sClass);
|
||||
WorkerPrivate* worker = GetJSPrivateSafeish<WorkerPrivate>(aCx, aObj);
|
||||
if (worker) {
|
||||
worker->FinalizeInstance(aCx, true);
|
||||
|
@ -251,7 +251,7 @@ private:
|
|||
static void
|
||||
Trace(JSTracer* aTrc, JSObject* aObj)
|
||||
{
|
||||
JS_ASSERT(JS_GET_CLASS(aTrc->context, aObj) == &sClass);
|
||||
JS_ASSERT(JS_GetClass(aObj) == &sClass);
|
||||
WorkerPrivate* worker =
|
||||
GetJSPrivateSafeish<WorkerPrivate>(aTrc->context, aObj);
|
||||
if (worker) {
|
||||
|
@ -378,7 +378,7 @@ private:
|
|||
GetInstancePrivate(JSContext* aCx, JSObject* aObj, const char* aFunctionName)
|
||||
{
|
||||
if (aObj) {
|
||||
JSClass* classPtr = JS_GET_CLASS(aCx, aObj);
|
||||
JSClass* classPtr = JS_GetClass(aObj);
|
||||
if (classPtr == &sClass) {
|
||||
return GetJSPrivateSafeish<WorkerPrivate>(aCx, aObj);
|
||||
}
|
||||
|
@ -396,7 +396,7 @@ private:
|
|||
static void
|
||||
Finalize(JSContext* aCx, JSObject* aObj)
|
||||
{
|
||||
JS_ASSERT(JS_GET_CLASS(aCx, aObj) == &sClass);
|
||||
JS_ASSERT(JS_GetClass(aObj) == &sClass);
|
||||
WorkerPrivate* worker = GetJSPrivateSafeish<WorkerPrivate>(aCx, aObj);
|
||||
if (worker) {
|
||||
worker->FinalizeInstance(aCx, true);
|
||||
|
@ -406,7 +406,7 @@ private:
|
|||
static void
|
||||
Trace(JSTracer* aTrc, JSObject* aObj)
|
||||
{
|
||||
JS_ASSERT(JS_GET_CLASS(aTrc->context, aObj) == &sClass);
|
||||
JS_ASSERT(JS_GetClass(aObj) == &sClass);
|
||||
WorkerPrivate* worker =
|
||||
GetJSPrivateSafeish<WorkerPrivate>(aTrc->context, aObj);
|
||||
if (worker) {
|
||||
|
@ -427,7 +427,7 @@ WorkerPrivate*
|
|||
Worker::GetInstancePrivate(JSContext* aCx, JSObject* aObj,
|
||||
const char* aFunctionName)
|
||||
{
|
||||
JSClass* classPtr = JS_GET_CLASS(aCx, aObj);
|
||||
JSClass* classPtr = JS_GetClass(aObj);
|
||||
if (classPtr == &sClass || classPtr == ChromeWorker::Class()) {
|
||||
return GetJSPrivateSafeish<WorkerPrivate>(aCx, aObj);
|
||||
}
|
||||
|
@ -453,7 +453,7 @@ InitClass(JSContext* aCx, JSObject* aGlobal, JSObject* aProto,
|
|||
void
|
||||
ClearPrivateSlot(JSContext* aCx, JSObject* aObj, bool aSaveEventHandlers)
|
||||
{
|
||||
JSClass* clasp = JS_GET_CLASS(aCx, aObj);
|
||||
JSClass* clasp = JS_GetClass(aObj);
|
||||
JS_ASSERT(clasp == Worker::Class() || clasp == ChromeWorker::Class());
|
||||
|
||||
if (clasp == ChromeWorker::Class()) {
|
||||
|
|
|
@ -659,7 +659,7 @@ public:
|
|||
static JSBool
|
||||
InitPrivate(JSContext* aCx, JSObject* aObj, WorkerPrivate* aWorkerPrivate)
|
||||
{
|
||||
JS_ASSERT(JS_GET_CLASS(aCx, aObj) == &sClass);
|
||||
JS_ASSERT(JS_GetClass(aObj) == &sClass);
|
||||
JS_ASSERT(!GetJSPrivateSafeish<DedicatedWorkerGlobalScope>(aCx, aObj));
|
||||
|
||||
DedicatedWorkerGlobalScope* priv =
|
||||
|
@ -722,7 +722,7 @@ private:
|
|||
static DedicatedWorkerGlobalScope*
|
||||
GetInstancePrivate(JSContext* aCx, JSObject* aObj, const char* aFunctionName)
|
||||
{
|
||||
JSClass* classPtr = JS_GET_CLASS(aCx, aObj);
|
||||
JSClass* classPtr = JS_GetClass(aObj);
|
||||
if (classPtr == &sClass) {
|
||||
return GetJSPrivateSafeish<DedicatedWorkerGlobalScope>(aCx, aObj);
|
||||
}
|
||||
|
@ -757,7 +757,7 @@ private:
|
|||
static void
|
||||
Finalize(JSContext* aCx, JSObject* aObj)
|
||||
{
|
||||
JS_ASSERT(JS_GET_CLASS(aCx, aObj) == &sClass);
|
||||
JS_ASSERT(JS_GetClass(aObj) == &sClass);
|
||||
DedicatedWorkerGlobalScope* scope =
|
||||
GetJSPrivateSafeish<DedicatedWorkerGlobalScope>(aCx, aObj);
|
||||
if (scope) {
|
||||
|
@ -769,7 +769,7 @@ private:
|
|||
static void
|
||||
Trace(JSTracer* aTrc, JSObject* aObj)
|
||||
{
|
||||
JS_ASSERT(JS_GET_CLASS(aTrc->context, aObj) == &sClass);
|
||||
JS_ASSERT(JS_GetClass(aObj) == &sClass);
|
||||
DedicatedWorkerGlobalScope* scope =
|
||||
GetJSPrivateSafeish<DedicatedWorkerGlobalScope>(aTrc->context, aObj);
|
||||
if (scope) {
|
||||
|
@ -827,7 +827,7 @@ WorkerGlobalScope*
|
|||
WorkerGlobalScope::GetInstancePrivate(JSContext* aCx, JSObject* aObj,
|
||||
const char* aFunctionName)
|
||||
{
|
||||
JSClass* classPtr = JS_GET_CLASS(aCx, aObj);
|
||||
JSClass* classPtr = JS_GetClass(aObj);
|
||||
if (classPtr == &sClass || classPtr == DedicatedWorkerGlobalScope::Class()) {
|
||||
return GetJSPrivateSafeish<WorkerGlobalScope>(aCx, aObj);
|
||||
}
|
||||
|
|
|
@ -137,7 +137,7 @@ private:
|
|||
GetPrivate(JSContext* aCx, JSObject* aObj)
|
||||
{
|
||||
if (aObj) {
|
||||
JSClass* classPtr = JS_GET_CLASS(aCx, aObj);
|
||||
JSClass* classPtr = JS_GetClass(aObj);
|
||||
if (classPtr == &sClass) {
|
||||
return GetJSPrivateSafeish<XMLHttpRequestUpload>(aCx, aObj);
|
||||
}
|
||||
|
@ -155,7 +155,7 @@ private:
|
|||
|
||||
JS_ReportErrorNumber(aCx, js_GetErrorMessage, NULL,
|
||||
JSMSG_INCOMPATIBLE_PROTO, sClass.name, aFunctionName,
|
||||
JS_GET_CLASS(aCx, aObj)->name);
|
||||
JS_GetClass(aObj)->name);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -170,7 +170,7 @@ private:
|
|||
static void
|
||||
Finalize(JSContext* aCx, JSObject* aObj)
|
||||
{
|
||||
JS_ASSERT(JS_GET_CLASS(aCx, aObj) == &sClass);
|
||||
JS_ASSERT(JS_GetClass(aObj) == &sClass);
|
||||
XMLHttpRequestUpload* priv = GetPrivate(aCx, aObj);
|
||||
if (priv) {
|
||||
priv->FinalizeInstance(aCx);
|
||||
|
@ -181,7 +181,7 @@ private:
|
|||
static void
|
||||
Trace(JSTracer* aTrc, JSObject* aObj)
|
||||
{
|
||||
JS_ASSERT(JS_GET_CLASS(aTrc->context, aObj) == &sClass);
|
||||
JS_ASSERT(JS_GetClass(aObj) == &sClass);
|
||||
XMLHttpRequestUpload* priv = GetPrivate(aTrc->context, aObj);
|
||||
if (priv) {
|
||||
priv->TraceInstance(aTrc);
|
||||
|
@ -356,7 +356,7 @@ private:
|
|||
GetPrivate(JSContext* aCx, JSObject* aObj)
|
||||
{
|
||||
if (aObj) {
|
||||
JSClass* classPtr = JS_GET_CLASS(aCx, aObj);
|
||||
JSClass* classPtr = JS_GetClass(aObj);
|
||||
if (classPtr == &sClass) {
|
||||
return GetJSPrivateSafeish<XMLHttpRequestPrivate>(aCx, aObj);
|
||||
}
|
||||
|
@ -374,7 +374,7 @@ private:
|
|||
|
||||
JS_ReportErrorNumber(aCx, js_GetErrorMessage, NULL,
|
||||
JSMSG_INCOMPATIBLE_PROTO, sClass.name, aFunctionName,
|
||||
JS_GET_CLASS(aCx, aObj)->name);
|
||||
JS_GetClass(aObj)->name);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -423,7 +423,7 @@ private:
|
|||
static void
|
||||
Finalize(JSContext* aCx, JSObject* aObj)
|
||||
{
|
||||
JS_ASSERT(JS_GET_CLASS(aCx, aObj) == &sClass);
|
||||
JS_ASSERT(JS_GetClass(aObj) == &sClass);
|
||||
XMLHttpRequestPrivate* priv = GetPrivate(aCx, aObj);
|
||||
if (priv) {
|
||||
priv->FinalizeInstance(aCx);
|
||||
|
@ -434,7 +434,7 @@ private:
|
|||
static void
|
||||
Trace(JSTracer* aTrc, JSObject* aObj)
|
||||
{
|
||||
JS_ASSERT(JS_GET_CLASS(aTrc->context, aObj) == &sClass);
|
||||
JS_ASSERT(JS_GetClass(aObj) == &sClass);
|
||||
XMLHttpRequestPrivate* priv = GetPrivate(aTrc->context, aObj);
|
||||
if (priv) {
|
||||
priv->TraceInstance(aTrc);
|
||||
|
@ -878,7 +878,7 @@ bool
|
|||
XMLHttpRequestUpload::UpdateState(JSContext* aCx, JSObject* aObj,
|
||||
const xhr::StateData& aNewState)
|
||||
{
|
||||
JS_ASSERT(JS_GET_CLASS(aCx, aObj) == &sClass);
|
||||
JS_ASSERT(JS_GetClass(aObj) == &sClass);
|
||||
|
||||
jsval parentVal;
|
||||
if (!JS_GetReservedSlot(aCx, aObj, SLOT_xhrParent, &parentVal)) {
|
||||
|
|
|
@ -819,8 +819,7 @@ jsd_GetValueClassName(JSDContext* jsdc, JSDValue* jsdval)
|
|||
|
||||
return NULL;
|
||||
}
|
||||
if(JS_GET_CLASS(jsdc->dumbContext, obj))
|
||||
jsdval->className = JS_GET_CLASS(jsdc->dumbContext, obj)->name;
|
||||
jsdval->className = JS_GetClass(obj)->name;
|
||||
JS_LeaveCrossCompartmentCall(call);
|
||||
JS_EndRequest(jsdc->dumbContext);
|
||||
}
|
||||
|
|
|
@ -482,7 +482,7 @@ GetABICode(JSContext* cx, JSObject* obj)
|
|||
{
|
||||
// make sure we have an object representing a CABI class,
|
||||
// and extract the enumerated class type from the reserved slot.
|
||||
if (JS_GET_CLASS(cx, obj) != &sCABIClass)
|
||||
if (JS_GetClass(obj) != &sCABIClass)
|
||||
return INVALID_ABI;
|
||||
|
||||
jsval result;
|
||||
|
@ -923,16 +923,16 @@ InitTypeClasses(JSContext* cx, JSObject* parent)
|
|||
}
|
||||
|
||||
bool
|
||||
IsCTypesGlobal(JSContext* cx, JSObject* obj)
|
||||
IsCTypesGlobal(JSObject* obj)
|
||||
{
|
||||
return JS_GET_CLASS(cx, obj) == &sCTypesGlobalClass;
|
||||
return JS_GetClass(obj) == &sCTypesGlobalClass;
|
||||
}
|
||||
|
||||
// Get the JSCTypesCallbacks struct from the 'ctypes' object 'obj'.
|
||||
JSCTypesCallbacks*
|
||||
GetCallbacks(JSContext* cx, JSObject* obj)
|
||||
{
|
||||
JS_ASSERT(IsCTypesGlobal(cx, obj));
|
||||
JS_ASSERT(IsCTypesGlobal(obj));
|
||||
|
||||
jsval result;
|
||||
ASSERT_OK(JS_GetReservedSlot(cx, obj, SLOT_CALLBACKS, &result));
|
||||
|
@ -974,7 +974,7 @@ JS_SetCTypesCallbacks(JSContext* cx,
|
|||
JSCTypesCallbacks* callbacks)
|
||||
{
|
||||
JS_ASSERT(callbacks);
|
||||
JS_ASSERT(IsCTypesGlobal(cx, ctypesObj));
|
||||
JS_ASSERT(IsCTypesGlobal(ctypesObj));
|
||||
|
||||
// Set the callbacks on a reserved slot.
|
||||
return JS_SetReservedSlot(cx, ctypesObj, SLOT_CALLBACKS,
|
||||
|
@ -1201,7 +1201,7 @@ jsvalToInteger(JSContext* cx, jsval val, IntegerType* result)
|
|||
}
|
||||
if (!JSVAL_IS_PRIMITIVE(val)) {
|
||||
JSObject* obj = JSVAL_TO_OBJECT(val);
|
||||
if (CData::IsCData(cx, obj)) {
|
||||
if (CData::IsCData(obj)) {
|
||||
JSObject* typeObj = CData::GetCType(cx, obj);
|
||||
void* data = CData::GetData(cx, obj);
|
||||
|
||||
|
@ -1235,13 +1235,13 @@ jsvalToInteger(JSContext* cx, jsval val, IntegerType* result)
|
|||
}
|
||||
}
|
||||
|
||||
if (Int64::IsInt64(cx, obj)) {
|
||||
if (Int64::IsInt64(obj)) {
|
||||
// Make sure the integer fits in IntegerType.
|
||||
int64_t i = Int64Base::GetInt(cx, obj);
|
||||
return ConvertExact(i, result);
|
||||
}
|
||||
|
||||
if (UInt64::IsUInt64(cx, obj)) {
|
||||
if (UInt64::IsUInt64(obj)) {
|
||||
// Make sure the integer fits in IntegerType.
|
||||
uint64_t i = Int64Base::GetInt(cx, obj);
|
||||
return ConvertExact(i, result);
|
||||
|
@ -1282,7 +1282,7 @@ jsvalToFloat(JSContext *cx, jsval val, FloatType* result)
|
|||
}
|
||||
if (!JSVAL_IS_PRIMITIVE(val)) {
|
||||
JSObject* obj = JSVAL_TO_OBJECT(val);
|
||||
if (CData::IsCData(cx, obj)) {
|
||||
if (CData::IsCData(obj)) {
|
||||
JSObject* typeObj = CData::GetCType(cx, obj);
|
||||
void* data = CData::GetData(cx, obj);
|
||||
|
||||
|
@ -1407,13 +1407,13 @@ jsvalToBigInteger(JSContext* cx,
|
|||
// Allow conversion from an Int64 or UInt64 object directly.
|
||||
JSObject* obj = JSVAL_TO_OBJECT(val);
|
||||
|
||||
if (UInt64::IsUInt64(cx, obj)) {
|
||||
if (UInt64::IsUInt64(obj)) {
|
||||
// Make sure the integer fits in IntegerType.
|
||||
uint64_t i = Int64Base::GetInt(cx, obj);
|
||||
return ConvertExact(i, result);
|
||||
}
|
||||
|
||||
if (Int64::IsInt64(cx, obj)) {
|
||||
if (Int64::IsInt64(obj)) {
|
||||
// Make sure the integer fits in IntegerType.
|
||||
int64_t i = Int64Base::GetInt(cx, obj);
|
||||
return ConvertExact(i, result);
|
||||
|
@ -1463,13 +1463,13 @@ jsidToBigInteger(JSContext* cx,
|
|||
// Allow conversion from an Int64 or UInt64 object directly.
|
||||
JSObject* obj = JSID_TO_OBJECT(val);
|
||||
|
||||
if (UInt64::IsUInt64(cx, obj)) {
|
||||
if (UInt64::IsUInt64(obj)) {
|
||||
// Make sure the integer fits in IntegerType.
|
||||
uint64_t i = Int64Base::GetInt(cx, obj);
|
||||
return ConvertExact(i, result);
|
||||
}
|
||||
|
||||
if (Int64::IsInt64(cx, obj)) {
|
||||
if (Int64::IsInt64(obj)) {
|
||||
// Make sure the integer fits in IntegerType.
|
||||
int64_t i = Int64Base::GetInt(cx, obj);
|
||||
return ConvertExact(i, result);
|
||||
|
@ -1519,12 +1519,12 @@ jsvalToIntegerExplicit(JSContext* cx, jsval val, IntegerType* result)
|
|||
if (!JSVAL_IS_PRIMITIVE(val)) {
|
||||
// Convert Int64 and UInt64 values by C-style cast.
|
||||
JSObject* obj = JSVAL_TO_OBJECT(val);
|
||||
if (Int64::IsInt64(cx, obj)) {
|
||||
if (Int64::IsInt64(obj)) {
|
||||
int64_t i = Int64Base::GetInt(cx, obj);
|
||||
*result = IntegerType(i);
|
||||
return true;
|
||||
}
|
||||
if (UInt64::IsUInt64(cx, obj)) {
|
||||
if (UInt64::IsUInt64(obj)) {
|
||||
uint64_t i = Int64Base::GetInt(cx, obj);
|
||||
*result = IntegerType(i);
|
||||
return true;
|
||||
|
@ -1563,7 +1563,7 @@ jsvalToPtrExplicit(JSContext* cx, jsval val, uintptr_t* result)
|
|||
}
|
||||
if (!JSVAL_IS_PRIMITIVE(val)) {
|
||||
JSObject* obj = JSVAL_TO_OBJECT(val);
|
||||
if (Int64::IsInt64(cx, obj)) {
|
||||
if (Int64::IsInt64(obj)) {
|
||||
int64_t i = Int64Base::GetInt(cx, obj);
|
||||
intptr_t p = intptr_t(i);
|
||||
|
||||
|
@ -1574,7 +1574,7 @@ jsvalToPtrExplicit(JSContext* cx, jsval val, uintptr_t* result)
|
|||
return true;
|
||||
}
|
||||
|
||||
if (UInt64::IsUInt64(cx, obj)) {
|
||||
if (UInt64::IsUInt64(obj)) {
|
||||
uint64_t i = Int64Base::GetInt(cx, obj);
|
||||
|
||||
// Make sure the integer fits in the alotted precision.
|
||||
|
@ -1646,7 +1646,7 @@ ConvertToJS(JSContext* cx,
|
|||
bool ownResult,
|
||||
jsval* result)
|
||||
{
|
||||
JS_ASSERT(!parentObj || CData::IsCData(cx, parentObj));
|
||||
JS_ASSERT(!parentObj || CData::IsCData(parentObj));
|
||||
JS_ASSERT(!parentObj || !ownResult);
|
||||
JS_ASSERT(!wantPrimitive || !ownResult);
|
||||
|
||||
|
@ -1762,7 +1762,7 @@ ImplicitConvert(JSContext* cx,
|
|||
JSObject* sourceData = NULL;
|
||||
JSObject* sourceType = NULL;
|
||||
if (!JSVAL_IS_PRIMITIVE(val) &&
|
||||
CData::IsCData(cx, JSVAL_TO_OBJECT(val))) {
|
||||
CData::IsCData(JSVAL_TO_OBJECT(val))) {
|
||||
sourceData = JSVAL_TO_OBJECT(val);
|
||||
sourceType = CData::GetCType(cx, sourceData);
|
||||
|
||||
|
@ -2567,7 +2567,7 @@ CType::ConstructData(JSContext* cx,
|
|||
{
|
||||
// get the callee object...
|
||||
JSObject* obj = JSVAL_TO_OBJECT(JS_CALLEE(cx, vp));
|
||||
if (!CType::IsCType(cx, obj)) {
|
||||
if (!CType::IsCType(obj)) {
|
||||
JS_ReportError(cx, "not a CType");
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
@ -2829,21 +2829,21 @@ CType::Trace(JSTracer* trc, JSObject* obj)
|
|||
}
|
||||
|
||||
bool
|
||||
CType::IsCType(JSContext* cx, JSObject* obj)
|
||||
CType::IsCType(JSObject* obj)
|
||||
{
|
||||
return JS_GET_CLASS(cx, obj) == &sCTypeClass;
|
||||
return JS_GetClass(obj) == &sCTypeClass;
|
||||
}
|
||||
|
||||
bool
|
||||
CType::IsCTypeProto(JSContext* cx, JSObject* obj)
|
||||
CType::IsCTypeProto(JSObject* obj)
|
||||
{
|
||||
return JS_GET_CLASS(cx, obj) == &sCTypeProtoClass;
|
||||
return JS_GetClass(obj) == &sCTypeProtoClass;
|
||||
}
|
||||
|
||||
TypeCode
|
||||
CType::GetTypeCode(JSContext* cx, JSObject* typeObj)
|
||||
{
|
||||
JS_ASSERT(IsCType(cx, typeObj));
|
||||
JS_ASSERT(IsCType(typeObj));
|
||||
|
||||
jsval result;
|
||||
ASSERT_OK(JS_GetReservedSlot(cx, typeObj, SLOT_TYPECODE, &result));
|
||||
|
@ -2853,7 +2853,7 @@ CType::GetTypeCode(JSContext* cx, JSObject* typeObj)
|
|||
bool
|
||||
CType::TypesEqual(JSContext* cx, JSObject* t1, JSObject* t2)
|
||||
{
|
||||
JS_ASSERT(IsCType(cx, t1) && IsCType(cx, t2));
|
||||
JS_ASSERT(IsCType(t1) && IsCType(t2));
|
||||
|
||||
// Fast path: check for object equality.
|
||||
if (t1 == t2)
|
||||
|
@ -2922,7 +2922,7 @@ CType::TypesEqual(JSContext* cx, JSObject* t1, JSObject* t2)
|
|||
bool
|
||||
CType::GetSafeSize(JSContext* cx, JSObject* obj, size_t* result)
|
||||
{
|
||||
JS_ASSERT(CType::IsCType(cx, obj));
|
||||
JS_ASSERT(CType::IsCType(obj));
|
||||
|
||||
jsval size;
|
||||
ASSERT_OK(JS_GetReservedSlot(cx, obj, SLOT_SIZE, &size));
|
||||
|
@ -2945,7 +2945,7 @@ CType::GetSafeSize(JSContext* cx, JSObject* obj, size_t* result)
|
|||
size_t
|
||||
CType::GetSize(JSContext* cx, JSObject* obj)
|
||||
{
|
||||
JS_ASSERT(CType::IsCType(cx, obj));
|
||||
JS_ASSERT(CType::IsCType(obj));
|
||||
|
||||
jsval size;
|
||||
ASSERT_OK(JS_GetReservedSlot(cx, obj, SLOT_SIZE, &size));
|
||||
|
@ -2963,7 +2963,7 @@ CType::GetSize(JSContext* cx, JSObject* obj)
|
|||
bool
|
||||
CType::IsSizeDefined(JSContext* cx, JSObject* obj)
|
||||
{
|
||||
JS_ASSERT(CType::IsCType(cx, obj));
|
||||
JS_ASSERT(CType::IsCType(obj));
|
||||
|
||||
jsval size;
|
||||
ASSERT_OK(JS_GetReservedSlot(cx, obj, SLOT_SIZE, &size));
|
||||
|
@ -2977,7 +2977,7 @@ CType::IsSizeDefined(JSContext* cx, JSObject* obj)
|
|||
size_t
|
||||
CType::GetAlignment(JSContext* cx, JSObject* obj)
|
||||
{
|
||||
JS_ASSERT(CType::IsCType(cx, obj));
|
||||
JS_ASSERT(CType::IsCType(obj));
|
||||
|
||||
jsval slot;
|
||||
ASSERT_OK(JS_GetReservedSlot(cx, obj, SLOT_ALIGN, &slot));
|
||||
|
@ -2987,7 +2987,7 @@ CType::GetAlignment(JSContext* cx, JSObject* obj)
|
|||
ffi_type*
|
||||
CType::GetFFIType(JSContext* cx, JSObject* obj)
|
||||
{
|
||||
JS_ASSERT(CType::IsCType(cx, obj));
|
||||
JS_ASSERT(CType::IsCType(obj));
|
||||
|
||||
jsval slot;
|
||||
ASSERT_OK(JS_GetReservedSlot(cx, obj, SLOT_FFITYPE, &slot));
|
||||
|
@ -3020,7 +3020,7 @@ CType::GetFFIType(JSContext* cx, JSObject* obj)
|
|||
JSString*
|
||||
CType::GetName(JSContext* cx, JSObject* obj)
|
||||
{
|
||||
JS_ASSERT(CType::IsCType(cx, obj));
|
||||
JS_ASSERT(CType::IsCType(obj));
|
||||
|
||||
jsval string;
|
||||
ASSERT_OK(JS_GetReservedSlot(cx, obj, SLOT_NAME, &string));
|
||||
|
@ -3044,7 +3044,7 @@ CType::GetProtoFromCtor(JSContext* cx, JSObject* obj, CTypeProtoSlot slot)
|
|||
jsval protoslot = js::GetFunctionNativeReserved(obj, SLOT_FN_CTORPROTO);
|
||||
JSObject* proto = JSVAL_TO_OBJECT(protoslot);
|
||||
JS_ASSERT(proto);
|
||||
JS_ASSERT(CType::IsCTypeProto(cx, proto));
|
||||
JS_ASSERT(CType::IsCTypeProto(proto));
|
||||
|
||||
// Get the desired prototype.
|
||||
jsval result;
|
||||
|
@ -3055,12 +3055,12 @@ CType::GetProtoFromCtor(JSContext* cx, JSObject* obj, CTypeProtoSlot slot)
|
|||
JSObject*
|
||||
CType::GetProtoFromType(JSContext* cx, JSObject* obj, CTypeProtoSlot slot)
|
||||
{
|
||||
JS_ASSERT(IsCType(cx, obj));
|
||||
JS_ASSERT(IsCType(obj));
|
||||
|
||||
// Get the prototype of the type object.
|
||||
JSObject* proto = JS_GetPrototype(cx, obj);
|
||||
JS_ASSERT(proto);
|
||||
JS_ASSERT(CType::IsCTypeProto(cx, proto));
|
||||
JS_ASSERT(CType::IsCTypeProto(proto));
|
||||
|
||||
// Get the requested ctypes.{Pointer,Array,Struct,Function}Type.prototype.
|
||||
jsval result;
|
||||
|
@ -3071,13 +3071,13 @@ CType::GetProtoFromType(JSContext* cx, JSObject* obj, CTypeProtoSlot slot)
|
|||
JSBool
|
||||
CType::PrototypeGetter(JSContext* cx, JSObject* obj, jsid idval, jsval* vp)
|
||||
{
|
||||
if (!(CType::IsCType(cx, obj) || CType::IsCTypeProto(cx, obj))) {
|
||||
if (!(CType::IsCType(obj) || CType::IsCTypeProto(obj))) {
|
||||
JS_ReportError(cx, "not a CType or CTypeProto");
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
unsigned slot = CType::IsCTypeProto(cx, obj) ? (unsigned) SLOT_OURDATAPROTO
|
||||
: (unsigned) SLOT_PROTO;
|
||||
unsigned slot = CType::IsCTypeProto(obj) ? (unsigned) SLOT_OURDATAPROTO
|
||||
: (unsigned) SLOT_PROTO;
|
||||
ASSERT_OK(JS_GetReservedSlot(cx, obj, slot, vp));
|
||||
JS_ASSERT(!JSVAL_IS_PRIMITIVE(*vp) || JSVAL_IS_VOID(*vp));
|
||||
return JS_TRUE;
|
||||
|
@ -3086,7 +3086,7 @@ CType::PrototypeGetter(JSContext* cx, JSObject* obj, jsid idval, jsval* vp)
|
|||
JSBool
|
||||
CType::NameGetter(JSContext* cx, JSObject* obj, jsid idval, jsval* vp)
|
||||
{
|
||||
if (!CType::IsCType(cx, obj)) {
|
||||
if (!CType::IsCType(obj)) {
|
||||
JS_ReportError(cx, "not a CType");
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
@ -3102,7 +3102,7 @@ CType::NameGetter(JSContext* cx, JSObject* obj, jsid idval, jsval* vp)
|
|||
JSBool
|
||||
CType::SizeGetter(JSContext* cx, JSObject* obj, jsid idval, jsval* vp)
|
||||
{
|
||||
if (!CType::IsCType(cx, obj)) {
|
||||
if (!CType::IsCType(obj)) {
|
||||
JS_ReportError(cx, "not a CType");
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
@ -3115,7 +3115,7 @@ CType::SizeGetter(JSContext* cx, JSObject* obj, jsid idval, jsval* vp)
|
|||
JSBool
|
||||
CType::PtrGetter(JSContext* cx, JSObject* obj, jsid idval, jsval* vp)
|
||||
{
|
||||
if (!CType::IsCType(cx, obj)) {
|
||||
if (!CType::IsCType(obj)) {
|
||||
JS_ReportError(cx, "not a CType");
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
@ -3132,7 +3132,7 @@ JSBool
|
|||
CType::CreateArray(JSContext* cx, uintN argc, jsval* vp)
|
||||
{
|
||||
JSObject* baseType = JS_THIS_OBJECT(cx, vp);
|
||||
if (!baseType || !CType::IsCType(cx, baseType)) {
|
||||
if (!baseType || !CType::IsCType(baseType)) {
|
||||
JS_ReportError(cx, "not a CType");
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
@ -3163,9 +3163,7 @@ JSBool
|
|||
CType::ToString(JSContext* cx, uintN argc, jsval* vp)
|
||||
{
|
||||
JSObject* obj = JS_THIS_OBJECT(cx, vp);
|
||||
if (!obj ||
|
||||
!(CType::IsCType(cx, obj) || CType::IsCTypeProto(cx, obj)))
|
||||
{
|
||||
if (!obj || !(CType::IsCType(obj) || CType::IsCTypeProto(obj))) {
|
||||
JS_ReportError(cx, "not a CType");
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
@ -3173,7 +3171,7 @@ CType::ToString(JSContext* cx, uintN argc, jsval* vp)
|
|||
// Create the appropriate string depending on whether we're sCTypeClass or
|
||||
// sCTypeProtoClass.
|
||||
JSString* result;
|
||||
if (CType::IsCType(cx, obj)) {
|
||||
if (CType::IsCType(obj)) {
|
||||
AutoString type;
|
||||
AppendString(type, "type ");
|
||||
AppendString(type, GetName(cx, obj));
|
||||
|
@ -3194,7 +3192,7 @@ CType::ToSource(JSContext* cx, uintN argc, jsval* vp)
|
|||
{
|
||||
JSObject* obj = JS_THIS_OBJECT(cx, vp);
|
||||
if (!obj ||
|
||||
!(CType::IsCType(cx, obj) || CType::IsCTypeProto(cx, obj)))
|
||||
!(CType::IsCType(obj) || CType::IsCTypeProto(obj)))
|
||||
{
|
||||
JS_ReportError(cx, "not a CType");
|
||||
return JS_FALSE;
|
||||
|
@ -3203,7 +3201,7 @@ CType::ToSource(JSContext* cx, uintN argc, jsval* vp)
|
|||
// Create the appropriate string depending on whether we're sCTypeClass or
|
||||
// sCTypeProtoClass.
|
||||
JSString* result;
|
||||
if (CType::IsCType(cx, obj)) {
|
||||
if (CType::IsCType(obj)) {
|
||||
AutoString source;
|
||||
BuildTypeSource(cx, obj, false, source);
|
||||
result = NewUCString(cx, source);
|
||||
|
@ -3220,13 +3218,13 @@ CType::ToSource(JSContext* cx, uintN argc, jsval* vp)
|
|||
JSBool
|
||||
CType::HasInstance(JSContext* cx, JSObject* obj, const jsval* v, JSBool* bp)
|
||||
{
|
||||
JS_ASSERT(CType::IsCType(cx, obj));
|
||||
JS_ASSERT(CType::IsCType(obj));
|
||||
|
||||
jsval slot;
|
||||
ASSERT_OK(JS_GetReservedSlot(cx, obj, SLOT_PROTO, &slot));
|
||||
JSObject* prototype = JSVAL_TO_OBJECT(slot);
|
||||
JS_ASSERT(prototype);
|
||||
JS_ASSERT(CData::IsCDataProto(cx, prototype));
|
||||
JS_ASSERT(CData::IsCDataProto(prototype));
|
||||
|
||||
*bp = JS_FALSE;
|
||||
if (JSVAL_IS_PRIMITIVE(*v))
|
||||
|
@ -3256,7 +3254,7 @@ PointerType::Create(JSContext* cx, uintN argc, jsval* vp)
|
|||
}
|
||||
|
||||
jsval arg = JS_ARGV(cx, vp)[0];
|
||||
if (JSVAL_IS_PRIMITIVE(arg) || !CType::IsCType(cx, JSVAL_TO_OBJECT(arg))) {
|
||||
if (JSVAL_IS_PRIMITIVE(arg) || !CType::IsCType(JSVAL_TO_OBJECT(arg))) {
|
||||
JS_ReportError(cx, "first argument must be a CType");
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
@ -3311,7 +3309,7 @@ PointerType::ConstructData(JSContext* cx,
|
|||
uintN argc,
|
||||
jsval* vp)
|
||||
{
|
||||
if (!CType::IsCType(cx, obj) || CType::GetTypeCode(cx, obj) != TYPE_pointer) {
|
||||
if (!CType::IsCType(obj) || CType::GetTypeCode(cx, obj) != TYPE_pointer) {
|
||||
JS_ReportError(cx, "not a PointerType");
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
@ -3404,7 +3402,7 @@ PointerType::TargetTypeGetter(JSContext* cx,
|
|||
jsid idval,
|
||||
jsval* vp)
|
||||
{
|
||||
if (!CType::IsCType(cx, obj) || CType::GetTypeCode(cx, obj) != TYPE_pointer) {
|
||||
if (!CType::IsCType(obj) || CType::GetTypeCode(cx, obj) != TYPE_pointer) {
|
||||
JS_ReportError(cx, "not a PointerType");
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
@ -3418,7 +3416,7 @@ JSBool
|
|||
PointerType::IsNull(JSContext* cx, uintN argc, jsval* vp)
|
||||
{
|
||||
JSObject* obj = JS_THIS_OBJECT(cx, vp);
|
||||
if (!obj || !CData::IsCData(cx, obj)) {
|
||||
if (!obj || !CData::IsCData(obj)) {
|
||||
JS_ReportError(cx, "not a CData");
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
@ -3440,7 +3438,7 @@ JSBool
|
|||
PointerType::OffsetBy(JSContext* cx, intN offset, jsval* vp)
|
||||
{
|
||||
JSObject* obj = JS_THIS_OBJECT(cx, vp);
|
||||
if (!obj || !CData::IsCData(cx, obj)) {
|
||||
if (!obj || !CData::IsCData(obj)) {
|
||||
JS_ReportError(cx, "not a CData");
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
@ -3488,7 +3486,7 @@ PointerType::ContentsGetter(JSContext* cx,
|
|||
jsid idval,
|
||||
jsval* vp)
|
||||
{
|
||||
if (!CData::IsCData(cx, obj)) {
|
||||
if (!CData::IsCData(obj)) {
|
||||
JS_ReportError(cx, "not a CData");
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
@ -3527,7 +3525,7 @@ PointerType::ContentsSetter(JSContext* cx,
|
|||
JSBool strict,
|
||||
jsval* vp)
|
||||
{
|
||||
if (!CData::IsCData(cx, obj)) {
|
||||
if (!CData::IsCData(obj)) {
|
||||
JS_ReportError(cx, "not a CData");
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
@ -3569,7 +3567,7 @@ ArrayType::Create(JSContext* cx, uintN argc, jsval* vp)
|
|||
|
||||
jsval* argv = JS_ARGV(cx, vp);
|
||||
if (JSVAL_IS_PRIMITIVE(argv[0]) ||
|
||||
!CType::IsCType(cx, JSVAL_TO_OBJECT(argv[0]))) {
|
||||
!CType::IsCType(JSVAL_TO_OBJECT(argv[0]))) {
|
||||
JS_ReportError(cx, "first argument must be a CType");
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
@ -3650,7 +3648,7 @@ ArrayType::ConstructData(JSContext* cx,
|
|||
uintN argc,
|
||||
jsval* vp)
|
||||
{
|
||||
if (!CType::IsCType(cx, obj) || CType::GetTypeCode(cx, obj) != TYPE_array) {
|
||||
if (!CType::IsCType(obj) || CType::GetTypeCode(cx, obj) != TYPE_array) {
|
||||
JS_ReportError(cx, "not an ArrayType");
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
@ -3751,7 +3749,7 @@ ArrayType::ConstructData(JSContext* cx,
|
|||
JSObject*
|
||||
ArrayType::GetBaseType(JSContext* cx, JSObject* obj)
|
||||
{
|
||||
JS_ASSERT(CType::IsCType(cx, obj));
|
||||
JS_ASSERT(CType::IsCType(obj));
|
||||
JS_ASSERT(CType::GetTypeCode(cx, obj) == TYPE_array);
|
||||
|
||||
jsval type;
|
||||
|
@ -3763,7 +3761,7 @@ ArrayType::GetBaseType(JSContext* cx, JSObject* obj)
|
|||
bool
|
||||
ArrayType::GetSafeLength(JSContext* cx, JSObject* obj, size_t* result)
|
||||
{
|
||||
JS_ASSERT(CType::IsCType(cx, obj));
|
||||
JS_ASSERT(CType::IsCType(obj));
|
||||
JS_ASSERT(CType::GetTypeCode(cx, obj) == TYPE_array);
|
||||
|
||||
jsval length;
|
||||
|
@ -3787,7 +3785,7 @@ ArrayType::GetSafeLength(JSContext* cx, JSObject* obj, size_t* result)
|
|||
size_t
|
||||
ArrayType::GetLength(JSContext* cx, JSObject* obj)
|
||||
{
|
||||
JS_ASSERT(CType::IsCType(cx, obj));
|
||||
JS_ASSERT(CType::IsCType(obj));
|
||||
JS_ASSERT(CType::GetTypeCode(cx, obj) == TYPE_array);
|
||||
|
||||
jsval length;
|
||||
|
@ -3806,7 +3804,7 @@ ArrayType::GetLength(JSContext* cx, JSObject* obj)
|
|||
ffi_type*
|
||||
ArrayType::BuildFFIType(JSContext* cx, JSObject* obj)
|
||||
{
|
||||
JS_ASSERT(CType::IsCType(cx, obj));
|
||||
JS_ASSERT(CType::IsCType(obj));
|
||||
JS_ASSERT(CType::GetTypeCode(cx, obj) == TYPE_array);
|
||||
JS_ASSERT(CType::IsSizeDefined(cx, obj));
|
||||
|
||||
|
@ -3849,7 +3847,7 @@ ArrayType::BuildFFIType(JSContext* cx, JSObject* obj)
|
|||
JSBool
|
||||
ArrayType::ElementTypeGetter(JSContext* cx, JSObject* obj, jsid idval, jsval* vp)
|
||||
{
|
||||
if (!CType::IsCType(cx, obj) || CType::GetTypeCode(cx, obj) != TYPE_array) {
|
||||
if (!CType::IsCType(obj) || CType::GetTypeCode(cx, obj) != TYPE_array) {
|
||||
JS_ReportError(cx, "not an ArrayType");
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
@ -3864,10 +3862,10 @@ ArrayType::LengthGetter(JSContext* cx, JSObject* obj, jsid idval, jsval* vp)
|
|||
{
|
||||
// This getter exists for both CTypes and CDatas of the ArrayType persuasion.
|
||||
// If we're dealing with a CData, get the CType from it.
|
||||
if (CData::IsCData(cx, obj))
|
||||
if (CData::IsCData(obj))
|
||||
obj = CData::GetCType(cx, obj);
|
||||
|
||||
if (!CType::IsCType(cx, obj) || CType::GetTypeCode(cx, obj) != TYPE_array) {
|
||||
if (!CType::IsCType(obj) || CType::GetTypeCode(cx, obj) != TYPE_array) {
|
||||
JS_ReportError(cx, "not an ArrayType");
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
@ -3881,7 +3879,7 @@ JSBool
|
|||
ArrayType::Getter(JSContext* cx, JSObject* obj, jsid idval, jsval* vp)
|
||||
{
|
||||
// This should never happen, but we'll check to be safe.
|
||||
if (!CData::IsCData(cx, obj)) {
|
||||
if (!CData::IsCData(obj)) {
|
||||
JS_ReportError(cx, "not a CData");
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
@ -3916,7 +3914,7 @@ JSBool
|
|||
ArrayType::Setter(JSContext* cx, JSObject* obj, jsid idval, JSBool strict, jsval* vp)
|
||||
{
|
||||
// This should never happen, but we'll check to be safe.
|
||||
if (!CData::IsCData(cx, obj)) {
|
||||
if (!CData::IsCData(obj)) {
|
||||
JS_ReportError(cx, "not a CData");
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
@ -3951,7 +3949,7 @@ JSBool
|
|||
ArrayType::AddressOfElement(JSContext* cx, uintN argc, jsval* vp)
|
||||
{
|
||||
JSObject* obj = JS_THIS_OBJECT(cx, vp);
|
||||
if (!obj || !CData::IsCData(cx, obj)) {
|
||||
if (!obj || !CData::IsCData(obj)) {
|
||||
JS_ReportError(cx, "not a CData");
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
@ -4043,7 +4041,7 @@ ExtractStructField(JSContext* cx, jsval val, JSObject** typeObj)
|
|||
return NULL;
|
||||
|
||||
if (propVal.value().isPrimitive() ||
|
||||
!CType::IsCType(cx, JSVAL_TO_OBJECT(propVal.jsval_value()))) {
|
||||
!CType::IsCType(JSVAL_TO_OBJECT(propVal.jsval_value()))) {
|
||||
JS_ReportError(cx, "struct field descriptors require a valid name and type");
|
||||
return NULL;
|
||||
}
|
||||
|
@ -4255,7 +4253,7 @@ StructType::DefineInternal(JSContext* cx, JSObject* typeObj, JSObject* fieldsObj
|
|||
ffi_type*
|
||||
StructType::BuildFFIType(JSContext* cx, JSObject* obj)
|
||||
{
|
||||
JS_ASSERT(CType::IsCType(cx, obj));
|
||||
JS_ASSERT(CType::IsCType(obj));
|
||||
JS_ASSERT(CType::GetTypeCode(cx, obj) == TYPE_struct);
|
||||
JS_ASSERT(CType::IsSizeDefined(cx, obj));
|
||||
|
||||
|
@ -4333,7 +4331,7 @@ StructType::Define(JSContext* cx, uintN argc, jsval* vp)
|
|||
{
|
||||
JSObject* obj = JS_THIS_OBJECT(cx, vp);
|
||||
if (!obj ||
|
||||
!CType::IsCType(cx, obj) ||
|
||||
!CType::IsCType(obj) ||
|
||||
CType::GetTypeCode(cx, obj) != TYPE_struct) {
|
||||
JS_ReportError(cx, "not a StructType");
|
||||
return JS_FALSE;
|
||||
|
@ -4365,7 +4363,7 @@ StructType::ConstructData(JSContext* cx,
|
|||
uintN argc,
|
||||
jsval* vp)
|
||||
{
|
||||
if (!CType::IsCType(cx, obj) || CType::GetTypeCode(cx, obj) != TYPE_struct) {
|
||||
if (!CType::IsCType(obj) || CType::GetTypeCode(cx, obj) != TYPE_struct) {
|
||||
JS_ReportError(cx, "not a StructType");
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
@ -4439,7 +4437,7 @@ StructType::ConstructData(JSContext* cx,
|
|||
const FieldInfoHash*
|
||||
StructType::GetFieldInfo(JSContext* cx, JSObject* obj)
|
||||
{
|
||||
JS_ASSERT(CType::IsCType(cx, obj));
|
||||
JS_ASSERT(CType::IsCType(obj));
|
||||
JS_ASSERT(CType::GetTypeCode(cx, obj) == TYPE_struct);
|
||||
|
||||
jsval slot;
|
||||
|
@ -4452,7 +4450,7 @@ StructType::GetFieldInfo(JSContext* cx, JSObject* obj)
|
|||
const FieldInfo*
|
||||
StructType::LookupField(JSContext* cx, JSObject* obj, JSFlatString *name)
|
||||
{
|
||||
JS_ASSERT(CType::IsCType(cx, obj));
|
||||
JS_ASSERT(CType::IsCType(obj));
|
||||
JS_ASSERT(CType::GetTypeCode(cx, obj) == TYPE_struct);
|
||||
|
||||
FieldInfoHash::Ptr ptr = GetFieldInfo(cx, obj)->lookup(name);
|
||||
|
@ -4470,7 +4468,7 @@ StructType::LookupField(JSContext* cx, JSObject* obj, JSFlatString *name)
|
|||
JSObject*
|
||||
StructType::BuildFieldsArray(JSContext* cx, JSObject* obj)
|
||||
{
|
||||
JS_ASSERT(CType::IsCType(cx, obj));
|
||||
JS_ASSERT(CType::IsCType(obj));
|
||||
JS_ASSERT(CType::GetTypeCode(cx, obj) == TYPE_struct);
|
||||
JS_ASSERT(CType::IsSizeDefined(cx, obj));
|
||||
|
||||
|
@ -4505,7 +4503,7 @@ StructType::BuildFieldsArray(JSContext* cx, JSObject* obj)
|
|||
JSBool
|
||||
StructType::FieldsArrayGetter(JSContext* cx, JSObject* obj, jsid idval, jsval* vp)
|
||||
{
|
||||
if (!CType::IsCType(cx, obj) || CType::GetTypeCode(cx, obj) != TYPE_struct) {
|
||||
if (!CType::IsCType(obj) || CType::GetTypeCode(cx, obj) != TYPE_struct) {
|
||||
JS_ReportError(cx, "not a StructType");
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
@ -4535,7 +4533,7 @@ StructType::FieldsArrayGetter(JSContext* cx, JSObject* obj, jsid idval, jsval* v
|
|||
JSBool
|
||||
StructType::FieldGetter(JSContext* cx, JSObject* obj, jsid idval, jsval* vp)
|
||||
{
|
||||
if (!CData::IsCData(cx, obj)) {
|
||||
if (!CData::IsCData(obj)) {
|
||||
JS_ReportError(cx, "not a CData");
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
@ -4557,7 +4555,7 @@ StructType::FieldGetter(JSContext* cx, JSObject* obj, jsid idval, jsval* vp)
|
|||
JSBool
|
||||
StructType::FieldSetter(JSContext* cx, JSObject* obj, jsid idval, JSBool strict, jsval* vp)
|
||||
{
|
||||
if (!CData::IsCData(cx, obj)) {
|
||||
if (!CData::IsCData(obj)) {
|
||||
JS_ReportError(cx, "not a CData");
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
@ -4580,7 +4578,7 @@ JSBool
|
|||
StructType::AddressOfField(JSContext* cx, uintN argc, jsval* vp)
|
||||
{
|
||||
JSObject* obj = JS_THIS_OBJECT(cx, vp);
|
||||
if (!obj || !CData::IsCData(cx, obj)) {
|
||||
if (!obj || !CData::IsCData(obj)) {
|
||||
JS_ReportError(cx, "not a CData");
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
@ -4686,7 +4684,7 @@ static JSObject*
|
|||
PrepareType(JSContext* cx, jsval type)
|
||||
{
|
||||
if (JSVAL_IS_PRIMITIVE(type) ||
|
||||
!CType::IsCType(cx, JSVAL_TO_OBJECT(type))) {
|
||||
!CType::IsCType(JSVAL_TO_OBJECT(type))) {
|
||||
JS_ReportError(cx, "not a ctypes type");
|
||||
return NULL;
|
||||
}
|
||||
|
@ -4723,7 +4721,7 @@ static JSObject*
|
|||
PrepareReturnType(JSContext* cx, jsval type)
|
||||
{
|
||||
if (JSVAL_IS_PRIMITIVE(type) ||
|
||||
!CType::IsCType(cx, JSVAL_TO_OBJECT(type))) {
|
||||
!CType::IsCType(JSVAL_TO_OBJECT(type))) {
|
||||
JS_ReportError(cx, "not a ctypes type");
|
||||
return NULL;
|
||||
}
|
||||
|
@ -5096,7 +5094,7 @@ FunctionType::Call(JSContext* cx,
|
|||
{
|
||||
// get the callee object...
|
||||
JSObject* obj = JSVAL_TO_OBJECT(JS_CALLEE(cx, vp));
|
||||
if (!CData::IsCData(cx, obj)) {
|
||||
if (!CData::IsCData(obj)) {
|
||||
JS_ReportError(cx, "not a CData");
|
||||
return false;
|
||||
}
|
||||
|
@ -5125,7 +5123,7 @@ FunctionType::Call(JSContext* cx,
|
|||
// Check if we have a Library object. If we do, make sure it's open.
|
||||
jsval slot;
|
||||
ASSERT_OK(JS_GetReservedSlot(cx, obj, SLOT_REFERENT, &slot));
|
||||
if (!JSVAL_IS_VOID(slot) && Library::IsLibrary(cx, JSVAL_TO_OBJECT(slot))) {
|
||||
if (!JSVAL_IS_VOID(slot) && Library::IsLibrary(JSVAL_TO_OBJECT(slot))) {
|
||||
PRLibrary* library = Library::GetLibrary(cx, JSVAL_TO_OBJECT(slot));
|
||||
if (!library) {
|
||||
JS_ReportError(cx, "library is not open");
|
||||
|
@ -5157,7 +5155,7 @@ FunctionType::Call(JSContext* cx,
|
|||
|
||||
for (uint32_t i = argcFixed; i < argc; ++i) {
|
||||
if (JSVAL_IS_PRIMITIVE(argv[i]) ||
|
||||
!CData::IsCData(cx, obj = JSVAL_TO_OBJECT(argv[i]))) {
|
||||
!CData::IsCData(obj = JSVAL_TO_OBJECT(argv[i]))) {
|
||||
// Since we know nothing about the CTypes of the ... arguments,
|
||||
// they absolutely must be CData objects already.
|
||||
JS_ReportError(cx, "argument %d of type %s is not a CData object",
|
||||
|
@ -5224,7 +5222,7 @@ FunctionType::Call(JSContext* cx,
|
|||
FunctionInfo*
|
||||
FunctionType::GetFunctionInfo(JSContext* cx, JSObject* obj)
|
||||
{
|
||||
JS_ASSERT(CType::IsCType(cx, obj));
|
||||
JS_ASSERT(CType::IsCType(obj));
|
||||
JS_ASSERT(CType::GetTypeCode(cx, obj) == TYPE_function);
|
||||
|
||||
jsval slot;
|
||||
|
@ -5237,7 +5235,7 @@ FunctionType::GetFunctionInfo(JSContext* cx, JSObject* obj)
|
|||
static JSBool
|
||||
CheckFunctionType(JSContext* cx, JSObject* obj)
|
||||
{
|
||||
if (!CType::IsCType(cx, obj) || CType::GetTypeCode(cx, obj) != TYPE_function) {
|
||||
if (!CType::IsCType(obj) || CType::GetTypeCode(cx, obj) != TYPE_function) {
|
||||
JS_ReportError(cx, "not a FunctionType");
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
@ -5345,7 +5343,7 @@ CClosure::Create(JSContext* cx,
|
|||
// which stores our JSContext for use with the closure.
|
||||
JSObject* proto = JS_GetPrototype(cx, typeObj);
|
||||
JS_ASSERT(proto);
|
||||
JS_ASSERT(CType::IsCTypeProto(cx, proto));
|
||||
JS_ASSERT(CType::IsCTypeProto(proto));
|
||||
|
||||
// Get a JSContext for use with the closure.
|
||||
jsval slot;
|
||||
|
@ -5641,10 +5639,10 @@ CData::Create(JSContext* cx,
|
|||
bool ownResult)
|
||||
{
|
||||
JS_ASSERT(typeObj);
|
||||
JS_ASSERT(CType::IsCType(cx, typeObj));
|
||||
JS_ASSERT(CType::IsCType(typeObj));
|
||||
JS_ASSERT(CType::IsSizeDefined(cx, typeObj));
|
||||
JS_ASSERT(ownResult || source);
|
||||
JS_ASSERT_IF(refObj && CData::IsCData(cx, refObj), !ownResult);
|
||||
JS_ASSERT_IF(refObj && CData::IsCData(refObj), !ownResult);
|
||||
|
||||
// Get the 'prototype' property from the type.
|
||||
jsval slot;
|
||||
|
@ -5734,19 +5732,19 @@ CData::Finalize(JSContext* cx, JSObject* obj)
|
|||
JSObject*
|
||||
CData::GetCType(JSContext* cx, JSObject* dataObj)
|
||||
{
|
||||
JS_ASSERT(CData::IsCData(cx, dataObj));
|
||||
JS_ASSERT(CData::IsCData(dataObj));
|
||||
|
||||
jsval slot;
|
||||
ASSERT_OK(JS_GetReservedSlot(cx, dataObj, SLOT_CTYPE, &slot));
|
||||
JSObject* typeObj = JSVAL_TO_OBJECT(slot);
|
||||
JS_ASSERT(CType::IsCType(cx, typeObj));
|
||||
JS_ASSERT(CType::IsCType(typeObj));
|
||||
return typeObj;
|
||||
}
|
||||
|
||||
void*
|
||||
CData::GetData(JSContext* cx, JSObject* dataObj)
|
||||
{
|
||||
JS_ASSERT(CData::IsCData(cx, dataObj));
|
||||
JS_ASSERT(CData::IsCData(dataObj));
|
||||
|
||||
jsval slot;
|
||||
ASSERT_OK(JS_GetReservedSlot(cx, dataObj, SLOT_DATA, &slot));
|
||||
|
@ -5758,21 +5756,21 @@ CData::GetData(JSContext* cx, JSObject* dataObj)
|
|||
}
|
||||
|
||||
bool
|
||||
CData::IsCData(JSContext* cx, JSObject* obj)
|
||||
CData::IsCData(JSObject* obj)
|
||||
{
|
||||
return JS_GET_CLASS(cx, obj) == &sCDataClass;
|
||||
return JS_GetClass(obj) == &sCDataClass;
|
||||
}
|
||||
|
||||
bool
|
||||
CData::IsCDataProto(JSContext* cx, JSObject* obj)
|
||||
CData::IsCDataProto(JSObject* obj)
|
||||
{
|
||||
return JS_GET_CLASS(cx, obj) == &sCDataProtoClass;
|
||||
return JS_GetClass(obj) == &sCDataProtoClass;
|
||||
}
|
||||
|
||||
JSBool
|
||||
CData::ValueGetter(JSContext* cx, JSObject* obj, jsid idval, jsval* vp)
|
||||
{
|
||||
if (!IsCData(cx, obj)) {
|
||||
if (!IsCData(obj)) {
|
||||
JS_ReportError(cx, "not a CData");
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
@ -5787,7 +5785,7 @@ CData::ValueGetter(JSContext* cx, JSObject* obj, jsid idval, jsval* vp)
|
|||
JSBool
|
||||
CData::ValueSetter(JSContext* cx, JSObject* obj, jsid idval, JSBool strict, jsval* vp)
|
||||
{
|
||||
if (!IsCData(cx, obj)) {
|
||||
if (!IsCData(obj)) {
|
||||
JS_ReportError(cx, "not a CData");
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
@ -5804,7 +5802,7 @@ CData::Address(JSContext* cx, uintN argc, jsval* vp)
|
|||
}
|
||||
|
||||
JSObject* obj = JS_THIS_OBJECT(cx, vp);
|
||||
if (!obj || !IsCData(cx, obj)) {
|
||||
if (!obj || !IsCData(obj)) {
|
||||
JS_ReportError(cx, "not a CData");
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
@ -5838,7 +5836,7 @@ CData::Cast(JSContext* cx, uintN argc, jsval* vp)
|
|||
|
||||
jsval* argv = JS_ARGV(cx, vp);
|
||||
if (JSVAL_IS_PRIMITIVE(argv[0]) ||
|
||||
!CData::IsCData(cx, JSVAL_TO_OBJECT(argv[0]))) {
|
||||
!CData::IsCData(JSVAL_TO_OBJECT(argv[0]))) {
|
||||
JS_ReportError(cx, "first argument must be a CData");
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
@ -5846,7 +5844,7 @@ CData::Cast(JSContext* cx, uintN argc, jsval* vp)
|
|||
JSObject* sourceType = CData::GetCType(cx, sourceData);
|
||||
|
||||
if (JSVAL_IS_PRIMITIVE(argv[1]) ||
|
||||
!CType::IsCType(cx, JSVAL_TO_OBJECT(argv[1]))) {
|
||||
!CType::IsCType(JSVAL_TO_OBJECT(argv[1]))) {
|
||||
JS_ReportError(cx, "second argument must be a CType");
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
@ -5881,7 +5879,7 @@ CData::GetRuntime(JSContext* cx, uintN argc, jsval* vp)
|
|||
|
||||
jsval* argv = JS_ARGV(cx, vp);
|
||||
if (JSVAL_IS_PRIMITIVE(argv[0]) ||
|
||||
!CType::IsCType(cx, JSVAL_TO_OBJECT(argv[0]))) {
|
||||
!CType::IsCType(JSVAL_TO_OBJECT(argv[0]))) {
|
||||
JS_ReportError(cx, "first argument must be a CType");
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
@ -5912,7 +5910,7 @@ CData::ReadString(JSContext* cx, uintN argc, jsval* vp)
|
|||
}
|
||||
|
||||
JSObject* obj = JS_THIS_OBJECT(cx, vp);
|
||||
if (!obj || !IsCData(cx, obj)) {
|
||||
if (!obj || !IsCData(obj)) {
|
||||
JS_ReportError(cx, "not a CData");
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
@ -6004,13 +6002,13 @@ CData::ToSource(JSContext* cx, uintN argc, jsval* vp)
|
|||
|
||||
JSObject* obj = JS_THIS_OBJECT(cx, vp);
|
||||
if (!obj ||
|
||||
!(CData::IsCData(cx, obj) || CData::IsCDataProto(cx, obj))) {
|
||||
!(CData::IsCData(obj) || CData::IsCDataProto(obj))) {
|
||||
JS_ReportError(cx, "not a CData");
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
JSString* result;
|
||||
if (CData::IsCData(cx, obj)) {
|
||||
if (CData::IsCData(obj)) {
|
||||
JSObject* typeObj = CData::GetCType(cx, obj);
|
||||
void* data = CData::GetData(cx, obj);
|
||||
|
||||
|
@ -6085,7 +6083,7 @@ Int64Base::Finalize(JSContext* cx, JSObject* obj)
|
|||
|
||||
uint64_t
|
||||
Int64Base::GetInt(JSContext* cx, JSObject* obj) {
|
||||
JS_ASSERT(Int64::IsInt64(cx, obj) || UInt64::IsUInt64(cx, obj));
|
||||
JS_ASSERT(Int64::IsInt64(obj) || UInt64::IsUInt64(obj));
|
||||
|
||||
jsval slot;
|
||||
ASSERT_OK(JS_GetReservedSlot(cx, obj, SLOT_INT64, &slot));
|
||||
|
@ -6182,7 +6180,7 @@ Int64::Construct(JSContext* cx,
|
|||
ASSERT_OK(JS_GetProperty(cx, JSVAL_TO_OBJECT(JS_CALLEE(cx, vp)),
|
||||
"prototype", &slot));
|
||||
JSObject* proto = JSVAL_TO_OBJECT(slot);
|
||||
JS_ASSERT(JS_GET_CLASS(cx, proto) == &sInt64ProtoClass);
|
||||
JS_ASSERT(JS_GetClass(proto) == &sInt64ProtoClass);
|
||||
|
||||
JSObject* result = Int64Base::Construct(cx, proto, i, false);
|
||||
if (!result)
|
||||
|
@ -6193,16 +6191,16 @@ Int64::Construct(JSContext* cx,
|
|||
}
|
||||
|
||||
bool
|
||||
Int64::IsInt64(JSContext* cx, JSObject* obj)
|
||||
Int64::IsInt64(JSObject* obj)
|
||||
{
|
||||
return JS_GET_CLASS(cx, obj) == &sInt64Class;
|
||||
return JS_GetClass(obj) == &sInt64Class;
|
||||
}
|
||||
|
||||
JSBool
|
||||
Int64::ToString(JSContext* cx, uintN argc, jsval* vp)
|
||||
{
|
||||
JSObject* obj = JS_THIS_OBJECT(cx, vp);
|
||||
if (!obj || !Int64::IsInt64(cx, obj)) {
|
||||
if (!obj || !Int64::IsInt64(obj)) {
|
||||
JS_ReportError(cx, "not an Int64");
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
@ -6214,7 +6212,7 @@ JSBool
|
|||
Int64::ToSource(JSContext* cx, uintN argc, jsval* vp)
|
||||
{
|
||||
JSObject* obj = JS_THIS_OBJECT(cx, vp);
|
||||
if (!obj || !Int64::IsInt64(cx, obj)) {
|
||||
if (!obj || !Int64::IsInt64(obj)) {
|
||||
JS_ReportError(cx, "not an Int64");
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
@ -6229,8 +6227,8 @@ Int64::Compare(JSContext* cx, uintN argc, jsval* vp)
|
|||
if (argc != 2 ||
|
||||
JSVAL_IS_PRIMITIVE(argv[0]) ||
|
||||
JSVAL_IS_PRIMITIVE(argv[1]) ||
|
||||
!Int64::IsInt64(cx, JSVAL_TO_OBJECT(argv[0])) ||
|
||||
!Int64::IsInt64(cx, JSVAL_TO_OBJECT(argv[1]))) {
|
||||
!Int64::IsInt64(JSVAL_TO_OBJECT(argv[0])) ||
|
||||
!Int64::IsInt64(JSVAL_TO_OBJECT(argv[1]))) {
|
||||
JS_ReportError(cx, "compare takes two Int64 arguments");
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
@ -6260,7 +6258,7 @@ Int64::Lo(JSContext* cx, uintN argc, jsval* vp)
|
|||
{
|
||||
jsval* argv = JS_ARGV(cx, vp);
|
||||
if (argc != 1 || JSVAL_IS_PRIMITIVE(argv[0]) ||
|
||||
!Int64::IsInt64(cx, JSVAL_TO_OBJECT(argv[0]))) {
|
||||
!Int64::IsInt64(JSVAL_TO_OBJECT(argv[0]))) {
|
||||
JS_ReportError(cx, "lo takes one Int64 argument");
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
@ -6282,7 +6280,7 @@ Int64::Hi(JSContext* cx, uintN argc, jsval* vp)
|
|||
{
|
||||
jsval* argv = JS_ARGV(cx, vp);
|
||||
if (argc != 1 || JSVAL_IS_PRIMITIVE(argv[0]) ||
|
||||
!Int64::IsInt64(cx, JSVAL_TO_OBJECT(argv[0]))) {
|
||||
!Int64::IsInt64(JSVAL_TO_OBJECT(argv[0]))) {
|
||||
JS_ReportError(cx, "hi takes one Int64 argument");
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
@ -6322,7 +6320,7 @@ Int64::Join(JSContext* cx, uintN argc, jsval* vp)
|
|||
|
||||
jsval slot = js::GetFunctionNativeReserved(callee, SLOT_FN_INT64PROTO);
|
||||
JSObject* proto = JSVAL_TO_OBJECT(slot);
|
||||
JS_ASSERT(JS_GET_CLASS(cx, proto) == &sInt64ProtoClass);
|
||||
JS_ASSERT(JS_GetClass(proto) == &sInt64ProtoClass);
|
||||
|
||||
JSObject* result = Int64Base::Construct(cx, proto, i, false);
|
||||
if (!result)
|
||||
|
@ -6353,7 +6351,7 @@ UInt64::Construct(JSContext* cx,
|
|||
ASSERT_OK(JS_GetProperty(cx, JSVAL_TO_OBJECT(JS_CALLEE(cx, vp)),
|
||||
"prototype", &slot));
|
||||
JSObject* proto = JSVAL_TO_OBJECT(slot);
|
||||
JS_ASSERT(JS_GET_CLASS(cx, proto) == &sUInt64ProtoClass);
|
||||
JS_ASSERT(JS_GetClass(proto) == &sUInt64ProtoClass);
|
||||
|
||||
JSObject* result = Int64Base::Construct(cx, proto, u, true);
|
||||
if (!result)
|
||||
|
@ -6364,16 +6362,16 @@ UInt64::Construct(JSContext* cx,
|
|||
}
|
||||
|
||||
bool
|
||||
UInt64::IsUInt64(JSContext* cx, JSObject* obj)
|
||||
UInt64::IsUInt64(JSObject* obj)
|
||||
{
|
||||
return JS_GET_CLASS(cx, obj) == &sUInt64Class;
|
||||
return JS_GetClass(obj) == &sUInt64Class;
|
||||
}
|
||||
|
||||
JSBool
|
||||
UInt64::ToString(JSContext* cx, uintN argc, jsval* vp)
|
||||
{
|
||||
JSObject* obj = JS_THIS_OBJECT(cx, vp);
|
||||
if (!obj || !UInt64::IsUInt64(cx, obj)) {
|
||||
if (!obj || !UInt64::IsUInt64(obj)) {
|
||||
JS_ReportError(cx, "not a UInt64");
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
@ -6385,7 +6383,7 @@ JSBool
|
|||
UInt64::ToSource(JSContext* cx, uintN argc, jsval* vp)
|
||||
{
|
||||
JSObject* obj = JS_THIS_OBJECT(cx, vp);
|
||||
if (!obj || !UInt64::IsUInt64(cx, obj)) {
|
||||
if (!obj || !UInt64::IsUInt64(obj)) {
|
||||
JS_ReportError(cx, "not a UInt64");
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
@ -6400,8 +6398,8 @@ UInt64::Compare(JSContext* cx, uintN argc, jsval* vp)
|
|||
if (argc != 2 ||
|
||||
JSVAL_IS_PRIMITIVE(argv[0]) ||
|
||||
JSVAL_IS_PRIMITIVE(argv[1]) ||
|
||||
!UInt64::IsUInt64(cx, JSVAL_TO_OBJECT(argv[0])) ||
|
||||
!UInt64::IsUInt64(cx, JSVAL_TO_OBJECT(argv[1]))) {
|
||||
!UInt64::IsUInt64(JSVAL_TO_OBJECT(argv[0])) ||
|
||||
!UInt64::IsUInt64(JSVAL_TO_OBJECT(argv[1]))) {
|
||||
JS_ReportError(cx, "compare takes two UInt64 arguments");
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
@ -6427,7 +6425,7 @@ UInt64::Lo(JSContext* cx, uintN argc, jsval* vp)
|
|||
{
|
||||
jsval* argv = JS_ARGV(cx, vp);
|
||||
if (argc != 1 || JSVAL_IS_PRIMITIVE(argv[0]) ||
|
||||
!UInt64::IsUInt64(cx, JSVAL_TO_OBJECT(argv[0]))) {
|
||||
!UInt64::IsUInt64(JSVAL_TO_OBJECT(argv[0]))) {
|
||||
JS_ReportError(cx, "lo takes one UInt64 argument");
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
@ -6449,7 +6447,7 @@ UInt64::Hi(JSContext* cx, uintN argc, jsval* vp)
|
|||
{
|
||||
jsval* argv = JS_ARGV(cx, vp);
|
||||
if (argc != 1 || JSVAL_IS_PRIMITIVE(argv[0]) ||
|
||||
!UInt64::IsUInt64(cx, JSVAL_TO_OBJECT(argv[0]))) {
|
||||
!UInt64::IsUInt64(JSVAL_TO_OBJECT(argv[0]))) {
|
||||
JS_ReportError(cx, "hi takes one UInt64 argument");
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
@ -6489,7 +6487,7 @@ UInt64::Join(JSContext* cx, uintN argc, jsval* vp)
|
|||
|
||||
jsval slot = js::GetFunctionNativeReserved(callee, SLOT_FN_INT64PROTO);
|
||||
JSObject* proto = JSVAL_TO_OBJECT(slot);
|
||||
JS_ASSERT(JS_GET_CLASS(cx, proto) == &sUInt64ProtoClass);
|
||||
JS_ASSERT(JS_GetClass(proto) == &sUInt64ProtoClass);
|
||||
|
||||
JSObject* result = Int64Base::Construct(cx, proto, u, true);
|
||||
if (!result)
|
||||
|
|
|
@ -348,7 +348,7 @@ struct ClosureInfo
|
|||
};
|
||||
};
|
||||
|
||||
bool IsCTypesGlobal(JSContext* cx, JSObject* obj);
|
||||
bool IsCTypesGlobal(JSObject* obj);
|
||||
|
||||
JSCTypesCallbacks* GetCallbacks(JSContext* cx, JSObject* obj);
|
||||
|
||||
|
@ -454,8 +454,8 @@ namespace CType {
|
|||
JSObject* typeProto, JSObject* dataProto, const char* name, TypeCode type,
|
||||
jsval size, jsval align, ffi_type* ffiType);
|
||||
|
||||
bool IsCType(JSContext* cx, JSObject* obj);
|
||||
bool IsCTypeProto(JSContext* cx, JSObject* obj);
|
||||
bool IsCType(JSObject* obj);
|
||||
bool IsCTypeProto(JSObject* obj);
|
||||
TypeCode GetTypeCode(JSContext* cx, JSObject* typeObj);
|
||||
bool TypesEqual(JSContext* cx, JSObject* t1, JSObject* t2);
|
||||
size_t GetSize(JSContext* cx, JSObject* obj);
|
||||
|
@ -518,8 +518,8 @@ namespace CData {
|
|||
|
||||
JSObject* GetCType(JSContext* cx, JSObject* dataObj);
|
||||
void* GetData(JSContext* cx, JSObject* dataObj);
|
||||
bool IsCData(JSContext* cx, JSObject* obj);
|
||||
bool IsCDataProto(JSContext* cx, JSObject* obj);
|
||||
bool IsCData(JSObject* obj);
|
||||
bool IsCDataProto(JSObject* obj);
|
||||
|
||||
// Attached by JSAPI as the function 'ctypes.cast'
|
||||
JSBool Cast(JSContext* cx, uintN argc, jsval* vp);
|
||||
|
@ -528,11 +528,11 @@ namespace CData {
|
|||
}
|
||||
|
||||
namespace Int64 {
|
||||
bool IsInt64(JSContext* cx, JSObject* obj);
|
||||
bool IsInt64(JSObject* obj);
|
||||
}
|
||||
|
||||
namespace UInt64 {
|
||||
bool IsUInt64(JSContext* cx, JSObject* obj);
|
||||
bool IsUInt64(JSObject* obj);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -195,15 +195,15 @@ Library::Create(JSContext* cx, jsval path, JSCTypesCallbacks* callbacks)
|
|||
}
|
||||
|
||||
bool
|
||||
Library::IsLibrary(JSContext* cx, JSObject* obj)
|
||||
Library::IsLibrary(JSObject* obj)
|
||||
{
|
||||
return JS_GET_CLASS(cx, obj) == &sLibraryClass;
|
||||
return JS_GetClass(obj) == &sLibraryClass;
|
||||
}
|
||||
|
||||
PRLibrary*
|
||||
Library::GetLibrary(JSContext* cx, JSObject* obj)
|
||||
{
|
||||
JS_ASSERT(IsLibrary(cx, obj));
|
||||
JS_ASSERT(IsLibrary(obj));
|
||||
|
||||
jsval slot;
|
||||
JS_GetReservedSlot(cx, obj, SLOT_LIBRARY, &slot);
|
||||
|
@ -223,7 +223,7 @@ JSBool
|
|||
Library::Open(JSContext* cx, uintN argc, jsval *vp)
|
||||
{
|
||||
JSObject* ctypesObj = JS_THIS_OBJECT(cx, vp);
|
||||
if (!ctypesObj || !IsCTypesGlobal(cx, ctypesObj)) {
|
||||
if (!ctypesObj || !IsCTypesGlobal(ctypesObj)) {
|
||||
JS_ReportError(cx, "not a ctypes object");
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
@ -245,7 +245,7 @@ JSBool
|
|||
Library::Close(JSContext* cx, uintN argc, jsval* vp)
|
||||
{
|
||||
JSObject* obj = JS_THIS_OBJECT(cx, vp);
|
||||
if (!obj || !IsLibrary(cx, obj)) {
|
||||
if (!obj || !IsLibrary(obj)) {
|
||||
JS_ReportError(cx, "not a library");
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
@ -267,7 +267,7 @@ JSBool
|
|||
Library::Declare(JSContext* cx, uintN argc, jsval* vp)
|
||||
{
|
||||
JSObject* obj = JS_THIS_OBJECT(cx, vp);
|
||||
if (!obj || !IsLibrary(cx, obj)) {
|
||||
if (!obj || !IsLibrary(obj)) {
|
||||
JS_ReportError(cx, "not a library");
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
@ -321,7 +321,7 @@ Library::Declare(JSContext* cx, uintN argc, jsval* vp)
|
|||
} else {
|
||||
// Case 2).
|
||||
if (JSVAL_IS_PRIMITIVE(argv[1]) ||
|
||||
!CType::IsCType(cx, JSVAL_TO_OBJECT(argv[1])) ||
|
||||
!CType::IsCType(JSVAL_TO_OBJECT(argv[1])) ||
|
||||
!CType::IsSizeDefined(cx, JSVAL_TO_OBJECT(argv[1]))) {
|
||||
JS_ReportError(cx, "second argument must be a type of defined size");
|
||||
return JS_FALSE;
|
||||
|
|
|
@ -58,7 +58,7 @@ namespace Library
|
|||
|
||||
JSObject* Create(JSContext* cx, jsval path, JSCTypesCallbacks* callbacks);
|
||||
|
||||
bool IsLibrary(JSContext* cx, JSObject* obj);
|
||||
bool IsLibrary(JSObject* obj);
|
||||
PRLibrary* GetLibrary(JSContext* cx, JSObject* obj);
|
||||
|
||||
JSBool Open(JSContext* cx, uintN argc, jsval* vp);
|
||||
|
|
|
@ -18,7 +18,7 @@ constructHook(JSContext *cx, uintN argc, jsval *vp)
|
|||
JS_ReportError(cx, "test failed, could not construct object");
|
||||
return false;
|
||||
}
|
||||
if (strcmp(JS_GET_CLASS(cx, obj)->name, "Object") != 0) {
|
||||
if (strcmp(JS_GetClass(obj)->name, "Object") != 0) {
|
||||
JS_ReportError(cx, "test failed, wrong class for 'this'");
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ BEGIN_TEST(testSetProperty_InheritedGlobalSetter)
|
|||
// This is a JSAPI test because jsapi-test globals do not have a resolve
|
||||
// hook and therefore can use the property cache in some cases where the
|
||||
// shell can't.
|
||||
JS_ASSERT(JS_GET_CLASS(cx, global)->resolve == &JS_ResolveStub);
|
||||
JS_ASSERT(JS_GetClass(global)->resolve == &JS_ResolveStub);
|
||||
|
||||
CHECK(JS_DefineProperty(cx, global, "HOTLOOP", INT_TO_JSVAL(8), NULL, NULL, 0));
|
||||
EXEC("var n = 0;\n"
|
||||
|
|
|
@ -3143,19 +3143,11 @@ JS_LinkConstructorAndPrototype(JSContext *cx, JSObject *ctor, JSObject *proto)
|
|||
return LinkConstructorAndPrototype(cx, ctor, proto);
|
||||
}
|
||||
|
||||
#ifdef JS_THREADSAFE
|
||||
JS_PUBLIC_API(JSClass *)
|
||||
JS_GetClass(JSContext *cx, JSObject *obj)
|
||||
{
|
||||
return obj->getJSClass();
|
||||
}
|
||||
#else
|
||||
JS_PUBLIC_API(JSClass *)
|
||||
JS_GetClass(JSObject *obj)
|
||||
{
|
||||
return obj->getJSClass();
|
||||
}
|
||||
#endif
|
||||
|
||||
JS_PUBLIC_API(JSBool)
|
||||
JS_InstanceOf(JSContext *cx, JSObject *obj, JSClass *clasp, jsval *argv)
|
||||
|
|
|
@ -3646,18 +3646,9 @@ JS_InitClass(JSContext *cx, JSObject *obj, JSObject *parent_proto,
|
|||
extern JS_PUBLIC_API(JSBool)
|
||||
JS_LinkConstructorAndPrototype(JSContext *cx, JSObject *ctor, JSObject *proto);
|
||||
|
||||
#ifdef JS_THREADSAFE
|
||||
extern JS_PUBLIC_API(JSClass *)
|
||||
JS_GetClass(JSContext *cx, JSObject *obj);
|
||||
|
||||
#define JS_GET_CLASS(cx,obj) JS_GetClass(cx, obj)
|
||||
#else
|
||||
extern JS_PUBLIC_API(JSClass *)
|
||||
JS_GetClass(JSObject *obj);
|
||||
|
||||
#define JS_GET_CLASS(cx,obj) JS_GetClass(obj)
|
||||
#endif
|
||||
|
||||
extern JS_PUBLIC_API(JSBool)
|
||||
JS_InstanceOf(JSContext *cx, JSObject *obj, JSClass *clasp, jsval *argv);
|
||||
|
||||
|
@ -5331,7 +5322,7 @@ JS_IsConstructing(JSContext *cx, const jsval *vp)
|
|||
JSFunction *fun = JS_ValueToFunction(cx, JS_CALLEE(cx, vp));
|
||||
JS_ASSERT((JS_GetFunctionFlags(fun) & JSFUN_CONSTRUCTOR) != 0);
|
||||
} else {
|
||||
JS_ASSERT(JS_GET_CLASS(cx, callee)->construct != NULL);
|
||||
JS_ASSERT(JS_GetClass(callee)->construct != NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -236,7 +236,7 @@ GetPM(JSContext* cx, JSObject* obj, const char* fname)
|
|||
// JS_GetInstancePrivate only sets an exception if its last argument
|
||||
// is nonzero, so we have to do it by hand.
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, 0, JSMSG_INCOMPATIBLE_PROTO,
|
||||
pm_class.name, fname, JS_GET_CLASS(cx, obj)->name);
|
||||
pm_class.name, fname, JS_GetClass(obj)->name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -818,7 +818,7 @@ EvaluateWithLocation(JSContext *cx, uintN argc, jsval *vp)
|
|||
if (!thisobj)
|
||||
return false;
|
||||
|
||||
if ((JS_GET_CLASS(cx, thisobj)->flags & JSCLASS_IS_GLOBAL) != JSCLASS_IS_GLOBAL) {
|
||||
if ((JS_GetClass(thisobj)->flags & JSCLASS_IS_GLOBAL) != JSCLASS_IS_GLOBAL) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_UNEXPECTED_TYPE,
|
||||
"this-value passed to evalWithLocation()", "not a global object");
|
||||
return false;
|
||||
|
@ -860,7 +860,7 @@ Evaluate(JSContext *cx, uintN argc, jsval *vp)
|
|||
if (!thisobj)
|
||||
return false;
|
||||
|
||||
if ((JS_GET_CLASS(cx, thisobj)->flags & JSCLASS_IS_GLOBAL) != JSCLASS_IS_GLOBAL) {
|
||||
if ((JS_GetClass(thisobj)->flags & JSCLASS_IS_GLOBAL) != JSCLASS_IS_GLOBAL) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_UNEXPECTED_TYPE,
|
||||
"this-value passed to evaluate()", "not a global object");
|
||||
return false;
|
||||
|
@ -1627,7 +1627,7 @@ ValueToScript(JSContext *cx, jsval v, JSFunction **funp = NULL)
|
|||
|
||||
if (!JSVAL_IS_PRIMITIVE(v)) {
|
||||
JSObject *obj = JSVAL_TO_OBJECT(v);
|
||||
JSClass *clasp = JS_GET_CLASS(cx, obj);
|
||||
JSClass *clasp = JS_GetClass(obj);
|
||||
|
||||
if (clasp == Jsvalify(&GeneratorClass)) {
|
||||
if (JSGenerator *gen = (JSGenerator *) JS_GetPrivate(cx, obj)) {
|
||||
|
@ -1686,7 +1686,7 @@ GetScriptAndPCArgs(JSContext *cx, uintN argc, jsval *argv, JSScript **scriptp,
|
|||
jsval v = argv[0];
|
||||
uintN intarg = 0;
|
||||
if (!JSVAL_IS_PRIMITIVE(v) &&
|
||||
JS_GET_CLASS(cx, JSVAL_TO_OBJECT(v)) == Jsvalify(&FunctionClass)) {
|
||||
JS_GetClass(JSVAL_TO_OBJECT(v)) == Jsvalify(&FunctionClass)) {
|
||||
script = ValueToScript(cx, v);
|
||||
if (!script)
|
||||
return JS_FALSE;
|
||||
|
@ -1831,7 +1831,7 @@ LineToPC(JSContext *cx, uintN argc, jsval *vp)
|
|||
script = JS_GetFrameScript(cx, JS_GetScriptedCaller(cx, NULL));
|
||||
jsval v = JS_ARGV(cx, vp)[0];
|
||||
if (!JSVAL_IS_PRIMITIVE(v) &&
|
||||
JS_GET_CLASS(cx, JSVAL_TO_OBJECT(v)) == Jsvalify(&FunctionClass))
|
||||
JS_GetClass(JSVAL_TO_OBJECT(v)) == Jsvalify(&FunctionClass))
|
||||
{
|
||||
script = ValueToScript(cx, v);
|
||||
if (!script)
|
||||
|
@ -4541,7 +4541,7 @@ static JSClass its_class = {
|
|||
static JSBool
|
||||
its_getter(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
|
||||
{
|
||||
if (JS_GET_CLASS(cx, obj) == &its_class) {
|
||||
if (JS_GetClass(obj) == &its_class) {
|
||||
jsval *val = (jsval *) JS_GetPrivate(cx, obj);
|
||||
*vp = val ? *val : JSVAL_VOID;
|
||||
} else {
|
||||
|
@ -4554,7 +4554,7 @@ its_getter(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
|
|||
static JSBool
|
||||
its_setter(JSContext *cx, JSObject *obj, jsid id, JSBool strict, jsval *vp)
|
||||
{
|
||||
if (JS_GET_CLASS(cx, obj) != &its_class)
|
||||
if (JS_GetClass(obj) != &its_class)
|
||||
return JS_TRUE;
|
||||
|
||||
jsval *val = (jsval *) JS_GetPrivate(cx, obj);
|
||||
|
|
|
@ -581,7 +581,7 @@ class ThreadPool
|
|||
|
||||
public:
|
||||
static ThreadPool *unwrap(JSContext *cx, JSObject *obj) {
|
||||
JS_ASSERT(JS_GET_CLASS(cx, obj) == &jsClass);
|
||||
JS_ASSERT(JS_GetClass(obj) == &jsClass);
|
||||
return (ThreadPool *) JS_GetPrivate(cx, obj);
|
||||
}
|
||||
};
|
||||
|
@ -700,7 +700,7 @@ class Worker MOZ_FINAL : public WorkerParent
|
|||
}
|
||||
|
||||
static void jsTraceWorker(JSTracer *trc, JSObject *obj) {
|
||||
JS_ASSERT(JS_GET_CLASS(trc->context, obj) == &jsWorkerClass);
|
||||
JS_ASSERT(JS_GetClass(obj) == &jsWorkerClass);
|
||||
if (Worker *w = (Worker *) JS_GetPrivate(trc->context, obj)) {
|
||||
w->parent->trace(trc);
|
||||
w->events.trace(trc);
|
||||
|
@ -711,7 +711,7 @@ class Worker MOZ_FINAL : public WorkerParent
|
|||
}
|
||||
|
||||
static void jsFinalize(JSContext *cx, JSObject *obj) {
|
||||
JS_ASSERT(JS_GET_CLASS(cx, obj) == &jsWorkerClass);
|
||||
JS_ASSERT(JS_GetClass(obj) == &jsWorkerClass);
|
||||
if (Worker *w = (Worker *) JS_GetPrivate(cx, obj))
|
||||
delete w;
|
||||
}
|
||||
|
|
|
@ -1234,7 +1234,7 @@ ProcessArgs(JSContext *cx, JSObject *obj, char **argv, int argc)
|
|||
xpc_ActivateDebugMode();
|
||||
break;
|
||||
case 'P':
|
||||
if (JS_GET_CLASS(cx, JS_GetPrototype(cx, obj)) != &global_class) {
|
||||
if (JS_GetClass(JS_GetPrototype(cx, obj)) != &global_class) {
|
||||
JSObject *gobj;
|
||||
|
||||
if (!JS_DeepFreezeObject(cx, obj))
|
||||
|
|
|
@ -269,7 +269,7 @@ WrapperFactory::Rewrap(JSContext *cx, JSObject *obj, JSObject *wrappedProto, JSO
|
|||
GetProxyHandler(obj) == &WaiveXrayWrapperWrapper ||
|
||||
js::GetObjectClass(obj)->ext.innerObject,
|
||||
"wrapped object passed to rewrap");
|
||||
NS_ASSERTION(JS_GET_CLASS(cx, obj) != &XrayUtils::HolderClass, "trying to wrap a holder");
|
||||
NS_ASSERTION(JS_GetClass(obj) != &XrayUtils::HolderClass, "trying to wrap a holder");
|
||||
|
||||
JSCompartment *origin = js::GetObjectCompartment(obj);
|
||||
JSCompartment *target = js::GetContextCompartment(cx);
|
||||
|
|
Загрузка…
Ссылка в новой задаче