Skip to content

Commit 88d272c

Browse files
kojiishimertcanaltin
authored andcommitted
[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 <[email protected]> Auto-Submit: Koji Ishii <[email protected]> Reviewed-by: Kent Tamura <[email protected]> Cr-Commit-Position: refs/heads/main@{#1531201}
1 parent b5d263f commit 88d272c

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!doctype html>
2+
<script>
3+
try {
4+
window.requestResize();
5+
} catch (e) {
6+
window.parent.postMessage({
7+
name: e.name,
8+
message: e.message,
9+
}, '*');
10+
}
11+
</script>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<!doctype HTML>
2+
<title>Test that calling `window.requestResize()` throws DOM NotAllowedError.</title>
3+
<link rel="author" href="mailto:[email protected]">
4+
<link rel="help" href="https://drafts.csswg.org/css-sizing/">
5+
<script src="/resources/testharness.js"></script>
6+
<script src="/resources/testharnessreport.js"></script>
7+
<body>
8+
<script>
9+
test(t => {
10+
assert_throws_dom('NotAllowedError', () => window.requestResize());
11+
}, "`window.requestResize()` from the parent frame throws DOM NotAllowedError");
12+
13+
async_test(t => {
14+
window.addEventListener('message', t.step_func_done(e => {
15+
assert_equals(e.data.name, 'NotAllowedError');
16+
}, {once: true}));
17+
const iframe = document.createElement('iframe');
18+
iframe.src = 'resources/iframe-contents-request-resize-error.html';
19+
document.body.appendChild(iframe);
20+
}, "`window.requestResize()` from iframe without `responsive-embedded-sizing` meta tag throws DOM NotAllowedError");
21+
</script>
22+
</body>

0 commit comments

Comments
 (0)