diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
commit | 43a97878ce14b72f0981164f87f2e35e14151312 (patch) | |
tree | 620249daf56c0258faa40cbdcf9cfba06de2a846 /browser/base/content/test/plugins/browser_globalplugin_crashinfobar.js | |
parent | Initial commit. (diff) | |
download | firefox-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 'browser/base/content/test/plugins/browser_globalplugin_crashinfobar.js')
-rw-r--r-- | browser/base/content/test/plugins/browser_globalplugin_crashinfobar.js | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/browser/base/content/test/plugins/browser_globalplugin_crashinfobar.js b/browser/base/content/test/plugins/browser_globalplugin_crashinfobar.js new file mode 100644 index 0000000000..97cb9db618 --- /dev/null +++ b/browser/base/content/test/plugins/browser_globalplugin_crashinfobar.js @@ -0,0 +1,63 @@ +"use strict"; + +let { PluginManager } = ChromeUtils.import( + "resource:///actors/PluginParent.jsm" +); + +/** + * Test that the notification bar for crashed GMPs works. + */ +add_task(async function() { + await BrowserTestUtils.withNewTab( + { + gBrowser, + url: "about:blank", + }, + async function(browser) { + // Ensure the parent has heard before the client. + // In practice, this is always true for GMP crashes (but not for NPAPI ones!) + let props = Cc["@mozilla.org/hash-property-bag;1"].createInstance( + Ci.nsIWritablePropertyBag2 + ); + props.setPropertyAsUint32("pluginID", 1); + props.setPropertyAsACString("pluginName", "GlobalTestPlugin"); + props.setPropertyAsACString("pluginDumpID", "1234"); + Services.obs.notifyObservers(props, "gmp-plugin-crash"); + + await SpecialPowers.spawn(browser, [], async function() { + const GMP_CRASH_EVENT = { + pluginID: 1, + pluginName: "GlobalTestPlugin", + submittedCrashReport: false, + bubbles: true, + cancelable: true, + gmpPlugin: true, + }; + + let crashEvent = new content.PluginCrashedEvent( + "PluginCrashed", + GMP_CRASH_EVENT + ); + content.dispatchEvent(crashEvent); + }); + + let notification = await waitForNotificationBar( + "plugin-crashed", + browser + ); + + let notificationBox = gBrowser.getNotificationBox(browser); + ok(notification, "Infobar was shown."); + is( + notification.priority, + notificationBox.PRIORITY_WARNING_MEDIUM, + "Correct priority." + ); + is( + notification.messageText.textContent, + "The GlobalTestPlugin plugin has crashed.", + "Correct message." + ); + } + ); +}); |