зеркало из https://github.com/mozilla/pjs.git
Fix uses of native reserved slots in web workers, bug 697537.
This commit is contained in:
Родитель
be5eb74993
Коммит
526a4947c7
|
@ -91,7 +91,7 @@ public:
|
|||
InitClass(JSContext* aCx, JSObject* aObj, JSObject* aParentProto,
|
||||
bool aMainRuntime)
|
||||
{
|
||||
JSObject* proto = JS_InitClass(aCx, aObj, aParentProto, &sClass, Construct,
|
||||
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,7 +335,7 @@ public:
|
|||
InitClass(JSContext* aCx, JSObject* aObj, JSObject* aParentProto,
|
||||
bool aMainRuntime)
|
||||
{
|
||||
JSObject* proto = JS_InitClass(aCx, aObj, aParentProto, &sClass, Construct,
|
||||
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;
|
||||
|
|
Загрузка…
Ссылка в новой задаче