@dev-blinq/cucumber_client 1.0.1590-dev → 1.0.1592-dev

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.
@@ -831,7 +831,10 @@ export class BVTRecorder {
831
831
  this.previousHistoryLength = null;
832
832
  this.previousUrl = null;
833
833
  this.previousEntries = null;
834
-
834
+ if (this.browserEmitter) {
835
+ this.browserEmitter.destroy();
836
+ this.browserEmitter = null; // Clear the reference
837
+ }
835
838
  await closeContext();
836
839
  this.pageSet.clear();
837
840
  }
@@ -371,7 +371,7 @@ export class RemoteBrowserService extends EventEmitter {
371
371
  async getDebugURLs() {
372
372
  const url = `${this.CDP_CONNECT_URL}/json`;
373
373
  try {
374
- const response = await fetch(url);
374
+ const response = await fetch(url, { cache: "no-store" });
375
375
  if (!response.ok) {
376
376
  throw new Error("Error while fetching debug URL");
377
377
  }
@@ -505,6 +505,22 @@ export class RemoteBrowserService extends EventEmitter {
505
505
  });
506
506
  return pageInfo?.page || null;
507
507
  }
508
+ destroy() {
509
+ this.log("💥 Destroying RemoteBrowserService");
510
+ // Remove all listeners *this* instance has registered
511
+ // This stops it from listening to context/page events
512
+ this.context.removeAllListeners("page");
513
+ for (const [stableId, pageInfo] of this.pages.entries()) {
514
+ pageInfo.page.removeAllListeners("load");
515
+ pageInfo.page.removeAllListeners("close");
516
+ pageInfo.page.removeAllListeners("framenavigated");
517
+ }
518
+ // Clear internal maps
519
+ this.pages.clear();
520
+ this._selectedPageId = null;
521
+ // Remove all listeners *on this* emitter
522
+ this.removeAllListeners();
523
+ }
508
524
  }
509
525
  // export class RemoteBrowserService extends EventEmitter {
510
526
  // private CDP_CONNECT_URL: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dev-blinq/cucumber_client",
3
- "version": "1.0.1590-dev",
3
+ "version": "1.0.1592-dev",
4
4
  "description": " ",
5
5
  "main": "bin/index.js",
6
6
  "types": "bin/index.d.ts",