Backed out changeset a5ff95602119 (bug 1905021) as requested for causing accessibilit...
[gecko.git] / widget / tests / window_bug522217.xhtml
blob80eb4b6e5ad9e90351c35c19ffbdcffa4e921d46
1 <?xml version="1.0"?>
2 <?xml-stylesheet href="chrome://global/skin" type="text/css"?>
3 <window title="Mozilla Bug 522217"
4 onload="start();"
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">
10 </body>
12 <script class="testbody" type="application/javascript">
13 <![CDATA[
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);
33 });
36 function waitForEvent(obj, name) {
37 return new Promise(resolve => {
38 obj.addEventListener(name, resolve, { once: true });
39 });
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");
48 await executeSoon();
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;
57 await sizemodeChange;
58 sizemodeChange = waitForEvent(window, "sizemodechange");
59 window.fullScreen = false;
60 await sizemodeChange;
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");
67 await executeSoon();
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();
73 window.close();
77 ]]>
78 </script>
80 </window>