playwright-core 1.54.0-alpha-2025-06-12 → 1.54.0-alpha-2025-06-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.
Files changed (30) hide show
  1. package/browsers.json +10 -10
  2. package/lib/generated/injectedScriptSource.js +1 -1
  3. package/lib/server/bidi/bidiInput.js +19 -16
  4. package/lib/server/bidi/bidiPage.js +1 -1
  5. package/lib/server/browserContext.js +12 -7
  6. package/lib/server/chromium/crBrowser.js +2 -1
  7. package/lib/server/chromium/crDragDrop.js +7 -2
  8. package/lib/server/chromium/crInput.js +21 -11
  9. package/lib/server/chromium/crPage.js +2 -2
  10. package/lib/server/deviceDescriptorsSource.json +54 -54
  11. package/lib/server/dispatchers/androidDispatcher.js +4 -2
  12. package/lib/server/dispatchers/pageDispatcher.js +17 -12
  13. package/lib/server/dom.js +10 -11
  14. package/lib/server/firefox/ffInput.js +16 -8
  15. package/lib/server/firefox/ffPage.js +2 -2
  16. package/lib/server/frames.js +7 -7
  17. package/lib/server/input.js +91 -52
  18. package/lib/server/launchApp.js +1 -1
  19. package/lib/server/page.js +5 -5
  20. package/lib/server/recorder/recorderRunner.js +1 -1
  21. package/lib/server/webkit/wkInput.js +17 -8
  22. package/lib/server/webkit/wkPage.js +1 -1
  23. package/lib/vite/traceViewer/assets/{codeMirrorModule-BKr-mZ2D.js → codeMirrorModule-CgepVw_3.js} +1 -1
  24. package/lib/vite/traceViewer/assets/{defaultSettingsView-CzQxXsO4.js → defaultSettingsView-3fKvgZ5q.js} +77 -77
  25. package/lib/vite/traceViewer/{index.BT-45kLv.js → index.B3b5SgUS.js} +1 -1
  26. package/lib/vite/traceViewer/index.html +2 -2
  27. package/lib/vite/traceViewer/{uiMode.BuGgfvGl.js → uiMode.D35cTLb_.js} +1 -1
  28. package/lib/vite/traceViewer/uiMode.html +2 -2
  29. package/package.json +1 -1
  30. package/types/types.d.ts +1 -0
@@ -58,7 +58,7 @@ class RawKeyboardImpl {
58
58
  constructor(client) {
59
59
  this._client = client;
60
60
  }
61
- async keydown(modifiers, keyName, description, autoRepeat) {
61
+ async keydown(progress, modifiers, keyName, description, autoRepeat) {
62
62
  let text = description.text;
63
63
  if (text === "\r")
64
64
  text = "";
@@ -72,8 +72,9 @@ class RawKeyboardImpl {
72
72
  location,
73
73
  text
74
74
  });
75
+ progress.throwIfAborted();
75
76
  }
76
- async keyup(modifiers, keyName, description) {
77
+ async keyup(progress, modifiers, keyName, description) {
77
78
  const { code, key, location } = description;
78
79
  await this._client.send("Page.dispatchKeyEvent", {
79
80
  type: "keyup",
@@ -83,16 +84,18 @@ class RawKeyboardImpl {
83
84
  location,
84
85
  repeat: false
85
86
  });
87
+ progress.throwIfAborted();
86
88
  }
87
- async sendText(text) {
89
+ async sendText(progress, text) {
88
90
  await this._client.send("Page.insertText", { text });
91
+ progress.throwIfAborted();
89
92
  }
90
93
  }
91
94
  class RawMouseImpl {
92
95
  constructor(client) {
93
96
  this._client = client;
94
97
  }
95
- async move(x, y, button, buttons, modifiers, forClick) {
98
+ async move(progress, x, y, button, buttons, modifiers, forClick) {
96
99
  await this._client.send("Page.dispatchMouseEvent", {
97
100
  type: "mousemove",
98
101
  button: 0,
@@ -101,8 +104,9 @@ class RawMouseImpl {
101
104
  y: Math.floor(y),
102
105
  modifiers: toModifiersMask(modifiers)
103
106
  });
107
+ progress.throwIfAborted();
104
108
  }
105
- async down(x, y, button, buttons, modifiers, clickCount) {
109
+ async down(progress, x, y, button, buttons, modifiers, clickCount) {
106
110
  await this._client.send("Page.dispatchMouseEvent", {
107
111
  type: "mousedown",
108
112
  button: toButtonNumber(button),
@@ -112,8 +116,9 @@ class RawMouseImpl {
112
116
  modifiers: toModifiersMask(modifiers),
113
117
  clickCount
114
118
  });
119
+ progress.throwIfAborted();
115
120
  }
116
- async up(x, y, button, buttons, modifiers, clickCount) {
121
+ async up(progress, x, y, button, buttons, modifiers, clickCount) {
117
122
  await this._client.send("Page.dispatchMouseEvent", {
118
123
  type: "mouseup",
119
124
  button: toButtonNumber(button),
@@ -123,8 +128,9 @@ class RawMouseImpl {
123
128
  modifiers: toModifiersMask(modifiers),
124
129
  clickCount
125
130
  });
131
+ progress.throwIfAborted();
126
132
  }
127
- async wheel(x, y, buttons, modifiers, deltaX, deltaY) {
133
+ async wheel(progress, x, y, buttons, modifiers, deltaX, deltaY) {
128
134
  await this._page.mainFrame().evaluateExpression(`new Promise(requestAnimationFrame)`, { world: "utility" });
129
135
  await this._client.send("Page.dispatchWheelEvent", {
130
136
  deltaX,
@@ -134,6 +140,7 @@ class RawMouseImpl {
134
140
  deltaZ: 0,
135
141
  modifiers: toModifiersMask(modifiers)
136
142
  });
143
+ progress.throwIfAborted();
137
144
  }
138
145
  setPage(page) {
139
146
  this._page = page;
@@ -143,12 +150,13 @@ class RawTouchscreenImpl {
143
150
  constructor(client) {
144
151
  this._client = client;
145
152
  }
146
- async tap(x, y, modifiers) {
153
+ async tap(progress, x, y, modifiers) {
147
154
  await this._client.send("Page.dispatchTapEvent", {
148
155
  x,
149
156
  y,
150
157
  modifiers: toModifiersMask(modifiers)
151
158
  });
159
+ progress.throwIfAborted();
152
160
  }
153
161
  }
154
162
  // Annotate the CommonJS export names for ESM import in node:
@@ -475,8 +475,8 @@ class FFPage {
475
475
  }
476
476
  async inputActionEpilogue() {
477
477
  }
478
- async resetForReuse() {
479
- await this.rawMouse.move(-1, -1, "none", /* @__PURE__ */ new Set(), /* @__PURE__ */ new Set(), false);
478
+ async resetForReuse(progress) {
479
+ await this.rawMouse.move(progress, -1, -1, "none", /* @__PURE__ */ new Set(), /* @__PURE__ */ new Set(), false);
480
480
  }
481
481
  async getFrameElement(frame) {
482
482
  const parent = frame.parentFrame();
@@ -488,7 +488,7 @@ class Frame extends import_instrumentation.SdkObject {
488
488
  const controller = new import_progress.ProgressController((0, import_instrumentation.serverSideCallMetadata)(), this);
489
489
  const data = {
490
490
  url,
491
- gotoPromise: controller.run((progress) => this._gotoAction(progress, url, { referer }), 0)
491
+ gotoPromise: controller.run((progress) => this.gotoImpl(progress, url, { referer }), 0)
492
492
  };
493
493
  this._redirectedNavigations.set(documentId, data);
494
494
  data.gotoPromise.finally(() => this._redirectedNavigations.delete(documentId));
@@ -497,10 +497,10 @@ class Frame extends import_instrumentation.SdkObject {
497
497
  const constructedNavigationURL = (0, import_utils.constructURLBasedOnBaseURL)(this._page.browserContext._options.baseURL, url);
498
498
  const controller = new import_progress.ProgressController(metadata, this);
499
499
  return controller.run((progress) => {
500
- return this.raceNavigationAction(progress, options, async () => this._gotoAction(progress, constructedNavigationURL, options));
500
+ return this.raceNavigationAction(progress, options, async () => this.gotoImpl(progress, constructedNavigationURL, options));
501
501
  }, options.timeout);
502
502
  }
503
- async _gotoAction(progress, url, options) {
503
+ async gotoImpl(progress, url, options) {
504
504
  const waitUntil = verifyLifecycle("waitUntil", options.waitUntil === void 0 ? "load" : options.waitUntil);
505
505
  progress.log(`navigating to "${url}", waiting until "${waitUntil}"`);
506
506
  const headers = this._page.extraHTTPHeaders() || [];
@@ -971,8 +971,8 @@ class Frame extends import_instrumentation.SdkObject {
971
971
  await controller.run(async (progress) => {
972
972
  dom.assertDone(await this._retryWithProgressIfNotConnected(progress, source, options.strict, !options.force, async (handle) => {
973
973
  return handle._retryPointerAction(progress, "move and down", false, async (point) => {
974
- await this._page.mouse.move(point.x, point.y);
975
- await this._page.mouse.down();
974
+ await this._page.mouse._move(progress, point.x, point.y);
975
+ await this._page.mouse._down(progress);
976
976
  }, {
977
977
  ...options,
978
978
  waitAfter: "disabled",
@@ -982,8 +982,8 @@ class Frame extends import_instrumentation.SdkObject {
982
982
  }));
983
983
  dom.assertDone(await this._retryWithProgressIfNotConnected(progress, target, options.strict, false, async (handle) => {
984
984
  return handle._retryPointerAction(progress, "move and up", false, async (point) => {
985
- await this._page.mouse.move(point.x, point.y);
986
- await this._page.mouse.up();
985
+ await this._page.mouse._move(progress, point.x, point.y);
986
+ await this._page.mouse._up(progress);
987
987
  }, {
988
988
  ...options,
989
989
  waitAfter: "disabled",
@@ -38,21 +38,27 @@ __export(input_exports, {
38
38
  module.exports = __toCommonJS(input_exports);
39
39
  var import_utils = require("../utils");
40
40
  var keyboardLayout = __toESM(require("./usKeyboardLayout"));
41
+ var import_progress = require("./progress");
41
42
  const keypadLocation = keyboardLayout.keypadLocation;
42
43
  const kModifiers = ["Alt", "Control", "Meta", "Shift"];
43
44
  class Keyboard {
44
- constructor(raw) {
45
+ constructor(raw, page) {
45
46
  this._pressedModifiers = /* @__PURE__ */ new Set();
46
47
  this._pressedKeys = /* @__PURE__ */ new Set();
47
48
  this._raw = raw;
49
+ this._page = page;
48
50
  }
49
- async down(key) {
51
+ async down(metadata, key) {
52
+ const controller = new import_progress.ProgressController(metadata, this._page);
53
+ return controller.run((progress) => this._down(progress, key));
54
+ }
55
+ async _down(progress, key) {
50
56
  const description = this._keyDescriptionForString(key);
51
57
  const autoRepeat = this._pressedKeys.has(description.code);
52
58
  this._pressedKeys.add(description.code);
53
59
  if (kModifiers.includes(description.key))
54
60
  this._pressedModifiers.add(description.key);
55
- await this._raw.keydown(this._pressedModifiers, key, description, autoRepeat);
61
+ await this._raw.keydown(progress, this._pressedModifiers, key, description, autoRepeat);
56
62
  }
57
63
  _keyDescriptionForString(str) {
58
64
  const keyString = resolveSmartModifierString(str);
@@ -64,29 +70,45 @@ class Keyboard {
64
70
  return { ...description, text: "" };
65
71
  return description;
66
72
  }
67
- async up(key) {
73
+ async up(metadata, key) {
74
+ const controller = new import_progress.ProgressController(metadata, this._page);
75
+ return controller.run((progress) => this._up(progress, key));
76
+ }
77
+ async _up(progress, key) {
68
78
  const description = this._keyDescriptionForString(key);
69
79
  if (kModifiers.includes(description.key))
70
80
  this._pressedModifiers.delete(description.key);
71
81
  this._pressedKeys.delete(description.code);
72
- await this._raw.keyup(this._pressedModifiers, key, description);
82
+ await this._raw.keyup(progress, this._pressedModifiers, key, description);
73
83
  }
74
- async insertText(text) {
75
- await this._raw.sendText(text);
84
+ async insertText(metadata, text) {
85
+ const controller = new import_progress.ProgressController(metadata, this._page);
86
+ return controller.run((progress) => this._insertText(progress, text));
76
87
  }
77
- async type(text, options) {
88
+ async _insertText(progress, text) {
89
+ await this._raw.sendText(progress, text);
90
+ }
91
+ async type(metadata, text, options) {
92
+ const controller = new import_progress.ProgressController(metadata, this._page);
93
+ return controller.run((progress) => this._type(progress, text, options));
94
+ }
95
+ async _type(progress, text, options) {
78
96
  const delay = options && options.delay || void 0;
79
97
  for (const char of text) {
80
98
  if (usKeyboardLayout.has(char)) {
81
- await this.press(char, { delay });
99
+ await this._press(progress, char, { delay });
82
100
  } else {
83
101
  if (delay)
84
- await new Promise((f) => setTimeout(f, delay));
85
- await this.insertText(char);
102
+ await wait(progress, delay);
103
+ await this._insertText(progress, char);
86
104
  }
87
105
  }
88
106
  }
89
- async press(key, options = {}) {
107
+ async press(metadata, key, options) {
108
+ const controller = new import_progress.ProgressController(metadata, this._page);
109
+ return controller.run((progress) => this._press(progress, key, options));
110
+ }
111
+ async _press(progress, key, options = {}) {
90
112
  function split(keyString) {
91
113
  const keys = [];
92
114
  let building = "";
@@ -104,15 +126,15 @@ class Keyboard {
104
126
  const tokens = split(key);
105
127
  key = tokens[tokens.length - 1];
106
128
  for (let i = 0; i < tokens.length - 1; ++i)
107
- await this.down(tokens[i]);
108
- await this.down(key);
129
+ await this._down(progress, tokens[i]);
130
+ await this._down(progress, key);
109
131
  if (options.delay)
110
- await new Promise((f) => setTimeout(f, options.delay));
111
- await this.up(key);
132
+ await wait(progress, options.delay);
133
+ await this._up(progress, key);
112
134
  for (let i = tokens.length - 2; i >= 0; --i)
113
- await this.up(tokens[i]);
135
+ await this._up(progress, tokens[i]);
114
136
  }
115
- async ensureModifiers(mm) {
137
+ async ensureModifiers(progress, mm) {
116
138
  const modifiers = mm.map(resolveSmartModifier);
117
139
  for (const modifier of modifiers) {
118
140
  if (!kModifiers.includes(modifier))
@@ -123,9 +145,9 @@ class Keyboard {
123
145
  const needDown = modifiers.includes(key);
124
146
  const isDown = this._pressedModifiers.has(key);
125
147
  if (needDown && !isDown)
126
- await this.down(key);
148
+ await this._down(progress, key);
127
149
  else if (!needDown && isDown)
128
- await this.up(key);
150
+ await this._up(progress, key);
129
151
  }
130
152
  return restore;
131
153
  }
@@ -151,9 +173,14 @@ class Mouse {
151
173
  this._page = page;
152
174
  this._keyboard = this._page.keyboard;
153
175
  }
154
- async move(x, y, options = {}, metadata) {
155
- if (metadata)
156
- metadata.point = { x, y };
176
+ currentPoint() {
177
+ return { x: this._x, y: this._y };
178
+ }
179
+ async move(metadata, x, y, options) {
180
+ const controller = new import_progress.ProgressController(metadata, this._page);
181
+ return controller.run((progress) => this._move(progress, x, y, options));
182
+ }
183
+ async _move(progress, x, y, options = {}) {
157
184
  const { steps = 1 } = options;
158
185
  const fromX = this._x;
159
186
  const fromY = this._y;
@@ -162,53 +189,59 @@ class Mouse {
162
189
  for (let i = 1; i <= steps; i++) {
163
190
  const middleX = fromX + (x - fromX) * (i / steps);
164
191
  const middleY = fromY + (y - fromY) * (i / steps);
165
- await this._raw.move(middleX, middleY, this._lastButton, this._buttons, this._keyboard._modifiers(), !!options.forClick);
192
+ await this._raw.move(progress, middleX, middleY, this._lastButton, this._buttons, this._keyboard._modifiers(), !!options.forClick);
166
193
  }
167
194
  }
168
- async down(options = {}, metadata) {
169
- if (metadata)
170
- metadata.point = { x: this._x, y: this._y };
195
+ async down(metadata, options) {
196
+ const controller = new import_progress.ProgressController(metadata, this._page);
197
+ return controller.run((progress) => this._down(progress, options));
198
+ }
199
+ async _down(progress, options = {}) {
171
200
  const { button = "left", clickCount = 1 } = options;
172
201
  this._lastButton = button;
173
202
  this._buttons.add(button);
174
- await this._raw.down(this._x, this._y, this._lastButton, this._buttons, this._keyboard._modifiers(), clickCount);
203
+ await this._raw.down(progress, this._x, this._y, this._lastButton, this._buttons, this._keyboard._modifiers(), clickCount);
175
204
  }
176
- async up(options = {}, metadata) {
177
- if (metadata)
178
- metadata.point = { x: this._x, y: this._y };
205
+ async up(metadata, options) {
206
+ const controller = new import_progress.ProgressController(metadata, this._page);
207
+ return controller.run((progress) => this._up(progress, options));
208
+ }
209
+ async _up(progress, options = {}) {
179
210
  const { button = "left", clickCount = 1 } = options;
180
211
  this._lastButton = "none";
181
212
  this._buttons.delete(button);
182
- await this._raw.up(this._x, this._y, button, this._buttons, this._keyboard._modifiers(), clickCount);
213
+ await this._raw.up(progress, this._x, this._y, button, this._buttons, this._keyboard._modifiers(), clickCount);
214
+ }
215
+ async click(metadata, x, y, options) {
216
+ const controller = new import_progress.ProgressController(metadata, this._page);
217
+ return controller.run((progress) => this._click(progress, x, y, options));
183
218
  }
184
- async click(x, y, options = {}, metadata) {
185
- if (metadata)
186
- metadata.point = { x, y };
219
+ async _click(progress, x, y, options = {}) {
187
220
  const { delay = null, clickCount = 1 } = options;
188
221
  if (delay) {
189
- this.move(x, y, { forClick: true });
222
+ this._move(progress, x, y, { forClick: true });
190
223
  for (let cc = 1; cc <= clickCount; ++cc) {
191
- await this.down({ ...options, clickCount: cc });
192
- await new Promise((f) => setTimeout(f, delay));
193
- await this.up({ ...options, clickCount: cc });
224
+ await this._down(progress, { ...options, clickCount: cc });
225
+ await wait(progress, delay);
226
+ await this._up(progress, { ...options, clickCount: cc });
194
227
  if (cc < clickCount)
195
- await new Promise((f) => setTimeout(f, delay));
228
+ await wait(progress, delay);
196
229
  }
197
230
  } else {
198
231
  const promises = [];
199
- promises.push(this.move(x, y, { forClick: true }));
232
+ promises.push(this._move(progress, x, y, { forClick: true }));
200
233
  for (let cc = 1; cc <= clickCount; ++cc) {
201
- promises.push(this.down({ ...options, clickCount: cc }));
202
- promises.push(this.up({ ...options, clickCount: cc }));
234
+ promises.push(this._down(progress, { ...options, clickCount: cc }));
235
+ promises.push(this._up(progress, { ...options, clickCount: cc }));
203
236
  }
204
237
  await Promise.all(promises);
205
238
  }
206
239
  }
207
- async dblclick(x, y, options = {}) {
208
- await this.click(x, y, { ...options, clickCount: 2 });
209
- }
210
- async wheel(deltaX, deltaY) {
211
- await this._raw.wheel(this._x, this._y, this._buttons, this._keyboard._modifiers(), deltaX, deltaY);
240
+ async wheel(metadata, deltaX, deltaY) {
241
+ const controller = new import_progress.ProgressController(metadata, this._page);
242
+ return controller.run(async (progress) => {
243
+ await this._raw.wheel(progress, this._x, this._y, this._buttons, this._keyboard._modifiers(), deltaX, deltaY);
244
+ });
212
245
  }
213
246
  }
214
247
  const aliases = /* @__PURE__ */ new Map([
@@ -261,14 +294,20 @@ class Touchscreen {
261
294
  this._raw = raw;
262
295
  this._page = page;
263
296
  }
264
- async tap(x, y, metadata) {
265
- if (metadata)
266
- metadata.point = { x, y };
297
+ async tap(metadata, x, y) {
298
+ const controller = new import_progress.ProgressController(metadata, this._page);
299
+ return controller.run((progress) => this._tap(progress, x, y));
300
+ }
301
+ async _tap(progress, x, y) {
267
302
  if (!this._page.browserContext._options.hasTouch)
268
303
  throw new Error("hasTouch must be enabled on the browser context before using the touchscreen.");
269
- await this._raw.tap(x, y, this._page.keyboard._modifiers());
304
+ await this._raw.tap(progress, x, y, this._page.keyboard._modifiers());
270
305
  }
271
306
  }
307
+ async function wait(progress, ms) {
308
+ await new Promise((f) => setTimeout(f, Math.min(ms, progress.timeUntilDeadline())));
309
+ progress.throwIfAborted();
310
+ }
272
311
  // Annotate the CommonJS export names for ESM import in node:
273
312
  0 && (module.exports = {
274
313
  Keyboard,
@@ -67,7 +67,7 @@ async function launchApp(browserType, options) {
67
67
  context.on("page", async (newPage) => {
68
68
  if (newPage.mainFrame().url() === "chrome://new-tab-page/") {
69
69
  await page.bringToFront();
70
- await newPage.close((0, import_instrumentation.serverSideCallMetadata)());
70
+ await newPage.close();
71
71
  }
72
72
  });
73
73
  }
@@ -83,7 +83,7 @@ class Page extends import_instrumentation.SdkObject {
83
83
  this.delegate = delegate;
84
84
  this.browserContext = browserContext;
85
85
  this.accessibility = new accessibility.Accessibility(delegate.getAccessibilityTree.bind(delegate));
86
- this.keyboard = new input.Keyboard(delegate.rawKeyboard);
86
+ this.keyboard = new input.Keyboard(delegate.rawKeyboard, this);
87
87
  this.mouse = new input.Mouse(delegate.rawMouse, this);
88
88
  this.touchscreen = new input.Touchscreen(delegate.rawTouchscreen, this);
89
89
  this.screenshotter = new import_screenshotter.Screenshotter(this);
@@ -153,9 +153,9 @@ class Page extends import_instrumentation.SdkObject {
153
153
  else
154
154
  this._eventsToEmitAfterInitialized.push({ event, args });
155
155
  }
156
- async resetForReuse(metadata) {
156
+ async resetForReuse(progress) {
157
157
  this._locatorHandlers.clear();
158
- await this.mainFrame().goto(metadata, "about:blank", { timeout: 0 });
158
+ await this.mainFrame().gotoImpl(progress, "about:blank", {});
159
159
  this._emulatedSize = void 0;
160
160
  this._emulatedMedia = {};
161
161
  this._extraHTTPHeaders = void 0;
@@ -163,7 +163,7 @@ class Page extends import_instrumentation.SdkObject {
163
163
  this.delegate.updateEmulatedViewportSize(),
164
164
  this.delegate.updateEmulateMedia()
165
165
  ]);
166
- await this.delegate.resetForReuse();
166
+ await this.delegate.resetForReuse(progress);
167
167
  }
168
168
  _didClose() {
169
169
  this.frameManager.dispose();
@@ -530,7 +530,7 @@ class Page extends import_instrumentation.SdkObject {
530
530
  options.timeout
531
531
  );
532
532
  }
533
- async close(metadata, options = {}) {
533
+ async close(options = {}) {
534
534
  if (this._closedState === "closed")
535
535
  return;
536
536
  if (options.reason)
@@ -38,7 +38,7 @@ async function performAction(pageAliases, actionInContext) {
38
38
  if (action.name === "openPage")
39
39
  throw Error("Not reached");
40
40
  if (action.name === "closePage") {
41
- await mainFrame._page.close(callMetadata);
41
+ await mainFrame._page.close();
42
42
  return;
43
43
  }
44
44
  const selector = (0, import_recorderUtils.buildFullSelector)(actionInContext.frame.framePath, action.selector);
@@ -65,7 +65,7 @@ class RawKeyboardImpl {
65
65
  setSession(session) {
66
66
  this._session = session;
67
67
  }
68
- async keydown(modifiers, keyName, description, autoRepeat) {
68
+ async keydown(progress, modifiers, keyName, description, autoRepeat) {
69
69
  const parts = [];
70
70
  for (const modifier of ["Shift", "Control", "Alt", "Meta"]) {
71
71
  if (modifiers.has(modifier))
@@ -89,8 +89,9 @@ class RawKeyboardImpl {
89
89
  macCommands: commands,
90
90
  isKeypad: description.location === input.keypadLocation
91
91
  });
92
+ progress.throwIfAborted();
92
93
  }
93
- async keyup(modifiers, keyName, description) {
94
+ async keyup(progress, modifiers, keyName, description) {
94
95
  const { code, key } = description;
95
96
  await this._pageProxySession.send("Input.dispatchKeyEvent", {
96
97
  type: "keyUp",
@@ -100,9 +101,11 @@ class RawKeyboardImpl {
100
101
  code,
101
102
  isKeypad: description.location === input.keypadLocation
102
103
  });
104
+ progress.throwIfAborted();
103
105
  }
104
- async sendText(text) {
106
+ async sendText(progress, text) {
105
107
  await this._session.send("Page.insertText", { text });
108
+ progress.throwIfAborted();
106
109
  }
107
110
  }
108
111
  class RawMouseImpl {
@@ -112,7 +115,7 @@ class RawMouseImpl {
112
115
  setSession(session) {
113
116
  this._session = session;
114
117
  }
115
- async move(x, y, button, buttons, modifiers, forClick) {
118
+ async move(progress, x, y, button, buttons, modifiers, forClick) {
116
119
  await this._pageProxySession.send("Input.dispatchMouseEvent", {
117
120
  type: "move",
118
121
  button,
@@ -121,8 +124,9 @@ class RawMouseImpl {
121
124
  y,
122
125
  modifiers: toModifiersMask(modifiers)
123
126
  });
127
+ progress.throwIfAborted();
124
128
  }
125
- async down(x, y, button, buttons, modifiers, clickCount) {
129
+ async down(progress, x, y, button, buttons, modifiers, clickCount) {
126
130
  await this._pageProxySession.send("Input.dispatchMouseEvent", {
127
131
  type: "down",
128
132
  button,
@@ -132,8 +136,9 @@ class RawMouseImpl {
132
136
  modifiers: toModifiersMask(modifiers),
133
137
  clickCount
134
138
  });
139
+ progress.throwIfAborted();
135
140
  }
136
- async up(x, y, button, buttons, modifiers, clickCount) {
141
+ async up(progress, x, y, button, buttons, modifiers, clickCount) {
137
142
  await this._pageProxySession.send("Input.dispatchMouseEvent", {
138
143
  type: "up",
139
144
  button,
@@ -143,12 +148,14 @@ class RawMouseImpl {
143
148
  modifiers: toModifiersMask(modifiers),
144
149
  clickCount
145
150
  });
151
+ progress.throwIfAborted();
146
152
  }
147
- async wheel(x, y, buttons, modifiers, deltaX, deltaY) {
153
+ async wheel(progress, x, y, buttons, modifiers, deltaX, deltaY) {
148
154
  if (this._page?.browserContext._options.isMobile)
149
155
  throw new Error("Mouse wheel is not supported in mobile WebKit");
150
156
  await this._session.send("Page.updateScrollingState");
151
157
  await this._page.mainFrame().evaluateExpression(`new Promise(requestAnimationFrame)`, { world: "utility" });
158
+ progress.throwIfAborted();
152
159
  await this._pageProxySession.send("Input.dispatchWheelEvent", {
153
160
  x,
154
161
  y,
@@ -156,6 +163,7 @@ class RawMouseImpl {
156
163
  deltaY,
157
164
  modifiers: toModifiersMask(modifiers)
158
165
  });
166
+ progress.throwIfAborted();
159
167
  }
160
168
  setPage(page) {
161
169
  this._page = page;
@@ -165,12 +173,13 @@ class RawTouchscreenImpl {
165
173
  constructor(session) {
166
174
  this._pageProxySession = session;
167
175
  }
168
- async tap(x, y, modifiers) {
176
+ async tap(progress, x, y, modifiers) {
169
177
  await this._pageProxySession.send("Input.dispatchTapEvent", {
170
178
  x,
171
179
  y,
172
180
  modifiers: toModifiersMask(modifiers)
173
181
  });
182
+ progress.throwIfAborted();
174
183
  }
175
184
  }
176
185
  // Annotate the CommonJS export names for ESM import in node:
@@ -907,7 +907,7 @@ class WKPage {
907
907
  }
908
908
  async inputActionEpilogue() {
909
909
  }
910
- async resetForReuse() {
910
+ async resetForReuse(progress) {
911
911
  }
912
912
  async getFrameElement(frame) {
913
913
  const parent = frame.parentFrame();