mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 15:52:07 +00:00
Bug 720305 - Deal with odd getters and setters. r=jwalden
--HG-- extra : rebase_source : b5df534b437a6c79ab95b16ebb081d961b08e87f
This commit is contained in:
parent
2dcf64b0c3
commit
7c21ecfee1
@ -180,7 +180,10 @@ ProxyHandler::set(JSContext *cx, JSObject *proxy, JSObject *receiver, jsid id, b
|
||||
if (desc.attrs & JSPROP_READONLY)
|
||||
return true;
|
||||
if (!desc.setter) {
|
||||
desc.setter = JS_StrictPropertyStub;
|
||||
// Be wary of the odd explicit undefined setter case possible through
|
||||
// Object.defineProperty.
|
||||
if (!(desc.attrs & JSPROP_SETTER))
|
||||
desc.setter = JS_StrictPropertyStub;
|
||||
} else if ((desc.attrs & JSPROP_SETTER) || desc.setter != JS_StrictPropertyStub) {
|
||||
if (!CallSetter(cx, receiver, id, desc.setter, desc.attrs, desc.shortid, strict, vp))
|
||||
return false;
|
||||
@ -189,8 +192,11 @@ ProxyHandler::set(JSContext *cx, JSObject *proxy, JSObject *receiver, jsid id, b
|
||||
if (desc.attrs & JSPROP_SHARED)
|
||||
return true;
|
||||
}
|
||||
if (!desc.getter)
|
||||
desc.getter = JS_PropertyStub;
|
||||
if (!desc.getter) {
|
||||
// Same as above for the null setter case.
|
||||
if (!(desc.attrs & JSPROP_GETTER))
|
||||
desc.getter = JS_PropertyStub;
|
||||
}
|
||||
desc.value = *vp;
|
||||
return defineProperty(cx, receiver, id, &desc);
|
||||
}
|
||||
@ -200,7 +206,10 @@ ProxyHandler::set(JSContext *cx, JSObject *proxy, JSObject *receiver, jsid id, b
|
||||
if (desc.attrs & JSPROP_READONLY)
|
||||
return true;
|
||||
if (!desc.setter) {
|
||||
desc.setter = JS_StrictPropertyStub;
|
||||
// Be wary of the odd explicit undefined setter case possible through
|
||||
// Object.defineProperty.
|
||||
if (!(desc.attrs & JSPROP_SETTER))
|
||||
desc.setter = JS_StrictPropertyStub;
|
||||
} else if ((desc.attrs & JSPROP_SETTER) || desc.setter != JS_StrictPropertyStub) {
|
||||
if (!CallSetter(cx, receiver, id, desc.setter, desc.attrs, desc.shortid, strict, vp))
|
||||
return false;
|
||||
@ -209,8 +218,11 @@ ProxyHandler::set(JSContext *cx, JSObject *proxy, JSObject *receiver, jsid id, b
|
||||
if (desc.attrs & JSPROP_SHARED)
|
||||
return true;
|
||||
}
|
||||
if (!desc.getter)
|
||||
desc.getter = JS_PropertyStub;
|
||||
if (!desc.getter) {
|
||||
// Same as above for the null setter case.
|
||||
if (!(desc.attrs & JSPROP_GETTER))
|
||||
desc.getter = JS_PropertyStub;
|
||||
}
|
||||
return defineProperty(cx, receiver, id, &desc);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user