mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 02:57:36 +00:00
LibWeb: Expose window.self and window.frames
"self" is a way to refer to the global object that will work in both a window context and a web worker context. "frames" apparently used to return a list of frame objects according to MDN, but it now just returns the window object.
This commit is contained in:
parent
1c8312fa50
commit
8aabec1c94
2 changed files with 10 additions and 0 deletions
|
@ -59,6 +59,8 @@ void WindowObject::initialize()
|
||||||
GlobalObject::initialize();
|
GlobalObject::initialize();
|
||||||
|
|
||||||
define_property("window", this, JS::Attribute::Enumerable);
|
define_property("window", this, JS::Attribute::Enumerable);
|
||||||
|
define_property("frames", this, JS::Attribute::Enumerable);
|
||||||
|
define_property("self", this, JS::Attribute::Enumerable);
|
||||||
define_native_property("document", document_getter, document_setter, JS::Attribute::Enumerable);
|
define_native_property("document", document_getter, document_setter, JS::Attribute::Enumerable);
|
||||||
define_native_function("alert", alert);
|
define_native_function("alert", alert);
|
||||||
define_native_function("confirm", confirm);
|
define_native_function("confirm", confirm);
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
loadPage("file:///res/html/misc/blank.html");
|
||||||
|
|
||||||
|
afterInitialPageLoad(() => {
|
||||||
|
test("window.{window,frames,self} all return the Window object", () => {
|
||||||
|
expect(window.window).toBe(window.frames);
|
||||||
|
expect(window.window).toBe(window.self);
|
||||||
|
});
|
||||||
|
});
|
Loading…
Add table
Add a link
Reference in a new issue