2 <?xml-stylesheet href=
"chrome://global/skin" type=
"text/css"?>
3 <window title=
"Mozilla Bug 522217"
5 xmlns=
"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
7 <script src=
"chrome://mochikit/content/tests/SimpleTest/EventUtils.js" />
9 <body xmlns=
"http://www.w3.org/1999/xhtml" id=
"body">
12 <script class=
"testbody" type=
"application/javascript">
15 function ok(aCondition, aMessage)
17 window.arguments[
0].SimpleTest.ok(aCondition, aMessage);
20 function is(aLeft, aRight, aMessage)
22 window.arguments[
0].SimpleTest.is(aLeft, aRight, aMessage);
25 function isnot(aLeft, aRight, aMessage)
27 window.arguments[
0].SimpleTest.isnot(aLeft, aRight, aMessage);
30 function executeSoon() {
31 return new Promise(resolve =
> {
32 window.arguments[
0].SimpleTest.executeSoon(resolve);
36 function waitForEvent(obj, name) {
37 return new Promise(resolve =
> {
38 obj.addEventListener(name, resolve, { once: true });
42 async function start() {
43 await waitForEvent(window,
"focus");
44 var oldOuterWidth = window.outerWidth, oldOuterHeight = window.outerHeight;
45 var oldInnerWidth = window.innerWidth, oldInnerHeight = window.innerHeight;
46 document.documentElement.setAttribute(
"chromemargin",
"0,0,0,0");
49 is(window.outerWidth, oldOuterWidth,
"chromemargin shouldn't change the window's outerWidth");
50 is(window.outerHeight, oldOuterHeight,
"chromemargin shouldn't change the window's outerHeight");
51 is(window.innerWidth, oldOuterWidth,
"if chromemargin is set, innerWidth and outerWidth should be the same");
52 is(window.innerHeight, oldOuterHeight,
"if chromemargin is set, innerHeight and outerHeight should be the same");
54 // Wait for going full screen and back.
55 let sizemodeChange = waitForEvent(window,
"sizemodechange");
56 window.fullScreen = true;
58 sizemodeChange = waitForEvent(window,
"sizemodechange");
59 window.fullScreen = false;
61 is(window.outerWidth, oldOuterWidth,
"wrong outerWidth after fullscreen mode");
62 is(window.outerHeight, oldOuterHeight,
"wrong outerHeight after fullscreen mode");
63 is(window.innerWidth, oldOuterWidth,
"wrong innerWidth after fullscreen mode");
64 is(window.innerHeight, oldOuterHeight,
"wrong innerHeight after fullscreen mode");
65 document.documentElement.removeAttribute(
"chromemargin");
68 is(window.outerWidth, oldOuterWidth,
"wrong outerWidth after removing chromemargin");
69 is(window.outerHeight, oldOuterHeight,
"wrong outerHeight after removing chromemargin");
70 is(window.innerWidth, oldInnerWidth,
"wrong innerWidth after removing chromemargin");
71 is(window.innerHeight, oldInnerHeight,
"wrong innerHeight after removing chromemargin");
72 window.arguments[
0].SimpleTest.finish();