diff --git a/dom/workers/Worker.cpp b/dom/workers/Worker.cpp index 41029178db7..c1d100c0de2 100644 --- a/dom/workers/Worker.cpp +++ b/dom/workers/Worker.cpp @@ -91,8 +91,8 @@ public: InitClass(JSContext* aCx, JSObject* aObj, JSObject* aParentProto, bool aMainRuntime) { - JSObject* proto = JS_InitClass(aCx, aObj, aParentProto, &sClass, Construct, - 0, sProperties, sFunctions, NULL, NULL); + JSObject* proto = js::InitClassWithReserved(aCx, aObj, aParentProto, &sClass, Construct, + 0, sProperties, sFunctions, NULL, NULL); if (!proto) { return NULL; } @@ -102,11 +102,10 @@ public: parent->AssertIsOnWorkerThread(); JSObject* constructor = JS_GetConstructor(aCx, proto); - if (!constructor || - !JS_SetReservedSlot(aCx, constructor, CONSTRUCTOR_SLOT_PARENT, - PRIVATE_TO_JSVAL(parent))) { + if (!constructor) return NULL; - } + js::SetFunctionNativeReserved(constructor, CONSTRUCTOR_SLOT_PARENT, + PRIVATE_TO_JSVAL(parent)); } return proto; @@ -153,11 +152,8 @@ protected: return false; } - jsval priv; - if (!JS_GetReservedSlot(aCx, JSVAL_TO_OBJECT(JS_CALLEE(aCx, aVp)), - CONSTRUCTOR_SLOT_PARENT, &priv)) { - return false; - } + jsval priv = js::GetFunctionNativeReserved(JSVAL_TO_OBJECT(JS_CALLEE(aCx, aVp)), + CONSTRUCTOR_SLOT_PARENT); RuntimeService* runtimeService; WorkerPrivate* parent; @@ -339,8 +335,8 @@ public: InitClass(JSContext* aCx, JSObject* aObj, JSObject* aParentProto, bool aMainRuntime) { - JSObject* proto = JS_InitClass(aCx, aObj, aParentProto, &sClass, Construct, - 0, NULL, NULL, NULL, NULL); + JSObject* proto = js::InitClassWithReserved(aCx, aObj, aParentProto, &sClass, Construct, + 0, NULL, NULL, NULL, NULL); if (!proto) { return NULL; } @@ -350,11 +346,10 @@ public: parent->AssertIsOnWorkerThread(); JSObject* constructor = JS_GetConstructor(aCx, proto); - if (!constructor || - !JS_SetReservedSlot(aCx, constructor, CONSTRUCTOR_SLOT_PARENT, - PRIVATE_TO_JSVAL(parent))) { + if (!constructor) return NULL; - } + js::SetFunctionNativeReserved(constructor, CONSTRUCTOR_SLOT_PARENT, + PRIVATE_TO_JSVAL(parent)); } return proto;