mirror of
https://github.com/servo/servo.git
synced 2025-06-20 15:18:58 +01:00
auto merge of #1219 : ksh8281/servo/impl_window_self, r=jdm
in order to Implement window.self #868
This commit is contained in:
commit
426d18ffb1
2 changed files with 24 additions and 6 deletions
|
@ -223,13 +223,18 @@ impl Window {
|
||||||
|
|
||||||
let global = WindowBinding::Wrap(cx, ptr::null(), win);
|
let global = WindowBinding::Wrap(cx, ptr::null(), win);
|
||||||
unsafe {
|
unsafe {
|
||||||
do "window".to_c_str().with_ref |name| {
|
let fn_names = ["window","self"];
|
||||||
JS_DefineProperty(cx, global, name,
|
for str in fn_names.iter() {
|
||||||
RUST_OBJECT_TO_JSVAL(global),
|
do (*str).to_c_str().with_ref |name| {
|
||||||
Some(GetJSClassHookStubPointer(PROPERTY_STUB) as JSPropertyOp),
|
JS_DefineProperty(cx, global, name,
|
||||||
Some(GetJSClassHookStubPointer(STRICT_PROPERTY_STUB) as JSStrictPropertyOp),
|
RUST_OBJECT_TO_JSVAL(global),
|
||||||
JSPROP_ENUMERATE);
|
Some(GetJSClassHookStubPointer(PROPERTY_STUB) as JSPropertyOp),
|
||||||
|
Some(GetJSClassHookStubPointer(STRICT_PROPERTY_STUB) as JSStrictPropertyOp),
|
||||||
|
JSPROP_ENUMERATE);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
win
|
win
|
||||||
}
|
}
|
||||||
|
|
13
src/test/html/content/test_window.html
Normal file
13
src/test/html/content/test_window.html
Normal file
|
@ -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>
|
Loading…
Add table
Add a link
Reference in a new issue