@glimt/record 0.0.74 → 0.0.75

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.
package/dist/record.cjs CHANGED
@@ -10298,6 +10298,12 @@ const _ObserveManager = class _ObserveManager2 {
10298
10298
  }
10299
10299
  _ObserveManager2.instance = this;
10300
10300
  }
10301
+ canObserveDoc(doc) {
10302
+ return !this.docsObservers.has(doc);
10303
+ }
10304
+ canObserveShadowRoot(shadowRoot2) {
10305
+ return !this.shadowRootsObserved.has(shadowRoot2);
10306
+ }
10301
10307
  observerAttached(doc, onCleanup) {
10302
10308
  debugLog("[doc] attaching observer to doc", doc);
10303
10309
  if (this.docsObservers.has(doc)) {
@@ -10316,17 +10322,6 @@ const _ObserveManager = class _ObserveManager2 {
10316
10322
  }
10317
10323
  this.shadowRootsObserved.set(shadowRoot2, onCleanup);
10318
10324
  }
10319
- // attachObserverToDoc(doc: Document, observerMethod: (doc: Document)) {}
10320
- // canObserveDoc(doc: Document) {
10321
- // if (this.docsObservers.has(doc)) return false;
10322
- // this.docsObservers.set(doc);
10323
- // return true;
10324
- // }
10325
- // canObserveShadow(shadowRoot: ShadowRoot) {
10326
- // if (this.shadowRootsObserved.has(shadowRoot)) return false;
10327
- // this.shadowRootsObserved.add(shadowRoot);
10328
- // return true;
10329
- // }
10330
10325
  destroy() {
10331
10326
  this.docsObservers = /* @__PURE__ */ new WeakMap();
10332
10327
  this.shadowRootsObserved = /* @__PURE__ */ new WeakMap();
@@ -12886,6 +12881,7 @@ class ShadowDomManager {
12886
12881
  }
12887
12882
  addShadowRoot(shadowRoot2, doc) {
12888
12883
  if (!isNativeShadowDom(shadowRoot2)) return;
12884
+ if (!observeManager.canObserveShadowRoot(shadowRoot2)) return;
12889
12885
  if (this.shadowDoms.has(shadowRoot2)) return;
12890
12886
  this.shadowDoms.add(shadowRoot2);
12891
12887
  debugLog(`Adding mutation observer for shadowRoot ${shadowRoot2.host}`);
@@ -13491,6 +13487,7 @@ function record(options = {}) {
13491
13487
  };
13492
13488
  iframeManager.addLoadListener((iframeEl) => {
13493
13489
  try {
13490
+ if (!observeManager.canObserveDoc(iframeEl.contentDocument)) return;
13494
13491
  const stopObserve = observe(iframeEl.contentDocument);
13495
13492
  const id = makeid();
13496
13493
  registeredHandlers[id] = stopObserve;