Skip to content

Commit

Permalink
Use JS_GetOwnPropertyDescriptorById in BrowserContext (fixes #6984).
Browse files Browse the repository at this point in the history
  • Loading branch information
nerith authored and Ms2ger committed Feb 11, 2016
1 parent 0b27807 commit 6bb61af
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions components/script/dom/browsingcontext.rs
Expand Up @@ -19,9 +19,8 @@ use js::jsapi::{HandleId, HandleObject, MutableHandle, MutableHandleValue};
use js::jsapi::{JSAutoCompartment, JSAutoRequest, JS_GetClass};
use js::jsapi::{JSContext, JSErrNum, JSObject, JSPropertyDescriptor};
use js::jsapi::{JS_AlreadyHasOwnPropertyById, JS_ForwardGetPropertyTo};
use js::jsapi::{JS_DefinePropertyById6, JS_GetPropertyDescriptorById};
use js::jsapi::{JS_DefinePropertyById6, JS_GetOwnPropertyDescriptorById};
use js::jsval::{ObjectValue, UndefinedValue, PrivateValue};
use std::ptr;

#[dom_struct]
pub struct BrowsingContext {
Expand Down Expand Up @@ -140,16 +139,13 @@ unsafe extern "C" fn getOwnPropertyDescriptor(cx: *mut JSContext,
}

let target = RootedObject::new(cx, GetProxyPrivate(*proxy.ptr).to_object());
// XXX This should be JS_GetOwnPropertyDescriptorById
if !JS_GetPropertyDescriptorById(cx, target.handle(), id, desc) {
if !JS_GetOwnPropertyDescriptorById(cx, target.handle(), id, desc) {
return false;
}

if (*desc.ptr).obj != target.ptr {
// Not an own property
(*desc.ptr).obj = ptr::null_mut();
} else {
(*desc.ptr).obj = *proxy.ptr;
assert!(desc.get().obj.is_null() || desc.get().obj == target.ptr);
if desc.get().obj == target.ptr {
desc.get().obj = *proxy.ptr;
}

true
Expand Down

0 comments on commit 6bb61af

Please sign in to comment.