Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

/* Any copyright is dedicated to the Public Domain.
"use strict";
// Tests that the view results are cleared and the view is closed, when an empty
// result set arrives after a non-empty one.
add_task(async function () {
await UrlbarTestUtils.promiseAutocompleteResultPopup({
window,
value: "foo",
});
Assert.greater(
UrlbarTestUtils.getResultCount(window),
0,
`There should be some results in the view.`
);
Assert.ok(gURLBar.view.isOpen, `The view should be open.`);
// Register an high priority empty result provider.
let provider = new UrlbarTestUtils.TestProvider({
results: [],
priority: 999,
});
let providersManager = ProvidersManager.getInstanceForSap("urlbar");
providersManager.registerProvider(provider);
registerCleanupFunction(async function () {
providersManager.unregisterProvider(provider);
await PlacesUtils.history.clear();
});
await UrlbarTestUtils.promiseAutocompleteResultPopup({
window,
value: "foo",
});
Assert.equal(
UrlbarTestUtils.getResultCount(window),
0,
`There should be no results in the view.`
);
Assert.ok(!gURLBar.view.isOpen, `The view should have been closed.`);
});