Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

/* Any copyright is dedicated to the Public Domain.
"use strict";
add_task(async function test_OPEN_URL() {
const action = {
type: "OPEN_URL",
data: { args: EXAMPLE_URL, where: "current" },
};
await BrowserTestUtils.withNewTab("about:blank", async browser => {
const loaded = BrowserTestUtils.browserLoaded(browser);
await SMATestUtils.executeAndValidateAction(action);
const url = await loaded;
Assert.equal(
url,
"should open URL in the same tab"
);
});
});
add_task(async function test_OPEN_URL_new_tab() {
const action = {
type: "OPEN_URL",
data: { args: EXAMPLE_URL, where: "tab" },
};
const tabPromise = BrowserTestUtils.waitForNewTab(gBrowser, EXAMPLE_URL);
await SpecialMessageActions.handleAction(action, gBrowser);
const browser = await tabPromise;
ok(browser, "should open URL in a new tab");
BrowserTestUtils.removeTab(browser);
});