summaryrefslogtreecommitdiffstats
path: root/toolkit/crashreporter/test/browser/browser_bug471404.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
commit43a97878ce14b72f0981164f87f2e35e14151312 (patch)
tree620249daf56c0258faa40cbdcf9cfba06de2a846 /toolkit/crashreporter/test/browser/browser_bug471404.js
parentInitial commit. (diff)
downloadfirefox-43a97878ce14b72f0981164f87f2e35e14151312.tar.xz
firefox-43a97878ce14b72f0981164f87f2e35e14151312.zip
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'toolkit/crashreporter/test/browser/browser_bug471404.js')
-rw-r--r--toolkit/crashreporter/test/browser/browser_bug471404.js61
1 files changed, 61 insertions, 0 deletions
diff --git a/toolkit/crashreporter/test/browser/browser_bug471404.js b/toolkit/crashreporter/test/browser/browser_bug471404.js
new file mode 100644
index 0000000000..f520fe2881
--- /dev/null
+++ b/toolkit/crashreporter/test/browser/browser_bug471404.js
@@ -0,0 +1,61 @@
+function check_clear_visible(browser, aVisible) {
+ return SpecialPowers.spawn(browser, [aVisible], function(aVisible) {
+ const doc = content.document;
+ let visible = false;
+ const reportListSubmitted = doc.getElementById("reportListSubmitted");
+ if (reportListSubmitted) {
+ const style = doc.defaultView.getComputedStyle(reportListSubmitted);
+ if (style.display !== "none" && style.visibility === "visible") {
+ visible = true;
+ }
+ }
+ Assert.equal(
+ visible,
+ aVisible,
+ "clear submitted reports button is " + (aVisible ? "visible" : "hidden")
+ );
+ });
+}
+
+// each test here has a setup (run before loading about:crashes) and onload (run after about:crashes loads)
+var _tests = [
+ {
+ setup: null,
+ onload(browser) {
+ return check_clear_visible(browser, false);
+ },
+ },
+ {
+ setup(crD) {
+ return add_fake_crashes(crD, 1);
+ },
+ onload(browser) {
+ return check_clear_visible(browser, true);
+ },
+ },
+];
+
+add_task(async function test() {
+ let appD = make_fake_appdir();
+ let crD = appD.clone();
+ crD.append("Crash Reports");
+
+ await BrowserTestUtils.withNewTab(
+ { gBrowser, url: "about:blank" },
+ async function(browser) {
+ for (let test of _tests) {
+ // Run setup before loading about:crashes.
+ if (test.setup) {
+ await test.setup(crD);
+ }
+
+ BrowserTestUtils.loadURI(browser, "about:crashes");
+ await BrowserTestUtils.browserLoaded(browser).then(() =>
+ test.onload(browser)
+ );
+ }
+ }
+ );
+
+ cleanup_fake_appdir();
+});