@capybara-hq/plugin-browser 0.1.0-rc.11 → 0.1.0-rc.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.capybara-plugin/plugin.json +5 -4
- package/README.md +93 -3
- package/dist/index.mjs +417 -51
- package/package.json +2 -2
- package/ui/panel.js +304 -24
- package/ui/service/daemon.mjs +1458 -67
- package/ui/service/vendor/playwright-core/lib/coreBundle.js +30 -0
|
@@ -37903,6 +37903,11 @@ var init_crNetworkManager = __esm({
|
|
|
37903
37903
|
} else if (credentials) {
|
|
37904
37904
|
response2 = "ProvideCredentials";
|
|
37905
37905
|
this._attemptedAuthentications.add(attemptKey);
|
|
37906
|
+
} else if (!isProxy) {
|
|
37907
|
+
// capybara patch (plugins#292): no site credentials match, so cancel the challenge and let
|
|
37908
|
+
// the request complete with its 401; "Default" leaves a subresource's challenge hanging in
|
|
37909
|
+
// headless Chromium
|
|
37910
|
+
response2 = "CancelAuth";
|
|
37906
37911
|
}
|
|
37907
37912
|
const { username, password } = credentials || { username: void 0, password: void 0 };
|
|
37908
37913
|
sessionInfo.session._sendMayFail("Fetch.continueWithAuth", {
|
|
@@ -37926,8 +37931,12 @@ var init_crNetworkManager = __esm({
|
|
|
37926
37931
|
const existingRequest = this._requestIdToRequest.get(requestId);
|
|
37927
37932
|
const alreadyContinuedParams = existingRequest?._originalRequestRoute?._alreadyContinuedParams;
|
|
37928
37933
|
if (alreadyContinuedParams && !event.redirectedRequestId) {
|
|
37934
|
+
// capybara patch (plugins#292 review): a redirect hop paused before its
|
|
37935
|
+
// requestWillBeSent lands here too (a subresource's hop carries no redirectedRequestId)
|
|
37936
|
+
const headers = alreadyContinuedParams.headers && crossedOrigin(existingRequest.request, event.request.url) ? alreadyContinuedParams.headers.filter((h) => h.name.toLowerCase() !== "authorization") : alreadyContinuedParams.headers;
|
|
37929
37937
|
sessionInfo.session._sendMayFail("Fetch.continueRequest", {
|
|
37930
37938
|
...alreadyContinuedParams,
|
|
37939
|
+
headers,
|
|
37931
37940
|
requestId: event.requestId
|
|
37932
37941
|
});
|
|
37933
37942
|
return;
|
|
@@ -37988,6 +37997,11 @@ var init_crNetworkManager = __esm({
|
|
|
37988
37997
|
if (headersOverride) {
|
|
37989
37998
|
const originalHeaders = Object.entries(requestPausedEvent.request.headers).map(([name, value2]) => ({ name, value: value2 }));
|
|
37990
37999
|
headersOverride = removeCookieHeader(applyHeadersOverrides(originalHeaders, headersOverride));
|
|
38000
|
+
// capybara patch (plugins#292 review): the route's headers are replayed on every
|
|
38001
|
+
// redirect hop; once the chain leaves the origin of its first request, an
|
|
38002
|
+
// Authorization header is never sent again (as a browser drops it)
|
|
38003
|
+
if (redirectedFrom && crossedOrigin(redirectedFrom.request, requestWillBeSentEvent.request.url))
|
|
38004
|
+
headersOverride = headersOverride.filter((h) => h.name.toLowerCase() !== "authorization");
|
|
37991
38005
|
}
|
|
37992
38006
|
requestPausedSessionInfo.session._sendMayFail("Fetch.continueRequest", { requestId: requestPausedEvent.requestId, headers: headersOverride });
|
|
37993
38007
|
} else {
|
|
@@ -53329,6 +53343,22 @@ function validateBrowserContextOptions(options, browserOptions) {
|
|
|
53329
53343
|
throw new Error(`"recordVideo.fps" must be a positive number, got ${options.recordVideo.fps}`);
|
|
53330
53344
|
verifyGeolocation(options.geolocation);
|
|
53331
53345
|
}
|
|
53346
|
+
// capybara patch (plugins#292 review): whether a redirect chain (its last hop `request`, then
|
|
53347
|
+
// `nextUrl`) has left the origin of its first request
|
|
53348
|
+
function crossedOrigin(request2, nextUrl) {
|
|
53349
|
+
const originOf = (u) => {
|
|
53350
|
+
try {
|
|
53351
|
+
return new URL(u).origin;
|
|
53352
|
+
} catch {
|
|
53353
|
+
return void 0;
|
|
53354
|
+
}
|
|
53355
|
+
};
|
|
53356
|
+
const urls = [nextUrl];
|
|
53357
|
+
for (let r = request2; r; r = r.redirectedFrom())
|
|
53358
|
+
urls.push(r.url());
|
|
53359
|
+
const first = originOf(urls[urls.length - 1]);
|
|
53360
|
+
return first === void 0 || urls.some((u) => originOf(u) !== first);
|
|
53361
|
+
}
|
|
53332
53362
|
function findMatchingHttpCredentials(credentials, url3) {
|
|
53333
53363
|
const origin = new URL(url3).origin.toLowerCase();
|
|
53334
53364
|
return credentials?.find((c) => !c.origin || c.origin.toLowerCase() === origin);
|