mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
impl window self
This commit is contained in:
parent
bdc7e984eb
commit
8db917849a
2 changed files with 19 additions and 1 deletions
|
@ -223,13 +223,18 @@ impl Window {
|
|||
|
||||
let global = WindowBinding::Wrap(cx, ptr::null(), win);
|
||||
unsafe {
|
||||
do "window".to_c_str().with_ref |name| {
|
||||
let fns = ["window","self"];
|
||||
for str in fns.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
|
||||
}
|
||||
|
|
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