Skip to content

Commit

Permalink
Bug 1895310 [wpt PR 46104] - add test for realm of result of Response…
Browse files Browse the repository at this point in the history
… arrayBuffer(), a=testonly

Automatic update from web-platform-tests
Fetch: add test for realm of result of Response's arrayBuffer()

For whatwg/fetch#1751.
--

wpt-commits: ef64e9e98aff5f530368ee2213b01b5fe2acc2ec
wpt-pr: 46104
  • Loading branch information
bakkot authored and moz-wptsync-bot committed May 14, 2024
1 parent bb4fc74 commit 231f758
Showing 1 changed file with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// META: title=realm of Response arrayBuffer()

'use strict';

promise_test(async () => {
await new Promise(resolve => {
onload = resolve;
});

let iframe = document.createElement('iframe');
document.body.appendChild(iframe);
iframe.srcdoc = '<!doctype html>';
await new Promise(resolve => {
iframe.onload = resolve;
});

let otherRealm = iframe.contentWindow;

let ab = await window.Response.prototype.arrayBuffer.call(new otherRealm.Response(''));

assert_true(ab instanceof otherRealm.ArrayBuffer, "ArrayBuffer should be created in receiver's realm");
assert_false(ab instanceof ArrayBuffer, "ArrayBuffer should not be created in the arrayBuffer() methods's realm");
}, 'realm of the ArrayBuffer from Response arrayBuffer()');

0 comments on commit 231f758

Please sign in to comment.