@tlockney/cdp-kernel 0.7.1 → 0.7.2

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.
@@ -29439,7 +29439,7 @@ ${expression}
29439
29439
  };
29440
29440
 
29441
29441
  // stub:package
29442
- var VERSION = "0.7.1";
29442
+ var VERSION = "0.7.2";
29443
29443
 
29444
29444
  // src/browser/channels.ts
29445
29445
  var PEER = "page";
@@ -29629,6 +29629,15 @@ var BrowserTarget = class _BrowserTarget {
29629
29629
  (err) => answer({ error: describeHostError(err) })
29630
29630
  );
29631
29631
  }
29632
+ /** Aborts each host request in flight and rejects it in the Worker. */
29633
+ #cancelHostCalls() {
29634
+ const calls = [...this.#hostCalls];
29635
+ this.#hostCalls.clear();
29636
+ for (const [id, controller] of calls) {
29637
+ controller.abort();
29638
+ this.#worker.postMessage({ op: "host", id, error: { name: "AbortError", message: "interrupted" } });
29639
+ }
29640
+ }
29632
29641
  /** Sends `host.onEvent` listeners in the Worker an event (#384). */
29633
29642
  notifyHost(event, value) {
29634
29643
  if (!this.#exited) this.#worker.postMessage({ op: "host", event, value });
@@ -29666,9 +29675,10 @@ var BrowserTarget = class _BrowserTarget {
29666
29675
  }
29667
29676
  /**
29668
29677
  * A cell that's waiting on something leaves the Worker free: it answers a
29669
- * ping, and the cell is abandoned with its state intact. A busy cell
29670
- * can't be reached, so the Worker is terminated, and a new one starts on
29671
- * the next cell.
29678
+ * ping, and the cell is abandoned with its state intact; host requests
29679
+ * in flight are cancelled on the page, and reject in the Worker with an
29680
+ * AbortError (#388). A busy cell can't be reached, so the Worker is
29681
+ * terminated, and a new one starts on the next cell.
29672
29682
  */
29673
29683
  async interrupt() {
29674
29684
  this.#interrupted = true;
@@ -29683,6 +29693,7 @@ var BrowserTarget = class _BrowserTarget {
29683
29693
  this.#pending.delete(id);
29684
29694
  this.#interruptible.delete(id);
29685
29695
  }
29696
+ this.#cancelHostCalls();
29686
29697
  return;
29687
29698
  }
29688
29699
  this.#stopNote = RESTART_NOTE;