playwright-core 1.56.0-beta-1759527268000 → 1.57.0-alpha-2025-10-04

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.
@@ -43,10 +43,6 @@ class Playwright extends import_channelOwner.ChannelOwner {
43
43
  this._android._playwright = this;
44
44
  this._electron = import_electron.Electron.from(initializer.electron);
45
45
  this._electron._playwright = this;
46
- this._bidiChromium = import_browserType.BrowserType.from(initializer._bidiChromium);
47
- this._bidiChromium._playwright = this;
48
- this._bidiFirefox = import_browserType.BrowserType.from(initializer._bidiFirefox);
49
- this._bidiFirefox._playwright = this;
50
46
  this.devices = this._connection.localUtils()?.devices ?? {};
51
47
  this.selectors = new import_selectors.Selectors(this._connection._platform);
52
48
  this.errors = { TimeoutError: import_errors.TimeoutError };
@@ -55,7 +51,7 @@ class Playwright extends import_channelOwner.ChannelOwner {
55
51
  return channel._object;
56
52
  }
57
53
  _browserTypes() {
58
- return [this.chromium, this.firefox, this.webkit, this._bidiChromium, this._bidiFirefox];
54
+ return [this.chromium, this.firefox, this.webkit];
59
55
  }
60
56
  _preLaunchedBrowser() {
61
57
  const browser = import_browser.Browser.from(this._initializer.preLaunchedBrowser);
@@ -43,8 +43,6 @@ function createInProcessPlaywright() {
43
43
  playwrightAPI.firefox._serverLauncher = new import_browserServerImpl.BrowserServerLauncherImpl("firefox");
44
44
  playwrightAPI.webkit._serverLauncher = new import_browserServerImpl.BrowserServerLauncherImpl("webkit");
45
45
  playwrightAPI._android._serverLauncher = new import_androidServerImpl.AndroidServerLauncherImpl();
46
- playwrightAPI._bidiChromium._serverLauncher = new import_browserServerImpl.BrowserServerLauncherImpl("_bidiChromium");
47
- playwrightAPI._bidiFirefox._serverLauncher = new import_browserServerImpl.BrowserServerLauncherImpl("_bidiFirefox");
48
46
  dispatcherConnection.onmessage = (message) => setImmediate(() => clientConnection.dispatch(message));
49
47
  clientConnection.onmessage = (message) => setImmediate(() => dispatcherConnection.dispatch(message));
50
48
  clientConnection.toImpl = (x) => {
@@ -383,8 +383,6 @@ import_validatorPrimitives.scheme.PlaywrightInitializer = (0, import_validatorPr
383
383
  chromium: (0, import_validatorPrimitives.tChannel)(["BrowserType"]),
384
384
  firefox: (0, import_validatorPrimitives.tChannel)(["BrowserType"]),
385
385
  webkit: (0, import_validatorPrimitives.tChannel)(["BrowserType"]),
386
- _bidiChromium: (0, import_validatorPrimitives.tChannel)(["BrowserType"]),
387
- _bidiFirefox: (0, import_validatorPrimitives.tChannel)(["BrowserType"]),
388
386
  android: (0, import_validatorPrimitives.tChannel)(["Android"]),
389
387
  electron: (0, import_validatorPrimitives.tChannel)(["Electron"]),
390
388
  utils: (0, import_validatorPrimitives.tOptional)((0, import_validatorPrimitives.tChannel)(["LocalUtils"])),
@@ -40,7 +40,7 @@ var import_chromiumSwitches = require("../chromium/chromiumSwitches");
40
40
  var import_chromium = require("../chromium/chromium");
41
41
  class BidiChromium extends import_browserType.BrowserType {
42
42
  constructor(parent) {
43
- super(parent, "_bidiChromium");
43
+ super(parent, "chromium");
44
44
  }
45
45
  async connectToTransport(transport, options, browserLogsCollector) {
46
46
  const bidiTransport = await require("./bidiOverCdp").connectBidiOverCdp(transport);
@@ -41,7 +41,7 @@ var import_firefoxPrefs = require("./third_party/firefoxPrefs");
41
41
  var import_manualPromise = require("../../utils/isomorphic/manualPromise");
42
42
  class BidiFirefox extends import_browserType.BrowserType {
43
43
  constructor(parent) {
44
- super(parent, "_bidiFirefox");
44
+ super(parent, "firefox");
45
45
  }
46
46
  executablePath() {
47
47
  return "";
@@ -55,11 +55,22 @@ var import_fileUtils = require("../utils/fileUtils");
55
55
  var import_processLauncher = require("../utils/processLauncher");
56
56
  const ARTIFACTS_FOLDER = import_path.default.join(import_os.default.tmpdir(), "playwright-artifacts-");
57
57
  class Chromium extends import_browserType.BrowserType {
58
- constructor(parent) {
58
+ constructor(parent, bidiChromium) {
59
59
  super(parent, "chromium");
60
+ this._bidiChromium = bidiChromium;
60
61
  if ((0, import_utils.debugMode)() === "inspector")
61
62
  this._devtools = this._createDevTools();
62
63
  }
64
+ launch(progress, options, protocolLogger) {
65
+ if (options.channel?.startsWith("bidi-"))
66
+ return this._bidiChromium.launch(progress, options, protocolLogger);
67
+ return super.launch(progress, options, protocolLogger);
68
+ }
69
+ async launchPersistentContext(progress, userDataDir, options) {
70
+ if (options.channel?.startsWith("bidi-"))
71
+ return this._bidiChromium.launchPersistentContext(progress, userDataDir, options);
72
+ return super.launchPersistentContext(progress, userDataDir, options);
73
+ }
63
74
  async connectOverCDP(progress, endpointURL, options) {
64
75
  return await this._connectOverCDPInternal(progress, endpointURL, options);
65
76
  }
@@ -118,7 +118,7 @@ class BrowserContextDispatcher extends import_dispatcher.Dispatcher {
118
118
  return true;
119
119
  };
120
120
  context.dialogManager.addDialogHandler(this._dialogHandler);
121
- if (context._browser.options.name === "chromium") {
121
+ if (context._browser.options.name === "chromium" && this._object._browser instanceof import_crBrowser.CRBrowser) {
122
122
  for (const serviceWorker of context.serviceWorkers())
123
123
  this._dispatchEvent("serviceWorker", { worker: new import_pageDispatcher.WorkerDispatcher(this, serviceWorker) });
124
124
  this.addObjectListener(import_crBrowser.CRBrowserContext.CREvents.ServiceWorker, (serviceWorker) => this._dispatchEvent("serviceWorker", { worker: new import_pageDispatcher.WorkerDispatcher(this, serviceWorker) }));
@@ -277,7 +277,7 @@ class BrowserContextDispatcher extends import_dispatcher.Dispatcher {
277
277
  await import_recorderApp.RecorderApp.show(this._context, params);
278
278
  }
279
279
  async disableRecorder(params, progress) {
280
- const recorder = import_recorder.Recorder.existingForContext(this._context);
280
+ const recorder = await import_recorder.Recorder.existingForContext(this._context);
281
281
  if (recorder)
282
282
  recorder.setMode("none");
283
283
  }
@@ -39,15 +39,11 @@ class PlaywrightDispatcher extends import_dispatcher.Dispatcher {
39
39
  const chromium = new import_browserTypeDispatcher.BrowserTypeDispatcher(scope, playwright.chromium, denyLaunch);
40
40
  const firefox = new import_browserTypeDispatcher.BrowserTypeDispatcher(scope, playwright.firefox, denyLaunch);
41
41
  const webkit = new import_browserTypeDispatcher.BrowserTypeDispatcher(scope, playwright.webkit, denyLaunch);
42
- const _bidiChromium = new import_browserTypeDispatcher.BrowserTypeDispatcher(scope, playwright._bidiChromium, denyLaunch);
43
- const _bidiFirefox = new import_browserTypeDispatcher.BrowserTypeDispatcher(scope, playwright._bidiFirefox, denyLaunch);
44
42
  const android = new import_androidDispatcher.AndroidDispatcher(scope, playwright.android);
45
43
  const initializer = {
46
44
  chromium,
47
45
  firefox,
48
46
  webkit,
49
- _bidiChromium,
50
- _bidiFirefox,
51
47
  android,
52
48
  electron: new import_electronDispatcher.ElectronDispatcher(scope, playwright.electron, denyLaunch),
53
49
  utils: playwright.options.isServer ? void 0 : new import_localUtilsDispatcher.LocalUtilsDispatcher(scope, playwright),
@@ -39,8 +39,19 @@ var import_ascii = require("../utils/ascii");
39
39
  var import_browserType = require("../browserType");
40
40
  var import_manualPromise = require("../../utils/isomorphic/manualPromise");
41
41
  class Firefox extends import_browserType.BrowserType {
42
- constructor(parent) {
42
+ constructor(parent, bidiFirefox) {
43
43
  super(parent, "firefox");
44
+ this._bidiFirefox = bidiFirefox;
45
+ }
46
+ launch(progress, options, protocolLogger) {
47
+ if (options.channel?.startsWith("moz-"))
48
+ return this._bidiFirefox.launch(progress, options, protocolLogger);
49
+ return super.launch(progress, options, protocolLogger);
50
+ }
51
+ async launchPersistentContext(progress, userDataDir, options) {
52
+ if (options.channel?.startsWith("moz-"))
53
+ return this._bidiFirefox.launchPersistentContext(progress, userDataDir, options);
54
+ return super.launchPersistentContext(progress, userDataDir, options);
44
55
  }
45
56
  connectToTransport(transport, options) {
46
57
  return import_ffBrowser.FFBrowser.connect(this.attribution.playwright, transport, options);
@@ -582,7 +582,8 @@ class Page extends import_instrumentation.SdkObject {
582
582
  this.closeReason = options.reason;
583
583
  const runBeforeUnload = !!options.runBeforeUnload;
584
584
  if (this._closedState !== "closing") {
585
- this._closedState = "closing";
585
+ if (!runBeforeUnload)
586
+ this._closedState = "closing";
586
587
  await this.delegate.closePage(runBeforeUnload).catch((e) => import_debugLogger.debugLogger.log("error", e));
587
588
  }
588
589
  if (!runBeforeUnload)
@@ -45,10 +45,8 @@ class Playwright extends import_instrumentation.SdkObject {
45
45
  onPageOpen: (page) => this._allPages.add(page),
46
46
  onPageClose: (page) => this._allPages.delete(page)
47
47
  }, null);
48
- this.chromium = new import_chromium.Chromium(this);
49
- this._bidiChromium = new import_bidiChromium.BidiChromium(this);
50
- this._bidiFirefox = new import_bidiFirefox.BidiFirefox(this);
51
- this.firefox = new import_firefox.Firefox(this);
48
+ this.chromium = new import_chromium.Chromium(this, new import_bidiChromium.BidiChromium(this));
49
+ this.firefox = new import_firefox.Firefox(this, new import_bidiFirefox.BidiFirefox(this));
52
50
  this.webkit = new import_webkit.WebKit(this);
53
51
  this.electron = new import_electron.Electron(this);
54
52
  this.android = new import_android.Android(this, new import_backendAdb.AdbBackend());
@@ -112,8 +112,9 @@ class Recorder extends import_events.default {
112
112
  }
113
113
  return recorderPromise;
114
114
  }
115
- static existingForContext(context) {
116
- return context[recorderSymbol];
115
+ static async existingForContext(context) {
116
+ const recorderPromise = context[recorderSymbol];
117
+ return await recorderPromise;
117
118
  }
118
119
  static async _create(context, params = {}) {
119
120
  const recorder = new Recorder(context, params);
@@ -417,10 +417,7 @@ const DOWNLOAD_PATHS = {
417
417
  "mac15": "builds/android/%s/android.zip",
418
418
  "mac15-arm64": "builds/android/%s/android.zip",
419
419
  "win64": "builds/android/%s/android.zip"
420
- },
421
- // TODO(bidi): implement downloads.
422
- "_bidiFirefox": {},
423
- "_bidiChromium": {}
420
+ }
424
421
  };
425
422
  const registryDirectory = (() => {
426
423
  let result;
@@ -674,9 +671,9 @@ ${(0, import_ascii.wrapInASCIIBox)(prettyMessage, 1)}`);
674
671
  "win32": `\\Google\\Chrome SxS\\Application\\chrome.exe`
675
672
  }));
676
673
  this._executables.push({
677
- type: "browser",
678
- name: "_bidiChromium",
679
- browserName: "_bidiChromium",
674
+ type: "channel",
675
+ name: "bidi-chromium",
676
+ browserName: "chromium",
680
677
  directory: chromium.dir,
681
678
  executablePath: () => chromiumExecutable,
682
679
  executablePathOrDie: (sdkLanguage) => executablePathOrDie("chromium", chromiumExecutable, chromium.installByDefault, sdkLanguage),
@@ -887,13 +884,14 @@ Run "${buildPlaywrightCLICommand(sdkLanguage, "install " + name)}"` : "";
887
884
  return executablePath2;
888
885
  }
889
886
  if (shouldThrow)
890
- throw new Error(`Cannot find Firefox installation for channel '${name}' at the standard system paths.`);
887
+ throw new Error(`Cannot find Firefox installation for channel '${name}' at the standard system paths. ${`Tried paths:
888
+ ${prefixes.map((p) => import_path.default.join(p, suffix)).join("\n ")}`}`);
891
889
  return void 0;
892
890
  };
893
891
  return {
894
892
  type: "channel",
895
893
  name,
896
- browserName: "_bidiFirefox",
894
+ browserName: "firefox",
897
895
  directory: void 0,
898
896
  executablePath: (sdkLanguage) => executablePath(sdkLanguage, false),
899
897
  executablePathOrDie: (sdkLanguage) => executablePath(sdkLanguage, true),
@@ -934,7 +932,7 @@ Run "${buildPlaywrightCLICommand(sdkLanguage, "install " + name)}"` : "";
934
932
  return {
935
933
  type: "channel",
936
934
  name,
937
- browserName: "_bidiChromium",
935
+ browserName: "chromium",
938
936
  directory: void 0,
939
937
  executablePath: (sdkLanguage) => executablePath(sdkLanguage, false),
940
938
  executablePathOrDie: (sdkLanguage) => executablePath(sdkLanguage, true),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "playwright-core",
3
- "version": "1.56.0-beta-1759527268000",
3
+ "version": "1.57.0-alpha-2025-10-04",
4
4
  "description": "A high-level API to automate web browsers",
5
5
  "repository": {
6
6
  "type": "git",
package/types/types.d.ts CHANGED
@@ -16290,8 +16290,6 @@ export type AndroidKey =
16290
16290
 
16291
16291
  export const _electron: Electron;
16292
16292
  export const _android: Android;
16293
- export const _bidiChromium: BrowserType;
16294
- export const _bidiFirefox: BrowserType;
16295
16293
 
16296
16294
  // This is required to not export everything by default. See https://github.com/Microsoft/TypeScript/issues/19545#issuecomment-340490459
16297
16295
  export {};