summaryrefslogtreecommitdiffstats
path: root/layout/base/tests
diff options
context:
space:
mode:
Diffstat (limited to 'layout/base/tests')
-rw-r--r--layout/base/tests/browser.toml6
-rw-r--r--layout/base/tests/browser_animatedImageLeak.js226
-rw-r--r--layout/base/tests/bug1896051-ref.html29
-rw-r--r--layout/base/tests/bug1896051.html38
-rw-r--r--layout/base/tests/helper_animatedImageLeak.html10
-rw-r--r--layout/base/tests/helper_bug1733509.html30
-rw-r--r--layout/base/tests/mochitest.toml3
-rw-r--r--layout/base/tests/test_event_target_radius.html56
-rw-r--r--layout/base/tests/test_reftests_with_caret.html1
9 files changed, 397 insertions, 2 deletions
diff --git a/layout/base/tests/browser.toml b/layout/base/tests/browser.toml
index a5b279145f..cc8df52306 100644
--- a/layout/base/tests/browser.toml
+++ b/layout/base/tests/browser.toml
@@ -3,6 +3,12 @@ prefs = [
"layout.css.properties-and-values.enabled=true",
]
+["browser_animatedImageLeak.js"]
+skip-if = ["!debug"]
+support-files = [
+ "helper_animatedImageLeak.html"
+]
+
["browser_bug617076.js"]
["browser_bug1701027-1.js"]
diff --git a/layout/base/tests/browser_animatedImageLeak.js b/layout/base/tests/browser_animatedImageLeak.js
new file mode 100644
index 0000000000..2c34ed9d89
--- /dev/null
+++ b/layout/base/tests/browser_animatedImageLeak.js
@@ -0,0 +1,226 @@
+/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
+/* vim: set sts=2 sw=2 et tw=80: */
+"use strict";
+
+requestLongerTimeout(4);
+
+/*
+ * This tests that when we have an animated image in a minimized window we
+ * don't leak.
+ * We've encountered this bug in 3 different ways:
+ * -bug 1830753 - images in top level chrome processes
+ * (we avoid processing them due to their CompositorBridgeChild being paused)
+ * -bug 1839109 - images in content processes
+ * (we avoid processing them due to their refresh driver being throttled, this
+ * would also fix the above case)
+ * -bug 1875100 - images that are in a content iframe that is not the content
+ * of a tab, so something like an extension iframe in the sidebar
+ * (this was fixed by making the content of a tab declare that it manually
+ * manages its activeness and having all other iframes inherit their
+ * activeness from their parent)
+ * In order to hit this bug we require
+ * -the same image to be in a minimized window and in a non-mininmized window
+ * so that the image is animated.
+ * -the animated image to go over the
+ * image.animated.decode-on-demand.threshold-kb threshold so that we do not
+ * keep all of its frames around (if we keep all its frame around then we
+ * don't try to keep allocating frames and not freeing the old ones)
+ * -it has to be the same Image object in memory, not just the same uri
+ * Then the visible copy of the image keeps generating new frames, those frames
+ * get sent to the minimized copies of the image but they never get processed
+ * or marked displayed so they can never be freed/reused.
+ *
+ * Note that due to bug 1889840, in order to test this we can't use an image
+ * loaded at the top level (see the last point above). We must use an html page
+ * that contains the image.
+ */
+
+// this test is based in part on https://searchfox.org/mozilla-central/rev/c09764753ea40725eb50decad2c51edecbd33308/browser/components/extensions/test/browser/browser_ext_sidebarAction.js
+
+async function pushPrefs1() {
+ await SpecialPowers.pushPrefEnv({
+ set: [
+ ["image.animated.decode-on-demand.threshold-kb", 1],
+ ["image.animated.decode-on-demand.batch-size", 2],
+ ],
+ });
+}
+
+async function openWindowsAndMinimize(taskToPerformBeforeMinimize) {
+ let wins = [null, null, null, null];
+ for (let i = 0; i < wins.length; i++) {
+ let win = await BrowserTestUtils.openNewBrowserWindow();
+ await win.delayedStartupPromise;
+ await taskToPerformBeforeMinimize(win);
+
+ // Leave the last window un-minimized.
+ if (i < wins.length - 1) {
+ let promiseSizeModeChange = BrowserTestUtils.waitForEvent(
+ win,
+ "sizemodechange"
+ );
+ win.minimize();
+ await promiseSizeModeChange;
+ }
+
+ wins[i] = win;
+ }
+ return wins;
+}
+
+async function pushPrefs2() {
+ // wait so that at least one frame of the animation has been shown while the
+ // below pref is not set so that the counter gets reset.
+ await new Promise(resolve => setTimeout(resolve, 500));
+
+ await SpecialPowers.pushPrefEnv({
+ set: [["gfx.testing.assert-render-textures-increase", 75]],
+ });
+}
+
+async function waitForEnoughFrames() {
+ // we want to wait for over 75 frames of the image, it has a delay of 200ms
+ // Windows debug test machines seem to animate at about 10 fps though
+ await new Promise(resolve => setTimeout(resolve, 20000));
+}
+
+async function closeWindows(wins) {
+ for (let i = 0; i < wins.length; i++) {
+ await BrowserTestUtils.closeWindow(wins[i]);
+ }
+}
+
+async function popPrefs() {
+ await SpecialPowers.popPrefEnv();
+ await SpecialPowers.popPrefEnv();
+}
+
+add_task(async () => {
+ async function runTest(theTestPath) {
+ await pushPrefs1();
+
+ let wins = await openWindowsAndMinimize(async function (win) {
+ let tab = await BrowserTestUtils.openNewForegroundTab(
+ win.gBrowser,
+ theTestPath
+ );
+ });
+
+ await pushPrefs2();
+
+ await waitForEnoughFrames();
+
+ await closeWindows(wins);
+
+ await popPrefs();
+
+ ok(true, "got here without assserting");
+ }
+
+ function fileURL(filename) {
+ let ifile = getChromeDir(getResolvedURI(gTestPath));
+ ifile.append(filename);
+ return Services.io.newFileURI(ifile).spec;
+ }
+
+ // This tests the image in content process case
+ await runTest(fileURL("helper_animatedImageLeak.html"));
+ // This tests the image in chrome process case
+ await runTest(getRootDirectory(gTestPath) + "helper_animatedImageLeak.html");
+});
+
+// Now we test the image in a sidebar loaded via an extension case.
+
+/*
+ * The data uri below is a 2kb apng that is 3000x200 with 22 frames with delay
+ * of 200ms, it just toggles the color of one pixel from black to red so it's
+ * tiny. We use the same data uri (although that is not important to this test)
+ * in helper_animatedImageLeak.html.
+ */
+
+/*
+ * This is just data to create a simple extension that creates a sidebar with
+ * an image in it.
+ */
+let extData = {
+ manifest: {
+ sidebar_action: {
+ default_panel: "sidebar.html",
+ },
+ },
+ useAddonManager: "temporary",
+
+ files: {
+ "sidebar.html": `
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="UTF-8">
+ <script src="sidebar.js"></script>
+ </head>
+ <body><p>Sidebar</p>
+ <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAC7gAAADICAMAAABP7lxwAAAACGFjVEwAAAAWAAAAAGbtojIAAAAJUExURQAAAAAAAP8AAD373S0AAAABdFJOUwBA5thmAAAAGmZjVEwAAAAAAAALuAAAAMgAAAA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AABAADlJ9/tQAAABpmY1RMAAAAHwAAAAEAAAABAAAAAQAAAAEAyAPoAAAWIpjqAAAADmZkQVQAAAAgeNpjYAQAAAMAAkqS2qEAAAAaZmNUTAAAACEAAAABAAAAAQAAAAEAAAABAMgD6AAA+MYjYgAAAA5mZEFUAAAAInjaY2ACAAAEAAO276ZuAAAAGmZjVEwAAAAjAAAAAQAAAAEAAAABAAAAAQDIA+gAABVQ8IsAAAAOZmRBVAAAACR42mNgBAAAAwAC+kupIwAAABpmY1RMAAAAJQAAAAEAAAABAAAAAQAAAAEAyAPoAAD4moLxAAAADmZkQVQAAAAmeNpjYAIAAAQAAwY21ewAAAAaZmNUTAAAACcAAAABAAAAAQAAAAEAAAABAMgD6AAAFQxRGAAAAA5mZEFUAAAAKHjaY2AEAAADAALwUTvkAAAAGmZjVEwAAAApAAAAAQAAAAEAAAABAAAAAQDIA+gAAPh/YEQAAAAOZmRBVAAAACp42mNgAgAABAADDCxHKwAAABt0RVh0U29mdHdhcmUAQVBORyBBc3NlbWJsZXIgMy4wXkUsHAAAAABJRU5ErkJggg=="/>
+ </body>
+</html>
+ `,
+
+ "sidebar.js": function () {
+ window.onload = () => {
+ browser.test.sendMessage("sidebar");
+ };
+ },
+ },
+};
+
+function getExtData(manifestUpdates = {}) {
+ return {
+ ...extData,
+ manifest: {
+ ...extData.manifest,
+ ...manifestUpdates,
+ },
+ };
+}
+
+async function sendMessage(ext, msg, data = undefined) {
+ ext.sendMessage({ msg, data });
+ await ext.awaitMessage("done");
+}
+
+add_task(async function sidebar_initial_install() {
+ await pushPrefs1();
+
+ ok(
+ document.getElementById("sidebar-box").hidden,
+ "sidebar box is not visible"
+ );
+
+ let extension = ExtensionTestUtils.loadExtension(getExtData());
+ await extension.startup();
+ await extension.awaitMessage("sidebar");
+
+ // Test sidebar is opened on install
+ ok(!document.getElementById("sidebar-box").hidden, "sidebar box is visible");
+
+ // the sidebar appears on all new windows automatically.
+ let wins = await openWindowsAndMinimize(async function (win) {
+ await extension.awaitMessage("sidebar");
+ });
+
+ await pushPrefs2();
+
+ await waitForEnoughFrames();
+
+ await extension.unload();
+ // Test that the sidebar was closed on unload.
+ ok(
+ document.getElementById("sidebar-box").hidden,
+ "sidebar box is not visible"
+ );
+
+ await closeWindows(wins);
+
+ await popPrefs();
+
+ ok(true, "got here without assserting");
+});
diff --git a/layout/base/tests/bug1896051-ref.html b/layout/base/tests/bug1896051-ref.html
new file mode 100644
index 0000000000..39b26f148d
--- /dev/null
+++ b/layout/base/tests/bug1896051-ref.html
@@ -0,0 +1,29 @@
+<!doctype html>
+<html class="reftest-wait">
+<script src="/tests/SimpleTest/EventUtils.js"></script>
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<style>
+ textarea {
+ font: 13px / 1 monospace;
+ border: 1px solid;
+ padding: 0;
+ overflow: hidden;
+ resize: none;
+ }
+</style>
+<textarea rows=5>
+a
+b
+c
+d
+</textarea>
+<script>
+SimpleTest.waitForFocus(function() {
+ let textarea = document.querySelector("textarea");
+ textarea.focus();
+ textarea.selectionStart = textarea.selectionEnd = textarea.value.length;
+ setTimeout(() => {
+ document.documentElement.removeAttribute("class");
+ }, 0);
+});
+</script>
diff --git a/layout/base/tests/bug1896051.html b/layout/base/tests/bug1896051.html
new file mode 100644
index 0000000000..ba35339475
--- /dev/null
+++ b/layout/base/tests/bug1896051.html
@@ -0,0 +1,38 @@
+<!doctype html>
+<html class="reftest-wait">
+<script src="/tests/SimpleTest/EventUtils.js"></script>
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<style>
+ textarea {
+ font: 13px / 1 monospace;
+ border: 1px solid;
+ padding: 0;
+ overflow: hidden;
+ resize: none;
+ }
+</style>
+<textarea rows=5>
+a
+b
+c
+d
+</textarea>
+<script>
+SimpleTest.waitForFocus(function() {
+ let textarea = document.querySelector("textarea");
+ textarea.focus();
+ if (navigator.platform.startsWith("Mac")) {
+ // On mac there is no page down key that moves the selection, afaict.
+ // (Fn+Arrow moves the scroll position but not selection).
+ // Do the next thing which would be something like Cmd+Down to move to the
+ // end. That tests a different code-path altogether, but for this test it
+ // doesn't matter.
+ synthesizeKey("KEY_ArrowDown", { metaKey: true });
+ } else {
+ synthesizeKey("KEY_PageDown");
+ }
+ setTimeout(() => {
+ document.documentElement.removeAttribute("class")
+ }, 0);
+});
+</script>
diff --git a/layout/base/tests/helper_animatedImageLeak.html b/layout/base/tests/helper_animatedImageLeak.html
new file mode 100644
index 0000000000..a5555f1fbb
--- /dev/null
+++ b/layout/base/tests/helper_animatedImageLeak.html
@@ -0,0 +1,10 @@
+<html>
+<!--
+ The data uri below is a 2kb apng that is 3000x200 with 22 frames with delay
+ of 200ms, it just toggles the color of one pixel from black to red so it's
+ tiny. We use the same data uri (although that is not important to this test)
+ in browser_animatedImageLeak.js.
+-->
+
+<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAC7gAAADICAMAAABP7lxwAAAACGFjVEwAAAAWAAAAAGbtojIAAAAJUExURQAAAAAAAP8AAD373S0AAAABdFJOUwBA5thmAAAAGmZjVEwAAAAAAAALuAAAAMgAAAAAAAAAAADIA+gAALdBHhgAAAJgSURBVHja7dABCQAAAAKg+n+6HYFOMAEAAA5UAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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AOZmRBVAAAACp42mNgAgAABAADDCxHKwAAABt0RVh0U29mdHdhcmUAQVBORyBBc3NlbWJsZXIgMy4wXkUsHAAAAABJRU5ErkJggg=="/>
+</html>
diff --git a/layout/base/tests/helper_bug1733509.html b/layout/base/tests/helper_bug1733509.html
new file mode 100644
index 0000000000..4fbdacdb46
--- /dev/null
+++ b/layout/base/tests/helper_bug1733509.html
@@ -0,0 +1,30 @@
+<html>
+<script src="/tests/SimpleTest/EventUtils.js"></script>
+<script src="/tests/SimpleTest/paint_listener.js"></script>
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="/tests/gfx/layers/apz/test/mochitest/apz_test_utils.js"></script>
+<style>
+ body {
+ margin: 0;
+ padding: 20;
+ background-color: blueviolet;
+ }
+
+ button {
+ margin: 0;
+ }
+</style>
+
+<body>
+ <button id="btn">Click me</button>
+</body>
+
+<script>
+ // Silence SimpleTest warning about missing assertions by having it wait
+ // indefinitely. We don't need to give it an explicit finish because the
+ // entire window this test runs in will be closed after the main browser test
+ // finished.
+ SimpleTest.waitForExplicitFinish();
+</script>
+
+</html>
diff --git a/layout/base/tests/mochitest.toml b/layout/base/tests/mochitest.toml
index 24924809c0..f74c6b030d 100644
--- a/layout/base/tests/mochitest.toml
+++ b/layout/base/tests/mochitest.toml
@@ -247,6 +247,7 @@ support-files = ["file_dynamic_toolbar_max_height.html"]
["test_emulate_color_scheme.html"]
["test_event_target_radius.html"]
+support-files = ["helper_bug1733509.html"]
skip-if = ["xorigin"] # JavaScript error: resource://specialpowers/SpecialPowersChild.sys.mjs, line 73: SecurityError: Permission denied to access property "windowUtils" on cross-origin object
["test_frame_reconstruction_body_table.html"]
@@ -558,6 +559,8 @@ support-files = [
"bug1518339-2-ref.html",
"bug1529492-1.html",
"bug1529492-1-ref.html",
+ "bug1896051.html",
+ "bug1896051-ref.html",
"chrome/blue-32x32.png",
]
diff --git a/layout/base/tests/test_event_target_radius.html b/layout/base/tests/test_event_target_radius.html
index caf046cf99..a1e8d9c16c 100644
--- a/layout/base/tests/test_event_target_radius.html
+++ b/layout/base/tests/test_event_target_radius.html
@@ -2,14 +2,19 @@
<html id="html" style="height:100%">
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=780847
+https://bugzilla.mozilla.org/show_bug.cgi?id=1733509
-->
<head>
<title>Test radii for mouse events</title>
- <script src="/tests/SimpleTest/SimpleTest.js"></script>
<script src="/tests/SimpleTest/EventUtils.js"></script>
+ <script src="/tests/SimpleTest/paint_listener.js"></script>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="text/javascript" src="/tests/gfx/layers/apz/test/mochitest/apz_test_utils.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<style>
.target { position:absolute; left:100px; top:100px; width:100px; height:100px; background:blue; }
+ .scaled { background: green; transform: scale(0.5); }
+ iframe { margin:0; padding:0; width:50; height:50; border:1px solid black; background:yellowgreen; }
</style>
</head>
<body id="body" onload="setTimeout(startTest, 0)" style="margin:0; width:100%; height:100%; overflow:hidden">
@@ -73,6 +78,10 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=780847
<div id="t13_touchlistener" style="width: 50px; height: 50px; background:red" ontouchend="x=1"></div>
<div id="t13_notouchlistener" style="width: 50px; height: 50px; background:green"></div>
</div>
+
+ <div id="t14" class="target scaled" hidden>
+ <iframe id="t14iframe"></iframe>
+ </div>
</div>
<pre id="test">
<script type="application/javascript">
@@ -414,7 +423,50 @@ function testTouchable() {
testTouch("t13", 10, 50 - (2*mm), "t13_touchlistener", "touch inside t13_touchlistener bottom edge");
setShowing("t13", false);
- endTest();
+ test4();
+}
+
+// https://bugzilla.mozilla.org/show_bug.cgi?id=1733509
+function test4() {
+ // Skip non-Fission for now because of bug 1890522
+ if (SpecialPowers.Services.appinfo.fissionAutostart) {
+ waitUntilApzStable().then(async () => doTest4()).then(endTest);
+ } else {
+ endTest();
+ }
+}
+
+async function doTest4() {
+ setShowing("t14", true);
+
+ let iframeURL = SimpleTest.getTestFileURL("helper_bug1733509.html");
+ // todo: Also perform this test for an in-process iframe
+ // once bug 1890522 is fixed.
+ const iframe = document.querySelector("#t14iframe");
+ iframeURL = iframeURL.replace(window.location.origin, "https://example.com");
+ await setupIframe(iframe, iframeURL);
+
+ var result = await SpecialPowers.spawn(iframe, [], async () => {
+ await content.wrappedJSObject.waitUntilApzStable();
+ var iframeEventTarget = null;
+ content.window.onmousedown = function (event) { iframeEventTarget = event.target; };
+ content.wrappedJSObject.synthesizeMouse(content.document.documentElement, 2, 2, {});
+ return iframeEventTarget && iframeEventTarget.id === "btn";
+ });
+
+ ok(result, "Failed to target button inside iframe");
+ setShowing("t14", false);
+}
+
+async function setupIframe(aIFrame, aURL) {
+ const iframeLoadPromise = promiseOneEvent(aIFrame, "load", null);
+ aIFrame.src = aURL;
+ await iframeLoadPromise;
+
+ await SpecialPowers.spawn(aIFrame, [], async () => {
+ await content.wrappedJSObject.waitUntilApzStable();
+ await SpecialPowers.contentTransformsReceived(content);
+ });
}
</script>
</pre>
diff --git a/layout/base/tests/test_reftests_with_caret.html b/layout/base/tests/test_reftests_with_caret.html
index 3935380e5d..d134bd2eb9 100644
--- a/layout/base/tests/test_reftests_with_caret.html
+++ b/layout/base/tests/test_reftests_with_caret.html
@@ -112,6 +112,7 @@ var tests = [
[ 'bug613807-1.html' , 'bug613807-1-ref.html' ] ,
[ 'bug1082486-1.html', 'bug1082486-1-ref.html'] ,
[ 'bug1082486-2.html', 'bug1082486-2-ref.html'] ,
+ [ 'bug1896051.html', 'bug1896051-ref.html'],
// The following test cases uses mouse events. We need to make
// AccessibleCaret unhide for them.
function() {SpecialPowers.pushPrefEnv({'set': [['layout.accessiblecaret.hide_carets_for_mouse_input', false]]}, nextTest);} ,