mirror of
https://github.com/servo/servo.git
synced 2025-08-04 05:00:08 +01:00
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:
parent
a734b8fa21
commit
144e215548
1 changed files with 12 additions and 12 deletions
|
@ -16,10 +16,10 @@ use js::JSCLASS_IS_GLOBAL;
|
||||||
use js::glue::{CreateWrapperProxyHandler, GetProxyPrivate, NewWindowProxy};
|
use js::glue::{CreateWrapperProxyHandler, GetProxyPrivate, NewWindowProxy};
|
||||||
use js::glue::{ProxyTraps, SetProxyExtra};
|
use js::glue::{ProxyTraps, SetProxyExtra};
|
||||||
use js::jsapi::{Handle, HandleId, HandleObject, JSAutoCompartment, JSAutoRequest, JSContext};
|
use js::jsapi::{Handle, HandleId, HandleObject, JSAutoCompartment, JSAutoRequest, JSContext};
|
||||||
use js::jsapi::{JSErrNum, JSObject, JSPropertyDescriptor, JS_AlreadyHasOwnPropertyById};
|
use js::jsapi::{JSErrNum, JSObject, JSPropertyDescriptor, JS_DefinePropertyById6};
|
||||||
use js::jsapi::{JS_DefinePropertyById6, JS_ForwardGetPropertyTo, JS_ForwardSetPropertyTo};
|
use js::jsapi::{JS_ForwardGetPropertyTo, JS_ForwardSetPropertyTo, JS_GetClass};
|
||||||
use js::jsapi::{JS_GetClass, JS_GetOwnPropertyDescriptorById, MutableHandle, MutableHandleValue};
|
use js::jsapi::{JS_GetOwnPropertyDescriptorById, JS_HasPropertyById, MutableHandle};
|
||||||
use js::jsapi::{ObjectOpResult, RootedObject, RootedValue};
|
use js::jsapi::{MutableHandleValue, ObjectOpResult, RootedObject, RootedValue};
|
||||||
use js::jsval::{ObjectValue, PrivateValue, UndefinedValue};
|
use js::jsval::{ObjectValue, PrivateValue, UndefinedValue};
|
||||||
|
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
|
@ -176,11 +176,11 @@ unsafe extern "C" fn defineProperty(cx: *mut JSContext,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
unsafe extern "C" fn hasOwn(cx: *mut JSContext,
|
unsafe extern "C" fn has(cx: *mut JSContext,
|
||||||
proxy: HandleObject,
|
proxy: HandleObject,
|
||||||
id: HandleId,
|
id: HandleId,
|
||||||
bp: *mut bool)
|
bp: *mut bool)
|
||||||
-> bool {
|
-> bool {
|
||||||
let window = GetSubframeWindow(cx, proxy, id);
|
let window = GetSubframeWindow(cx, proxy, id);
|
||||||
if window.is_some() {
|
if window.is_some() {
|
||||||
*bp = true;
|
*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 target = RootedObject::new(cx, GetProxyPrivate(*proxy.ptr).to_object());
|
||||||
let mut found = false;
|
let mut found = false;
|
||||||
if !JS_AlreadyHasOwnPropertyById(cx, target.handle(), id, &mut found) {
|
if !JS_HasPropertyById(cx, target.handle(), id, &mut found) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -247,13 +247,13 @@ static PROXY_HANDLER: ProxyTraps = ProxyTraps {
|
||||||
enumerate: None,
|
enumerate: None,
|
||||||
preventExtensions: None,
|
preventExtensions: None,
|
||||||
isExtensible: None,
|
isExtensible: None,
|
||||||
has: None,
|
has: Some(has),
|
||||||
get: Some(get),
|
get: Some(get),
|
||||||
set: Some(set),
|
set: Some(set),
|
||||||
call: None,
|
call: None,
|
||||||
construct: None,
|
construct: None,
|
||||||
getPropertyDescriptor: Some(get_property_descriptor),
|
getPropertyDescriptor: Some(get_property_descriptor),
|
||||||
hasOwn: Some(hasOwn),
|
hasOwn: None,
|
||||||
getOwnEnumerablePropertyKeys: None,
|
getOwnEnumerablePropertyKeys: None,
|
||||||
nativeCall: None,
|
nativeCall: None,
|
||||||
hasInstance: None,
|
hasInstance: None,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue