Skip to content

Commit 231f758

Browse files
bakkotmoz-wptsync-bot
authored andcommitted
Bug 1895310 [wpt PR 46104] - add test for realm of result of Response 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
1 parent bb4fc74 commit 231f758

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// META: title=realm of Response arrayBuffer()
2+
3+
'use strict';
4+
5+
promise_test(async () => {
6+
await new Promise(resolve => {
7+
onload = resolve;
8+
});
9+
10+
let iframe = document.createElement('iframe');
11+
document.body.appendChild(iframe);
12+
iframe.srcdoc = '<!doctype html>';
13+
await new Promise(resolve => {
14+
iframe.onload = resolve;
15+
});
16+
17+
let otherRealm = iframe.contentWindow;
18+
19+
let ab = await window.Response.prototype.arrayBuffer.call(new otherRealm.Response(''));
20+
21+
assert_true(ab instanceof otherRealm.ArrayBuffer, "ArrayBuffer should be created in receiver's realm");
22+
assert_false(ab instanceof ArrayBuffer, "ArrayBuffer should not be created in the arrayBuffer() methods's realm");
23+
}, 'realm of the ArrayBuffer from Response arrayBuffer()');

0 commit comments

Comments
 (0)