aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/bindings/proxyhandler.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/script/dom/bindings/proxyhandler.rs')
-rw-r--r--components/script/dom/bindings/proxyhandler.rs22
1 files changed, 8 insertions, 14 deletions
diff --git a/components/script/dom/bindings/proxyhandler.rs b/components/script/dom/bindings/proxyhandler.rs
index 76382e59423..2a512b02df3 100644
--- a/components/script/dom/bindings/proxyhandler.rs
+++ b/components/script/dom/bindings/proxyhandler.rs
@@ -8,11 +8,11 @@
use dom::bindings::conversions::is_dom_proxy;
use dom::bindings::utils::delete_property_by_id;
-use js::glue::{GetProxyHandler, GetProxyHandlerFamily, SetProxyExtra};
-use js::glue::GetProxyExtra;
+use js::glue::{GetProxyHandler, GetProxyHandlerFamily};
+use js::glue::{GetProxyPrivate, SetProxyPrivate};
use js::glue::InvokeGetOwnPropertyDescriptor;
-use js::jsapi::{DOMProxyShadowsResult, JSContext, JSObject, PropertyDescriptor, JSPROP_GETTER};
-use js::jsapi::{JSErrNum, JS_StrictPropertyStub, SetDOMProxyInformation};
+use js::jsapi::{DOMProxyShadowsResult, JSContext, JSObject, PropertyDescriptor};
+use js::jsapi::{JSErrNum, SetDOMProxyInformation};
use js::jsapi::GetObjectProto;
use js::jsapi::GetStaticPrototype;
use js::jsapi::Handle as RawHandle;
@@ -24,14 +24,13 @@ use js::jsapi::MutableHandle as RawMutableHandle;
use js::jsapi::MutableHandleObject as RawMutableHandleObject;
use js::jsapi::ObjectOpResult;
use js::jsval::ObjectValue;
+use js::jsval::UndefinedValue;
use js::rust::{Handle, HandleObject, MutableHandle, MutableHandleObject};
use js::rust::wrappers::JS_AlreadyHasOwnPropertyById;
use js::rust::wrappers::JS_NewObjectWithGivenProto;
use std::ptr;
-static JSPROXYSLOT_EXPANDO: u32 = 0;
-
/// Determine if this id shadows any existing properties for this proxy.
pub unsafe extern "C" fn shadow_check_callback(cx: *mut JSContext,
object: RawHandleObject,
@@ -61,7 +60,6 @@ pub unsafe extern "C" fn shadow_check_callback(cx: *mut JSContext,
/// Initialize the infrastructure for DOM proxy objects.
pub unsafe fn init() {
SetDOMProxyInformation(GetProxyHandlerFamily(),
- JSPROXYSLOT_EXPANDO,
Some(shadow_check_callback));
}
@@ -99,11 +97,6 @@ pub unsafe extern "C" fn define_property(cx: *mut JSContext,
desc: RawHandle<PropertyDescriptor>,
result: *mut ObjectOpResult)
-> bool {
- if (desc.get().attrs & JSPROP_GETTER) != 0 && desc.get().setter == Some(JS_StrictPropertyStub) {
- (*result).code_ = JSErrNum::JSMSG_GETTER_ONLY as ::libc::uintptr_t;
- return true;
- }
-
rooted!(in(cx) let mut expando = ptr::null_mut::<JSObject>());
ensure_expando_object(cx, proxy, expando.handle_mut());
JS_DefinePropertyById(cx, expando.handle().into(), id, desc, result)
@@ -165,7 +158,8 @@ pub unsafe extern "C" fn get_prototype_if_ordinary(_: *mut JSContext,
/// Get the expando object, or null if there is none.
pub unsafe fn get_expando_object(obj: RawHandleObject, mut expando: MutableHandleObject) {
assert!(is_dom_proxy(obj.get()));
- let val = GetProxyExtra(obj.get(), JSPROXYSLOT_EXPANDO);
+ let ref mut val = UndefinedValue();
+ GetProxyPrivate(obj.get(), val);
expando.set(if val.is_undefined() {
ptr::null_mut()
} else {
@@ -182,7 +176,7 @@ pub unsafe fn ensure_expando_object(cx: *mut JSContext, obj: RawHandleObject, mu
expando.set(JS_NewObjectWithGivenProto(cx, ptr::null_mut(), HandleObject::null()));
assert!(!expando.is_null());
- SetProxyExtra(obj.get(), JSPROXYSLOT_EXPANDO, &ObjectValue(expando.get()));
+ SetProxyPrivate(obj.get(), &ObjectValue(expando.get()));
}
}