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 });
});
}
promise_test(async function () {
const worker = new Worker(
worker_url(
[
"onmessage = function (event) {",
" postMessage({",
" isArrayBuffer: event.data instanceof ArrayBuffer,",
" bytes: Array.from(new Uint8Array(event.data)).join(',')",
" });",
"};",
].join("\n"),
),
);
try {
const first = new Uint8Array([7, 8, 9]).buffer;
worker.postMessage(first, [first]);
const firstReply = await next_message(worker);
assert_true(firstReply.data.isArrayBuffer, "transfer list should deliver ArrayBuffer to worker");
assert_equals(firstReply.data.bytes, "7,8,9", "worker should receive transferred bytes");
assert_equals(first.byteLength, 0, "transfer list should detach the sender buffer");
const second = new Uint8Array([10, 11]).buffer;
worker.postMessage(second, { transfer: [second] });
const secondReply = await next_message(worker);
assert_true(
secondReply.data.isArrayBuffer,
"options.transfer should also deliver ArrayBuffer to worker",
);
assert_equals(secondReply.data.bytes, "10,11", "worker should receive bytes from options.transfer");
assert_equals(second.byteLength, 0, "options.transfer should detach the sender buffer");
} finally {
worker.terminate();
}
}, "Worker.postMessage supports ArrayBuffer transfers through legacy and options-dict forms");
</script>