summaryrefslogtreecommitdiffstats
path: root/layout/xul/test
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /layout/xul/test
parentInitial commit. (diff)
downloadfirefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz
firefox-26a029d407be480d791972afb5975cf62c9360a6.zip
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'layout/xul/test')
-rw-r--r--layout/xul/test/browser.toml17
-rw-r--r--layout/xul/test/browser_bug1163304.js83
-rw-r--r--layout/xul/test/browser_bug1754298.js35
-rw-r--r--layout/xul/test/browser_bug685470.js38
-rw-r--r--layout/xul/test/browser_bug703210.js56
-rw-r--r--layout/xul/test/browser_bug706743.js158
-rw-r--r--layout/xul/test/chrome.toml56
-rw-r--r--layout/xul/test/file_bug386386.sjs14
-rw-r--r--layout/xul/test/mochitest.toml25
-rw-r--r--layout/xul/test/test_bug1197913.xhtml63
-rw-r--r--layout/xul/test/test_bug159346.xhtml143
-rw-r--r--layout/xul/test/test_bug381167.xhtml52
-rw-r--r--layout/xul/test/test_bug386386.html34
-rw-r--r--layout/xul/test/test_bug394800.xhtml39
-rw-r--r--layout/xul/test/test_bug398982-1.xhtml31
-rw-r--r--layout/xul/test/test_bug398982-2.xhtml33
-rw-r--r--layout/xul/test/test_bug467442.xhtml53
-rw-r--r--layout/xul/test/test_bug477754.xhtml51
-rw-r--r--layout/xul/test/test_bug511075.html121
-rw-r--r--layout/xul/test/test_bug563416.html53
-rw-r--r--layout/xul/test/test_bug703150.xhtml74
-rw-r--r--layout/xul/test/test_bug987230.xhtml109
-rw-r--r--layout/xul/test/test_drag_thumb_in_link.html76
-rw-r--r--layout/xul/test/test_menuitem_ctrl_click.xhtml80
-rw-r--r--layout/xul/test/test_popupReflowPos.xhtml77
-rw-r--r--layout/xul/test/test_popupSizeTo.xhtml55
-rw-r--r--layout/xul/test/test_popupZoom.xhtml53
-rw-r--r--layout/xul/test/test_resizer_ctrl_click.xhtml47
-rw-r--r--layout/xul/test/test_resizer_incontent.xhtml42
-rw-r--r--layout/xul/test/test_splitter.xhtml117
-rw-r--r--layout/xul/test/test_splitter_sibling.xhtml88
-rw-r--r--layout/xul/test/test_submenuClose.xhtml91
-rw-r--r--layout/xul/test/test_toolbarbutton_ctrl_click.xhtml47
-rw-r--r--layout/xul/test/test_windowminmaxsize.xhtml193
-rw-r--r--layout/xul/test/titledpanelwindow.xhtml5
-rw-r--r--layout/xul/test/windowminmaxsize1.xhtml4
-rw-r--r--layout/xul/test/windowminmaxsize10.xhtml4
-rw-r--r--layout/xul/test/windowminmaxsize2.xhtml4
-rw-r--r--layout/xul/test/windowminmaxsize3.xhtml4
-rw-r--r--layout/xul/test/windowminmaxsize4.xhtml4
-rw-r--r--layout/xul/test/windowminmaxsize5.xhtml4
-rw-r--r--layout/xul/test/windowminmaxsize6.xhtml4
-rw-r--r--layout/xul/test/windowminmaxsize7.xhtml4
-rw-r--r--layout/xul/test/windowminmaxsize8.xhtml4
-rw-r--r--layout/xul/test/windowminmaxsize9.xhtml4
45 files changed, 2349 insertions, 0 deletions
diff --git a/layout/xul/test/browser.toml b/layout/xul/test/browser.toml
new file mode 100644
index 0000000000..46c0103b58
--- /dev/null
+++ b/layout/xul/test/browser.toml
@@ -0,0 +1,17 @@
+[DEFAULT]
+
+["browser_bug685470.js"]
+
+["browser_bug703210.js"]
+skip-if = ["true"] # Bugs 1382428, 1567736, 1565339
+
+["browser_bug706743.js"]
+skip-if = ["true"] # Bug 1157576
+
+["browser_bug1163304.js"]
+run-if = [
+ "os == 'linux'",
+ "os == 'win'",
+] # Due to testing menubar behavior with keyboard
+
+["browser_bug1754298.js"]
diff --git a/layout/xul/test/browser_bug1163304.js b/layout/xul/test/browser_bug1163304.js
new file mode 100644
index 0000000000..cebc857c9a
--- /dev/null
+++ b/layout/xul/test/browser_bug1163304.js
@@ -0,0 +1,83 @@
+const { CustomizableUITestUtils } = ChromeUtils.importESModule(
+ "resource://testing-common/CustomizableUITestUtils.sys.mjs"
+);
+let gCUITestUtils = new CustomizableUITestUtils(window);
+
+add_task(async function test_setup() {
+ await gCUITestUtils.addSearchBar();
+ registerCleanupFunction(() => {
+ gCUITestUtils.removeSearchBar();
+ });
+});
+
+add_task(async function () {
+ const promiseFocusInSearchBar = BrowserTestUtils.waitForEvent(
+ BrowserSearch.searchBar.textbox,
+ "focus"
+ );
+ BrowserSearch.searchBar.focus();
+ await promiseFocusInSearchBar;
+
+ let DOMWindowUtils = EventUtils._getDOMWindowUtils();
+ is(
+ DOMWindowUtils.IMEStatus,
+ DOMWindowUtils.IME_STATUS_ENABLED,
+ "IME should be available when searchbar has focus"
+ );
+
+ let searchPopup = document.getElementById("PopupSearchAutoComplete");
+
+ // Open popup of the searchbar
+ // Oddly, F4 key press is sometimes not handled by the search bar.
+ // It's out of scope of this test, so, let's retry to open it if failed.
+ await (async () => {
+ async function tryToOpen() {
+ try {
+ BrowserSearch.searchBar.focus();
+ EventUtils.synthesizeKey("KEY_F4");
+ await TestUtils.waitForCondition(
+ () => searchPopup.state == "open",
+ "The popup isn't opened",
+ 5,
+ 100
+ );
+ } catch (e) {
+ // timed out, let's just return false without asserting the failure.
+ return false;
+ }
+ return true;
+ }
+ for (let i = 0; i < 5; i++) {
+ if (await tryToOpen()) {
+ return;
+ }
+ }
+ ok(false, "Failed to open the popup of searchbar");
+ })();
+
+ is(
+ DOMWindowUtils.IMEStatus,
+ DOMWindowUtils.IME_STATUS_ENABLED,
+ "IME should be available even when the popup of searchbar is open"
+ );
+
+ // Activate the menubar, then, the popup should be closed
+ is(searchPopup.state, "open", "The popup of searchbar shouldn't be closed");
+ let hiddenPromise = BrowserTestUtils.waitForEvent(searchPopup, "popuphidden");
+ EventUtils.synthesizeKey("KEY_Alt");
+ await hiddenPromise;
+ await new Promise(r => setTimeout(r, 0));
+
+ is(
+ DOMWindowUtils.IMEStatus,
+ DOMWindowUtils.IME_STATUS_DISABLED,
+ "IME should not be available when menubar is active"
+ );
+ // Inactivate the menubar (and restore the focus to the searchbar
+ EventUtils.synthesizeKey("KEY_Escape");
+ is(
+ DOMWindowUtils.IMEStatus,
+ DOMWindowUtils.IME_STATUS_ENABLED,
+ "IME should be available after focus is back to the searchbar"
+ );
+});
diff --git a/layout/xul/test/browser_bug1754298.js b/layout/xul/test/browser_bug1754298.js
new file mode 100644
index 0000000000..05701e4f08
--- /dev/null
+++ b/layout/xul/test/browser_bug1754298.js
@@ -0,0 +1,35 @@
+add_task(async function () {
+ const PAGE = `
+<!doctype html>
+<select>
+<option value="1">AA Option</option>
+<option value="2">BB Option</option>
+<option value="3">&nbsp;CC Option</option>
+<option value="4">&nbsp;&nbsp;DD Option</option>
+<option value="5">&nbsp;&nbsp;&nbsp;EE Option</option>
+</select>`;
+ const url = "data:text/html," + encodeURI(PAGE);
+ await BrowserTestUtils.withNewTab(
+ {
+ gBrowser,
+ url,
+ },
+ async function (browser) {
+ let popupShownPromise = BrowserTestUtils.waitForSelectPopupShown(window);
+ await BrowserTestUtils.synthesizeMouseAtCenter("select", {}, browser);
+ let popup = await popupShownPromise;
+ EventUtils.sendString("C", window);
+ EventUtils.sendKey("RETURN", window);
+ ok(
+ await TestUtils.waitForCondition(() => {
+ return SpecialPowers.spawn(
+ browser,
+ [],
+ () => content.document.querySelector("select").value
+ ).then(value => value == 3);
+ }),
+ "Unexpected value for select element (expected 3)!"
+ );
+ }
+ );
+});
diff --git a/layout/xul/test/browser_bug685470.js b/layout/xul/test/browser_bug685470.js
new file mode 100644
index 0000000000..46997b2e3b
--- /dev/null
+++ b/layout/xul/test/browser_bug685470.js
@@ -0,0 +1,38 @@
+add_task(async function () {
+ const html =
+ '<p id="p1" title="tooltip is here">This paragraph has a tooltip.</p>';
+ await BrowserTestUtils.openNewForegroundTab(
+ gBrowser,
+ "data:text/html," + html
+ );
+
+ await new Promise(resolve => {
+ SpecialPowers.pushPrefEnv({ set: [["ui.tooltipDelay", 0]] }, resolve);
+ });
+
+ await BrowserTestUtils.synthesizeMouseAtCenter(
+ "#p1",
+ { type: "mousemove" },
+ gBrowser.selectedBrowser
+ );
+ await BrowserTestUtils.synthesizeMouseAtCenter(
+ "#p1",
+ {},
+ gBrowser.selectedBrowser
+ );
+
+ // Wait until the tooltip timeout triggers that would normally have opened the popup.
+ await new Promise(resolve => setTimeout(resolve, 0));
+ is(
+ document.getElementById("aHTMLTooltip").state,
+ "closed",
+ "local tooltip is closed"
+ );
+ is(
+ document.getElementById("remoteBrowserTooltip").state,
+ "closed",
+ "remote tooltip is closed"
+ );
+
+ gBrowser.removeCurrentTab();
+});
diff --git a/layout/xul/test/browser_bug703210.js b/layout/xul/test/browser_bug703210.js
new file mode 100644
index 0000000000..5026875310
--- /dev/null
+++ b/layout/xul/test/browser_bug703210.js
@@ -0,0 +1,56 @@
+add_task(async function () {
+ const url =
+ "data:text/html," +
+ "<html onmousemove='event.stopPropagation()'" +
+ " onmouseenter='event.stopPropagation()' onmouseleave='event.stopPropagation()'" +
+ " onmouseover='event.stopPropagation()' onmouseout='event.stopPropagation()'>" +
+ '<p id="p1" title="tooltip is here">This paragraph has a tooltip.</p>' +
+ '<p id="p2">This paragraph doesn\'t have tooltip.</p></html>';
+
+ let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, url);
+ let browser = gBrowser.selectedBrowser;
+
+ await new Promise(resolve => {
+ SpecialPowers.pushPrefEnv({ set: [["ui.tooltipDelay", 0]] }, resolve);
+ });
+
+ let popupShownPromise = BrowserTestUtils.waitForEvent(
+ document,
+ "popupshown",
+ false,
+ event => {
+ is(event.originalTarget.localName, "tooltip", "tooltip is showing");
+ return true;
+ }
+ );
+ let popupHiddenPromise = BrowserTestUtils.waitForEvent(
+ document,
+ "popuphidden",
+ false,
+ event => {
+ is(event.originalTarget.localName, "tooltip", "tooltip is hidden");
+ return true;
+ }
+ );
+
+ // Send a mousemove at a known position to start the test.
+ await BrowserTestUtils.synthesizeMouseAtCenter(
+ "#p2",
+ { type: "mousemove" },
+ browser
+ );
+ await BrowserTestUtils.synthesizeMouseAtCenter(
+ "#p1",
+ { type: "mousemove" },
+ browser
+ );
+ await popupShownPromise;
+ await BrowserTestUtils.synthesizeMouseAtCenter(
+ "#p2",
+ { type: "mousemove" },
+ browser
+ );
+ await popupHiddenPromise;
+
+ gBrowser.removeCurrentTab();
+});
diff --git a/layout/xul/test/browser_bug706743.js b/layout/xul/test/browser_bug706743.js
new file mode 100644
index 0000000000..c28721e831
--- /dev/null
+++ b/layout/xul/test/browser_bug706743.js
@@ -0,0 +1,158 @@
+add_task(async function () {
+ const url =
+ "data:text/html,<html><head></head><body>" +
+ '<a id="target" href="about:blank" title="This is tooltip text" ' +
+ 'style="display:block;height:20px;margin:10px;" ' +
+ 'onclick="return false;">here is an anchor element</a></body></html>';
+
+ let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, url);
+ let browser = gBrowser.selectedBrowser;
+
+ await new Promise(resolve => {
+ SpecialPowers.pushPrefEnv({ set: [["ui.tooltipDelay", 0]] }, resolve);
+ });
+
+ // Send a mousemove at a known position to start the test.
+ await BrowserTestUtils.synthesizeMouse(
+ "#target",
+ -5,
+ -5,
+ { type: "mousemove" },
+ browser
+ );
+
+ // show tooltip by mousemove into target.
+ let popupShownPromise = BrowserTestUtils.waitForEvent(document, "popupshown");
+ await BrowserTestUtils.synthesizeMouse(
+ "#target",
+ 5,
+ 15,
+ { type: "mousemove" },
+ browser
+ );
+ await popupShownPromise;
+
+ // hide tooltip by mousemove to outside.
+ let popupHiddenPromise = BrowserTestUtils.waitForEvent(
+ document,
+ "popuphidden"
+ );
+ await BrowserTestUtils.synthesizeMouse(
+ "#target",
+ -5,
+ 15,
+ { type: "mousemove" },
+ browser
+ );
+ await popupHiddenPromise;
+
+ // mousemove into the target and start drag by emulation via nsIDragService.
+ // Note that on some platforms, we cannot actually start the drag by
+ // synthesized events. E.g., Windows waits an actual mousemove event after
+ // dragstart.
+
+ // Emulate a buggy mousemove event. widget might dispatch mousemove event
+ // during drag.
+
+ function tooltipNotExpected() {
+ ok(false, "tooltip is shown during drag");
+ }
+ addEventListener("popupshown", tooltipNotExpected, true);
+
+ let dragService = Cc["@mozilla.org/widget/dragservice;1"].getService(
+ Ci.nsIDragService
+ );
+ dragService.startDragSessionForTests(
+ Ci.nsIDragService.DRAGDROP_ACTION_MOVE |
+ Ci.nsIDragService.DRAGDROP_ACTION_COPY |
+ Ci.nsIDragService.DRAGDROP_ACTION_LINK
+ );
+ try {
+ await BrowserTestUtils.synthesizeMouse(
+ "#target",
+ 5,
+ 15,
+ { type: "mousemove" },
+ browser
+ );
+
+ // eslint-disable-next-line mozilla/no-arbitrary-setTimeout
+ await new Promise(resolve => setTimeout(resolve, 100));
+ } finally {
+ removeEventListener("popupshown", tooltipNotExpected, true);
+ dragService.endDragSession(true);
+ }
+
+ await BrowserTestUtils.synthesizeMouse(
+ "#target",
+ -5,
+ -5,
+ { type: "mousemove" },
+ browser
+ );
+
+ // If tooltip listener used a flag for managing D&D state, we would need
+ // to test if the tooltip is shown after drag.
+
+ // show tooltip by mousemove into target.
+ popupShownPromise = BrowserTestUtils.waitForEvent(document, "popupshown");
+ await BrowserTestUtils.synthesizeMouse(
+ "#target",
+ 5,
+ 15,
+ { type: "mousemove" },
+ browser
+ );
+ await popupShownPromise;
+
+ // hide tooltip by mousemove to outside.
+ popupHiddenPromise = BrowserTestUtils.waitForEvent(document, "popuphidden");
+ await BrowserTestUtils.synthesizeMouse(
+ "#target",
+ -5,
+ 15,
+ { type: "mousemove" },
+ browser
+ );
+ await popupHiddenPromise;
+
+ // Show tooltip after mousedown
+ popupShownPromise = BrowserTestUtils.waitForEvent(document, "popupshown");
+ await BrowserTestUtils.synthesizeMouse(
+ "#target",
+ 5,
+ 15,
+ { type: "mousemove" },
+ browser
+ );
+ await popupShownPromise;
+
+ popupHiddenPromise = BrowserTestUtils.waitForEvent(document, "popuphidden");
+ await BrowserTestUtils.synthesizeMouse(
+ "#target",
+ 5,
+ 15,
+ { type: "mousedown" },
+ browser
+ );
+ await popupHiddenPromise;
+
+ await BrowserTestUtils.synthesizeMouse(
+ "#target",
+ 5,
+ 15,
+ { type: "mouseup" },
+ browser
+ );
+ await BrowserTestUtils.synthesizeMouse(
+ "#target",
+ -5,
+ 15,
+ { type: "mousemove" },
+ browser
+ );
+
+ ok(true, "tooltips appear properly");
+
+ gBrowser.removeCurrentTab();
+});
diff --git a/layout/xul/test/chrome.toml b/layout/xul/test/chrome.toml
new file mode 100644
index 0000000000..6588db2ea4
--- /dev/null
+++ b/layout/xul/test/chrome.toml
@@ -0,0 +1,56 @@
+[DEFAULT]
+skip-if = ["os == 'android'"]
+support-files = [
+ "windowminmaxsize1.xhtml",
+ "windowminmaxsize2.xhtml",
+ "windowminmaxsize3.xhtml",
+ "windowminmaxsize4.xhtml",
+ "windowminmaxsize5.xhtml",
+ "windowminmaxsize6.xhtml",
+ "windowminmaxsize7.xhtml",
+ "windowminmaxsize8.xhtml",
+ "windowminmaxsize9.xhtml",
+ "windowminmaxsize10.xhtml",
+ "titledpanelwindow.xhtml",
+]
+
+["test_bug159346.xhtml"]
+
+["test_bug381167.xhtml"]
+
+["test_bug398982-1.xhtml"]
+
+["test_bug398982-2.xhtml"]
+
+["test_bug467442.xhtml"]
+
+["test_bug477754.xhtml"]
+
+["test_bug703150.xhtml"]
+
+["test_bug987230.xhtml"]
+skip-if = ["os == 'linux'"] # No native mousedown event on Linux
+
+["test_bug1197913.xhtml"]
+
+["test_menuitem_ctrl_click.xhtml"]
+
+["test_popupReflowPos.xhtml"]
+
+["test_popupSizeTo.xhtml"]
+
+["test_popupZoom.xhtml"]
+
+["test_resizer_ctrl_click.xhtml"]
+
+["test_resizer_incontent.xhtml"]
+
+["test_splitter.xhtml"]
+
+["test_splitter_sibling.xhtml"]
+
+["test_submenuClose.xhtml"]
+
+["test_toolbarbutton_ctrl_click.xhtml"]
+
+["test_windowminmaxsize.xhtml"]
diff --git a/layout/xul/test/file_bug386386.sjs b/layout/xul/test/file_bug386386.sjs
new file mode 100644
index 0000000000..4cd23a7909
--- /dev/null
+++ b/layout/xul/test/file_bug386386.sjs
@@ -0,0 +1,14 @@
+// SJS file for test_bug386386.html
+"use strict";
+
+function handleRequest(request, response) {
+ response.setHeader("Cache-Control", "no-cache", false);
+ response.setHeader(
+ "Content-Type",
+ "application/xhtml+xml;charset=utf-8",
+ false
+ );
+ response.write(
+ "%3C%3Fxml%20version%3D%221.0%22%3F%3E%0A%3Cwindow%3E%3C/window%3E"
+ );
+}
diff --git a/layout/xul/test/mochitest.toml b/layout/xul/test/mochitest.toml
new file mode 100644
index 0000000000..bb22c84315
--- /dev/null
+++ b/layout/xul/test/mochitest.toml
@@ -0,0 +1,25 @@
+[DEFAULT]
+support-files = ["file_bug386386.sjs"]
+
+["test_bug386386.html"]
+allow_xul_xbl = true
+skip-if = [
+ "http3",
+ "http2",
+]
+
+["test_bug394800.xhtml"]
+allow_xul_xbl = true
+skip-if = [
+ "http3",
+ "http2",
+]
+
+["test_bug511075.html"]
+skip-if = ["os == 'android'"] #bug 798806
+
+["test_bug563416.html"]
+skip-if = ["os == 'android'"]
+
+["test_drag_thumb_in_link.html"]
+skip-if = ["os == 'android'"]
diff --git a/layout/xul/test/test_bug1197913.xhtml b/layout/xul/test/test_bug1197913.xhtml
new file mode 100644
index 0000000000..539f02128f
--- /dev/null
+++ b/layout/xul/test/test_bug1197913.xhtml
@@ -0,0 +1,63 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/css" href="chrome://global/skin"?>
+<?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1197913
+-->
+<window title="Mozilla Bug 1197913"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ onload="SimpleTest.waitForFocus(nextTest, window)">
+ <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
+ <script src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
+
+
+ <!-- test results are displayed in the html:body -->
+ <body xmlns="http://www.w3.org/1999/xhtml">
+ <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1197913"
+ target="_blank">Mozilla Bug 1197913</a>
+ </body>
+
+ <hbox align="center" pack="center">
+ <menulist>
+ <menupopup>
+ <menuitem label="Car" />
+ <menuitem label="Taxi" id="target" />
+ <menuitem label="Bus" />
+ </menupopup>
+ </menulist>
+ </hbox>
+ <!-- test code goes here -->
+ <script type="application/javascript">
+ <![CDATA[
+ SimpleTest.waitForExplicitFinish();
+
+ let menulist = document.getElementsByTagName("menulist")[0];
+ let menuitem = document.getElementById("target");
+
+ function onDOMMenuItemActive(e) {
+ menuitem.removeEventListener("DOMMenuItemActive", onDOMMenuItemActive);
+
+ synthesizeMouse(menuitem, 5, 0, { type: "mousemove" });
+ synthesizeMouse(menuitem, -1, 0, { type: "mousemove" });
+
+ setTimeout(() => {
+ ok(menuitem.getAttribute("_moz-menuactive"), "Should be active");
+ SimpleTest.finish();
+ });
+ }
+
+ function onPopupShown(e) {
+ menulist.removeEventListener("popupshown", onPopupShown);
+ menuitem.addEventListener("DOMMenuItemActive", onDOMMenuItemActive);
+ synthesizeMouse(menuitem, 5, 0, { type: "mousemove" });
+ synthesizeMouse(menuitem, 6, 0, { type: "mousemove" });
+ }
+
+ function nextTest(e) {
+ menulist.addEventListener("popupshown", onPopupShown);
+ synthesizeMouseAtCenter(menulist, {});
+ }
+
+ ]]>
+ </script>
+</window>
diff --git a/layout/xul/test/test_bug159346.xhtml b/layout/xul/test/test_bug159346.xhtml
new file mode 100644
index 0000000000..c33823f755
--- /dev/null
+++ b/layout/xul/test/test_bug159346.xhtml
@@ -0,0 +1,143 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
+<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
+<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ xmlns:html="http://www.w3.org/1999/xhtml"
+ title="Test for Bug 159346">
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=159346
+-->
+
+ <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+ <script src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
+
+<scrollbar id="scrollbar" curpos="0" maxpos="500"/>
+
+<script class="testbody" type="application/javascript">
+<![CDATA[
+
+var scrollbar = document.getElementById("scrollbar");
+var downButton;
+
+var domWinUtils = SpecialPowers.DOMWindowUtils;
+domWinUtils.loadSheetUsingURIString('data:text/css,@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); scrollbarbutton[type="increment"][sbattr="scrollbar-down-bottom"] { display: -moz-box; min-width: 3px; min-height: 3px; }', domWinUtils.AGENT_SHEET);
+
+function init()
+{
+ downButton = SpecialPowers.unwrap(
+ SpecialPowers.InspectorUtils.getChildrenForNode(scrollbar, true, false)[4]);
+ if (!downButton) {
+ ok(navigator.userAgent.indexOf("Linux") !== -1 ||
+ navigator.userAgent.indexOf("Mac") !== -1, "Theme doesn't support scrollbar buttons");
+ SimpleTest.finish();
+ return;
+ }
+ SimpleTest.executeSoon(doTest1);
+}
+
+function getCurrentPos()
+{
+ return Number(scrollbar.getAttribute("curpos"));
+}
+
+function doTest1()
+{
+ var lastPos = 0;
+
+ synthesizeMouseAtCenter(downButton, { type: "mousedown" });
+ ok(getCurrentPos() > lastPos,
+ "scrollbar didn't change curpos by mousedown #1");
+ lastPos = getCurrentPos();
+
+ setTimeout(function () {
+ ok(getCurrentPos() > lastPos,
+ "scrollbar didn't change curpos by auto repeat #1");
+ synthesizeMouseAtCenter(downButton, { type: "mouseup" });
+ lastPos = getCurrentPos();
+
+ setTimeout(function () {
+ is(getCurrentPos(), lastPos,
+ "scrollbar changed curpos after mouseup #1");
+ SimpleTest.executeSoon(doTest2);
+ }, 1000);
+ }, 1000);
+}
+
+function doTest2()
+{
+ SpecialPowers.setIntPref("ui.scrollbarButtonAutoRepeatBehavior", 0);
+
+ scrollbar.setAttribute("curpos", 0);
+ var lastPos = 0;
+
+ synthesizeMouseAtCenter(downButton, { type: "mousedown" });
+ ok(getCurrentPos() > lastPos,
+ "scrollbar didn't change curpos by mousedown #2");
+ lastPos = getCurrentPos();
+
+ synthesizeMouse(downButton, -10, -10, { type: "mousemove" });
+ lastPos = getCurrentPos();
+
+ setTimeout(function () {
+ is(getCurrentPos(), lastPos,
+ "scrollbar changed curpos by auto repeat when cursor is outside of scrollbar button #2");
+ synthesizeMouseAtCenter(downButton, { type: "mousemove" });
+ lastPos = getCurrentPos();
+
+ setTimeout(function () {
+ ok(getCurrentPos() > lastPos,
+ "scrollbar didn't change curpos by mousemove after cursor is back on the scrollbar button #2");
+ synthesizeMouseAtCenter(downButton, { type: "mouseup" });
+ SimpleTest.executeSoon(doTest3);
+ }, 1000);
+ }, 1000);
+}
+
+function doTest3()
+{
+ SpecialPowers.setIntPref("ui.scrollbarButtonAutoRepeatBehavior", 1);
+
+ scrollbar.setAttribute("curpos", 0);
+ var lastPos = 0;
+
+ synthesizeMouseAtCenter(downButton, { type: "mousedown" });
+ ok(getCurrentPos() > lastPos,
+ "scrollbar didn't change curpos by mousedown #3");
+ synthesizeMouse(downButton, -10, -10, { type: "mousemove" });
+ lastPos = getCurrentPos();
+
+ setTimeout(function () {
+ ok(getCurrentPos() > lastPos,
+ "scrollbar didn't change curpos by auto repeat when cursor is outside of scrollbar button #3");
+ synthesizeMouseAtCenter(downButton, { type: "mousemove" });
+ lastPos = getCurrentPos();
+
+ setTimeout(function () {
+ ok(getCurrentPos() > lastPos,
+ "scrollbar didn't change curpos by mousemove after cursor is back on the scrollbar button #3");
+ synthesizeMouseAtCenter(downButton, { type: "mouseup" });
+
+ SpecialPowers.clearUserPref("ui.scrollbarButtonAutoRepeatBehavior");
+ SimpleTest.finish();
+ }, 1000);
+ }, 1000);
+}
+
+SimpleTest.waitForExplicitFinish();
+
+]]>
+</script>
+
+<body id="html_body" xmlns="http://www.w3.org/1999/xhtml">
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=159346">Mozilla Bug 159346</a>
+<p id="display"></p>
+
+<pre id="test">
+</pre>
+<script>
+addLoadEvent(init);
+</script>
+</body>
+
+
+</window>
diff --git a/layout/xul/test/test_bug381167.xhtml b/layout/xul/test/test_bug381167.xhtml
new file mode 100644
index 0000000000..750dabae33
--- /dev/null
+++ b/layout/xul/test/test_bug381167.xhtml
@@ -0,0 +1,52 @@
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=381167
+-->
+<head>
+ <title>Test for Bug 381167</title>
+ <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=381167">Mozilla Bug 381167</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<xul:tree>
+ <xul:tree>
+ <xul:treechildren/>
+ <xul:treecol/>
+ </xul:tree>
+</xul:tree>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for Bug 381167 **/
+
+SimpleTest.waitForExplicitFinish();
+
+function closeit() {
+ var evt = new KeyboardEvent("keypress", {
+ bubbles: true,
+ cancelable: true,
+ view: window,
+ ctrlKey: true,
+ keyCode: 'W'.charCodeAt(0),
+ charCode: 0,
+ });
+ window.dispatchEvent(evt);
+
+ setTimeout(finish, 200);
+}
+window.addEventListener('load', closeit);
+
+function finish()
+{
+ ok(true, "This is a mochikit version of a crash test. To complete is to pass.");
+ SimpleTest.finish();
+}
+</script>
+</pre>
+</body>
+</html>
diff --git a/layout/xul/test/test_bug386386.html b/layout/xul/test/test_bug386386.html
new file mode 100644
index 0000000000..d3187c9142
--- /dev/null
+++ b/layout/xul/test/test_bug386386.html
@@ -0,0 +1,34 @@
+<html>
+<head><title>Testcase for bug 386386</title>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=386386
+-->
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+</head>
+<body>
+
+<iframe id="test386386" src="file_bug386386.sjs"></iframe>
+
+<script class="testbody" type="application/javascript">
+
+function boom()
+{
+ var XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
+ var doc = document.getElementById("test386386").contentDocument;
+ var observes = doc.createElementNS(XUL_NS, 'observes');
+ doc.removeChild(doc.documentElement);
+ doc.appendChild(observes);
+ is(0, 0, "Test is successful if we get here without crashing");
+ SimpleTest.finish();
+}
+
+function do_test() {
+ setTimeout(boom, 200);
+}
+SimpleTest.waitForExplicitFinish();
+SimpleTest.requestFlakyTimeout("untriaged");
+addLoadEvent(do_test);
+</script>
+
+</body>
+</html>
diff --git a/layout/xul/test/test_bug394800.xhtml b/layout/xul/test/test_bug394800.xhtml
new file mode 100644
index 0000000000..26fc50f771
--- /dev/null
+++ b/layout/xul/test/test_bug394800.xhtml
@@ -0,0 +1,39 @@
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+<head>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=394800
+-->
+ <title>Test Mozilla bug 394800</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+
+<script class="testbody" type="application/javascript">
+
+function do_test()
+{
+ var x = document.getElementById("x");
+ x.parentNode.removeChild(x);
+ is(0, 0, "this is a crash/assertion test, so we're ok if we survived this far");
+ SimpleTest.finish();
+}
+
+SimpleTest.waitForExplicitFinish();
+</script>
+</head>
+
+<body>
+
+<xul:menulist><xul:tooltip/><div><span><xul:hbox id="x"/></span></div></xul:menulist>
+
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=394800">Mozilla Bug 394800</a>
+<p id="display"></p>
+
+<pre id="test">
+</pre>
+
+<script>
+ addLoadEvent(do_test);
+</script>
+
+</body>
+</html>
diff --git a/layout/xul/test/test_bug398982-1.xhtml b/layout/xul/test/test_bug398982-1.xhtml
new file mode 100644
index 0000000000..da6598b70d
--- /dev/null
+++ b/layout/xul/test/test_bug398982-1.xhtml
@@ -0,0 +1,31 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
+<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
+<menuitem xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ xmlns:html="http://www.w3.org/1999/xhtml"
+ style="position: absolute; display: block;">
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=398982
+-->
+ <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+
+<tooltip type="zzz">
+<treecols/>
+</tooltip>
+
+<script xmlns="http://www.w3.org/1999/xhtml" class="testbody" type="application/javascript">
+<![CDATA[
+function doe() {
+ document.getElementsByTagName('menuitem')[0].removeAttribute('style');
+ is(0, 0, "Test is successful if we get here without crashing");
+ SimpleTest.finish();
+}
+function do_test() {
+ setTimeout(doe, 200);
+}
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(do_test);
+]]>
+</script>
+<html:body></html:body> <!-- XXX SimpleTest.showReport() requires a html:body -->
+</menuitem>
diff --git a/layout/xul/test/test_bug398982-2.xhtml b/layout/xul/test/test_bug398982-2.xhtml
new file mode 100644
index 0000000000..865e688ea3
--- /dev/null
+++ b/layout/xul/test/test_bug398982-2.xhtml
@@ -0,0 +1,33 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
+<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
+<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ xmlns:html="http://www.w3.org/1999/xhtml"
+ title="Test for Bug 398982">
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=398982
+-->
+ <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+
+<popupgroup style="position: absolute; display: block;">
+<tooltip type="zzz">
+<treecols/>
+</tooltip>
+
+<script xmlns="http://www.w3.org/1999/xhtml" class="testbody" type="application/javascript">
+<![CDATA[
+function doe() {
+ document.getElementsByTagName('popupgroup')[0].removeAttribute('style');
+ is(0, 0, "Test is successful if we get here without crashing");
+ SimpleTest.finish();
+}
+function do_test() {
+ setTimeout(doe, 200);
+}
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(do_test);
+]]>
+</script>
+</popupgroup>
+<html:body></html:body> <!-- XXX SimpleTest.showReport() requires a html:body -->
+</window>
diff --git a/layout/xul/test/test_bug467442.xhtml b/layout/xul/test/test_bug467442.xhtml
new file mode 100644
index 0000000000..f0f84c3f86
--- /dev/null
+++ b/layout/xul/test/test_bug467442.xhtml
@@ -0,0 +1,53 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/css" href="chrome://global/skin"?>
+<?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=467442
+-->
+<window title="Mozilla Bug 467442"
+ onload="onload()"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+ <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
+
+ <!-- test code goes here -->
+ <popupset>
+ <panel id="panel">
+ Hello.
+ </panel>
+ </popupset>
+ <hbox>
+ <button id="anchor" label="Anchor hello on here" style="transform: translate(100px, 0)"/>
+ </hbox>
+ <script type="application/javascript">
+ <![CDATA[
+
+ SimpleTest.waitForExplicitFinish();
+
+ function onload() {
+ /** Test for Bug 467442 **/
+ let panel = document.getElementById("panel");
+ let anchor = document.getElementById("anchor");
+
+ panel.addEventListener("popupshown", function onpopupshown() {
+ let panelRect = panel.getBoundingClientRect();
+ let marginLeft = parseFloat(getComputedStyle(panel).marginLeft);
+ let anchorRect = anchor.getBoundingClientRect();
+ is(panelRect.left - marginLeft, anchorRect.left, "Panel should be anchored to the button");
+ panel.addEventListener("popuphidden", function onpopuphidden() {
+ SimpleTest.finish();
+ }, { once: true });
+ panel.hidePopup();
+ }, { once: true });
+
+ panel.openPopup(anchor, "after_start", 0, 0, false, false);
+ }
+
+ ]]>
+ </script>
+
+ <!-- test results are displayed in the html:body -->
+ <body xmlns="http://www.w3.org/1999/xhtml">
+ <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=467442"
+ target="_blank">Mozilla Bug 467442</a>
+ </body>
+</window>
diff --git a/layout/xul/test/test_bug477754.xhtml b/layout/xul/test/test_bug477754.xhtml
new file mode 100644
index 0000000000..338f95c62e
--- /dev/null
+++ b/layout/xul/test/test_bug477754.xhtml
@@ -0,0 +1,51 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
+<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=477754
+-->
+<window title="Mozilla Bug 477754"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+ <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
+
+ <!-- test results are displayed in the html:body -->
+ <body xmlns="http://www.w3.org/1999/xhtml">
+ <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=477754"
+ target="_blank">Mozilla Bug 477754</a>
+ </body>
+
+ <hbox pack="center">
+ <label id="anchor" style="direction: rtl;" value="Anchor"/>
+ </hbox>
+ <panel id="testPopup" onpopupshown="doTest();">
+ <label value="I am a popup"/>
+ </panel>
+
+ <!-- test code goes here -->
+ <script type="application/javascript"><![CDATA[
+ /** Test for Bug 477754 **/
+ SimpleTest.waitForExplicitFinish();
+
+ let testPopup, testAnchor;
+
+ addEventListener("load", function () {
+ removeEventListener("load", arguments.callee, false);
+
+ testPopup = document.getElementById("testPopup");
+ testAnchor = document.getElementById("anchor");
+
+ testPopup.openPopup(testAnchor, "after_start", 10, 0, false, false);
+ }, false);
+
+ function doTest() {
+ let anchorRect = testAnchor.getBoundingClientRect();
+ let popupRect = testPopup.getBoundingClientRect();
+ let marginRight = parseFloat(getComputedStyle(testPopup).marginRight)
+ is(Math.round(anchorRect.right - popupRect.right - marginRight), 10,
+ "RTL popup's right offset should be equal to the x offset passed to openPopup");
+ testPopup.hidePopup();
+ SimpleTest.finish();
+ }
+
+ ]]></script>
+</window>
diff --git a/layout/xul/test/test_bug511075.html b/layout/xul/test/test_bug511075.html
new file mode 100644
index 0000000000..34e784ba56
--- /dev/null
+++ b/layout/xul/test/test_bug511075.html
@@ -0,0 +1,121 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=511075
+-->
+<head>
+ <title>Test for Bug 511075</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script src="/tests/SimpleTest/EventUtils.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+ <style>
+ #scroller {
+ border: 1px solid black;
+ }
+ </style>
+</head>
+<body onload="runTests()">
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=511075">Mozilla Bug 511075</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for Bug 511075 **/
+
+SimpleTest.waitForExplicitFinish();
+SimpleTest.requestFlakyTimeout("untriaged");
+
+var tests = [
+ function() {
+ ok(true, "Setting location.hash should scroll.");
+ nextTest();
+ // Click the top scroll arrow.
+ var x = scroller.getBoundingClientRect().width - 5;
+ var y = 5;
+ // On MacOSX the top scroll arrow can be below the slider just above
+ // the bottom scroll arrow.
+ if (navigator.platform.includes("Mac"))
+ y = scroller.getBoundingClientRect().height - 40;
+ synthesizeMouse(scroller, x, y, { type : "mousedown" }, window);
+ synthesizeMouse(scroller, x, y, { type: "mouseup" }, window);
+ },
+ function() {
+ ok(true, "Clicking the top scroll arrow should scroll.");
+ nextTest();
+ // Click the bottom scroll arrow.
+ var x = scroller.getBoundingClientRect().width - 5;
+ var y = scroller.getBoundingClientRect().height - 25;
+ synthesizeMouse(scroller, x, y, { type : "mousedown" }, window);
+ synthesizeMouse(scroller, x, y, { type: "mouseup" }, window);
+ },
+ function() {
+ ok(true, "Clicking the bottom scroll arrow should scroll.");
+ nextTest();
+ // Click the scrollbar.
+ var x = scroller.getBoundingClientRect().width - 5;
+ synthesizeMouse(scroller, x, 40, { type : "mousedown" }, window);
+ synthesizeMouse(scroller, x, 40, { type: "mouseup" }, window);
+ },
+ function() {
+ ok(true, "Clicking the scrollbar should scroll");
+ nextTest();
+ // Click the scrollbar.
+ var x = scroller.getBoundingClientRect().width - 5;
+ var y = scroller.getBoundingClientRect().height - 50;
+ synthesizeMouse(scroller, x, y, { type : "mousedown" }, window);
+ synthesizeMouse(scroller, x, y, { type: "mouseup" }, window);
+ },
+ function() {
+ scroller.onscroll = null;
+ ok(true, "Clicking the scrollbar should scroll");
+ finish();
+ }
+];
+
+document.onmousedown = function () { return false; };
+document.onmouseup = function () { return true; };
+
+
+var scroller;
+var timer = 0;
+
+function failure() {
+ ok(false, scroller.onscroll + " did not run!");
+ scroller.onscroll = null;
+ finish();
+}
+
+function nextTest() {
+ clearTimeout(timer);
+ scroller.onscroll = tests.shift();
+ timer = setTimeout(failure, 2000);
+}
+
+function runTests() {
+ scroller = document.getElementById("scroller");
+ nextTest();
+ window.location.hash = "initialPosition";
+}
+
+function finish() {
+ document.onmousedown = null;
+ document.onmouseup = null;
+ clearTimeout(timer);
+ window.location.hash = "topPosition";
+ SimpleTest.finish();
+}
+
+
+</script>
+</pre>
+<div id="scroller" style="overflow: scroll; width: 100px; height: 150px;">
+<a id="topPosition" name="topPosition">top</a>
+<div style="width: 20000px; height: 20000px;"></div>
+<a id="initialPosition" name="initialPosition">initialPosition</a>
+<div style="width: 20000px; height: 20000px;"></div>
+</div>
+</body>
+</html>
diff --git a/layout/xul/test/test_bug563416.html b/layout/xul/test/test_bug563416.html
new file mode 100644
index 0000000000..22abb5bdc3
--- /dev/null
+++ b/layout/xul/test/test_bug563416.html
@@ -0,0 +1,53 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=563416
+-->
+<head>
+ <title>Test for Bug 563416</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=563416">Mozilla Bug 563416</a>
+<p id="display"><iframe id="test" srcdoc='<textarea style="box-sizing:content-box; overflow: hidden; -moz-appearance:none; height: 0px; padding: 0px;" cols="20" rows="10">hsldkjvmshlkkajskdlfksdjflskdjflskdjflskdjflskdjfddddddddd</textarea>'></iframe></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for Bug 563416 **/
+
+var result = -1;
+var expected = -2;
+var i = 0;
+
+function runTest() {
+ i = 0;
+ var frame = document.getElementById('test');
+ frame.onload = function() {
+ var t = frame.contentDocument.documentElement.getElementsByTagName("textarea")[0];
+ expected = t.clientWidth + 10;
+ t.style.width = expected + 'px';
+ result = t.clientWidth;
+ if (i == 0) {
+ i++;
+ setTimeout(function(){frame.contentWindow.location.reload();},0);
+ }
+ else {
+ is(result, expected, "setting style.width changes clientWidth");
+ SimpleTest.finish();
+ }
+ }
+ frame.contentWindow.location.reload();
+}
+
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(runTest);
+
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/layout/xul/test/test_bug703150.xhtml b/layout/xul/test/test_bug703150.xhtml
new file mode 100644
index 0000000000..4a7230bd49
--- /dev/null
+++ b/layout/xul/test/test_bug703150.xhtml
@@ -0,0 +1,74 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
+<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
+<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ xmlns:html="http://www.w3.org/1999/xhtml"
+ title="Test for Bug 703150">
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=703150
+-->
+
+ <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+ <script src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
+
+<scrollbar id="scrollbar" curpos="0" maxpos="500"/>
+
+<script class="testbody" type="application/javascript">
+<![CDATA[
+function doTest()
+{
+ var scrollbar = document.getElementById("scrollbar");
+ var scrollbarThumb = null;
+ for (let child of SpecialPowers.InspectorUtils.getChildrenForNode(scrollbar, true, false)) {
+ if (child.nodeName === "slider") {
+ scrollbarThumb = SpecialPowers.unwrap(child.childNodes[0]);
+ }
+ }
+
+ ok(scrollbarThumb, "Should find thumb");
+ is(scrollbarThumb.nodeName, "thumb", "Should find thumb");
+
+ function mousedownHandler(aEvent)
+ {
+ aEvent.stopPropagation();
+ }
+ window.addEventListener("mousedown", mousedownHandler, true);
+
+ // Wait for finishing reflow...
+ SimpleTest.executeSoon(function () {
+ synthesizeMouseAtCenter(scrollbarThumb, { type: "mousedown" });
+
+ is(scrollbar.getAttribute("curpos"), "0",
+ "scrollbar thumb has been moved already");
+
+ synthesizeMouseAtCenter(scrollbar, { type: "mousemove" });
+
+ ok(scrollbar.getAttribute("curpos") > 0,
+ "scrollbar thumb hasn't been dragged");
+
+ synthesizeMouseAtCenter(scrollbarThumb, { type: "mouseup" });
+
+ window.removeEventListener("mousedown", mousedownHandler, true);
+
+ SimpleTest.finish();
+ });
+}
+
+SimpleTest.waitForExplicitFinish();
+
+]]>
+</script>
+
+<body id="html_body" xmlns="http://www.w3.org/1999/xhtml">
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=703150">Mozilla Bug 703150</a>
+<p id="display"></p>
+
+<pre id="test">
+</pre>
+<script>
+addLoadEvent(doTest);
+</script>
+</body>
+
+
+</window>
diff --git a/layout/xul/test/test_bug987230.xhtml b/layout/xul/test/test_bug987230.xhtml
new file mode 100644
index 0000000000..3161ad9d0e
--- /dev/null
+++ b/layout/xul/test/test_bug987230.xhtml
@@ -0,0 +1,109 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/css" href="chrome://global/skin"?>
+<?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=987230
+-->
+<window title="Mozilla Bug 987230"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ onload="SimpleTest.waitForFocus(startTest, window)">
+ <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
+ <script src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
+
+
+ <!-- test results are displayed in the html:body -->
+ <body xmlns="http://www.w3.org/1999/xhtml">
+ <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=987230"
+ target="_blank">Mozilla Bug 987230</a>
+ </body>
+
+ <vbox>
+ <toolbar>
+ <toolbarbutton id="toolbarbutton-anchor"
+ label="Anchor"
+ consumeanchor="toolbarbutton-anchor"
+ onclick="onAnchorClick(event)"
+ style="padding: 50px !important; list-style-image: url(chrome://branding/content/icon32.png)"/>
+ </toolbar>
+ <spacer flex="1"/>
+ <hbox id="hbox-anchor"
+ style="padding: 20px"
+ onclick="onAnchorClick(event)">
+ <hbox id="inner-anchor"
+ consumeanchor="hbox-anchor"
+ >
+ Another anchor
+ </hbox>
+ </hbox>
+ <spacer flex="1"/>
+ </vbox>
+
+ <panel id="mypopup"
+ type="arrow"
+ onpopupshown="onMyPopupShown(event)"
+ onpopuphidden="onMyPopupHidden(event)">This is a test popup</panel>
+
+ <!-- test code goes here -->
+ <script type="application/javascript">
+ <![CDATA[
+ /** Test for Bug 987230 **/
+ SimpleTest.waitForExplicitFinish();
+
+ SimpleTest.requestCompleteLog();
+
+ function onMyPopupHidden(e) {
+ ok(true, "Popup hidden");
+ if (outerAnchor.id == "toolbarbutton-anchor") {
+ popupHasShown = false;
+ outerAnchor = document.getElementById("hbox-anchor");
+ anchor = document.getElementById("inner-anchor");
+ nextTest();
+ } else {
+ //XXXgijs set mouse position back outside the iframe:
+ let frameRect = window.frameElement.getBoundingClientRect();
+ let scale = window.devicePixelRatio;
+ let outsideOfFrameX = (window.mozInnerScreenX + frameRect.width + 100) * scale;
+ let outsideOfFrameY = Math.max(0, window.mozInnerScreenY - 100) * scale;
+
+ info("Mousemove: " + outsideOfFrameX + ", " + outsideOfFrameY +
+ " (from innerscreen " + window.mozInnerScreenX + ", " + window.mozInnerScreenY +
+ " and rect width " + frameRect.width + " and scale " + scale + ")");
+ synthesizeNativeMouseEvent({
+ type: "mousemove",
+ screenX: outsideOfFrameX,
+ screenY: outsideOfFrameY,
+ scale: "inScreenPixels",
+ elementOnWidget: null,
+ });
+ SimpleTest.finish();
+ }
+ }
+
+ let popupHasShown = false;
+ function onMyPopupShown(e) {
+ popupHasShown = true;
+ synthesizeNativeMouseEvent({ type: "click", target: outerAnchor, offsetX: 5, offsetY: 5 });
+ }
+
+ function onAnchorClick(e) {
+ info("click: " + e.target.id);
+ ok(!popupHasShown, "Popup should only be shown once");
+ popup.openPopup(anchor, "bottomcenter topright");
+ }
+
+ let popup, outerAnchor, anchor;
+
+ function startTest() {
+ popup = document.getElementById("mypopup");
+ outerAnchor = document.getElementById("toolbarbutton-anchor");
+ anchor = outerAnchor.icon;
+ nextTest();
+ }
+
+ function nextTest(e) {
+ synthesizeMouse(outerAnchor, 5, 5, {});
+ }
+
+ ]]>
+ </script>
+</window>
diff --git a/layout/xul/test/test_drag_thumb_in_link.html b/layout/xul/test/test_drag_thumb_in_link.html
new file mode 100644
index 0000000000..7c39fd0f28
--- /dev/null
+++ b/layout/xul/test/test_drag_thumb_in_link.html
@@ -0,0 +1,76 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=367028
+-->
+<head>
+<title>Test for Bug 367028</title>
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script src="/tests/SimpleTest/EventUtils.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+<style>
+#scroller {
+ display: block;
+ width: 200px;
+ height: 100px;
+ overflow: scroll;
+ background: beige;
+ border: 1px solid black;
+}
+
+#biggerblock {
+ display: block;
+ width: 100px;
+ height: 150px;
+ line-height: 150px;
+ white-space: nowrap;
+ overflow: hidden;
+ background: khaki;
+}
+</style>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=367028">Mozilla Bug 367028</a>
+<p id="display"></p>
+<div id="content" style="display: none"></div>
+<a id="scroller" href="#">
+ block anchor<span id="biggerblock">bigger block</span>
+</a>
+<script type="application/javascript">
+
+function waitForEvent(aTarget, aEvent) {
+ return new Promise(aResolve => {
+ aTarget.addEventListener(aEvent, aResolve, { once: true });
+ });
+}
+
+/** Test for Bug 367028 **/
+
+add_task(async function drag_thumb_in_link() {
+ let scroller = document.getElementById("scroller");
+ scroller.ondragstart = function(e) {
+ e.preventDefault();
+ ok(false, "dragging on scroller bar should not trigger drag-and-drop operation");
+ scroller.ondragstart = null;
+ };
+
+ // Click the scroll bar.
+ let x = scroller.getBoundingClientRect().width - 5;
+ let y = scroller.getBoundingClientRect().height - 70;
+ synthesizeMouse(scroller, x, y, { type : "mousedown" }, window);
+ synthesizeMouse(scroller, x, y, { type : "mousemove" }, window);
+
+ let scrollPromise = waitForEvent(scroller, "scroll");
+ x = scroller.getBoundingClientRect().width + 20;
+ y = scroller.getBoundingClientRect().height - 30;
+ synthesizeMouse(scroller, x, y, { type : "mousemove" }, window);
+ synthesizeMouse(scroller, x, y, { type : "mouseup" }, window);
+ await scrollPromise;
+
+ ok(true, "Dragging scroller bar should scroll");
+ scroller.ondragstart = null;
+});
+
+</script>
+</body>
+</html>
diff --git a/layout/xul/test/test_menuitem_ctrl_click.xhtml b/layout/xul/test/test_menuitem_ctrl_click.xhtml
new file mode 100644
index 0000000000..99f7cba7c6
--- /dev/null
+++ b/layout/xul/test/test_menuitem_ctrl_click.xhtml
@@ -0,0 +1,80 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/css" href="chrome://global/skin"?>
+<?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1630828
+-->
+<window title="Mozilla Bug 1630828"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ onload="">
+<script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
+<script src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
+
+<!-- test results are displayed in the html:body -->
+<body xmlns="http://www.w3.org/1999/xhtml">
+<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1630828"
+ target="_blank">Mozilla Bug 1630828</a>
+</body>
+
+<hbox align="center" pack="center">
+ <menulist id="menu">
+ <menupopup id="popup">
+ <menuitem label="Target" id="target" />
+ </menupopup>
+ </menulist>
+</hbox>
+<!-- test code goes here -->
+<script type="application/javascript">
+<![CDATA[
+
+const { AppConstants } = SpecialPowers.ChromeUtils.importESModule(
+ "resource://gre/modules/AppConstants.sys.mjs"
+);
+
+function waitForEvent(target, event) {
+ info(`Waiting for ${event} event.`);
+ return new Promise(resolve => {
+ target.addEventListener(event, resolve, { once: true });
+ });
+}
+
+function waitForIdle() {
+ return new Promise(resolve => {
+ SpecialPowers.Services.tm.idleDispatchToMainThread(resolve);
+ });
+}
+
+add_setup(async function() {
+ await SimpleTest.promiseFocus();
+});
+
+add_task(async function test_ctrl_click() {
+ const isMac = AppConstants.platform === "macosx";
+
+ let popup = document.getElementById("popup");
+ let promise = waitForEvent(popup, "popupshown");
+ let menu = document.getElementById("menu");
+ synthesizeMouseAtCenter(menu, {});
+ // Wait for popup open.
+ await promise;
+
+ let commandReceived = false;
+ menu.addEventListener("command", function(e) {
+ ok(!isMac, `${AppConstants.platform} receives command event`);
+ commandReceived = true;
+ });
+
+ // Ctrl click in Mac won't dispatch command event and close popup, so we wait
+ // for idle instead.
+ promise = isMac ? waitForIdle() : waitForEvent(popup, "popuphidden");
+ let target = document.getElementById("target");
+ synthesizeMouseAtCenter(target, { ctrlKey: true });
+ await promise;
+
+ is(commandReceived, !isMac, `Check command event for ${AppConstants.platform}`);
+ is(popup.state, isMac ? "open" : "closed", `Check popup state for ${AppConstants.platform}`);
+});
+
+]]>
+</script>
+</window>
diff --git a/layout/xul/test/test_popupReflowPos.xhtml b/layout/xul/test/test_popupReflowPos.xhtml
new file mode 100644
index 0000000000..a26a833d13
--- /dev/null
+++ b/layout/xul/test/test_popupReflowPos.xhtml
@@ -0,0 +1,77 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
+<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
+<window title="XUL Panel reflow placement test"
+ xmlns:html="http://www.w3.org/1999/xhtml"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+ <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
+ <script src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
+
+ <body xmlns="http://www.w3.org/1999/xhtml">
+ </body>
+
+ <script><![CDATA[
+ SimpleTest.waitForExplicitFinish();
+
+ function openPopup()
+ {
+ synthesizeMouseAtCenter(document.getElementById("thebutton"), {}, window);
+ }
+
+ function popupShown(event)
+ {
+ document.getElementById("parent").className = "";
+ var popup = document.getElementById("thepopup");
+
+ var buttonbcr = document.getElementById("thebutton").getBoundingClientRect();
+ var popupbcr = popup.getOuterScreenRect();
+ var popupMarginLeft = parseFloat(getComputedStyle(popup).marginLeft);
+ var popupMarginTop = parseFloat(getComputedStyle(popup).marginTop);
+
+ ok(Math.abs(popupbcr.x - popupMarginLeft - window.mozInnerScreenX - buttonbcr.x) < 3, "x pos is correct");
+ ok(Math.abs(popupbcr.y - popupMarginTop - window.mozInnerScreenY - buttonbcr.bottom) < 3, "y pos is correct");
+
+ event.target.hidePopup();
+ }
+
+ SimpleTest.waitForFocus(openPopup);
+ ]]></script>
+
+ <html:style>
+ .mbox {
+ display: inline-block;
+ width: 33%;
+ height: 50px;
+ background: green;
+ vertical-align: middle;
+ }
+ .orange {
+ background: orange;
+ }
+ .change > .mbox {
+ width: 60px;
+ }
+ </html:style>
+
+ <html:div style="width: 300px; height: 200px;">
+ <html:div id="parent" class="change" style="background: red; border: 1px solid black; width: 300px; height: 200px;">
+ <html:div class="mbox"></html:div>
+ <html:div class="mbox"></html:div>
+ <html:div class="mbox"></html:div>
+ <html:div class="mbox orange">
+
+ <button label="Show" type="menu" id="thebutton">
+ <menupopup id="thepopup" onpopupshown="popupShown(event)" onpopuphidden="SimpleTest.finish()">
+ <menuitem label="New"/>
+ <menuitem label="Open"/>
+ <menuitem label="Save"/>
+ <menuseparator/>
+ <menuitem label="Exit"/>
+ </menupopup>
+ </button>
+
+ </html:div>
+ </html:div>
+ </html:div>
+
+</window>
diff --git a/layout/xul/test/test_popupSizeTo.xhtml b/layout/xul/test/test_popupSizeTo.xhtml
new file mode 100644
index 0000000000..6e60f28e0a
--- /dev/null
+++ b/layout/xul/test/test_popupSizeTo.xhtml
@@ -0,0 +1,55 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
+<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
+<!--
+XUL Panel sizeTo tests
+-->
+<window title="XUL Panel sizeTo tests"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+ <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
+ <script src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
+
+ <!-- test results are displayed in the html:body -->
+ <body xmlns="http://www.w3.org/1999/xhtml">
+ </body>
+
+ <!-- test code goes here -->
+ <script type="application/javascript"><![CDATA[
+ SimpleTest.waitForExplicitFinish();
+
+ function openPopup()
+ {
+ document.getElementById("panel").
+ openPopupAtScreen(Math.round(window.mozInnerScreenX) + window.innerWidth - 130,
+ Math.round(window.mozInnerScreenY) + window.innerHeight - 130);
+ }
+
+ function sizeAndCheck(width, height) {
+ var panel = document.getElementById("panel");
+ panel.sizeTo(width, height);
+ is(panel.getBoundingClientRect().width, width, "width is correct");
+ is(panel.getBoundingClientRect().height, height, "height is correct");
+
+ }
+ function popupShown(event)
+ {
+ var panel = document.getElementById("panel");
+ var bcr = panel.getBoundingClientRect();
+ // resize to 10px bigger in both dimensions.
+ sizeAndCheck(bcr.width+10, bcr.height+10);
+ // Same width, different height (based on *new* size from last sizeAndCheck)
+ sizeAndCheck(bcr.width+10, bcr.height);
+ // Same height, different width (also based on *new* size from last sizeAndCheck)
+ sizeAndCheck(bcr.width, bcr.height);
+ event.target.hidePopup();
+ }
+
+ SimpleTest.waitForFocus(openPopup);
+ ]]></script>
+
+<panel id="panel" onpopupshown="popupShown(event)" onpopuphidden="SimpleTest.finish()">
+ <resizer id="resizer" dir="bottomend" width="16" height="16"/>
+ <hbox width="50" height="50" flex="1"/>
+</panel>
+
+</window>
diff --git a/layout/xul/test/test_popupZoom.xhtml b/layout/xul/test/test_popupZoom.xhtml
new file mode 100644
index 0000000000..5e253744f9
--- /dev/null
+++ b/layout/xul/test/test_popupZoom.xhtml
@@ -0,0 +1,53 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
+<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
+<window title="XUL Panel zoom test"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+ <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
+ <script src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
+
+ <body xmlns="http://www.w3.org/1999/xhtml">
+ </body>
+
+ <script><![CDATA[
+ SimpleTest.waitForExplicitFinish();
+
+ var savedzoom;
+
+ function openPopup()
+ {
+ docviewer = window.docShell.docViewer;
+ savedzoom = SpecialPowers.getFullZoom(window);
+ SpecialPowers.setFullZoom(window, 2);
+
+ document.getElementById("panel").
+ openPopup(document.getElementById("anchor"), "after_start", 0, 0, false, false, null);
+ }
+
+ function popupShown(event)
+ {
+ var panel = document.getElementById("panel");
+ var panelMarginLeft = parseFloat(getComputedStyle(panel).marginLeft);
+ var panelMarginTop = parseFloat(getComputedStyle(panel).marginTop);
+ var panelbcr = panel.getBoundingClientRect();
+ var anchorbcr = document.getElementById("anchor").getBoundingClientRect();
+
+ ok(Math.abs(panelbcr.x - panelMarginLeft - anchorbcr.x) < 3, "x pos is correct");
+ ok(Math.abs(panelbcr.y - panelMarginTop - anchorbcr.bottom) < 3, "y pos is correct");
+
+ SpecialPowers.setFullZoom(window, savedzoom);
+
+ event.target.hidePopup();
+ }
+
+ SimpleTest.waitForFocus(openPopup);
+ ]]></script>
+
+<description id="anchor" value="Sometext to this some texts"/>
+<panel id="panel" onpopupshown="popupShown(event)" onpopuphidden="SimpleTest.finish()">
+ <resizer id="resizer" dir="bottomend" width="16" height="16"/>
+ <hbox width="50" height="50" flex="1"/>
+</panel>
+
+
+</window>
diff --git a/layout/xul/test/test_resizer_ctrl_click.xhtml b/layout/xul/test/test_resizer_ctrl_click.xhtml
new file mode 100644
index 0000000000..4ab6f405c1
--- /dev/null
+++ b/layout/xul/test/test_resizer_ctrl_click.xhtml
@@ -0,0 +1,47 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
+<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
+<!--
+ XUL Widget Test for the resizer element
+ -->
+<window title="Titlebar" width="200" height="200"
+ onload="setTimeout(test_resizer_ctrl_click, 0);"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+<script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
+<script src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
+
+<resizer id="resizer" dir="bottomend" width="16" height="16"/>
+
+<!-- test code goes here -->
+<script type="application/javascript"><![CDATA[
+
+SimpleTest.waitForExplicitFinish();
+
+function test_resizer_ctrl_click()
+{
+ let resizer = document.getElementById("resizer");
+ let isCommandFired = false;
+
+ resizer.addEventListener("click", function(aEvent) {
+ // Delay check for command event, because it is fired after click event.
+ setTimeout(() => {
+ ok(isCommandFired, "Check if command event is fired");
+ SimpleTest.finish();
+ }, 0);
+ });
+ resizer.addEventListener("command", function(aEvent) {
+ isCommandFired = true;
+ ok(aEvent.ctrlKey, "Check ctrlKey for command event");
+ ok(!aEvent.shiftKey, "Check shiftKey for command event");
+ ok(!aEvent.altKey, "Check altKey for command event");
+ ok(!aEvent.metaKey, "Check metaKey for command event");
+ is(aEvent.inputSource, MouseEvent.MOZ_SOURCE_MOUSE,
+ "Check inputSource for command event");
+ });
+ synthesizeMouseAtCenter(resizer, { ctrlKey: true });
+}
+
+]]>
+</script>
+
+</window>
diff --git a/layout/xul/test/test_resizer_incontent.xhtml b/layout/xul/test/test_resizer_incontent.xhtml
new file mode 100644
index 0000000000..2d29dd3f8d
--- /dev/null
+++ b/layout/xul/test/test_resizer_incontent.xhtml
@@ -0,0 +1,42 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
+<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
+<!--
+This test ensures that a resizer in content doesn't resize the window.
+-->
+<window title="XUL resizer in content test"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+ <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
+ <script src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js" />
+
+ <!-- test results are displayed in the html:body -->
+ <body xmlns="http://www.w3.org/1999/xhtml">
+ </body>
+
+ <!-- test code goes here -->
+ <script type="application/javascript"><![CDATA[
+ SimpleTest.waitForExplicitFinish();
+
+ function testResizer()
+ {
+ var oldScreenX = window.screenX;
+ var oldScreenY = window.screenY;
+ var oldWidth = window.outerWidth;
+ var oldHeight = window.outerHeight;
+ var resizer = document.getElementById("resizer");
+ synthesizeMouseAtCenter(resizer, { type:"mousedown" });
+ synthesizeMouse(resizer, 32, 32, { type:"mousemove" });
+ synthesizeMouse(resizer, 32, 32, { type:"mouseup" });
+ is(window.screenX, oldScreenX, "window not moved for non-chrome window screenX");
+ is(window.screenY, oldScreenY, "window not moved for non-chrome window screenY");
+ is(window.outerWidth, oldWidth, "window not moved for non-chrome window outerWidth");
+ is(window.outerHeight, oldHeight, "window not moved for non-chrome window outerHeight");
+ SimpleTest.finish();
+ }
+
+ SimpleTest.waitForFocus(testResizer);
+ ]]></script>
+
+ <resizer id="resizer" dir="bottomend" width="16" height="16"/>
+
+</window>
diff --git a/layout/xul/test/test_splitter.xhtml b/layout/xul/test/test_splitter.xhtml
new file mode 100644
index 0000000000..32c4118c8c
--- /dev/null
+++ b/layout/xul/test/test_splitter.xhtml
@@ -0,0 +1,117 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
+<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
+<?xml-stylesheet href="data:text/css, * { flex-shrink: 0 } hbox { border: 1px solid red; } vbox { border: 1px solid green }" type="text/css"?>
+<!--
+XUL <splitter> collapsing tests
+-->
+<window title="XUL splitter collapsing tests"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ orient="horizontal">
+ <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
+ <script src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
+
+ <!-- test results are displayed in the html:body -->
+ <body xmlns="http://www.w3.org/1999/xhtml">
+ </body>
+
+ <!-- test code goes here -->
+ <script type="application/javascript"><![CDATA[
+ SimpleTest.waitForExplicitFinish();
+
+ async function dragSplitter(offsetX) {
+ info(`Dragging splitter ${splitter.id} to ${offsetX}`);
+
+ const splitterRect = splitter.getBoundingClientRect();
+ const splitterWidth = splitterRect.width;
+ synthesizeMouse(splitter, splitterWidth / 2, 2, {type: "mousedown"});
+ synthesizeMouse(splitter, splitterWidth / 2, 1, {type: "mousemove"});
+ await new Promise(SimpleTest.executeSoon);
+ is(splitter.getAttribute("state"), "dragging", "The splitter should be dragged");
+ synthesizeMouse(splitter, offsetX, 1, {type: "mousemove"});
+ synthesizeMouse(splitter, offsetX, 1, {type: "mouseup"});
+ await new Promise(SimpleTest.executeSoon);
+ const newSplitterRect = splitter.getBoundingClientRect();
+ is(
+ offsetX > 0,
+ newSplitterRect.left > splitterRect.left,
+ `Should move in the right direction ${splitterRect.left} -> ${newSplitterRect.left}, ${offsetX}`
+ );
+ }
+
+ function shouldBeCollapsed(where) {
+ is(splitter.getAttribute("state"), "collapsed", "The splitter should be collapsed");
+ is(splitter.getAttribute("substate"), where, "The splitter should be collapsed " + where);
+ }
+
+ function shouldNotBeCollapsed() {
+ is(splitter.getAttribute("state"), "", "The splitter should not be collapsed");
+ }
+
+ async function runPass(isRTL, rightCollapsed, leftCollapsed) {
+ const containerWidth = splitter.parentNode.getBoundingClientRect().width;
+ await dragSplitter(containerWidth);
+ if (rightCollapsed) {
+ shouldBeCollapsed(isRTL ? "before" : "after");
+ } else {
+ shouldNotBeCollapsed();
+ }
+ await dragSplitter(-containerWidth * 2);
+ if (leftCollapsed) {
+ shouldBeCollapsed(isRTL ? "after" : "before");
+ } else {
+ shouldNotBeCollapsed();
+ }
+ await dragSplitter(containerWidth / 2);
+ // the splitter should never be collapsed in the middle
+ shouldNotBeCollapsed();
+ }
+
+ var splitter;
+ var activeBox = null;
+ function setActiveBox(element) {
+ if (activeBox) {
+ activeBox.style.display = "none";
+ }
+ if (element) {
+ element.style.display = "";
+ element.getBoundingClientRect();
+ }
+ activeBox = element;
+ }
+
+ async function runTests(rtl, splitterId) {
+ info(`Running tests for ${splitterId}`);
+ splitter = document.getElementById(splitterId);
+ setActiveBox(splitter.parentNode);
+ await runPass(rtl, false, false);
+ splitter.setAttribute("collapse", "before");
+ await runPass(rtl, rtl, !rtl);
+ splitter.setAttribute("collapse", "after");
+ await runPass(rtl, !rtl, rtl);
+ splitter.setAttribute("collapse", "both");
+ await runPass(rtl, true, true);
+ }
+
+ async function runAllTests() {
+ await runTests(false, "ltr-splitter");
+ await runTests(true, "rtl-splitter");
+ SimpleTest.finish();
+ }
+
+ addLoadEvent(function() {SimpleTest.executeSoon(runAllTests);});
+ ]]></script>
+
+ <hbox style="display: none; width: 200px; height: 300px; direction: ltr;">
+ <vbox style="height: 300px; flex: 1 auto"/>
+ <splitter id="ltr-splitter" style="width: 5px"/>
+ <vbox style="height: 300px; flex: 1 auto;"/>
+ </hbox>
+
+ <hbox style="display: none; width: 200px; height: 300px; direction: rtl;">
+ <vbox style="height: 300px; flex: 1 auto" />
+ <splitter id="rtl-splitter" style="width: 5px"/>
+ <vbox style="height: 300px; flex: 1 auto" />
+ </hbox>
+
+</window>
diff --git a/layout/xul/test/test_splitter_sibling.xhtml b/layout/xul/test/test_splitter_sibling.xhtml
new file mode 100644
index 0000000000..a2e00890c5
--- /dev/null
+++ b/layout/xul/test/test_splitter_sibling.xhtml
@@ -0,0 +1,88 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
+<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
+<?xml-stylesheet href="data:text/css, hbox { border: 1px solid red; } vbox { border: 1px solid green }" type="text/css"?>
+<window title="XUL splitter resizebefore/after tests"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ orient="horizontal">
+ <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
+ <script src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
+
+ <body xmlns="http://www.w3.org/1999/xhtml">
+ </body>
+
+ <hbox style="width: 200px; height: 200px; direction: ltr; display: none">
+ <vbox style="height: 200px; width: 40px" />
+ <splitter id="ltr-splitter-before" style="width: 5px" resizebefore="sibling" resizeafter="none"/>
+ <vbox style="height: 200px;" flex="1"/>
+ </hbox>
+
+ <hbox style="width: 200px; height: 200px; direction: rtl; display: none">
+ <vbox style="height: 200px; width: 40px" />
+ <splitter id="rtl-splitter-before" style="width: 5px" resizebefore="sibling" resizeafter="none"/>
+ <vbox style="height: 200px;" flex="1"/>
+ </hbox>
+
+ <hbox style="width: 200px; height: 200px; direction: ltr; display: none">
+ <vbox style="height: 200px;" flex="1"/>
+ <splitter id="ltr-splitter-after" style="width: 5px" resizeafter="sibling" resizebefore="none"/>
+ <vbox style="height: 200px; width: 40px" />
+ </hbox>
+
+ <hbox style="width: 200px; height: 200px; direction: rtl; display: none">
+ <vbox style="height: 200px;" flex="1"/>
+ <splitter id="rtl-splitter-after" style="width: 5px" resizeafter="sibling" resizebefore="none"/>
+ <vbox style="height: 200px; width: 40px" />
+ </hbox>
+
+ <script><![CDATA[
+ async function dragSplitter(splitter, offsetX) {
+ info(`Dragging splitter ${splitter.id} to ${offsetX}`);
+
+ const splitterRect = splitter.getBoundingClientRect();
+ const splitterWidth = splitterRect.width;
+ synthesizeMouse(splitter, splitterWidth / 2, 2, {type: "mousedown"});
+ synthesizeMouse(splitter, splitterWidth / 2, 1, {type: "mousemove"});
+ await new Promise(SimpleTest.executeSoon);
+ is(splitter.getAttribute("state"), "dragging", "The splitter should be dragged");
+ synthesizeMouse(splitter, offsetX, 1, {type: "mousemove"});
+ synthesizeMouse(splitter, offsetX, 1, {type: "mouseup"});
+ await new Promise(SimpleTest.executeSoon);
+ const newSplitterRect = splitter.getBoundingClientRect();
+ is(
+ offsetX > 0,
+ newSplitterRect.left > splitterRect.left,
+ `Should move in the right direction ${splitterRect.left} -> ${newSplitterRect.left}, ${offsetX}`
+ );
+ }
+
+ add_task(async function() {
+ for (let splitter of document.querySelectorAll("splitter")) {
+ info(`Testing ${splitter.id}`);
+ splitter.parentNode.style.display = "";
+ const isBefore = splitter.getAttribute("resizebefore") == "sibling";
+ const isRtl = getComputedStyle(splitter).direction == "rtl";
+
+ const resizableElement = isBefore ? splitter.previousElementSibling : splitter.nextElementSibling;
+ const nonResizableElement = isBefore ? splitter.nextElementSibling : splitter.previousElementSibling;
+ const oldWidth = resizableElement.getBoundingClientRect().width;
+
+ await dragSplitter(splitter, 10);
+
+ is(nonResizableElement.style.width, "", "Shouldn't have set width");
+ isnot(resizableElement.style.width, "40px", "Should've changed width");
+
+ const newWidth = resizableElement.getBoundingClientRect().width;
+
+ info(`Went from ${oldWidth} -> ${newWidth}\n`);
+
+ if (isRtl == isBefore) {
+ ok(newWidth < oldWidth, "Should've shrunk");
+ } else {
+ ok(newWidth > oldWidth, "Should've grown");
+ }
+ splitter.parentNode.style.display = "none";
+ }
+ });
+ ]]></script>
+</window>
diff --git a/layout/xul/test/test_submenuClose.xhtml b/layout/xul/test/test_submenuClose.xhtml
new file mode 100644
index 0000000000..47337e61b9
--- /dev/null
+++ b/layout/xul/test/test_submenuClose.xhtml
@@ -0,0 +1,91 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/css" href="chrome://global/skin"?>
+<?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1181560
+-->
+<window title="Mozilla Bug 1181560"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ onload="SimpleTest.waitForFocus(nextTest, window)">
+ <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
+ <script src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
+
+
+ <!-- test results are displayed in the html:body -->
+ <body xmlns="http://www.w3.org/1999/xhtml">
+ <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1181560"
+ target="_blank">Mozilla Bug 1181560</a>
+ </body>
+
+ <vbox>
+ <menubar>
+ <menu id="menu" label="MyMenu">
+ <menupopup>
+ <menuitem label="A"/>
+ <menu id="b" label="B">
+ <menupopup>
+ <menuitem label="B1"/>
+ </menupopup>
+ </menu>
+ <menu id="c" label="C">
+ <menupopup>
+ <menuitem label="C1"/>
+ </menupopup>
+ </menu>
+ </menupopup>
+ </menu>
+ </menubar>
+ </vbox>
+
+ <!-- test code goes here -->
+ <script type="application/javascript">
+ <![CDATA[
+ /** Test for Bug 1181560 **/
+ SimpleTest.waitForExplicitFinish();
+
+ let menuB, menuC, mainMenu, menuBOpen, menuCOpen;
+ let menuBOpenCount = 0;
+
+ function handleBOpens() {
+ menuBOpenCount++;
+ menuBOpen = true;
+ ok(!menuCOpen, "Menu C should not be open when menu B has opened");
+ if (menuBOpenCount >= 2) {
+ SimpleTest.finish();
+ return;
+ }
+ sendKey("LEFT", window);
+ sendKey("DOWN", window);
+ sendKey("RIGHT", window);
+ }
+
+ function handleBCloses() {
+ menuBOpen = false;
+ }
+
+ function handleCOpens() {
+ menuCOpen = true;
+ ok(!menuBOpen, "Menu B should not be open when menu C has opened");
+ synthesizeMouseAtCenter(menuB, {}, window);
+ }
+
+ function handleCCloses() {
+ menuCOpen = false;
+ }
+
+ function nextTest(e) {
+ mainMenu = document.getElementById("menu");
+ menuB = document.getElementById("b");
+ menuC = document.getElementById("c");
+ menuB.menupopup.addEventListener("popupshown", handleBOpens);
+ menuB.menupopup.addEventListener("popuphidden", handleBCloses);
+ menuC.menupopup.addEventListener("popupshown", handleCOpens);
+ menuC.menupopup.addEventListener("popuphidden", handleCCloses);
+ mainMenu.addEventListener("popupshown", ev => {
+ synthesizeMouseAtCenter(menuB, {}, window);
+ });
+ mainMenu.open = true;
+ }
+ ]]>
+ </script>
+</window>
diff --git a/layout/xul/test/test_toolbarbutton_ctrl_click.xhtml b/layout/xul/test/test_toolbarbutton_ctrl_click.xhtml
new file mode 100644
index 0000000000..b4f1bac5bf
--- /dev/null
+++ b/layout/xul/test/test_toolbarbutton_ctrl_click.xhtml
@@ -0,0 +1,47 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
+<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
+<!--
+ XUL Widget Test for the toolbarbutton element
+ -->
+<window title="Titlebar" width="200" height="200"
+ onload="setTimeout(test_resizer_ctrl_click, 0);"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+<script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
+<script src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
+
+<toolbarbutton id="toolbarbutton" width="16" height="16"/>
+
+<!-- test code goes here -->
+<script type="application/javascript"><![CDATA[
+
+SimpleTest.waitForExplicitFinish();
+
+function test_resizer_ctrl_click()
+{
+ let toolbarbutton = document.getElementById("toolbarbutton");
+ let isCommandFired = false;
+
+ toolbarbutton.addEventListener("click", function(aEvent) {
+ // Delay check for command event, because it is fired after click event.
+ setTimeout(() => {
+ ok(isCommandFired, "Check if command event is fired");
+ SimpleTest.finish();
+ }, 0);
+ });
+ toolbarbutton.addEventListener("command", function(aEvent) {
+ isCommandFired = true;
+ ok(aEvent.ctrlKey, "Check ctrlKey for command event");
+ ok(!aEvent.shiftKey, "Check shiftKey for command event");
+ ok(!aEvent.altKey, "Check altKey for command event");
+ ok(!aEvent.metaKey, "Check metaKey for command event");
+ is(aEvent.inputSource, MouseEvent.MOZ_SOURCE_MOUSE,
+ "Check inputSource for command event");
+ });
+ synthesizeMouseAtCenter(toolbarbutton, { ctrlKey: true });
+}
+
+]]>
+</script>
+
+</window>
diff --git a/layout/xul/test/test_windowminmaxsize.xhtml b/layout/xul/test/test_windowminmaxsize.xhtml
new file mode 100644
index 0000000000..187732dd3d
--- /dev/null
+++ b/layout/xul/test/test_windowminmaxsize.xhtml
@@ -0,0 +1,193 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
+<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
+
+<window title="Window Minimum and Maximum Size Tests" onload="nextTest()"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ xmlns:html="http://www.w3.org/1999/xhtml">
+
+ <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
+ <script src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
+
+<html:style>
+<![CDATA[
+ panel::part(content) {
+ border: 0;
+ padding: 0;
+ margin: 0;
+ }
+]]>
+</html:style>
+
+<panel id="panel" onpopupshown="doPanelTest(this)" onpopuphidden="nextPopupTest(this)"
+ orient="vertical"
+ align="start" pack="start" style="appearance: none; margin: 0; border: 0; padding: 0;">
+ <hbox id="popupresizer" dir="bottomright"
+ style="width: 60px; height: 60px; appearance: none; margin: 0; border: 0; padding: 0;"/>
+</panel>
+
+<script>
+<![CDATA[
+
+SimpleTest.waitForExplicitFinish();
+
+var gTestId = -1;
+
+// width and height in the tests below specify the expected size of the window.
+// note, win8 has a minimum inner window size of around 122 pixels. Don't go below this on min-width tests.
+var tests = [
+ { testname: "unconstrained",
+ src: "windowminmaxsize1.xhtml",
+ width: 150, height: 150 },
+ { testname: "constraint min style",
+ src: "windowminmaxsize2.xhtml",
+ width: 180, height: 210 },
+ { testname: "constraint max style",
+ src: "windowminmaxsize3.xhtml",
+ width: 125, height: 140 },
+ { testname: "constraint min attributes",
+ src: "windowminmaxsize4.xhtml",
+ width: 240, height: 220 },
+ { testname: "constraint min attributes with width and height set",
+ src: "windowminmaxsize5.xhtml",
+ width: 215, height: 235 },
+ { testname: "constraint max attributes",
+ src: "windowminmaxsize6.xhtml",
+ width: 125, height: 95 },
+ // this gets the inner width as <window minwidth='210'> makes the box 210 pixels wide
+ { testname: "constraint min width attribute only",
+ src: "windowminmaxsize7.xhtml",
+ width: 210, height: 150 },
+ { testname: "constraint max width attribute only",
+ src: "windowminmaxsize8.xhtml",
+ width: 128, height: 150 },
+ { testname: "constraint max width attribute with minheight",
+ src: "windowminmaxsize9.xhtml",
+ width: 195, height: 180 },
+ { testname: "constraint minwidth, minheight, maxwidth and maxheight set",
+ src: "windowminmaxsize10.xhtml",
+ width: 150, height: 150 }
+];
+
+var popupTests = [
+ { testname: "popup unconstrained",
+ width: 60, height: 60
+ },
+ { testname: "popup with minimum size",
+ minWidth: 150, minHeight: 180,
+ width: 150, height: 180
+ },
+ { testname: "popup with maximum size",
+ maxWidth: 50, maxHeight: 45,
+ width: 50, height: 45,
+ }
+];
+
+function nextTest()
+{
+ info(`Running test ${gTestId}`);
+ // Run through each of the tests above by opening a simple window with
+ // the attributes or style defined for that test. The comparisons will be
+ // done by windowOpened. gTestId holds the index into the tests array.
+ if (++gTestId >= tests.length) {
+ // Now do the popup tests
+ gTestId = -1;
+ SimpleTest.waitForFocus(function () { nextPopupTest(document.getElementById("panel")) } );
+ }
+ else {
+ info(`opening ${tests[gTestId].src}`);
+ tests[gTestId].window = window.browsingContext.topChromeWindow.open(tests[gTestId].src, "_blank", "chrome,resizable=yes");
+ SimpleTest.waitForFocus(windowOpened, tests[gTestId].window);
+ }
+}
+
+function windowOpened(otherWindow)
+{
+ // Check the width and the width plus one due to bug 696746.
+ ok(otherWindow.innerWidth == tests[gTestId].width ||
+ otherWindow.innerWidth == tests[gTestId].width + 1,
+ tests[gTestId].testname + " width of " + otherWindow.innerWidth + " matches " + tests[gTestId].width);
+ is(otherWindow.innerHeight, tests[gTestId].height, tests[gTestId].testname + " height");
+
+ otherWindow.close();
+ nextTest();
+}
+
+function doPanelTest(panel)
+{
+ var rect = panel.getBoundingClientRect();
+ is(rect.width, popupTests[gTestId].width, popupTests[gTestId].testname + " width");
+ is(rect.height, popupTests[gTestId].height, popupTests[gTestId].testname + " height");
+
+ panel.hidePopup();
+}
+
+function nextPopupTest(panel)
+{
+ if (++gTestId >= popupTests.length) {
+ // Next, check a panel that has a titlebar to ensure that it is accounted for
+ // properly in the size.
+ var titledPanelWindow = window.browsingContext.topChromeWindow.open("titledpanelwindow.xhtml", "_blank", "chrome,resizable=yes");
+ SimpleTest.waitForFocus(titledPanelWindowOpened, titledPanelWindow);
+ }
+ else {
+ function setStyle(attr) {
+ if (attr in popupTests[gTestId])
+ panel.style[attr] = popupTests[gTestId][attr] + "px";
+ else
+ panel.style[attr] = "";
+ }
+ setStyle("minWidth");
+ setStyle("minHeight");
+ setStyle("maxWidth");
+ setStyle("maxHeight");
+
+ // Prevent event loop starvation as a result of popup events being
+ // synchronous. See bug 1131576.
+ SimpleTest.executeSoon(() => {
+ // Non-chrome shells require focus to open a popup.
+ SimpleTest.waitForFocus(() => { panel.openPopup() });
+ });
+ }
+}
+
+function titledPanelWindowOpened(panelwindow)
+{
+ info("titledPanelWindowOpened");
+ var panel = panelwindow.document.documentElement.firstChild;
+ panel.addEventListener("popupshown", () => doTitledPanelTest(panel));
+ panel.addEventListener("popuphidden", () => done(panelwindow));
+ // See above as for why.
+ SimpleTest.executeSoon(() => {
+ SimpleTest.waitForFocus(() => { panel.openPopup() }, panelwindow);
+ });
+}
+
+function doTitledPanelTest(panel)
+{
+ info("doTitledPanelTest");
+ var rect = panel.getBoundingClientRect();
+ is(rect.width, 120, "panel with titlebar width");
+ is(rect.height, 140, "panel with titlebar height");
+ panel.hidePopup();
+}
+
+function done(panelwindow)
+{
+ panelwindow.close();
+ SimpleTest.finish();
+}
+
+]]>
+</script>
+
+<body xmlns="http://www.w3.org/1999/xhtml">
+<p id="display">
+</p>
+<div id="content" style="display: none">
+</div>
+<pre id="test">
+</pre>
+</body>
+
+</window>
diff --git a/layout/xul/test/titledpanelwindow.xhtml b/layout/xul/test/titledpanelwindow.xhtml
new file mode 100644
index 0000000000..4289f8deab
--- /dev/null
+++ b/layout/xul/test/titledpanelwindow.xhtml
@@ -0,0 +1,5 @@
+<?xml-stylesheet href='chrome://global/skin' type='text/css'?>
+<window xmlns='http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul' align='start' pack='start' style='-moz-appearance: none; margin: 0; padding: 0; border: 0;'>
+ <panel noautohide='true' titlebar='normal' style="background: white; min-width: 120px; min-height: 140px"/>
+ <label value='Test'/>
+</window>
diff --git a/layout/xul/test/windowminmaxsize1.xhtml b/layout/xul/test/windowminmaxsize1.xhtml
new file mode 100644
index 0000000000..59f361aced
--- /dev/null
+++ b/layout/xul/test/windowminmaxsize1.xhtml
@@ -0,0 +1,4 @@
+<?xml-stylesheet href='chrome://global/skin' type='text/css'?>
+<window xmlns='http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul' align='start' pack='start' style='-moz-appearance: none; margin: 0; padding: 0; border: 0;'>
+<resizer dir='bottomright' flex='1' style="min-width: 150px; min-height: 150px; appearance: none; margin: 0; border: 0; padding: 0;"/>
+</window>
diff --git a/layout/xul/test/windowminmaxsize10.xhtml b/layout/xul/test/windowminmaxsize10.xhtml
new file mode 100644
index 0000000000..8b568d986f
--- /dev/null
+++ b/layout/xul/test/windowminmaxsize10.xhtml
@@ -0,0 +1,4 @@
+<?xml-stylesheet href='chrome://global/skin' type='text/css'?>
+<window xmlns='http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul' align='start' pack='start' style='-moz-appearance: none; margin: 0; padding: 0; border: 0; min-width: 120px; max-width: 480px; min-height: 110px; max-height: 470px'>
+<resizer dir='bottomright' flex='1' style='min-width: 150px; min-height: 150px; appearance: none; margin: 0; border: 0; padding: 0;'/>
+</window>
diff --git a/layout/xul/test/windowminmaxsize2.xhtml b/layout/xul/test/windowminmaxsize2.xhtml
new file mode 100644
index 0000000000..fb72903dbd
--- /dev/null
+++ b/layout/xul/test/windowminmaxsize2.xhtml
@@ -0,0 +1,4 @@
+<?xml-stylesheet href='chrome://global/skin' type='text/css'?>
+<window xmlns='http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul' align='start' pack='start' style='-moz-appearance: none; margin: 0; padding: 0; border: 0; min-width: 180px; min-height: 210px;'>
+<resizer dir='bottomright' flex='1' style='min-width: 150px; min-height: 150px; appearance: none; margin: 0; border: 0; padding: 0;'/>
+</window>
diff --git a/layout/xul/test/windowminmaxsize3.xhtml b/layout/xul/test/windowminmaxsize3.xhtml
new file mode 100644
index 0000000000..ed6acbe2be
--- /dev/null
+++ b/layout/xul/test/windowminmaxsize3.xhtml
@@ -0,0 +1,4 @@
+<?xml-stylesheet href='chrome://global/skin' type='text/css'?>
+<window xmlns='http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul' align='start' pack='start' style='-moz-appearance: none; margin: 0; padding: 0; border: 0; max-width: 125px; max-height: 140px'>
+<resizer dir='bottomright' flex='1' style='min-width: 150px; min-height: 150px; appearance: none; margin: 0; border: 0; padding: 0;'/>
+</window>
diff --git a/layout/xul/test/windowminmaxsize4.xhtml b/layout/xul/test/windowminmaxsize4.xhtml
new file mode 100644
index 0000000000..e29a48016e
--- /dev/null
+++ b/layout/xul/test/windowminmaxsize4.xhtml
@@ -0,0 +1,4 @@
+<?xml-stylesheet href='chrome://global/skin' type='text/css'?>
+<window xmlns='http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul' align='start' pack='start' style='-moz-appearance: none; margin: 0; padding: 0; border: 0; min-width: 240px; min-height: 220px'>
+<resizer dir='bottomright' flex='1' style='min-width: 150px; min-height: 150px; appearance: none; margin: 0; border: 0; padding: 0;'/>
+</window>
diff --git a/layout/xul/test/windowminmaxsize5.xhtml b/layout/xul/test/windowminmaxsize5.xhtml
new file mode 100644
index 0000000000..7cbce93cc1
--- /dev/null
+++ b/layout/xul/test/windowminmaxsize5.xhtml
@@ -0,0 +1,4 @@
+<?xml-stylesheet href='chrome://global/skin' type='text/css'?>
+<window xmlns='http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul' align='start' pack='start' style='-moz-appearance: none; margin: 0; padding: 0; border: 0; min-width: 215px; min-height: 235px' width='190' height='220'>
+<resizer dir='bottomright' flex='1' style='min-width: 150px; min-height: 150px; appearance: none; margin: 0; border: 0; padding: 0;'/>
+</window>
diff --git a/layout/xul/test/windowminmaxsize6.xhtml b/layout/xul/test/windowminmaxsize6.xhtml
new file mode 100644
index 0000000000..abba98027a
--- /dev/null
+++ b/layout/xul/test/windowminmaxsize6.xhtml
@@ -0,0 +1,4 @@
+<?xml-stylesheet href='chrome://global/skin' type='text/css'?>
+<window xmlns='http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul' align='start' pack='start' style='-moz-appearance: none; margin: 0; padding: 0; border: 0; max-width: 125px; max-height: 95px'>
+<resizer dir='bottomright' flex='1' style='min-width: 150px; min-height: 150px; appearance: none; margin: 0; border: 0; padding: 0;'/>
+</window>
diff --git a/layout/xul/test/windowminmaxsize7.xhtml b/layout/xul/test/windowminmaxsize7.xhtml
new file mode 100644
index 0000000000..f14e2ca4f8
--- /dev/null
+++ b/layout/xul/test/windowminmaxsize7.xhtml
@@ -0,0 +1,4 @@
+<?xml-stylesheet href='chrome://global/skin' type='text/css'?>
+<window xmlns='http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul' align='start' pack='start' style='-moz-appearance: none; margin: 0; padding: 0; border: 0; min-width: 210px'>
+<resizer dir='bottomright' flex='1' style='min-width: 150px; min-height: 150px; appearance: none; margin: 0; border: 0; padding: 0;'/>
+</window>
diff --git a/layout/xul/test/windowminmaxsize8.xhtml b/layout/xul/test/windowminmaxsize8.xhtml
new file mode 100644
index 0000000000..8beff9d32a
--- /dev/null
+++ b/layout/xul/test/windowminmaxsize8.xhtml
@@ -0,0 +1,4 @@
+<?xml-stylesheet href='chrome://global/skin' type='text/css'?>
+<window xmlns='http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul' align='start' pack='start' style='-moz-appearance: none; margin: 0; padding: 0; border: 0; max-width: 128px'>
+<resizer dir='bottomright' flex='1' style='min-width: 150px; min-height: 150px; appearance: none; margin: 0; border: 0; padding: 0;'/>
+</window>
diff --git a/layout/xul/test/windowminmaxsize9.xhtml b/layout/xul/test/windowminmaxsize9.xhtml
new file mode 100644
index 0000000000..b4a06d4ff2
--- /dev/null
+++ b/layout/xul/test/windowminmaxsize9.xhtml
@@ -0,0 +1,4 @@
+<?xml-stylesheet href='chrome://global/skin' type='text/css'?>
+<window xmlns='http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul' align='start' pack='start' style='-moz-appearance: none; margin: 0; padding: 0; border: 0; max-width: 195px; min-height: 180px' width='230' height='120'>
+<resizer dir='bottomright' flex='1' style='min-width: 150px; min-height: 150px; appearance: none; margin: 0; border: 0; padding: 0;'/>
+</window>