@olimsaidov/icdp 0.2.0 → 0.2.1

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.
@@ -34,7 +34,9 @@ var IcdpHost = class {
34
34
  pending: /* @__PURE__ */ new Map(),
35
35
  enables: /* @__PURE__ */ new Map(),
36
36
  localSessions: /* @__PURE__ */ new Map(),
37
- onLoad: () => this.probe(pairing)
37
+ onLoad: () => {
38
+ if (!pairing.port) this.probe(pairing);
39
+ }
38
40
  };
39
41
  this.pairings.set(options.targetId, pairing);
40
42
  iframe.addEventListener("load", pairing.onLoad);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@olimsaidov/icdp",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Chrome DevTools Protocol over an iframe boundary: drive and inspect embedded (including cross-origin) apps with CDP tools, without a real browser debugging session.",
5
5
  "homepage": "https://github.com/olimsaidov/icdp#readme",
6
6
  "bugs": "https://github.com/olimsaidov/icdp/issues",
package/src/host/index.ts CHANGED
@@ -138,7 +138,14 @@ export class IcdpHost {
138
138
  pending: new Map(),
139
139
  enables: new Map(),
140
140
  localSessions: new Map(),
141
- onLoad: () => this.probe(pairing),
141
+ // Re-probe on load only when we have no channel yet. A connected pairing
142
+ // must not be re-probed: the agent would answer with a fresh hello, which
143
+ // handleWindowMessage treats as a reload and uses to fail in-flight
144
+ // commands. The initial load of a freshly-paired iframe already connected
145
+ // via the agent's boot hello, and a genuine reload re-announces on its own.
146
+ onLoad: () => {
147
+ if (!pairing.port) this.probe(pairing);
148
+ },
142
149
  };
143
150
  this.pairings.set(options.targetId, pairing);
144
151
  iframe.addEventListener("load", pairing.onLoad);