Fill out various proxy binding traps as part of making setters work. Add named getter and setter and indexed getter support, as well as proxy object expandos. Fixes #660.

This commit is contained in:
Josh Matthews 2013-08-03 13:48:09 -04:00
parent a4baa7fc6b
commit c9bc2046f6
10 changed files with 376 additions and 48 deletions

View file

@ -120,7 +120,7 @@ fn is_dom_class(clasp: *JSClass) -> bool {
}
}
fn is_dom_proxy(obj: *JSObject) -> bool {
pub fn is_dom_proxy(obj: *JSObject) -> bool {
unsafe {
(js_IsObjectProxyClass(obj) || js_IsFunctionProxyClass(obj)) &&
IsProxyHandlerFamily(obj)
@ -888,3 +888,9 @@ pub fn FindEnumStringIndex(cx: *JSContext,
return Err(()); //XXX pass in behaviour for value not found
}
}
pub fn HasPropertyOnPrototype(cx: *JSContext, proxy: *JSObject, id: jsid) -> bool {
// MOZ_ASSERT(js::IsProxy(proxy) && js::GetProxyHandler(proxy) == handler);
let mut found = false;
return !GetPropertyOnPrototype(cx, proxy, id, &mut found, ptr::null()) || found;
}