rebrowser-playwright-core 1.47.100 → 1.49.0
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/README.md +1 -1
- package/ThirdPartyNotices.txt +70 -384
- package/bin/reinstall_chrome_beta_linux.sh +10 -8
- package/bin/reinstall_chrome_stable_linux.sh +10 -8
- package/bin/reinstall_msedge_beta_linux.sh +11 -9
- package/bin/reinstall_msedge_dev_linux.sh +11 -9
- package/bin/reinstall_msedge_stable_linux.sh +11 -9
- package/browsers.json +24 -12
- package/lib/cli/program.js +49 -19
- package/lib/client/api.js +6 -0
- package/lib/client/browserContext.js +20 -2
- package/lib/client/channelOwner.js +6 -2
- package/lib/client/connection.js +3 -0
- package/lib/client/fetch.js +16 -21
- package/lib/client/jsHandle.js +0 -8
- package/lib/client/localUtils.js +1 -0
- package/lib/client/locator.js +7 -0
- package/lib/client/network.js +180 -17
- package/lib/client/page.js +25 -2
- package/lib/client/playwright.js +6 -3
- package/lib/client/tracing.js +29 -20
- package/lib/client/waiter.js +15 -11
- package/lib/generated/consoleApiSource.js +1 -1
- package/lib/generated/injectedScriptSource.js +1 -1
- package/lib/generated/pollingRecorderSource.js +7 -0
- package/lib/generated/webSocketMockSource.js +7 -0
- package/lib/protocol/validator.js +103 -17
- package/lib/server/ariaSnapshot.js +33 -0
- package/lib/server/bidi/bidiBrowser.js +23 -8
- package/lib/server/bidi/bidiChromium.js +124 -0
- package/lib/server/bidi/bidiConnection.js +1 -3
- package/lib/server/bidi/bidiExecutionContext.js +0 -6
- package/lib/server/bidi/bidiFirefox.js +15 -21
- package/lib/server/bidi/bidiInput.js +16 -32
- package/lib/server/bidi/bidiNetworkManager.js +39 -5
- package/lib/server/bidi/bidiOverCdp.js +103 -0
- package/lib/server/bidi/bidiPage.js +98 -25
- package/lib/server/bidi/bidiPdf.js +140 -0
- package/lib/server/bidi/third_party/firefoxPrefs.js +221 -0
- package/lib/server/browser.js +13 -2
- package/lib/server/browserContext.js +6 -23
- package/lib/server/browserType.js +43 -12
- package/lib/server/chromium/chromium.js +9 -17
- package/lib/server/chromium/chromiumSwitches.js +3 -1
- package/lib/server/chromium/crBrowser.js +4 -3
- package/lib/server/chromium/crConnection.js +153 -0
- package/lib/server/chromium/crExecutionContext.js +0 -20
- package/lib/server/chromium/crPage.js +13 -7
- package/lib/server/chromium/videoRecorder.js +1 -1
- package/lib/server/codegen/csharp.js +12 -17
- package/lib/server/codegen/java.js +5 -8
- package/lib/server/codegen/javascript.js +29 -7
- package/lib/server/codegen/language.js +14 -2
- package/lib/server/codegen/python.js +13 -17
- package/lib/server/cookieStore.js +73 -0
- package/lib/server/debugController.js +10 -7
- package/lib/server/deviceDescriptorsSource.json +127 -127
- package/lib/server/dialog.js +1 -0
- package/lib/server/dispatchers/androidDispatcher.js +13 -2
- package/lib/server/dispatchers/browserContextDispatcher.js +19 -2
- package/lib/server/dispatchers/debugControllerDispatcher.js +1 -1
- package/lib/server/dispatchers/dispatcher.js +1 -1
- package/lib/server/dispatchers/frameDispatcher.js +8 -1
- package/lib/server/dispatchers/jsHandleDispatcher.js +0 -5
- package/lib/server/dispatchers/pageDispatcher.js +9 -0
- package/lib/server/dispatchers/playwrightDispatcher.js +2 -1
- package/lib/server/dispatchers/tracingDispatcher.js +10 -0
- package/lib/server/dispatchers/webSocketRouteDispatcher.js +189 -0
- package/lib/server/dom.js +79 -36
- package/lib/server/download.js +9 -2
- package/lib/server/fetch.js +105 -96
- package/lib/server/firefox/ffBrowser.js +6 -4
- package/lib/server/firefox/ffExecutionContext.js +0 -15
- package/lib/server/firefox/ffNetworkManager.js +1 -1
- package/lib/server/firefox/ffPage.js +6 -3
- package/lib/server/firefox/firefox.js +2 -13
- package/lib/server/frameSelectors.js +1 -1
- package/lib/server/frames.js +68 -67
- package/lib/server/har/harTracer.js +11 -0
- package/lib/server/index.js +0 -6
- package/lib/server/input.js +0 -1
- package/lib/server/javascript.js +0 -13
- package/lib/server/page.js +53 -9
- package/lib/server/playwright.js +5 -2
- package/lib/server/progress.js +0 -3
- package/lib/server/recorder/contextRecorder.js +33 -50
- package/lib/server/recorder/recorderApp.js +22 -25
- package/lib/server/recorder/recorderCollection.js +68 -79
- package/lib/server/recorder/recorderInTraceViewer.js +144 -0
- package/lib/server/recorder/recorderRunner.js +75 -97
- package/lib/server/recorder/recorderUtils.js +48 -6
- package/lib/server/recorder.js +87 -47
- package/lib/server/registry/index.js +154 -26
- package/lib/server/registry/nativeDeps.js +6 -3
- package/lib/server/socksClientCertificatesInterceptor.js +15 -3
- package/lib/server/trace/recorder/snapshotter.js +2 -12
- package/lib/server/trace/recorder/snapshotterInjected.js +21 -3
- package/lib/server/trace/recorder/tracing.js +127 -17
- package/lib/server/trace/test/inMemorySnapshotter.js +4 -4
- package/lib/server/trace/viewer/traceViewer.js +4 -6
- package/lib/server/webkit/webkit.js +1 -1
- package/lib/server/webkit/wkBrowser.js +8 -7
- package/lib/server/webkit/wkExecutionContext.js +0 -16
- package/lib/server/webkit/wkPage.js +11 -4
- package/lib/utils/comparators.js +12 -30
- package/lib/utils/crypto.js +1 -4
- package/lib/utils/happy-eyeballs.js +13 -0
- package/lib/utils/hostPlatform.js +8 -2
- package/lib/utils/httpServer.js +1 -0
- package/lib/utils/isomorphic/ariaSnapshot.js +267 -0
- package/lib/utils/isomorphic/locatorGenerators.js +30 -21
- package/lib/utils/isomorphic/locatorParser.js +2 -2
- package/lib/utils/isomorphic/recorderUtils.js +227 -0
- package/lib/utils/isomorphic/stringUtils.js +30 -0
- package/lib/utils/isomorphic/urlMatch.js +5 -1
- package/lib/utils/network.js +1 -1
- package/lib/utils/sequence.js +64 -0
- package/lib/utils/stackTrace.js +16 -3
- package/lib/utils/zones.js +32 -23
- package/lib/utilsBundle.js +4 -5
- package/lib/utilsBundleImpl/index.js +190 -33
- package/lib/vite/htmlReport/index.html +19 -16
- package/lib/vite/recorder/assets/codeMirrorModule-AFvV6hAs.js +24 -0
- package/lib/vite/recorder/assets/index-_cTWgVuJ.js +184 -0
- package/lib/vite/recorder/assets/{index-B-MT5gKo.css → index-iA1aAGZg.css} +1 -1
- package/lib/vite/recorder/index.html +2 -2
- package/lib/vite/traceViewer/assets/codeMirrorModule-KatbITLF.js +24 -0
- package/lib/vite/traceViewer/assets/inspectorTab-DdpLd2bb.js +68 -0
- package/lib/vite/traceViewer/assets/workbench-CdYbzWFD.js +9 -0
- package/lib/vite/traceViewer/embedded.6m3UZh7r.js +2 -0
- package/lib/vite/traceViewer/embedded.html +5 -3
- package/lib/vite/traceViewer/index.WUV-8boJ.js +2 -0
- package/lib/vite/traceViewer/index.html +24 -5
- package/lib/vite/traceViewer/inspectorTab.DEOUW62d.css +1 -0
- package/lib/vite/traceViewer/recorder.B_SY1GJM.css +0 -0
- package/lib/vite/traceViewer/recorder.OT2tVHgn.js +2 -0
- package/lib/vite/traceViewer/recorder.html +17 -0
- package/lib/vite/traceViewer/sw.bundle.js +3 -3
- package/lib/vite/traceViewer/uiMode.BZBTyvGn.js +5 -0
- package/lib/vite/traceViewer/uiMode.html +6 -4
- package/lib/vite/traceViewer/{uiMode.D3cNFP6u.css → uiMode.voC1ZiOQ.css} +1 -1
- package/lib/vite/traceViewer/workbench.C-zR9ysA.css +1 -0
- package/package.json +1 -1
- package/types/protocol.d.ts +135 -16
- package/types/types.d.ts +2149 -965
- package/lib/generated/recorderSource.js +0 -7
- package/lib/third_party/diff_match_patch.js +0 -2222
- package/lib/vite/recorder/assets/codeMirrorModule-aW6Vz3gf.js +0 -24
- package/lib/vite/recorder/assets/index-DCpXOVIh.js +0 -47
- package/lib/vite/traceViewer/assets/codeMirrorModule-eFKCUIu2.js +0 -24
- package/lib/vite/traceViewer/assets/workbench-D0cirtfA.js +0 -72
- package/lib/vite/traceViewer/embedded.BkuvsLJp.js +0 -2
- package/lib/vite/traceViewer/index.C968kAiC.js +0 -2
- package/lib/vite/traceViewer/uiMode.BkFnr4V0.js +0 -10
- package/lib/vite/traceViewer/workbench.DjbIuxix.css +0 -1
- /package/lib/server/recorder/{recorderActions.js → recorderFrontend.js} +0 -0
package/lib/client/network.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.WebSocket = exports.RouteHandler = exports.Route = exports.Response = exports.Request = exports.RawHeaders = void 0;
|
|
6
|
+
exports.WebSocketRouteHandler = exports.WebSocketRoute = exports.WebSocket = exports.RouteHandler = exports.Route = exports.Response = exports.Request = exports.RawHeaders = void 0;
|
|
7
7
|
exports.validateHeaders = validateHeaders;
|
|
8
8
|
var _url = require("url");
|
|
9
9
|
var _channelOwner = require("./channelOwner");
|
|
@@ -17,7 +17,7 @@ var _events = require("./events");
|
|
|
17
17
|
var _waiter = require("./waiter");
|
|
18
18
|
var _fetch = require("./fetch");
|
|
19
19
|
var _errors = require("./errors");
|
|
20
|
-
|
|
20
|
+
let _Symbol$asyncDispose;
|
|
21
21
|
/**
|
|
22
22
|
* Copyright (c) Microsoft Corporation.
|
|
23
23
|
*
|
|
@@ -33,7 +33,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
33
33
|
* See the License for the specific language governing permissions and
|
|
34
34
|
* limitations under the License.
|
|
35
35
|
*/
|
|
36
|
-
|
|
36
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
37
37
|
class Request extends _channelOwner.ChannelOwner {
|
|
38
38
|
static from(request) {
|
|
39
39
|
return request._object;
|
|
@@ -203,6 +203,7 @@ class Route extends _channelOwner.ChannelOwner {
|
|
|
203
203
|
this._handlingPromise = null;
|
|
204
204
|
this._context = void 0;
|
|
205
205
|
this._didThrow = false;
|
|
206
|
+
this.markAsInternalType();
|
|
206
207
|
}
|
|
207
208
|
request() {
|
|
208
209
|
return Request.from(this._initializer.request);
|
|
@@ -225,7 +226,6 @@ class Route extends _channelOwner.ChannelOwner {
|
|
|
225
226
|
async abort(errorCode) {
|
|
226
227
|
await this._handleRoute(async () => {
|
|
227
228
|
await this._raceWithTargetClose(this._channel.abort({
|
|
228
|
-
requestUrl: this.request()._initializer.url,
|
|
229
229
|
errorCode
|
|
230
230
|
}));
|
|
231
231
|
});
|
|
@@ -302,7 +302,6 @@ class Route extends _channelOwner.ChannelOwner {
|
|
|
302
302
|
if (options.contentType) headers['content-type'] = String(options.contentType);else if (options.json) headers['content-type'] = 'application/json';else if (options.path) headers['content-type'] = _utilsBundle.mime.getType(options.path) || 'application/octet-stream';
|
|
303
303
|
if (length && !('content-length' in headers)) headers['content-length'] = String(length);
|
|
304
304
|
await this._raceWithTargetClose(this._channel.fulfill({
|
|
305
|
-
requestUrl: this.request()._initializer.url,
|
|
306
305
|
status: statusOption || 200,
|
|
307
306
|
headers: (0, _utils.headersObjectToArray)(headers),
|
|
308
307
|
body,
|
|
@@ -313,7 +312,7 @@ class Route extends _channelOwner.ChannelOwner {
|
|
|
313
312
|
async continue(options = {}) {
|
|
314
313
|
await this._handleRoute(async () => {
|
|
315
314
|
this.request()._applyFallbackOverrides(options);
|
|
316
|
-
await this._innerContinue();
|
|
315
|
+
await this._innerContinue(false /* isFallback */);
|
|
317
316
|
});
|
|
318
317
|
}
|
|
319
318
|
_checkNotHandled() {
|
|
@@ -324,21 +323,180 @@ class Route extends _channelOwner.ChannelOwner {
|
|
|
324
323
|
this._handlingPromise = null;
|
|
325
324
|
chain.resolve(done);
|
|
326
325
|
}
|
|
327
|
-
async _innerContinue(
|
|
326
|
+
async _innerContinue(isFallback) {
|
|
328
327
|
const options = this.request()._fallbackOverridesForContinue();
|
|
329
|
-
return await this.
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
isFallback: internal
|
|
337
|
-
}));
|
|
338
|
-
}, !!internal);
|
|
328
|
+
return await this._raceWithTargetClose(this._channel.continue({
|
|
329
|
+
url: options.url,
|
|
330
|
+
method: options.method,
|
|
331
|
+
headers: options.headers ? (0, _utils.headersObjectToArray)(options.headers) : undefined,
|
|
332
|
+
postData: options.postDataBuffer,
|
|
333
|
+
isFallback
|
|
334
|
+
}));
|
|
339
335
|
}
|
|
340
336
|
}
|
|
341
337
|
exports.Route = Route;
|
|
338
|
+
_Symbol$asyncDispose = Symbol.asyncDispose;
|
|
339
|
+
class WebSocketRoute extends _channelOwner.ChannelOwner {
|
|
340
|
+
static from(route) {
|
|
341
|
+
return route._object;
|
|
342
|
+
}
|
|
343
|
+
constructor(parent, type, guid, initializer) {
|
|
344
|
+
super(parent, type, guid, initializer);
|
|
345
|
+
this._onPageMessage = void 0;
|
|
346
|
+
this._onPageClose = void 0;
|
|
347
|
+
this._onServerMessage = void 0;
|
|
348
|
+
this._onServerClose = void 0;
|
|
349
|
+
this._server = void 0;
|
|
350
|
+
this._connected = false;
|
|
351
|
+
this.markAsInternalType();
|
|
352
|
+
this._server = {
|
|
353
|
+
onMessage: handler => {
|
|
354
|
+
this._onServerMessage = handler;
|
|
355
|
+
},
|
|
356
|
+
onClose: handler => {
|
|
357
|
+
this._onServerClose = handler;
|
|
358
|
+
},
|
|
359
|
+
connectToServer: () => {
|
|
360
|
+
throw new Error(`connectToServer must be called on the page-side WebSocketRoute`);
|
|
361
|
+
},
|
|
362
|
+
url: () => {
|
|
363
|
+
return this._initializer.url;
|
|
364
|
+
},
|
|
365
|
+
close: async (options = {}) => {
|
|
366
|
+
await this._channel.closeServer({
|
|
367
|
+
...options,
|
|
368
|
+
wasClean: true
|
|
369
|
+
}).catch(() => {});
|
|
370
|
+
},
|
|
371
|
+
send: message => {
|
|
372
|
+
if ((0, _utils.isString)(message)) this._channel.sendToServer({
|
|
373
|
+
message,
|
|
374
|
+
isBase64: false
|
|
375
|
+
}).catch(() => {});else this._channel.sendToServer({
|
|
376
|
+
message: message.toString('base64'),
|
|
377
|
+
isBase64: true
|
|
378
|
+
}).catch(() => {});
|
|
379
|
+
},
|
|
380
|
+
async [Symbol.asyncDispose]() {
|
|
381
|
+
await this.close();
|
|
382
|
+
}
|
|
383
|
+
};
|
|
384
|
+
this._channel.on('messageFromPage', ({
|
|
385
|
+
message,
|
|
386
|
+
isBase64
|
|
387
|
+
}) => {
|
|
388
|
+
if (this._onPageMessage) this._onPageMessage(isBase64 ? Buffer.from(message, 'base64') : message);else if (this._connected) this._channel.sendToServer({
|
|
389
|
+
message,
|
|
390
|
+
isBase64
|
|
391
|
+
}).catch(() => {});
|
|
392
|
+
});
|
|
393
|
+
this._channel.on('messageFromServer', ({
|
|
394
|
+
message,
|
|
395
|
+
isBase64
|
|
396
|
+
}) => {
|
|
397
|
+
if (this._onServerMessage) this._onServerMessage(isBase64 ? Buffer.from(message, 'base64') : message);else this._channel.sendToPage({
|
|
398
|
+
message,
|
|
399
|
+
isBase64
|
|
400
|
+
}).catch(() => {});
|
|
401
|
+
});
|
|
402
|
+
this._channel.on('closePage', ({
|
|
403
|
+
code,
|
|
404
|
+
reason,
|
|
405
|
+
wasClean
|
|
406
|
+
}) => {
|
|
407
|
+
if (this._onPageClose) this._onPageClose(code, reason);else this._channel.closeServer({
|
|
408
|
+
code,
|
|
409
|
+
reason,
|
|
410
|
+
wasClean
|
|
411
|
+
}).catch(() => {});
|
|
412
|
+
});
|
|
413
|
+
this._channel.on('closeServer', ({
|
|
414
|
+
code,
|
|
415
|
+
reason,
|
|
416
|
+
wasClean
|
|
417
|
+
}) => {
|
|
418
|
+
if (this._onServerClose) this._onServerClose(code, reason);else this._channel.closePage({
|
|
419
|
+
code,
|
|
420
|
+
reason,
|
|
421
|
+
wasClean
|
|
422
|
+
}).catch(() => {});
|
|
423
|
+
});
|
|
424
|
+
}
|
|
425
|
+
url() {
|
|
426
|
+
return this._initializer.url;
|
|
427
|
+
}
|
|
428
|
+
async close(options = {}) {
|
|
429
|
+
await this._channel.closePage({
|
|
430
|
+
...options,
|
|
431
|
+
wasClean: true
|
|
432
|
+
}).catch(() => {});
|
|
433
|
+
}
|
|
434
|
+
connectToServer() {
|
|
435
|
+
if (this._connected) throw new Error('Already connected to the server');
|
|
436
|
+
this._connected = true;
|
|
437
|
+
this._channel.connect().catch(() => {});
|
|
438
|
+
return this._server;
|
|
439
|
+
}
|
|
440
|
+
send(message) {
|
|
441
|
+
if ((0, _utils.isString)(message)) this._channel.sendToPage({
|
|
442
|
+
message,
|
|
443
|
+
isBase64: false
|
|
444
|
+
}).catch(() => {});else this._channel.sendToPage({
|
|
445
|
+
message: message.toString('base64'),
|
|
446
|
+
isBase64: true
|
|
447
|
+
}).catch(() => {});
|
|
448
|
+
}
|
|
449
|
+
onMessage(handler) {
|
|
450
|
+
this._onPageMessage = handler;
|
|
451
|
+
}
|
|
452
|
+
onClose(handler) {
|
|
453
|
+
this._onPageClose = handler;
|
|
454
|
+
}
|
|
455
|
+
async [_Symbol$asyncDispose]() {
|
|
456
|
+
await this.close();
|
|
457
|
+
}
|
|
458
|
+
async _afterHandle() {
|
|
459
|
+
if (this._connected) return;
|
|
460
|
+
// Ensure that websocket is "open" and can send messages without an actual server connection.
|
|
461
|
+
await this._channel.ensureOpened();
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
exports.WebSocketRoute = WebSocketRoute;
|
|
465
|
+
class WebSocketRouteHandler {
|
|
466
|
+
constructor(baseURL, url, handler) {
|
|
467
|
+
this._baseURL = void 0;
|
|
468
|
+
this.url = void 0;
|
|
469
|
+
this.handler = void 0;
|
|
470
|
+
this._baseURL = baseURL;
|
|
471
|
+
this.url = url;
|
|
472
|
+
this.handler = handler;
|
|
473
|
+
}
|
|
474
|
+
static prepareInterceptionPatterns(handlers) {
|
|
475
|
+
const patterns = [];
|
|
476
|
+
let all = false;
|
|
477
|
+
for (const handler of handlers) {
|
|
478
|
+
if ((0, _utils.isString)(handler.url)) patterns.push({
|
|
479
|
+
glob: handler.url
|
|
480
|
+
});else if ((0, _utils.isRegExp)(handler.url)) patterns.push({
|
|
481
|
+
regexSource: handler.url.source,
|
|
482
|
+
regexFlags: handler.url.flags
|
|
483
|
+
});else all = true;
|
|
484
|
+
}
|
|
485
|
+
if (all) return [{
|
|
486
|
+
glob: '**/*'
|
|
487
|
+
}];
|
|
488
|
+
return patterns;
|
|
489
|
+
}
|
|
490
|
+
matches(wsURL) {
|
|
491
|
+
return (0, _utils.urlMatches)(this._baseURL, wsURL, this.url);
|
|
492
|
+
}
|
|
493
|
+
async handle(webSocketRoute) {
|
|
494
|
+
const handler = this.handler;
|
|
495
|
+
await handler(webSocketRoute);
|
|
496
|
+
await webSocketRoute._afterHandle();
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
exports.WebSocketRouteHandler = WebSocketRouteHandler;
|
|
342
500
|
class Response extends _channelOwner.ChannelOwner {
|
|
343
501
|
static from(response) {
|
|
344
502
|
return response._object;
|
|
@@ -496,10 +654,12 @@ class RouteHandler {
|
|
|
496
654
|
this.handler = void 0;
|
|
497
655
|
this._ignoreException = false;
|
|
498
656
|
this._activeInvocations = new Set();
|
|
657
|
+
this._svedZone = void 0;
|
|
499
658
|
this._baseURL = baseURL;
|
|
500
659
|
this._times = times;
|
|
501
660
|
this.url = url;
|
|
502
661
|
this.handler = handler;
|
|
662
|
+
this._svedZone = _utils.zones.currentZone();
|
|
503
663
|
}
|
|
504
664
|
static prepareInterceptionPatterns(handlers) {
|
|
505
665
|
const patterns = [];
|
|
@@ -521,6 +681,9 @@ class RouteHandler {
|
|
|
521
681
|
return (0, _utils.urlMatches)(this._baseURL, requestURL, this.url);
|
|
522
682
|
}
|
|
523
683
|
async handle(route) {
|
|
684
|
+
return await this._svedZone.run(async () => this._handleImpl(route));
|
|
685
|
+
}
|
|
686
|
+
async _handleImpl(route) {
|
|
524
687
|
const handlerInvocation = {
|
|
525
688
|
complete: new _manualPromise.ManualPromise(),
|
|
526
689
|
route
|
package/lib/client/page.js
CHANGED
|
@@ -63,6 +63,7 @@ class Page extends _channelOwner.ChannelOwner {
|
|
|
63
63
|
this._closedOrCrashedScope = new _utils.LongStandingScope();
|
|
64
64
|
this._viewportSize = void 0;
|
|
65
65
|
this._routes = [];
|
|
66
|
+
this._webSocketRoutes = [];
|
|
66
67
|
this.accessibility = void 0;
|
|
67
68
|
this.coverage = void 0;
|
|
68
69
|
this.keyboard = void 0;
|
|
@@ -121,6 +122,9 @@ class Page extends _channelOwner.ChannelOwner {
|
|
|
121
122
|
this._channel.on('route', ({
|
|
122
123
|
route
|
|
123
124
|
}) => this._onRoute(_network.Route.from(route)));
|
|
125
|
+
this._channel.on('webSocketRoute', ({
|
|
126
|
+
webSocketRoute
|
|
127
|
+
}) => this._onWebSocketRoute(_network.WebSocketRoute.from(webSocketRoute)));
|
|
124
128
|
this._channel.on('video', ({
|
|
125
129
|
artifact
|
|
126
130
|
}) => {
|
|
@@ -166,6 +170,10 @@ class Page extends _channelOwner.ChannelOwner {
|
|
|
166
170
|
}
|
|
167
171
|
await this._browserContext._onRoute(route);
|
|
168
172
|
}
|
|
173
|
+
async _onWebSocketRoute(webSocketRoute) {
|
|
174
|
+
const routeHandler = this._webSocketRoutes.find(route => route.matches(webSocketRoute.url()));
|
|
175
|
+
if (routeHandler) await routeHandler.handle(webSocketRoute);else await this._browserContext._onWebSocketRoute(webSocketRoute);
|
|
176
|
+
}
|
|
169
177
|
async _onBinding(bindingCall) {
|
|
170
178
|
const func = this._bindings.get(bindingCall._initializer.name);
|
|
171
179
|
if (func) {
|
|
@@ -416,6 +424,9 @@ class Page extends _channelOwner.ChannelOwner {
|
|
|
416
424
|
waitUntil
|
|
417
425
|
})).response);
|
|
418
426
|
}
|
|
427
|
+
async requestGC() {
|
|
428
|
+
await this._channel.requestGC();
|
|
429
|
+
}
|
|
419
430
|
async emulateMedia(options = {}) {
|
|
420
431
|
await this._channel.emulateMedia({
|
|
421
432
|
media: options.media === null ? 'no-override' : options.media,
|
|
@@ -458,6 +469,10 @@ class Page extends _channelOwner.ChannelOwner {
|
|
|
458
469
|
this._harRouters.push(harRouter);
|
|
459
470
|
await harRouter.addPageRoute(this);
|
|
460
471
|
}
|
|
472
|
+
async routeWebSocket(url, handler) {
|
|
473
|
+
this._webSocketRoutes.unshift(new _network.WebSocketRouteHandler(this._browserContext._options.baseURL, url, handler));
|
|
474
|
+
await this._updateWebSocketInterceptionPatterns();
|
|
475
|
+
}
|
|
461
476
|
_disposeHarRouters() {
|
|
462
477
|
this._harRouters.forEach(router => router.dispose());
|
|
463
478
|
this._harRouters = [];
|
|
@@ -487,6 +502,12 @@ class Page extends _channelOwner.ChannelOwner {
|
|
|
487
502
|
patterns
|
|
488
503
|
});
|
|
489
504
|
}
|
|
505
|
+
async _updateWebSocketInterceptionPatterns() {
|
|
506
|
+
const patterns = _network.WebSocketRouteHandler.prepareInterceptionPatterns(this._webSocketRoutes);
|
|
507
|
+
await this._channel.setWebSocketInterceptionPatterns({
|
|
508
|
+
patterns
|
|
509
|
+
});
|
|
510
|
+
}
|
|
490
511
|
async screenshot(options = {}) {
|
|
491
512
|
const copy = {
|
|
492
513
|
...options,
|
|
@@ -655,14 +676,16 @@ class Page extends _channelOwner.ChannelOwner {
|
|
|
655
676
|
workers() {
|
|
656
677
|
return [...this._workers];
|
|
657
678
|
}
|
|
658
|
-
async pause() {
|
|
679
|
+
async pause(_options) {
|
|
659
680
|
var _this$_instrumentatio;
|
|
660
681
|
if (require('inspector').url()) return;
|
|
661
682
|
const defaultNavigationTimeout = this._browserContext._timeoutSettings.defaultNavigationTimeout();
|
|
662
683
|
const defaultTimeout = this._browserContext._timeoutSettings.defaultTimeout();
|
|
663
684
|
this._browserContext.setDefaultNavigationTimeout(0);
|
|
664
685
|
this._browserContext.setDefaultTimeout(0);
|
|
665
|
-
(_this$_instrumentatio = this._instrumentation) === null || _this$_instrumentatio === void 0 || _this$_instrumentatio.onWillPause(
|
|
686
|
+
(_this$_instrumentatio = this._instrumentation) === null || _this$_instrumentatio === void 0 || _this$_instrumentatio.onWillPause({
|
|
687
|
+
keepTestTimeout: !!(_options !== null && _options !== void 0 && _options.__testHookKeepTestTimeout)
|
|
688
|
+
});
|
|
666
689
|
await this._closedOrCrashedScope.safeRace(this.context()._channel.pause());
|
|
667
690
|
this._browserContext.setDefaultNavigationTimeout(defaultNavigationTimeout);
|
|
668
691
|
this._browserContext.setDefaultTimeout(defaultTimeout);
|
package/lib/client/playwright.js
CHANGED
|
@@ -33,7 +33,8 @@ class Playwright extends _channelOwner.ChannelOwner {
|
|
|
33
33
|
super(parent, type, guid, initializer);
|
|
34
34
|
this._android = void 0;
|
|
35
35
|
this._electron = void 0;
|
|
36
|
-
this.
|
|
36
|
+
this._bidiChromium = void 0;
|
|
37
|
+
this._bidiFirefox = void 0;
|
|
37
38
|
this.chromium = void 0;
|
|
38
39
|
this.firefox = void 0;
|
|
39
40
|
this.webkit = void 0;
|
|
@@ -50,8 +51,10 @@ class Playwright extends _channelOwner.ChannelOwner {
|
|
|
50
51
|
this.webkit._playwright = this;
|
|
51
52
|
this._android = _android.Android.from(initializer.android);
|
|
52
53
|
this._electron = _electron.Electron.from(initializer.electron);
|
|
53
|
-
this.
|
|
54
|
-
this.
|
|
54
|
+
this._bidiChromium = _browserType.BrowserType.from(initializer.bidiChromium);
|
|
55
|
+
this._bidiChromium._playwright = this;
|
|
56
|
+
this._bidiFirefox = _browserType.BrowserType.from(initializer.bidiFirefox);
|
|
57
|
+
this._bidiFirefox._playwright = this;
|
|
55
58
|
this.devices = (_this$_connection$loc = (_this$_connection$loc2 = this._connection.localUtils()) === null || _this$_connection$loc2 === void 0 ? void 0 : _this$_connection$loc2.devices) !== null && _this$_connection$loc !== void 0 ? _this$_connection$loc : {};
|
|
56
59
|
this.selectors = new _selectors.Selectors();
|
|
57
60
|
this.errors = {
|
package/lib/client/tracing.js
CHANGED
|
@@ -32,22 +32,22 @@ class Tracing extends _channelOwner.ChannelOwner {
|
|
|
32
32
|
this._tracesDir = void 0;
|
|
33
33
|
this._stacksId = void 0;
|
|
34
34
|
this._isTracing = false;
|
|
35
|
+
this.markAsInternalType();
|
|
35
36
|
}
|
|
36
37
|
async start(options = {}) {
|
|
37
38
|
this._includeSources = !!options.sources;
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}, true);
|
|
39
|
+
await this._channel.tracingStart({
|
|
40
|
+
name: options.name,
|
|
41
|
+
snapshots: options.snapshots,
|
|
42
|
+
screenshots: options.screenshots,
|
|
43
|
+
live: options._live
|
|
44
|
+
});
|
|
45
|
+
const {
|
|
46
|
+
traceName
|
|
47
|
+
} = await this._channel.tracingStartChunk({
|
|
48
|
+
name: options.name,
|
|
49
|
+
title: options.title
|
|
50
|
+
});
|
|
51
51
|
await this._startCollectingStacks(traceName);
|
|
52
52
|
}
|
|
53
53
|
async startChunk(options = {}) {
|
|
@@ -56,6 +56,19 @@ class Tracing extends _channelOwner.ChannelOwner {
|
|
|
56
56
|
} = await this._channel.tracingStartChunk(options);
|
|
57
57
|
await this._startCollectingStacks(traceName);
|
|
58
58
|
}
|
|
59
|
+
async group(name, options = {}) {
|
|
60
|
+
await this._wrapApiCall(async () => {
|
|
61
|
+
await this._channel.tracingGroup({
|
|
62
|
+
name,
|
|
63
|
+
location: options.location
|
|
64
|
+
});
|
|
65
|
+
}, false);
|
|
66
|
+
}
|
|
67
|
+
async groupEnd() {
|
|
68
|
+
await this._wrapApiCall(async () => {
|
|
69
|
+
await this._channel.tracingGroupEnd();
|
|
70
|
+
}, false);
|
|
71
|
+
}
|
|
59
72
|
async _startCollectingStacks(traceName) {
|
|
60
73
|
if (!this._isTracing) {
|
|
61
74
|
this._isTracing = true;
|
|
@@ -68,15 +81,11 @@ class Tracing extends _channelOwner.ChannelOwner {
|
|
|
68
81
|
this._stacksId = result.stacksId;
|
|
69
82
|
}
|
|
70
83
|
async stopChunk(options = {}) {
|
|
71
|
-
await this.
|
|
72
|
-
await this._doStopChunk(options.path);
|
|
73
|
-
}, true);
|
|
84
|
+
await this._doStopChunk(options.path);
|
|
74
85
|
}
|
|
75
86
|
async stop(options = {}) {
|
|
76
|
-
await this.
|
|
77
|
-
|
|
78
|
-
await this._channel.tracingStop();
|
|
79
|
-
}, true);
|
|
87
|
+
await this._doStopChunk(options.path);
|
|
88
|
+
await this._channel.tracingStop();
|
|
80
89
|
}
|
|
81
90
|
async _doStopChunk(filePath) {
|
|
82
91
|
this._resetStackCounter();
|
package/lib/client/waiter.js
CHANGED
|
@@ -32,8 +32,10 @@ class Waiter {
|
|
|
32
32
|
this._channelOwner = void 0;
|
|
33
33
|
this._waitId = void 0;
|
|
34
34
|
this._error = void 0;
|
|
35
|
+
this._savedZone = void 0;
|
|
35
36
|
this._waitId = (0, _utils.createGuid)();
|
|
36
37
|
this._channelOwner = channelOwner;
|
|
38
|
+
this._savedZone = _utils.zones.currentZone();
|
|
37
39
|
this._channelOwner._channel.waitForEventInfo({
|
|
38
40
|
info: {
|
|
39
41
|
waitId: this._waitId,
|
|
@@ -58,14 +60,14 @@ class Waiter {
|
|
|
58
60
|
const {
|
|
59
61
|
promise,
|
|
60
62
|
dispose
|
|
61
|
-
} = waitForEvent(emitter, event, predicate);
|
|
63
|
+
} = waitForEvent(emitter, event, this._savedZone, predicate);
|
|
62
64
|
return await this.waitForPromise(promise, dispose);
|
|
63
65
|
}
|
|
64
66
|
rejectOnEvent(emitter, event, error, predicate) {
|
|
65
67
|
const {
|
|
66
68
|
promise,
|
|
67
69
|
dispose
|
|
68
|
-
} = waitForEvent(emitter, event, predicate);
|
|
70
|
+
} = waitForEvent(emitter, event, this._savedZone, predicate);
|
|
69
71
|
this._rejectOn(promise.then(() => {
|
|
70
72
|
throw typeof error === 'function' ? error() : error;
|
|
71
73
|
}), dispose);
|
|
@@ -118,18 +120,20 @@ class Waiter {
|
|
|
118
120
|
}
|
|
119
121
|
}
|
|
120
122
|
exports.Waiter = Waiter;
|
|
121
|
-
function waitForEvent(emitter, event, predicate) {
|
|
123
|
+
function waitForEvent(emitter, event, savedZone, predicate) {
|
|
122
124
|
let listener;
|
|
123
125
|
const promise = new Promise((resolve, reject) => {
|
|
124
126
|
listener = async eventArg => {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
127
|
+
await savedZone.run(async () => {
|
|
128
|
+
try {
|
|
129
|
+
if (predicate && !(await predicate(eventArg))) return;
|
|
130
|
+
emitter.removeListener(event, listener);
|
|
131
|
+
resolve(eventArg);
|
|
132
|
+
} catch (e) {
|
|
133
|
+
emitter.removeListener(event, listener);
|
|
134
|
+
reject(e);
|
|
135
|
+
}
|
|
136
|
+
});
|
|
133
137
|
};
|
|
134
138
|
emitter.addListener(event, listener);
|
|
135
139
|
});
|