mirror of
https://github.com/HeyPuter/firefox.git
synced 2026-11-13 20:14:57 -10:00
Automatic update from web-platform-tests Fetch: add test for realm of result of Response's arrayBuffer() For https://github.com/whatwg/fetch/pull/1751. -- wpt-commits: ef64e9e98aff5f530368ee2213b01b5fe2acc2ec wpt-pr: 46104
24 lines
760 B
JavaScript
24 lines
760 B
JavaScript
// 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()');
|