Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test gets skipped with pattern: appname == 'thunderbird'
- Manifest: remote/marionette/test/xpcshell/xpcshell.toml
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
const { navigate } = ChromeUtils.importESModule(
"chrome://remote/content/marionette/navigate.sys.mjs"
);
const mockTopContext = {
get children() {
return [mockNestedContext];
},
id: 7,
get top() {
return this;
},
};
const mockNestedContext = {
id: 8,
parent: mockTopContext,
top: mockTopContext,
};
add_task(function test_isLoadEventExpectedForCurrent() {
Assert.throws(
() => navigate.isLoadEventExpected(undefined),
/Expected at least one URL/
);
});
add_task(function test_isLoadEventExpectedForFuture() {
const data = [
];
for (const entry of data) {
const current = new URL(entry.current);
const future = entry.future ? new URL(entry.future) : undefined;
equal(navigate.isLoadEventExpected(current, { future }), entry.expected);
}
});
add_task(function test_isLoadEventExpectedForTarget() {
for (const target of ["_parent", "_top"]) {
Assert.throws(
/Expected browsingContext when target is _parent or _top/
);
}
const data = [
{
target: "_parent",
bc: mockNestedContext,
expected: false,
},
{
target: "_top",
bc: mockNestedContext,
expected: false,
},
];
for (const entry of data) {
const current = entry.cur ? new URL(entry.cur) : undefined;
equal(
navigate.isLoadEventExpected(current, {
target: entry.target,
browsingContext: entry.bc,
}),
entry.expected
);
}
});