Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

/* Any copyright is dedicated to the Public Domain.
"use strict";
// Gecko drops an editor's undo history when its frame is reconstructed
// (bug 2017065), so opening and closing the view must not reconstruct the
// input's frame (bug 2061633).
add_task(async function undoAfterViewClose() {
await UrlbarTestUtils.promisePopupOpen(window, () => {
gURLBar.focus();
EventUtils.sendString("example");
});
await UrlbarTestUtils.promiseSearchComplete(window);
Assert.equal(gURLBar.value, "example", "The string was typed.");
await UrlbarTestUtils.promisePopupClose(window);
let controller =
document.commandDispatcher.getControllerForCommand("cmd_undo");
Assert.ok(
controller.isCommandEnabled("cmd_undo"),
"Undo is available after the view closed."
);
goDoCommand("cmd_undo");
Assert.equal(gURLBar.value, "", "Undo removed the typed string.");
gURLBar.blur();
});