commit 976bee971eaf1bdb1d8d70348ace06e3b739f002 parent 597f771625bec13fd8ebe137dbe5d7cd1676f88c Author: Koji Ishii <kojii@chromium.org> Date: Tue, 21 Oct 2025 10:31:48 +0000 Bug 1994916 [wpt PR 55502] - [iframe] Add tests for `requestResize()` throws, a=testonly Automatic update from web-platform-tests [iframe] Add tests for `requestResize()` throws This patch adds tests for `requestResize()`, which was added in <crrev.com/c/7040609>, throws the DOM `NotAllowedError` when the operation is not allowed. Bug: 418397278 Change-Id: I2b0d2390f39235928c345d6f5af2f7bf10be8f64 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7048160 Commit-Queue: Kent Tamura <tkent@chromium.org> Auto-Submit: Koji Ishii <kojii@chromium.org> Reviewed-by: Kent Tamura <tkent@chromium.org> Cr-Commit-Position: refs/heads/main@{#1531201} -- wpt-commits: c394f05dc1444912be496781191be8f05d19fb2a wpt-pr: 55502 Diffstat:
2 files changed, 33 insertions(+), 0 deletions(-)
diff --git a/testing/web-platform/tests/css/css-sizing/responsive-iframe/resources/iframe-contents-request-resize-error.html b/testing/web-platform/tests/css/css-sizing/responsive-iframe/resources/iframe-contents-request-resize-error.html @@ -0,0 +1,11 @@ +<!doctype html> +<script> +try { + window.requestResize(); +} catch (e) { + window.parent.postMessage({ + name: e.name, + message: e.message, + }, '*'); +} +</script> diff --git a/testing/web-platform/tests/css/css-sizing/responsive-iframe/responsive-iframe-request-resize-error.tentative.html b/testing/web-platform/tests/css/css-sizing/responsive-iframe/responsive-iframe-request-resize-error.tentative.html @@ -0,0 +1,22 @@ +<!doctype HTML> +<title>Test that calling `window.requestResize()` throws DOM NotAllowedError.</title> +<link rel="author" href="mailto:kojii@chromium.org"> +<link rel="help" href="https://drafts.csswg.org/css-sizing/"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<body> +<script> +test(t => { + assert_throws_dom('NotAllowedError', () => window.requestResize()); +}, "`window.requestResize()` from the parent frame throws DOM NotAllowedError"); + +async_test(t => { + window.addEventListener('message', t.step_func_done(e => { + assert_equals(e.data.name, 'NotAllowedError'); + }, {once: true})); + const iframe = document.createElement('iframe'); + iframe.src = 'resources/iframe-contents-request-resize-error.html'; + document.body.appendChild(iframe); +}, "`window.requestResize()` from iframe without `responsive-embedded-sizing` meta tag throws DOM NotAllowedError"); +</script> +</body>