auto merge of #1219 : ksh8281/servo/impl_window_self, r=jdm

in order to Implement window.self
#868
This commit is contained in:
bors-servo 2013-11-17 19:19:24 -08:00
commit 426d18ffb1
2 changed files with 24 additions and 6 deletions

View file

@ -223,13 +223,18 @@ impl Window {
let global = WindowBinding::Wrap(cx, ptr::null(), win);
unsafe {
do "window".to_c_str().with_ref |name| {
JS_DefineProperty(cx, global, name,
RUST_OBJECT_TO_JSVAL(global),
Some(GetJSClassHookStubPointer(PROPERTY_STUB) as JSPropertyOp),
Some(GetJSClassHookStubPointer(STRICT_PROPERTY_STUB) as JSStrictPropertyOp),
JSPROP_ENUMERATE);
let fn_names = ["window","self"];
for str in fn_names.iter() {
do (*str).to_c_str().with_ref |name| {
JS_DefineProperty(cx, global, name,
RUST_OBJECT_TO_JSVAL(global),
Some(GetJSClassHookStubPointer(PROPERTY_STUB) as JSPropertyOp),
Some(GetJSClassHookStubPointer(STRICT_PROPERTY_STUB) as JSStrictPropertyOp),
JSPROP_ENUMERATE);
}
}
}
win
}