@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
|
@@ -10337,6 +10337,11 @@ class MutationBuffer {
|
|
|
10337
10337
|
this.shadowDomManager.reset();
|
|
10338
10338
|
this.canvasManager.reset();
|
|
10339
10339
|
}
|
|
10340
|
+
destroy() {
|
|
10341
|
+
while (this.mapRemoves.length) {
|
|
10342
|
+
this.mirror.removeNodeFromMap(this.mapRemoves.shift());
|
|
10343
|
+
}
|
|
10344
|
+
}
|
|
10340
10345
|
}
|
|
10341
10346
|
function deepDelete(addsSet, n2) {
|
|
10342
10347
|
addsSet.delete(n2);
|
|
@@ -11381,6 +11386,7 @@ function initObservers(o2, hooks = {}) {
|
|
|
11381
11386
|
);
|
|
11382
11387
|
}
|
|
11383
11388
|
return callbackWrapper(() => {
|
|
11389
|
+
mutationBuffers.forEach((b) => b.destroy());
|
|
11384
11390
|
mutationBuffers.forEach((b) => b.reset());
|
|
11385
11391
|
mutationObserver == null ? void 0 : mutationObserver.disconnect();
|
|
11386
11392
|
mousemoveHandler();
|
|
@@ -11718,6 +11724,8 @@ class IframeManager {
|
|
|
11718
11724
|
contentWindow.removeEventListener("message", handler);
|
|
11719
11725
|
});
|
|
11720
11726
|
this.nestedIframeListeners.clear();
|
|
11727
|
+
this.crossOriginIframeMirror.reset();
|
|
11728
|
+
this.crossOriginIframeStyleMirror.reset();
|
|
11721
11729
|
}
|
|
11722
11730
|
}
|
|
11723
11731
|
class ShadowDomManager {
|
|
@@ -11864,9 +11872,9 @@ const saveWebGLVar = (value, win, ctx) => {
|
|
|
11864
11872
|
}
|
|
11865
11873
|
return index2;
|
|
11866
11874
|
};
|
|
11867
|
-
function serializeArg(value, win, ctx) {
|
|
11875
|
+
function serializeArg(value, win, ctx, dataURLOptions) {
|
|
11868
11876
|
if (value instanceof Array) {
|
|
11869
|
-
return value.map((arg) => serializeArg(arg, win, ctx));
|
|
11877
|
+
return value.map((arg) => serializeArg(arg, win, ctx, dataURLOptions));
|
|
11870
11878
|
} else if (value === null) {
|
|
11871
11879
|
return value;
|
|
11872
11880
|
} 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) {
|
|
@@ -11892,7 +11900,7 @@ function serializeArg(value, win, ctx) {
|
|
|
11892
11900
|
return {
|
|
11893
11901
|
rr_type: name,
|
|
11894
11902
|
args: [
|
|
11895
|
-
serializeArg(value.buffer, win, ctx),
|
|
11903
|
+
serializeArg(value.buffer, win, ctx, dataURLOptions),
|
|
11896
11904
|
value.byteOffset,
|
|
11897
11905
|
value.byteLength
|
|
11898
11906
|
]
|
|
@@ -11906,7 +11914,7 @@ function serializeArg(value, win, ctx) {
|
|
|
11906
11914
|
};
|
|
11907
11915
|
} else if (value instanceof HTMLCanvasElement) {
|
|
11908
11916
|
const name = "HTMLImageElement";
|
|
11909
|
-
const src = value.toDataURL();
|
|
11917
|
+
const src = value.toDataURL(dataURLOptions.type, dataURLOptions.quality);
|
|
11910
11918
|
return {
|
|
11911
11919
|
rr_type: name,
|
|
11912
11920
|
src
|
|
@@ -11915,7 +11923,11 @@ function serializeArg(value, win, ctx) {
|
|
|
11915
11923
|
const name = value.constructor.name;
|
|
11916
11924
|
return {
|
|
11917
11925
|
rr_type: name,
|
|
11918
|
-
args: [
|
|
11926
|
+
args: [
|
|
11927
|
+
serializeArg(value.data, win, ctx, dataURLOptions),
|
|
11928
|
+
value.width,
|
|
11929
|
+
value.height
|
|
11930
|
+
]
|
|
11919
11931
|
};
|
|
11920
11932
|
} else if (isInstanceOfWebGLObject(value, win) || typeof value === "object") {
|
|
11921
11933
|
const name = value.constructor.name;
|
|
@@ -11927,8 +11939,8 @@ function serializeArg(value, win, ctx) {
|
|
|
11927
11939
|
}
|
|
11928
11940
|
return value;
|
|
11929
11941
|
}
|
|
11930
|
-
const serializeArgs = (args, win, ctx) => {
|
|
11931
|
-
return args.map((arg) => serializeArg(arg, win, ctx));
|
|
11942
|
+
const serializeArgs = (args, win, ctx, dataURLOptions) => {
|
|
11943
|
+
return args.map((arg) => serializeArg(arg, win, ctx, dataURLOptions));
|
|
11932
11944
|
};
|
|
11933
11945
|
const isInstanceOfWebGLObject = (value, win) => {
|
|
11934
11946
|
const webGLConstructorNames = [
|
|
@@ -11954,7 +11966,7 @@ const isInstanceOfWebGLObject = (value, win) => {
|
|
|
11954
11966
|
)
|
|
11955
11967
|
);
|
|
11956
11968
|
};
|
|
11957
|
-
function initCanvas2DMutationObserver(cb, win, blockClass, blockSelector) {
|
|
11969
|
+
function initCanvas2DMutationObserver(cb, win, blockClass, blockSelector, dataURLOptions) {
|
|
11958
11970
|
const handlers = [];
|
|
11959
11971
|
const props2D = Object.getOwnPropertyNames(
|
|
11960
11972
|
win.CanvasRenderingContext2D.prototype
|
|
@@ -11971,7 +11983,12 @@ function initCanvas2DMutationObserver(cb, win, blockClass, blockSelector) {
|
|
|
11971
11983
|
return function(...args) {
|
|
11972
11984
|
if (!isBlocked(this.canvas, blockClass, blockSelector, true)) {
|
|
11973
11985
|
setTimeout(() => {
|
|
11974
|
-
const recordArgs = serializeArgs(
|
|
11986
|
+
const recordArgs = serializeArgs(
|
|
11987
|
+
args,
|
|
11988
|
+
win,
|
|
11989
|
+
this,
|
|
11990
|
+
dataURLOptions
|
|
11991
|
+
);
|
|
11975
11992
|
cb(this.canvas, {
|
|
11976
11993
|
type: CanvasContext["2D"],
|
|
11977
11994
|
property: prop,
|
|
@@ -12045,7 +12062,7 @@ function initCanvasContextObserver(win, blockClass, blockSelector, setPreserveDr
|
|
|
12045
12062
|
handlers.forEach((h) => h());
|
|
12046
12063
|
};
|
|
12047
12064
|
}
|
|
12048
|
-
function patchGLPrototype(prototype, type, cb, blockClass, blockSelector, win) {
|
|
12065
|
+
function patchGLPrototype(prototype, type, cb, blockClass, blockSelector, win, dataURLOptions) {
|
|
12049
12066
|
const handlers = [];
|
|
12050
12067
|
const props = Object.getOwnPropertyNames(prototype);
|
|
12051
12068
|
for (const prop of props) {
|
|
@@ -12072,7 +12089,7 @@ function patchGLPrototype(prototype, type, cb, blockClass, blockSelector, win) {
|
|
|
12072
12089
|
const result2 = original.apply(this, args);
|
|
12073
12090
|
saveWebGLVar(result2, win, this);
|
|
12074
12091
|
if ("tagName" in this.canvas && !isBlocked(this.canvas, blockClass, blockSelector, true)) {
|
|
12075
|
-
const recordArgs = serializeArgs(args, win, this);
|
|
12092
|
+
const recordArgs = serializeArgs(args, win, this, dataURLOptions);
|
|
12076
12093
|
const mutation = {
|
|
12077
12094
|
type,
|
|
12078
12095
|
property: prop,
|
|
@@ -12101,7 +12118,7 @@ function patchGLPrototype(prototype, type, cb, blockClass, blockSelector, win) {
|
|
|
12101
12118
|
}
|
|
12102
12119
|
return handlers;
|
|
12103
12120
|
}
|
|
12104
|
-
function initCanvasWebGLMutationObserver(cb, win, blockClass, blockSelector) {
|
|
12121
|
+
function initCanvasWebGLMutationObserver(cb, win, blockClass, blockSelector, dataURLOptions) {
|
|
12105
12122
|
const handlers = [];
|
|
12106
12123
|
handlers.push(
|
|
12107
12124
|
...patchGLPrototype(
|
|
@@ -12110,7 +12127,8 @@ function initCanvasWebGLMutationObserver(cb, win, blockClass, blockSelector) {
|
|
|
12110
12127
|
cb,
|
|
12111
12128
|
blockClass,
|
|
12112
12129
|
blockSelector,
|
|
12113
|
-
win
|
|
12130
|
+
win,
|
|
12131
|
+
dataURLOptions
|
|
12114
12132
|
)
|
|
12115
12133
|
);
|
|
12116
12134
|
if (typeof win.WebGL2RenderingContext !== "undefined") {
|
|
@@ -12121,7 +12139,8 @@ function initCanvasWebGLMutationObserver(cb, win, blockClass, blockSelector) {
|
|
|
12121
12139
|
cb,
|
|
12122
12140
|
blockClass,
|
|
12123
12141
|
blockSelector,
|
|
12124
|
-
win
|
|
12142
|
+
win,
|
|
12143
|
+
dataURLOptions
|
|
12125
12144
|
)
|
|
12126
12145
|
);
|
|
12127
12146
|
}
|
|
@@ -12163,6 +12182,8 @@ class CanvasManager {
|
|
|
12163
12182
|
__publicField(this, "resetObservers");
|
|
12164
12183
|
__publicField(this, "frozen", false);
|
|
12165
12184
|
__publicField(this, "locked", false);
|
|
12185
|
+
__publicField(this, "rafIdTimestamp", null);
|
|
12186
|
+
__publicField(this, "rafIdFlush", null);
|
|
12166
12187
|
__publicField(this, "processMutation", (target, mutation) => {
|
|
12167
12188
|
const newFrame = this.rafStamps.invokeId && this.rafStamps.latestId !== this.rafStamps.invokeId;
|
|
12168
12189
|
if (newFrame || !this.rafStamps.invokeId)
|
|
@@ -12183,7 +12204,12 @@ class CanvasManager {
|
|
|
12183
12204
|
this.mutationCb = options.mutationCb;
|
|
12184
12205
|
this.mirror = options.mirror;
|
|
12185
12206
|
if (recordCanvas && sampling === "all")
|
|
12186
|
-
this.initCanvasMutationObserver(
|
|
12207
|
+
this.initCanvasMutationObserver(
|
|
12208
|
+
win,
|
|
12209
|
+
blockClass,
|
|
12210
|
+
blockSelector,
|
|
12211
|
+
dataURLOptions
|
|
12212
|
+
);
|
|
12187
12213
|
if (recordCanvas && typeof sampling === "number")
|
|
12188
12214
|
this.initCanvasFPSObserver(sampling, win, blockClass, blockSelector, {
|
|
12189
12215
|
dataURLOptions
|
|
@@ -12192,6 +12218,14 @@ class CanvasManager {
|
|
|
12192
12218
|
reset() {
|
|
12193
12219
|
this.pendingCanvasMutations.clear();
|
|
12194
12220
|
this.resetObservers && this.resetObservers();
|
|
12221
|
+
if (this.rafIdTimestamp !== null) {
|
|
12222
|
+
cancelAnimationFrame(this.rafIdTimestamp);
|
|
12223
|
+
this.rafIdTimestamp = null;
|
|
12224
|
+
}
|
|
12225
|
+
if (this.rafIdFlush !== null) {
|
|
12226
|
+
cancelAnimationFrame(this.rafIdFlush);
|
|
12227
|
+
this.rafIdFlush = null;
|
|
12228
|
+
}
|
|
12195
12229
|
}
|
|
12196
12230
|
freeze() {
|
|
12197
12231
|
this.frozen = true;
|
|
@@ -12312,7 +12346,7 @@ class CanvasManager {
|
|
|
12312
12346
|
cancelAnimationFrame(rafId);
|
|
12313
12347
|
};
|
|
12314
12348
|
}
|
|
12315
|
-
initCanvasMutationObserver(win, blockClass, blockSelector) {
|
|
12349
|
+
initCanvasMutationObserver(win, blockClass, blockSelector, dataURLOptions) {
|
|
12316
12350
|
this.startRAFTimestamping();
|
|
12317
12351
|
this.startPendingCanvasMutationFlusher();
|
|
12318
12352
|
const canvasContextReset = initCanvasContextObserver(
|
|
@@ -12325,13 +12359,15 @@ class CanvasManager {
|
|
|
12325
12359
|
this.processMutation.bind(this),
|
|
12326
12360
|
win,
|
|
12327
12361
|
blockClass,
|
|
12328
|
-
blockSelector
|
|
12362
|
+
blockSelector,
|
|
12363
|
+
dataURLOptions
|
|
12329
12364
|
);
|
|
12330
12365
|
const canvasWebGL1and2Reset = initCanvasWebGLMutationObserver(
|
|
12331
12366
|
this.processMutation.bind(this),
|
|
12332
12367
|
win,
|
|
12333
12368
|
blockClass,
|
|
12334
|
-
blockSelector
|
|
12369
|
+
blockSelector,
|
|
12370
|
+
dataURLOptions
|
|
12335
12371
|
);
|
|
12336
12372
|
this.resetObservers = () => {
|
|
12337
12373
|
canvasContextReset();
|
|
@@ -12340,14 +12376,16 @@ class CanvasManager {
|
|
|
12340
12376
|
};
|
|
12341
12377
|
}
|
|
12342
12378
|
startPendingCanvasMutationFlusher() {
|
|
12343
|
-
|
|
12379
|
+
this.rafIdFlush = requestAnimationFrame(
|
|
12380
|
+
() => this.flushPendingCanvasMutations()
|
|
12381
|
+
);
|
|
12344
12382
|
}
|
|
12345
12383
|
startRAFTimestamping() {
|
|
12346
12384
|
const setLatestRAFTimestamp = (timestamp) => {
|
|
12347
12385
|
this.rafStamps.latestId = timestamp;
|
|
12348
|
-
requestAnimationFrame(setLatestRAFTimestamp);
|
|
12386
|
+
this.rafIdTimestamp = requestAnimationFrame(setLatestRAFTimestamp);
|
|
12349
12387
|
};
|
|
12350
|
-
requestAnimationFrame(setLatestRAFTimestamp);
|
|
12388
|
+
this.rafIdTimestamp = requestAnimationFrame(setLatestRAFTimestamp);
|
|
12351
12389
|
}
|
|
12352
12390
|
flushPendingCanvasMutations() {
|
|
12353
12391
|
this.pendingCanvasMutations.forEach(
|
|
@@ -12356,7 +12394,9 @@ class CanvasManager {
|
|
|
12356
12394
|
this.flushPendingCanvasMutationFor(canvas, id);
|
|
12357
12395
|
}
|
|
12358
12396
|
);
|
|
12359
|
-
|
|
12397
|
+
this.rafIdFlush = requestAnimationFrame(
|
|
12398
|
+
() => this.flushPendingCanvasMutations()
|
|
12399
|
+
);
|
|
12360
12400
|
}
|
|
12361
12401
|
flushPendingCanvasMutationFor(canvas, id) {
|
|
12362
12402
|
if (this.frozen || this.locked) {
|
|
@@ -12922,6 +12962,7 @@ function record(options = {}) {
|
|
|
12922
12962
|
processedNodeManager.destroy();
|
|
12923
12963
|
iframeManager.removeLoadListener();
|
|
12924
12964
|
iframeManager.destroy();
|
|
12965
|
+
mirror.reset();
|
|
12925
12966
|
recording = false;
|
|
12926
12967
|
unregisterErrorHandler();
|
|
12927
12968
|
};
|