summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/browsers/the-window-object/length-attribute.window.js
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/html/browsers/the-window-object/length-attribute.window.js')
-rw-r--r--testing/web-platform/tests/html/browsers/the-window-object/length-attribute.window.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/browsers/the-window-object/length-attribute.window.js b/testing/web-platform/tests/html/browsers/the-window-object/length-attribute.window.js
new file mode 100644
index 0000000000..d56e1e4692
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/the-window-object/length-attribute.window.js
@@ -0,0 +1,24 @@
+async_test(t => {
+ const frame = document.createElement("iframe");
+ frame.srcdoc = "<iframe name=x srcdoc='<iframe name=z></iframe>'></iframe><iframe name=y></iframe>";
+ frame.onload = t.step_func_done(() => {
+ const frameW = frame.contentWindow;
+ assert_equals(frameW.length, 2);
+ assert_not_equals(frameW.x, undefined);
+ assert_not_equals(frameW.y, undefined);
+ assert_equals(frameW.z, undefined);
+ assert_equals(frameW.x, frameW[0]);
+ assert_equals(frameW.y, frameW[1]);
+ const xFrameW = frameW.x;
+ assert_equals(xFrameW.length, 1);
+ assert_not_equals(xFrameW.z, undefined);
+ assert_equals(xFrameW.z, xFrameW[0]);
+ frame.remove();
+ assert_equals(frameW.length, 0);
+ assert_equals(frameW.x, undefined);
+ assert_equals(frameW[0], undefined);
+ assert_equals(xFrameW.length, 0);
+ assert_equals(xFrameW.z, undefined);
+ });
+ document.body.append(frame);
+}, "Window object's length IDL attribute (and named access)");