@posthog/rrweb 0.0.46 → 0.0.47
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.cjs +56 -8
- package/dist/rrweb.cjs.map +1 -1
- package/dist/rrweb.js +56 -8
- package/dist/rrweb.js.map +1 -1
- package/dist/rrweb.umd.cjs +56 -8
- package/dist/rrweb.umd.cjs.map +2 -2
- package/dist/rrweb.umd.min.cjs +25 -25
- package/dist/rrweb.umd.min.cjs.map +3 -3
- package/package.json +5 -5
package/dist/rrweb.umd.cjs
CHANGED
|
@@ -12627,7 +12627,7 @@ function initMutationObserver(options, rootEl) {
|
|
|
12627
12627
|
childList: true,
|
|
12628
12628
|
subtree: true
|
|
12629
12629
|
});
|
|
12630
|
-
return observer;
|
|
12630
|
+
return { observer, buffer: mutationBuffer };
|
|
12631
12631
|
}
|
|
12632
12632
|
function initMoveObserver({
|
|
12633
12633
|
mousemoveCb,
|
|
@@ -13546,8 +13546,11 @@ function initObservers(o2, hooks = {}) {
|
|
|
13546
13546
|
}
|
|
13547
13547
|
mergeHooks(o2, hooks);
|
|
13548
13548
|
let mutationObserver;
|
|
13549
|
+
let mutationBuffer;
|
|
13549
13550
|
if (o2.recordDOM) {
|
|
13550
|
-
|
|
13551
|
+
const result2 = initMutationObserver(o2, o2.doc);
|
|
13552
|
+
mutationObserver = result2.observer;
|
|
13553
|
+
mutationBuffer = result2.buffer;
|
|
13551
13554
|
}
|
|
13552
13555
|
const mousemoveHandler = initMoveObserver(o2);
|
|
13553
13556
|
const mouseInteractionHandler = initMouseInteractionObserver(o2);
|
|
@@ -13584,8 +13587,14 @@ function initObservers(o2, hooks = {}) {
|
|
|
13584
13587
|
);
|
|
13585
13588
|
}
|
|
13586
13589
|
return callbackWrapper(() => {
|
|
13587
|
-
|
|
13588
|
-
|
|
13590
|
+
if (mutationBuffer) {
|
|
13591
|
+
mutationBuffer.destroy();
|
|
13592
|
+
mutationBuffer.reset();
|
|
13593
|
+
const index2 = mutationBuffers.indexOf(mutationBuffer);
|
|
13594
|
+
if (index2 !== -1) {
|
|
13595
|
+
mutationBuffers.splice(index2, 1);
|
|
13596
|
+
}
|
|
13597
|
+
}
|
|
13589
13598
|
mutationObserver == null ? void 0 : mutationObserver.disconnect();
|
|
13590
13599
|
mousemoveHandler();
|
|
13591
13600
|
mouseInteractionHandler();
|
|
@@ -13600,7 +13609,6 @@ function initObservers(o2, hooks = {}) {
|
|
|
13600
13609
|
selectionObserver();
|
|
13601
13610
|
customElementObserver();
|
|
13602
13611
|
pluginHandlers.forEach((h) => h());
|
|
13603
|
-
mutationBuffers.length = 0;
|
|
13604
13612
|
});
|
|
13605
13613
|
}
|
|
13606
13614
|
function hasNestedCSSRule(prop) {
|
|
@@ -14000,7 +14008,7 @@ class ShadowDomManager {
|
|
|
14000
14008
|
if (!isNativeShadowDom(shadowRoot2)) return;
|
|
14001
14009
|
if (this.shadowDoms.has(shadowRoot2)) return;
|
|
14002
14010
|
this.shadowDoms.add(shadowRoot2);
|
|
14003
|
-
const observer = initMutationObserver(
|
|
14011
|
+
const { observer, buffer } = initMutationObserver(
|
|
14004
14012
|
__spreadProps(__spreadValues({}, this.bypassOptions), {
|
|
14005
14013
|
doc,
|
|
14006
14014
|
mutationCb: this.mutationCb,
|
|
@@ -14009,7 +14017,15 @@ class ShadowDomManager {
|
|
|
14009
14017
|
}),
|
|
14010
14018
|
shadowRoot2
|
|
14011
14019
|
);
|
|
14012
|
-
this.restoreHandlers.push(() =>
|
|
14020
|
+
this.restoreHandlers.push(() => {
|
|
14021
|
+
observer.disconnect();
|
|
14022
|
+
buffer.destroy();
|
|
14023
|
+
buffer.reset();
|
|
14024
|
+
const index2 = mutationBuffers.indexOf(buffer);
|
|
14025
|
+
if (index2 !== -1) {
|
|
14026
|
+
mutationBuffers.splice(index2, 1);
|
|
14027
|
+
}
|
|
14028
|
+
});
|
|
14013
14029
|
this.restoreHandlers.push(
|
|
14014
14030
|
initScrollObserver(__spreadProps(__spreadValues({}, this.bypassOptions), {
|
|
14015
14031
|
scrollCb: this.scrollCb,
|
|
@@ -14884,6 +14900,26 @@ function record(options = {}) {
|
|
|
14884
14900
|
polyfill$1();
|
|
14885
14901
|
let lastFullSnapshotEvent;
|
|
14886
14902
|
let incrementalSnapshotCount = 0;
|
|
14903
|
+
const iframeObserverCleanups = /* @__PURE__ */ new Map();
|
|
14904
|
+
function cleanupDetachedIframeObservers() {
|
|
14905
|
+
for (const [iframeId, cleanup] of iframeObserverCleanups) {
|
|
14906
|
+
const iframe = mirror.getNode(iframeId);
|
|
14907
|
+
if (!iframe) {
|
|
14908
|
+
cleanup();
|
|
14909
|
+
iframeObserverCleanups.delete(iframeId);
|
|
14910
|
+
continue;
|
|
14911
|
+
}
|
|
14912
|
+
try {
|
|
14913
|
+
if (!iframe.contentDocument || !iframe.contentDocument.defaultView) {
|
|
14914
|
+
cleanup();
|
|
14915
|
+
iframeObserverCleanups.delete(iframeId);
|
|
14916
|
+
}
|
|
14917
|
+
} catch (e2) {
|
|
14918
|
+
cleanup();
|
|
14919
|
+
iframeObserverCleanups.delete(iframeId);
|
|
14920
|
+
}
|
|
14921
|
+
}
|
|
14922
|
+
}
|
|
14887
14923
|
const eventProcessor = (e2) => {
|
|
14888
14924
|
for (const plugin of plugins || []) {
|
|
14889
14925
|
if (plugin.eventProcessor) {
|
|
@@ -14934,9 +14970,15 @@ function record(options = {}) {
|
|
|
14934
14970
|
const addedIds = m.adds.length > 0 ? new Set(m.adds.map((add) => add.node.id)) : null;
|
|
14935
14971
|
m.removes.forEach(({ id }) => {
|
|
14936
14972
|
if (!addedIds || !addedIds.has(id)) {
|
|
14973
|
+
const cleanup = iframeObserverCleanups.get(id);
|
|
14974
|
+
if (cleanup) {
|
|
14975
|
+
cleanup();
|
|
14976
|
+
iframeObserverCleanups.delete(id);
|
|
14977
|
+
}
|
|
14937
14978
|
iframeManager.removeIframeById(id);
|
|
14938
14979
|
}
|
|
14939
14980
|
});
|
|
14981
|
+
cleanupDetachedIframeObservers();
|
|
14940
14982
|
}
|
|
14941
14983
|
wrappedEmit({
|
|
14942
14984
|
type: EventType.IncrementalSnapshot,
|
|
@@ -15211,7 +15253,12 @@ function record(options = {}) {
|
|
|
15211
15253
|
};
|
|
15212
15254
|
const loadListener = (iframeEl) => {
|
|
15213
15255
|
try {
|
|
15214
|
-
|
|
15256
|
+
const iframeId = mirror.getId(iframeEl);
|
|
15257
|
+
const cleanup = observe(iframeEl.contentDocument);
|
|
15258
|
+
handlers.push(cleanup);
|
|
15259
|
+
if (iframeId !== -1) {
|
|
15260
|
+
iframeObserverCleanups.set(iframeId, cleanup);
|
|
15261
|
+
}
|
|
15215
15262
|
} catch (error) {
|
|
15216
15263
|
console.warn(error);
|
|
15217
15264
|
}
|
|
@@ -15253,6 +15300,7 @@ function record(options = {}) {
|
|
|
15253
15300
|
processedNodeManager.destroy();
|
|
15254
15301
|
iframeManager.removeLoadListener();
|
|
15255
15302
|
iframeManager.destroy();
|
|
15303
|
+
iframeObserverCleanups.clear();
|
|
15256
15304
|
mirror.reset();
|
|
15257
15305
|
recording = false;
|
|
15258
15306
|
unregisterErrorHandler();
|