diff options
Diffstat (limited to 'src/components/script/dom/window.rs')
-rw-r--r-- | src/components/script/dom/window.rs | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/components/script/dom/window.rs b/src/components/script/dom/window.rs index 64edfdf4baf..7303d5d81f0 100644 --- a/src/components/script/dom/window.rs +++ b/src/components/script/dom/window.rs @@ -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 } |