patchright-core 1.52.4 → 1.55.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/ThirdPartyNotices.txt +65 -123
- package/bin/reinstall_chrome_beta_mac.sh +1 -1
- package/bin/reinstall_chrome_stable_mac.sh +1 -1
- package/bin/reinstall_msedge_beta_mac.sh +1 -1
- package/bin/reinstall_msedge_dev_mac.sh +1 -1
- package/bin/reinstall_msedge_stable_mac.sh +1 -1
- package/browsers.json +14 -14
- package/index.js +1 -1
- package/lib/androidServerImpl.js +4 -2
- package/lib/browserServerImpl.js +47 -12
- package/lib/cli/program.js +116 -50
- package/lib/cli/programWithTestStub.js +1 -1
- package/lib/client/android.js +30 -34
- package/lib/client/browser.js +54 -17
- package/lib/client/browserContext.js +67 -71
- package/lib/client/browserType.js +25 -34
- package/lib/client/channelOwner.js +20 -24
- package/lib/client/connection.js +6 -10
- package/lib/client/electron.js +8 -3
- package/lib/client/elementHandle.js +18 -21
- package/lib/client/fetch.js +5 -3
- package/lib/client/frame.js +57 -35
- package/lib/client/input.js +3 -1
- package/lib/client/jsHandle.js +4 -0
- package/lib/client/localUtils.js +0 -1
- package/lib/client/locator.js +32 -28
- package/lib/client/network.js +5 -12
- package/lib/client/page.js +32 -32
- package/lib/client/playwright.js +6 -16
- package/lib/client/selectors.js +18 -38
- package/lib/client/timeoutSettings.js +12 -8
- package/lib/client/tracing.js +24 -20
- package/lib/client/waiter.js +2 -2
- package/lib/client/webSocket.js +4 -22
- package/lib/generated/bindingsControllerSource.js +28 -0
- package/lib/generated/clockSource.js +1 -1
- package/lib/generated/injectedScriptSource.js +1 -1
- package/lib/generated/pollingRecorderSource.js +1 -1
- package/lib/generated/storageScriptSource.js +28 -0
- package/lib/generated/utilityScriptSource.js +1 -1
- package/lib/generated/webSocketMockSource.js +12 -50
- package/lib/inProcessFactory.js +9 -6
- package/lib/outofprocess.js +0 -2
- package/lib/protocol/validator.js +423 -346
- package/lib/protocol/validatorPrimitives.js +18 -4
- package/lib/remote/playwrightConnection.js +29 -166
- package/lib/remote/playwrightServer.js +233 -35
- package/lib/server/android/android.js +97 -83
- package/lib/server/android/backendAdb.js +0 -2
- package/lib/server/bidi/bidiBrowser.js +139 -73
- package/lib/server/bidi/bidiChromium.js +23 -22
- package/lib/server/bidi/bidiExecutionContext.js +2 -1
- package/lib/server/bidi/bidiFirefox.js +17 -14
- package/lib/server/bidi/bidiInput.js +22 -22
- package/lib/server/bidi/bidiNetworkManager.js +8 -11
- package/lib/server/bidi/bidiPage.js +42 -86
- package/lib/server/bidi/third_party/bidiProtocol.js +5 -133
- package/lib/server/bidi/third_party/bidiProtocolCore.js +179 -0
- package/lib/server/{dispatchers/selectorsDispatcher.js → bidi/third_party/bidiProtocolPermissions.js} +20 -18
- package/lib/server/browser.js +30 -21
- package/lib/server/browserContext.js +203 -165
- package/lib/server/browserType.js +109 -107
- package/lib/server/chromium/chromium.js +84 -69
- package/lib/server/chromium/chromiumSwitches.js +13 -20
- package/lib/server/chromium/crBrowser.js +74 -40
- package/lib/server/chromium/crConnection.js +8 -9
- package/lib/server/chromium/crCoverage.js +11 -8
- package/lib/server/chromium/crDragDrop.js +25 -20
- package/lib/server/chromium/crExecutionContext.js +2 -1
- package/lib/server/chromium/crInput.js +32 -29
- package/lib/server/chromium/crNetworkManager.js +45 -33
- package/lib/server/chromium/crPage.js +98 -73
- package/lib/server/chromium/crServiceWorker.js +13 -18
- package/lib/server/chromium/videoRecorder.js +10 -18
- package/lib/server/clock.js +51 -39
- package/lib/server/codegen/csharp.js +10 -5
- package/lib/server/codegen/java.js +1 -1
- package/lib/server/codegen/javascript.js +1 -1
- package/lib/server/codegen/jsonl.js +2 -1
- package/lib/server/codegen/language.js +22 -1
- package/lib/server/codegen/languages.js +4 -4
- package/lib/server/codegen/python.js +1 -1
- package/lib/server/cookieStore.js +3 -1
- package/lib/server/debugController.js +105 -71
- package/lib/server/debugger.js +6 -23
- package/lib/server/deviceDescriptorsSource.json +237 -127
- package/lib/server/dialog.js +50 -6
- package/lib/server/dispatchers/androidDispatcher.js +77 -62
- package/lib/server/dispatchers/artifactDispatcher.js +18 -18
- package/lib/server/dispatchers/browserContextDispatcher.js +141 -91
- package/lib/server/dispatchers/browserDispatcher.js +55 -88
- package/lib/server/dispatchers/browserTypeDispatcher.js +18 -9
- package/lib/server/dispatchers/cdpSessionDispatcher.js +4 -4
- package/lib/server/dispatchers/debugControllerDispatcher.js +12 -21
- package/lib/server/dispatchers/dialogDispatcher.js +4 -4
- package/lib/server/dispatchers/dispatcher.js +78 -53
- package/lib/server/dispatchers/electronDispatcher.js +19 -20
- package/lib/server/dispatchers/elementHandlerDispatcher.js +83 -93
- package/lib/server/dispatchers/frameDispatcher.js +99 -102
- package/lib/server/dispatchers/jsHandleDispatcher.js +21 -16
- package/lib/server/dispatchers/jsonPipeDispatcher.js +4 -4
- package/lib/server/dispatchers/localUtilsDispatcher.js +53 -59
- package/lib/server/dispatchers/networkDispatchers.js +41 -35
- package/lib/server/dispatchers/pageDispatcher.js +156 -107
- package/lib/server/dispatchers/playwrightDispatcher.js +37 -25
- package/lib/server/dispatchers/streamDispatcher.js +15 -8
- package/lib/server/dispatchers/tracingDispatcher.js +22 -13
- package/lib/server/dispatchers/webSocketRouteDispatcher.js +46 -35
- package/lib/server/dispatchers/writableStreamDispatcher.js +16 -10
- package/lib/server/dom.js +198 -266
- package/lib/server/download.js +3 -3
- package/lib/server/electron/electron.js +96 -103
- package/lib/server/electron/loader.js +1 -1
- package/lib/server/fetch.js +22 -41
- package/lib/server/fileUploadUtils.js +1 -1
- package/lib/server/firefox/ffBrowser.js +79 -55
- package/lib/server/firefox/ffExecutionContext.js +2 -1
- package/lib/server/firefox/ffInput.js +23 -23
- package/lib/server/firefox/ffNetworkManager.js +8 -6
- package/lib/server/firefox/ffPage.js +39 -36
- package/lib/server/firefox/firefox.js +9 -10
- package/lib/server/frameSelectors.js +65 -22
- package/lib/server/frames.js +516 -544
- package/lib/server/har/harRecorder.js +1 -1
- package/lib/server/har/harTracer.js +4 -2
- package/lib/server/helper.js +3 -7
- package/lib/server/index.js +0 -3
- package/lib/server/input.js +47 -54
- package/lib/server/instrumentation.js +8 -14
- package/lib/server/javascript.js +9 -17
- package/lib/server/launchApp.js +48 -30
- package/lib/server/localUtils.js +45 -38
- package/lib/server/network.js +44 -10
- package/lib/server/page.js +233 -178
- package/lib/server/pageBinding.js +6 -7
- package/lib/server/playwright.js +4 -14
- package/lib/server/progress.js +57 -49
- package/lib/server/recorder/recorderApp.js +298 -95
- package/lib/server/recorder/recorderRunner.js +23 -24
- package/lib/server/recorder/recorderSignalProcessor.js +83 -0
- package/lib/server/recorder/recorderUtils.js +67 -10
- package/lib/server/recorder.js +284 -146
- package/lib/server/registry/index.js +83 -48
- package/lib/server/registry/nativeDeps.js +175 -0
- package/lib/server/registry/oopDownloadBrowserMain.js +1 -1
- package/lib/server/screenshotter.js +84 -83
- package/lib/server/selectors.js +12 -12
- package/lib/server/socksClientCertificatesInterceptor.js +198 -136
- package/lib/server/trace/recorder/snapshotter.js +12 -19
- package/lib/server/trace/recorder/tracing.js +36 -27
- package/lib/server/trace/viewer/traceViewer.js +11 -20
- package/lib/server/transport.js +20 -22
- package/lib/server/utils/comparators.js +2 -2
- package/lib/server/utils/debug.js +3 -8
- package/lib/server/utils/debugLogger.js +8 -0
- package/lib/server/utils/hostPlatform.js +3 -1
- package/lib/server/utils/network.js +35 -25
- package/lib/server/utils/nodePlatform.js +1 -1
- package/lib/server/utils/processLauncher.js +4 -1
- package/lib/server/utils/wsServer.js +11 -17
- package/lib/server/webkit/webkit.js +5 -2
- package/lib/server/webkit/wkBrowser.js +51 -28
- package/lib/server/webkit/wkExecutionContext.js +2 -1
- package/lib/server/webkit/wkInput.js +25 -25
- package/lib/server/webkit/wkInterceptableRequest.js +1 -1
- package/lib/server/webkit/wkPage.js +80 -59
- package/lib/server/webkit/wkProvisionalPage.js +1 -1
- package/lib/server/webkit/wkWorkers.js +7 -7
- package/lib/utils/isomorphic/ariaSnapshot.js +13 -7
- package/lib/utils/isomorphic/cssParser.js +1 -2
- package/lib/utils/isomorphic/locatorGenerators.js +18 -0
- package/lib/utils/isomorphic/manualPromise.js +1 -2
- package/lib/utils/isomorphic/mimeType.js +1 -2
- package/lib/utils/isomorphic/multimap.js +1 -2
- package/lib/utils/isomorphic/oldUtilityScriptSerializers.js +248 -0
- package/lib/utils/isomorphic/protocolFormatter.js +78 -0
- package/lib/utils/isomorphic/protocolMetainfo.js +318 -0
- package/lib/utils/isomorphic/selectorParser.js +3 -4
- package/lib/utils/isomorphic/stringUtils.js +3 -24
- package/lib/utils/isomorphic/time.js +9 -4
- package/lib/utils/isomorphic/timeoutRunner.js +3 -4
- package/lib/utils/isomorphic/traceUtils.js +2 -3
- package/lib/utils/isomorphic/urlMatch.js +21 -7
- package/lib/utils/isomorphic/utilityScriptSerializers.js +208 -205
- package/lib/utils.js +8 -2
- package/lib/utilsBundleImpl/index.js +160 -150
- package/lib/vite/htmlReport/index.html +17 -17
- package/lib/vite/recorder/assets/{codeMirrorModule-CXVeovup.js → codeMirrorModule-DzQ0k89p.js} +1 -1
- package/lib/vite/recorder/assets/{index-eHBmevrY.css → index-CI4HQ-Zb.css} +1 -1
- package/lib/vite/recorder/assets/index-D7C7daHH.js +184 -0
- package/lib/vite/recorder/index.html +3 -3
- package/lib/vite/traceViewer/assets/{codeMirrorModule-_GLjJL-7.js → codeMirrorModule-Di48jgWx.js} +1 -1
- package/lib/vite/traceViewer/assets/defaultSettingsView-szBn8781.js +256 -0
- package/lib/vite/traceViewer/defaultSettingsView.DVJHpiGt.css +1 -0
- package/lib/vite/traceViewer/index.BFsek2M6.css +1 -0
- package/lib/vite/traceViewer/index.DQvXoPLL.js +2 -0
- package/lib/vite/traceViewer/index.html +6 -6
- package/lib/vite/traceViewer/sw.bundle.js +3 -3
- package/lib/vite/traceViewer/uiMode.dBV3oN9h.js +5 -0
- package/lib/vite/traceViewer/uiMode.html +4 -4
- package/lib/zipBundleImpl.js +4 -4
- package/package.json +1 -1
- package/types/protocol.d.ts +712 -107
- package/types/types.d.ts +148 -37
- package/lib/generated/consoleApiSource.js +0 -28
- package/lib/protocol/debug.js +0 -211
- package/lib/server/recorder/contextRecorder.js +0 -286
- package/lib/server/recorder/recorderCollection.js +0 -116
- package/lib/server/recorder/recorderFrontend.js +0 -16
- package/lib/server/storageScript.js +0 -154
- package/lib/server/timeoutSettings.js +0 -89
- package/lib/utils/isomorphic/builtins.js +0 -86
- package/lib/vite/recorder/assets/index-BsWQsSGl.js +0 -184
- package/lib/vite/traceViewer/assets/defaultSettingsView-DtCQiGHe.js +0 -265
- package/lib/vite/traceViewer/defaultSettingsView.QdHITyLI.css +0 -1
- package/lib/vite/traceViewer/index.CFOW-Ezb.css +0 -1
- package/lib/vite/traceViewer/index.cFZzK9RN.js +0 -2
- package/lib/vite/traceViewer/uiMode.XVPIqBeS.js +0 -5
|
@@ -21,31 +21,17 @@ __export(chromiumSwitches_exports, {
|
|
|
21
21
|
chromiumSwitches: () => chromiumSwitches
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(chromiumSwitches_exports);
|
|
24
|
-
const disabledFeatures = [
|
|
24
|
+
const disabledFeatures = (assistantMode) => [
|
|
25
25
|
// See https://github.com/microsoft/playwright/pull/10380
|
|
26
26
|
"AcceptCHFrame",
|
|
27
|
-
// See https://github.com/microsoft/playwright/pull/10679
|
|
28
|
-
"AutoExpandDetailsElement",
|
|
29
27
|
// See https://github.com/microsoft/playwright/issues/14047
|
|
30
28
|
"AvoidUnnecessaryBeforeUnloadCheckSync",
|
|
31
|
-
// See https://github.com/microsoft/playwright/pull/12992
|
|
32
|
-
"CertificateTransparencyComponentUpdater",
|
|
33
|
-
// This makes Page.frameScheduledNavigation arrive much later after a click,
|
|
34
|
-
// making our navigation auto-wait after click not working.
|
|
35
|
-
// Can be removed once we deperecate noWaitAfter.
|
|
36
|
-
// See https://github.com/microsoft/playwright/pull/34372.
|
|
37
|
-
"DeferRendererTasksAfterInput",
|
|
38
29
|
"DestroyProfileOnBrowserClose",
|
|
39
30
|
// See https://github.com/microsoft/playwright/pull/13854
|
|
40
31
|
"DialMediaRouteProvider",
|
|
41
|
-
// Chromium is disabling manifest version 2. Allow testing it as long as Chromium can actually run it.
|
|
42
|
-
// Disabled in https://chromium-review.googlesource.com/c/chromium/src/+/6265903.
|
|
43
|
-
"ExtensionManifestV2Disabled",
|
|
44
32
|
"GlobalMediaControls",
|
|
45
33
|
// See https://github.com/microsoft/playwright/pull/27605
|
|
46
34
|
"HttpsUpgrades",
|
|
47
|
-
"ImprovedCookieControls",
|
|
48
|
-
"LazyFrameLoading",
|
|
49
35
|
// Hides the Lens feature in the URL address bar. Its not working in unofficial builds.
|
|
50
36
|
"LensOverlay",
|
|
51
37
|
// See https://github.com/microsoft/playwright/pull/8162
|
|
@@ -55,9 +41,12 @@ const disabledFeatures = [
|
|
|
55
41
|
// See https://github.com/microsoft/playwright/issues/32230
|
|
56
42
|
"ThirdPartyStoragePartitioning",
|
|
57
43
|
// See https://github.com/microsoft/playwright/issues/16126
|
|
58
|
-
"Translate"
|
|
59
|
-
|
|
60
|
-
|
|
44
|
+
"Translate",
|
|
45
|
+
// See https://issues.chromium.org/u/1/issues/435410220
|
|
46
|
+
"AutoDeElevate",
|
|
47
|
+
assistantMode ? "AutomationControlled" : ""
|
|
48
|
+
].filter(Boolean);
|
|
49
|
+
const chromiumSwitches = (assistantMode, channel) => [
|
|
61
50
|
"--disable-field-trial-config",
|
|
62
51
|
// https://source.chromium.org/chromium/chromium/src/+/main:testing/variations/README.md
|
|
63
52
|
"--disable-background-networking",
|
|
@@ -68,7 +57,8 @@ const chromiumSwitches = [
|
|
|
68
57
|
// Avoids unneeded network activity after startup.
|
|
69
58
|
"--no-default-browser-check",
|
|
70
59
|
"--disable-dev-shm-usage",
|
|
71
|
-
"--disable-features=" + disabledFeatures.join(","),
|
|
60
|
+
"--disable-features=" + disabledFeatures(assistantMode).join(","),
|
|
61
|
+
channel === "chromium-tip-of-tree" ? "--enable-features=CDPScreenshotNewSurface" : "",
|
|
72
62
|
"--disable-hang-monitor",
|
|
73
63
|
"--disable-prompt-on-repost",
|
|
74
64
|
"--disable-renderer-backgrounding",
|
|
@@ -81,8 +71,11 @@ const chromiumSwitches = [
|
|
|
81
71
|
"--export-tagged-pdf",
|
|
82
72
|
// https://chromium-review.googlesource.com/c/chromium/src/+/4853540
|
|
83
73
|
"--disable-search-engine-choice-screen",
|
|
74
|
+
// Edge can potentially restart on Windows (msRelaunchNoCompatLayer) which looses its file descriptors (stdout/stderr) and CDP (3/4). Disable until fixed upstream.
|
|
75
|
+
"--edge-skip-compat-layer-relaunch",
|
|
76
|
+
assistantMode ? "" : "--enable-automation",
|
|
84
77
|
"--disable-blink-features=AutomationControlled"
|
|
85
|
-
];
|
|
78
|
+
].filter(Boolean);
|
|
86
79
|
// Annotate the CommonJS export names for ESM import in node:
|
|
87
80
|
0 && (module.exports = {
|
|
88
81
|
chromiumSwitches
|
|
@@ -66,7 +66,7 @@ class CRBrowser extends import_browser.Browser {
|
|
|
66
66
|
}
|
|
67
67
|
static async connect(parent, transport, options, devtools) {
|
|
68
68
|
options = { ...options };
|
|
69
|
-
const connection = new import_crConnection.CRConnection(transport, options.protocolLogger, options.browserLogsCollector);
|
|
69
|
+
const connection = new import_crConnection.CRConnection(parent, transport, options.protocolLogger, options.browserLogsCollector);
|
|
70
70
|
const browser = new CRBrowser(parent, connection, options);
|
|
71
71
|
browser._devtools = devtools;
|
|
72
72
|
if (browser.isClank())
|
|
@@ -133,7 +133,7 @@ class CRBrowser extends import_browser.Browser {
|
|
|
133
133
|
async _waitForAllPagesToBeInitialized() {
|
|
134
134
|
await Promise.all([...this._crPages.values()].map((crPage) => crPage._page.waitForInitializedOrError()));
|
|
135
135
|
}
|
|
136
|
-
_onAttachedToTarget({ targetInfo, sessionId
|
|
136
|
+
_onAttachedToTarget({ targetInfo, sessionId }) {
|
|
137
137
|
if (targetInfo.type === "browser")
|
|
138
138
|
return;
|
|
139
139
|
const session = this._session.createChildSession(sessionId);
|
|
@@ -210,7 +210,7 @@ class CRBrowser extends import_browser.Browser {
|
|
|
210
210
|
}
|
|
211
211
|
_findOwningPage(frameId) {
|
|
212
212
|
for (const crPage of this._crPages.values()) {
|
|
213
|
-
const frame = crPage._page.
|
|
213
|
+
const frame = crPage._page.frameManager.frame(frameId);
|
|
214
214
|
if (frame)
|
|
215
215
|
return crPage;
|
|
216
216
|
}
|
|
@@ -243,7 +243,7 @@ class CRBrowser extends import_browser.Browser {
|
|
|
243
243
|
}
|
|
244
244
|
async startTracing(page, options = {}) {
|
|
245
245
|
(0, import_assert.assert)(!this._tracingRecording, "Cannot start recording trace while already recording trace.");
|
|
246
|
-
this._tracingClient = page ? page.
|
|
246
|
+
this._tracingClient = page ? page.delegate._mainFrameSession._client : this._session;
|
|
247
247
|
const defaultCategories = [
|
|
248
248
|
"-*",
|
|
249
249
|
"devtools.timeline",
|
|
@@ -323,25 +323,57 @@ class CRBrowserContext extends import_browserContext.BrowserContext {
|
|
|
323
323
|
return this._crPages().map((crPage) => crPage._page);
|
|
324
324
|
}
|
|
325
325
|
async doCreateNewPage() {
|
|
326
|
-
(0, import_browserContext.assertBrowserContextIsNotOwned)(this);
|
|
327
326
|
const { targetId } = await this._browser._session.send("Target.createTarget", { url: "about:blank", browserContextId: this._browserContextId });
|
|
328
327
|
return this._browser._crPages.get(targetId)._page;
|
|
329
328
|
}
|
|
330
329
|
async doGetCookies(urls) {
|
|
331
330
|
const { cookies } = await this._browser._session.send("Storage.getCookies", { browserContextId: this._browserContextId });
|
|
332
331
|
return network.filterCookies(cookies.map((c) => {
|
|
333
|
-
const
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
332
|
+
const { name, value, domain, path: path2, expires, httpOnly, secure, sameSite } = c;
|
|
333
|
+
const copy = {
|
|
334
|
+
name,
|
|
335
|
+
value,
|
|
336
|
+
domain,
|
|
337
|
+
path: path2,
|
|
338
|
+
expires,
|
|
339
|
+
httpOnly,
|
|
340
|
+
secure,
|
|
341
|
+
sameSite: sameSite ?? "Lax"
|
|
342
|
+
};
|
|
343
|
+
if (c.partitionKey) {
|
|
344
|
+
copy._crHasCrossSiteAncestor = c.partitionKey.hasCrossSiteAncestor;
|
|
345
|
+
copy.partitionKey = c.partitionKey.topLevelSite;
|
|
346
|
+
}
|
|
340
347
|
return copy;
|
|
341
348
|
}), urls);
|
|
342
349
|
}
|
|
343
350
|
async addCookies(cookies) {
|
|
344
|
-
|
|
351
|
+
function toChromiumCookie(cookie) {
|
|
352
|
+
const { name, value, url, domain, path: path2, expires, httpOnly, secure, sameSite, partitionKey, _crHasCrossSiteAncestor } = cookie;
|
|
353
|
+
const copy = {
|
|
354
|
+
name,
|
|
355
|
+
value,
|
|
356
|
+
url,
|
|
357
|
+
domain,
|
|
358
|
+
path: path2,
|
|
359
|
+
expires,
|
|
360
|
+
httpOnly,
|
|
361
|
+
secure,
|
|
362
|
+
sameSite
|
|
363
|
+
};
|
|
364
|
+
if (partitionKey) {
|
|
365
|
+
copy.partitionKey = {
|
|
366
|
+
topLevelSite: partitionKey,
|
|
367
|
+
// _crHasCrossSiteAncestor is non-standard, set it true by default if the cookie is partitioned.
|
|
368
|
+
hasCrossSiteAncestor: _crHasCrossSiteAncestor ?? true
|
|
369
|
+
};
|
|
370
|
+
}
|
|
371
|
+
return copy;
|
|
372
|
+
}
|
|
373
|
+
await this._browser._session.send("Storage.setCookies", {
|
|
374
|
+
cookies: network.rewriteCookies(cookies).map(toChromiumCookie),
|
|
375
|
+
browserContextId: this._browserContextId
|
|
376
|
+
});
|
|
345
377
|
}
|
|
346
378
|
async doClearCookies() {
|
|
347
379
|
await this._browser._session.send("Storage.clearCookies", { browserContextId: this._browserContextId });
|
|
@@ -363,7 +395,8 @@ class CRBrowserContext extends import_browserContext.BrowserContext {
|
|
|
363
395
|
["payment-handler", "paymentHandler"],
|
|
364
396
|
// chrome-specific permissions we have.
|
|
365
397
|
["midi-sysex", "midiSysex"],
|
|
366
|
-
["storage-access", "storageAccess"]
|
|
398
|
+
["storage-access", "storageAccess"],
|
|
399
|
+
["local-fonts", "localFonts"]
|
|
367
400
|
]);
|
|
368
401
|
const filtered = permissions.map((permission) => {
|
|
369
402
|
const protocolPermission = webPermissionToProtocol.get(permission);
|
|
@@ -380,51 +413,55 @@ class CRBrowserContext extends import_browserContext.BrowserContext {
|
|
|
380
413
|
(0, import_browserContext.verifyGeolocation)(geolocation);
|
|
381
414
|
this._options.geolocation = geolocation;
|
|
382
415
|
for (const page of this.pages())
|
|
383
|
-
await page.
|
|
416
|
+
await page.delegate.updateGeolocation();
|
|
384
417
|
}
|
|
385
|
-
async
|
|
386
|
-
this._options.extraHTTPHeaders = headers;
|
|
418
|
+
async doUpdateExtraHTTPHeaders() {
|
|
387
419
|
for (const page of this.pages())
|
|
388
|
-
await page.
|
|
420
|
+
await page.delegate.updateExtraHTTPHeaders();
|
|
389
421
|
for (const sw of this.serviceWorkers())
|
|
390
422
|
await sw.updateExtraHTTPHeaders();
|
|
391
423
|
}
|
|
392
424
|
async setUserAgent(userAgent) {
|
|
393
425
|
this._options.userAgent = userAgent;
|
|
394
426
|
for (const page of this.pages())
|
|
395
|
-
await page.
|
|
427
|
+
await page.delegate.updateUserAgent();
|
|
396
428
|
}
|
|
397
|
-
async
|
|
398
|
-
this._options.offline = offline;
|
|
429
|
+
async doUpdateOffline() {
|
|
399
430
|
for (const page of this.pages())
|
|
400
|
-
await page.
|
|
431
|
+
await page.delegate.updateOffline();
|
|
401
432
|
for (const sw of this.serviceWorkers())
|
|
402
433
|
await sw.updateOffline();
|
|
403
434
|
}
|
|
404
435
|
async doSetHTTPCredentials(httpCredentials) {
|
|
405
436
|
this._options.httpCredentials = httpCredentials;
|
|
406
437
|
for (const page of this.pages())
|
|
407
|
-
await page.
|
|
438
|
+
await page.delegate.updateHttpCredentials();
|
|
408
439
|
for (const sw of this.serviceWorkers())
|
|
409
440
|
await sw.updateHttpCredentials();
|
|
410
441
|
}
|
|
411
442
|
async doAddInitScript(initScript) {
|
|
412
443
|
for (const page of this.pages())
|
|
413
|
-
await page.
|
|
444
|
+
await page.delegate.addInitScript(initScript);
|
|
445
|
+
}
|
|
446
|
+
async doRemoveInitScripts(initScripts) {
|
|
447
|
+
for (const page of this.pages()) await page.delegate.removeInitScripts();
|
|
414
448
|
}
|
|
415
449
|
async doUpdateRequestInterception() {
|
|
416
450
|
for (const page of this.pages())
|
|
417
|
-
await page.
|
|
451
|
+
await page.delegate.updateRequestInterception();
|
|
418
452
|
for (const sw of this.serviceWorkers())
|
|
419
453
|
await sw.updateRequestInterception();
|
|
420
454
|
}
|
|
455
|
+
async doUpdateDefaultViewport() {
|
|
456
|
+
}
|
|
457
|
+
async doUpdateDefaultEmulatedMedia() {
|
|
458
|
+
}
|
|
459
|
+
async doExposePlaywrightBinding() {
|
|
460
|
+
for (const page of this._crPages())
|
|
461
|
+
await page.exposePlaywrightBinding();
|
|
462
|
+
}
|
|
421
463
|
async doClose(reason) {
|
|
422
|
-
|
|
423
|
-
for (const crPage of this._crPages()) {
|
|
424
|
-
const dialogs = [...crPage._page._frameManager._openedDialogs].filter((dialog) => dialog.type() === "beforeunload");
|
|
425
|
-
openedBeforeUnloadDialogs.push(...dialogs);
|
|
426
|
-
}
|
|
427
|
-
await Promise.all(openedBeforeUnloadDialogs.map((dialog) => dialog.dismiss()));
|
|
464
|
+
await this.dialogManager.closeBeforeUnloadDialogs();
|
|
428
465
|
if (!this._browserContextId) {
|
|
429
466
|
await this.stopVideoRecording();
|
|
430
467
|
await this._browser.close({ reason });
|
|
@@ -433,7 +470,7 @@ class CRBrowserContext extends import_browserContext.BrowserContext {
|
|
|
433
470
|
await this._browser._session.send("Target.disposeBrowserContext", { browserContextId: this._browserContextId });
|
|
434
471
|
this._browser._contexts.delete(this._browserContextId);
|
|
435
472
|
for (const [targetId, serviceWorker] of this._browser._serviceWorkers) {
|
|
436
|
-
if (serviceWorker.
|
|
473
|
+
if (serviceWorker.browserContext !== this)
|
|
437
474
|
continue;
|
|
438
475
|
serviceWorker.didClose();
|
|
439
476
|
this._browser._serviceWorkers.delete(targetId);
|
|
@@ -469,14 +506,14 @@ class CRBrowserContext extends import_browserContext.BrowserContext {
|
|
|
469
506
|
return result;
|
|
470
507
|
}
|
|
471
508
|
serviceWorkers() {
|
|
472
|
-
return Array.from(this._browser._serviceWorkers.values()).filter((serviceWorker) => serviceWorker.
|
|
509
|
+
return Array.from(this._browser._serviceWorkers.values()).filter((serviceWorker) => serviceWorker.browserContext === this);
|
|
473
510
|
}
|
|
474
511
|
async newCDPSession(page) {
|
|
475
512
|
let targetId = null;
|
|
476
513
|
if (page instanceof import_page.Page) {
|
|
477
|
-
targetId = page.
|
|
514
|
+
targetId = page.delegate._targetId;
|
|
478
515
|
} else if (page instanceof import_frames.Frame) {
|
|
479
|
-
const session = page._page.
|
|
516
|
+
const session = page._page.delegate._sessions.get(page._id);
|
|
480
517
|
if (!session)
|
|
481
518
|
throw new Error(`This frame does not have a separate CDP session, it is a part of the parent frame's session`);
|
|
482
519
|
targetId = session._targetId;
|
|
@@ -486,14 +523,11 @@ class CRBrowserContext extends import_browserContext.BrowserContext {
|
|
|
486
523
|
const rootSession = await this._browser._clientRootSession();
|
|
487
524
|
return rootSession.attachToTarget(targetId);
|
|
488
525
|
}
|
|
489
|
-
async doRemoveInitScripts() {
|
|
490
|
-
for (const page of this.pages()) await page._delegate.removeInitScripts();
|
|
491
|
-
}
|
|
492
526
|
async doExposeBinding(binding) {
|
|
493
|
-
for (const page of this.pages()) await page.
|
|
527
|
+
for (const page of this.pages()) await page.delegate.exposeBinding(binding);
|
|
494
528
|
}
|
|
495
529
|
async doRemoveExposedBindings() {
|
|
496
|
-
for (const page of this.pages()) await page.
|
|
530
|
+
for (const page of this.pages()) await page.delegate.removeExposedBindings();
|
|
497
531
|
}
|
|
498
532
|
}
|
|
499
533
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -25,18 +25,18 @@ __export(crConnection_exports, {
|
|
|
25
25
|
kBrowserCloseMessageId: () => kBrowserCloseMessageId
|
|
26
26
|
});
|
|
27
27
|
module.exports = __toCommonJS(crConnection_exports);
|
|
28
|
-
var import_events = require("events");
|
|
29
28
|
var import_utils = require("../../utils");
|
|
30
29
|
var import_debugLogger = require("../utils/debugLogger");
|
|
31
30
|
var import_helper = require("../helper");
|
|
32
31
|
var import_protocolError = require("../protocolError");
|
|
32
|
+
var import_instrumentation = require("../instrumentation");
|
|
33
33
|
const ConnectionEvents = {
|
|
34
34
|
Disconnected: Symbol("ConnectionEvents.Disconnected")
|
|
35
35
|
};
|
|
36
36
|
const kBrowserCloseMessageId = -9999;
|
|
37
|
-
class CRConnection extends
|
|
38
|
-
constructor(transport, protocolLogger, browserLogsCollector) {
|
|
39
|
-
super();
|
|
37
|
+
class CRConnection extends import_instrumentation.SdkObject {
|
|
38
|
+
constructor(parent, transport, protocolLogger, browserLogsCollector) {
|
|
39
|
+
super(parent, "cr-connection");
|
|
40
40
|
this._lastId = 0;
|
|
41
41
|
this._sessions = /* @__PURE__ */ new Map();
|
|
42
42
|
this._closed = false;
|
|
@@ -83,9 +83,9 @@ class CRConnection extends import_events.EventEmitter {
|
|
|
83
83
|
return new CDPSession(this.rootSession, sessionId);
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
|
-
class CRSession extends
|
|
86
|
+
class CRSession extends import_instrumentation.SdkObject {
|
|
87
87
|
constructor(connection, parentSession, sessionId, eventListener) {
|
|
88
|
-
super();
|
|
88
|
+
super(connection, "cr-session");
|
|
89
89
|
this._callbacks = /* @__PURE__ */ new Map();
|
|
90
90
|
this._crashed = false;
|
|
91
91
|
this._closed = false;
|
|
@@ -160,11 +160,10 @@ class CRSession extends import_events.EventEmitter {
|
|
|
160
160
|
this._callbacks.clear();
|
|
161
161
|
}
|
|
162
162
|
}
|
|
163
|
-
class CDPSession extends
|
|
163
|
+
class CDPSession extends import_instrumentation.SdkObject {
|
|
164
164
|
constructor(parentSession, sessionId) {
|
|
165
|
-
super();
|
|
165
|
+
super(parentSession, "cdp-session");
|
|
166
166
|
this._listeners = [];
|
|
167
|
-
this.guid = `cdp-session@${sessionId}`;
|
|
168
167
|
this._session = parentSession.createChildSession(sessionId, (method, params) => this.emit(CDPSession.Events.Event, { method, params }));
|
|
169
168
|
this._listeners = [import_utils.eventsHelper.addEventListener(parentSession, "Target.detachedFromTarget", (event) => {
|
|
170
169
|
if (event.sessionId === sessionId)
|
|
@@ -23,19 +23,20 @@ __export(crCoverage_exports, {
|
|
|
23
23
|
module.exports = __toCommonJS(crCoverage_exports);
|
|
24
24
|
var import_utils = require("../../utils");
|
|
25
25
|
var import_eventsHelper = require("../utils/eventsHelper");
|
|
26
|
+
var import_progress = require("../progress");
|
|
26
27
|
class CRCoverage {
|
|
27
28
|
constructor(client) {
|
|
28
29
|
this._jsCoverage = new JSCoverage(client);
|
|
29
30
|
this._cssCoverage = new CSSCoverage(client);
|
|
30
31
|
}
|
|
31
|
-
async startJSCoverage(options) {
|
|
32
|
-
|
|
32
|
+
async startJSCoverage(progress, options) {
|
|
33
|
+
await (0, import_progress.raceUncancellableOperationWithCleanup)(progress, () => this._jsCoverage.start(options), () => this._jsCoverage.stop());
|
|
33
34
|
}
|
|
34
35
|
async stopJSCoverage() {
|
|
35
36
|
return await this._jsCoverage.stop();
|
|
36
37
|
}
|
|
37
|
-
async startCSSCoverage(options) {
|
|
38
|
-
|
|
38
|
+
async startCSSCoverage(progress, options) {
|
|
39
|
+
await (0, import_progress.raceUncancellableOperationWithCleanup)(progress, () => this._cssCoverage.start(options), () => this._cssCoverage.stop());
|
|
39
40
|
}
|
|
40
41
|
async stopCSSCoverage() {
|
|
41
42
|
return await this._cssCoverage.stop();
|
|
@@ -92,8 +93,8 @@ class JSCoverage {
|
|
|
92
93
|
this._scriptSources.set(event.scriptId, response.scriptSource);
|
|
93
94
|
}
|
|
94
95
|
async stop() {
|
|
95
|
-
|
|
96
|
-
|
|
96
|
+
if (!this._enabled)
|
|
97
|
+
return { entries: [] };
|
|
97
98
|
const [profileResponse] = await Promise.all([
|
|
98
99
|
this._client.send("Profiler.takePreciseCoverage"),
|
|
99
100
|
this._client.send("Profiler.stopPreciseCoverage"),
|
|
@@ -101,6 +102,7 @@ class JSCoverage {
|
|
|
101
102
|
this._client.send("Debugger.disable")
|
|
102
103
|
]);
|
|
103
104
|
import_eventsHelper.eventsHelper.removeEventListeners(this._eventListeners);
|
|
105
|
+
this._enabled = false;
|
|
104
106
|
const coverage = { entries: [] };
|
|
105
107
|
for (const entry of profileResponse.result) {
|
|
106
108
|
if (!this._scriptIds.has(entry.scriptId))
|
|
@@ -159,14 +161,15 @@ class CSSCoverage {
|
|
|
159
161
|
}
|
|
160
162
|
}
|
|
161
163
|
async stop() {
|
|
162
|
-
|
|
163
|
-
|
|
164
|
+
if (!this._enabled)
|
|
165
|
+
return { entries: [] };
|
|
164
166
|
const ruleTrackingResponse = await this._client.send("CSS.stopRuleUsageTracking");
|
|
165
167
|
await Promise.all([
|
|
166
168
|
this._client.send("CSS.disable"),
|
|
167
169
|
this._client.send("DOM.disable")
|
|
168
170
|
]);
|
|
169
171
|
import_eventsHelper.eventsHelper.removeEventListeners(this._eventListeners);
|
|
172
|
+
this._enabled = false;
|
|
170
173
|
const styleSheetIdToCoverage = /* @__PURE__ */ new Map();
|
|
171
174
|
for (const entry of ruleTrackingResponse.ruleUsage) {
|
|
172
175
|
let ranges = styleSheetIdToCoverage.get(entry.styleSheetId);
|
|
@@ -44,16 +44,16 @@ class DragManager {
|
|
|
44
44
|
this._dragState = null;
|
|
45
45
|
return true;
|
|
46
46
|
}
|
|
47
|
-
async interceptDragCausedByMove(x, y, button, buttons, modifiers, moveCallback) {
|
|
47
|
+
async interceptDragCausedByMove(progress, x, y, button, buttons, modifiers, moveCallback) {
|
|
48
48
|
this._lastPosition = { x, y };
|
|
49
49
|
if (this._dragState) {
|
|
50
|
-
await this._crPage._mainFrameSession._client.send("Input.dispatchDragEvent", {
|
|
50
|
+
await progress.race(this._crPage._mainFrameSession._client.send("Input.dispatchDragEvent", {
|
|
51
51
|
type: "dragOver",
|
|
52
52
|
x,
|
|
53
53
|
y,
|
|
54
54
|
data: this._dragState,
|
|
55
55
|
modifiers: (0, import_crProtocolHelper.toModifiersMask)(modifiers)
|
|
56
|
-
});
|
|
56
|
+
}));
|
|
57
57
|
return;
|
|
58
58
|
}
|
|
59
59
|
if (button !== "left")
|
|
@@ -80,43 +80,48 @@ class DragManager {
|
|
|
80
80
|
return val;
|
|
81
81
|
};
|
|
82
82
|
}
|
|
83
|
-
await this._crPage._page.safeNonStallingEvaluateInAllFrames(`(${setupDragListeners.toString()})()`, "utility");
|
|
84
|
-
client.on("Input.dragIntercepted", onDragIntercepted);
|
|
85
83
|
try {
|
|
84
|
+
let expectingDrag = false;
|
|
85
|
+
await progress.race(this._crPage._page.safeNonStallingEvaluateInAllFrames(`(${setupDragListeners.toString()})()`, "utility"));
|
|
86
|
+
client.on("Input.dragIntercepted", onDragIntercepted);
|
|
86
87
|
await client.send("Input.setInterceptDrags", { enabled: true });
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
88
|
+
try {
|
|
89
|
+
await progress.race(moveCallback());
|
|
90
|
+
expectingDrag = (await Promise.all(this._crPage._page.frames().map(async (frame) => {
|
|
91
|
+
return frame.nonStallingEvaluateInExistingContext("window.__cleanupDrag?.()", "utility").catch(() => false);
|
|
92
|
+
}))).some((x2) => x2);
|
|
93
|
+
} finally {
|
|
94
|
+
client.off("Input.dragIntercepted", onDragIntercepted);
|
|
95
|
+
await client.send("Input.setInterceptDrags", { enabled: false });
|
|
96
|
+
}
|
|
97
|
+
this._dragState = expectingDrag ? (await dragInterceptedPromise).data : null;
|
|
98
|
+
} catch (error) {
|
|
99
|
+
this._crPage._page.safeNonStallingEvaluateInAllFrames("window.__cleanupDrag?.()", "utility").catch(() => {
|
|
100
|
+
});
|
|
101
|
+
throw error;
|
|
90
102
|
}
|
|
91
|
-
await moveCallback();
|
|
92
|
-
const expectingDrag = (await Promise.all(this._crPage._page.frames().map(async (frame) => {
|
|
93
|
-
return frame.nonStallingEvaluateInExistingContext("window.__cleanupDrag && window.__cleanupDrag()", "utility").catch(() => false);
|
|
94
|
-
}))).some((x2) => x2);
|
|
95
|
-
this._dragState = expectingDrag ? (await dragInterceptedPromise).data : null;
|
|
96
|
-
client.off("Input.dragIntercepted", onDragIntercepted);
|
|
97
|
-
await client.send("Input.setInterceptDrags", { enabled: false });
|
|
98
103
|
if (this._dragState) {
|
|
99
|
-
await this._crPage._mainFrameSession._client.send("Input.dispatchDragEvent", {
|
|
104
|
+
await progress.race(this._crPage._mainFrameSession._client.send("Input.dispatchDragEvent", {
|
|
100
105
|
type: "dragEnter",
|
|
101
106
|
x,
|
|
102
107
|
y,
|
|
103
108
|
data: this._dragState,
|
|
104
109
|
modifiers: (0, import_crProtocolHelper.toModifiersMask)(modifiers)
|
|
105
|
-
});
|
|
110
|
+
}));
|
|
106
111
|
}
|
|
107
112
|
}
|
|
108
113
|
isDragging() {
|
|
109
114
|
return !!this._dragState;
|
|
110
115
|
}
|
|
111
|
-
async drop(x, y, modifiers) {
|
|
116
|
+
async drop(progress, x, y, modifiers) {
|
|
112
117
|
(0, import_utils.assert)(this._dragState, "missing drag state");
|
|
113
|
-
await this._crPage._mainFrameSession._client.send("Input.dispatchDragEvent", {
|
|
118
|
+
await progress.race(this._crPage._mainFrameSession._client.send("Input.dispatchDragEvent", {
|
|
114
119
|
type: "drop",
|
|
115
120
|
x,
|
|
116
121
|
y,
|
|
117
122
|
data: this._dragState,
|
|
118
123
|
modifiers: (0, import_crProtocolHelper.toModifiersMask)(modifiers)
|
|
119
|
-
});
|
|
124
|
+
}));
|
|
120
125
|
this._dragState = null;
|
|
121
126
|
}
|
|
122
127
|
}
|
|
@@ -35,6 +35,7 @@ module.exports = __toCommonJS(crExecutionContext_exports);
|
|
|
35
35
|
var import_assert = require("../../utils/isomorphic/assert");
|
|
36
36
|
var import_crProtocolHelper = require("./crProtocolHelper");
|
|
37
37
|
var import_stackTrace = require("../../utils/isomorphic/stackTrace");
|
|
38
|
+
var import_utilityScriptSerializers = require("../../utils/isomorphic/utilityScriptSerializers");
|
|
38
39
|
var js = __toESM(require("../javascript"));
|
|
39
40
|
var dom = __toESM(require("../dom"));
|
|
40
41
|
var import_protocolError = require("../protocolError");
|
|
@@ -77,7 +78,7 @@ class CRExecutionContext {
|
|
|
77
78
|
}).catch(rewriteError);
|
|
78
79
|
if (exceptionDetails)
|
|
79
80
|
throw new js.JavaScriptErrorInEvaluate((0, import_crProtocolHelper.getExceptionMessage)(exceptionDetails));
|
|
80
|
-
return returnByValue ?
|
|
81
|
+
return returnByValue ? (0, import_utilityScriptSerializers.parseEvaluationResultValue)(remoteObject.value) : createHandle(utilityScript._context, remoteObject);
|
|
81
82
|
}
|
|
82
83
|
async getProperties(object) {
|
|
83
84
|
const response = await this._client.send("Runtime.getProperties", {
|
|
@@ -59,12 +59,12 @@ class RawKeyboardImpl {
|
|
|
59
59
|
commands = commands.filter((x) => !x.startsWith("insert"));
|
|
60
60
|
return commands.map((c) => c.substring(0, c.length - 1));
|
|
61
61
|
}
|
|
62
|
-
async keydown(modifiers, keyName, description, autoRepeat) {
|
|
62
|
+
async keydown(progress, modifiers, keyName, description, autoRepeat) {
|
|
63
63
|
const { code, key, location, text } = description;
|
|
64
|
-
if (code === "Escape" && await this._dragManger.cancelDrag())
|
|
64
|
+
if (code === "Escape" && await progress.race(this._dragManger.cancelDrag()))
|
|
65
65
|
return;
|
|
66
66
|
const commands = this._commandsForCode(code, modifiers);
|
|
67
|
-
await this._client.send("Input.dispatchKeyEvent", {
|
|
67
|
+
await progress.race(this._client.send("Input.dispatchKeyEvent", {
|
|
68
68
|
type: text ? "keyDown" : "rawKeyDown",
|
|
69
69
|
modifiers: (0, import_crProtocolHelper.toModifiersMask)(modifiers),
|
|
70
70
|
windowsVirtualKeyCode: description.keyCodeWithoutLocation,
|
|
@@ -76,21 +76,21 @@ class RawKeyboardImpl {
|
|
|
76
76
|
autoRepeat,
|
|
77
77
|
location,
|
|
78
78
|
isKeypad: location === input.keypadLocation
|
|
79
|
-
});
|
|
79
|
+
}));
|
|
80
80
|
}
|
|
81
|
-
async keyup(modifiers, keyName, description) {
|
|
81
|
+
async keyup(progress, modifiers, keyName, description) {
|
|
82
82
|
const { code, key, location } = description;
|
|
83
|
-
await this._client.send("Input.dispatchKeyEvent", {
|
|
83
|
+
await progress.race(this._client.send("Input.dispatchKeyEvent", {
|
|
84
84
|
type: "keyUp",
|
|
85
85
|
modifiers: (0, import_crProtocolHelper.toModifiersMask)(modifiers),
|
|
86
86
|
key,
|
|
87
87
|
windowsVirtualKeyCode: description.keyCodeWithoutLocation,
|
|
88
88
|
code,
|
|
89
89
|
location
|
|
90
|
-
});
|
|
90
|
+
}));
|
|
91
91
|
}
|
|
92
|
-
async sendText(text) {
|
|
93
|
-
await this._client.send("Input.insertText", { text });
|
|
92
|
+
async sendText(progress, text) {
|
|
93
|
+
await progress.race(this._client.send("Input.insertText", { text }));
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
class RawMouseImpl {
|
|
@@ -99,41 +99,44 @@ class RawMouseImpl {
|
|
|
99
99
|
this._client = client;
|
|
100
100
|
this._dragManager = dragManager;
|
|
101
101
|
}
|
|
102
|
-
async move(x, y, button, buttons, modifiers, forClick) {
|
|
102
|
+
async move(progress, x, y, button, buttons, modifiers, forClick) {
|
|
103
103
|
const actualMove = async () => {
|
|
104
|
-
await this._client.send("Input.dispatchMouseEvent", {
|
|
104
|
+
await progress.race(this._client.send("Input.dispatchMouseEvent", {
|
|
105
105
|
type: "mouseMoved",
|
|
106
106
|
button,
|
|
107
107
|
buttons: (0, import_crProtocolHelper.toButtonsMask)(buttons),
|
|
108
108
|
x,
|
|
109
109
|
y,
|
|
110
|
-
modifiers: (0, import_crProtocolHelper.toModifiersMask)(modifiers)
|
|
111
|
-
|
|
110
|
+
modifiers: (0, import_crProtocolHelper.toModifiersMask)(modifiers),
|
|
111
|
+
force: buttons.size > 0 ? 0.5 : 0
|
|
112
|
+
}));
|
|
112
113
|
};
|
|
113
114
|
if (forClick) {
|
|
114
|
-
|
|
115
|
+
await actualMove();
|
|
116
|
+
return;
|
|
115
117
|
}
|
|
116
|
-
await this._dragManager.interceptDragCausedByMove(x, y, button, buttons, modifiers, actualMove);
|
|
118
|
+
await this._dragManager.interceptDragCausedByMove(progress, x, y, button, buttons, modifiers, actualMove);
|
|
117
119
|
}
|
|
118
|
-
async down(x, y, button, buttons, modifiers, clickCount) {
|
|
120
|
+
async down(progress, x, y, button, buttons, modifiers, clickCount) {
|
|
119
121
|
if (this._dragManager.isDragging())
|
|
120
122
|
return;
|
|
121
|
-
await this._client.send("Input.dispatchMouseEvent", {
|
|
123
|
+
await progress.race(this._client.send("Input.dispatchMouseEvent", {
|
|
122
124
|
type: "mousePressed",
|
|
123
125
|
button,
|
|
124
126
|
buttons: (0, import_crProtocolHelper.toButtonsMask)(buttons),
|
|
125
127
|
x,
|
|
126
128
|
y,
|
|
127
129
|
modifiers: (0, import_crProtocolHelper.toModifiersMask)(modifiers),
|
|
128
|
-
clickCount
|
|
129
|
-
|
|
130
|
+
clickCount,
|
|
131
|
+
force: buttons.size > 0 ? 0.5 : 0
|
|
132
|
+
}));
|
|
130
133
|
}
|
|
131
|
-
async up(x, y, button, buttons, modifiers, clickCount) {
|
|
134
|
+
async up(progress, x, y, button, buttons, modifiers, clickCount) {
|
|
132
135
|
if (this._dragManager.isDragging()) {
|
|
133
|
-
await this._dragManager.drop(x, y, modifiers);
|
|
136
|
+
await this._dragManager.drop(progress, x, y, modifiers);
|
|
134
137
|
return;
|
|
135
138
|
}
|
|
136
|
-
await this._client.send("Input.dispatchMouseEvent", {
|
|
139
|
+
await progress.race(this._client.send("Input.dispatchMouseEvent", {
|
|
137
140
|
type: "mouseReleased",
|
|
138
141
|
button,
|
|
139
142
|
buttons: (0, import_crProtocolHelper.toButtonsMask)(buttons),
|
|
@@ -141,25 +144,25 @@ class RawMouseImpl {
|
|
|
141
144
|
y,
|
|
142
145
|
modifiers: (0, import_crProtocolHelper.toModifiersMask)(modifiers),
|
|
143
146
|
clickCount
|
|
144
|
-
});
|
|
147
|
+
}));
|
|
145
148
|
}
|
|
146
|
-
async wheel(x, y, buttons, modifiers, deltaX, deltaY) {
|
|
147
|
-
await this._client.send("Input.dispatchMouseEvent", {
|
|
149
|
+
async wheel(progress, x, y, buttons, modifiers, deltaX, deltaY) {
|
|
150
|
+
await progress.race(this._client.send("Input.dispatchMouseEvent", {
|
|
148
151
|
type: "mouseWheel",
|
|
149
152
|
x,
|
|
150
153
|
y,
|
|
151
154
|
modifiers: (0, import_crProtocolHelper.toModifiersMask)(modifiers),
|
|
152
155
|
deltaX,
|
|
153
156
|
deltaY
|
|
154
|
-
});
|
|
157
|
+
}));
|
|
155
158
|
}
|
|
156
159
|
}
|
|
157
160
|
class RawTouchscreenImpl {
|
|
158
161
|
constructor(client) {
|
|
159
162
|
this._client = client;
|
|
160
163
|
}
|
|
161
|
-
async tap(x, y, modifiers) {
|
|
162
|
-
await Promise.all([
|
|
164
|
+
async tap(progress, x, y, modifiers) {
|
|
165
|
+
await progress.race(Promise.all([
|
|
163
166
|
this._client.send("Input.dispatchTouchEvent", {
|
|
164
167
|
type: "touchStart",
|
|
165
168
|
modifiers: (0, import_crProtocolHelper.toModifiersMask)(modifiers),
|
|
@@ -173,7 +176,7 @@ class RawTouchscreenImpl {
|
|
|
173
176
|
modifiers: (0, import_crProtocolHelper.toModifiersMask)(modifiers),
|
|
174
177
|
touchPoints: []
|
|
175
178
|
})
|
|
176
|
-
]);
|
|
179
|
+
]));
|
|
177
180
|
}
|
|
178
181
|
}
|
|
179
182
|
// Annotate the CommonJS export names for ESM import in node:
|