From 6bf0a5cb5034a7e684dcc3500e841785237ce2dd Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 19:32:43 +0200 Subject: Adding upstream version 1:115.7.0. Signed-off-by: Daniel Baumann --- .../test/tabs/browser_tabswitch_updatecommands.js | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 browser/base/content/test/tabs/browser_tabswitch_updatecommands.js (limited to 'browser/base/content/test/tabs/browser_tabswitch_updatecommands.js') diff --git a/browser/base/content/test/tabs/browser_tabswitch_updatecommands.js b/browser/base/content/test/tabs/browser_tabswitch_updatecommands.js new file mode 100644 index 0000000000..b5d2762eec --- /dev/null +++ b/browser/base/content/test/tabs/browser_tabswitch_updatecommands.js @@ -0,0 +1,28 @@ +// This test ensures that only one command update happens when switching tabs. + +"use strict"; + +add_task(async function () { + const uri = "data:text/html,"; + let tab1 = await BrowserTestUtils.openNewForegroundTab(gBrowser, uri); + let tab2 = await BrowserTestUtils.openNewForegroundTab(gBrowser, uri); + + let updates = []; + function countUpdates(event) { + updates.push(new Error().stack); + } + let updater = document.getElementById("editMenuCommandSetAll"); + updater.addEventListener("commandupdate", countUpdates, true); + await BrowserTestUtils.switchTab(gBrowser, tab1); + + is(updates.length, 1, "only one command update per tab switch"); + if (updates.length > 1) { + for (let stack of updates) { + info("Update stack:\n" + stack); + } + } + + updater.removeEventListener("commandupdate", countUpdates, true); + BrowserTestUtils.removeTab(tab1); + BrowserTestUtils.removeTab(tab2); +}); -- cgit v1.2.3