@remotion/renderer 4.0.536 → 4.0.538

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 (292) hide show
  1. package/dist/aac-priming.d.ts +2 -1
  2. package/dist/assets/apply-tone-frequency.d.ts +2 -1
  3. package/dist/assets/apply-tone-frequency.js +8 -1
  4. package/dist/assets/calculate-asset-positions.js +2 -0
  5. package/dist/assets/convert-assets-to-file-urls.d.ts +2 -1
  6. package/dist/assets/download-and-map-assets-to-file.d.ts +3 -2
  7. package/dist/assets/get-audio-channels.d.ts +3 -2
  8. package/dist/assets/inline-audio-mixing.d.ts +2 -1
  9. package/dist/assets/types.d.ts +2 -1
  10. package/dist/browser/Browser.d.ts +5 -5
  11. package/dist/browser/Browser.js +74 -65
  12. package/dist/browser/BrowserFetcher.d.ts +7 -5
  13. package/dist/browser/BrowserPage.d.ts +4 -4
  14. package/dist/browser/BrowserPage.js +222 -226
  15. package/dist/browser/BrowserRunner.d.ts +2 -1
  16. package/dist/browser/Connection.js +109 -96
  17. package/dist/browser/ConsoleMessage.d.ts +1 -1
  18. package/dist/browser/ConsoleMessage.js +16 -9
  19. package/dist/browser/DOMWorld.d.ts +1 -1
  20. package/dist/browser/DOMWorld.js +91 -77
  21. package/dist/browser/Errors.js +4 -2
  22. package/dist/browser/EventEmitter.js +1 -2
  23. package/dist/browser/ExecutionContext.js +120 -117
  24. package/dist/browser/FrameManager.js +244 -249
  25. package/dist/browser/HTTPRequest.js +22 -11
  26. package/dist/browser/HTTPResponse.js +16 -3
  27. package/dist/browser/JSHandle.js +30 -17
  28. package/dist/browser/LifecycleWatcher.js +128 -122
  29. package/dist/browser/NetworkEventManager.js +40 -31
  30. package/dist/browser/NetworkManager.js +203 -210
  31. package/dist/browser/NodeWebSocketTransport.js +0 -3
  32. package/dist/browser/Target.d.ts +1 -1
  33. package/dist/browser/Target.js +39 -32
  34. package/dist/browser/TaskQueue.js +18 -5
  35. package/dist/browser/TimeoutSettings.js +25 -12
  36. package/dist/browser/browser-download-progress-bar.d.ts +2 -1
  37. package/dist/browser/get-chrome-download-url.d.ts +3 -2
  38. package/dist/browser/handle-failed-resource.d.ts +2 -1
  39. package/dist/call-ffmpeg.d.ts +7 -6
  40. package/dist/can-concat-seamlessly.d.ts +4 -2
  41. package/dist/can-use-parallel-encoding.d.ts +2 -1
  42. package/dist/check-version-requirements.d.ts +2 -1
  43. package/dist/client.d.ts +302 -280
  44. package/dist/client.js +2 -2
  45. package/dist/codec-supports-media.d.ts +4 -3
  46. package/dist/codec.d.ts +1 -1
  47. package/dist/collect-assets.d.ts +1 -1
  48. package/dist/combine-audio.d.ts +4 -2
  49. package/dist/combine-chunks.d.ts +2 -1
  50. package/dist/combine-video-streams.d.ts +4 -2
  51. package/dist/compositor/compositor.d.ts +4 -3
  52. package/dist/compositor/get-executable-path.d.ts +4 -4
  53. package/dist/compress-audio.d.ts +4 -2
  54. package/dist/create-audio.d.ts +4 -2
  55. package/dist/create-silent-audio.d.ts +2 -1
  56. package/dist/crf.d.ts +6 -4
  57. package/dist/cycle-browser-tabs.d.ts +2 -1
  58. package/dist/ensure-browser.d.ts +1 -52
  59. package/dist/error-handling/handle-javascript-exception.d.ts +1 -1
  60. package/dist/error-handling/handle-javascript-exception.js +0 -5
  61. package/dist/error-handling/symbolicateable-error.d.ts +1 -1
  62. package/dist/error-handling/symbolicateable-error.js +0 -4
  63. package/dist/error-handling.js +1 -1
  64. package/dist/esm/client.mjs +306 -238
  65. package/dist/esm/index.mjs +108 -88
  66. package/dist/extract-audio.d.ts +3 -2
  67. package/dist/ffmpeg-args.d.ts +12 -6
  68. package/dist/finalize-fast-start.d.ts +2 -1
  69. package/dist/get-browser-instance.d.ts +6 -4
  70. package/dist/get-codec-name.d.ts +6 -3
  71. package/dist/get-compositions.d.ts +2 -1
  72. package/dist/get-concurrency.d.ts +1 -1
  73. package/dist/get-concurrency.js +1 -1
  74. package/dist/get-duration-from-frame-range.d.ts +1 -1
  75. package/dist/get-extension-from-codec.d.ts +2 -1
  76. package/dist/get-frame-padded-index.d.ts +2 -1
  77. package/dist/get-local-browser-executable.d.ts +4 -2
  78. package/dist/get-port.d.ts +1 -1
  79. package/dist/get-prores-profile-name.d.ts +3 -1
  80. package/dist/get-silent-parts.d.ts +5 -4
  81. package/dist/get-video-metadata.d.ts +4 -3
  82. package/dist/get-video-threads-flag.d.ts +2 -1
  83. package/dist/goto-page-or-throw.d.ts +1 -1
  84. package/dist/guess-extension-for-media.d.ts +2 -1
  85. package/dist/image-format.d.ts +6 -5
  86. package/dist/index.d.ts +213 -440
  87. package/dist/index.js +18 -18
  88. package/dist/is-audio-codec.d.ts +2 -1
  89. package/dist/log-level.d.ts +2 -2
  90. package/dist/logger.d.ts +6 -6
  91. package/dist/make-page.d.ts +5 -3
  92. package/dist/memory/from-macos-sysctl.d.ts +2 -1
  93. package/dist/memory/from-proc-meminfo.d.ts +2 -1
  94. package/dist/memory/get-available-memory.d.ts +2 -1
  95. package/dist/merge-inline-audio-tracks.d.ts +2 -1
  96. package/dist/mux-video-and-audio.d.ts +5 -3
  97. package/dist/offthread-video-server.d.ts +2 -1
  98. package/dist/offthread-video-server.js +6 -4
  99. package/dist/open-browser.d.ts +2 -2
  100. package/dist/options/allow-html-in-canvas.js +1 -2
  101. package/dist/options/api-key.d.ts +1 -1
  102. package/dist/options/api-key.js +1 -3
  103. package/dist/options/ask-ai.js +1 -1
  104. package/dist/options/audio-bitrate.js +1 -9
  105. package/dist/options/audio-codec.d.ts +23 -20
  106. package/dist/options/beep-on-finish.js +1 -1
  107. package/dist/options/benchmark-concurrencies.js +1 -2
  108. package/dist/options/binaries-directory.d.ts +1 -1
  109. package/dist/options/binaries-directory.js +1 -9
  110. package/dist/options/browser-executable.d.ts +1 -1
  111. package/dist/options/browser-executable.js +1 -1
  112. package/dist/options/browser.js +1 -2
  113. package/dist/options/bundle-cache.js +1 -2
  114. package/dist/options/canvas-tabs.js +1 -1
  115. package/dist/options/chrome-mode.d.ts +4 -4
  116. package/dist/options/chrome-mode.js +1 -6
  117. package/dist/options/color-space.d.ts +9 -5
  118. package/dist/options/color-space.js +1 -8
  119. package/dist/options/concurrency.d.ts +1 -1
  120. package/dist/options/concurrency.js +1 -5
  121. package/dist/options/config.js +1 -1
  122. package/dist/options/crf.js +1 -1
  123. package/dist/options/cross-site-isolation.js +1 -2
  124. package/dist/options/dark-mode.js +1 -2
  125. package/dist/options/default-coding-agent.d.ts +2 -2
  126. package/dist/options/default-coding-agent.js +1 -2
  127. package/dist/options/default-editor.d.ts +4 -4
  128. package/dist/options/default-editor.js +1 -3
  129. package/dist/options/default-premount-in-seconds.js +1 -1
  130. package/dist/options/delete-after.d.ts +1 -1
  131. package/dist/options/delete-after.js +1 -11
  132. package/dist/options/disable-shared-memory-capture.js +1 -3
  133. package/dist/options/disable-web-security.d.ts +1 -1
  134. package/dist/options/disable-web-security.js +1 -1
  135. package/dist/options/disallow-parallel-encoding.js +1 -1
  136. package/dist/options/enable-cancellation.js +1 -2
  137. package/dist/options/enable-lambda-insights.js +1 -2
  138. package/dist/options/enable-multiprocess-on-linux.js +1 -13
  139. package/dist/options/encoding-buffer-size.d.ts +4 -2
  140. package/dist/options/encoding-buffer-size.js +1 -3
  141. package/dist/options/encoding-max-rate.d.ts +1 -1
  142. package/dist/options/encoding-max-rate.js +1 -3
  143. package/dist/options/enforce-audio.js +1 -15
  144. package/dist/options/env-file.js +1 -3
  145. package/dist/options/every-nth-frame.d.ts +1 -1
  146. package/dist/options/every-nth-frame.js +1 -6
  147. package/dist/options/experimental-keep-audio-context-alive.js +1 -3
  148. package/dist/options/folder-expiry.d.ts +1 -1
  149. package/dist/options/folder-expiry.js +1 -4
  150. package/dist/options/for-seamless-aac-concatenation.js +1 -3
  151. package/dist/options/force-new-studio.js +1 -1
  152. package/dist/options/frames.d.ts +1 -1
  153. package/dist/options/frames.js +1 -4
  154. package/dist/options/gl.d.ts +6 -6
  155. package/dist/options/gl.js +3 -28
  156. package/dist/options/gop-size.js +1 -3
  157. package/dist/options/hardware-acceleration.d.ts +3 -3
  158. package/dist/options/headless.js +1 -1
  159. package/dist/options/ignore-certificate-errors.d.ts +1 -1
  160. package/dist/options/ignore-certificate-errors.js +1 -1
  161. package/dist/options/image-sequence-pattern.js +1 -5
  162. package/dist/options/image-sequence.js +1 -1
  163. package/dist/options/index.d.ts +91 -72
  164. package/dist/options/index.js +2 -0
  165. package/dist/options/interactivity.js +1 -1
  166. package/dist/options/ipv4.js +1 -1
  167. package/dist/options/is-production.d.ts +1 -1
  168. package/dist/options/is-production.js +1 -4
  169. package/dist/options/jpeg-quality.d.ts +1 -1
  170. package/dist/options/jpeg-quality.js +1 -4
  171. package/dist/options/keyboard-shortcuts.js +1 -1
  172. package/dist/options/latency-hint.d.ts +1 -1
  173. package/dist/options/latency-hint.js +1 -10
  174. package/dist/options/license-key.d.ts +1 -1
  175. package/dist/options/license-key.js +1 -2
  176. package/dist/options/log-level.d.ts +4 -3
  177. package/dist/options/log-level.js +1 -16
  178. package/dist/options/metadata.js +2 -7
  179. package/dist/options/mute.js +1 -1
  180. package/dist/options/no-open.js +1 -1
  181. package/dist/options/number-of-gif-loops.d.ts +1 -1
  182. package/dist/options/number-of-gif-loops.js +1 -13
  183. package/dist/options/number-of-shared-audio-tags.js +1 -1
  184. package/dist/options/offthreadvideo-cache-size.d.ts +1 -1
  185. package/dist/options/offthreadvideo-cache-size.js +1 -11
  186. package/dist/options/offthreadvideo-threads.d.ts +1 -1
  187. package/dist/options/offthreadvideo-threads.js +1 -2
  188. package/dist/options/on-browser-download.d.ts +1 -1
  189. package/dist/options/on-browser-download.js +1 -2
  190. package/dist/options/options-map.d.ts +180 -180
  191. package/dist/options/out-dir.d.ts +1 -1
  192. package/dist/options/out-dir.js +1 -4
  193. package/dist/options/override-duration.js +1 -1
  194. package/dist/options/override-fps.js +1 -1
  195. package/dist/options/override-height.js +1 -1
  196. package/dist/options/override-width.js +1 -1
  197. package/dist/options/overwrite.js +1 -5
  198. package/dist/options/package-manager.d.ts +1 -1
  199. package/dist/options/package-manager.js +1 -12
  200. package/dist/options/pixel-format.d.ts +6 -5
  201. package/dist/options/pixel-format.js +1 -2
  202. package/dist/options/port.js +1 -1
  203. package/dist/options/prefer-lossless.d.ts +1 -1
  204. package/dist/options/prefer-lossless.js +1 -4
  205. package/dist/options/{experimental-tracks.d.ts → preserve-pitch-on-playback.d.ts} +3 -3
  206. package/dist/options/preserve-pitch-on-playback.js +36 -0
  207. package/dist/options/preview-sample-rate.js +1 -3
  208. package/dist/options/props.js +1 -5
  209. package/dist/options/prores-profile.d.ts +2 -2
  210. package/dist/options/prores-profile.js +1 -5
  211. package/dist/options/public-dir.d.ts +1 -1
  212. package/dist/options/public-dir.js +1 -2
  213. package/dist/options/public-license-key.d.ts +1 -1
  214. package/dist/options/public-license-key.js +1 -3
  215. package/dist/options/public-path.d.ts +1 -1
  216. package/dist/options/public-path.js +1 -5
  217. package/dist/options/repro.d.ts +3 -1
  218. package/dist/options/repro.js +1 -1
  219. package/dist/options/rspack.js +1 -1
  220. package/dist/options/runs.js +1 -3
  221. package/dist/options/sample-rate.d.ts +2 -2
  222. package/dist/options/sample-rate.js +1 -2
  223. package/dist/options/scale.js +1 -5
  224. package/dist/options/sequence-activity-limit.js +1 -4
  225. package/dist/options/show-layer-frame-numbers.js +1 -3
  226. package/dist/options/show-premounting.js +1 -2
  227. package/dist/options/skip-skills.js +1 -1
  228. package/dist/options/still-frame.d.ts +1 -1
  229. package/dist/options/still-frame.js +1 -3
  230. package/dist/options/still-image-format.d.ts +3 -2
  231. package/dist/options/still-image-format.js +1 -2
  232. package/dist/options/timeout.d.ts +1 -1
  233. package/dist/options/timeout.js +1 -4
  234. package/dist/options/user-agent.d.ts +1 -1
  235. package/dist/options/user-agent.js +1 -1
  236. package/dist/options/version-flag.js +1 -1
  237. package/dist/options/video-bitrate.js +1 -7
  238. package/dist/options/video-cache-size.d.ts +1 -1
  239. package/dist/options/video-cache-size.js +1 -7
  240. package/dist/options/video-codec.d.ts +9 -7
  241. package/dist/options/video-codec.js +1 -1
  242. package/dist/options/video-image-format.d.ts +6 -5
  243. package/dist/options/video-image-format.js +1 -6
  244. package/dist/options/webhook-custom-data.d.ts +1 -1
  245. package/dist/options/webhook-custom-data.js +1 -1
  246. package/dist/options/webpack-poll.js +1 -1
  247. package/dist/options/x264-preset.d.ts +8 -7
  248. package/dist/options/x264-preset.js +1 -23
  249. package/dist/p-limit.d.ts +1 -1
  250. package/dist/pixel-format.d.ts +4 -3
  251. package/dist/pool.js +0 -2
  252. package/dist/port-config.d.ts +6 -5
  253. package/dist/prespawn-ffmpeg.d.ts +1 -1
  254. package/dist/print-useful-error-message.d.ts +2 -1
  255. package/dist/probe-encoder.d.ts +8 -5
  256. package/dist/probe-shared-memory-capture.d.ts +4 -2
  257. package/dist/prores-profile.d.ts +4 -2
  258. package/dist/puppeteer-evaluate.d.ts +2 -2
  259. package/dist/puppeteer-screenshot.d.ts +4 -3
  260. package/dist/pure.d.ts +12 -15
  261. package/dist/remotion-shared-memory.d.ts +1 -1
  262. package/dist/remotion-shared-memory.js +199 -187
  263. package/dist/render-frame-and-retry-target-close.d.ts +10 -10
  264. package/dist/render-frame-with-option-to-reject.d.ts +7 -5
  265. package/dist/render-frame-with-option-to-reject.js +1 -5
  266. package/dist/render-frame.d.ts +8 -6
  267. package/dist/render-frames.d.ts +1 -40
  268. package/dist/render-has-audio.d.ts +3 -2
  269. package/dist/replace-browser.d.ts +2 -1
  270. package/dist/repro.d.ts +1 -1
  271. package/dist/screenshot-task.d.ts +4 -3
  272. package/dist/seek-to-frame.d.ts +3 -2
  273. package/dist/select-composition.d.ts +1 -20
  274. package/dist/serve-handler/index.d.ts +1 -1
  275. package/dist/serve-handler/range-parser.d.ts +2 -2
  276. package/dist/serve-static.d.ts +2 -1
  277. package/dist/serve-static.js +4 -4
  278. package/dist/set-props-and-env.js +2 -6
  279. package/dist/stringify-ffmpeg-filter.d.ts +2 -1
  280. package/dist/stringify-ffmpeg-filter.js +20 -2
  281. package/dist/take-frame.d.ts +1 -1
  282. package/dist/test-gpu.d.ts +4 -2
  283. package/dist/validate-even-dimensions-with-codec.d.ts +4 -2
  284. package/dist/validate-ffmpeg-override.d.ts +1 -1
  285. package/dist/validate-number-of-gif-loops.d.ts +2 -1
  286. package/dist/validate-output-filename.d.ts +4 -2
  287. package/package.json +16 -16
  288. package/dist/options/experimental-sequence-activity-limit.d.ts +0 -19
  289. package/dist/options/experimental-sequence-activity-limit.js +0 -40
  290. package/dist/options/experimental-sequence-activity.d.ts +0 -19
  291. package/dist/options/experimental-sequence-activity.js +0 -38
  292. package/dist/options/experimental-tracks.js +0 -43
@@ -1,4 +1,16 @@
1
1
  "use strict";
2
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
3
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
4
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
5
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
6
+ };
7
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
8
+ if (kind === "m") throw new TypeError("Private method is not writable");
9
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
10
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
11
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
12
+ };
13
+ var _Connection_instances, _Connection_lastId, _Connection_sessions, _Connection_closed, _Connection_callbacks, _Connection_onMessage, _Connection_onClose, _CDPSession_sessionId, _CDPSession_targetType, _CDPSession_callbacks, _CDPSession_connection;
2
14
  Object.defineProperty(exports, "__esModule", { value: true });
3
15
  exports.CDPSession = exports.CDPSessionEmittedEvents = exports.Connection = void 0;
4
16
  /**
@@ -23,22 +35,22 @@ const ConnectionEmittedEvents = {
23
35
  Disconnected: Symbol('Connection.Disconnected'),
24
36
  };
25
37
  class Connection extends EventEmitter_1.EventEmitter {
26
- transport;
27
- #lastId = 0;
28
- #sessions = new Map();
29
- #closed = false;
30
- #callbacks = new Map();
31
38
  constructor(transport) {
32
39
  super();
40
+ _Connection_instances.add(this);
41
+ _Connection_lastId.set(this, 0);
42
+ _Connection_sessions.set(this, new Map());
43
+ _Connection_closed.set(this, false);
44
+ _Connection_callbacks.set(this, new Map());
33
45
  this.transport = transport;
34
- this.transport.onmessage = this.#onMessage.bind(this);
35
- this.transport.onclose = this.#onClose.bind(this);
46
+ this.transport.onmessage = __classPrivateFieldGet(this, _Connection_instances, "m", _Connection_onMessage).bind(this);
47
+ this.transport.onclose = __classPrivateFieldGet(this, _Connection_instances, "m", _Connection_onClose).bind(this);
36
48
  }
37
49
  static fromSession(session) {
38
50
  return session.connection();
39
51
  }
40
52
  session(sessionId) {
41
- return this.#sessions.get(sessionId) || null;
53
+ return __classPrivateFieldGet(this, _Connection_sessions, "f").get(sessionId) || null;
42
54
  }
43
55
  send(method, ...paramArgs) {
44
56
  // There is only ever 1 param arg passed, but the Protocol defines it as an
@@ -50,7 +62,7 @@ class Connection extends EventEmitter_1.EventEmitter {
50
62
  const params = paramArgs.length ? paramArgs[0] : undefined;
51
63
  const id = this._rawSend({ method, params });
52
64
  return new Promise((resolve, reject) => {
53
- this.#callbacks.set(id, {
65
+ __classPrivateFieldGet(this, _Connection_callbacks, "f").set(id, {
54
66
  resolve,
55
67
  reject,
56
68
  method,
@@ -59,76 +71,14 @@ class Connection extends EventEmitter_1.EventEmitter {
59
71
  });
60
72
  }
61
73
  _rawSend(message) {
62
- const id = ++this.#lastId;
74
+ var _a;
75
+ const id = __classPrivateFieldSet(this, _Connection_lastId, (_a = __classPrivateFieldGet(this, _Connection_lastId, "f"), ++_a), "f");
63
76
  const stringifiedMessage = JSON.stringify({ ...message, id });
64
77
  this.transport.send(stringifiedMessage);
65
78
  return id;
66
79
  }
67
- #onMessage(message) {
68
- const object = JSON.parse(message);
69
- if (object.method === 'Target.attachedToTarget') {
70
- const { sessionId } = object.params;
71
- const session = new CDPSession(this, object.params.targetInfo.type, sessionId);
72
- this.#sessions.set(sessionId, session);
73
- this.emit('sessionattached', session);
74
- const parentSession = this.#sessions.get(object.sessionId);
75
- if (parentSession) {
76
- parentSession.emit('sessionattached', session);
77
- }
78
- }
79
- else if (object.method === 'Target.detachedFromTarget') {
80
- const session = this.#sessions.get(object.params.sessionId);
81
- if (session) {
82
- session._onClosed();
83
- this.#sessions.delete(object.params.sessionId);
84
- this.emit('sessiondetached', session);
85
- const parentSession = this.#sessions.get(object.sessionId);
86
- if (parentSession) {
87
- parentSession.emit('sessiondetached', session);
88
- }
89
- }
90
- }
91
- if (object.sessionId) {
92
- const session = this.#sessions.get(object.sessionId);
93
- if (session) {
94
- session._onMessage(object, message.length);
95
- }
96
- }
97
- else if (object.id) {
98
- const callback = this.#callbacks.get(object.id);
99
- // Callbacks could be all rejected if someone has called `.dispose()`.
100
- if (callback) {
101
- this.#callbacks.delete(object.id);
102
- if (object.error) {
103
- callback.reject(createProtocolError(callback.method, object));
104
- }
105
- else {
106
- callback.resolve({ value: object.result, size: message.length });
107
- }
108
- }
109
- }
110
- else {
111
- this.emit(object.method, object.params);
112
- }
113
- }
114
- #onClose() {
115
- if (this.#closed) {
116
- return;
117
- }
118
- this.transport.onmessage = undefined;
119
- this.transport.onclose = undefined;
120
- for (const callback of this.#callbacks.values()) {
121
- callback.reject(rewriteError(new Errors_1.ProtocolError(), `Protocol error (${callback.method}): Target closed. https://www.remotion.dev/docs/target-closed`));
122
- }
123
- this.#callbacks.clear();
124
- for (const session of this.#sessions.values()) {
125
- session._onClosed();
126
- }
127
- this.#sessions.clear();
128
- this.emit(ConnectionEmittedEvents.Disconnected);
129
- }
130
80
  dispose() {
131
- this.#onClose();
81
+ __classPrivateFieldGet(this, _Connection_instances, "m", _Connection_onClose).call(this);
132
82
  this.transport.close();
133
83
  }
134
84
  /**
@@ -140,7 +90,7 @@ class Connection extends EventEmitter_1.EventEmitter {
140
90
  targetId: targetInfo.targetId,
141
91
  flatten: true,
142
92
  });
143
- const session = this.#sessions.get(sessionId);
93
+ const session = __classPrivateFieldGet(this, _Connection_sessions, "f").get(sessionId);
144
94
  if (!session) {
145
95
  throw new Error('CDPSession creation failed.');
146
96
  }
@@ -148,42 +98,104 @@ class Connection extends EventEmitter_1.EventEmitter {
148
98
  }
149
99
  }
150
100
  exports.Connection = Connection;
101
+ _Connection_lastId = new WeakMap(), _Connection_sessions = new WeakMap(), _Connection_closed = new WeakMap(), _Connection_callbacks = new WeakMap(), _Connection_instances = new WeakSet(), _Connection_onMessage = function _Connection_onMessage(message) {
102
+ const object = JSON.parse(message);
103
+ if (object.method === 'Target.attachedToTarget') {
104
+ const { sessionId } = object.params;
105
+ const session = new CDPSession(this, object.params.targetInfo.type, sessionId);
106
+ __classPrivateFieldGet(this, _Connection_sessions, "f").set(sessionId, session);
107
+ this.emit('sessionattached', session);
108
+ const parentSession = __classPrivateFieldGet(this, _Connection_sessions, "f").get(object.sessionId);
109
+ if (parentSession) {
110
+ parentSession.emit('sessionattached', session);
111
+ }
112
+ }
113
+ else if (object.method === 'Target.detachedFromTarget') {
114
+ const session = __classPrivateFieldGet(this, _Connection_sessions, "f").get(object.params.sessionId);
115
+ if (session) {
116
+ session._onClosed();
117
+ __classPrivateFieldGet(this, _Connection_sessions, "f").delete(object.params.sessionId);
118
+ this.emit('sessiondetached', session);
119
+ const parentSession = __classPrivateFieldGet(this, _Connection_sessions, "f").get(object.sessionId);
120
+ if (parentSession) {
121
+ parentSession.emit('sessiondetached', session);
122
+ }
123
+ }
124
+ }
125
+ if (object.sessionId) {
126
+ const session = __classPrivateFieldGet(this, _Connection_sessions, "f").get(object.sessionId);
127
+ if (session) {
128
+ session._onMessage(object, message.length);
129
+ }
130
+ }
131
+ else if (object.id) {
132
+ const callback = __classPrivateFieldGet(this, _Connection_callbacks, "f").get(object.id);
133
+ // Callbacks could be all rejected if someone has called `.dispose()`.
134
+ if (callback) {
135
+ __classPrivateFieldGet(this, _Connection_callbacks, "f").delete(object.id);
136
+ if (object.error) {
137
+ callback.reject(createProtocolError(callback.method, object));
138
+ }
139
+ else {
140
+ callback.resolve({ value: object.result, size: message.length });
141
+ }
142
+ }
143
+ }
144
+ else {
145
+ this.emit(object.method, object.params);
146
+ }
147
+ }, _Connection_onClose = function _Connection_onClose() {
148
+ if (__classPrivateFieldGet(this, _Connection_closed, "f")) {
149
+ return;
150
+ }
151
+ this.transport.onmessage = undefined;
152
+ this.transport.onclose = undefined;
153
+ for (const callback of __classPrivateFieldGet(this, _Connection_callbacks, "f").values()) {
154
+ callback.reject(rewriteError(new Errors_1.ProtocolError(), `Protocol error (${callback.method}): Target closed. https://www.remotion.dev/docs/target-closed`));
155
+ }
156
+ __classPrivateFieldGet(this, _Connection_callbacks, "f").clear();
157
+ for (const session of __classPrivateFieldGet(this, _Connection_sessions, "f").values()) {
158
+ session._onClosed();
159
+ }
160
+ __classPrivateFieldGet(this, _Connection_sessions, "f").clear();
161
+ this.emit(ConnectionEmittedEvents.Disconnected);
162
+ };
151
163
  exports.CDPSessionEmittedEvents = {
152
164
  Disconnected: Symbol('CDPSession.Disconnected'),
153
165
  };
154
166
  class CDPSession extends EventEmitter_1.EventEmitter {
155
- #sessionId;
156
- #targetType;
157
- #callbacks = new Map();
158
- #connection;
159
167
  constructor(connection, targetType, sessionId) {
160
168
  super();
161
- this.#connection = connection;
162
- this.#targetType = targetType;
163
- this.#sessionId = sessionId;
169
+ _CDPSession_sessionId.set(this, void 0);
170
+ _CDPSession_targetType.set(this, void 0);
171
+ _CDPSession_callbacks.set(this, new Map());
172
+ _CDPSession_connection.set(this, void 0);
173
+ __classPrivateFieldSet(this, _CDPSession_connection, connection, "f");
174
+ __classPrivateFieldSet(this, _CDPSession_targetType, targetType, "f");
175
+ __classPrivateFieldSet(this, _CDPSession_sessionId, sessionId, "f");
164
176
  }
165
177
  connection() {
166
- return this.#connection;
178
+ return __classPrivateFieldGet(this, _CDPSession_connection, "f");
167
179
  }
168
180
  send(method, ...paramArgs) {
169
- if (!this.#connection) {
170
- return Promise.reject(new Error(`Protocol error (${method}): Session closed. Most likely the ${this.#targetType} has been closed.`));
181
+ if (!__classPrivateFieldGet(this, _CDPSession_connection, "f")) {
182
+ return Promise.reject(new Error(`Protocol error (${method}): Session closed. Most likely the ${__classPrivateFieldGet(this, _CDPSession_targetType, "f")} has been closed.`));
171
183
  }
172
184
  // See the comment in Connection#send explaining why we do this.
173
185
  const params = paramArgs.length ? paramArgs[0] : undefined;
174
- const id = this.#connection._rawSend({
175
- sessionId: this.#sessionId,
186
+ const id = __classPrivateFieldGet(this, _CDPSession_connection, "f")._rawSend({
187
+ sessionId: __classPrivateFieldGet(this, _CDPSession_sessionId, "f"),
176
188
  method,
177
189
  params,
178
190
  });
179
191
  return new Promise((resolve, reject) => {
180
- if (this.#callbacks.size > 100) {
181
- for (const callback of this.#callbacks.values()) {
192
+ if (__classPrivateFieldGet(this, _CDPSession_callbacks, "f").size > 100) {
193
+ for (const callback of __classPrivateFieldGet(this, _CDPSession_callbacks, "f").values()) {
182
194
  logger_1.Log.info({ indent: false, logLevel: 'info' }, callback.method + JSON.stringify(callback.params));
183
195
  }
184
196
  throw new Error('Leak detected: Too many callbacks');
185
197
  }
186
- this.#callbacks.set(id, {
198
+ __classPrivateFieldGet(this, _CDPSession_callbacks, "f").set(id, {
187
199
  resolve,
188
200
  reject,
189
201
  method,
@@ -192,9 +204,9 @@ class CDPSession extends EventEmitter_1.EventEmitter {
192
204
  });
193
205
  }
194
206
  _onMessage(object, size) {
195
- const callback = object.id ? this.#callbacks.get(object.id) : undefined;
207
+ const callback = object.id ? __classPrivateFieldGet(this, _CDPSession_callbacks, "f").get(object.id) : undefined;
196
208
  if (object.id && callback) {
197
- this.#callbacks.delete(object.id);
209
+ __classPrivateFieldGet(this, _CDPSession_callbacks, "f").delete(object.id);
198
210
  if (object.error) {
199
211
  callback.reject(createProtocolError(callback.method, object));
200
212
  }
@@ -207,18 +219,19 @@ class CDPSession extends EventEmitter_1.EventEmitter {
207
219
  }
208
220
  }
209
221
  _onClosed() {
210
- this.#connection = undefined;
211
- for (const callback of this.#callbacks.values()) {
222
+ __classPrivateFieldSet(this, _CDPSession_connection, undefined, "f");
223
+ for (const callback of __classPrivateFieldGet(this, _CDPSession_callbacks, "f").values()) {
212
224
  callback.reject(rewriteError(new Errors_1.ProtocolError(), `Protocol error (${callback.method}): Target closed. https://www.remotion.dev/docs/target-closed`));
213
225
  }
214
- this.#callbacks.clear();
226
+ __classPrivateFieldGet(this, _CDPSession_callbacks, "f").clear();
215
227
  this.emit(exports.CDPSessionEmittedEvents.Disconnected);
216
228
  }
217
229
  id() {
218
- return this.#sessionId;
230
+ return __classPrivateFieldGet(this, _CDPSession_sessionId, "f");
219
231
  }
220
232
  }
221
233
  exports.CDPSession = CDPSession;
234
+ _CDPSession_sessionId = new WeakMap(), _CDPSession_targetType = new WeakMap(), _CDPSession_callbacks = new WeakMap(), _CDPSession_connection = new WeakMap();
222
235
  function createProtocolError(method, object) {
223
236
  let message = `Protocol error (${method}): ${object.error.message}`;
224
237
  if ('data' in object.error) {
@@ -29,7 +29,7 @@ export declare class ConsoleMessage {
29
29
  previewString: string;
30
30
  logLevel: LogLevel;
31
31
  tag: string | null;
32
- constructor({ type, text, args, stackTraceLocations, previewString, logLevel, tag }: {
32
+ constructor({ type, text, args, stackTraceLocations, previewString, logLevel, tag, }: {
33
33
  type: ConsoleMessageType;
34
34
  text: string;
35
35
  args: JSHandle[];
@@ -14,27 +14,34 @@
14
14
  * See the License for the specific language governing permissions and
15
15
  * limitations under the License.
16
16
  */
17
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
18
+ if (kind === "m") throw new TypeError("Private method is not writable");
19
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
20
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
21
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
22
+ };
23
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
24
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
25
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
26
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
27
+ };
28
+ var _ConsoleMessage_stackTraceLocations;
17
29
  Object.defineProperty(exports, "__esModule", { value: true });
18
30
  exports.ConsoleMessage = void 0;
19
31
  class ConsoleMessage {
20
- type;
21
- text;
22
- args;
23
- previewString;
24
- #stackTraceLocations;
25
- logLevel;
26
- tag;
27
32
  constructor({ type, text, args, stackTraceLocations, previewString, logLevel, tag, }) {
33
+ _ConsoleMessage_stackTraceLocations.set(this, void 0);
28
34
  this.type = type;
29
35
  this.text = text;
30
36
  this.args = args;
31
37
  this.previewString = previewString;
32
- this.#stackTraceLocations = stackTraceLocations;
38
+ __classPrivateFieldSet(this, _ConsoleMessage_stackTraceLocations, stackTraceLocations, "f");
33
39
  this.logLevel = logLevel;
34
40
  this.tag = tag;
35
41
  }
36
42
  stackTrace() {
37
- return this.#stackTraceLocations;
43
+ return __classPrivateFieldGet(this, _ConsoleMessage_stackTraceLocations, "f");
38
44
  }
39
45
  }
40
46
  exports.ConsoleMessage = ConsoleMessage;
47
+ _ConsoleMessage_stackTraceLocations = new WeakMap();
@@ -29,7 +29,7 @@ export declare class DOMWorld {
29
29
  executionContext(): Promise<ExecutionContext>;
30
30
  evaluateHandle<HandlerType extends JSHandle = JSHandle>(pageFunction: EvaluateHandleFn, ...args: SerializableOrJSHandle[]): Promise<HandlerType>;
31
31
  evaluate<T extends EvaluateFn>(pageFunction: T, ...args: SerializableOrJSHandle[]): Promise<UnwrapPromiseLike<EvaluateFnReturnType<T>>>;
32
- waitForFunction({ browser, timeout, pageFunction, title }: {
32
+ waitForFunction({ browser, timeout, pageFunction, title, }: {
33
33
  browser: HeadlessBrowser;
34
34
  timeout: number | null;
35
35
  pageFunction: Function | string;
@@ -14,62 +14,74 @@
14
14
  * See the License for the specific language governing permissions and
15
15
  * limitations under the License.
16
16
  */
17
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
18
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
19
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
20
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
21
+ };
22
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
23
+ if (kind === "m") throw new TypeError("Private method is not writable");
24
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
25
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
26
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
27
+ };
28
+ var _DOMWorld_frame, _DOMWorld_contextPromise, _DOMWorld_contextResolveCallback, _DOMWorld_detached, _DOMWorld_waitTasks, _WaitTask_instances, _WaitTask_domWorld, _WaitTask_timeout, _WaitTask_predicateBody, _WaitTask_args, _WaitTask_runCount, _WaitTask_resolve, _WaitTask_reject, _WaitTask_timeoutTimer, _WaitTask_terminated, _WaitTask_browser, _WaitTask_cleanup;
17
29
  Object.defineProperty(exports, "__esModule", { value: true });
18
30
  exports.DOMWorld = void 0;
19
31
  const assert_1 = require("./assert");
20
32
  const Errors_1 = require("./Errors");
21
33
  const util_1 = require("./util");
22
34
  class DOMWorld {
23
- #frame;
24
- #contextPromise = null;
25
- #contextResolveCallback = null;
26
- #detached = false;
27
- #waitTasks = new Set();
28
35
  get _waitTasks() {
29
- return this.#waitTasks;
36
+ return __classPrivateFieldGet(this, _DOMWorld_waitTasks, "f");
30
37
  }
31
38
  constructor(frame) {
39
+ _DOMWorld_frame.set(this, void 0);
40
+ _DOMWorld_contextPromise.set(this, null);
41
+ _DOMWorld_contextResolveCallback.set(this, null);
42
+ _DOMWorld_detached.set(this, false);
43
+ _DOMWorld_waitTasks.set(this, new Set());
32
44
  // Keep own reference to client because it might differ from the FrameManager's
33
45
  // client for OOP iframes.
34
- this.#frame = frame;
46
+ __classPrivateFieldSet(this, _DOMWorld_frame, frame, "f");
35
47
  this._setContext(null);
36
48
  }
37
49
  frame() {
38
- return this.#frame;
50
+ return __classPrivateFieldGet(this, _DOMWorld_frame, "f");
39
51
  }
40
52
  _setContext(context) {
41
53
  var _a;
42
54
  if (context) {
43
- (0, assert_1.assert)(this.#contextResolveCallback, 'Execution Context has already been set.');
44
- (_a = this.#contextResolveCallback) === null || _a === void 0 ? void 0 : _a.call(null, context);
45
- this.#contextResolveCallback = null;
55
+ (0, assert_1.assert)(__classPrivateFieldGet(this, _DOMWorld_contextResolveCallback, "f"), 'Execution Context has already been set.');
56
+ (_a = __classPrivateFieldGet(this, _DOMWorld_contextResolveCallback, "f")) === null || _a === void 0 ? void 0 : _a.call(null, context);
57
+ __classPrivateFieldSet(this, _DOMWorld_contextResolveCallback, null, "f");
46
58
  for (const waitTask of this._waitTasks) {
47
59
  waitTask.rerun();
48
60
  }
49
61
  }
50
62
  else {
51
- this.#contextPromise = new Promise((fulfill) => {
52
- this.#contextResolveCallback = fulfill;
53
- });
63
+ __classPrivateFieldSet(this, _DOMWorld_contextPromise, new Promise((fulfill) => {
64
+ __classPrivateFieldSet(this, _DOMWorld_contextResolveCallback, fulfill, "f");
65
+ }), "f");
54
66
  }
55
67
  }
56
68
  _hasContext() {
57
- return !this.#contextResolveCallback;
69
+ return !__classPrivateFieldGet(this, _DOMWorld_contextResolveCallback, "f");
58
70
  }
59
71
  _detach() {
60
- this.#detached = true;
72
+ __classPrivateFieldSet(this, _DOMWorld_detached, true, "f");
61
73
  for (const waitTask of this._waitTasks) {
62
74
  waitTask.terminate(new Error('waitForFunction failed: frame got detached.'));
63
75
  }
64
76
  }
65
77
  executionContext() {
66
- if (this.#detached) {
67
- throw new Error(`Execution context is not available in detached frame "${this.#frame.url()}" (are you trying to evaluate?)`);
78
+ if (__classPrivateFieldGet(this, _DOMWorld_detached, "f")) {
79
+ throw new Error(`Execution context is not available in detached frame "${__classPrivateFieldGet(this, _DOMWorld_frame, "f").url()}" (are you trying to evaluate?)`);
68
80
  }
69
- if (this.#contextPromise === null) {
81
+ if (__classPrivateFieldGet(this, _DOMWorld_contextPromise, "f") === null) {
70
82
  throw new Error(`Execution content promise is missing`);
71
83
  }
72
- return this.#contextPromise;
84
+ return __classPrivateFieldGet(this, _DOMWorld_contextPromise, "f");
73
85
  }
74
86
  async evaluateHandle(pageFunction, ...args) {
75
87
  const context = await this.executionContext();
@@ -91,78 +103,80 @@ class DOMWorld {
91
103
  }
92
104
  }
93
105
  exports.DOMWorld = DOMWorld;
106
+ _DOMWorld_frame = new WeakMap(), _DOMWorld_contextPromise = new WeakMap(), _DOMWorld_contextResolveCallback = new WeakMap(), _DOMWorld_detached = new WeakMap(), _DOMWorld_waitTasks = new WeakMap();
94
107
  const noop = () => undefined;
95
108
  class WaitTask {
96
- #domWorld;
97
- #timeout;
98
- #predicateBody;
99
- #args;
100
- #runCount = 0;
101
- #resolve = noop;
102
- #reject = noop;
103
- #timeoutTimer;
104
- #terminated = false;
105
- #browser;
106
- promise;
107
109
  constructor(options) {
110
+ _WaitTask_instances.add(this);
111
+ _WaitTask_domWorld.set(this, void 0);
112
+ _WaitTask_timeout.set(this, void 0);
113
+ _WaitTask_predicateBody.set(this, void 0);
114
+ _WaitTask_args.set(this, void 0);
115
+ _WaitTask_runCount.set(this, 0);
116
+ _WaitTask_resolve.set(this, noop);
117
+ _WaitTask_reject.set(this, noop);
118
+ _WaitTask_timeoutTimer.set(this, void 0);
119
+ _WaitTask_terminated.set(this, false);
120
+ _WaitTask_browser.set(this, void 0);
121
+ this.onBrowserClose = () => {
122
+ return this.terminate(new Error('Browser was closed'));
123
+ };
124
+ this.onBrowserCloseSilent = () => {
125
+ return this.terminate(null);
126
+ };
108
127
  function getPredicateBody(predicateBody) {
109
128
  if ((0, util_1.isString)(predicateBody)) {
110
129
  return `return (${predicateBody});`;
111
130
  }
112
131
  return `return (${predicateBody})(...args);`;
113
132
  }
114
- this.#domWorld = options.domWorld;
115
- this.#timeout = options.timeout;
116
- this.#predicateBody = getPredicateBody(options.predicateBody);
117
- this.#args = options.args;
118
- this.#runCount = 0;
119
- this.#domWorld._waitTasks.add(this);
133
+ __classPrivateFieldSet(this, _WaitTask_domWorld, options.domWorld, "f");
134
+ __classPrivateFieldSet(this, _WaitTask_timeout, options.timeout, "f");
135
+ __classPrivateFieldSet(this, _WaitTask_predicateBody, getPredicateBody(options.predicateBody), "f");
136
+ __classPrivateFieldSet(this, _WaitTask_args, options.args, "f");
137
+ __classPrivateFieldSet(this, _WaitTask_runCount, 0, "f");
138
+ __classPrivateFieldGet(this, _WaitTask_domWorld, "f")._waitTasks.add(this);
120
139
  this.promise = new Promise((resolve, reject) => {
121
- this.#resolve = resolve;
122
- this.#reject = reject;
140
+ __classPrivateFieldSet(this, _WaitTask_resolve, resolve, "f");
141
+ __classPrivateFieldSet(this, _WaitTask_reject, reject, "f");
123
142
  });
124
143
  // Since page navigation requires us to re-install the pageScript, we should track
125
144
  // timeout on our end.
126
145
  if (options.timeout) {
127
146
  const timeoutError = new Errors_1.TimeoutError(`waiting for ${options.title} failed: timeout ${options.timeout}ms exceeded`);
128
- this.#timeoutTimer = setTimeout(() => {
129
- return this.#reject(timeoutError);
130
- }, options.timeout);
147
+ __classPrivateFieldSet(this, _WaitTask_timeoutTimer, setTimeout(() => {
148
+ return __classPrivateFieldGet(this, _WaitTask_reject, "f").call(this, timeoutError);
149
+ }, options.timeout), "f");
131
150
  }
132
- this.#browser = options.browser;
133
- this.#browser.on("closed" /* BrowserEmittedEvents.Closed */, this.onBrowserClose);
134
- this.#browser.on("closed-silent" /* BrowserEmittedEvents.ClosedSilent */, this.onBrowserCloseSilent);
151
+ __classPrivateFieldSet(this, _WaitTask_browser, options.browser, "f");
152
+ __classPrivateFieldGet(this, _WaitTask_browser, "f").on("closed" /* BrowserEmittedEvents.Closed */, this.onBrowserClose);
153
+ __classPrivateFieldGet(this, _WaitTask_browser, "f").on("closed-silent" /* BrowserEmittedEvents.ClosedSilent */, this.onBrowserCloseSilent);
135
154
  this.rerun();
136
155
  }
137
- onBrowserClose = () => {
138
- return this.terminate(new Error('Browser was closed'));
139
- };
140
- onBrowserCloseSilent = () => {
141
- return this.terminate(null);
142
- };
143
156
  terminate(error) {
144
- this.#terminated = true;
157
+ __classPrivateFieldSet(this, _WaitTask_terminated, true, "f");
145
158
  if (error) {
146
- this.#reject(error);
159
+ __classPrivateFieldGet(this, _WaitTask_reject, "f").call(this, error);
147
160
  }
148
- this.#cleanup();
161
+ __classPrivateFieldGet(this, _WaitTask_instances, "m", _WaitTask_cleanup).call(this);
149
162
  }
150
163
  async rerun() {
151
- const runCount = ++this.#runCount;
164
+ var _a;
165
+ const runCount = __classPrivateFieldSet(this, _WaitTask_runCount, (_a = __classPrivateFieldGet(this, _WaitTask_runCount, "f"), ++_a), "f");
152
166
  let success = null;
153
167
  let error = null;
154
- const contextPromise = this.#domWorld.executionContext();
168
+ const contextPromise = __classPrivateFieldGet(this, _WaitTask_domWorld, "f").executionContext();
155
169
  const context = await contextPromise;
156
- if (this.#terminated || runCount !== this.#runCount) {
170
+ if (__classPrivateFieldGet(this, _WaitTask_terminated, "f") || runCount !== __classPrivateFieldGet(this, _WaitTask_runCount, "f")) {
157
171
  return;
158
172
  }
159
173
  try {
160
- success = await context.evaluateHandle(waitForPredicatePageFunction, this.#predicateBody, this.#timeout, ...this.#args);
174
+ success = await context.evaluateHandle(waitForPredicatePageFunction, __classPrivateFieldGet(this, _WaitTask_predicateBody, "f"), __classPrivateFieldGet(this, _WaitTask_timeout, "f"), ...__classPrivateFieldGet(this, _WaitTask_args, "f"));
161
175
  }
162
176
  catch (error_) {
163
177
  error = error_;
164
178
  }
165
- if (this.#terminated || runCount !== this.#runCount) {
179
+ if (__classPrivateFieldGet(this, _WaitTask_terminated, "f") || runCount !== __classPrivateFieldGet(this, _WaitTask_runCount, "f")) {
166
180
  if (success) {
167
181
  await success.dispose();
168
182
  }
@@ -174,9 +188,9 @@ class WaitTask {
174
188
  if (!error &&
175
189
  (success && !success._remoteObject.objectId
176
190
  ? !(0, util_1.valueFromRemoteObject)(success._remoteObject) ||
177
- !this.#domWorld._hasContext() ||
178
- this.#domWorld.executionContext() !== contextPromise
179
- : await this.#domWorld
191
+ !__classPrivateFieldGet(this, _WaitTask_domWorld, "f")._hasContext() ||
192
+ __classPrivateFieldGet(this, _WaitTask_domWorld, "f").executionContext() !== contextPromise
193
+ : await __classPrivateFieldGet(this, _WaitTask_domWorld, "f")
180
194
  .evaluate((s) => {
181
195
  return !s;
182
196
  }, success)
@@ -189,7 +203,7 @@ class WaitTask {
189
203
  await success.dispose();
190
204
  return;
191
205
  }
192
- if (this.#terminated || runCount !== this.#runCount) {
206
+ if (__classPrivateFieldGet(this, _WaitTask_terminated, "f") || runCount !== __classPrivateFieldGet(this, _WaitTask_runCount, "f")) {
193
207
  await (success === null || success === void 0 ? void 0 : success.dispose());
194
208
  return;
195
209
  }
@@ -214,28 +228,28 @@ class WaitTask {
214
228
  if (error.message.includes('Cannot find context with specified id')) {
215
229
  return;
216
230
  }
217
- this.#reject(error);
231
+ __classPrivateFieldGet(this, _WaitTask_reject, "f").call(this, error);
218
232
  }
219
233
  else {
220
234
  if (!success) {
221
235
  throw new Error('Assertion: result handle is not available');
222
236
  }
223
- this.#resolve(success);
224
- }
225
- this.#cleanup();
226
- }
227
- #cleanup() {
228
- if (this.#timeoutTimer !== undefined) {
229
- clearTimeout(this.#timeoutTimer);
237
+ __classPrivateFieldGet(this, _WaitTask_resolve, "f").call(this, success);
230
238
  }
231
- this.#browser.off("closed" /* BrowserEmittedEvents.Closed */, this.onBrowserClose);
232
- this.#browser.off("closed-silent" /* BrowserEmittedEvents.ClosedSilent */, this.onBrowserCloseSilent);
233
- if (this.#domWorld._waitTasks.size > 100) {
234
- throw new Error('Leak detected: Too many WaitTasks');
235
- }
236
- this.#domWorld._waitTasks.delete(this);
239
+ __classPrivateFieldGet(this, _WaitTask_instances, "m", _WaitTask_cleanup).call(this);
237
240
  }
238
241
  }
242
+ _WaitTask_domWorld = new WeakMap(), _WaitTask_timeout = new WeakMap(), _WaitTask_predicateBody = new WeakMap(), _WaitTask_args = new WeakMap(), _WaitTask_runCount = new WeakMap(), _WaitTask_resolve = new WeakMap(), _WaitTask_reject = new WeakMap(), _WaitTask_timeoutTimer = new WeakMap(), _WaitTask_terminated = new WeakMap(), _WaitTask_browser = new WeakMap(), _WaitTask_instances = new WeakSet(), _WaitTask_cleanup = function _WaitTask_cleanup() {
243
+ if (__classPrivateFieldGet(this, _WaitTask_timeoutTimer, "f") !== undefined) {
244
+ clearTimeout(__classPrivateFieldGet(this, _WaitTask_timeoutTimer, "f"));
245
+ }
246
+ __classPrivateFieldGet(this, _WaitTask_browser, "f").off("closed" /* BrowserEmittedEvents.Closed */, this.onBrowserClose);
247
+ __classPrivateFieldGet(this, _WaitTask_browser, "f").off("closed-silent" /* BrowserEmittedEvents.ClosedSilent */, this.onBrowserCloseSilent);
248
+ if (__classPrivateFieldGet(this, _WaitTask_domWorld, "f")._waitTasks.size > 100) {
249
+ throw new Error('Leak detected: Too many WaitTasks');
250
+ }
251
+ __classPrivateFieldGet(this, _WaitTask_domWorld, "f")._waitTasks.delete(this);
252
+ };
239
253
  function waitForPredicatePageFunction(predicateBody, timeout, ...args) {
240
254
  // eslint-disable-next-line no-new-func
241
255
  const predicate = new Function('...args', predicateBody);
@@ -27,7 +27,9 @@ class TimeoutError extends CustomError {
27
27
  }
28
28
  exports.TimeoutError = TimeoutError;
29
29
  class ProtocolError extends CustomError {
30
- code;
31
- originalMessage = '';
30
+ constructor() {
31
+ super(...arguments);
32
+ this.originalMessage = '';
33
+ }
32
34
  }
33
35
  exports.ProtocolError = ProtocolError;