"use strict";
const DIRPATH = getRootDirectory(gTestPath).replace(
"chrome://mochitests/content/",
""
);
const PATH = DIRPATH + "file_coop_coep.html";
const ORIGIN = "https://test1.example.com";
const URL = `${ORIGIN}/${PATH}`;
add_task(async function () {
await BrowserTestUtils.withNewTab(URL, async function (browser) {
BrowserTestUtils.loadURIString(browser, URL);
await BrowserTestUtils.browserLoaded(browser);
await SpecialPowers.spawn(browser, [ORIGIN], async origin => {
is(
content.window.origin,
origin,
`Opened a tab and navigated to ${origin}`
);
ok(
content.window.crossOriginIsolated,
`Should have been cross-origin-isolated env`
);
let hostIds = [];
function createShadowDOMAndTriggerSlotChange(host) {
var shadow = host.attachShadow({ mode: "closed" });
let promise = new Promise(resolve => {
shadow.addEventListener("slotchange", function () {
hostIds.push(host.id);
resolve();
});
});
shadow.innerHTML = "