Skip to content

Commit 221274b

Browse files
committed
first change to start support frames
1 parent 84d07f3 commit 221274b

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/browser/html/window.zig

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,18 @@ pub const Window = struct {
127127
return self;
128128
}
129129

130+
// frames return the window itself, but accessing it via a pseudo
131+
// array returns the Window object corresponding to the given frame or
132+
// iframe.
133+
// https://developer.mozilla.org/en-US/docs/Web/API/Window/frames
134+
pub fn get_frames(self: *Window) *Window {
135+
return self;
136+
}
130137
// TODO: frames
138+
pub fn get_length(_: *Window) u32 {
139+
return 0;
140+
}
141+
131142
pub fn get_top(self: *Window) *Window {
132143
return self;
133144
}
@@ -504,6 +515,14 @@ test "Browser.HTML.Window" {
504515
.{ "scrollend", "true" },
505516
}, .{});
506517

518+
try runner.testCases(&.{
519+
.{ "window == window.self", "true" },
520+
.{ "window == window.parent", "true" },
521+
.{ "window == window.top", "true" },
522+
.{ "window == window.frames", "true" },
523+
.{ "window.frames.length", "0" },
524+
}, .{});
525+
507526
try runner.testCases(&.{
508527
.{ "var qm = false; window.queueMicrotask(() => {qm = true });", null },
509528
.{ "qm", "true" },

0 commit comments

Comments
 (0)