Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test gets skipped with pattern: display == 'wayland'
- Manifest: remote/cdp/test/browser/browser.toml
/* Any copyright is dedicated to the Public Domain.
"use strict";
// Test very basic CDP features.
add_task(async function ({ CDP }) {
const { mainProcessTarget } = RemoteAgent.cdp.targetList;
ok(
mainProcessTarget,
"The main process target is instantiated after the call to `listen`"
);
const targetURL = mainProcessTarget.wsDebuggerURL;
const client = await CDP({ target: targetURL });
info("CDP client has been instantiated");
try {
const { Browser, Target } = client;
ok(Browser, "The main process target exposes Browser domain");
ok(Target, "The main process target exposes Target domain");
const version = await Browser.getVersion();
const { isHeadless } = Cc["@mozilla.org/gfx/info;1"].getService(
Ci.nsIGfxInfo
);
const expectedProduct =
(isHeadless ? "Headless" : "") +
`${Services.appinfo.name}/${Services.appinfo.version}`;
is(version.product, expectedProduct, "Browser.getVersion works");
is(
version.revision,
Services.appinfo.sourceURL.split("/").pop(),
"Browser.getVersion().revision is correct"
);
is(
version.jsVersion,
Services.appinfo.version,
"Browser.getVersion().jsVersion is correct"
);
const { webSocketDebuggerUrl } = await CDP.Version();
is(
webSocketDebuggerUrl,
targetURL,
"Version endpoint refers to the same Main process target"
);
} finally {
await client.close();
}
});