mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-23 02:05:42 +00:00
Bug 1576085 - Don't allow evaluation results to be repeated. r=Honza.
With top-level await, we can now have multiple evaluation results next to each others. Which means that if they had the same repeatId, we would only print the first result. We fix that by not allowing evaluation results to be repeated. A mochitest is added to ensure the patch properly fixes the issue. Differential Revision: https://phabricator.services.mozilla.com/D43253 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
7c3097eb13
commit
7f5a19c884
@ -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]
|
||||
|
@ -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");
|
||||
});
|
@ -405,6 +405,7 @@ function transformEvaluationResultPacket(packet) {
|
||||
timeStamp,
|
||||
notes,
|
||||
private: packet.private,
|
||||
allowRepeating: false,
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user