Bug 1897477 - Update test that uses oncommand for eval. r=Gijs

Differential Revision: https://phabricator.services.mozilla.com/D211721
This commit is contained in:
Tom Schuster 2024-05-29 12:53:33 +00:00
parent 4e4692b083
commit 0f04b017c1

View file

@ -14,7 +14,6 @@ function test() {
let windowsToClose = [];
let testURI = "about:blank";
let pbMenuItem;
let cmd;
function doTest(aIsPrivateMode, aWindow, aCallback) {
BrowserTestUtils.browserLoaded(aWindow.gBrowser.selectedBrowser).then(
@ -24,7 +23,7 @@ function test() {
pbMenuItem = aWindow.document.getElementById("menu_newPrivateWindow");
ok(pbMenuItem, "The Private Browsing menu item exists");
cmd = aWindow.document.getElementById("Tools:PrivateBrowsing");
let cmd = aWindow.document.getElementById("Tools:PrivateBrowsing");
isnot(
cmd,
null,
@ -67,9 +66,10 @@ function test() {
);
}, "domwindowopened");
cmd = aWindow.document.getElementById("Tools:PrivateBrowsing");
var func = new Function("", cmd.getAttribute("oncommand"));
func.call(cmd);
let cmdEvent = aWindow.document.createEvent("xulcommandevent");
cmdEvent.initCommandEvent("command", true, true);
let cmd = aWindow.document.getElementById("Tools:PrivateBrowsing");
cmd.dispatchEvent(cmdEvent);
}
function testOnWindow(aOptions, aCallback) {