@posthog/rrweb-record 0.0.27 → 0.0.29
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 +63 -22
- package/dist/rrweb-record.cjs.map +1 -1
- package/dist/rrweb-record.js +63 -22
- package/dist/rrweb-record.js.map +1 -1
- package/dist/rrweb-record.umd.cjs +63 -22
- package/dist/rrweb-record.umd.cjs.map +2 -2
- package/dist/rrweb-record.umd.min.cjs +31 -31
- package/dist/rrweb-record.umd.min.cjs.map +2 -2
- package/package.json +1 -1
package/dist/rrweb-record.js
CHANGED
|
@@ -10291,6 +10291,11 @@ class MutationBuffer {
|
|
|
10291
10291
|
this.shadowDomManager.reset();
|
|
10292
10292
|
this.canvasManager.reset();
|
|
10293
10293
|
}
|
|
10294
|
+
destroy() {
|
|
10295
|
+
while (this.mapRemoves.length) {
|
|
10296
|
+
this.mirror.removeNodeFromMap(this.mapRemoves.shift());
|
|
10297
|
+
}
|
|
10298
|
+
}
|
|
10294
10299
|
}
|
|
10295
10300
|
function deepDelete(addsSet, n2) {
|
|
10296
10301
|
addsSet.delete(n2);
|
|
@@ -11337,6 +11342,7 @@ function initObservers(o2, hooks = {}) {
|
|
|
11337
11342
|
);
|
|
11338
11343
|
}
|
|
11339
11344
|
return callbackWrapper(() => {
|
|
11345
|
+
mutationBuffers.forEach((b) => b.destroy());
|
|
11340
11346
|
mutationBuffers.forEach((b) => b.reset());
|
|
11341
11347
|
mutationObserver == null ? void 0 : mutationObserver.disconnect();
|
|
11342
11348
|
mousemoveHandler();
|
|
@@ -11674,6 +11680,8 @@ class IframeManager {
|
|
|
11674
11680
|
contentWindow.removeEventListener("message", handler);
|
|
11675
11681
|
});
|
|
11676
11682
|
this.nestedIframeListeners.clear();
|
|
11683
|
+
this.crossOriginIframeMirror.reset();
|
|
11684
|
+
this.crossOriginIframeStyleMirror.reset();
|
|
11677
11685
|
}
|
|
11678
11686
|
}
|
|
11679
11687
|
class ShadowDomManager {
|
|
@@ -11822,9 +11830,9 @@ const saveWebGLVar = (value, win, ctx) => {
|
|
|
11822
11830
|
}
|
|
11823
11831
|
return index2;
|
|
11824
11832
|
};
|
|
11825
|
-
function serializeArg(value, win, ctx) {
|
|
11833
|
+
function serializeArg(value, win, ctx, dataURLOptions) {
|
|
11826
11834
|
if (value instanceof Array) {
|
|
11827
|
-
return value.map((arg) => serializeArg(arg, win, ctx));
|
|
11835
|
+
return value.map((arg) => serializeArg(arg, win, ctx, dataURLOptions));
|
|
11828
11836
|
} else if (value === null) {
|
|
11829
11837
|
return value;
|
|
11830
11838
|
} else if (value instanceof Float32Array || value instanceof Float64Array || value instanceof Int32Array || value instanceof Uint32Array || value instanceof Uint8Array || value instanceof Uint16Array || value instanceof Int16Array || value instanceof Int8Array || value instanceof Uint8ClampedArray) {
|
|
@@ -11850,7 +11858,7 @@ function serializeArg(value, win, ctx) {
|
|
|
11850
11858
|
return {
|
|
11851
11859
|
rr_type: name,
|
|
11852
11860
|
args: [
|
|
11853
|
-
serializeArg(value.buffer, win, ctx),
|
|
11861
|
+
serializeArg(value.buffer, win, ctx, dataURLOptions),
|
|
11854
11862
|
value.byteOffset,
|
|
11855
11863
|
value.byteLength
|
|
11856
11864
|
]
|
|
@@ -11864,7 +11872,7 @@ function serializeArg(value, win, ctx) {
|
|
|
11864
11872
|
};
|
|
11865
11873
|
} else if (value instanceof HTMLCanvasElement) {
|
|
11866
11874
|
const name = "HTMLImageElement";
|
|
11867
|
-
const src = value.toDataURL();
|
|
11875
|
+
const src = value.toDataURL(dataURLOptions.type, dataURLOptions.quality);
|
|
11868
11876
|
return {
|
|
11869
11877
|
rr_type: name,
|
|
11870
11878
|
src
|
|
@@ -11873,7 +11881,11 @@ function serializeArg(value, win, ctx) {
|
|
|
11873
11881
|
const name = value.constructor.name;
|
|
11874
11882
|
return {
|
|
11875
11883
|
rr_type: name,
|
|
11876
|
-
args: [
|
|
11884
|
+
args: [
|
|
11885
|
+
serializeArg(value.data, win, ctx, dataURLOptions),
|
|
11886
|
+
value.width,
|
|
11887
|
+
value.height
|
|
11888
|
+
]
|
|
11877
11889
|
};
|
|
11878
11890
|
} else if (isInstanceOfWebGLObject(value, win) || typeof value === "object") {
|
|
11879
11891
|
const name = value.constructor.name;
|
|
@@ -11885,8 +11897,8 @@ function serializeArg(value, win, ctx) {
|
|
|
11885
11897
|
}
|
|
11886
11898
|
return value;
|
|
11887
11899
|
}
|
|
11888
|
-
const serializeArgs = (args, win, ctx) => {
|
|
11889
|
-
return args.map((arg) => serializeArg(arg, win, ctx));
|
|
11900
|
+
const serializeArgs = (args, win, ctx, dataURLOptions) => {
|
|
11901
|
+
return args.map((arg) => serializeArg(arg, win, ctx, dataURLOptions));
|
|
11890
11902
|
};
|
|
11891
11903
|
const isInstanceOfWebGLObject = (value, win) => {
|
|
11892
11904
|
const webGLConstructorNames = [
|
|
@@ -11912,7 +11924,7 @@ const isInstanceOfWebGLObject = (value, win) => {
|
|
|
11912
11924
|
)
|
|
11913
11925
|
);
|
|
11914
11926
|
};
|
|
11915
|
-
function initCanvas2DMutationObserver(cb, win, blockClass, blockSelector) {
|
|
11927
|
+
function initCanvas2DMutationObserver(cb, win, blockClass, blockSelector, dataURLOptions) {
|
|
11916
11928
|
const handlers = [];
|
|
11917
11929
|
const props2D = Object.getOwnPropertyNames(
|
|
11918
11930
|
win.CanvasRenderingContext2D.prototype
|
|
@@ -11929,7 +11941,12 @@ function initCanvas2DMutationObserver(cb, win, blockClass, blockSelector) {
|
|
|
11929
11941
|
return function(...args) {
|
|
11930
11942
|
if (!isBlocked(this.canvas, blockClass, blockSelector, true)) {
|
|
11931
11943
|
setTimeout(() => {
|
|
11932
|
-
const recordArgs = serializeArgs(
|
|
11944
|
+
const recordArgs = serializeArgs(
|
|
11945
|
+
args,
|
|
11946
|
+
win,
|
|
11947
|
+
this,
|
|
11948
|
+
dataURLOptions
|
|
11949
|
+
);
|
|
11933
11950
|
cb(this.canvas, {
|
|
11934
11951
|
type: CanvasContext["2D"],
|
|
11935
11952
|
property: prop,
|
|
@@ -12003,7 +12020,7 @@ function initCanvasContextObserver(win, blockClass, blockSelector, setPreserveDr
|
|
|
12003
12020
|
handlers.forEach((h) => h());
|
|
12004
12021
|
};
|
|
12005
12022
|
}
|
|
12006
|
-
function patchGLPrototype(prototype, type, cb, blockClass, blockSelector, win) {
|
|
12023
|
+
function patchGLPrototype(prototype, type, cb, blockClass, blockSelector, win, dataURLOptions) {
|
|
12007
12024
|
const handlers = [];
|
|
12008
12025
|
const props = Object.getOwnPropertyNames(prototype);
|
|
12009
12026
|
for (const prop of props) {
|
|
@@ -12030,7 +12047,7 @@ function patchGLPrototype(prototype, type, cb, blockClass, blockSelector, win) {
|
|
|
12030
12047
|
const result2 = original.apply(this, args);
|
|
12031
12048
|
saveWebGLVar(result2, win, this);
|
|
12032
12049
|
if ("tagName" in this.canvas && !isBlocked(this.canvas, blockClass, blockSelector, true)) {
|
|
12033
|
-
const recordArgs = serializeArgs(args, win, this);
|
|
12050
|
+
const recordArgs = serializeArgs(args, win, this, dataURLOptions);
|
|
12034
12051
|
const mutation = {
|
|
12035
12052
|
type,
|
|
12036
12053
|
property: prop,
|
|
@@ -12059,7 +12076,7 @@ function patchGLPrototype(prototype, type, cb, blockClass, blockSelector, win) {
|
|
|
12059
12076
|
}
|
|
12060
12077
|
return handlers;
|
|
12061
12078
|
}
|
|
12062
|
-
function initCanvasWebGLMutationObserver(cb, win, blockClass, blockSelector) {
|
|
12079
|
+
function initCanvasWebGLMutationObserver(cb, win, blockClass, blockSelector, dataURLOptions) {
|
|
12063
12080
|
const handlers = [];
|
|
12064
12081
|
handlers.push(
|
|
12065
12082
|
...patchGLPrototype(
|
|
@@ -12068,7 +12085,8 @@ function initCanvasWebGLMutationObserver(cb, win, blockClass, blockSelector) {
|
|
|
12068
12085
|
cb,
|
|
12069
12086
|
blockClass,
|
|
12070
12087
|
blockSelector,
|
|
12071
|
-
win
|
|
12088
|
+
win,
|
|
12089
|
+
dataURLOptions
|
|
12072
12090
|
)
|
|
12073
12091
|
);
|
|
12074
12092
|
if (typeof win.WebGL2RenderingContext !== "undefined") {
|
|
@@ -12079,7 +12097,8 @@ function initCanvasWebGLMutationObserver(cb, win, blockClass, blockSelector) {
|
|
|
12079
12097
|
cb,
|
|
12080
12098
|
blockClass,
|
|
12081
12099
|
blockSelector,
|
|
12082
|
-
win
|
|
12100
|
+
win,
|
|
12101
|
+
dataURLOptions
|
|
12083
12102
|
)
|
|
12084
12103
|
);
|
|
12085
12104
|
}
|
|
@@ -12121,6 +12140,8 @@ class CanvasManager {
|
|
|
12121
12140
|
__publicField(this, "resetObservers");
|
|
12122
12141
|
__publicField(this, "frozen", false);
|
|
12123
12142
|
__publicField(this, "locked", false);
|
|
12143
|
+
__publicField(this, "rafIdTimestamp", null);
|
|
12144
|
+
__publicField(this, "rafIdFlush", null);
|
|
12124
12145
|
__publicField(this, "processMutation", (target, mutation) => {
|
|
12125
12146
|
const newFrame = this.rafStamps.invokeId && this.rafStamps.latestId !== this.rafStamps.invokeId;
|
|
12126
12147
|
if (newFrame || !this.rafStamps.invokeId)
|
|
@@ -12141,7 +12162,12 @@ class CanvasManager {
|
|
|
12141
12162
|
this.mutationCb = options.mutationCb;
|
|
12142
12163
|
this.mirror = options.mirror;
|
|
12143
12164
|
if (recordCanvas && sampling === "all")
|
|
12144
|
-
this.initCanvasMutationObserver(
|
|
12165
|
+
this.initCanvasMutationObserver(
|
|
12166
|
+
win,
|
|
12167
|
+
blockClass,
|
|
12168
|
+
blockSelector,
|
|
12169
|
+
dataURLOptions
|
|
12170
|
+
);
|
|
12145
12171
|
if (recordCanvas && typeof sampling === "number")
|
|
12146
12172
|
this.initCanvasFPSObserver(sampling, win, blockClass, blockSelector, {
|
|
12147
12173
|
dataURLOptions
|
|
@@ -12150,6 +12176,14 @@ class CanvasManager {
|
|
|
12150
12176
|
reset() {
|
|
12151
12177
|
this.pendingCanvasMutations.clear();
|
|
12152
12178
|
this.resetObservers && this.resetObservers();
|
|
12179
|
+
if (this.rafIdTimestamp !== null) {
|
|
12180
|
+
cancelAnimationFrame(this.rafIdTimestamp);
|
|
12181
|
+
this.rafIdTimestamp = null;
|
|
12182
|
+
}
|
|
12183
|
+
if (this.rafIdFlush !== null) {
|
|
12184
|
+
cancelAnimationFrame(this.rafIdFlush);
|
|
12185
|
+
this.rafIdFlush = null;
|
|
12186
|
+
}
|
|
12153
12187
|
}
|
|
12154
12188
|
freeze() {
|
|
12155
12189
|
this.frozen = true;
|
|
@@ -12270,7 +12304,7 @@ class CanvasManager {
|
|
|
12270
12304
|
cancelAnimationFrame(rafId);
|
|
12271
12305
|
};
|
|
12272
12306
|
}
|
|
12273
|
-
initCanvasMutationObserver(win, blockClass, blockSelector) {
|
|
12307
|
+
initCanvasMutationObserver(win, blockClass, blockSelector, dataURLOptions) {
|
|
12274
12308
|
this.startRAFTimestamping();
|
|
12275
12309
|
this.startPendingCanvasMutationFlusher();
|
|
12276
12310
|
const canvasContextReset = initCanvasContextObserver(
|
|
@@ -12283,13 +12317,15 @@ class CanvasManager {
|
|
|
12283
12317
|
this.processMutation.bind(this),
|
|
12284
12318
|
win,
|
|
12285
12319
|
blockClass,
|
|
12286
|
-
blockSelector
|
|
12320
|
+
blockSelector,
|
|
12321
|
+
dataURLOptions
|
|
12287
12322
|
);
|
|
12288
12323
|
const canvasWebGL1and2Reset = initCanvasWebGLMutationObserver(
|
|
12289
12324
|
this.processMutation.bind(this),
|
|
12290
12325
|
win,
|
|
12291
12326
|
blockClass,
|
|
12292
|
-
blockSelector
|
|
12327
|
+
blockSelector,
|
|
12328
|
+
dataURLOptions
|
|
12293
12329
|
);
|
|
12294
12330
|
this.resetObservers = () => {
|
|
12295
12331
|
canvasContextReset();
|
|
@@ -12298,14 +12334,16 @@ class CanvasManager {
|
|
|
12298
12334
|
};
|
|
12299
12335
|
}
|
|
12300
12336
|
startPendingCanvasMutationFlusher() {
|
|
12301
|
-
|
|
12337
|
+
this.rafIdFlush = requestAnimationFrame(
|
|
12338
|
+
() => this.flushPendingCanvasMutations()
|
|
12339
|
+
);
|
|
12302
12340
|
}
|
|
12303
12341
|
startRAFTimestamping() {
|
|
12304
12342
|
const setLatestRAFTimestamp = (timestamp) => {
|
|
12305
12343
|
this.rafStamps.latestId = timestamp;
|
|
12306
|
-
requestAnimationFrame(setLatestRAFTimestamp);
|
|
12344
|
+
this.rafIdTimestamp = requestAnimationFrame(setLatestRAFTimestamp);
|
|
12307
12345
|
};
|
|
12308
|
-
requestAnimationFrame(setLatestRAFTimestamp);
|
|
12346
|
+
this.rafIdTimestamp = requestAnimationFrame(setLatestRAFTimestamp);
|
|
12309
12347
|
}
|
|
12310
12348
|
flushPendingCanvasMutations() {
|
|
12311
12349
|
this.pendingCanvasMutations.forEach(
|
|
@@ -12314,7 +12352,9 @@ class CanvasManager {
|
|
|
12314
12352
|
this.flushPendingCanvasMutationFor(canvas, id);
|
|
12315
12353
|
}
|
|
12316
12354
|
);
|
|
12317
|
-
|
|
12355
|
+
this.rafIdFlush = requestAnimationFrame(
|
|
12356
|
+
() => this.flushPendingCanvasMutations()
|
|
12357
|
+
);
|
|
12318
12358
|
}
|
|
12319
12359
|
flushPendingCanvasMutationFor(canvas, id) {
|
|
12320
12360
|
if (this.frozen || this.locked) {
|
|
@@ -12893,6 +12933,7 @@ function record(options = {}) {
|
|
|
12893
12933
|
processedNodeManager.destroy();
|
|
12894
12934
|
iframeManager.removeLoadListener();
|
|
12895
12935
|
iframeManager.destroy();
|
|
12936
|
+
mirror.reset();
|
|
12896
12937
|
recording = false;
|
|
12897
12938
|
unregisterErrorHandler();
|
|
12898
12939
|
};
|