From 26a029d407be480d791972afb5975cf62c9360a6 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 02:47:55 +0200 Subject: Adding upstream version 124.0.1. Signed-off-by: Daniel Baumann --- .../cross-origin-objects-function-common.js | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 testing/web-platform/tests/html/browsers/origin/cross-origin-objects/cross-origin-objects-function-common.js (limited to 'testing/web-platform/tests/html/browsers/origin/cross-origin-objects/cross-origin-objects-function-common.js') diff --git a/testing/web-platform/tests/html/browsers/origin/cross-origin-objects/cross-origin-objects-function-common.js b/testing/web-platform/tests/html/browsers/origin/cross-origin-objects/cross-origin-objects-function-common.js new file mode 100644 index 0000000000..3b93b498a2 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/origin/cross-origin-objects/cross-origin-objects-function-common.js @@ -0,0 +1,34 @@ +"use strict"; + +const crossOriginWindowMethods = [ + {key: "close", length: 0}, + {key: "focus", length: 0}, + {key: "blur", length: 0}, + {key: "postMessage", length: 1}, +]; + +const crossOriginWindowAccessors = [ + "window", + "self", + "location", + "closed", + "frames", + "length", + "top", + "opener", + "parent", +].map(key => ({key})); + +const makeCrossOriginWindow = t => { + const iframe = document.createElement("iframe"); + const path = location.pathname.slice(0, location.pathname.lastIndexOf("/")) + "/frame.html"; + iframe.src = get_host_info().HTTP_REMOTE_ORIGIN + path; + + return new Promise((resolve, reject) => { + iframe.onload = () => { resolve(iframe.contentWindow); }; + iframe.onerror = reject; + + document.body.append(iframe); + t.add_cleanup(() => { iframe.remove(); }); + }); +}; -- cgit v1.2.3