fune/browser/base/content/test/plugins/browser_globalplugin_crashinfobar.js
Norisz Fay 0d4fc02631 Backed out 7 changesets (bug 1845150) for causing failures on browser_datachoices_notification.js CLOSED TREE
Backed out changeset a07c835a4bf7 (bug 1845150)
Backed out changeset 0016d7f4e556 (bug 1845150)
Backed out changeset 46cfe5fe6e6a (bug 1845150)
Backed out changeset 83190b8a08d0 (bug 1845150)
Backed out changeset ada948351267 (bug 1845150)
Backed out changeset 7aa4340bfd96 (bug 1845150)
Backed out changeset 683745289588 (bug 1845150)
2024-01-05 18:52:01 +02:00

63 lines
1.8 KiB
JavaScript

"use strict";
let { PluginManager } = ChromeUtils.importESModule(
"resource:///actors/PluginParent.sys.mjs"
);
/**
* 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."
);
}
);
});