bug 726944 - Remove JSClass::xdrObject and related functionality. r=luke
authorIgor Bukanov <igor@mir2.org>
Mon, 13 Feb 2012 09:02:21 +0100
changeset 87276 e6ffb760d2f0f7b4f6f590cf51555cbf22a681e2
parent 87275 a374a3bb0bc297c6ea9cc63518bdd9fe9bbf08c6
child 87277 63861267f6a704db2c47e6a8d6ccaefdaf27528d
push idunknown
push userunknown
push dateunknown
reviewersluke
bugs726944
milestone13.0a1
bug 726944 - Remove JSClass::xdrObject and related functionality. r=luke
content/xbl/src/nsXBLDocumentInfo.cpp
content/xul/document/src/nsXULPrototypeDocument.cpp
dom/plugins/base/nsJSNPRuntime.cpp
dom/workers/Events.cpp
dom/workers/Exceptions.cpp
dom/workers/File.cpp
dom/workers/Location.cpp
dom/workers/Navigator.cpp
dom/workers/Worker.cpp
dom/workers/WorkerScope.cpp
dom/workers/XMLHttpRequest.cpp
js/ipc/ObjectWrapperParent.cpp
js/src/builtin/MapObject.cpp
js/src/ctypes/CTypes.cpp
js/src/gc/Barrier.h
js/src/js.msg
js/src/jsapi-tests/testCustomIterator.cpp
js/src/jsapi-tests/testExtendedEq.cpp
js/src/jsapi-tests/testNewObject.cpp
js/src/jsapi.cpp
js/src/jsapi.h
js/src/jsarray.cpp
js/src/jsclass.h
js/src/jsexn.cpp
js/src/jsfun.cpp
js/src/jsfun.h
js/src/jsiter.cpp
js/src/jsobj.cpp
js/src/jsobj.h
js/src/jsproxy.cpp
js/src/jsscript.cpp
js/src/jsscript.h
js/src/jstypedarray.cpp
js/src/jsweakmap.cpp
js/src/jsxdrapi.cpp
js/src/jsxdrapi.h
js/src/jsxml.cpp
js/src/shell/jsworkers.cpp
js/src/vm/Debugger.cpp
js/src/vm/RegExpObject.cpp
js/src/vm/RegExpObject.h
js/src/vm/RegExpStatics.cpp
js/src/vm/ScopeObject.cpp
js/src/vm/ScopeObject.h
js/xpconnect/src/XPCComponents.cpp
js/xpconnect/src/XPCString.cpp
js/xpconnect/src/XPCThreadContext.cpp
js/xpconnect/src/XPCWrappedNativeJSOps.cpp
js/xpconnect/src/XPCWrappedNativeScope.cpp
js/xpconnect/src/dombindingsgen.py
--- a/content/xbl/src/nsXBLDocumentInfo.cpp
+++ b/content/xbl/src/nsXBLDocumentInfo.cpp
@@ -189,17 +189,17 @@ nsXBLDocGlobalObject_resolve(JSContext *
 
 JSClass nsXBLDocGlobalObject::gSharedGlobalClass = {
     "nsXBLPrototypeScript compilation scope",
     XPCONNECT_GLOBAL_FLAGS,
     JS_PropertyStub,  JS_PropertyStub,
     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
 };
 
 //----------------------------------------------------------------------
 //
 // nsXBLDocGlobalObject
 //
 
--- a/content/xul/document/src/nsXULPrototypeDocument.cpp
+++ b/content/xul/document/src/nsXULPrototypeDocument.cpp
@@ -141,17 +141,17 @@ nsXULPDGlobalObject_resolve(JSContext *c
 }
 
 
 JSClass nsXULPDGlobalObject::gSharedGlobalClass = {
     "nsXULPrototypeScript compilation scope",
     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
 };
 
 
 
 //----------------------------------------------------------------------
 //
 // ctors, dtors, n' stuff
--- a/dom/plugins/base/nsJSNPRuntime.cpp
+++ b/dom/plugins/base/nsJSNPRuntime.cpp
@@ -179,18 +179,18 @@ CreateNPObjectMember(NPP npp, JSContext 
 static JSClass sNPObjectJSWrapperClass =
   {
     NPRUNTIME_JSCLASS_NAME,
     JSCLASS_HAS_PRIVATE | JSCLASS_IMPLEMENTS_BARRIERS | JSCLASS_NEW_RESOLVE | JSCLASS_NEW_ENUMERATE,
     NPObjWrapper_AddProperty, NPObjWrapper_DelProperty,
     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 {
     JSObject *npobjWrapper;
     jsval fieldValue;
     NPIdentifier methodName;
     NPP   npp;
 } NPObjectMemberPrivate;
@@ -208,18 +208,18 @@ static void
 NPObjectMember_Trace(JSTracer *trc, JSObject *obj);
 
 static JSClass sNPObjectMemberClass =
   {
     "NPObject Ambiguous Member class", JSCLASS_HAS_PRIVATE,
     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
 OnWrapperDestroyed();
 
 static JSBool
 DelayedReleaseGCCallback(JSContext* cx, JSGCStatus status)
 {
--- a/dom/workers/Events.cpp
+++ b/dom/workers/Events.cpp
@@ -45,17 +45,17 @@
 #include "jsfriendapi.h"
 
 #include "nsTraceRefcnt.h"
 
 #include "WorkerInlines.h"
 #include "WorkerPrivate.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
 
 using namespace mozilla;
--- a/dom/workers/Exceptions.cpp
+++ b/dom/workers/Exceptions.cpp
@@ -45,17 +45,17 @@
 #include "jsfriendapi.h"
 #include "jsprf.h"
 
 #include "nsTraceRefcnt.h"
 
 #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
 
 using namespace mozilla;
 USING_WORKERS_NAMESPACE
 
 namespace {
--- a/dom/workers/File.cpp
+++ b/dom/workers/File.cpp
@@ -48,17 +48,17 @@
 #include "nsJSUtils.h"
 #include "nsStringGlue.h"
 
 #include "Exceptions.h"
 #include "WorkerInlines.h"
 #include "WorkerPrivate.h"
 
 #define PROPERTY_FLAGS \
-  JSPROP_ENUMERATE | JSPROP_SHARED
+  (JSPROP_ENUMERATE | JSPROP_SHARED)
 
 USING_WORKERS_NAMESPACE
 
 using mozilla::dom::workers::exceptions::ThrowFileExceptionForCode;
 
 namespace {
 
 class Blob
--- a/dom/workers/Location.cpp
+++ b/dom/workers/Location.cpp
@@ -39,17 +39,17 @@
 #include "Location.h"
 
 #include "jsapi.h"
 #include "jsfriendapi.h"
 
 #include "nsTraceRefcnt.h"
 
 #define PROPERTY_FLAGS \
-  JSPROP_ENUMERATE | JSPROP_SHARED
+  (JSPROP_ENUMERATE | JSPROP_SHARED)
 
 USING_WORKERS_NAMESPACE
 
 namespace {
 
 class Location
 {
   static JSClass sClass;
--- a/dom/workers/Navigator.cpp
+++ b/dom/workers/Navigator.cpp
@@ -41,17 +41,17 @@
 #include "jsapi.h"
 #include "jsfriendapi.h"
 
 #include "nsTraceRefcnt.h"
 
 #include "RuntimeService.h"
 
 #define PROPERTY_FLAGS \
-  JSPROP_ENUMERATE | JSPROP_SHARED
+  (JSPROP_ENUMERATE | JSPROP_SHARED)
 
 USING_WORKERS_NAMESPACE
 
 namespace {
 
 class Navigator
 {
   static JSClass sClass;
--- a/dom/workers/Worker.cpp
+++ b/dom/workers/Worker.cpp
@@ -43,17 +43,17 @@
 
 #include "EventTarget.h"
 #include "RuntimeService.h"
 #include "WorkerPrivate.h"
 
 #include "WorkerInlines.h"
 
 #define PROPERTY_FLAGS \
-  JSPROP_ENUMERATE | JSPROP_SHARED
+  (JSPROP_ENUMERATE | JSPROP_SHARED)
 
 #define FUNCTION_FLAGS \
   JSPROP_ENUMERATE
 
 USING_WORKERS_NAMESPACE
 
 namespace {
 
@@ -297,18 +297,18 @@ private:
     return worker->PostMessage(aCx, message);
   }
 };
 
 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[] = {
   { sEventStrings[STRING_onerror], STRING_onerror, PROPERTY_FLAGS,
     GetEventListener, SetEventListener },
   { sEventStrings[STRING_onmessage], STRING_onmessage, PROPERTY_FLAGS,
     GetEventListener, SetEventListener },
   { 0, 0, 0, NULL, NULL }
@@ -412,18 +412,18 @@ private:
     }
   }
 };
 
 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*
 Worker::GetInstancePrivate(JSContext* aCx, JSObject* aObj,
                            const char* aFunctionName)
 {
   JSClass* classPtr = JS_GetClass(aObj);
   if (classPtr == &sClass || classPtr == ChromeWorker::Class()) {
--- a/dom/workers/WorkerScope.cpp
+++ b/dom/workers/WorkerScope.cpp
@@ -63,17 +63,17 @@
 #include "XMLHttpRequest.h"
 #ifdef ANDROID
 #include <android/log.h>
 #endif
 
 #include "WorkerInlines.h"
 
 #define PROPERTY_FLAGS \
-  JSPROP_ENUMERATE | JSPROP_SHARED
+  (JSPROP_ENUMERATE | JSPROP_SHARED)
 
 #define FUNCTION_FLAGS \
   JSPROP_ENUMERATE
 
 using namespace mozilla;
 USING_WORKERS_NAMESPACE
 
 namespace {
@@ -797,17 +797,17 @@ private:
   }
 };
 
 JSClass DedicatedWorkerGlobalScope::sClass = {
   "DedicatedWorkerGlobalScope",
   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[] = {
   { sEventStrings[STRING_onmessage], STRING_onmessage, PROPERTY_FLAGS,
     GetEventListener, SetEventListener },
   { 0, 0, 0, NULL, NULL }
 };
 
--- a/dom/workers/XMLHttpRequest.cpp
+++ b/dom/workers/XMLHttpRequest.cpp
@@ -43,23 +43,23 @@
 
 #include "Exceptions.h"
 #include "WorkerPrivate.h"
 #include "XMLHttpRequestPrivate.h"
 
 #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
 
 using mozilla::dom::workers::xhr::XMLHttpRequestPrivate;
 
 namespace {
 
 class XMLHttpRequestUpload : public events::EventTarget
@@ -218,17 +218,17 @@ private:
   }
 };
 
 JSClass XMLHttpRequestUpload::sClass = {
   "XMLHttpRequestUpload",
   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[] = {
   { sEventStrings[STRING_onabort], STRING_onabort, PROPERTY_FLAGS,
     GetEventListener, SetEventListener },
   { sEventStrings[STRING_onerror], STRING_onerror, PROPERTY_FLAGS,
     GetEventListener, SetEventListener },
   { sEventStrings[STRING_onload], STRING_onload, PROPERTY_FLAGS,
@@ -767,17 +767,17 @@ private:
   }
 };
 
 JSClass XMLHttpRequest::sClass = {
   "XMLHttpRequest",
   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[] = {
 
 #define GENERIC_READONLY_PROPERTY(_name) \
   { #_name, SLOT_##_name, PROPERTY_FLAGS, GetProperty, \
     js_GetterOnlyPropertyStub },
 
--- a/js/ipc/ObjectWrapperParent.cpp
+++ b/js/ipc/ObjectWrapperParent.cpp
@@ -167,23 +167,21 @@ const js::Class ObjectWrapperParent::sCP
       ObjectWrapperParent::CPOW_AddProperty,
       ObjectWrapperParent::CPOW_DelProperty,
       ObjectWrapperParent::CPOW_GetProperty,
       ObjectWrapperParent::CPOW_SetProperty,
       (JSEnumerateOp) ObjectWrapperParent::CPOW_NewEnumerate,
       (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
           nsnull, // innerObject
           nsnull, // iteratorObject
           nsnull, // wrappedObject
     }
 };
--- a/js/src/builtin/MapObject.cpp
+++ b/js/src/builtin/MapObject.cpp
@@ -152,21 +152,19 @@ Class MapObject::class_ = {
     JS_PropertyStub,         /* addProperty */
     JS_PropertyStub,         /* delProperty */
     JS_PropertyStub,         /* getProperty */
     JS_StrictPropertyStub,   /* setProperty */
     JS_EnumerateStub,
     JS_ResolveStub,
     JS_ConvertStub,
     finalize,
-    NULL,                    /* reserved0   */
     NULL,                    /* checkAccess */
     NULL,                    /* call        */
     NULL,                    /* construct   */
-    NULL,                    /* xdrObject   */
     NULL,                    /* hasInstance */
     mark
 };
 
 JSFunctionSpec MapObject::methods[] = {
     JS_FN("get", get, 1, 0),
     JS_FN("has", has, 1, 0),
     JS_FN("set", set, 2, 0),
@@ -303,21 +301,19 @@ Class SetObject::class_ = {
     JS_PropertyStub,         /* addProperty */
     JS_PropertyStub,         /* delProperty */
     JS_PropertyStub,         /* getProperty */
     JS_StrictPropertyStub,   /* setProperty */
     JS_EnumerateStub,
     JS_ResolveStub,
     JS_ConvertStub,
     finalize,
-    NULL,                    /* reserved0   */
     NULL,                    /* checkAccess */
     NULL,                    /* call        */
     NULL,                    /* construct   */
-    NULL,                    /* xdrObject   */
     NULL,                    /* hasInstance */
     mark
 };
 
 JSFunctionSpec SetObject::methods[] = {
     JS_FN("has", has, 1, 0),
     JS_FN("add", add, 1, 0),
     JS_FN("delete", delete_, 1, 0),
--- a/js/src/ctypes/CTypes.cpp
+++ b/js/src/ctypes/CTypes.cpp
@@ -235,17 +235,17 @@ static JSClass sCABIClass = {
 // Class representing ctypes.{C,Pointer,Array,Struct,Function}Type.prototype.
 // This exists to give said prototypes a class of "CType", and to provide
 // reserved slots for stashing various other prototype objects.
 static JSClass sCTypeProtoClass = {
   "CType",
   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
 // of CTypes. This exists to give said prototypes a class of "CData".
 static JSClass sCDataProtoClass = {
   "CData",
   0,
   JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
@@ -253,34 +253,34 @@ static JSClass sCDataProtoClass = {
   JSCLASS_NO_OPTIONAL_MEMBERS
 };
 
 static JSClass sCTypeClass = {
   "CType",
   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 = {
   "CData",
   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 = {
   "CClosure",
   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 \
   (JSPROP_ENUMERATE | JSPROP_READONLY | JSPROP_PERMANENT)
 
 #define CTYPESCTOR_FLAGS \
   (CTYPESFN_FLAGS | JSFUN_CONSTRUCTOR)
 
--- a/js/src/gc/Barrier.h
+++ b/js/src/gc/Barrier.h
@@ -324,16 +324,17 @@ class HeapValue
 
     bool isUndefined() const { return value.isUndefined(); }
     bool isNull() const { return value.isNull(); }
     bool isBoolean() const { return value.isBoolean(); }
     bool isTrue() const { return value.isTrue(); }
     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); }
     bool isGCThing() const { return value.isGCThing(); }
     bool isMarkable() const { return value.isMarkable(); }
 
     bool toBoolean() const { return value.toBoolean(); }
     double toNumber() const { return value.toNumber(); }
--- a/js/src/js.msg
+++ b/js/src/js.msg
@@ -119,17 +119,17 @@ MSG_DEF(JSMSG_BAD_BYTECODE,            3
 MSG_DEF(JSMSG_BAD_RADIX,               33, 0, JSEXN_RANGEERR, "radix must be an integer at least 2 and no greater than 36")
 MSG_DEF(JSMSG_PAREN_BEFORE_LET,        34, 0, JSEXN_SYNTAXERR, "missing ( before let head")
 MSG_DEF(JSMSG_CANT_CONVERT,            35, 1, JSEXN_ERR, "can't convert {0} to an integer")
 MSG_DEF(JSMSG_CYCLIC_VALUE,            36, 1, JSEXN_TYPEERR, "cyclic {0} value")
 MSG_DEF(JSMSG_COMPILE_EXECED_SCRIPT,   37, 0, JSEXN_TYPEERR, "can't compile over a script that is currently executing")
 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")
 MSG_DEF(JSMSG_TOO_MANY_FUN_ARGS,       45, 0, JSEXN_SYNTAXERR, "too many function arguments")
 MSG_DEF(JSMSG_BAD_QUANTIFIER,          46, 0, JSEXN_SYNTAXERR, "invalid quantifier")
 MSG_DEF(JSMSG_MIN_TOO_BIG,             47, 1, JSEXN_SYNTAXERR, "overlarge minimum {0}")
 MSG_DEF(JSMSG_MAX_TOO_BIG,             48, 1, JSEXN_SYNTAXERR, "overlarge maximum {0}")
 MSG_DEF(JSMSG_OUT_OF_ORDER,            49, 1, JSEXN_SYNTAXERR, "maximum {0} less than minimum")
--- a/js/src/jsapi-tests/testCustomIterator.cpp
+++ b/js/src/jsapi-tests/testCustomIterator.cpp
@@ -30,21 +30,19 @@ js::Class HasCustomIterClass = {
     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 */
     NULL, /* mark */
     {
         NULL,
         NULL,
         NULL,
         IterHook,
         NULL
--- a/js/src/jsapi-tests/testExtendedEq.cpp
+++ b/js/src/jsapi-tests/testExtendedEq.cpp
@@ -21,21 +21,19 @@ js::Class TestExtendedEq_JSClass = {
     JS_PropertyStub,       /* addProperty */
     JS_PropertyStub,       /* delProperty */
     JS_PropertyStub,       /* getProperty */
     JS_StrictPropertyStub, /* setProperty */
     JS_EnumerateStub,
     JS_ResolveStub,
     NULL,                  /* convert */
     NULL,                  /* finalize */
-    NULL,                  /* reserved0   */
     NULL,                  /* checkAccess */
     NULL,                  /* call        */
     NULL,                  /* construct   */
-    NULL,                  /* xdrObject   */
     NULL,                  /* hasInstance */
     NULL,                  /* mark        */
     {
         my_Equality,
         NULL,              /* outerObject    */
         NULL,              /* innerObject    */
         NULL,              /* iteratorObject */
         NULL,              /* wrappedObject  */
--- a/js/src/jsapi-tests/testNewObject.cpp
+++ b/js/src/jsapi-tests/testNewObject.cpp
@@ -81,17 +81,17 @@ BEGIN_TEST(testNewObject_1)
     CHECK_SAME(v, INT_TO_JSVAL(N - 1));
 
     // With JSClass.construct.
     static JSClass cls = {
         "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);
     jsvalRoot rt2(cx, OBJECT_TO_JSVAL(ctor));
     obj = JS_New(cx, ctor, 3, argv);
     CHECK(obj);
     CHECK(JS_GetElement(cx, ctor, 0, &v));
     CHECK_SAME(v, JSVAL_ZERO);
--- a/js/src/jsapi.cpp
+++ b/js/src/jsapi.cpp
@@ -4286,21 +4286,19 @@ static Class prop_iter_class = {
     JS_PropertyStub,         /* addProperty */
     JS_PropertyStub,         /* delProperty */
     JS_PropertyStub,         /* getProperty */
     JS_StrictPropertyStub,   /* setProperty */
     JS_EnumerateStub,
     JS_ResolveStub,
     JS_ConvertStub,
     prop_iter_finalize,
-    NULL,           /* reserved0   */
     NULL,           /* checkAccess */
     NULL,           /* call        */
     NULL,           /* construct   */
-    NULL,           /* xdrObject   */
     NULL,           /* hasInstance */
     prop_iter_trace
 };
 
 JS_PUBLIC_API(JSObject *)
 JS_NewPropertyIterator(JSContext *cx, JSObject *obj)
 {
     JSObject *iterobj;
--- a/js/src/jsapi.h
+++ b/js/src/jsapi.h
@@ -1346,23 +1346,16 @@ struct JSStringFinalizer {
  * value in *vp, and its attributes in *attrsp.  As for JSPropertyOp above, id
  * is either a string or an int jsval.
  */
 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
  * *bp otherwise.
  */
 typedef JSBool
 (* JSHasInstanceOp)(JSContext *cx, JSObject *obj, const jsval *v, JSBool *bp);
 
 /*
@@ -3392,25 +3385,22 @@ struct JSClass {
     JSPropertyOp        getProperty;
     JSStrictPropertyOp  setProperty;
     JSEnumerateOp       enumerate;
     JSResolveOp         resolve;
     JSConvertOp         convert;
     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];
 };
 
 #define JSCLASS_HAS_PRIVATE             (1<<0)  /* objects have private slot */
 #define JSCLASS_NEW_ENUMERATE           (1<<1)  /* has JSNewEnumerateOp hook */
 #define JSCLASS_NEW_RESOLVE             (1<<2)  /* has JSNewResolveOp hook */
 #define JSCLASS_PRIVATE_IS_NSISUPPORTS  (1<<3)  /* private is (nsISupports *) */
 #define JSCLASS_NEW_RESOLVE_GETS_START  (1<<4)  /* JSNewResolveOp gets starting
@@ -3484,18 +3474,18 @@ struct JSClass {
 #define JSCLASS_CACHED_PROTO_MASK       JS_BITMASK(JSCLASS_CACHED_PROTO_WIDTH)
 #define JSCLASS_HAS_CACHED_PROTO(key)   ((key) << JSCLASS_CACHED_PROTO_SHIFT)
 #define JSCLASS_CACHED_PROTO_KEY(clasp) ((JSProtoKey)                         \
                                          (((clasp)->flags                     \
                                            >> JSCLASS_CACHED_PROTO_SHIFT)     \
                                           & 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);
 
 extern JS_PUBLIC_API(jsid)
 JS_IdArrayGet(JSContext *cx, JSIdArray *ida, jsint index);
 
 extern JS_PUBLIC_API(void)
--- a/js/src/jsarray.cpp
+++ b/js/src/jsarray.cpp
@@ -1220,21 +1220,19 @@ Class js::ArrayClass = {
     JS_PropertyStub,         /* addProperty */
     JS_PropertyStub,         /* delProperty */
     JS_PropertyStub,         /* getProperty */
     JS_StrictPropertyStub,   /* setProperty */
     JS_EnumerateStub,
     JS_ResolveStub,
     JS_ConvertStub,
     NULL,
-    NULL,           /* reserved0   */
     NULL,           /* checkAccess */
     NULL,           /* call        */
     NULL,           /* construct   */
-    NULL,           /* xdrObject   */
     NULL,           /* hasInstance */
     array_trace,    /* trace       */
     {
         NULL,       /* equality    */
         NULL,       /* outerObject */
         NULL,       /* innerObject */
         JS_ElementIteratorStub,
         NULL,       /* unused      */
@@ -1284,21 +1282,19 @@ Class js::SlowArrayClass = {
     slowarray_addProperty,
     JS_PropertyStub,         /* delProperty */
     JS_PropertyStub,         /* getProperty */
     JS_StrictPropertyStub,   /* setProperty */
     JS_EnumerateStub,
     JS_ResolveStub,
     JS_ConvertStub,
     NULL,
-    NULL,           /* reserved0   */
     NULL,           /* checkAccess */
     NULL,           /* call        */
     NULL,           /* construct   */
-    NULL,           /* xdrObject   */
     NULL,           /* hasInstance */
     NULL,           /* trace       */
     {
         NULL,       /* equality    */
         NULL,       /* outerObject */
         NULL,       /* innerObject */
         JS_ElementIteratorStub,
         NULL,       /* unused      */
--- a/js/src/jsclass.h
+++ b/js/src/jsclass.h
@@ -260,21 +260,19 @@ typedef void
     JSPropertyOp        getProperty;                                          \
     JSStrictPropertyOp  setProperty;                                          \
     JSEnumerateOp       enumerate;                                            \
     JSResolveOp         resolve;                                              \
     JSConvertOp         convert;                                              \
     JSFinalizeOp        finalize;                                             \
                                                                               \
     /* Optionally non-null members start here. */                             \
-    JSClassInternal     reserved0;                                            \
     JSCheckAccessOp     checkAccess;                                          \
     JSNative            call;                                                 \
     JSNative            construct;                                            \
-    JSXDRObjectOp       xdrObject;                                            \
     JSHasInstanceOp     hasInstance;                                          \
     JSTraceOp           trace
 
 /*
  * The helper struct to measure the size of JS_CLASS_MEMBERS to know how much
  * we have to padd js::Class to match the size of JSClass;
  */
 struct ClassSizeMeasurement
@@ -367,21 +365,19 @@ JS_STATIC_ASSERT(offsetof(JSClass, flags
 JS_STATIC_ASSERT(offsetof(JSClass, addProperty) == offsetof(Class, addProperty));
 JS_STATIC_ASSERT(offsetof(JSClass, delProperty) == offsetof(Class, delProperty));
 JS_STATIC_ASSERT(offsetof(JSClass, getProperty) == offsetof(Class, getProperty));
 JS_STATIC_ASSERT(offsetof(JSClass, setProperty) == offsetof(Class, setProperty));
 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));
 
 static JS_ALWAYS_INLINE JSClass *
 Jsvalify(Class *c)
 {
     return (JSClass *)c;
--- a/js/src/jsexn.cpp
+++ b/js/src/jsexn.cpp
@@ -99,21 +99,19 @@ Class js::ErrorClass = {
     JS_PropertyStub,         /* addProperty */
     JS_PropertyStub,         /* delProperty */
     JS_PropertyStub,         /* getProperty */
     JS_StrictPropertyStub,   /* setProperty */
     JS_EnumerateStub,
     (JSResolveOp)exn_resolve,
     JS_ConvertStub,
     exn_finalize,
-    NULL,                 /* reserved0   */
     NULL,                 /* checkAccess */
     NULL,                 /* call        */
     NULL,                 /* construct   */
-    NULL,                 /* xdrObject   */
     NULL,                 /* hasInstance */
     exn_trace
 };
 
 typedef struct JSStackTraceElem {
     js::HeapPtrString   funName;
     size_t              argc;
     const char          *filename;
--- a/js/src/jsfun.cpp
+++ b/js/src/jsfun.cpp
@@ -559,21 +559,19 @@ Class js::NormalArgumentsObjectClass = {
     JS_PropertyStub,         /* addProperty */
     args_delProperty,
     JS_PropertyStub,         /* getProperty */
     JS_StrictPropertyStub,   /* setProperty */
     args_enumerate,
     reinterpret_cast<JSResolveOp>(args_resolve),
     JS_ConvertStub,
     args_finalize,           /* finalize   */
-    NULL,                    /* reserved0   */
     NULL,                    /* checkAccess */
     NULL,                    /* call        */
     NULL,                    /* construct   */
-    NULL,                    /* xdrObject   */
     NULL,                    /* hasInstance */
     args_trace,
     {
         NULL,       /* equality    */
         NULL,       /* outerObject */
         NULL,       /* innerObject */
         JS_ElementIteratorStub,
         NULL,       /* unused      */
@@ -595,21 +593,19 @@ Class js::StrictArgumentsObjectClass = {
     JS_PropertyStub,         /* addProperty */
     args_delProperty,
     JS_PropertyStub,         /* getProperty */
     JS_StrictPropertyStub,   /* setProperty */
     strictargs_enumerate,
     reinterpret_cast<JSResolveOp>(strictargs_resolve),
     JS_ConvertStub,
     args_finalize,           /* finalize   */
-    NULL,                    /* reserved0   */
     NULL,                    /* checkAccess */
     NULL,                    /* call        */
     NULL,                    /* construct   */
-    NULL,                    /* xdrObject   */
     NULL,                    /* hasInstance */
     args_trace,
     {
         NULL,       /* equality    */
         NULL,       /* outerObject */
         NULL,       /* innerObject */
         JS_ElementIteratorStub,
         NULL,       /* unused      */
@@ -949,21 +945,19 @@ JS_PUBLIC_DATA(Class) js::CallClass = {
     JS_PropertyStub,         /* addProperty */
     JS_PropertyStub,         /* delProperty */
     JS_PropertyStub,         /* getProperty */
     JS_StrictPropertyStub,   /* setProperty */
     JS_EnumerateStub,
     (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
 };
 
 bool
 StackFrame::getValidCalleeObject(JSContext *cx, Value *vp)
 {
     if (!isFunctionFrame()) {
@@ -1345,17 +1339,17 @@ fun_resolve(JSContext *cx, JSObject *obj
 
     return true;
 }
 
 #if JS_HAS_XDR
 
 /* XXX store parent and proto, if defined */
 JSBool
-js_XDRFunctionObject(JSXDRState *xdr, JSObject **objp)
+js::XDRFunctionObject(JSXDRState *xdr, JSObject **objp)
 {
     JSContext *cx;
     JSFunction *fun;
     uint32_t firstword;           /* flag telling whether fun->atom is non-null,
                                    plus for fun->u.i.skipmin, fun->u.i.wrapper,
                                    and 14 bits reserved for future use */
     uint32_t flagsword;           /* word for argument count and fun->flags */
 
@@ -1388,17 +1382,17 @@ js_XDRFunctionObject(JSXDRState *xdr, JS
 
     if (!JS_XDRUint32(xdr, &firstword))
         return false;
     if ((firstword & 1U) && !js_XDRAtom(xdr, &fun->atom))
         return false;
     if (!JS_XDRUint32(xdr, &flagsword))
         return false;
 
-    if (!js_XDRScript(xdr, &script))
+    if (!XDRScript(xdr, &script))
         return false;
 
     if (xdr->mode == JSXDR_DECODE) {
         fun->nargs = flagsword >> 16;
         JS_ASSERT((flagsword & JSFUN_KINDMASK) >= JSFUN_INTERPRETED);
         fun->flags = uint16_t(flagsword);
         fun->setScript(script);
         if (!script->typeSetFunction(cx, fun))
@@ -1406,21 +1400,17 @@ js_XDRFunctionObject(JSXDRState *xdr, JS
         JS_ASSERT(fun->nargs == fun->script()->bindings.countArgs());
         js_CallNewScriptHook(cx, fun->script(), fun);
         *objp = fun;
     }
 
     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
  * property of its 'this' parameter, and walks the prototype chain of v (only
  * if v is an object) returning true if .prototype is found.
  */
 static JSBool
 fun_hasInstance(JSContext *cx, JSObject *obj, const Value *v, JSBool *bp)
@@ -1505,21 +1495,19 @@ JS_FRIEND_DATA(Class) js::FunctionClass 
     JS_PropertyStub,         /* addProperty */
     JS_PropertyStub,         /* delProperty */
     JS_PropertyStub,         /* getProperty */
     JS_StrictPropertyStub,   /* setProperty */
     fun_enumerate,
     (JSResolveOp)fun_resolve,
     JS_ConvertStub,
     fun_finalize,
-    NULL,                    /* reserved0   */
     NULL,                    /* checkAccess */
     NULL,                    /* call        */
     NULL,                    /* construct   */
-    NULL,
     fun_hasInstance,
     fun_trace
 };
 
 JSString *
 fun_toStringHelper(JSContext *cx, JSObject *obj, uintN indent)
 {
     if (!obj->isFunction()) {
@@ -2227,17 +2215,17 @@ js_CloneFunctionObject(JSContext *cx, JS
          */
         if (clone->isInterpreted()) {
             JSScript *script = clone->script();
             JS_ASSERT(script);
             JS_ASSERT(script->compartment() == fun->compartment());
             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;
 
             cscript->globalObject = &clone->global();
             clone->setScript(cscript);
             if (!cscript->typeSetFunction(cx, clone))
                 return NULL;
 
--- a/js/src/jsfun.h
+++ b/js/src/jsfun.h
@@ -432,18 +432,22 @@ extern JSObject *
 js_GetArgsObject(JSContext *cx, js::StackFrame *fp);
 
 extern void
 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);
 
 extern JSBool
 js_fun_call(JSContext *cx, uintN argc, js::Value *vp);
 
 #endif /* jsfun_h___ */
--- a/js/src/jsiter.cpp
+++ b/js/src/jsiter.cpp
@@ -95,21 +95,19 @@ Class js::IteratorClass = {
     JS_PropertyStub,         /* addProperty */
     JS_PropertyStub,         /* delProperty */
     JS_PropertyStub,         /* getProperty */
     JS_StrictPropertyStub,   /* setProperty */
     JS_EnumerateStub,
     JS_ResolveStub,
     JS_ConvertStub,
     iterator_finalize,
-    NULL,                    /* reserved    */
     NULL,                    /* checkAccess */
     NULL,                    /* call        */
     NULL,                    /* construct   */
-    NULL,                    /* xdrObject   */
     NULL,                    /* hasInstance */
     iterator_trace,
     {
         NULL,                /* equality       */
         NULL,                /* outerObject    */
         NULL,                /* innerObject    */
         iterator_iterator,
         NULL                 /* unused  */
@@ -122,21 +120,19 @@ Class js::ElementIteratorClass = {
     JS_PropertyStub,         /* addProperty */
     JS_PropertyStub,         /* delProperty */
     JS_PropertyStub,         /* getProperty */
     JS_StrictPropertyStub,   /* setProperty */
     JS_EnumerateStub,
     JS_ResolveStub,
     JS_ConvertStub,
     NULL,                    /* finalize    */
-    NULL,                    /* reserved    */
     NULL,                    /* checkAccess */
     NULL,                    /* call        */
     NULL,                    /* construct   */
-    NULL,                    /* xdrObject   */
     NULL,                    /* hasInstance */
     NULL,                    /* trace       */
     {
         NULL,                /* equality       */
         NULL,                /* outerObject    */
         NULL,                /* innerObject    */
         iterator_iterator,
         NULL                 /* unused  */
@@ -1335,21 +1331,19 @@ Class js::StopIterationClass = {
     JS_PropertyStub,         /* addProperty */
     JS_PropertyStub,         /* delProperty */
     JS_PropertyStub,         /* getProperty */
     JS_StrictPropertyStub,   /* setProperty */
     JS_EnumerateStub,
     JS_ResolveStub,
     JS_ConvertStub,
     NULL,                    /* finalize    */
-    NULL,                    /* reserved0   */
     NULL,                    /* checkAccess */
     NULL,                    /* call        */
     NULL,                    /* construct   */
-    NULL,                    /* xdrObject   */
     stopiter_hasInstance
 };
 
 #if JS_HAS_GENERATORS
 
 static void
 generator_finalize(JSContext *cx, JSObject *obj)
 {
@@ -1424,21 +1418,19 @@ Class js::GeneratorClass = {
     JS_PropertyStub,         /* addProperty */
     JS_PropertyStub,         /* delProperty */
     JS_PropertyStub,         /* getProperty */
     JS_StrictPropertyStub,   /* setProperty */
     JS_EnumerateStub,
     JS_ResolveStub,
     JS_ConvertStub,
     generator_finalize,
-    NULL,                    /* reserved    */
     NULL,                    /* checkAccess */
     NULL,                    /* call        */
     NULL,                    /* construct   */
-    NULL,                    /* xdrObject   */
     NULL,                    /* hasInstance */
     generator_trace,
     {
         NULL,                /* equality       */
         NULL,                /* outerObject    */
         NULL,                /* innerObject    */
         iterator_iterator,
         NULL                 /* unused */
--- a/js/src/jsobj.cpp
+++ b/js/src/jsobj.cpp
@@ -6174,98 +6174,16 @@ js_ValueToNonNullObject(JSContext *cx, c
 
     if (!js_ValueToObjectOrNull(cx, v, &obj))
         return NULL;
     if (!obj)
         js_ReportIsNullOrUndefined(cx, JSDVG_SEARCH_STACK, v, NULL);
     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)
 {
     JS_ASSERT(trc->debugPrinter == js_PrintObjectSlotName);
 
     JSObject *obj = (JSObject *)trc->debugPrintArg;
     uint32_t slot = uint32_t(trc->debugPrintIndex);
--- a/js/src/jsobj.h
+++ b/js/src/jsobj.h
@@ -1955,19 +1955,16 @@ ValueToObject(JSContext *cx, const Value
 {
     if (v.isObject())
         return &v.toObject();
     return js_ValueToNonNullObject(cx, v);
 }
 
 } /* namespace js */
 
-extern JSBool
-js_XDRObject(JSXDRState *xdr, JSObject **objp);
-
 extern void
 js_PrintObjectSlotName(JSTracer *trc, char *buf, size_t bufsize);
 
 extern bool
 js_ClearNative(JSContext *cx, JSObject *obj);
 
 extern JSBool
 js_ReportGetterOnlyAssignment(JSContext *cx);
--- a/js/src/jsproxy.cpp
+++ b/js/src/jsproxy.cpp
@@ -1317,21 +1317,19 @@ JS_FRIEND_DATA(Class) js::ObjectProxyCla
     JS_PropertyStub,         /* addProperty */
     JS_PropertyStub,         /* delProperty */
     JS_PropertyStub,         /* getProperty */
     JS_StrictPropertyStub,   /* setProperty */
     JS_EnumerateStub,
     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,
     {
         proxy_LookupGeneric,
         proxy_LookupProperty,
         proxy_LookupElement,
         proxy_LookupSpecial,
@@ -1373,21 +1371,19 @@ JS_FRIEND_DATA(Class) js::OuterWindowPro
     JS_PropertyStub,         /* addProperty */
     JS_PropertyStub,         /* delProperty */
     JS_PropertyStub,         /* getProperty */
     JS_StrictPropertyStub,   /* setProperty */
     JS_EnumerateStub,
     JS_ResolveStub,
     JS_ConvertStub,
     proxy_Finalize,          /* finalize    */
-    NULL,                    /* reserved0   */
     NULL,                    /* checkAccess */
     NULL,                    /* call        */
     NULL,                    /* construct   */
-    NULL,                    /* xdrObject   */
     NULL,                    /* hasInstance */
     proxy_TraceObject,       /* trace       */
     {
         NULL,                /* equality    */
         NULL,                /* outerObject */
         proxy_innerObject,
         NULL                 /* unused */
     },
@@ -1451,21 +1447,19 @@ JS_FRIEND_DATA(Class) js::FunctionProxyC
     JS_PropertyStub,         /* addProperty */
     JS_PropertyStub,         /* delProperty */
     JS_PropertyStub,         /* getProperty */
     JS_StrictPropertyStub,   /* setProperty */
     JS_EnumerateStub,
     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,
     {
         proxy_LookupGeneric,
         proxy_LookupProperty,
         proxy_LookupElement,
         proxy_LookupSpecial,
@@ -1729,17 +1723,16 @@ Class js::CallableObjectClass = {
     JS_PropertyStub,         /* addProperty */
     JS_PropertyStub,         /* delProperty */
     JS_PropertyStub,         /* getProperty */
     JS_StrictPropertyStub,   /* setProperty */
     JS_EnumerateStub,
     JS_ResolveStub,
     JS_ConvertStub,
     NULL,                    /* finalize    */
-    NULL,                    /* reserved0   */
     NULL,                    /* checkAccess */
     callable_Call,
     callable_Construct,
 };
 
 static bool
 FixProxy(JSContext *cx, JSObject *proxy, JSBool *bp)
 {
--- a/js/src/jsscript.cpp
+++ b/js/src/jsscript.cpp
@@ -331,63 +331,154 @@ CheckScript(JSScript *script, JSScript *
         crash::StackBuffer<sizeof(JSScript), 0x87> buf1(script);
         crash::StackBuffer<sizeof(JSScript), 0x88> buf2(prev);
         JS_OPT_ASSERT(false);
     }
 }
 
 #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;
     uint16_t nClosedArgs = 0, nClosedVars = 0;
     uint32_t nTypeSets = 0;
     uint32_t encodeable, sameOriginPrincipals;
     JSSecurityCallbacks *callbacks;
     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();
         argsVars = (nargs << 16) | nvars;
         paddingUpvars = nupvars;
     }
     if (!JS_XDRUint32(xdr, &argsVars) || !JS_XDRUint32(xdr, &paddingUpvars))
         return false;
@@ -581,92 +672,83 @@ js_XDRScript(JSXDRState *xdr, JSScript *
         if (scriptBits & (1 << StrictModeCode))
             script->strictModeCode = true;
         if (scriptBits & (1 << UsesEval))
             script->usesEval = true;
         if (scriptBits & (1 << UsesArguments))
             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) {
         if (!state->filenameSaved) {
             const char *filename = state->filename;
             filename = SaveScriptFilename(xdr->cx, filename);
             xdr->cx->free_((void *) state->filename);
             state->filename = filename;
             state->filenameSaved = true;
             if (!filename)
-                goto error;
+                return false;
         }
         script->filename = state->filename;
     }
 
     JS_ASSERT_IF(xdr->mode == JSXDR_ENCODE, state->filename == script->filename);
 
     callbacks = JS_GetSecurityCallbacks(cx);
     if (xdr->mode == JSXDR_ENCODE)
         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) {
                 script->originPrincipals = script->principals;
                 JSPRINCIPALS_HOLD(cx, script->originPrincipals);
             }
         } else {
             if (!callbacks->principalsTranscoder(xdr, &script->originPrincipals))
-                goto error;
+                return false;
         }
     }
 
     if (xdr->mode == JSXDR_DECODE) {
         script->lineno = (uintN)lineno;
         script->nslots = uint16_t(nslots);
         script->staticLevel = uint16_t(nslots >> 16);
     }
 
     for (i = 0; i != natoms; ++i) {
         if (!js_XDRAtom(xdr, &script->atoms[i]))
-            goto error;
+            return false;
     }
 
     /*
      * Here looping from 0-to-length to xdr objects is essential. It ensures
      * that block objects from the script->objects array will be written and
      * restored in the outer-to-inner order. js_XDRBlockObject relies on this
      * to restore the parent chain.
      */
@@ -674,47 +756,45 @@ js_XDRScript(JSXDRState *xdr, JSScript *
         HeapPtr<JSObject> *objp = &script->objects()->vector[i];
         uint32_t isBlock;
         if (xdr->mode == JSXDR_ENCODE) {
             JSObject *obj = *objp;
             JS_ASSERT(obj->isFunction() || obj->isStaticBlock());
             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) {
         /*
          * We combine tn->kind and tn->stackDepth when serializing as XDR is not
          * efficient when serializing small integer types.
          */
         JSTryNote *tn, *tnfirst;
@@ -729,47 +809,46 @@ js_XDRScript(JSXDRState *xdr, JSScript *
             --tn;
             if (xdr->mode == JSXDR_ENCODE) {
                 kindAndDepth = (uint32_t(tn->kind) << 16)
                                | uint32_t(tn->stackDepth);
             }
             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);
                 tn->stackDepth = uint16_t(kindAndDepth);
             }
         } 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);
-
-    xdr->script = oldscript;
-    return JS_TRUE;
+    if (xdr->mode == JSXDR_DECODE) {
+        if (cx->hasRunOption(JSOPTION_PCCOUNT))
+            (void) script->initCounts(cx);
+        *scriptp = script;
+    }
 
-  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)
 {
     JS_ASSERT(!pcCounters);
 
     size_t count = 0;
 
     jsbytecode *pc, *next;
@@ -812,16 +891,17 @@ void
 JSScript::destroyCounts(JSContext *cx)
 {
     if (pcCounters) {
         cx->free_(pcCounters.counts);
         pcCounters.counts = NULL;
     }
 }
 
+namespace js {
 
 /*
  * Shared script filename management.
  */
 
 static const char *
 SaveScriptFilename(JSContext *cx, const char *filename)
 {
@@ -841,16 +921,18 @@ SaveScriptFilename(JSContext *cx, const 
             JS_ReportOutOfMemory(cx);
             return NULL;
         }
     }
 
     return (*p)->filename;
 }
 
+} /* namespace js */
+
 /*
  * Back up from a saved filename by its offset within its hash table entry.
  */
 #define FILENAME_TO_SFE(fn) \
     ((ScriptFilenameEntry *) ((fn) - offsetof(ScriptFilenameEntry, filename)))
 
 void
 js_MarkScriptFilename(const char *filename)
@@ -1618,18 +1700,16 @@ CurrentScriptFileLineOriginSlow(JSContex
     }
 
     JSScript *script = iter.fp()->script();
     *file = script->filename;
     *linenop = js_PCToLineNumber(cx, iter.fp()->script(), iter.pc());
     *origin = script->originPrincipals;
 }
 
-}  /* namespace js */
-
 class DisablePrincipalsTranscoding {
     JSSecurityCallbacks *callbacks;
     JSPrincipalsTranscoder temp;
 
   public:
     DisablePrincipalsTranscoding(JSContext *cx)
       : callbacks(JS_GetRuntimeSecurityCallbacks(cx->runtime)),
         temp(NULL)
@@ -1665,33 +1745,33 @@ public:
     }
 
 private:
     JSXDRState *const xdr;
     JS_DECL_USE_GUARD_OBJECT_NOTIFIER
 };
 
 JSScript *
-js_CloneScript(JSContext *cx, JSScript *script)
+CloneScript(JSContext *cx, JSScript *script)
 {
     JS_ASSERT(cx->compartment != script->compartment());
 
     // serialize script
     AutoJSXDRState w(JS_XDRNewMem(cx, JSXDR_ENCODE));
     if (!w)
         return NULL;
 
     // we don't want gecko to transcribe our principals for us
     DisablePrincipalsTranscoding disable(cx);
 
     XDRScriptState wstate(w);
 #ifdef DEBUG
     wstate.filename = script->filename;
 #endif
-    if (!js_XDRScript(w, &script))
+    if (!XDRScript(w, &script))
         return NULL;
 
     uint32_t nbytes;
     void *p = JS_XDRMemGetData(w, &nbytes);
     if (!p)
         return NULL;
 
     // de-serialize script
@@ -1704,33 +1784,35 @@ js_CloneScript(JSContext *cx, JSScript *
     JS_XDRMemSetData(r, p, nbytes);
     JS_XDRMemSetData(w, NULL, 0);
 
     XDRScriptState rstate(r);
     rstate.filename = script->filename;
     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
     // the originPrincipals are not related to compartment, so just copy
     newScript->principals = newScript->compartment()->principals;
     newScript->originPrincipals = script->originPrincipals;
     if (!newScript->originPrincipals)
         newScript->originPrincipals = newScript->principals;
     if (newScript->principals) {
         JSPRINCIPALS_HOLD(cx, newScript->principals);
         JSPRINCIPALS_HOLD(cx, newScript->originPrincipals);
     }
 
     return newScript;
 }
 
+}  /* namespace js */
+
 void
 JSScript::copyClosedSlotsTo(JSScript *other)
 {
     js_memcpy(other->closedSlots, closedSlots, nClosedArgs + nClosedVars);
 }
 
 bool
 JSScript::ensureHasDebug(JSContext *cx)
--- a/js/src/jsscript.h
+++ b/js/src/jsscript.h
@@ -843,18 +843,18 @@ StackDepth(JSScript *script)
 extern void
 js_MarkScriptFilename(const char *filename);
 
 extern void
 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)
 js_CallNewScriptHook(JSContext *cx, JSScript *script, JSFunction *fun);
 
 extern void
 js_CallDestroyScriptHook(JSContext *cx, JSScript *script);
 
@@ -923,22 +923,22 @@ CurrentLine(JSContext *cx);
 enum LineOption {
     CALLED_FROM_JSOP_EVAL,
     NOT_CALLED_FROM_JSOP_EVAL
 };
 
 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
  * required subsequent set-up of owning function or script object and then call
  * js_CallNewScriptHook.
  */
 extern JSBool
-js_XDRScript(JSXDRState *xdr, JSScript **scriptp);
+XDRScript(JSXDRState *xdr, JSScript **scriptp);
+
+}
 
 #endif /* jsscript_h___ */
--- a/js/src/jstypedarray.cpp
+++ b/js/src/jstypedarray.cpp
@@ -2189,21 +2189,19 @@ Class js::ArrayBufferClass = {
     JS_PropertyStub,         /* addProperty */
     JS_PropertyStub,         /* delProperty */
     JS_PropertyStub,         /* getProperty */
     JS_StrictPropertyStub,   /* setProperty */
     JS_EnumerateStub,
     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,
     {
         ArrayBuffer::obj_lookupGeneric,
         ArrayBuffer::obj_lookupProperty,
         ArrayBuffer::obj_lookupElement,
         ArrayBuffer::obj_lookupSpecial,
@@ -2307,21 +2305,19 @@ JSFunctionSpec _typedArray::jsfuncs[] = 
     JS_PropertyStub,         /* addProperty */                                 \
     JS_PropertyStub,         /* delProperty */                                 \
     JS_PropertyStub,         /* getProperty */                                 \
     JS_StrictPropertyStub,   /* setProperty */                                 \
     JS_EnumerateStub,                                                          \
     JS_ResolveStub,                                                            \
     JS_ConvertStub,                                                            \
     NULL,                    /* finalize    */                                 \
-    NULL,                    /* reserved0   */                                 \
     NULL,                    /* checkAccess */                                 \
     NULL,                    /* call        */                                 \
     NULL,                    /* construct   */                                 \
-    NULL,                    /* xdrObject   */                                 \
     NULL,                    /* hasInstance */                                 \
     _typedArray::obj_trace,  /* trace       */                                 \
     {                                                                          \
         NULL,       /* equality    */                                          \
         NULL,       /* outerObject */                                          \
         NULL,       /* innerObject */                                          \
         JS_ElementIteratorStub,                                                \
         NULL,       /* unused      */                                          \
--- a/js/src/jsweakmap.cpp
+++ b/js/src/jsweakmap.cpp
@@ -346,22 +346,20 @@ Class js::WeakMapClass = {
     JS_PropertyStub,         /* addProperty */
     JS_PropertyStub,         /* delProperty */
     JS_PropertyStub,         /* getProperty */
     JS_StrictPropertyStub,   /* setProperty */
     JS_EnumerateStub,
     JS_ResolveStub,
     JS_ConvertStub,
     WeakMap_finalize,
-    NULL,                    /* reserved0   */
     NULL,                    /* checkAccess */
     NULL,                    /* call        */
     NULL,                    /* construct   */
     NULL,                    /* xdrObject   */
-    NULL,                    /* hasInstance */
     WeakMap_mark
 };
 
 static JSFunctionSpec weak_map_methods[] = {
     JS_FN("has",    WeakMap_has, 1, 0),
     JS_FN("get",    WeakMap_get, 2, 0),
     JS_FN("delete", WeakMap_delete, 1, 0),
     JS_FN("set",    WeakMap_set, 2, 0),
--- a/js/src/jsxdrapi.cpp
+++ b/js/src/jsxdrapi.cpp
@@ -46,17 +46,16 @@
 #include <string.h>
 #include "jstypes.h"
 #include "jsutil.h"
 #include "jsdhash.h"
 #include "jsprf.h"
 #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"
 #include "vm/Debugger.h"
 
 #include "jsobjinlines.h"
 
 using namespace mozilla;
@@ -232,21 +231,17 @@ static JSXDROps xdrmem_ops = {
     mem_raw,        mem_seek,       mem_tell,       mem_finalize
 };
 
 JS_PUBLIC_API(void)
 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;
 }
 
 JS_PUBLIC_API(JSXDRState *)
 JS_XDRNewMem(JSContext *cx, JSXDRMode mode)
 {
     JSXDRState *xdr = (JSXDRState *) cx->malloc_(sizeof(JSXDRMemState));
     if (!xdr)
@@ -302,21 +297,16 @@ JS_XDRMemResetData(JSXDRState *xdr)
     MEM_COUNT(xdr) = 0;
 }
 
 JS_PUBLIC_API(void)
 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);
 }
 
 JS_PUBLIC_API(JSBool)
 JS_XDRUint8(JSXDRState *xdr, uint8_t *b)
 {
     uint32_t l = *b;
     if (!JS_XDRUint32(xdr, &l))
@@ -488,141 +478,27 @@ JS_XDRStringOrNull(JSXDRState *xdr, JSSt
         return JS_FALSE;
     if (null) {
         *strp = NULL;
         return JS_TRUE;
     }
     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
 js_XDRAtom(JSXDRState *xdr, JSAtom **atomp)
 {
     JSString *str;
     uint32_t nchars;
     JSAtom *atom;
@@ -692,17 +568,17 @@ JS_XDRFunctionObject(JSXDRState *xdr, JS
     if (xdr->mode == JSXDR_ENCODE) {
         JSFunction* fun = (*objp)->toFunction();
         fstate.filename = fun->script()->filename;
     }
 
     if (!JS_XDRCStringOrNull(xdr, (char **) &fstate.filename))
         return false;
 
-    return js_XDRFunctionObject(xdr, objp);
+    return XDRFunctionObject(xdr, objp);
 }
 
 JS_PUBLIC_API(JSBool)
 JS_XDRScript(JSXDRState *xdr, JSScript **scriptp)
 {
     JS_ASSERT(!xdr->state);
 
     JSScript *script;
@@ -733,126 +609,23 @@ JS_XDRScript(JSXDRState *xdr, JSScript *
     if (!xdr->state)
         return false;
 
     if (xdr->mode == JSXDR_ENCODE)
         state.filename = script->filename;
     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) {
         JS_ASSERT(!script->compileAndGo);
         script->globalObject = GetCurrentGlobal(xdr->cx);
         js_CallNewScriptHook(xdr->cx, script, NULL);
         Debugger::onNewScript(xdr->cx, script, NULL);
         *scriptp = script;
     }
 
     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 */
--- a/js/src/jsxdrapi.h
+++ b/js/src/jsxdrapi.h
@@ -120,22 +120,17 @@ public:
 };
 
 } /* namespace JS */
 
 struct JSXDRState {
     JSXDRMode   mode;
     JSXDROps    *ops;
     JSContext   *cx;
-    JSClass     **registry;
-    uintN       numclasses;
-    uintN       maxclasses;
-    void        *reghash;
     void        *userdata;
-    JSScript    *script;
     js::XDRScriptState *state;
 };
 
 extern JS_PUBLIC_API(void)
 JS_XDRInitBase(JSXDRState *xdr, JSXDRMode mode, JSContext *cx);
 
 extern JS_PUBLIC_API(JSXDRState *)
 JS_XDRNewMem(JSContext *cx, JSXDRMode mode);
@@ -178,33 +173,21 @@ JS_XDRString(JSXDRState *xdr, JSString *
 
 extern JS_PUBLIC_API(JSBool)
 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.
  */
 #define JSXDR_MAGIC_SCRIPT_1        0xdead0001
 #define JSXDR_MAGIC_SCRIPT_2        0xdead0002
 #define JSXDR_MAGIC_SCRIPT_3        0xdead0003
 #define JSXDR_MAGIC_SCRIPT_4        0xdead0004
 #define JSXDR_MAGIC_SCRIPT_5        0xdead0005
--- a/js/src/jsxml.cpp
+++ b/js/src/jsxml.cpp
@@ -228,21 +228,19 @@ JS_FRIEND_DATA(Class) js::NamespaceClass
     JS_PropertyStub,         /* addProperty */
     JS_PropertyStub,         /* delProperty */
     JS_PropertyStub,         /* getProperty */
     JS_StrictPropertyStub,   /* setProperty */
     JS_EnumerateStub,
     JS_ResolveStub,
     JS_ConvertStub,
     JS_FinalizeStub,
-    NULL,                    /* reserved0   */
     NULL,                    /* checkAccess */
     NULL,                    /* call        */
     NULL,                    /* construct   */
-    NULL,                    /* xdrObject   */
     NULL,                    /* hasInstance */
     NULL,                    /* mark        */
     {
         namespace_equality,
         NULL,                /* outerObject    */
         NULL,                /* innerObject    */
         NULL,                /* iteratorObject */
         NULL,                /* wrappedObject  */
@@ -344,21 +342,19 @@ JS_FRIEND_DATA(Class) js::QNameClass = {
     JS_PropertyStub,         /* addProperty */
     JS_PropertyStub,         /* delProperty */
     JS_PropertyStub,         /* getProperty */
     JS_StrictPropertyStub,   /* setProperty */
     JS_EnumerateStub,
     JS_ResolveStub,
     JS_ConvertStub,
     JS_FinalizeStub,
-    NULL,                    /* reserved0   */
     NULL,                    /* checkAccess */
     NULL,                    /* call        */
     NULL,                    /* construct   */
-    NULL,                    /* xdrObject   */
     NULL,                    /* hasInstance */
     NULL,                    /* mark        */
     {
         qname_equality,
         NULL,                /* outerObject    */
         NULL,                /* innerObject    */
         NULL,                /* iteratorObject */
         NULL,                /* wrappedObject  */
@@ -5375,21 +5371,19 @@ JS_FRIEND_DATA(Class) js::XMLClass = {
     JS_PropertyStub,         /* addProperty */
     JS_PropertyStub,         /* delProperty */
     JS_PropertyStub,         /* getProperty */
     JS_StrictPropertyStub,   /* setProperty */
     JS_EnumerateStub,
     JS_ResolveStub,
     xml_convert,
     xml_finalize,
-    NULL,                 /* reserved0   */
     NULL,                 /* checkAccess */
     NULL,                 /* call        */
     NULL,                 /* construct   */
-    NULL,                 /* xdrObject   */
     xml_hasInstance,
     xml_trace,
     JS_NULL_CLASS_EXT,
     {
         xml_lookupGeneric,
         xml_lookupProperty,
         xml_lookupElement,
         xml_lookupSpecial,
@@ -7927,21 +7921,19 @@ Class js_XMLFilterClass = {
     JS_PropertyStub,         /* addProperty */
     JS_PropertyStub,         /* delProperty */
     JS_PropertyStub,         /* getProperty */
     JS_StrictPropertyStub,   /* setProperty */
     JS_EnumerateStub,
     JS_ResolveStub,
     JS_ConvertStub,
     xmlfilter_finalize,
-    NULL,                    /* reserved0   */
     NULL,                    /* checkAccess */
     NULL,                    /* call        */
     NULL,                    /* construct   */
-    NULL,                    /* xdrObject   */
     NULL,                    /* hasInstance */
     xmlfilter_trace
 };
 
 JSBool
 js_StepXMLListFilter(JSContext *cx, JSBool initialized)
 {
     jsval *sp;
--- a/js/src/shell/jsworkers.cpp
+++ b/js/src/shell/jsworkers.cpp
@@ -1265,26 +1265,24 @@ Event::trace(JSTracer *trc)
     if (child)
         JS_CALL_OBJECT_TRACER(trc, child->asObject(), "worker");
 }
 
 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] = {
     JS_FN("postMessage", Worker::jsPostMessageToChild, 1, 0),
     JS_FN("terminate", Worker::jsTerminate, 0, 0),
     JS_FS_END
 };
 
--- a/js/src/vm/Debugger.cpp
+++ b/js/src/vm/Debugger.cpp
@@ -1323,21 +1323,19 @@ Debugger::finalize(JSContext *cx, JSObje
 }
 
 Class Debugger::jsclass = {
     "Debugger",
     JSCLASS_HAS_PRIVATE | JSCLASS_IMPLEMENTS_BARRIERS |
     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
 };
 
 Debugger *
 Debugger::fromThisValue(JSContext *cx, const CallArgs &args, const char *fnname)
 {
     if (!args.thisv().isObject()) {
@@ -1856,21 +1854,19 @@ DebuggerScript_trace(JSTracer *trc, JSOb
 }
 
 Class DebuggerScript_class = {
     "Script",
     JSCLASS_HAS_PRIVATE | JSCLASS_IMPLEMENTS_BARRIERS |
     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
 };
 
 JSObject *
 Debugger::newDebuggerScript(JSContext *cx, JSScript *script)
 {
     assertSameCompartment(cx, object.get());
@@ -2960,21 +2956,19 @@ DebuggerObject_trace(JSTracer *trc, JSOb
 }
 
 Class DebuggerObject_class = {
     "Object",
     JSCLASS_HAS_PRIVATE | JSCLASS_IMPLEMENTS_BARRIERS |
     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
 };
 
 static JSObject *
 DebuggerObject_checkThis(JSContext *cx, const CallArgs &args, const char *fnname)
 {
     if (!args.thisv().isObject()) {
@@ -3604,21 +3598,19 @@ DebuggerEnv_trace(JSTracer *trc, JSObjec
 }
 
 Class DebuggerEnv_class = {
     "Environment",
     JSCLASS_HAS_PRIVATE | JSCLASS_IMPLEMENTS_BARRIERS |
     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
 };
 
 static JSObject *
 DebuggerEnv_checkThis(JSContext *cx, const CallArgs &args, const char *fnname)
 {
     if (!args.thisv().isObject()) {
--- a/js/src/vm/RegExpObject.cpp
+++ b/js/src/vm/RegExpObject.cpp
@@ -347,25 +347,19 @@ Class js::RegExpClass = {
     JS_PropertyStub,         /* addProperty */
     JS_PropertyStub,         /* delProperty */
     JS_PropertyStub,         /* getProperty */
     JS_StrictPropertyStub,   /* setProperty */
     JS_EnumerateStub,        /* enumerate */
     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
 };
 
 RegExpShared::RegExpShared(JSRuntime *rt, RegExpFlag flags)
   : parenCount(0), flags(flags), activeUseCount(0), gcNumberWhenUsed(rt->gcNumber)
 {}
 
@@ -741,18 +735,18 @@ js::ParseRegExpFlags(JSContext *cx, JSSt
 #undef HANDLE_FLAG
     }
     return true;
 }
 
 #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;
 
     if (xdr->mode == JSXDR_ENCODE) {
         JS_ASSERT(objp);
         RegExpObject &reobj = (*objp)->asRegExp();
         source = reobj.getSource();
@@ -765,14 +759,14 @@ js_XDRRegExpObject(JSXDRState *xdr, JSOb
         RegExpObject *reobj = RegExpObject::createNoStatics(xdr->cx, source, flags, NULL);
         if (!reobj)
             return false;
 
         if (!reobj->clearParent(xdr->cx))
             return false;
         if (!reobj->clearType(xdr->cx))
             return false;
-        *objp = reobj;
+        objp->init(reobj);
     }
     return true;
 }
 #endif /* !JS_HAS_XDR */
 
--- a/js/src/vm/RegExpObject.h
+++ b/js/src/vm/RegExpObject.h
@@ -459,14 +459,14 @@ ParseRegExpFlags(JSContext *cx, JSString
  * Beware: this RegExpShared can be owned by a compartment other than
  * cx->compartment. Normal RegExpShared::Guard (which is necessary anyways)
  * will protect the object but it is important not to assign the return value
  * to be the private of any RegExpObject.
  */
 inline RegExpShared *
 RegExpToShared(JSContext *cx, JSObject &obj);
 
+bool
+XDRScriptRegExpObject(JSXDRState *xdr, HeapPtrObject *objp);
+
 } /* namespace js */
 
-JSBool
-js_XDRRegExpObject(JSXDRState *xdr, JSObject **objp);
-
 #endif
--- a/js/src/vm/RegExpStatics.cpp
+++ b/js/src/vm/RegExpStatics.cpp
@@ -75,21 +75,19 @@ Class js::RegExpStaticsClass = {
     JS_PropertyStub,         /* addProperty */
     JS_PropertyStub,         /* delProperty */
     JS_PropertyStub,         /* getProperty */
     JS_StrictPropertyStub,   /* setProperty */
     JS_EnumerateStub,
     JS_ResolveStub,
     JS_ConvertStub,
     resc_finalize,
-    NULL,                    /* reserved0   */
     NULL,                    /* checkAccess */
     NULL,                    /* call        */
     NULL,                    /* construct   */
-    NULL,                    /* xdrObject   */
     NULL,                    /* hasInstance */
     resc_trace
 };
 
 JSObject *
 RegExpStatics::create(JSContext *cx, GlobalObject *parent)
 {
     JSObject *obj = NewObjectWithGivenProto(cx, &RegExpStaticsClass, NULL, parent);
--- a/js/src/vm/ScopeObject.cpp
+++ b/js/src/vm/ScopeObject.cpp
@@ -377,21 +377,19 @@ Class js::WithClass = {
     JS_PropertyStub,         /* addProperty */
     JS_PropertyStub,         /* delProperty */
     JS_PropertyStub,         /* getProperty */
     JS_StrictPropertyStub,   /* setProperty */
     JS_EnumerateStub,
     JS_ResolveStub,
     JS_ConvertStub,
     NULL,                    /* finalize */
-    NULL,                    /* reserved    */
     NULL,                    /* checkAccess */
     NULL,                    /* call        */
     NULL,                    /* construct   */
-    NULL,                    /* xdrObject   */
     NULL,                    /* hasInstance */
     NULL,                    /* trace       */
     JS_NULL_CLASS_EXT,
     {
         with_LookupGeneric,
         with_LookupProperty,
         with_LookupElement,
         with_LookupSpecial,
@@ -612,28 +610,28 @@ FindObjectIndex(JSObjectArray *array, JS
                 return i;
         } while (i != 0);
     }
 
     return NO_PARENT_INDEX;
 }
 
 bool
-js_XDRStaticBlockObject(JSXDRState *xdr, StaticBlockObject **objp)
+js::XDRStaticBlockObject(JSXDRState *xdr, JSScript *script, StaticBlockObject **objp)
 {
     JSContext *cx = xdr->cx;
 
     StaticBlockObject *obj = NULL;
     uint32_t parentId = 0;
     uint32_t count = 0;
     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);
         count = obj->slotCount();
         JS_ASSERT(count <= UINT16_MAX);
         depthAndCount = (depth << 16) | uint16_t(count);
     }
 
@@ -649,17 +647,17 @@ js_XDRStaticBlockObject(JSXDRState *xdr,
 
         /*
          * If there's a parent id, then get the parent out of our script's
          * object array. We know that we XDR block object in outer-to-inner
          * order, which means that getting the parent now will work.
          */
         obj->setEnclosingBlock(parentId == NO_PARENT_INDEX
                                ? NULL
-                               : &xdr->script->getObject(parentId)->asStaticBlock());
+                               : &script->getObject(parentId)->asStaticBlock());
     }
 
     AutoObjectRooter tvr(cx, obj);
 
     if (!JS_XDRUint32(xdr, &depthAndCount))
         return false;
 
     if (xdr->mode == JSXDR_DECODE) {
--- a/js/src/vm/ScopeObject.h
+++ b/js/src/vm/ScopeObject.h
@@ -251,14 +251,14 @@ class ClonedBlockObject : public BlockOb
      * called to copy the slot values into this block's object slots.
      */
     void put(JSContext *cx);
 
     /* Assuming 'put' has been called, return the value of the ith let var. */
     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___ */
--- a/js/xpconnect/src/XPCComponents.cpp
+++ b/js/xpconnect/src/XPCComponents.cpp
@@ -2902,17 +2902,17 @@ sandbox_convert(JSContext *cx, JSObject 
     return JS_ConvertStub(cx, obj, type, vp);
 }
 
 static JSClass SandboxClass = {
     "Sandbox",
     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[] = {
     {"dump",    SandboxDump,    1,0},
     {"debug",   SandboxDebug,   1,0},
     {"importFunction", SandboxImport, 1,0},
     {nsnull,nsnull,0,0}
 };
--- a/js/xpconnect/src/XPCString.cpp
+++ b/js/xpconnect/src/XPCString.cpp
@@ -50,18 +50,16 @@
  * Wrap the JSString with a root-holding XPCJSReadableStringWrapper, which roots
  * the string and exposes its buffer via the nsAString interface, as
  * well as providing refcounting support.
  */
 
 #include "xpcprivate.h"
 #include "nsStringBuffer.h"
 
-static int sDOMStringFinalizerIndex = -1;
-
 static void
 FinalizeDOMString(const JSStringFinalizer *fin, jschar *chars)
 {
     nsStringBuffer::FromData(chars)->Release();
 }
 
 static const JSStringFinalizer sDOMStringFinalizer = { FinalizeDOMString };
 
--- a/js/xpconnect/src/XPCThreadContext.cpp
+++ b/js/xpconnect/src/XPCThreadContext.cpp
@@ -172,17 +172,17 @@ SafeFinalize(JSContext* cx, JSObject* ob
     NS_IF_RELEASE(sop);
 }
 
 static JSClass global_class = {
     "global_for_XPCJSContextStack_SafeJSContext",
     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
 // XXX #include angels cry.
 extern void
 mozJSLoaderErrorReporter(JSContext *cx, const char *message, JSErrorReport *rep);
 
 JSContext*
--- a/js/xpconnect/src/XPCWrappedNativeJSOps.cpp
+++ b/js/xpconnect/src/XPCWrappedNativeJSOps.cpp
@@ -827,21 +827,19 @@ XPCWrappedNativeJSClass XPC_WN_NoHelper_
     XPC_WN_OnlyIWrite_SetPropertyStub, // setProperty
 
     XPC_WN_Shared_Enumerate,           // enumerate
     XPC_WN_NoHelper_Resolve,           // resolve
     XPC_WN_Shared_Convert,             // convert
     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
 
     // ClassExtension
     {
         XPC_WN_Equality,
         nsnull, // outerObject
         nsnull, // innerObject
@@ -1692,21 +1690,19 @@ js::Class XPC_WN_ModsAllowed_WithCall_Pr
     JS_PropertyStub,                // getProperty;
     JS_StrictPropertyStub,          // setProperty;
     XPC_WN_Shared_Proto_Enumerate,  // enumerate;
     XPC_WN_ModsAllowed_Proto_Resolve, // resolve;
     JS_ConvertStub,                 // convert;
     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;
 
     JS_NULL_CLASS_EXT,
     XPC_WN_WithCall_ObjectOps
 };
 
 js::Class XPC_WN_ModsAllowed_NoCall_Proto_JSClass = {
@@ -1719,21 +1715,19 @@ js::Class XPC_WN_ModsAllowed_NoCall_Prot
     JS_PropertyStub,                // getProperty;
     JS_StrictPropertyStub,          // setProperty;
     XPC_WN_Shared_Proto_Enumerate,  // enumerate;
     XPC_WN_ModsAllowed_Proto_Resolve, // resolve;
     JS_ConvertStub,                 // convert;
     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;
 
     JS_NULL_CLASS_EXT,
     XPC_WN_NoCall_ObjectOps
 };
 
 /***************************************************************************/
@@ -1809,21 +1803,19 @@ js::Class XPC_WN_NoMods_WithCall_Proto_J
     JS_PropertyStub,                           // getProperty;
     XPC_WN_OnlyIWrite_Proto_SetPropertyStub,   // setProperty;
     XPC_WN_Shared_Proto_Enumerate,             // enumerate;
     XPC_WN_NoMods_Proto_Resolve,               // resolve;
     JS_ConvertStub,                            // convert;
     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;
 
     JS_NULL_CLASS_EXT,
     XPC_WN_WithCall_ObjectOps
 };
 
 js::Class XPC_WN_NoMods_NoCall_Proto_JSClass = {
@@ -1836,21 +1828,19 @@ js::Class XPC_WN_NoMods_NoCall_Proto_JSC
     JS_PropertyStub,                           // getProperty;
     XPC_WN_OnlyIWrite_Proto_SetPropertyStub,   // setProperty;
     XPC_WN_Shared_Proto_Enumerate,             // enumerate;
     XPC_WN_NoMods_Proto_Resolve,               // resolve;
     JS_ConvertStub,                            // convert;
     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;
 
     JS_NULL_CLASS_EXT,
     XPC_WN_NoCall_ObjectOps
 };
 
 /***************************************************************************/
--- a/js/xpconnect/src/XPCWrappedNativeScope.cpp
+++ b/js/xpconnect/src/XPCWrappedNativeScope.cpp
@@ -209,21 +209,19 @@ js::Class XPC_WN_NoHelper_Proto_JSClass 
     JS_PropertyStub,                // getProperty;
     JS_StrictPropertyStub,          // setProperty;
     JS_EnumerateStub,               // enumerate;
     JS_ResolveStub,                 // resolve;
     JS_ConvertStub,                 // convert;
     nsnull,                         // finalize;
 
     /* Optionally non-null members start here. */
-    nsnull,                         // reserved0;
     nsnull,                         // checkAccess;
     nsnull,                         // call;
     nsnull,                         // construct;
-    nsnull,                         // xdrObject;
     nsnull,                         // hasInstance;
     nsnull,                         // trace;
 
     JS_NULL_CLASS_EXT,
     XPC_WN_NoCall_ObjectOps
 };
 
 
--- a/js/xpconnect/src/dombindingsgen.py
+++ b/js/xpconnect/src/dombindingsgen.py
@@ -439,21 +439,19 @@ listTemplate = (
 "    JS_PropertyStub,        /* addProperty */\n"
 "    JS_PropertyStub,        /* delProperty */\n"
 "    JS_PropertyStub,        /* getProperty */\n"
 "    JS_StrictPropertyStub,  /* setProperty */\n"
 "    JS_EnumerateStub,\n"
 "    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")
 
 derivedClassTemplate = (
 "template<>\n"
 "bool\n"
 "${name}Wrapper::objIsList(JSObject *obj)\n"