diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /browser/components/extensions/test/xpcshell/test_ext_menu_caller.js | |
parent | Initial commit. (diff) | |
download | firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'browser/components/extensions/test/xpcshell/test_ext_menu_caller.js')
-rw-r--r-- | browser/components/extensions/test/xpcshell/test_ext_menu_caller.js | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/browser/components/extensions/test/xpcshell/test_ext_menu_caller.js b/browser/components/extensions/test/xpcshell/test_ext_menu_caller.js new file mode 100644 index 0000000000..5aa04bbc78 --- /dev/null +++ b/browser/components/extensions/test/xpcshell/test_ext_menu_caller.js @@ -0,0 +1,53 @@ +/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* vim: set sts=2 sw=2 et tw=80: */ +"use strict"; + +add_task(async function test_create_menu_ext_error() { + let extension = ExtensionTestUtils.loadExtension({ + manifest: { + permissions: ["menus"], + }, + async background() { + let { fileName } = new Error(); + browser.menus.create({ + id: "muted-tab", + title: "open link with Menu 1", + contexts: ["link"], + }); + await new Promise(resolve => { + browser.menus.create( + { + id: "muted-tab", + title: "open link with Menu 2", + contexts: ["link"], + }, + resolve + ); + }); + browser.test.sendMessage("fileName", fileName); + }, + }); + + let fileName; + const { messages } = await promiseConsoleOutput(async () => { + await extension.startup(); + fileName = await extension.awaitMessage("fileName"); + await extension.unload(); + }); + let [msg] = messages + .filter(m => m.message.includes("Unchecked lastError")) + .map(m => m.QueryInterface(Ci.nsIScriptError)); + equal(msg.sourceName, fileName, "Message source"); + + equal( + msg.errorMessage, + "Unchecked lastError value: Error: ID already exists: muted-tab", + "Message content" + ); + equal(msg.lineNumber, 9, "Message line"); + + let frame = msg.stack; + equal(frame.source, fileName, "Frame source"); + equal(frame.line, 9, "Frame line"); + equal(frame.column, 23, "Frame column"); +}); |