playwright-core 1.55.0-beta-1755602792000 → 1.56.0-alpha-2025-08-20
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.
|
@@ -40,6 +40,7 @@ class BidiNetworkManager {
|
|
|
40
40
|
constructor(bidiSession, page) {
|
|
41
41
|
this._userRequestInterceptionEnabled = false;
|
|
42
42
|
this._protocolRequestInterceptionEnabled = false;
|
|
43
|
+
this._attemptedAuthentications = /* @__PURE__ */ new Set();
|
|
43
44
|
this._session = bidiSession;
|
|
44
45
|
this._requests = /* @__PURE__ */ new Map();
|
|
45
46
|
this._page = page;
|
|
@@ -62,7 +63,7 @@ class BidiNetworkManager {
|
|
|
62
63
|
if (!frame)
|
|
63
64
|
return;
|
|
64
65
|
if (redirectedFrom)
|
|
65
|
-
this.
|
|
66
|
+
this._deleteRequest(redirectedFrom._id);
|
|
66
67
|
let route;
|
|
67
68
|
if (param.intercepts) {
|
|
68
69
|
if (redirectedFrom) {
|
|
@@ -124,7 +125,7 @@ class BidiNetworkManager {
|
|
|
124
125
|
if (isRedirected) {
|
|
125
126
|
response._requestFinished(responseEndTime);
|
|
126
127
|
} else {
|
|
127
|
-
this.
|
|
128
|
+
this._deleteRequest(request._id);
|
|
128
129
|
response._requestFinished(responseEndTime);
|
|
129
130
|
}
|
|
130
131
|
response._setHttpVersion(params.response.protocol);
|
|
@@ -134,7 +135,7 @@ class BidiNetworkManager {
|
|
|
134
135
|
const request = this._requests.get(params.request.request);
|
|
135
136
|
if (!request)
|
|
136
137
|
return;
|
|
137
|
-
this.
|
|
138
|
+
this._deleteRequest(request._id);
|
|
138
139
|
const response = request.request._existingResponse();
|
|
139
140
|
if (response) {
|
|
140
141
|
response.setTransferSize(null);
|
|
@@ -148,15 +149,23 @@ class BidiNetworkManager {
|
|
|
148
149
|
const isBasic = params.response.authChallenges?.some((challenge) => challenge.scheme.startsWith("Basic"));
|
|
149
150
|
const credentials = this._page.browserContext._options.httpCredentials;
|
|
150
151
|
if (isBasic && credentials) {
|
|
151
|
-
this.
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
152
|
+
if (this._attemptedAuthentications.has(params.request.request)) {
|
|
153
|
+
this._session.sendMayFail("network.continueWithAuth", {
|
|
154
|
+
request: params.request.request,
|
|
155
|
+
action: "cancel"
|
|
156
|
+
});
|
|
157
|
+
} else {
|
|
158
|
+
this._attemptedAuthentications.add(params.request.request);
|
|
159
|
+
this._session.sendMayFail("network.continueWithAuth", {
|
|
160
|
+
request: params.request.request,
|
|
161
|
+
action: "provideCredentials",
|
|
162
|
+
credentials: {
|
|
163
|
+
type: "password",
|
|
164
|
+
username: credentials.username,
|
|
165
|
+
password: credentials.password
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
}
|
|
160
169
|
} else {
|
|
161
170
|
this._session.sendMayFail("network.continueWithAuth", {
|
|
162
171
|
request: params.request.request,
|
|
@@ -164,6 +173,10 @@ class BidiNetworkManager {
|
|
|
164
173
|
});
|
|
165
174
|
}
|
|
166
175
|
}
|
|
176
|
+
_deleteRequest(requestId) {
|
|
177
|
+
this._requests.delete(requestId);
|
|
178
|
+
this._attemptedAuthentications.delete(requestId);
|
|
179
|
+
}
|
|
167
180
|
async setRequestInterception(value) {
|
|
168
181
|
this._userRequestInterceptionEnabled = value;
|
|
169
182
|
await this._updateProtocolRequestInterception();
|