summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/fenced-frame/resources/utils.js
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/fenced-frame/resources/utils.js')
-rw-r--r--testing/web-platform/tests/fenced-frame/resources/utils.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/testing/web-platform/tests/fenced-frame/resources/utils.js b/testing/web-platform/tests/fenced-frame/resources/utils.js
index cbea173f17..d6cca91437 100644
--- a/testing/web-platform/tests/fenced-frame/resources/utils.js
+++ b/testing/web-platform/tests/fenced-frame/resources/utils.js
@@ -250,6 +250,11 @@ function buildRemoteContextForObject(object, uuid, html) {
}
};
+ // If `object` is null (e.g. a window created with noopener), set it to a
+ // dummy value so that the Proxy constructor won't fail.
+ if (object == null) {
+ object = {};
+ }
const proxy = new Proxy(object, handler);
return proxy;
}
@@ -646,3 +651,19 @@ function setupCSP(csp, second_csp=null) {
document.head.appendChild(second_meta);
}
}
+
+// Clicking in WPT tends to be flaky (https://crbug.com/1066891), so you may
+// need to click multiple times to have an effect. This function clicks at
+// coordinates `{x, y}` relative to `click_origin`, by default 3 times. Should
+// not be used for tests where multiple clicks have distinct impact on the state
+// of the page, but rather to bruteforce through flakes that rely on only one
+// click.
+async function multiClick(x, y, click_origin, times = 3) {
+ for (let i = 0; i < times; i++) {
+ let actions = new test_driver.Actions();
+ await actions.pointerMove(x, y, {origin: click_origin})
+ .pointerDown()
+ .pointerUp()
+ .send();
+ }
+}