From d76ed882af1bbaf2879d3a8805de15a37a2e1525 Mon Sep 17 00:00:00 2001 From: Anne van Kesteren Date: Fri, 15 Feb 2019 14:50:57 +0100 Subject: [PATCH] HTML: window.length and named access For https://github.com/whatwg/html/pull/4368. --- .../length-attribute.window.js | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 html/browsers/the-window-object/length-attribute.window.js diff --git a/html/browsers/the-window-object/length-attribute.window.js b/html/browsers/the-window-object/length-attribute.window.js new file mode 100644 index 00000000000000..d56e1e46928043 --- /dev/null +++ b/html/browsers/the-window-object/length-attribute.window.js @@ -0,0 +1,24 @@ +async_test(t => { + const frame = document.createElement("iframe"); + frame.srcdoc = ""; + 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)");