diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
commit | 2aa4a82499d4becd2284cdb482213d541b8804dd (patch) | |
tree | b80bf8bf13c3766139fbacc530efd0dd9d54394c /gfx/tests/browser/browser_windowless_troubleshoot_crash.js | |
parent | Initial commit. (diff) | |
download | firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.tar.xz firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.zip |
Adding upstream version 86.0.1.upstream/86.0.1upstream
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.js | 58 |
1 files changed, 58 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..9afce41163 --- /dev/null +++ b/gfx/tests/browser/browser_windowless_troubleshoot_crash.js @@ -0,0 +1,58 @@ +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("about:blank", loadURIOptions); + + await onLoaded; + + let winUtils = webNav.document.defaultView.windowUtils; + try { + is( + winUtils.layerManagerType, + "Basic", + "windowless browser's layerManagerType should be 'Basic'" + ); + } 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.import( + "resource://gre/modules/Troubleshoot.jsm", + {} + ).Troubleshoot; + var data = await new Promise((resolve, reject) => { + Troubleshoot.snapshot(data => { + resolve(data); + }); + }); + + ok( + data.graphics.windowLayerManagerType !== "None", + "windowless browser window should not set windowLayerManagerType to 'None'" + ); + + webNav.close(); +}); |