From 144e21554820cf9638ceff76f89b35f6f1a346e0 Mon Sep 17 00:00:00 2001 From: Anthony Ramine Date: Tue, 16 Feb 2016 00:39:26 +0100 Subject: [PATCH] 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 --- components/script/dom/browsingcontext.rs | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/components/script/dom/browsingcontext.rs b/components/script/dom/browsingcontext.rs index 2805d271636..7149a365800 100644 --- a/components/script/dom/browsingcontext.rs +++ b/components/script/dom/browsingcontext.rs @@ -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,