@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.cjs
CHANGED
|
@@ -1148,6 +1148,16 @@ function slimDOMExcluded(sn, slimDOMOptions) {
|
|
|
1148
1148
|
}
|
|
1149
1149
|
return false;
|
|
1150
1150
|
}
|
|
1151
|
+
const DEFAULT_MAX_DEPTH = 50;
|
|
1152
|
+
let _maxDepthWarned = false;
|
|
1153
|
+
let _maxDepthReached = false;
|
|
1154
|
+
function wasMaxDepthReached() {
|
|
1155
|
+
return _maxDepthReached;
|
|
1156
|
+
}
|
|
1157
|
+
function resetMaxDepthState() {
|
|
1158
|
+
_maxDepthReached = false;
|
|
1159
|
+
_maxDepthWarned = false;
|
|
1160
|
+
}
|
|
1151
1161
|
function serializeNodeWithId(n2, options) {
|
|
1152
1162
|
const {
|
|
1153
1163
|
doc,
|
|
@@ -1171,10 +1181,22 @@ function serializeNodeWithId(n2, options) {
|
|
|
1171
1181
|
onStylesheetLoad,
|
|
1172
1182
|
stylesheetLoadTimeout = 5e3,
|
|
1173
1183
|
keepIframeSrcFn = () => false,
|
|
1174
|
-
newlyAddedElement = false
|
|
1184
|
+
newlyAddedElement = false,
|
|
1185
|
+
depth = 0,
|
|
1186
|
+
maxDepth = DEFAULT_MAX_DEPTH
|
|
1175
1187
|
} = options;
|
|
1176
1188
|
let { needsMask } = options;
|
|
1177
1189
|
let { preserveWhiteSpace = true } = options;
|
|
1190
|
+
if (depth >= maxDepth) {
|
|
1191
|
+
_maxDepthReached = true;
|
|
1192
|
+
if (!_maxDepthWarned) {
|
|
1193
|
+
_maxDepthWarned = true;
|
|
1194
|
+
console.warn(
|
|
1195
|
+
`[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.`
|
|
1196
|
+
);
|
|
1197
|
+
}
|
|
1198
|
+
return null;
|
|
1199
|
+
}
|
|
1178
1200
|
if (!needsMask) {
|
|
1179
1201
|
const checkAncestors = needsMask === void 0;
|
|
1180
1202
|
needsMask = needMaskingText(
|
|
@@ -1255,7 +1277,9 @@ function serializeNodeWithId(n2, options) {
|
|
|
1255
1277
|
iframeLoadTimeout,
|
|
1256
1278
|
onStylesheetLoad,
|
|
1257
1279
|
stylesheetLoadTimeout,
|
|
1258
|
-
keepIframeSrcFn
|
|
1280
|
+
keepIframeSrcFn,
|
|
1281
|
+
depth: depth + 1,
|
|
1282
|
+
maxDepth
|
|
1259
1283
|
};
|
|
1260
1284
|
if (serializedNode.type === NodeType$1$1.Element && serializedNode.tagName === "textarea" && serializedNode.attributes.value !== void 0) ;
|
|
1261
1285
|
else {
|
|
@@ -1310,7 +1334,9 @@ function serializeNodeWithId(n2, options) {
|
|
|
1310
1334
|
iframeLoadTimeout,
|
|
1311
1335
|
onStylesheetLoad,
|
|
1312
1336
|
stylesheetLoadTimeout,
|
|
1313
|
-
keepIframeSrcFn
|
|
1337
|
+
keepIframeSrcFn,
|
|
1338
|
+
depth: depth + 1,
|
|
1339
|
+
maxDepth
|
|
1314
1340
|
});
|
|
1315
1341
|
if (serializedIframeNode) {
|
|
1316
1342
|
onIframeLoad(
|
|
@@ -1351,7 +1377,9 @@ function serializeNodeWithId(n2, options) {
|
|
|
1351
1377
|
iframeLoadTimeout,
|
|
1352
1378
|
onStylesheetLoad,
|
|
1353
1379
|
stylesheetLoadTimeout,
|
|
1354
|
-
keepIframeSrcFn
|
|
1380
|
+
keepIframeSrcFn,
|
|
1381
|
+
depth,
|
|
1382
|
+
maxDepth
|
|
1355
1383
|
});
|
|
1356
1384
|
if (serializedLinkNode) {
|
|
1357
1385
|
onStylesheetLoad(
|
|
@@ -1387,7 +1415,8 @@ function snapshot(n2, options) {
|
|
|
1387
1415
|
iframeLoadTimeout,
|
|
1388
1416
|
onStylesheetLoad,
|
|
1389
1417
|
stylesheetLoadTimeout,
|
|
1390
|
-
keepIframeSrcFn = () => false
|
|
1418
|
+
keepIframeSrcFn = () => false,
|
|
1419
|
+
maxDepth
|
|
1391
1420
|
} = options || {};
|
|
1392
1421
|
const maskInputOptions = maskAllInputs === true ? {
|
|
1393
1422
|
color: true,
|
|
@@ -1448,7 +1477,8 @@ function snapshot(n2, options) {
|
|
|
1448
1477
|
onStylesheetLoad,
|
|
1449
1478
|
stylesheetLoadTimeout,
|
|
1450
1479
|
keepIframeSrcFn,
|
|
1451
|
-
newlyAddedElement: false
|
|
1480
|
+
newlyAddedElement: false,
|
|
1481
|
+
maxDepth
|
|
1452
1482
|
});
|
|
1453
1483
|
}
|
|
1454
1484
|
const MEDIA_SELECTOR = /(max|min)-device-(width|height)/;
|
|
@@ -18181,6 +18211,8 @@ exports.addCustomEvent = addCustomEvent;
|
|
|
18181
18211
|
exports.canvasMutation = canvasMutation;
|
|
18182
18212
|
exports.freezePage = freezePage;
|
|
18183
18213
|
exports.record = record;
|
|
18214
|
+
exports.resetMaxDepthState = resetMaxDepthState;
|
|
18184
18215
|
exports.takeFullSnapshot = takeFullSnapshot;
|
|
18185
18216
|
exports.utils = utils;
|
|
18217
|
+
exports.wasMaxDepthReached = wasMaxDepthReached;
|
|
18186
18218
|
//# sourceMappingURL=rrweb.cjs.map
|