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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set sts=2 sw=2 et tw=80: */
"use strict";
function waitForReflow(aWindow) {
return new Promise(resolve => {
aWindow.requestAnimationFrame(() => {
aWindow.requestAnimationFrame(resolve);
});
});
}
add_task(async function fullscreen_size() {
let win = await BrowserTestUtils.openNewBrowserWindow({});
win.gBrowser.selectedBrowser.focus();
info("Enter browser fullscreen mode");
let promise = Promise.all([
BrowserTestUtils.waitForEvent(win, "fullscreen"),
BrowserTestUtils.waitForEvent(win, "resize"),
]);
win.fullScreen = true;
await promise;
info("Await reflow of the chrome window");
await waitForReflow(win);
is(win.innerHeight, win.outerHeight, "Check height");
is(win.innerWidth, win.outerWidth, "Check width");
await BrowserTestUtils.closeWindow(win);
});
// https://bugzilla.mozilla.org/show_bug.cgi?id=1830721
add_task(async function fullscreen_size_moz_appearance() {
const win = await BrowserTestUtils.openNewBrowserWindow({});
win.gBrowser.selectedBrowser.focus();
info("Add -moz-appearance style to chrome document");
const style = win.document.createElement("style");
style.innerHTML = `
#main-window {
-moz-appearance: -moz-win-borderless-glass;
}
`;
win.document.head.appendChild(style);
info("Await reflow of the chrome window");
await waitForReflow(win);
info("Enter browser fullscreen mode");
let promise = Promise.all([
BrowserTestUtils.waitForEvent(win, "fullscreen"),
BrowserTestUtils.waitForEvent(win, "resize"),
]);
win.fullScreen = true;
await promise;
info("Await reflow of the chrome window");
await waitForReflow(win);
is(win.innerHeight, win.outerHeight, "Check height");
is(win.innerWidth, win.outerWidth, `Check width`);
await BrowserTestUtils.closeWindow(win);
});
|