1
0
Fork 0
firefox/testing/web-platform/tests/fetch/api/response/response-clone-iframe.window.js
Daniel Baumann 5e9a113729
Adding upstream version 140.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
2025-06-25 09:37:52 +02:00

32 lines
794 B
JavaScript

// Verify that calling Response clone() in a detached iframe doesn't crash.
// Regression test for https://crbug.com/1082688.
'use strict';
promise_test(async () => {
// Wait for the document body to be available.
await new Promise(resolve => {
onload = resolve;
});
window.iframe = document.createElement('iframe');
document.body.appendChild(iframe);
iframe.srcdoc = `<!doctype html>
<script>
const response = new Response('body');
window.parent.postMessage('okay', '*');
window.parent.iframe.remove();
response.clone();
</script>
`;
await new Promise(resolve => {
onmessage = evt => {
if (evt.data === 'okay') {
resolve();
}
};
});
// If it got here without crashing, the test passed.
}, 'clone within removed iframe should not crash');