Don't use the hasOwn hook anymore in browsingcontext

There is no [[HasOwnProperty]] hook in the ES spec, we should just define
the has proxy trap.

https://bugzilla.mozilla.org/show_bug.cgi?id=980565
This commit is contained in:
Anthony Ramine 2016-02-16 00:39:26 +01:00
parent a734b8fa21
commit 144e215548

View file

@ -16,10 +16,10 @@ use js::JSCLASS_IS_GLOBAL;
use js::glue::{CreateWrapperProxyHandler, GetProxyPrivate, NewWindowProxy};
use js::glue::{ProxyTraps, SetProxyExtra};
use js::jsapi::{Handle, HandleId, HandleObject, JSAutoCompartment, JSAutoRequest, JSContext};
use js::jsapi::{JSErrNum, JSObject, JSPropertyDescriptor, JS_AlreadyHasOwnPropertyById};
use js::jsapi::{JS_DefinePropertyById6, JS_ForwardGetPropertyTo, JS_ForwardSetPropertyTo};
use js::jsapi::{JS_GetClass, JS_GetOwnPropertyDescriptorById, MutableHandle, MutableHandleValue};
use js::jsapi::{ObjectOpResult, RootedObject, RootedValue};
use js::jsapi::{JSErrNum, JSObject, JSPropertyDescriptor, JS_DefinePropertyById6};
use js::jsapi::{JS_ForwardGetPropertyTo, JS_ForwardSetPropertyTo, JS_GetClass};
use js::jsapi::{JS_GetOwnPropertyDescriptorById, JS_HasPropertyById, MutableHandle};
use js::jsapi::{MutableHandleValue, ObjectOpResult, RootedObject, RootedValue};
use js::jsval::{ObjectValue, PrivateValue, UndefinedValue};
#[dom_struct]
@ -176,11 +176,11 @@ unsafe extern "C" fn defineProperty(cx: *mut JSContext,
}
#[allow(unsafe_code)]
unsafe extern "C" fn hasOwn(cx: *mut JSContext,
proxy: HandleObject,
id: HandleId,
bp: *mut bool)
-> bool {
unsafe extern "C" fn has(cx: *mut JSContext,
proxy: HandleObject,
id: HandleId,
bp: *mut bool)
-> bool {
let window = GetSubframeWindow(cx, proxy, id);
if window.is_some() {
*bp = true;
@ -189,7 +189,7 @@ unsafe extern "C" fn hasOwn(cx: *mut JSContext,
let target = RootedObject::new(cx, GetProxyPrivate(*proxy.ptr).to_object());
let mut found = false;
if !JS_AlreadyHasOwnPropertyById(cx, target.handle(), id, &mut found) {
if !JS_HasPropertyById(cx, target.handle(), id, &mut found) {
return false;
}
@ -247,13 +247,13 @@ static PROXY_HANDLER: ProxyTraps = ProxyTraps {
enumerate: None,
preventExtensions: None,
isExtensible: None,
has: None,
has: Some(has),
get: Some(get),
set: Some(set),
call: None,
construct: None,
getPropertyDescriptor: Some(get_property_descriptor),
hasOwn: Some(hasOwn),
hasOwn: None,
getOwnEnumerablePropertyKeys: None,
nativeCall: None,
hasInstance: None,