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>
const EMPTY_URL = "/wpt/runtime/xhr/empty";
const SLOW_URL = "/wpt/runtime/xhr/slow";
function assert_invalid_state(callback, message) {
let thrown = null;
try {
callback();
} catch (error) {
thrown = error;
}
assert_true(!!thrown, message + " should throw");
assert_equals(thrown.name, "InvalidStateError", message + " exception name");
assert_true(thrown instanceof DOMException, message + " should throw a DOMException");
}
test(function () {
const unopened = new XMLHttpRequest();
assert_invalid_state(function () {
unopened.send();
}, "send() before open()");
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
assert_true(xhr.withCredentials, "withCredentials should be mutable in UNSENT");
xhr.open("GET", SLOW_URL);
xhr.withCredentials = false;
assert_false(xhr.withCredentials, "withCredentials should be mutable in OPENED before send()");
xhr.send();
assert_invalid_state(function () {
xhr.withCredentials = true;
}, "withCredentials while send flag is set");
assert_invalid_state(function () {
xhr.send();
}, "second send() while send flag is set");
xhr.abort();
xhr.withCredentials = true;
assert_true(xhr.withCredentials, "withCredentials should be mutable after abort resets state");
}, "XMLHttpRequest send flag gates send() and withCredentials while a request is in flight");
promise_test(async function () {
const xhr = new XMLHttpRequest();
await new Promise(function (resolve) {
xhr.onloadend = resolve;
xhr.open("GET", EMPTY_URL);
xhr.send();
});
assert_equals(xhr.readyState, XMLHttpRequest.DONE, "request should finish at DONE");
assert_invalid_state(function () {
xhr.withCredentials = true;
}, "withCredentials after DONE");
xhr.open("GET", EMPTY_URL);
xhr.withCredentials = true;
assert_true(xhr.withCredentials, "open() should return to a mutable OPENED state");
}, "XMLHttpRequest withCredentials setter rejects DONE and is restored by open()");
</script>