Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

/* Any copyright is dedicated to the Public Domain.
"use strict";
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
});
const { MockRegistrar } = ChromeUtils.importESModule(
);
add_task(async function test_userpass() {
// Setup the prompt to avoid showing it.
let mockPromptService = {
firstTimeCalled: false,
confirmExBC() {
if (!this.firstTimeCalled) {
this.firstTimeCalled = true;
return 0;
}
return 1;
},
QueryInterface: ChromeUtils.generateQI(["nsIPromptService"]),
};
let mockPromptServiceCID = MockRegistrar.register(
"@mozilla.org/prompter;1",
mockPromptService
);
registerCleanupFunction(() => {
MockRegistrar.unregister(mockPromptServiceCID);
});
const pageUrl =
const faviconUrl =
const exposableFaviconUrl =
let faviconPromise = lazy.PlacesTestUtils.waitForNotification(
"favicon-changed",
async () => {
let faviconForExposable = await lazy.PlacesTestUtils.getDatabaseValue(
"moz_icons",
"icon_url",
{
icon_url: exposableFaviconUrl,
}
);
Assert.ok(faviconForExposable, "Found the icon for exposable URL");
let faviconForOriginal = await lazy.PlacesTestUtils.getDatabaseValue(
"moz_icons",
"icon_url",
{
icon_url: faviconUrl,
}
);
Assert.ok(!faviconForOriginal, "Not found the icon for the original URL");
return true;
}
);
await BrowserTestUtils.openNewForegroundTab(gBrowser, pageUrl);
await faviconPromise;
// Clean up.
await PlacesUtils.history.clear();
gBrowser.removeCurrentTab();
});