blob: edf926c4ca03b46fea591268efd99d43ff2fa939 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
"use strict";
add_task(async () => {
function httpURL(filename, host = "https://example.com/") {
let root = getRootDirectory(gTestPath).replace(
"chrome://mochitests/content/",
host
);
return root + filename;
}
const fissionWindow = await BrowserTestUtils.openNewBrowserWindow({
fission: true,
});
const url = httpURL(
"test_scroll_into_view_in_oopif.html",
"http://mochi.test:8888/"
);
const crossOriginIframeUrl = httpURL("scroll_into_view_in_child.html");
try {
await BrowserTestUtils.withNewTab(
{ gBrowser: fissionWindow.gBrowser, url },
async browser => {
await SpecialPowers.spawn(
browser,
[crossOriginIframeUrl],
async iframeUrl => {
const iframe = content.document.getElementById("iframe");
iframe.setAttribute("src", iframeUrl);
// Wait for a scroll event since scrollIntoView for cross origin documents is
// asyncronously processed.
const scroller = content.document.getElementById("scroller");
await new Promise(resolve => {
scroller.addEventListener("scroll", resolve, { once: true });
});
ok(
scroller.scrollTop > 0,
"scrollIntoView works in a cross origin iframe"
);
}
);
}
);
} finally {
await BrowserTestUtils.closeWindow(fissionWindow);
}
});
|