@posthog/rrweb 0.0.40 → 0.0.42
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 +38 -6
- package/dist/rrweb.cjs.map +1 -1
- package/dist/rrweb.d.cts +6 -0
- package/dist/rrweb.d.ts +6 -0
- package/dist/rrweb.js +39 -7
- package/dist/rrweb.js.map +1 -1
- package/dist/rrweb.umd.cjs +38 -6
- package/dist/rrweb.umd.cjs.map +4 -4
- package/dist/rrweb.umd.min.cjs +19 -19
- package/dist/rrweb.umd.min.cjs.map +4 -4
- package/package.json +5 -5
package/dist/rrweb.umd.cjs
CHANGED
|
@@ -1181,6 +1181,16 @@ function slimDOMExcluded(sn, slimDOMOptions) {
|
|
|
1181
1181
|
}
|
|
1182
1182
|
return false;
|
|
1183
1183
|
}
|
|
1184
|
+
const DEFAULT_MAX_DEPTH = 50;
|
|
1185
|
+
let _maxDepthWarned = false;
|
|
1186
|
+
let _maxDepthReached = false;
|
|
1187
|
+
function wasMaxDepthReached() {
|
|
1188
|
+
return _maxDepthReached;
|
|
1189
|
+
}
|
|
1190
|
+
function resetMaxDepthState() {
|
|
1191
|
+
_maxDepthReached = false;
|
|
1192
|
+
_maxDepthWarned = false;
|
|
1193
|
+
}
|
|
1184
1194
|
function serializeNodeWithId(n2, options) {
|
|
1185
1195
|
const {
|
|
1186
1196
|
doc,
|
|
@@ -1204,10 +1214,22 @@ function serializeNodeWithId(n2, options) {
|
|
|
1204
1214
|
onStylesheetLoad,
|
|
1205
1215
|
stylesheetLoadTimeout = 5e3,
|
|
1206
1216
|
keepIframeSrcFn = () => false,
|
|
1207
|
-
newlyAddedElement = false
|
|
1217
|
+
newlyAddedElement = false,
|
|
1218
|
+
depth = 0,
|
|
1219
|
+
maxDepth = DEFAULT_MAX_DEPTH
|
|
1208
1220
|
} = options;
|
|
1209
1221
|
let { needsMask } = options;
|
|
1210
1222
|
let { preserveWhiteSpace = true } = options;
|
|
1223
|
+
if (depth >= maxDepth) {
|
|
1224
|
+
_maxDepthReached = true;
|
|
1225
|
+
if (!_maxDepthWarned) {
|
|
1226
|
+
_maxDepthWarned = true;
|
|
1227
|
+
console.warn(
|
|
1228
|
+
`[rrweb-snapshot] DOM tree depth exceeded max depth of ${maxDepth}. Children beyond this depth will not be recorded. This may indicate deeply nested DOM structures.`
|
|
1229
|
+
);
|
|
1230
|
+
}
|
|
1231
|
+
return null;
|
|
1232
|
+
}
|
|
1211
1233
|
if (!needsMask) {
|
|
1212
1234
|
const checkAncestors = needsMask === void 0;
|
|
1213
1235
|
needsMask = needMaskingText(
|
|
@@ -1288,7 +1310,9 @@ function serializeNodeWithId(n2, options) {
|
|
|
1288
1310
|
iframeLoadTimeout,
|
|
1289
1311
|
onStylesheetLoad,
|
|
1290
1312
|
stylesheetLoadTimeout,
|
|
1291
|
-
keepIframeSrcFn
|
|
1313
|
+
keepIframeSrcFn,
|
|
1314
|
+
depth: depth + 1,
|
|
1315
|
+
maxDepth
|
|
1292
1316
|
};
|
|
1293
1317
|
if (serializedNode.type === NodeType$1$1.Element && serializedNode.tagName === "textarea" && serializedNode.attributes.value !== void 0) ;
|
|
1294
1318
|
else {
|
|
@@ -1343,7 +1367,9 @@ function serializeNodeWithId(n2, options) {
|
|
|
1343
1367
|
iframeLoadTimeout,
|
|
1344
1368
|
onStylesheetLoad,
|
|
1345
1369
|
stylesheetLoadTimeout,
|
|
1346
|
-
keepIframeSrcFn
|
|
1370
|
+
keepIframeSrcFn,
|
|
1371
|
+
depth: depth + 1,
|
|
1372
|
+
maxDepth
|
|
1347
1373
|
});
|
|
1348
1374
|
if (serializedIframeNode) {
|
|
1349
1375
|
onIframeLoad(
|
|
@@ -1384,7 +1410,9 @@ function serializeNodeWithId(n2, options) {
|
|
|
1384
1410
|
iframeLoadTimeout,
|
|
1385
1411
|
onStylesheetLoad,
|
|
1386
1412
|
stylesheetLoadTimeout,
|
|
1387
|
-
keepIframeSrcFn
|
|
1413
|
+
keepIframeSrcFn,
|
|
1414
|
+
depth,
|
|
1415
|
+
maxDepth
|
|
1388
1416
|
});
|
|
1389
1417
|
if (serializedLinkNode) {
|
|
1390
1418
|
onStylesheetLoad(
|
|
@@ -1420,7 +1448,8 @@ function snapshot(n2, options) {
|
|
|
1420
1448
|
iframeLoadTimeout,
|
|
1421
1449
|
onStylesheetLoad,
|
|
1422
1450
|
stylesheetLoadTimeout,
|
|
1423
|
-
keepIframeSrcFn = () => false
|
|
1451
|
+
keepIframeSrcFn = () => false,
|
|
1452
|
+
maxDepth
|
|
1424
1453
|
} = options || {};
|
|
1425
1454
|
const maskInputOptions = maskAllInputs === true ? {
|
|
1426
1455
|
color: true,
|
|
@@ -1481,7 +1510,8 @@ function snapshot(n2, options) {
|
|
|
1481
1510
|
onStylesheetLoad,
|
|
1482
1511
|
stylesheetLoadTimeout,
|
|
1483
1512
|
keepIframeSrcFn,
|
|
1484
|
-
newlyAddedElement: false
|
|
1513
|
+
newlyAddedElement: false,
|
|
1514
|
+
maxDepth
|
|
1485
1515
|
});
|
|
1486
1516
|
}
|
|
1487
1517
|
const MEDIA_SELECTOR = /(max|min)-device-(width|height)/;
|
|
@@ -18160,8 +18190,10 @@ exports.addCustomEvent = addCustomEvent;
|
|
|
18160
18190
|
exports.canvasMutation = canvasMutation;
|
|
18161
18191
|
exports.freezePage = freezePage;
|
|
18162
18192
|
exports.record = record;
|
|
18193
|
+
exports.resetMaxDepthState = resetMaxDepthState;
|
|
18163
18194
|
exports.takeFullSnapshot = takeFullSnapshot;
|
|
18164
18195
|
exports.utils = utils;
|
|
18196
|
+
exports.wasMaxDepthReached = wasMaxDepthReached;
|
|
18165
18197
|
;if (typeof module.exports == "object" && typeof exports == "object") {
|
|
18166
18198
|
var __cp = (to, from, except, desc) => {
|
|
18167
18199
|
if ((from && typeof from === "object") || typeof from === "function") {
|