diff --git a/devtools/client/webconsole/test/browser/browser.ini b/devtools/client/webconsole/test/browser/browser.ini index aa98373f5fe7..7c187121077e 100644 --- a/devtools/client/webconsole/test/browser/browser.ini +++ b/devtools/client/webconsole/test/browser/browser.ini @@ -207,6 +207,7 @@ skip-if = verify [browser_jsterm_autocomplete_will_navigate.js] [browser_jsterm_autocomplete-properties-with-non-alphanumeric-names.js] [browser_jsterm_await_assignments.js] +[browser_jsterm_await_concurrent_same_result.js] [browser_jsterm_await_concurrent.js] [browser_jsterm_await_dynamic_import.js] [browser_jsterm_await_error.js] diff --git a/devtools/client/webconsole/test/browser/browser_jsterm_await_concurrent_same_result.js b/devtools/client/webconsole/test/browser/browser_jsterm_await_concurrent_same_result.js new file mode 100644 index 000000000000..bd32882852ec --- /dev/null +++ b/devtools/client/webconsole/test/browser/browser_jsterm_await_concurrent_same_result.js @@ -0,0 +1,41 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +// Test that hitting Ctrl + E does toggle the editor mode. +// See https://bugzilla.mozilla.org/show_bug.cgi?id=1519105 + +"use strict"; + +const TEST_URI = + "data:text/html;charset=utf-8,Test concurrent top-level await expressions returning same value"; + +add_task(async function() { + // Enable editor mode as we'll be able to quicly trigger multiple evaluations. + await pushPref("devtools.webconsole.features.editor", true); + await pushPref("devtools.webconsole.input.editor", true); + + const hud = await openNewTabAndConsole(TEST_URI); + setInputValue( + hud, + `await new Promise(res => setTimeout(() => res("foo"), 5000))` + ); + + info("Evaluate the expression 3 times in a row"); + const executeButton = hud.ui.outputNode.querySelector( + ".webconsole-editor-toolbar-executeButton" + ); + + executeButton.click(); + executeButton.click(); + executeButton.click(); + + await waitFor( + () => findMessages(hud, "foo", ".result").length === 3, + "Waiting for all results to be printed in console", + 1000 + ); + ok(true, "There are as many results as commands"); + + Services.prefs.clearUserPref("devtools.webconsole.features.editor"); + Services.prefs.clearUserPref("devtools.webconsole.input.editor"); +}); diff --git a/devtools/client/webconsole/utils/messages.js b/devtools/client/webconsole/utils/messages.js index 408d7cca05d7..3d1b4e167bc4 100644 --- a/devtools/client/webconsole/utils/messages.js +++ b/devtools/client/webconsole/utils/messages.js @@ -405,6 +405,7 @@ function transformEvaluationResultPacket(packet) { timeStamp, notes, private: packet.private, + allowRepeating: false, }); }