summaryrefslogtreecommitdiffstats
path: root/gfx/tests/browser/browser_windowless_troubleshoot_crash.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
commit6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch)
treea68f146d7fa01f0134297619fbe7e33db084e0aa /gfx/tests/browser/browser_windowless_troubleshoot_crash.js
parentInitial commit. (diff)
downloadthunderbird-upstream.tar.xz
thunderbird-upstream.zip
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'gfx/tests/browser/browser_windowless_troubleshoot_crash.js')
-rw-r--r--gfx/tests/browser/browser_windowless_troubleshoot_crash.js54
1 files changed, 54 insertions, 0 deletions
diff --git a/gfx/tests/browser/browser_windowless_troubleshoot_crash.js b/gfx/tests/browser/browser_windowless_troubleshoot_crash.js
new file mode 100644
index 0000000000..44fc50e2f8
--- /dev/null
+++ b/gfx/tests/browser/browser_windowless_troubleshoot_crash.js
@@ -0,0 +1,54 @@
+add_task(async function test_windowlessBrowserTroubleshootCrash() {
+ let webNav = Services.appShell.createWindowlessBrowser(false);
+
+ let onLoaded = new Promise((resolve, reject) => {
+ let docShell = webNav.docShell;
+ let listener = {
+ observe(contentWindow, topic, data) {
+ let observedDocShell =
+ contentWindow.docShell.sameTypeRootTreeItem.QueryInterface(
+ Ci.nsIDocShell
+ );
+ if (docShell === observedDocShell) {
+ Services.obs.removeObserver(
+ listener,
+ "content-document-global-created"
+ );
+ resolve();
+ }
+ },
+ };
+ Services.obs.addObserver(listener, "content-document-global-created");
+ });
+ let loadURIOptions = {
+ triggeringPrincipal: Services.scriptSecurityManager.createNullPrincipal({}),
+ };
+ webNav.loadURI(Services.io.newURI("about:blank"), loadURIOptions);
+
+ await onLoaded;
+
+ let winUtils = webNav.document.defaultView.windowUtils;
+ try {
+ let layerManager = winUtils.layerManagerType;
+ ok(
+ layerManager == "Basic" || layerManager == "WebRender (Software)",
+ "windowless browser's layerManagerType should be 'Basic' or 'WebRender (Software)'"
+ );
+ } catch (e) {
+ // The windowless browser may not have a layermanager at all yet, and that's ok.
+ // The troubleshooting code similarly skips over windows with no layer managers.
+ }
+ ok(true, "not crashed");
+
+ var { Troubleshoot } = ChromeUtils.importESModule(
+ "resource://gre/modules/Troubleshoot.sys.mjs"
+ );
+ var data = await Troubleshoot.snapshot();
+
+ ok(
+ data.graphics.windowLayerManagerType !== "None",
+ "windowless browser window should not set windowLayerManagerType to 'None'"
+ );
+
+ webNav.close();
+});