Best headless browser for AI agents. Lite, Fast, High-Compatibility. Built in Rust
Rust ai-agentsai-toolsbrowserbrowser-automationcloud-browserheadlessheadless-browserkitesurfplaywrightpuppeteerrustservoweb-crawlerweb-crawlingweb-scraperweb-scraping
<!doctype html>
<meta charset="utf-8">
<script src="/wpt/resources/testharness.js"></script>
<script src="/wpt/resources/testharnessreport.js"></script>
<script src="/wpt/resources/moli-wpt-adapter.js"></script>
<script>
function worker_url(source) {
return "data:text/javascript," + encodeURIComponent(source);
}
function next_message(worker) {
return new Promise(function (resolve) {
worker.addEventListener("message", resolve, { once: true });
});
}
function assert_live_import_payload(data, label) {
assert_equals(data.before, 1, label + ": named import should expose initial value");
assert_equals(data.defaultBefore, 1, label + ": default import should expose initial value");
assert_equals(data.bumpReturn, 2, label + ": imported mutator should return updated value");
assert_equals(data.afterBump, 2, label + ": function closure should read updated named import");
assert_equals(data.afterSet, 9, label + ": named import should observe setCounter()");
assert_equals(data.defaultAfterSet, 9, label + ": default import should observe setCounter()");
assert_equals(data.secondBump, 10, label + ": imported function should mutate live state again");
assert_equals(data.afterSecondBump, 10, label + ": named import should observe second mutation");
assert_equals(data.importScriptsType, "function", label + ": module workers should expose WorkerGlobalScope.importScripts");
}
function module_source(depUrl) {
return [
"import current, { counter, bump, setCounter } from " + JSON.stringify(depUrl) + ";",
"function readCounter() { return counter; }",
"const before = counter;",
"const defaultBefore = current;",
"const bumpReturn = bump();",
"const afterBump = readCounter();",
"setCounter(9);",
"const afterSet = counter;",
"const defaultAfterSet = current;",
"const secondBump = bump();",
"const afterSecondBump = readCounter();",
"postMessage({",
" before,",
" defaultBefore,",
" bumpReturn,",
" afterBump,",
" afterSet,",
" defaultAfterSet,",
" secondBump,",
" afterSecondBump,",
" importScriptsType: typeof importScripts",
"});",
].join("\n");
}
promise_test(async function () {
const depUrl = worker_url([
"export let counter = 1;",
"export { counter as default };",
"export function bump() { counter += 1; return counter; }",
"export function setCounter(value) { counter = value; }",
].join("\n"));
const worker = new Worker(worker_url(module_source(depUrl)), { type: "module" });
try {
const message = await next_message(worker);
assert_live_import_payload(message.data, "data URL dependency");
} finally {
worker.terminate();
}
}, "Dedicated module worker named imports observe live data URL exports");
promise_test(async function () {
const workerUrl = new URL(
"/wpt/ported/worker/resources/worker-module-live-import-main.js",
location.href
).href;
const worker = new Worker(workerUrl, { type: "module" });
try {
const message = await next_message(worker);
assert_live_import_payload(message.data, "HTTP dependency");
} finally {
worker.terminate();
}
}, "Dedicated module worker named imports observe live HTTP exports");
</script>