playwright-core 1.55.0-alpha-2025-08-06 → 1.55.0-alpha-2025-08-08

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.
@@ -50,19 +50,17 @@ class Browser extends import_channelOwner.ChannelOwner {
50
50
  return await this._innerNewContext(options, false);
51
51
  }
52
52
  async _newContextForReuse(options = {}) {
53
- return await this._wrapApiCall(() => this._innerNewContext(options, true), { internal: true });
53
+ return await this._innerNewContext(options, true);
54
54
  }
55
55
  async _disconnectFromReusedContext(reason) {
56
- return await this._wrapApiCall(async () => {
57
- const context = [...this._contexts].find((context2) => context2._forReuse);
58
- if (!context)
59
- return;
60
- await this._instrumentation.runBeforeCloseBrowserContext(context);
61
- for (const page of context.pages())
62
- page._onClose();
63
- context._onClose();
64
- await this._channel.disconnectFromReusedContext({ reason });
65
- }, { internal: true });
56
+ const context = [...this._contexts].find((context2) => context2._forReuse);
57
+ if (!context)
58
+ return;
59
+ await this._instrumentation.runBeforeCloseBrowserContext(context);
60
+ for (const page of context.pages())
61
+ page._onClose();
62
+ context._onClose();
63
+ await this._channel.disconnectFromReusedContext({ reason });
66
64
  }
67
65
  async _innerNewContext(options = {}, forReuse) {
68
66
  options = this._browserType._playwright.selectors._withSelectorOptions({
@@ -434,8 +434,8 @@ class BrowserContext extends import_channelOwner.ChannelOwner {
434
434
  this._closeReason = options.reason;
435
435
  this._closingStatus = "closing";
436
436
  await this.request.dispose(options);
437
+ await this._instrumentation.runBeforeCloseBrowserContext(this);
437
438
  await this._wrapApiCall(async () => {
438
- await this._instrumentation.runBeforeCloseBrowserContext(this);
439
439
  for (const [harId, harParams] of this._harRecorders) {
440
440
  const har = await this._channel.harExport({ harId });
441
441
  const artifact = import_artifact.Artifact.from(har.artifact);
@@ -90,15 +90,16 @@ class BrowserType extends import_channelOwner.ChannelOwner {
90
90
  userDataDir: this._platform.path().isAbsolute(userDataDir) || !userDataDir ? userDataDir : this._platform.path().resolve(userDataDir),
91
91
  timeout: new import_timeoutSettings.TimeoutSettings(this._platform).launchTimeout(options)
92
92
  };
93
- return await this._wrapApiCall(async () => {
93
+ const context = await this._wrapApiCall(async () => {
94
94
  const result = await this._channel.launchPersistentContext(persistentParams);
95
95
  const browser = import_browser.Browser.from(result.browser);
96
96
  browser._connectToBrowserType(this, options, logger);
97
- const context = import_browserContext.BrowserContext.from(result.context);
98
- await context._initializeHarFromOptions(options.recordHar);
99
- await this._instrumentation.runAfterCreateBrowserContext(context);
100
- return context;
97
+ const context2 = import_browserContext.BrowserContext.from(result.context);
98
+ await context2._initializeHarFromOptions(options.recordHar);
99
+ return context2;
101
100
  });
101
+ await this._instrumentation.runAfterCreateBrowserContext(context);
102
+ return context;
102
103
  }
103
104
  async connect(optionsOrWsEndpoint, options) {
104
105
  if (typeof optionsOrWsEndpoint === "string")