зеркало из https://github.com/mozilla/gecko-dev.git
bug 726944 - Remove JSClass::xdrObject and related functionality. r=luke
This commit is contained in:
Родитель
0698516eb4
Коммит
1013be2159
|
@ -194,7 +194,7 @@ JSClass nsXBLDocGlobalObject::gSharedGlobalClass = {
|
|||
nsXBLDocGlobalObject_getProperty, nsXBLDocGlobalObject_setProperty,
|
||||
JS_EnumerateStub, nsXBLDocGlobalObject_resolve,
|
||||
JS_ConvertStub, nsXBLDocGlobalObject_finalize,
|
||||
NULL, nsXBLDocGlobalObject_checkAccess, NULL, NULL, NULL, NULL,
|
||||
nsXBLDocGlobalObject_checkAccess, NULL, NULL, NULL,
|
||||
TraceXPCGlobal
|
||||
};
|
||||
|
||||
|
|
|
@ -146,7 +146,7 @@ JSClass nsXULPDGlobalObject::gSharedGlobalClass = {
|
|||
XPCONNECT_GLOBAL_FLAGS,
|
||||
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
|
||||
JS_EnumerateStub, nsXULPDGlobalObject_resolve, JS_ConvertStub,
|
||||
nsXULPDGlobalObject_finalize, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
nsXULPDGlobalObject_finalize, NULL, NULL, NULL, NULL,
|
||||
TraceXPCGlobal
|
||||
};
|
||||
|
||||
|
|
|
@ -184,8 +184,8 @@ static JSClass sNPObjectJSWrapperClass =
|
|||
NPObjWrapper_GetProperty, NPObjWrapper_SetProperty,
|
||||
(JSEnumerateOp)NPObjWrapper_newEnumerate,
|
||||
(JSResolveOp)NPObjWrapper_NewResolve, NPObjWrapper_Convert,
|
||||
NPObjWrapper_Finalize, nsnull, nsnull, NPObjWrapper_Call,
|
||||
NPObjWrapper_Construct, nsnull, nsnull
|
||||
NPObjWrapper_Finalize, nsnull, NPObjWrapper_Call,
|
||||
NPObjWrapper_Construct
|
||||
};
|
||||
|
||||
typedef struct NPObjectMemberPrivate {
|
||||
|
@ -213,8 +213,8 @@ static JSClass sNPObjectMemberClass =
|
|||
JS_PropertyStub, JS_PropertyStub,
|
||||
JS_PropertyStub, JS_StrictPropertyStub, JS_EnumerateStub,
|
||||
JS_ResolveStub, NPObjectMember_Convert,
|
||||
NPObjectMember_Finalize, nsnull, nsnull, NPObjectMember_Call,
|
||||
nsnull, nsnull, nsnull, NPObjectMember_Trace, nsnull
|
||||
NPObjectMember_Finalize, nsnull, NPObjectMember_Call,
|
||||
nsnull, nsnull, NPObjectMember_Trace
|
||||
};
|
||||
|
||||
static void
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
#include "WorkerPrivate.h"
|
||||
|
||||
#define PROPERTY_FLAGS \
|
||||
JSPROP_ENUMERATE | JSPROP_SHARED
|
||||
(JSPROP_ENUMERATE | JSPROP_SHARED)
|
||||
|
||||
#define FUNCTION_FLAGS \
|
||||
JSPROP_ENUMERATE
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
#include "WorkerInlines.h"
|
||||
|
||||
#define PROPERTY_FLAGS \
|
||||
JSPROP_ENUMERATE | JSPROP_SHARED
|
||||
(JSPROP_ENUMERATE | JSPROP_SHARED)
|
||||
|
||||
#define CONSTANT_FLAGS \
|
||||
JSPROP_ENUMERATE | JSPROP_SHARED | JSPROP_PERMANENT | JSPROP_READONLY
|
||||
|
|
|
@ -53,7 +53,7 @@
|
|||
#include "WorkerPrivate.h"
|
||||
|
||||
#define PROPERTY_FLAGS \
|
||||
JSPROP_ENUMERATE | JSPROP_SHARED
|
||||
(JSPROP_ENUMERATE | JSPROP_SHARED)
|
||||
|
||||
USING_WORKERS_NAMESPACE
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
#include "nsTraceRefcnt.h"
|
||||
|
||||
#define PROPERTY_FLAGS \
|
||||
JSPROP_ENUMERATE | JSPROP_SHARED
|
||||
(JSPROP_ENUMERATE | JSPROP_SHARED)
|
||||
|
||||
USING_WORKERS_NAMESPACE
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
#include "RuntimeService.h"
|
||||
|
||||
#define PROPERTY_FLAGS \
|
||||
JSPROP_ENUMERATE | JSPROP_SHARED
|
||||
(JSPROP_ENUMERATE | JSPROP_SHARED)
|
||||
|
||||
USING_WORKERS_NAMESPACE
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
#include "WorkerInlines.h"
|
||||
|
||||
#define PROPERTY_FLAGS \
|
||||
JSPROP_ENUMERATE | JSPROP_SHARED
|
||||
(JSPROP_ENUMERATE | JSPROP_SHARED)
|
||||
|
||||
#define FUNCTION_FLAGS \
|
||||
JSPROP_ENUMERATE
|
||||
|
@ -302,8 +302,8 @@ JSClass Worker::sClass = {
|
|||
"Worker",
|
||||
JSCLASS_HAS_PRIVATE | JSCLASS_IMPLEMENTS_BARRIERS,
|
||||
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
|
||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, Finalize, NULL, NULL, NULL,
|
||||
NULL, NULL, NULL, Trace, NULL
|
||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, Finalize,
|
||||
NULL, NULL, NULL, NULL, Trace,
|
||||
};
|
||||
|
||||
JSPropertySpec Worker::sProperties[] = {
|
||||
|
@ -417,8 +417,8 @@ JSClass ChromeWorker::sClass = {
|
|||
"ChromeWorker",
|
||||
JSCLASS_HAS_PRIVATE | JSCLASS_IMPLEMENTS_BARRIERS,
|
||||
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
|
||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, Finalize, NULL, NULL, NULL,
|
||||
NULL, NULL, NULL, Trace, NULL
|
||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, Finalize,
|
||||
NULL, NULL, NULL, NULL, Trace
|
||||
};
|
||||
|
||||
WorkerPrivate*
|
||||
|
|
|
@ -68,7 +68,7 @@
|
|||
#include "WorkerInlines.h"
|
||||
|
||||
#define PROPERTY_FLAGS \
|
||||
JSPROP_ENUMERATE | JSPROP_SHARED
|
||||
(JSPROP_ENUMERATE | JSPROP_SHARED)
|
||||
|
||||
#define FUNCTION_FLAGS \
|
||||
JSPROP_ENUMERATE
|
||||
|
@ -802,7 +802,7 @@ JSClass DedicatedWorkerGlobalScope::sClass = {
|
|||
JSCLASS_GLOBAL_FLAGS | JSCLASS_HAS_PRIVATE | JSCLASS_IMPLEMENTS_BARRIERS | JSCLASS_NEW_RESOLVE,
|
||||
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
|
||||
JS_EnumerateStub, reinterpret_cast<JSResolveOp>(Resolve), JS_ConvertStub,
|
||||
Finalize, NULL, NULL, NULL, NULL, NULL, NULL, Trace, NULL
|
||||
Finalize, NULL, NULL, NULL, NULL, Trace
|
||||
};
|
||||
|
||||
JSPropertySpec DedicatedWorkerGlobalScope::sProperties[] = {
|
||||
|
|
|
@ -48,13 +48,13 @@
|
|||
#include "WorkerInlines.h"
|
||||
|
||||
#define PROPERTY_FLAGS \
|
||||
JSPROP_ENUMERATE | JSPROP_SHARED
|
||||
(JSPROP_ENUMERATE | JSPROP_SHARED)
|
||||
|
||||
#define FUNCTION_FLAGS \
|
||||
JSPROP_ENUMERATE
|
||||
|
||||
#define CONSTANT_FLAGS \
|
||||
JSPROP_ENUMERATE | JSPROP_SHARED | JSPROP_PERMANENT | JSPROP_READONLY
|
||||
(JSPROP_ENUMERATE | JSPROP_SHARED | JSPROP_PERMANENT | JSPROP_READONLY)
|
||||
|
||||
USING_WORKERS_NAMESPACE
|
||||
|
||||
|
@ -223,7 +223,7 @@ JSClass XMLHttpRequestUpload::sClass = {
|
|||
JSCLASS_HAS_PRIVATE | JSCLASS_IMPLEMENTS_BARRIERS | JSCLASS_HAS_RESERVED_SLOTS(SLOT_COUNT),
|
||||
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
|
||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, Finalize,
|
||||
NULL, NULL, NULL, NULL, NULL, NULL, Trace, NULL
|
||||
NULL, NULL, NULL, NULL, Trace
|
||||
};
|
||||
|
||||
JSPropertySpec XMLHttpRequestUpload::sProperties[] = {
|
||||
|
@ -772,7 +772,7 @@ JSClass XMLHttpRequest::sClass = {
|
|||
JSCLASS_HAS_PRIVATE | JSCLASS_IMPLEMENTS_BARRIERS | JSCLASS_HAS_RESERVED_SLOTS(SLOT_COUNT),
|
||||
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
|
||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, Finalize,
|
||||
NULL, NULL, NULL, NULL, NULL, NULL, Trace, NULL
|
||||
NULL, NULL, NULL, NULL, Trace
|
||||
};
|
||||
|
||||
JSPropertySpec XMLHttpRequest::sProperties[] = {
|
||||
|
|
|
@ -172,13 +172,11 @@ const js::Class ObjectWrapperParent::sCPOW_JSClass = {
|
|||
(JSResolveOp) ObjectWrapperParent::CPOW_NewResolve,
|
||||
ObjectWrapperParent::CPOW_Convert,
|
||||
ObjectWrapperParent::CPOW_Finalize,
|
||||
nsnull, // reserved1
|
||||
nsnull, // checkAccess
|
||||
ObjectWrapperParent::CPOW_Call,
|
||||
ObjectWrapperParent::CPOW_Construct,
|
||||
nsnull, // xdrObject
|
||||
ObjectWrapperParent::CPOW_HasInstance,
|
||||
nsnull, // mark
|
||||
nsnull, // trace
|
||||
{
|
||||
ObjectWrapperParent::CPOW_Equality,
|
||||
nsnull, // outerObject
|
||||
|
|
|
@ -157,11 +157,9 @@ Class MapObject::class_ = {
|
|||
JS_ResolveStub,
|
||||
JS_ConvertStub,
|
||||
finalize,
|
||||
NULL, /* reserved0 */
|
||||
NULL, /* checkAccess */
|
||||
NULL, /* call */
|
||||
NULL, /* construct */
|
||||
NULL, /* xdrObject */
|
||||
NULL, /* hasInstance */
|
||||
mark
|
||||
};
|
||||
|
@ -308,11 +306,9 @@ Class SetObject::class_ = {
|
|||
JS_ResolveStub,
|
||||
JS_ConvertStub,
|
||||
finalize,
|
||||
NULL, /* reserved0 */
|
||||
NULL, /* checkAccess */
|
||||
NULL, /* call */
|
||||
NULL, /* construct */
|
||||
NULL, /* xdrObject */
|
||||
NULL, /* hasInstance */
|
||||
mark
|
||||
};
|
||||
|
|
|
@ -240,7 +240,7 @@ static JSClass sCTypeProtoClass = {
|
|||
JSCLASS_HAS_RESERVED_SLOTS(CTYPEPROTO_SLOTS),
|
||||
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
|
||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, CType::FinalizeProtoClass,
|
||||
NULL, NULL, ConstructAbstract, ConstructAbstract, NULL, NULL, NULL, NULL
|
||||
NULL, ConstructAbstract, ConstructAbstract
|
||||
};
|
||||
|
||||
// Class representing ctypes.CData.prototype and the 'prototype' properties
|
||||
|
@ -258,8 +258,8 @@ static JSClass sCTypeClass = {
|
|||
JSCLASS_IMPLEMENTS_BARRIERS | JSCLASS_HAS_RESERVED_SLOTS(CTYPE_SLOTS),
|
||||
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
|
||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, CType::Finalize,
|
||||
NULL, NULL, CType::ConstructData, CType::ConstructData, NULL,
|
||||
CType::HasInstance, CType::Trace, NULL
|
||||
NULL, CType::ConstructData, CType::ConstructData,
|
||||
CType::HasInstance, CType::Trace
|
||||
};
|
||||
|
||||
static JSClass sCDataClass = {
|
||||
|
@ -267,7 +267,7 @@ static JSClass sCDataClass = {
|
|||
JSCLASS_HAS_RESERVED_SLOTS(CDATA_SLOTS),
|
||||
JS_PropertyStub, JS_PropertyStub, ArrayType::Getter, ArrayType::Setter,
|
||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, CData::Finalize,
|
||||
NULL, NULL, FunctionType::Call, FunctionType::Call, NULL, NULL, NULL, NULL
|
||||
NULL, FunctionType::Call, FunctionType::Call
|
||||
};
|
||||
|
||||
static JSClass sCClosureClass = {
|
||||
|
@ -275,7 +275,7 @@ static JSClass sCClosureClass = {
|
|||
JSCLASS_IMPLEMENTS_BARRIERS | JSCLASS_HAS_RESERVED_SLOTS(CCLOSURE_SLOTS),
|
||||
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
|
||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, CClosure::Finalize,
|
||||
NULL, NULL, NULL, NULL, NULL, NULL, CClosure::Trace, NULL
|
||||
NULL, NULL, NULL, NULL, CClosure::Trace
|
||||
};
|
||||
|
||||
#define CTYPESFN_FLAGS \
|
||||
|
|
|
@ -329,6 +329,7 @@ class HeapValue
|
|||
bool isFalse() const { return value.isFalse(); }
|
||||
bool isNumber() const { return value.isNumber(); }
|
||||
bool isInt32() const { return value.isInt32(); }
|
||||
bool isDouble() const { return value.isDouble(); }
|
||||
bool isString() const { return value.isString(); }
|
||||
bool isObject() const { return value.isObject(); }
|
||||
bool isMagic(JSWhyMagic why) const { return value.isMagic(why); }
|
||||
|
|
|
@ -124,7 +124,7 @@ MSG_DEF(JSMSG_COMPILE_EXECED_SCRIPT, 37, 0, JSEXN_TYPEERR, "can't compile over
|
|||
MSG_DEF(JSMSG_CANT_CONVERT_TO, 38, 2, JSEXN_TYPEERR, "can't convert {0} to {1}")
|
||||
MSG_DEF(JSMSG_NO_PROPERTIES, 39, 1, JSEXN_TYPEERR, "{0} has no properties")
|
||||
MSG_DEF(JSMSG_CANT_FIND_CLASS, 40, 1, JSEXN_TYPEERR, "can't find class id {0}")
|
||||
MSG_DEF(JSMSG_CANT_XDR_CLASS, 41, 1, JSEXN_TYPEERR, "can't XDR class {0}")
|
||||
MSG_DEF(JSMSG_UNUSED41 , 41, 0, JSEXN_NONE, "")
|
||||
MSG_DEF(JSMSG_BYTECODE_TOO_BIG, 42, 2, JSEXN_INTERNALERR, "bytecode {0} too large (limit {1})")
|
||||
MSG_DEF(JSMSG_UNKNOWN_FORMAT, 43, 1, JSEXN_INTERNALERR, "unknown bytecode format {0}")
|
||||
MSG_DEF(JSMSG_TOO_MANY_CON_ARGS, 44, 0, JSEXN_SYNTAXERR, "too many constructor arguments")
|
||||
|
|
|
@ -35,11 +35,9 @@ js::Class HasCustomIterClass = {
|
|||
JS_ResolveStub,
|
||||
JS_ConvertStub,
|
||||
NULL,
|
||||
NULL, /* reserved0 */
|
||||
NULL, /* checkAccess */
|
||||
NULL, /* call */
|
||||
NULL, /* construct */
|
||||
NULL, /* xdrObject */
|
||||
NULL, /* hasInstance */
|
||||
NULL, /* mark */
|
||||
{
|
||||
|
|
|
@ -26,11 +26,9 @@ js::Class TestExtendedEq_JSClass = {
|
|||
JS_ResolveStub,
|
||||
NULL, /* convert */
|
||||
NULL, /* finalize */
|
||||
NULL, /* reserved0 */
|
||||
NULL, /* checkAccess */
|
||||
NULL, /* call */
|
||||
NULL, /* construct */
|
||||
NULL, /* xdrObject */
|
||||
NULL, /* hasInstance */
|
||||
NULL, /* mark */
|
||||
{
|
||||
|
|
|
@ -86,7 +86,7 @@ BEGIN_TEST(testNewObject_1)
|
|||
0,
|
||||
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
|
||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, NULL,
|
||||
NULL, NULL, NULL, constructHook, NULL, NULL, NULL, NULL
|
||||
NULL, NULL, constructHook
|
||||
};
|
||||
JSObject *ctor = JS_NewObject(cx, &cls, NULL, NULL);
|
||||
CHECK(ctor);
|
||||
|
|
|
@ -4291,11 +4291,9 @@ static Class prop_iter_class = {
|
|||
JS_ResolveStub,
|
||||
JS_ConvertStub,
|
||||
prop_iter_finalize,
|
||||
NULL, /* reserved0 */
|
||||
NULL, /* checkAccess */
|
||||
NULL, /* call */
|
||||
NULL, /* construct */
|
||||
NULL, /* xdrObject */
|
||||
NULL, /* hasInstance */
|
||||
prop_iter_trace
|
||||
};
|
||||
|
|
|
@ -1350,13 +1350,6 @@ typedef JSBool
|
|||
(* JSCheckAccessOp)(JSContext *cx, JSObject *obj, jsid id, JSAccessMode mode,
|
||||
jsval *vp);
|
||||
|
||||
/*
|
||||
* Encode or decode an object, given an XDR state record representing external
|
||||
* data. See jsxdrapi.h.
|
||||
*/
|
||||
typedef JSBool
|
||||
(* JSXDRObjectOp)(JSXDRState *xdr, JSObject **objp);
|
||||
|
||||
/*
|
||||
* Check whether v is an instance of obj. Return false on error or exception,
|
||||
* true on success with JS_TRUE in *bp if v is an instance of obj, JS_FALSE in
|
||||
|
@ -3397,15 +3390,12 @@ struct JSClass {
|
|||
JSFinalizeOp finalize;
|
||||
|
||||
/* Optionally non-null members start here. */
|
||||
JSClassInternal reserved0;
|
||||
JSCheckAccessOp checkAccess;
|
||||
JSNative call;
|
||||
JSNative construct;
|
||||
JSXDRObjectOp xdrObject;
|
||||
JSHasInstanceOp hasInstance;
|
||||
JSTraceOp trace;
|
||||
|
||||
JSClassInternal reserved1;
|
||||
void *reserved[40];
|
||||
};
|
||||
|
||||
|
@ -3489,8 +3479,8 @@ struct JSClass {
|
|||
& JSCLASS_CACHED_PROTO_MASK))
|
||||
|
||||
/* Initializer for unused members of statically initialized JSClass structs. */
|
||||
#define JSCLASS_NO_INTERNAL_MEMBERS 0,{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
|
||||
#define JSCLASS_NO_OPTIONAL_MEMBERS 0,0,0,0,0,0,0,JSCLASS_NO_INTERNAL_MEMBERS
|
||||
#define JSCLASS_NO_INTERNAL_MEMBERS {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
|
||||
#define JSCLASS_NO_OPTIONAL_MEMBERS 0,0,0,0,0,JSCLASS_NO_INTERNAL_MEMBERS
|
||||
|
||||
extern JS_PUBLIC_API(jsint)
|
||||
JS_IdArrayLength(JSContext *cx, JSIdArray *ida);
|
||||
|
|
|
@ -1225,11 +1225,9 @@ Class js::ArrayClass = {
|
|||
JS_ResolveStub,
|
||||
JS_ConvertStub,
|
||||
NULL,
|
||||
NULL, /* reserved0 */
|
||||
NULL, /* checkAccess */
|
||||
NULL, /* call */
|
||||
NULL, /* construct */
|
||||
NULL, /* xdrObject */
|
||||
NULL, /* hasInstance */
|
||||
array_trace, /* trace */
|
||||
{
|
||||
|
@ -1289,11 +1287,9 @@ Class js::SlowArrayClass = {
|
|||
JS_ResolveStub,
|
||||
JS_ConvertStub,
|
||||
NULL,
|
||||
NULL, /* reserved0 */
|
||||
NULL, /* checkAccess */
|
||||
NULL, /* call */
|
||||
NULL, /* construct */
|
||||
NULL, /* xdrObject */
|
||||
NULL, /* hasInstance */
|
||||
NULL, /* trace */
|
||||
{
|
||||
|
|
|
@ -265,11 +265,9 @@ typedef void
|
|||
JSFinalizeOp finalize; \
|
||||
\
|
||||
/* Optionally non-null members start here. */ \
|
||||
JSClassInternal reserved0; \
|
||||
JSCheckAccessOp checkAccess; \
|
||||
JSNative call; \
|
||||
JSNative construct; \
|
||||
JSXDRObjectOp xdrObject; \
|
||||
JSHasInstanceOp hasInstance; \
|
||||
JSTraceOp trace
|
||||
|
||||
|
@ -372,11 +370,9 @@ JS_STATIC_ASSERT(offsetof(JSClass, enumerate) == offsetof(Class, enumerate));
|
|||
JS_STATIC_ASSERT(offsetof(JSClass, resolve) == offsetof(Class, resolve));
|
||||
JS_STATIC_ASSERT(offsetof(JSClass, convert) == offsetof(Class, convert));
|
||||
JS_STATIC_ASSERT(offsetof(JSClass, finalize) == offsetof(Class, finalize));
|
||||
JS_STATIC_ASSERT(offsetof(JSClass, reserved0) == offsetof(Class, reserved0));
|
||||
JS_STATIC_ASSERT(offsetof(JSClass, checkAccess) == offsetof(Class, checkAccess));
|
||||
JS_STATIC_ASSERT(offsetof(JSClass, call) == offsetof(Class, call));
|
||||
JS_STATIC_ASSERT(offsetof(JSClass, construct) == offsetof(Class, construct));
|
||||
JS_STATIC_ASSERT(offsetof(JSClass, xdrObject) == offsetof(Class, xdrObject));
|
||||
JS_STATIC_ASSERT(offsetof(JSClass, hasInstance) == offsetof(Class, hasInstance));
|
||||
JS_STATIC_ASSERT(offsetof(JSClass, trace) == offsetof(Class, trace));
|
||||
JS_STATIC_ASSERT(sizeof(JSClass) == sizeof(Class));
|
||||
|
|
|
@ -104,11 +104,9 @@ Class js::ErrorClass = {
|
|||
(JSResolveOp)exn_resolve,
|
||||
JS_ConvertStub,
|
||||
exn_finalize,
|
||||
NULL, /* reserved0 */
|
||||
NULL, /* checkAccess */
|
||||
NULL, /* call */
|
||||
NULL, /* construct */
|
||||
NULL, /* xdrObject */
|
||||
NULL, /* hasInstance */
|
||||
exn_trace
|
||||
};
|
||||
|
|
|
@ -564,11 +564,9 @@ Class js::NormalArgumentsObjectClass = {
|
|||
reinterpret_cast<JSResolveOp>(args_resolve),
|
||||
JS_ConvertStub,
|
||||
args_finalize, /* finalize */
|
||||
NULL, /* reserved0 */
|
||||
NULL, /* checkAccess */
|
||||
NULL, /* call */
|
||||
NULL, /* construct */
|
||||
NULL, /* xdrObject */
|
||||
NULL, /* hasInstance */
|
||||
args_trace,
|
||||
{
|
||||
|
@ -600,11 +598,9 @@ Class js::StrictArgumentsObjectClass = {
|
|||
reinterpret_cast<JSResolveOp>(strictargs_resolve),
|
||||
JS_ConvertStub,
|
||||
args_finalize, /* finalize */
|
||||
NULL, /* reserved0 */
|
||||
NULL, /* checkAccess */
|
||||
NULL, /* call */
|
||||
NULL, /* construct */
|
||||
NULL, /* xdrObject */
|
||||
NULL, /* hasInstance */
|
||||
args_trace,
|
||||
{
|
||||
|
@ -954,11 +950,9 @@ JS_PUBLIC_DATA(Class) js::CallClass = {
|
|||
(JSResolveOp)call_resolve,
|
||||
NULL, /* convert: Leave it NULL so we notice if calls ever escape */
|
||||
NULL, /* finalize */
|
||||
NULL, /* reserved0 */
|
||||
NULL, /* checkAccess */
|
||||
NULL, /* call */
|
||||
NULL, /* construct */
|
||||
NULL, /* xdrObject */
|
||||
NULL, /* hasInstance */
|
||||
call_trace
|
||||
};
|
||||
|
@ -1350,7 +1344,7 @@ fun_resolve(JSContext *cx, JSObject *obj, jsid id, uintN flags,
|
|||
|
||||
/* XXX store parent and proto, if defined */
|
||||
JSBool
|
||||
js_XDRFunctionObject(JSXDRState *xdr, JSObject **objp)
|
||||
js::XDRFunctionObject(JSXDRState *xdr, JSObject **objp)
|
||||
{
|
||||
JSContext *cx;
|
||||
JSFunction *fun;
|
||||
|
@ -1393,7 +1387,7 @@ js_XDRFunctionObject(JSXDRState *xdr, JSObject **objp)
|
|||
if (!JS_XDRUint32(xdr, &flagsword))
|
||||
return false;
|
||||
|
||||
if (!js_XDRScript(xdr, &script))
|
||||
if (!XDRScript(xdr, &script))
|
||||
return false;
|
||||
|
||||
if (xdr->mode == JSXDR_DECODE) {
|
||||
|
@ -1411,11 +1405,7 @@ js_XDRFunctionObject(JSXDRState *xdr, JSObject **objp)
|
|||
return true;
|
||||
}
|
||||
|
||||
#else /* !JS_HAS_XDR */
|
||||
|
||||
#define js_XDRFunctionObject NULL
|
||||
|
||||
#endif /* !JS_HAS_XDR */
|
||||
#endif /* JS_HAS_XDR */
|
||||
|
||||
/*
|
||||
* [[HasInstance]] internal method for Function objects: fetch the .prototype
|
||||
|
@ -1510,11 +1500,9 @@ JS_FRIEND_DATA(Class) js::FunctionClass = {
|
|||
(JSResolveOp)fun_resolve,
|
||||
JS_ConvertStub,
|
||||
fun_finalize,
|
||||
NULL, /* reserved0 */
|
||||
NULL, /* checkAccess */
|
||||
NULL, /* call */
|
||||
NULL, /* construct */
|
||||
NULL,
|
||||
fun_hasInstance,
|
||||
fun_trace
|
||||
};
|
||||
|
@ -2232,7 +2220,7 @@ js_CloneFunctionObject(JSContext *cx, JSFunction *fun, JSObject *parent,
|
|||
JS_ASSERT(script->compartment() != cx->compartment);
|
||||
|
||||
clone->script().init(NULL);
|
||||
JSScript *cscript = js_CloneScript(cx, script);
|
||||
JSScript *cscript = CloneScript(cx, script);
|
||||
if (!cscript)
|
||||
return NULL;
|
||||
|
||||
|
|
|
@ -437,8 +437,12 @@ js_PutArgsObject(js::StackFrame *fp);
|
|||
inline bool
|
||||
js_IsNamedLambda(JSFunction *fun) { return (fun->flags & JSFUN_LAMBDA) && fun->atom; }
|
||||
|
||||
namespace js {
|
||||
|
||||
extern JSBool
|
||||
js_XDRFunctionObject(JSXDRState *xdr, JSObject **objp);
|
||||
XDRFunctionObject(JSXDRState *xdr, JSObject **objp);
|
||||
|
||||
} /* namespace js */
|
||||
|
||||
extern JSBool
|
||||
js_fun_apply(JSContext *cx, uintN argc, js::Value *vp);
|
||||
|
|
|
@ -100,11 +100,9 @@ Class js::IteratorClass = {
|
|||
JS_ResolveStub,
|
||||
JS_ConvertStub,
|
||||
iterator_finalize,
|
||||
NULL, /* reserved */
|
||||
NULL, /* checkAccess */
|
||||
NULL, /* call */
|
||||
NULL, /* construct */
|
||||
NULL, /* xdrObject */
|
||||
NULL, /* hasInstance */
|
||||
iterator_trace,
|
||||
{
|
||||
|
@ -127,11 +125,9 @@ Class js::ElementIteratorClass = {
|
|||
JS_ResolveStub,
|
||||
JS_ConvertStub,
|
||||
NULL, /* finalize */
|
||||
NULL, /* reserved */
|
||||
NULL, /* checkAccess */
|
||||
NULL, /* call */
|
||||
NULL, /* construct */
|
||||
NULL, /* xdrObject */
|
||||
NULL, /* hasInstance */
|
||||
NULL, /* trace */
|
||||
{
|
||||
|
@ -1340,11 +1336,9 @@ Class js::StopIterationClass = {
|
|||
JS_ResolveStub,
|
||||
JS_ConvertStub,
|
||||
NULL, /* finalize */
|
||||
NULL, /* reserved0 */
|
||||
NULL, /* checkAccess */
|
||||
NULL, /* call */
|
||||
NULL, /* construct */
|
||||
NULL, /* xdrObject */
|
||||
stopiter_hasInstance
|
||||
};
|
||||
|
||||
|
@ -1429,11 +1423,9 @@ Class js::GeneratorClass = {
|
|||
JS_ResolveStub,
|
||||
JS_ConvertStub,
|
||||
generator_finalize,
|
||||
NULL, /* reserved */
|
||||
NULL, /* checkAccess */
|
||||
NULL, /* call */
|
||||
NULL, /* construct */
|
||||
NULL, /* xdrObject */
|
||||
NULL, /* hasInstance */
|
||||
generator_trace,
|
||||
{
|
||||
|
|
|
@ -6179,88 +6179,6 @@ js_ValueToNonNullObject(JSContext *cx, const Value &v)
|
|||
return obj;
|
||||
}
|
||||
|
||||
#if JS_HAS_XDR
|
||||
|
||||
JSBool
|
||||
js_XDRObject(JSXDRState *xdr, JSObject **objp)
|
||||
{
|
||||
JSContext *cx;
|
||||
JSAtom *atom;
|
||||
Class *clasp;
|
||||
uint32_t classId, classDef;
|
||||
JSProtoKey protoKey;
|
||||
JSObject *proto;
|
||||
|
||||
cx = xdr->cx;
|
||||
atom = NULL;
|
||||
if (xdr->mode == JSXDR_ENCODE) {
|
||||
clasp = (*objp)->getClass();
|
||||
classId = JS_XDRFindClassIdByName(xdr, clasp->name);
|
||||
classDef = !classId;
|
||||
if (classDef) {
|
||||
if (!JS_XDRRegisterClass(xdr, Jsvalify(clasp), &classId))
|
||||
return JS_FALSE;
|
||||
protoKey = JSCLASS_CACHED_PROTO_KEY(clasp);
|
||||
if (protoKey != JSProto_Null) {
|
||||
classDef |= (protoKey << 1);
|
||||
} else {
|
||||
atom = js_Atomize(cx, clasp->name, strlen(clasp->name));
|
||||
if (!atom)
|
||||
return JS_FALSE;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
clasp = NULL; /* quell GCC overwarning */
|
||||
classDef = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* XDR a flag word, which could be 0 for a class use, in which case no
|
||||
* name follows, only the id in xdr's class registry; 1 for a class def,
|
||||
* in which case the flag word is followed by the class name transferred
|
||||
* from or to atom; or a value greater than 1, an odd number that when
|
||||
* divided by two yields the JSProtoKey for class. In the last case, as
|
||||
* in the 0 classDef case, no name is transferred via atom.
|
||||
*/
|
||||
if (!JS_XDRUint32(xdr, &classDef))
|
||||
return JS_FALSE;
|
||||
if (classDef == 1 && !js_XDRAtom(xdr, &atom))
|
||||
return JS_FALSE;
|
||||
|
||||
if (!JS_XDRUint32(xdr, &classId))
|
||||
return JS_FALSE;
|
||||
|
||||
if (xdr->mode == JSXDR_DECODE) {
|
||||
if (classDef) {
|
||||
/* NB: we know that JSProto_Null is 0 here, for backward compat. */
|
||||
protoKey = (JSProtoKey) (classDef >> 1);
|
||||
if (!js_GetClassPrototype(cx, NULL, protoKey, &proto, clasp))
|
||||
return JS_FALSE;
|
||||
clasp = proto->getClass();
|
||||
if (!JS_XDRRegisterClass(xdr, Jsvalify(clasp), &classId))
|
||||
return JS_FALSE;
|
||||
} else {
|
||||
clasp = Valueify(JS_XDRFindClassById(xdr, classId));
|
||||
if (!clasp) {
|
||||
char numBuf[12];
|
||||
JS_snprintf(numBuf, sizeof numBuf, "%ld", (long)classId);
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL,
|
||||
JSMSG_CANT_FIND_CLASS, numBuf);
|
||||
return JS_FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!clasp->xdrObject) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL,
|
||||
JSMSG_CANT_XDR_CLASS, clasp->name);
|
||||
return JS_FALSE;
|
||||
}
|
||||
return clasp->xdrObject(xdr, objp);
|
||||
}
|
||||
|
||||
#endif /* JS_HAS_XDR */
|
||||
|
||||
#ifdef DEBUG
|
||||
void
|
||||
js_PrintObjectSlotName(JSTracer *trc, char *buf, size_t bufsize)
|
||||
|
|
|
@ -1960,9 +1960,6 @@ ValueToObject(JSContext *cx, const Value &v)
|
|||
|
||||
} /* namespace js */
|
||||
|
||||
extern JSBool
|
||||
js_XDRObject(JSXDRState *xdr, JSObject **objp);
|
||||
|
||||
extern void
|
||||
js_PrintObjectSlotName(JSTracer *trc, char *buf, size_t bufsize);
|
||||
|
||||
|
|
|
@ -1322,11 +1322,9 @@ JS_FRIEND_DATA(Class) js::ObjectProxyClass = {
|
|||
JS_ResolveStub,
|
||||
proxy_Convert,
|
||||
proxy_Finalize, /* finalize */
|
||||
NULL, /* reserved0 */
|
||||
NULL, /* checkAccess */
|
||||
NULL, /* call */
|
||||
NULL, /* construct */
|
||||
NULL, /* xdrObject */
|
||||
proxy_HasInstance, /* hasInstance */
|
||||
proxy_TraceObject, /* trace */
|
||||
JS_NULL_CLASS_EXT,
|
||||
|
@ -1378,11 +1376,9 @@ JS_FRIEND_DATA(Class) js::OuterWindowProxyClass = {
|
|||
JS_ResolveStub,
|
||||
JS_ConvertStub,
|
||||
proxy_Finalize, /* finalize */
|
||||
NULL, /* reserved0 */
|
||||
NULL, /* checkAccess */
|
||||
NULL, /* call */
|
||||
NULL, /* construct */
|
||||
NULL, /* xdrObject */
|
||||
NULL, /* hasInstance */
|
||||
proxy_TraceObject, /* trace */
|
||||
{
|
||||
|
@ -1456,11 +1452,9 @@ JS_FRIEND_DATA(Class) js::FunctionProxyClass = {
|
|||
JS_ResolveStub,
|
||||
JS_ConvertStub,
|
||||
NULL, /* finalize */
|
||||
NULL, /* reserved0 */
|
||||
NULL, /* checkAccess */
|
||||
proxy_Call,
|
||||
proxy_Construct,
|
||||
NULL, /* xdrObject */
|
||||
FunctionClass.hasInstance,
|
||||
proxy_TraceFunction, /* trace */
|
||||
JS_NULL_CLASS_EXT,
|
||||
|
@ -1734,7 +1728,6 @@ Class js::CallableObjectClass = {
|
|||
JS_ResolveStub,
|
||||
JS_ConvertStub,
|
||||
NULL, /* finalize */
|
||||
NULL, /* reserved0 */
|
||||
NULL, /* checkAccess */
|
||||
callable_Call,
|
||||
callable_Construct,
|
||||
|
|
|
@ -336,26 +336,114 @@ CheckScript(JSScript *script, JSScript *prev)
|
|||
|
||||
#endif /* JS_CRASH_DIAGNOSTICS */
|
||||
|
||||
} /* namespace js */
|
||||
|
||||
#if JS_HAS_XDR
|
||||
|
||||
enum ScriptBits {
|
||||
NoScriptRval,
|
||||
SavedCallerFun,
|
||||
StrictModeCode,
|
||||
UsesEval,
|
||||
UsesArguments
|
||||
};
|
||||
static bool
|
||||
XDRScriptConst(JSXDRState *xdr, HeapValue *vp)
|
||||
{
|
||||
/*
|
||||
* A script constant can be an arbitrary primitive value as they are used
|
||||
* to implement JSOP_LOOKUPSWITCH. But they cannot be objects, see
|
||||
* bug 407186.
|
||||
*/
|
||||
enum ConstTag {
|
||||
SCRIPT_INT = 0,
|
||||
SCRIPT_DOUBLE = 1,
|
||||
SCRIPT_STRING = 2,
|
||||
SCRIPT_TRUE = 3,
|
||||
SCRIPT_FALSE = 4,
|
||||
SCRIPT_NULL = 5,
|
||||
SCRIPT_VOID = 6
|
||||
};
|
||||
|
||||
uint32_t tag;
|
||||
if (xdr->mode == JSXDR_ENCODE) {
|
||||
if (vp->isInt32()) {
|
||||
tag = SCRIPT_INT;
|
||||
} else if (vp->isDouble()) {
|
||||
tag = SCRIPT_DOUBLE;
|
||||
} else if (vp->isString()) {
|
||||
tag = SCRIPT_STRING;
|
||||
} else if (vp->isTrue()) {
|
||||
tag = SCRIPT_TRUE;
|
||||
} else if (vp->isFalse()) {
|
||||
tag = SCRIPT_FALSE;
|
||||
} else if (vp->isNull()) {
|
||||
tag = SCRIPT_NULL;
|
||||
} else {
|
||||
JS_ASSERT(vp->isUndefined());
|
||||
tag = SCRIPT_VOID;
|
||||
}
|
||||
}
|
||||
|
||||
if (!JS_XDRUint32(xdr, &tag))
|
||||
return false;
|
||||
|
||||
switch (tag) {
|
||||
case SCRIPT_INT: {
|
||||
uint32_t i;
|
||||
if (xdr->mode == JSXDR_ENCODE)
|
||||
i = uint32_t(vp->toInt32());
|
||||
if (!JS_XDRUint32(xdr, &i))
|
||||
return JS_FALSE;
|
||||
if (xdr->mode == JSXDR_DECODE)
|
||||
vp->init(Int32Value(int32_t(i)));
|
||||
break;
|
||||
}
|
||||
case SCRIPT_DOUBLE: {
|
||||
double d;
|
||||
if (xdr->mode == JSXDR_ENCODE)
|
||||
d = vp->toDouble();
|
||||
if (!JS_XDRDouble(xdr, &d))
|
||||
return false;
|
||||
if (xdr->mode == JSXDR_DECODE)
|
||||
vp->init(DoubleValue(d));
|
||||
break;
|
||||
}
|
||||
case SCRIPT_STRING: {
|
||||
JSString *str;
|
||||
if (xdr->mode == JSXDR_ENCODE)
|
||||
str = vp->toString();
|
||||
if (!JS_XDRString(xdr, &str))
|
||||
return false;
|
||||
if (xdr->mode == JSXDR_DECODE)
|
||||
vp->init(StringValue(str));
|
||||
break;
|
||||
}
|
||||
case SCRIPT_TRUE:
|
||||
if (xdr->mode == JSXDR_DECODE)
|
||||
vp->init(BooleanValue(true));
|
||||
break;
|
||||
case SCRIPT_FALSE:
|
||||
if (xdr->mode == JSXDR_DECODE)
|
||||
vp->init(BooleanValue(false));
|
||||
break;
|
||||
case SCRIPT_NULL:
|
||||
if (xdr->mode == JSXDR_DECODE)
|
||||
vp->init(NullValue());
|
||||
break;
|
||||
case SCRIPT_VOID:
|
||||
if (xdr->mode == JSXDR_DECODE)
|
||||
vp->init(UndefinedValue());
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static const char *
|
||||
SaveScriptFilename(JSContext *cx, const char *filename);
|
||||
|
||||
JSBool
|
||||
js_XDRScript(JSXDRState *xdr, JSScript **scriptp)
|
||||
XDRScript(JSXDRState *xdr, JSScript **scriptp)
|
||||
{
|
||||
JSScript *oldscript;
|
||||
JSBool ok;
|
||||
enum ScriptBits {
|
||||
NoScriptRval,
|
||||
SavedCallerFun,
|
||||
StrictModeCode,
|
||||
UsesEval,
|
||||
UsesArguments
|
||||
};
|
||||
|
||||
uint32_t length, lineno, nslots;
|
||||
uint32_t natoms, nsrcnotes, ntrynotes, nobjects, nregexps, nconsts, i;
|
||||
uint32_t prologLength, version, encodedClosedCount;
|
||||
|
@ -366,23 +454,26 @@ js_XDRScript(JSXDRState *xdr, JSScript **scriptp)
|
|||
uint32_t scriptBits = 0;
|
||||
|
||||
JSContext *cx = xdr->cx;
|
||||
JSScript *script = *scriptp;
|
||||
JSScript *script;
|
||||
nsrcnotes = ntrynotes = natoms = nobjects = nregexps = nconsts = 0;
|
||||
jssrcnote *notes = NULL;
|
||||
XDRScriptState *state = xdr->state;
|
||||
|
||||
JS_ASSERT(state);
|
||||
|
||||
/* Should not XDR scripts optimized for a single global object. */
|
||||
JS_ASSERT_IF(script, !JSScript::isValidOffset(script->globalsOffset));
|
||||
|
||||
/* XDR arguments, local vars, and upvars. */
|
||||
uint16_t nargs, nvars, nupvars;
|
||||
#if defined(DEBUG) || defined(__GNUC__) /* quell GCC overwarning */
|
||||
script = NULL;
|
||||
nargs = nvars = nupvars = Bindings::BINDING_COUNT_LIMIT;
|
||||
#endif
|
||||
uint32_t argsVars, paddingUpvars;
|
||||
if (xdr->mode == JSXDR_ENCODE) {
|
||||
script = *scriptp;
|
||||
|
||||
/* Should not XDR scripts optimized for a single global object. */
|
||||
JS_ASSERT(!JSScript::isValidOffset(script->globalsOffset));
|
||||
|
||||
nargs = script->bindings.countArgs();
|
||||
nvars = script->bindings.countVars();
|
||||
nupvars = script->bindings.countUpvars();
|
||||
|
@ -586,22 +677,13 @@ js_XDRScript(JSXDRState *xdr, JSScript **scriptp)
|
|||
script->usesArguments = true;
|
||||
}
|
||||
|
||||
/*
|
||||
* Control hereafter must goto error on failure, in order for the
|
||||
* DECODE case to destroy script.
|
||||
*/
|
||||
oldscript = xdr->script;
|
||||
|
||||
xdr->script = script;
|
||||
ok = JS_XDRBytes(xdr, (char *)script->code, length * sizeof(jsbytecode));
|
||||
|
||||
if (!ok)
|
||||
goto error;
|
||||
if (!JS_XDRBytes(xdr, (char *)script->code, length * sizeof(jsbytecode)))
|
||||
return false;
|
||||
|
||||
if (!JS_XDRBytes(xdr, (char *)notes, nsrcnotes * sizeof(jssrcnote)) ||
|
||||
!JS_XDRUint32(xdr, &lineno) ||
|
||||
!JS_XDRUint32(xdr, &nslots)) {
|
||||
goto error;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (xdr->mode == JSXDR_DECODE && state->filename) {
|
||||
|
@ -612,7 +694,7 @@ js_XDRScript(JSXDRState *xdr, JSScript **scriptp)
|
|||
state->filename = filename;
|
||||
state->filenameSaved = true;
|
||||
if (!filename)
|
||||
goto error;
|
||||
return false;
|
||||
}
|
||||
script->filename = state->filename;
|
||||
}
|
||||
|
@ -624,23 +706,23 @@ js_XDRScript(JSXDRState *xdr, JSScript **scriptp)
|
|||
encodeable = script->principals && callbacks && callbacks->principalsTranscoder;
|
||||
|
||||
if (!JS_XDRUint32(xdr, &encodeable))
|
||||
goto error;
|
||||
return false;
|
||||
|
||||
if (encodeable) {
|
||||
if (!callbacks || !callbacks->principalsTranscoder) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL,
|
||||
JSMSG_CANT_DECODE_PRINCIPALS);
|
||||
goto error;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!callbacks->principalsTranscoder(xdr, &script->principals))
|
||||
goto error;
|
||||
return false;
|
||||
|
||||
if (xdr->mode == JSXDR_ENCODE)
|
||||
sameOriginPrincipals = script->principals == script->originPrincipals;
|
||||
|
||||
if (!JS_XDRUint32(xdr, &sameOriginPrincipals))
|
||||
goto error;
|
||||
return false;
|
||||
|
||||
if (sameOriginPrincipals) {
|
||||
if (xdr->mode == JSXDR_DECODE) {
|
||||
|
@ -649,7 +731,7 @@ js_XDRScript(JSXDRState *xdr, JSScript **scriptp)
|
|||
}
|
||||
} else {
|
||||
if (!callbacks->principalsTranscoder(xdr, &script->originPrincipals))
|
||||
goto error;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -661,7 +743,7 @@ js_XDRScript(JSXDRState *xdr, JSScript **scriptp)
|
|||
|
||||
for (i = 0; i != natoms; ++i) {
|
||||
if (!js_XDRAtom(xdr, &script->atoms[i]))
|
||||
goto error;
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -679,37 +761,35 @@ js_XDRScript(JSXDRState *xdr, JSScript **scriptp)
|
|||
isBlock = obj->isBlock() ? 1 : 0;
|
||||
}
|
||||
if (!JS_XDRUint32(xdr, &isBlock))
|
||||
goto error;
|
||||
return false;
|
||||
if (isBlock == 0) {
|
||||
JSObject *tmp = *objp;
|
||||
if (!js_XDRFunctionObject(xdr, &tmp))
|
||||
goto error;
|
||||
if (!XDRFunctionObject(xdr, &tmp))
|
||||
return false;
|
||||
*objp = tmp;
|
||||
} else {
|
||||
JS_ASSERT(isBlock == 1);
|
||||
StaticBlockObject *tmp = static_cast<StaticBlockObject *>(objp->get());
|
||||
if (!js_XDRStaticBlockObject(xdr, &tmp))
|
||||
goto error;
|
||||
if (!XDRStaticBlockObject(xdr, script, &tmp))
|
||||
return false;
|
||||
*objp = tmp;
|
||||
}
|
||||
}
|
||||
for (i = 0; i != nupvars; ++i) {
|
||||
if (!JS_XDRUint32(xdr, reinterpret_cast<uint32_t *>(&script->upvars()->vector[i])))
|
||||
goto error;
|
||||
return false;
|
||||
}
|
||||
for (i = 0; i != nregexps; ++i) {
|
||||
JSObject *tmp = script->regexps()->vector[i];
|
||||
if (!js_XDRRegExpObject(xdr, &tmp))
|
||||
goto error;
|
||||
script->regexps()->vector[i] = tmp;
|
||||
if (!XDRScriptRegExpObject(xdr, &script->regexps()->vector[i]))
|
||||
return false;
|
||||
}
|
||||
for (i = 0; i != nClosedArgs; ++i) {
|
||||
if (!JS_XDRUint32(xdr, &script->closedSlots[i]))
|
||||
goto error;
|
||||
return false;
|
||||
}
|
||||
for (i = 0; i != nClosedVars; ++i) {
|
||||
if (!JS_XDRUint32(xdr, &script->closedSlots[nClosedArgs + i]))
|
||||
goto error;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ntrynotes != 0) {
|
||||
|
@ -734,7 +814,7 @@ js_XDRScript(JSXDRState *xdr, JSScript **scriptp)
|
|||
if (!JS_XDRUint32(xdr, &kindAndDepth) ||
|
||||
!JS_XDRUint32(xdr, &tn->start) ||
|
||||
!JS_XDRUint32(xdr, &tn->length)) {
|
||||
goto error;
|
||||
return false;
|
||||
}
|
||||
if (xdr->mode == JSXDR_DECODE) {
|
||||
tn->kind = uint8_t(kindAndDepth >> 16);
|
||||
|
@ -743,28 +823,27 @@ js_XDRScript(JSXDRState *xdr, JSScript **scriptp)
|
|||
} while (tn != tnfirst);
|
||||
}
|
||||
|
||||
for (i = 0; i != nconsts; ++i) {
|
||||
Value tmp = script->consts()->vector[i];
|
||||
if (!JS_XDRValue(xdr, &tmp))
|
||||
goto error;
|
||||
script->consts()->vector[i] = tmp;
|
||||
if (nconsts) {
|
||||
HeapValue *vector = script->consts()->vector;
|
||||
for (i = 0; i != nconsts; ++i) {
|
||||
if (!XDRScriptConst(xdr, &vector[i]))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (xdr->mode == JSXDR_DECODE && cx->hasRunOption(JSOPTION_PCCOUNT))
|
||||
(void) script->initCounts(cx);
|
||||
if (xdr->mode == JSXDR_DECODE) {
|
||||
if (cx->hasRunOption(JSOPTION_PCCOUNT))
|
||||
(void) script->initCounts(cx);
|
||||
*scriptp = script;
|
||||
}
|
||||
|
||||
xdr->script = oldscript;
|
||||
return JS_TRUE;
|
||||
|
||||
error:
|
||||
if (xdr->mode == JSXDR_DECODE)
|
||||
*scriptp = NULL;
|
||||
xdr->script = oldscript;
|
||||
return JS_FALSE;
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif /* JS_HAS_XDR */
|
||||
|
||||
} /* namespace js */
|
||||
|
||||
bool
|
||||
JSScript::initCounts(JSContext *cx)
|
||||
{
|
||||
|
@ -817,6 +896,7 @@ JSScript::destroyCounts(JSContext *cx)
|
|||
}
|
||||
}
|
||||
|
||||
namespace js {
|
||||
|
||||
/*
|
||||
* Shared script filename management.
|
||||
|
@ -846,6 +926,8 @@ SaveScriptFilename(JSContext *cx, const char *filename)
|
|||
return (*p)->filename;
|
||||
}
|
||||
|
||||
} /* namespace js */
|
||||
|
||||
/*
|
||||
* Back up from a saved filename by its offset within its hash table entry.
|
||||
*/
|
||||
|
@ -1623,8 +1705,6 @@ CurrentScriptFileLineOriginSlow(JSContext *cx, const char **file, uintN *linenop
|
|||
*origin = script->originPrincipals;
|
||||
}
|
||||
|
||||
} /* namespace js */
|
||||
|
||||
class DisablePrincipalsTranscoding {
|
||||
JSSecurityCallbacks *callbacks;
|
||||
JSPrincipalsTranscoder temp;
|
||||
|
@ -1670,7 +1750,7 @@ private:
|
|||
};
|
||||
|
||||
JSScript *
|
||||
js_CloneScript(JSContext *cx, JSScript *script)
|
||||
CloneScript(JSContext *cx, JSScript *script)
|
||||
{
|
||||
JS_ASSERT(cx->compartment != script->compartment());
|
||||
|
||||
|
@ -1686,7 +1766,7 @@ js_CloneScript(JSContext *cx, JSScript *script)
|
|||
#ifdef DEBUG
|
||||
wstate.filename = script->filename;
|
||||
#endif
|
||||
if (!js_XDRScript(w, &script))
|
||||
if (!XDRScript(w, &script))
|
||||
return NULL;
|
||||
|
||||
uint32_t nbytes;
|
||||
|
@ -1709,7 +1789,7 @@ js_CloneScript(JSContext *cx, JSScript *script)
|
|||
rstate.filenameSaved = true;
|
||||
|
||||
JSScript *newScript = NULL;
|
||||
if (!js_XDRScript(r, &newScript))
|
||||
if (!XDRScript(r, &newScript))
|
||||
return NULL;
|
||||
|
||||
// set the proper principals for the script's new compartment
|
||||
|
@ -1726,6 +1806,8 @@ js_CloneScript(JSContext *cx, JSScript *script)
|
|||
return newScript;
|
||||
}
|
||||
|
||||
} /* namespace js */
|
||||
|
||||
void
|
||||
JSScript::copyClosedSlotsTo(JSScript *other)
|
||||
{
|
||||
|
|
|
@ -848,8 +848,8 @@ js_SweepScriptFilenames(JSCompartment *comp);
|
|||
|
||||
/*
|
||||
* New-script-hook calling is factored from NewScriptFromEmitter so that it
|
||||
* and callers of js_XDRScript can share this code. In the case of callers
|
||||
* of js_XDRScript, the hook should be invoked only after successful decode
|
||||
* and callers of XDRScript can share this code. In the case of callers
|
||||
* of XDRScript, the hook should be invoked only after successful decode
|
||||
* of any owning function (the fun parameter) or script object (null fun).
|
||||
*/
|
||||
extern JS_FRIEND_API(void)
|
||||
|
@ -928,10 +928,8 @@ enum LineOption {
|
|||
inline void
|
||||
CurrentScriptFileLineOrigin(JSContext *cx, uintN *linenop, LineOption = NOT_CALLED_FROM_JSOP_EVAL);
|
||||
|
||||
}
|
||||
|
||||
extern JSScript *
|
||||
js_CloneScript(JSContext *cx, JSScript *script);
|
||||
CloneScript(JSContext *cx, JSScript *script);
|
||||
|
||||
/*
|
||||
* NB: after a successful JSXDR_DECODE, js_XDRScript callers must do any
|
||||
|
@ -939,6 +937,8 @@ js_CloneScript(JSContext *cx, JSScript *script);
|
|||
* js_CallNewScriptHook.
|
||||
*/
|
||||
extern JSBool
|
||||
js_XDRScript(JSXDRState *xdr, JSScript **scriptp);
|
||||
XDRScript(JSXDRState *xdr, JSScript **scriptp);
|
||||
|
||||
}
|
||||
|
||||
#endif /* jsscript_h___ */
|
||||
|
|
|
@ -2194,11 +2194,9 @@ Class js::ArrayBufferClass = {
|
|||
JS_ResolveStub,
|
||||
JS_ConvertStub,
|
||||
NULL, /* finalize */
|
||||
NULL, /* reserved0 */
|
||||
NULL, /* checkAccess */
|
||||
NULL, /* call */
|
||||
NULL, /* construct */
|
||||
NULL, /* xdrObject */
|
||||
NULL, /* hasInstance */
|
||||
ArrayBuffer::obj_trace,
|
||||
JS_NULL_CLASS_EXT,
|
||||
|
@ -2312,11 +2310,9 @@ JSFunctionSpec _typedArray::jsfuncs[] = { \
|
|||
JS_ResolveStub, \
|
||||
JS_ConvertStub, \
|
||||
NULL, /* finalize */ \
|
||||
NULL, /* reserved0 */ \
|
||||
NULL, /* checkAccess */ \
|
||||
NULL, /* call */ \
|
||||
NULL, /* construct */ \
|
||||
NULL, /* xdrObject */ \
|
||||
NULL, /* hasInstance */ \
|
||||
_typedArray::obj_trace, /* trace */ \
|
||||
{ \
|
||||
|
|
|
@ -351,12 +351,10 @@ Class js::WeakMapClass = {
|
|||
JS_ResolveStub,
|
||||
JS_ConvertStub,
|
||||
WeakMap_finalize,
|
||||
NULL, /* reserved0 */
|
||||
NULL, /* checkAccess */
|
||||
NULL, /* call */
|
||||
NULL, /* construct */
|
||||
NULL, /* xdrObject */
|
||||
NULL, /* hasInstance */
|
||||
WeakMap_mark
|
||||
};
|
||||
|
||||
|
|
|
@ -51,7 +51,6 @@
|
|||
#include "jsapi.h"
|
||||
#include "jscntxt.h"
|
||||
#include "jsnum.h"
|
||||
#include "jsobj.h" /* js_XDRObject */
|
||||
#include "jsscript.h" /* js_XDRScript */
|
||||
#include "jsstr.h"
|
||||
#include "jsxdrapi.h"
|
||||
|
@ -237,11 +236,7 @@ JS_XDRInitBase(JSXDRState *xdr, JSXDRMode mode, JSContext *cx)
|
|||
{
|
||||
xdr->mode = mode;
|
||||
xdr->cx = cx;
|
||||
xdr->registry = NULL;
|
||||
xdr->numclasses = xdr->maxclasses = 0;
|
||||
xdr->reghash = NULL;
|
||||
xdr->userdata = NULL;
|
||||
xdr->script = NULL;
|
||||
xdr->state = NULL;
|
||||
}
|
||||
|
||||
|
@ -307,11 +302,6 @@ JS_XDRDestroy(JSXDRState *xdr)
|
|||
{
|
||||
JSContext *cx = xdr->cx;
|
||||
xdr->ops->finalize(xdr);
|
||||
if (xdr->registry) {
|
||||
cx->free_(xdr->registry);
|
||||
if (xdr->reghash)
|
||||
JS_DHashTableDestroy((JSDHashTable *) xdr->reghash);
|
||||
}
|
||||
cx->free_(xdr);
|
||||
}
|
||||
|
||||
|
@ -493,131 +483,17 @@ JS_XDRStringOrNull(JSXDRState *xdr, JSString **strp)
|
|||
return JS_XDRString(xdr, strp);
|
||||
}
|
||||
|
||||
static JSBool
|
||||
XDRDoubleValue(JSXDRState *xdr, jsdouble *dp)
|
||||
JS_PUBLIC_API(JSBool)
|
||||
JS_XDRDouble(JSXDRState *xdr, jsdouble *dp)
|
||||
{
|
||||
jsdpun u;
|
||||
|
||||
u.d = (xdr->mode == JSXDR_ENCODE) ? *dp : 0.0;
|
||||
if (!JS_XDRUint32(xdr, &u.s.lo) || !JS_XDRUint32(xdr, &u.s.hi))
|
||||
return JS_FALSE;
|
||||
return false;
|
||||
if (xdr->mode == JSXDR_DECODE)
|
||||
*dp = u.d;
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSBool)
|
||||
JS_XDRDouble(JSXDRState *xdr, jsdouble *dp)
|
||||
{
|
||||
jsdouble d = (xdr->mode == JSXDR_ENCODE) ? *dp : 0.0;
|
||||
if (!XDRDoubleValue(xdr, &d))
|
||||
return JS_FALSE;
|
||||
if (xdr->mode == JSXDR_DECODE)
|
||||
*dp = d;
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
enum XDRValueTag {
|
||||
XDRTAG_OBJECT = 0,
|
||||
XDRTAG_INT = 1,
|
||||
XDRTAG_DOUBLE = 2,
|
||||
XDRTAG_STRING = 3,
|
||||
XDRTAG_SPECIAL = 4,
|
||||
XDRTAG_XDRNULL = 5,
|
||||
XDRTAG_XDRVOID = 6
|
||||
};
|
||||
|
||||
static XDRValueTag
|
||||
GetXDRTag(jsval v)
|
||||
{
|
||||
if (JSVAL_IS_NULL(v))
|
||||
return XDRTAG_XDRNULL;
|
||||
if (JSVAL_IS_VOID(v))
|
||||
return XDRTAG_XDRVOID;
|
||||
if (JSVAL_IS_OBJECT(v))
|
||||
return XDRTAG_OBJECT;
|
||||
if (JSVAL_IS_INT(v))
|
||||
return XDRTAG_INT;
|
||||
if (JSVAL_IS_DOUBLE(v))
|
||||
return XDRTAG_DOUBLE;
|
||||
if (JSVAL_IS_STRING(v))
|
||||
return XDRTAG_STRING;
|
||||
JS_ASSERT(JSVAL_IS_BOOLEAN(v));
|
||||
return XDRTAG_SPECIAL;
|
||||
}
|
||||
|
||||
static JSBool
|
||||
XDRValueBody(JSXDRState *xdr, uint32_t type, jsval *vp)
|
||||
{
|
||||
switch (type) {
|
||||
case XDRTAG_XDRNULL:
|
||||
*vp = JSVAL_NULL;
|
||||
break;
|
||||
case XDRTAG_XDRVOID:
|
||||
*vp = JSVAL_VOID;
|
||||
break;
|
||||
case XDRTAG_STRING: {
|
||||
JSString *str;
|
||||
if (xdr->mode == JSXDR_ENCODE)
|
||||
str = JSVAL_TO_STRING(*vp);
|
||||
if (!JS_XDRString(xdr, &str))
|
||||
return JS_FALSE;
|
||||
if (xdr->mode == JSXDR_DECODE)
|
||||
*vp = STRING_TO_JSVAL(str);
|
||||
break;
|
||||
}
|
||||
case XDRTAG_DOUBLE: {
|
||||
double d = xdr->mode == JSXDR_ENCODE ? JSVAL_TO_DOUBLE(*vp) : 0;
|
||||
if (!JS_XDRDouble(xdr, &d))
|
||||
return JS_FALSE;
|
||||
if (xdr->mode == JSXDR_DECODE)
|
||||
*vp = DOUBLE_TO_JSVAL(d);
|
||||
break;
|
||||
}
|
||||
case XDRTAG_OBJECT: {
|
||||
JSObject *obj;
|
||||
if (xdr->mode == JSXDR_ENCODE)
|
||||
obj = JSVAL_TO_OBJECT(*vp);
|
||||
if (!js_XDRObject(xdr, &obj))
|
||||
return JS_FALSE;
|
||||
if (xdr->mode == JSXDR_DECODE)
|
||||
*vp = OBJECT_TO_JSVAL(obj);
|
||||
break;
|
||||
}
|
||||
case XDRTAG_SPECIAL: {
|
||||
uint32_t b;
|
||||
if (xdr->mode == JSXDR_ENCODE)
|
||||
b = (uint32_t) JSVAL_TO_BOOLEAN(*vp);
|
||||
if (!JS_XDRUint32(xdr, &b))
|
||||
return JS_FALSE;
|
||||
if (xdr->mode == JSXDR_DECODE)
|
||||
*vp = BOOLEAN_TO_JSVAL(!!b);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
uint32_t i;
|
||||
|
||||
JS_ASSERT(type == XDRTAG_INT);
|
||||
if (xdr->mode == JSXDR_ENCODE)
|
||||
i = (uint32_t) JSVAL_TO_INT(*vp);
|
||||
if (!JS_XDRUint32(xdr, &i))
|
||||
return JS_FALSE;
|
||||
if (xdr->mode == JSXDR_DECODE)
|
||||
*vp = INT_TO_JSVAL((int32_t) i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSBool)
|
||||
JS_XDRValue(JSXDRState *xdr, jsval *vp)
|
||||
{
|
||||
uint32_t type;
|
||||
|
||||
if (xdr->mode == JSXDR_ENCODE)
|
||||
type = GetXDRTag(*vp);
|
||||
return JS_XDRUint32(xdr, &type) && XDRValueBody(xdr, type, vp);
|
||||
return true;
|
||||
}
|
||||
|
||||
extern JSBool
|
||||
|
@ -697,7 +573,7 @@ JS_XDRFunctionObject(JSXDRState *xdr, JSObject **objp)
|
|||
if (!JS_XDRCStringOrNull(xdr, (char **) &fstate.filename))
|
||||
return false;
|
||||
|
||||
return js_XDRFunctionObject(xdr, objp);
|
||||
return XDRFunctionObject(xdr, objp);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSBool)
|
||||
|
@ -738,7 +614,7 @@ JS_XDRScript(JSXDRState *xdr, JSScript **scriptp)
|
|||
if (!JS_XDRCStringOrNull(xdr, (char **) &state.filename))
|
||||
return false;
|
||||
|
||||
if (!js_XDRScript(xdr, &script))
|
||||
if (!XDRScript(xdr, &script))
|
||||
return false;
|
||||
|
||||
if (xdr->mode == JSXDR_DECODE) {
|
||||
|
@ -752,107 +628,4 @@ JS_XDRScript(JSXDRState *xdr, JSScript **scriptp)
|
|||
return true;
|
||||
}
|
||||
|
||||
#define CLASS_REGISTRY_MIN 8
|
||||
#define CLASS_INDEX_TO_ID(i) ((i)+1)
|
||||
#define CLASS_ID_TO_INDEX(id) ((id)-1)
|
||||
|
||||
typedef struct JSRegHashEntry {
|
||||
JSDHashEntryHdr hdr;
|
||||
const char *name;
|
||||
uint32_t index;
|
||||
} JSRegHashEntry;
|
||||
|
||||
JS_PUBLIC_API(JSBool)
|
||||
JS_XDRRegisterClass(JSXDRState *xdr, JSClass *clasp, uint32_t *idp)
|
||||
{
|
||||
uintN numclasses, maxclasses;
|
||||
JSClass **registry;
|
||||
|
||||
numclasses = xdr->numclasses;
|
||||
maxclasses = xdr->maxclasses;
|
||||
if (numclasses == maxclasses) {
|
||||
maxclasses = (maxclasses == 0) ? CLASS_REGISTRY_MIN : maxclasses << 1;
|
||||
registry = (JSClass **)
|
||||
xdr->cx->realloc_(xdr->registry, maxclasses * sizeof(JSClass *));
|
||||
if (!registry)
|
||||
return JS_FALSE;
|
||||
xdr->registry = registry;
|
||||
xdr->maxclasses = maxclasses;
|
||||
} else {
|
||||
JS_ASSERT(numclasses && numclasses < maxclasses);
|
||||
registry = xdr->registry;
|
||||
}
|
||||
|
||||
registry[numclasses] = clasp;
|
||||
if (xdr->reghash) {
|
||||
JSRegHashEntry *entry = (JSRegHashEntry *)
|
||||
JS_DHashTableOperate((JSDHashTable *) xdr->reghash,
|
||||
clasp->name, JS_DHASH_ADD);
|
||||
if (!entry) {
|
||||
JS_ReportOutOfMemory(xdr->cx);
|
||||
return JS_FALSE;
|
||||
}
|
||||
entry->name = clasp->name;
|
||||
entry->index = numclasses;
|
||||
}
|
||||
*idp = CLASS_INDEX_TO_ID(numclasses);
|
||||
xdr->numclasses = ++numclasses;
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(uint32_t)
|
||||
JS_XDRFindClassIdByName(JSXDRState *xdr, const char *name)
|
||||
{
|
||||
uintN i, numclasses;
|
||||
|
||||
numclasses = xdr->numclasses;
|
||||
if (numclasses >= 10) {
|
||||
JSRegHashEntry *entry;
|
||||
|
||||
/* Bootstrap reghash from registry on first overpopulated Find. */
|
||||
if (!xdr->reghash) {
|
||||
xdr->reghash =
|
||||
JS_NewDHashTable(JS_DHashGetStubOps(), NULL,
|
||||
sizeof(JSRegHashEntry),
|
||||
JS_DHASH_DEFAULT_CAPACITY(numclasses));
|
||||
if (xdr->reghash) {
|
||||
for (i = 0; i < numclasses; i++) {
|
||||
JSClass *clasp = xdr->registry[i];
|
||||
entry = (JSRegHashEntry *)
|
||||
JS_DHashTableOperate((JSDHashTable *) xdr->reghash,
|
||||
clasp->name, JS_DHASH_ADD);
|
||||
entry->name = clasp->name;
|
||||
entry->index = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* If we managed to create reghash, use it for O(1) Find. */
|
||||
if (xdr->reghash) {
|
||||
entry = (JSRegHashEntry *)
|
||||
JS_DHashTableOperate((JSDHashTable *) xdr->reghash,
|
||||
name, JS_DHASH_LOOKUP);
|
||||
if (JS_DHASH_ENTRY_IS_BUSY(&entry->hdr))
|
||||
return CLASS_INDEX_TO_ID(entry->index);
|
||||
}
|
||||
}
|
||||
|
||||
/* Only a few classes, or we couldn't malloc reghash: use linear search. */
|
||||
for (i = 0; i < numclasses; i++) {
|
||||
if (!strcmp(name, xdr->registry[i]->name))
|
||||
return CLASS_INDEX_TO_ID(i);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSClass *)
|
||||
JS_XDRFindClassById(JSXDRState *xdr, uint32_t id)
|
||||
{
|
||||
uintN i = CLASS_ID_TO_INDEX(id);
|
||||
|
||||
if (i >= xdr->numclasses)
|
||||
return NULL;
|
||||
return xdr->registry[i];
|
||||
}
|
||||
|
||||
#endif /* JS_HAS_XDR */
|
||||
|
|
|
@ -125,12 +125,7 @@ struct JSXDRState {
|
|||
JSXDRMode mode;
|
||||
JSXDROps *ops;
|
||||
JSContext *cx;
|
||||
JSClass **registry;
|
||||
uintN numclasses;
|
||||
uintN maxclasses;
|
||||
void *reghash;
|
||||
void *userdata;
|
||||
JSScript *script;
|
||||
js::XDRScriptState *state;
|
||||
};
|
||||
|
||||
|
@ -182,24 +177,12 @@ JS_XDRStringOrNull(JSXDRState *xdr, JSString **strp);
|
|||
extern JS_PUBLIC_API(JSBool)
|
||||
JS_XDRDouble(JSXDRState *xdr, jsdouble *dp);
|
||||
|
||||
extern JS_PUBLIC_API(JSBool)
|
||||
JS_XDRValue(JSXDRState *xdr, jsval *vp);
|
||||
|
||||
extern JS_PUBLIC_API(JSBool)
|
||||
JS_XDRFunctionObject(JSXDRState *xdr, JSObject **objp);
|
||||
|
||||
extern JS_PUBLIC_API(JSBool)
|
||||
JS_XDRScript(JSXDRState *xdr, JSScript **scriptp);
|
||||
|
||||
extern JS_PUBLIC_API(JSBool)
|
||||
JS_XDRRegisterClass(JSXDRState *xdr, JSClass *clasp, uint32_t *lp);
|
||||
|
||||
extern JS_PUBLIC_API(uint32_t)
|
||||
JS_XDRFindClassIdByName(JSXDRState *xdr, const char *name);
|
||||
|
||||
extern JS_PUBLIC_API(JSClass *)
|
||||
JS_XDRFindClassById(JSXDRState *xdr, uint32_t id);
|
||||
|
||||
/*
|
||||
* Magic numbers.
|
||||
*/
|
||||
|
|
|
@ -233,11 +233,9 @@ JS_FRIEND_DATA(Class) js::NamespaceClass = {
|
|||
JS_ResolveStub,
|
||||
JS_ConvertStub,
|
||||
JS_FinalizeStub,
|
||||
NULL, /* reserved0 */
|
||||
NULL, /* checkAccess */
|
||||
NULL, /* call */
|
||||
NULL, /* construct */
|
||||
NULL, /* xdrObject */
|
||||
NULL, /* hasInstance */
|
||||
NULL, /* mark */
|
||||
{
|
||||
|
@ -349,11 +347,9 @@ JS_FRIEND_DATA(Class) js::QNameClass = {
|
|||
JS_ResolveStub,
|
||||
JS_ConvertStub,
|
||||
JS_FinalizeStub,
|
||||
NULL, /* reserved0 */
|
||||
NULL, /* checkAccess */
|
||||
NULL, /* call */
|
||||
NULL, /* construct */
|
||||
NULL, /* xdrObject */
|
||||
NULL, /* hasInstance */
|
||||
NULL, /* mark */
|
||||
{
|
||||
|
@ -5380,11 +5376,9 @@ JS_FRIEND_DATA(Class) js::XMLClass = {
|
|||
JS_ResolveStub,
|
||||
xml_convert,
|
||||
xml_finalize,
|
||||
NULL, /* reserved0 */
|
||||
NULL, /* checkAccess */
|
||||
NULL, /* call */
|
||||
NULL, /* construct */
|
||||
NULL, /* xdrObject */
|
||||
xml_hasInstance,
|
||||
xml_trace,
|
||||
JS_NULL_CLASS_EXT,
|
||||
|
@ -7932,11 +7926,9 @@ Class js_XMLFilterClass = {
|
|||
JS_ResolveStub,
|
||||
JS_ConvertStub,
|
||||
xmlfilter_finalize,
|
||||
NULL, /* reserved0 */
|
||||
NULL, /* checkAccess */
|
||||
NULL, /* call */
|
||||
NULL, /* construct */
|
||||
NULL, /* xdrObject */
|
||||
NULL, /* hasInstance */
|
||||
xmlfilter_trace
|
||||
};
|
||||
|
|
|
@ -1270,16 +1270,14 @@ JSClass ThreadPool::jsClass = {
|
|||
"ThreadPool", JSCLASS_HAS_PRIVATE,
|
||||
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
|
||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, jsFinalize,
|
||||
NULL, NULL, NULL, NULL,
|
||||
NULL, NULL, jsTraceThreadPool, NULL
|
||||
NULL, NULL, NULL, NULL, jsTraceThreadPool
|
||||
};
|
||||
|
||||
JSClass Worker::jsWorkerClass = {
|
||||
"Worker", JSCLASS_HAS_PRIVATE,
|
||||
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
|
||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, jsFinalize,
|
||||
NULL, NULL, NULL, NULL,
|
||||
NULL, NULL, jsTraceWorker, NULL
|
||||
NULL, NULL, NULL, NULL, jsTraceWorker
|
||||
};
|
||||
|
||||
JSFunctionSpec Worker::jsMethods[3] = {
|
||||
|
|
|
@ -1328,11 +1328,9 @@ Class Debugger::jsclass = {
|
|||
JSCLASS_HAS_RESERVED_SLOTS(JSSLOT_DEBUG_COUNT),
|
||||
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
|
||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, Debugger::finalize,
|
||||
NULL, /* reserved0 */
|
||||
NULL, /* checkAccess */
|
||||
NULL, /* call */
|
||||
NULL, /* construct */
|
||||
NULL, /* xdrObject */
|
||||
NULL, /* hasInstance */
|
||||
Debugger::traceObject
|
||||
};
|
||||
|
@ -1861,11 +1859,9 @@ Class DebuggerScript_class = {
|
|||
JSCLASS_HAS_RESERVED_SLOTS(JSSLOT_DEBUGSCRIPT_COUNT),
|
||||
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
|
||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, NULL,
|
||||
NULL, /* reserved0 */
|
||||
NULL, /* checkAccess */
|
||||
NULL, /* call */
|
||||
NULL, /* construct */
|
||||
NULL, /* xdrObject */
|
||||
NULL, /* hasInstance */
|
||||
DebuggerScript_trace
|
||||
};
|
||||
|
@ -2965,11 +2961,9 @@ Class DebuggerObject_class = {
|
|||
JSCLASS_HAS_RESERVED_SLOTS(JSSLOT_DEBUGOBJECT_COUNT),
|
||||
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
|
||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, NULL,
|
||||
NULL, /* reserved0 */
|
||||
NULL, /* checkAccess */
|
||||
NULL, /* call */
|
||||
NULL, /* construct */
|
||||
NULL, /* xdrObject */
|
||||
NULL, /* hasInstance */
|
||||
DebuggerObject_trace
|
||||
};
|
||||
|
@ -3609,11 +3603,9 @@ Class DebuggerEnv_class = {
|
|||
JSCLASS_HAS_RESERVED_SLOTS(JSSLOT_DEBUGENV_COUNT),
|
||||
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
|
||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, NULL,
|
||||
NULL, /* reserved0 */
|
||||
NULL, /* checkAccess */
|
||||
NULL, /* call */
|
||||
NULL, /* construct */
|
||||
NULL, /* xdrObject */
|
||||
NULL, /* hasInstance */
|
||||
DebuggerEnv_trace
|
||||
};
|
||||
|
|
|
@ -352,15 +352,9 @@ Class js::RegExpClass = {
|
|||
JS_ResolveStub,
|
||||
JS_ConvertStub,
|
||||
NULL, /* finalize */
|
||||
NULL, /* reserved0 */
|
||||
NULL, /* checkAccess */
|
||||
NULL, /* call */
|
||||
NULL, /* construct */
|
||||
#if JS_HAS_XDR
|
||||
js_XDRRegExpObject,
|
||||
#else
|
||||
NULL
|
||||
#endif
|
||||
NULL, /* hasInstance */
|
||||
regexp_trace
|
||||
};
|
||||
|
@ -746,8 +740,8 @@ js::ParseRegExpFlags(JSContext *cx, JSString *flagStr, RegExpFlag *flagsOut)
|
|||
#if JS_HAS_XDR
|
||||
# include "jsxdrapi.h"
|
||||
|
||||
JSBool
|
||||
js_XDRRegExpObject(JSXDRState *xdr, JSObject **objp)
|
||||
bool
|
||||
js::XDRScriptRegExpObject(JSXDRState *xdr, HeapPtrObject *objp)
|
||||
{
|
||||
JSAtom *source = 0;
|
||||
uint32_t flagsword = 0;
|
||||
|
@ -770,7 +764,7 @@ js_XDRRegExpObject(JSXDRState *xdr, JSObject **objp)
|
|||
return false;
|
||||
if (!reobj->clearType(xdr->cx))
|
||||
return false;
|
||||
*objp = reobj;
|
||||
objp->init(reobj);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -464,9 +464,9 @@ ParseRegExpFlags(JSContext *cx, JSString *flagStr, RegExpFlag *flagsOut);
|
|||
inline RegExpShared *
|
||||
RegExpToShared(JSContext *cx, JSObject &obj);
|
||||
|
||||
bool
|
||||
XDRScriptRegExpObject(JSXDRState *xdr, HeapPtrObject *objp);
|
||||
|
||||
} /* namespace js */
|
||||
|
||||
JSBool
|
||||
js_XDRRegExpObject(JSXDRState *xdr, JSObject **objp);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -80,11 +80,9 @@ Class js::RegExpStaticsClass = {
|
|||
JS_ResolveStub,
|
||||
JS_ConvertStub,
|
||||
resc_finalize,
|
||||
NULL, /* reserved0 */
|
||||
NULL, /* checkAccess */
|
||||
NULL, /* call */
|
||||
NULL, /* construct */
|
||||
NULL, /* xdrObject */
|
||||
NULL, /* hasInstance */
|
||||
resc_trace
|
||||
};
|
||||
|
|
|
@ -382,11 +382,9 @@ Class js::WithClass = {
|
|||
JS_ResolveStub,
|
||||
JS_ConvertStub,
|
||||
NULL, /* finalize */
|
||||
NULL, /* reserved */
|
||||
NULL, /* checkAccess */
|
||||
NULL, /* call */
|
||||
NULL, /* construct */
|
||||
NULL, /* xdrObject */
|
||||
NULL, /* hasInstance */
|
||||
NULL, /* trace */
|
||||
JS_NULL_CLASS_EXT,
|
||||
|
@ -617,7 +615,7 @@ FindObjectIndex(JSObjectArray *array, JSObject *obj)
|
|||
}
|
||||
|
||||
bool
|
||||
js_XDRStaticBlockObject(JSXDRState *xdr, StaticBlockObject **objp)
|
||||
js::XDRStaticBlockObject(JSXDRState *xdr, JSScript *script, StaticBlockObject **objp)
|
||||
{
|
||||
JSContext *cx = xdr->cx;
|
||||
|
||||
|
@ -627,8 +625,8 @@ js_XDRStaticBlockObject(JSXDRState *xdr, StaticBlockObject **objp)
|
|||
uint32_t depthAndCount = 0;
|
||||
if (xdr->mode == JSXDR_ENCODE) {
|
||||
obj = *objp;
|
||||
parentId = JSScript::isValidOffset(xdr->script->objectsOffset)
|
||||
? FindObjectIndex(xdr->script->objects(), obj->enclosingBlock())
|
||||
parentId = JSScript::isValidOffset(script->objectsOffset)
|
||||
? FindObjectIndex(script->objects(), obj->enclosingBlock())
|
||||
: NO_PARENT_INDEX;
|
||||
uint32_t depth = obj->stackDepth();
|
||||
JS_ASSERT(depth <= UINT16_MAX);
|
||||
|
@ -654,7 +652,7 @@ js_XDRStaticBlockObject(JSXDRState *xdr, StaticBlockObject **objp)
|
|||
*/
|
||||
obj->setEnclosingBlock(parentId == NO_PARENT_INDEX
|
||||
? NULL
|
||||
: &xdr->script->getObject(parentId)->asStaticBlock());
|
||||
: &script->getObject(parentId)->asStaticBlock());
|
||||
}
|
||||
|
||||
AutoObjectRooter tvr(cx, obj);
|
||||
|
|
|
@ -256,9 +256,9 @@ class ClonedBlockObject : public BlockObject
|
|||
const Value &closedSlot(unsigned i);
|
||||
};
|
||||
|
||||
extern bool
|
||||
XDRStaticBlockObject(JSXDRState *xdr, JSScript *script, StaticBlockObject **objp);
|
||||
|
||||
} /* namespace js */
|
||||
|
||||
extern bool
|
||||
js_XDRStaticBlockObject(JSXDRState *xdr, js::StaticBlockObject **objp);
|
||||
|
||||
#endif /* ScopeObject_h___ */
|
||||
|
|
|
@ -2907,7 +2907,7 @@ static JSClass SandboxClass = {
|
|||
XPCONNECT_GLOBAL_FLAGS,
|
||||
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
|
||||
sandbox_enumerate, sandbox_resolve, sandbox_convert, sandbox_finalize,
|
||||
NULL, NULL, NULL, NULL, NULL, NULL, TraceXPCGlobal
|
||||
NULL, NULL, NULL, NULL, TraceXPCGlobal
|
||||
};
|
||||
|
||||
static JSFunctionSpec SandboxFunctions[] = {
|
||||
|
|
|
@ -55,8 +55,6 @@
|
|||
#include "xpcprivate.h"
|
||||
#include "nsStringBuffer.h"
|
||||
|
||||
static int sDOMStringFinalizerIndex = -1;
|
||||
|
||||
static void
|
||||
FinalizeDOMString(const JSStringFinalizer *fin, jschar *chars)
|
||||
{
|
||||
|
|
|
@ -177,7 +177,7 @@ static JSClass global_class = {
|
|||
XPCONNECT_GLOBAL_FLAGS,
|
||||
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
|
||||
JS_EnumerateStub, SafeGlobalResolve, JS_ConvertStub, SafeFinalize,
|
||||
NULL, NULL, NULL, NULL, NULL, NULL, TraceXPCGlobal
|
||||
NULL, NULL, NULL, NULL, TraceXPCGlobal
|
||||
};
|
||||
|
||||
// We just use the same reporter as the component loader
|
||||
|
|
|
@ -832,11 +832,9 @@ XPCWrappedNativeJSClass XPC_WN_NoHelper_JSClass = {
|
|||
XPC_WN_NoHelper_Finalize, // finalize
|
||||
|
||||
/* Optionally non-null members start here. */
|
||||
nsnull, // reserved0
|
||||
nsnull, // checkAccess
|
||||
nsnull, // call
|
||||
nsnull, // construct
|
||||
nsnull, // xdrObject;
|
||||
nsnull, // hasInstance
|
||||
XPC_WN_NoHelper_Trace, // trace
|
||||
|
||||
|
@ -1697,11 +1695,9 @@ js::Class XPC_WN_ModsAllowed_WithCall_Proto_JSClass = {
|
|||
XPC_WN_Shared_Proto_Finalize, // finalize;
|
||||
|
||||
/* Optionally non-null members start here. */
|
||||
nsnull, // reserved0;
|
||||
nsnull, // checkAccess;
|
||||
nsnull, // call;
|
||||
nsnull, // construct;
|
||||
nsnull, // xdrObject;
|
||||
nsnull, // hasInstance;
|
||||
XPC_WN_Shared_Proto_Trace, // trace;
|
||||
|
||||
|
@ -1724,11 +1720,9 @@ js::Class XPC_WN_ModsAllowed_NoCall_Proto_JSClass = {
|
|||
XPC_WN_Shared_Proto_Finalize, // finalize;
|
||||
|
||||
/* Optionally non-null members start here. */
|
||||
nsnull, // reserved0;
|
||||
nsnull, // checkAccess;
|
||||
nsnull, // call;
|
||||
nsnull, // construct;
|
||||
nsnull, // xdrObject;
|
||||
nsnull, // hasInstance;
|
||||
XPC_WN_Shared_Proto_Trace, // trace;
|
||||
|
||||
|
@ -1814,11 +1808,9 @@ js::Class XPC_WN_NoMods_WithCall_Proto_JSClass = {
|
|||
XPC_WN_Shared_Proto_Finalize, // finalize;
|
||||
|
||||
/* Optionally non-null members start here. */
|
||||
nsnull, // reserved0;
|
||||
nsnull, // checkAccess;
|
||||
nsnull, // call;
|
||||
nsnull, // construct;
|
||||
nsnull, // xdrObject;
|
||||
nsnull, // hasInstance;
|
||||
XPC_WN_Shared_Proto_Trace, // trace;
|
||||
|
||||
|
@ -1841,11 +1833,9 @@ js::Class XPC_WN_NoMods_NoCall_Proto_JSClass = {
|
|||
XPC_WN_Shared_Proto_Finalize, // finalize;
|
||||
|
||||
/* Optionally non-null members start here. */
|
||||
nsnull, // reserved0;
|
||||
nsnull, // checkAccess;
|
||||
nsnull, // call;
|
||||
nsnull, // construct;
|
||||
nsnull, // xdrObject;
|
||||
nsnull, // hasInstance;
|
||||
XPC_WN_Shared_Proto_Trace, // trace;
|
||||
|
||||
|
|
|
@ -214,11 +214,9 @@ js::Class XPC_WN_NoHelper_Proto_JSClass = {
|
|||
nsnull, // finalize;
|
||||
|
||||
/* Optionally non-null members start here. */
|
||||
nsnull, // reserved0;
|
||||
nsnull, // checkAccess;
|
||||
nsnull, // call;
|
||||
nsnull, // construct;
|
||||
nsnull, // xdrObject;
|
||||
nsnull, // hasInstance;
|
||||
nsnull, // trace;
|
||||
|
||||
|
|
|
@ -444,11 +444,9 @@ listTemplate = (
|
|||
" JS_ResolveStub,\n"
|
||||
" JS_ConvertStub,\n"
|
||||
" JS_FinalizeStub,\n"
|
||||
" NULL, /* reserved0 */\n"
|
||||
" NULL, /* checkAccess */\n"
|
||||
" NULL, /* call */\n"
|
||||
" NULL, /* construct */\n"
|
||||
" NULL, /* xdrObject */\n"
|
||||
" interface_hasInstance\n"
|
||||
"};\n"
|
||||
"\n")
|
||||
|
|
Загрузка…
Ссылка в новой задаче