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 src="/wpt/runtime/fixture-server-config.js"></script>
<script>
function alternate_url(path) {
return location.protocol + "//" + location.hostname + ":" + __lmFixtureServerConfig.alternatePort + path;
}
async function assert_rejects_name(expectedName, promise, description) {
try {
await promise;
} catch (error) {
assert_equals(error.name, expectedName, description);
return;
}
throw new Error(description || "expected rejection");
}
function xhr_result(url, withCredentials) {
return new Promise(function (resolve) {
const events = [];
const xhr = new XMLHttpRequest();
xhr.onreadystatechange = function () {
events.push("readystatechange:" + xhr.readyState);
};
xhr.onload = function () {
events.push("load");
};
xhr.onerror = function () {
events.push("error");
};
xhr.onloadend = function () {
events.push("loadend");
resolve({
events,
readyState: xhr.readyState,
status: xhr.status,
responseText: xhr.responseText,
responseURL: xhr.responseURL,
contentType: xhr.getResponseHeader("Content-Type"),
allHeaders: xhr.getAllResponseHeaders(),
});
};
xhr.open("GET", url);
xhr.withCredentials = withCredentials;
xhr.send();
});
}
promise_test(async function () {
const response = await fetch(alternate_url("/wpt/runtime/cors/credentials/allow"), {
credentials: "include",
});
assert_equals(response.type, "cors");
assert_equals(await response.text(), "cors-credentials-ok");
}, "fetch accepts credentialed CORS responses with exact origin and Access-Control-Allow-Credentials");
promise_test(async function () {
await assert_rejects_name(
"TypeError",
fetch(alternate_url("/wpt/runtime/cors/credentials/wildcard"), {
credentials: "include",
}),
"credentialed fetch should reject wildcard Access-Control-Allow-Origin",
);
}, "fetch rejects wildcard Access-Control-Allow-Origin for credentialed CORS responses");
promise_test(async function () {
await assert_rejects_name(
"TypeError",
fetch(alternate_url("/wpt/runtime/cors/allow"), {
credentials: "include",
}),
"credentialed fetch should require Access-Control-Allow-Credentials",
);
}, "fetch rejects credentialed CORS responses without Access-Control-Allow-Credentials");
promise_test(async function () {
const response = await fetch(alternate_url("/wpt/runtime/cors/credentials/wildcard"));
assert_equals(response.type, "cors");
assert_equals(await response.text(), "cors-credentials-wildcard");
}, "fetch still accepts wildcard Access-Control-Allow-Origin without credentials");
promise_test(async function () {
const result = await xhr_result(alternate_url("/wpt/runtime/cors/credentials/allow"), true);
assert_array_equals(result.events, [
"readystatechange:1",
"readystatechange:2",
"readystatechange:3",
"readystatechange:4",
"load",
"loadend",
]);
assert_equals(result.status, 200);
assert_equals(result.responseText, "cors-credentials-ok");
assert_true(result.responseURL.endsWith("/wpt/runtime/cors/credentials/allow"));
}, "XMLHttpRequest accepts credentialed CORS responses with exact origin and Access-Control-Allow-Credentials");
promise_test(async function () {
const result = await xhr_result(alternate_url("/wpt/runtime/cors/credentials/wildcard"), true);
assert_array_equals(result.events, [
"readystatechange:1",
"readystatechange:4",
"error",
"loadend",
]);
assert_equals(result.readyState, 4);
assert_equals(result.status, 0);
assert_equals(result.responseText, "");
assert_equals(result.responseURL, "");
assert_equals(result.contentType, null);
assert_equals(result.allHeaders, "");
}, "XMLHttpRequest rejects wildcard Access-Control-Allow-Origin for credentialed CORS responses");
promise_test(async function () {
const result = await xhr_result(alternate_url("/wpt/runtime/cors/allow"), true);
assert_array_equals(result.events, [
"readystatechange:1",
"readystatechange:4",
"error",
"loadend",
]);
assert_equals(result.readyState, 4);
assert_equals(result.status, 0);
assert_equals(result.responseText, "");
assert_equals(result.responseURL, "");
assert_equals(result.contentType, null);
assert_equals(result.allHeaders, "");
}, "XMLHttpRequest rejects credentialed CORS responses without Access-Control-Allow-Credentials");
</script>