diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/components/script/dom/window.rs | 17 | ||||
-rw-r--r-- | src/test/html/content/test_window.html | 13 |
2 files changed, 24 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 } diff --git a/src/test/html/content/test_window.html b/src/test/html/content/test_window.html new file mode 100644 index 00000000000..f532929a124 --- /dev/null +++ b/src/test/html/content/test_window.html @@ -0,0 +1,13 @@ +<html> +<head> + <title></title> + <script src="harness.js"></script> +</head> +<body> +<script> +is(window, window.self); +is_a(window.self, Window); +finish(); +</script> +</body> +</html> |