@posthog/rrweb-record 0.0.46 → 0.0.48
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/rrweb-record.cjs +56 -8
- package/dist/rrweb-record.cjs.map +1 -1
- package/dist/rrweb-record.js +56 -8
- package/dist/rrweb-record.js.map +1 -1
- package/dist/rrweb-record.umd.cjs +56 -8
- package/dist/rrweb-record.umd.cjs.map +2 -2
- package/dist/rrweb-record.umd.min.cjs +17 -17
- package/dist/rrweb-record.umd.min.cjs.map +3 -3
- package/package.json +4 -4
package/dist/rrweb-record.js
CHANGED
|
@@ -10545,7 +10545,7 @@ function initMutationObserver(options, rootEl) {
|
|
|
10545
10545
|
childList: true,
|
|
10546
10546
|
subtree: true
|
|
10547
10547
|
});
|
|
10548
|
-
return observer;
|
|
10548
|
+
return { observer, buffer: mutationBuffer };
|
|
10549
10549
|
}
|
|
10550
10550
|
function initMoveObserver({
|
|
10551
10551
|
mousemoveCb,
|
|
@@ -11466,8 +11466,11 @@ function initObservers(o2, hooks = {}) {
|
|
|
11466
11466
|
}
|
|
11467
11467
|
mergeHooks(o2, hooks);
|
|
11468
11468
|
let mutationObserver;
|
|
11469
|
+
let mutationBuffer;
|
|
11469
11470
|
if (o2.recordDOM) {
|
|
11470
|
-
|
|
11471
|
+
const result2 = initMutationObserver(o2, o2.doc);
|
|
11472
|
+
mutationObserver = result2.observer;
|
|
11473
|
+
mutationBuffer = result2.buffer;
|
|
11471
11474
|
}
|
|
11472
11475
|
const mousemoveHandler = initMoveObserver(o2);
|
|
11473
11476
|
const mouseInteractionHandler = initMouseInteractionObserver(o2);
|
|
@@ -11504,8 +11507,14 @@ function initObservers(o2, hooks = {}) {
|
|
|
11504
11507
|
);
|
|
11505
11508
|
}
|
|
11506
11509
|
return callbackWrapper(() => {
|
|
11507
|
-
|
|
11508
|
-
|
|
11510
|
+
if (mutationBuffer) {
|
|
11511
|
+
mutationBuffer.destroy();
|
|
11512
|
+
mutationBuffer.reset();
|
|
11513
|
+
const index2 = mutationBuffers.indexOf(mutationBuffer);
|
|
11514
|
+
if (index2 !== -1) {
|
|
11515
|
+
mutationBuffers.splice(index2, 1);
|
|
11516
|
+
}
|
|
11517
|
+
}
|
|
11509
11518
|
mutationObserver == null ? void 0 : mutationObserver.disconnect();
|
|
11510
11519
|
mousemoveHandler();
|
|
11511
11520
|
mouseInteractionHandler();
|
|
@@ -11520,7 +11529,6 @@ function initObservers(o2, hooks = {}) {
|
|
|
11520
11529
|
selectionObserver();
|
|
11521
11530
|
customElementObserver();
|
|
11522
11531
|
pluginHandlers.forEach((h) => h());
|
|
11523
|
-
mutationBuffers.length = 0;
|
|
11524
11532
|
});
|
|
11525
11533
|
}
|
|
11526
11534
|
function hasNestedCSSRule(prop) {
|
|
@@ -11920,7 +11928,7 @@ class ShadowDomManager {
|
|
|
11920
11928
|
if (!isNativeShadowDom(shadowRoot2)) return;
|
|
11921
11929
|
if (this.shadowDoms.has(shadowRoot2)) return;
|
|
11922
11930
|
this.shadowDoms.add(shadowRoot2);
|
|
11923
|
-
const observer = initMutationObserver(
|
|
11931
|
+
const { observer, buffer } = initMutationObserver(
|
|
11924
11932
|
{
|
|
11925
11933
|
...this.bypassOptions,
|
|
11926
11934
|
doc,
|
|
@@ -11930,7 +11938,15 @@ class ShadowDomManager {
|
|
|
11930
11938
|
},
|
|
11931
11939
|
shadowRoot2
|
|
11932
11940
|
);
|
|
11933
|
-
this.restoreHandlers.push(() =>
|
|
11941
|
+
this.restoreHandlers.push(() => {
|
|
11942
|
+
observer.disconnect();
|
|
11943
|
+
buffer.destroy();
|
|
11944
|
+
buffer.reset();
|
|
11945
|
+
const index2 = mutationBuffers.indexOf(buffer);
|
|
11946
|
+
if (index2 !== -1) {
|
|
11947
|
+
mutationBuffers.splice(index2, 1);
|
|
11948
|
+
}
|
|
11949
|
+
});
|
|
11934
11950
|
this.restoreHandlers.push(
|
|
11935
11951
|
initScrollObserver({
|
|
11936
11952
|
...this.bypassOptions,
|
|
@@ -12787,6 +12803,26 @@ function record(options = {}) {
|
|
|
12787
12803
|
polyfill$1();
|
|
12788
12804
|
let lastFullSnapshotEvent;
|
|
12789
12805
|
let incrementalSnapshotCount = 0;
|
|
12806
|
+
const iframeObserverCleanups = /* @__PURE__ */ new Map();
|
|
12807
|
+
function cleanupDetachedIframeObservers() {
|
|
12808
|
+
for (const [iframeId, cleanup] of iframeObserverCleanups) {
|
|
12809
|
+
const iframe = mirror.getNode(iframeId);
|
|
12810
|
+
if (!iframe) {
|
|
12811
|
+
cleanup();
|
|
12812
|
+
iframeObserverCleanups.delete(iframeId);
|
|
12813
|
+
continue;
|
|
12814
|
+
}
|
|
12815
|
+
try {
|
|
12816
|
+
if (!iframe.contentDocument || !iframe.contentDocument.defaultView) {
|
|
12817
|
+
cleanup();
|
|
12818
|
+
iframeObserverCleanups.delete(iframeId);
|
|
12819
|
+
}
|
|
12820
|
+
} catch {
|
|
12821
|
+
cleanup();
|
|
12822
|
+
iframeObserverCleanups.delete(iframeId);
|
|
12823
|
+
}
|
|
12824
|
+
}
|
|
12825
|
+
}
|
|
12790
12826
|
const eventProcessor = (e2) => {
|
|
12791
12827
|
for (const plugin of plugins || []) {
|
|
12792
12828
|
if (plugin.eventProcessor) {
|
|
@@ -12837,9 +12873,15 @@ function record(options = {}) {
|
|
|
12837
12873
|
const addedIds = m.adds.length > 0 ? new Set(m.adds.map((add) => add.node.id)) : null;
|
|
12838
12874
|
m.removes.forEach(({ id }) => {
|
|
12839
12875
|
if (!addedIds || !addedIds.has(id)) {
|
|
12876
|
+
const cleanup = iframeObserverCleanups.get(id);
|
|
12877
|
+
if (cleanup) {
|
|
12878
|
+
cleanup();
|
|
12879
|
+
iframeObserverCleanups.delete(id);
|
|
12880
|
+
}
|
|
12840
12881
|
iframeManager.removeIframeById(id);
|
|
12841
12882
|
}
|
|
12842
12883
|
});
|
|
12884
|
+
cleanupDetachedIframeObservers();
|
|
12843
12885
|
}
|
|
12844
12886
|
wrappedEmit({
|
|
12845
12887
|
type: EventType.IncrementalSnapshot,
|
|
@@ -13127,7 +13169,12 @@ function record(options = {}) {
|
|
|
13127
13169
|
};
|
|
13128
13170
|
const loadListener = (iframeEl) => {
|
|
13129
13171
|
try {
|
|
13130
|
-
|
|
13172
|
+
const iframeId = mirror.getId(iframeEl);
|
|
13173
|
+
const cleanup = observe(iframeEl.contentDocument);
|
|
13174
|
+
handlers.push(cleanup);
|
|
13175
|
+
if (iframeId !== -1) {
|
|
13176
|
+
iframeObserverCleanups.set(iframeId, cleanup);
|
|
13177
|
+
}
|
|
13131
13178
|
} catch (error) {
|
|
13132
13179
|
console.warn(error);
|
|
13133
13180
|
}
|
|
@@ -13169,6 +13216,7 @@ function record(options = {}) {
|
|
|
13169
13216
|
processedNodeManager.destroy();
|
|
13170
13217
|
iframeManager.removeLoadListener();
|
|
13171
13218
|
iframeManager.destroy();
|
|
13219
|
+
iframeObserverCleanups.clear();
|
|
13172
13220
|
mirror.reset();
|
|
13173
13221
|
recording = false;
|
|
13174
13222
|
unregisterErrorHandler();
|