@posthog/rrweb 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.cjs +63 -22
- package/dist/rrweb.cjs.map +1 -1
- package/dist/rrweb.js +63 -22
- package/dist/rrweb.js.map +1 -1
- package/dist/rrweb.umd.cjs +63 -22
- package/dist/rrweb.umd.cjs.map +2 -2
- package/dist/rrweb.umd.min.cjs +37 -37
- package/dist/rrweb.umd.min.cjs.map +2 -2
- package/package.json +1 -1
package/dist/rrweb.cjs
CHANGED
|
@@ -12168,6 +12168,11 @@ class MutationBuffer {
|
|
|
12168
12168
|
this.shadowDomManager.reset();
|
|
12169
12169
|
this.canvasManager.reset();
|
|
12170
12170
|
}
|
|
12171
|
+
destroy() {
|
|
12172
|
+
while (this.mapRemoves.length) {
|
|
12173
|
+
this.mirror.removeNodeFromMap(this.mapRemoves.shift());
|
|
12174
|
+
}
|
|
12175
|
+
}
|
|
12171
12176
|
}
|
|
12172
12177
|
function deepDelete(addsSet, n2) {
|
|
12173
12178
|
addsSet.delete(n2);
|
|
@@ -13214,6 +13219,7 @@ function initObservers(o2, hooks = {}) {
|
|
|
13214
13219
|
);
|
|
13215
13220
|
}
|
|
13216
13221
|
return callbackWrapper(() => {
|
|
13222
|
+
mutationBuffers.forEach((b) => b.destroy());
|
|
13217
13223
|
mutationBuffers.forEach((b) => b.reset());
|
|
13218
13224
|
mutationObserver == null ? void 0 : mutationObserver.disconnect();
|
|
13219
13225
|
mousemoveHandler();
|
|
@@ -13552,6 +13558,8 @@ class IframeManager {
|
|
|
13552
13558
|
contentWindow.removeEventListener("message", handler);
|
|
13553
13559
|
});
|
|
13554
13560
|
this.nestedIframeListeners.clear();
|
|
13561
|
+
this.crossOriginIframeMirror.reset();
|
|
13562
|
+
this.crossOriginIframeStyleMirror.reset();
|
|
13555
13563
|
}
|
|
13556
13564
|
}
|
|
13557
13565
|
class ShadowDomManager {
|
|
@@ -13720,9 +13728,9 @@ const saveWebGLVar = (value, win, ctx) => {
|
|
|
13720
13728
|
}
|
|
13721
13729
|
return index2;
|
|
13722
13730
|
};
|
|
13723
|
-
function serializeArg(value, win, ctx) {
|
|
13731
|
+
function serializeArg(value, win, ctx, dataURLOptions) {
|
|
13724
13732
|
if (value instanceof Array) {
|
|
13725
|
-
return value.map((arg) => serializeArg(arg, win, ctx));
|
|
13733
|
+
return value.map((arg) => serializeArg(arg, win, ctx, dataURLOptions));
|
|
13726
13734
|
} else if (value === null) {
|
|
13727
13735
|
return value;
|
|
13728
13736
|
} 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) {
|
|
@@ -13748,7 +13756,7 @@ function serializeArg(value, win, ctx) {
|
|
|
13748
13756
|
return {
|
|
13749
13757
|
rr_type: name,
|
|
13750
13758
|
args: [
|
|
13751
|
-
serializeArg(value.buffer, win, ctx),
|
|
13759
|
+
serializeArg(value.buffer, win, ctx, dataURLOptions),
|
|
13752
13760
|
value.byteOffset,
|
|
13753
13761
|
value.byteLength
|
|
13754
13762
|
]
|
|
@@ -13762,7 +13770,7 @@ function serializeArg(value, win, ctx) {
|
|
|
13762
13770
|
};
|
|
13763
13771
|
} else if (value instanceof HTMLCanvasElement) {
|
|
13764
13772
|
const name = "HTMLImageElement";
|
|
13765
|
-
const src = value.toDataURL();
|
|
13773
|
+
const src = value.toDataURL(dataURLOptions.type, dataURLOptions.quality);
|
|
13766
13774
|
return {
|
|
13767
13775
|
rr_type: name,
|
|
13768
13776
|
src
|
|
@@ -13771,7 +13779,11 @@ function serializeArg(value, win, ctx) {
|
|
|
13771
13779
|
const name = value.constructor.name;
|
|
13772
13780
|
return {
|
|
13773
13781
|
rr_type: name,
|
|
13774
|
-
args: [
|
|
13782
|
+
args: [
|
|
13783
|
+
serializeArg(value.data, win, ctx, dataURLOptions),
|
|
13784
|
+
value.width,
|
|
13785
|
+
value.height
|
|
13786
|
+
]
|
|
13775
13787
|
};
|
|
13776
13788
|
} else if (isInstanceOfWebGLObject(value, win) || typeof value === "object") {
|
|
13777
13789
|
const name = value.constructor.name;
|
|
@@ -13783,8 +13795,8 @@ function serializeArg(value, win, ctx) {
|
|
|
13783
13795
|
}
|
|
13784
13796
|
return value;
|
|
13785
13797
|
}
|
|
13786
|
-
const serializeArgs = (args, win, ctx) => {
|
|
13787
|
-
return args.map((arg) => serializeArg(arg, win, ctx));
|
|
13798
|
+
const serializeArgs = (args, win, ctx, dataURLOptions) => {
|
|
13799
|
+
return args.map((arg) => serializeArg(arg, win, ctx, dataURLOptions));
|
|
13788
13800
|
};
|
|
13789
13801
|
const isInstanceOfWebGLObject = (value, win) => {
|
|
13790
13802
|
const webGLConstructorNames = [
|
|
@@ -13810,7 +13822,7 @@ const isInstanceOfWebGLObject = (value, win) => {
|
|
|
13810
13822
|
)
|
|
13811
13823
|
);
|
|
13812
13824
|
};
|
|
13813
|
-
function initCanvas2DMutationObserver(cb, win, blockClass, blockSelector) {
|
|
13825
|
+
function initCanvas2DMutationObserver(cb, win, blockClass, blockSelector, dataURLOptions) {
|
|
13814
13826
|
const handlers = [];
|
|
13815
13827
|
const props2D = Object.getOwnPropertyNames(
|
|
13816
13828
|
win.CanvasRenderingContext2D.prototype
|
|
@@ -13827,7 +13839,12 @@ function initCanvas2DMutationObserver(cb, win, blockClass, blockSelector) {
|
|
|
13827
13839
|
return function(...args) {
|
|
13828
13840
|
if (!isBlocked(this.canvas, blockClass, blockSelector, true)) {
|
|
13829
13841
|
setTimeout(() => {
|
|
13830
|
-
const recordArgs = serializeArgs(
|
|
13842
|
+
const recordArgs = serializeArgs(
|
|
13843
|
+
args,
|
|
13844
|
+
win,
|
|
13845
|
+
this,
|
|
13846
|
+
dataURLOptions
|
|
13847
|
+
);
|
|
13831
13848
|
cb(this.canvas, {
|
|
13832
13849
|
type: CanvasContext["2D"],
|
|
13833
13850
|
property: prop,
|
|
@@ -13901,7 +13918,7 @@ function initCanvasContextObserver(win, blockClass, blockSelector, setPreserveDr
|
|
|
13901
13918
|
handlers.forEach((h) => h());
|
|
13902
13919
|
};
|
|
13903
13920
|
}
|
|
13904
|
-
function patchGLPrototype(prototype, type, cb, blockClass, blockSelector, win) {
|
|
13921
|
+
function patchGLPrototype(prototype, type, cb, blockClass, blockSelector, win, dataURLOptions) {
|
|
13905
13922
|
const handlers = [];
|
|
13906
13923
|
const props = Object.getOwnPropertyNames(prototype);
|
|
13907
13924
|
for (const prop of props) {
|
|
@@ -13928,7 +13945,7 @@ function patchGLPrototype(prototype, type, cb, blockClass, blockSelector, win) {
|
|
|
13928
13945
|
const result2 = original.apply(this, args);
|
|
13929
13946
|
saveWebGLVar(result2, win, this);
|
|
13930
13947
|
if ("tagName" in this.canvas && !isBlocked(this.canvas, blockClass, blockSelector, true)) {
|
|
13931
|
-
const recordArgs = serializeArgs(args, win, this);
|
|
13948
|
+
const recordArgs = serializeArgs(args, win, this, dataURLOptions);
|
|
13932
13949
|
const mutation = {
|
|
13933
13950
|
type,
|
|
13934
13951
|
property: prop,
|
|
@@ -13957,7 +13974,7 @@ function patchGLPrototype(prototype, type, cb, blockClass, blockSelector, win) {
|
|
|
13957
13974
|
}
|
|
13958
13975
|
return handlers;
|
|
13959
13976
|
}
|
|
13960
|
-
function initCanvasWebGLMutationObserver(cb, win, blockClass, blockSelector) {
|
|
13977
|
+
function initCanvasWebGLMutationObserver(cb, win, blockClass, blockSelector, dataURLOptions) {
|
|
13961
13978
|
const handlers = [];
|
|
13962
13979
|
handlers.push(
|
|
13963
13980
|
...patchGLPrototype(
|
|
@@ -13966,7 +13983,8 @@ function initCanvasWebGLMutationObserver(cb, win, blockClass, blockSelector) {
|
|
|
13966
13983
|
cb,
|
|
13967
13984
|
blockClass,
|
|
13968
13985
|
blockSelector,
|
|
13969
|
-
win
|
|
13986
|
+
win,
|
|
13987
|
+
dataURLOptions
|
|
13970
13988
|
)
|
|
13971
13989
|
);
|
|
13972
13990
|
if (typeof win.WebGL2RenderingContext !== "undefined") {
|
|
@@ -13977,7 +13995,8 @@ function initCanvasWebGLMutationObserver(cb, win, blockClass, blockSelector) {
|
|
|
13977
13995
|
cb,
|
|
13978
13996
|
blockClass,
|
|
13979
13997
|
blockSelector,
|
|
13980
|
-
win
|
|
13998
|
+
win,
|
|
13999
|
+
dataURLOptions
|
|
13981
14000
|
)
|
|
13982
14001
|
);
|
|
13983
14002
|
}
|
|
@@ -14019,6 +14038,8 @@ class CanvasManager {
|
|
|
14019
14038
|
__publicField(this, "resetObservers");
|
|
14020
14039
|
__publicField(this, "frozen", false);
|
|
14021
14040
|
__publicField(this, "locked", false);
|
|
14041
|
+
__publicField(this, "rafIdTimestamp", null);
|
|
14042
|
+
__publicField(this, "rafIdFlush", null);
|
|
14022
14043
|
__publicField(this, "processMutation", (target, mutation) => {
|
|
14023
14044
|
const newFrame = this.rafStamps.invokeId && this.rafStamps.latestId !== this.rafStamps.invokeId;
|
|
14024
14045
|
if (newFrame || !this.rafStamps.invokeId)
|
|
@@ -14039,7 +14060,12 @@ class CanvasManager {
|
|
|
14039
14060
|
this.mutationCb = options.mutationCb;
|
|
14040
14061
|
this.mirror = options.mirror;
|
|
14041
14062
|
if (recordCanvas && sampling === "all")
|
|
14042
|
-
this.initCanvasMutationObserver(
|
|
14063
|
+
this.initCanvasMutationObserver(
|
|
14064
|
+
win,
|
|
14065
|
+
blockClass,
|
|
14066
|
+
blockSelector,
|
|
14067
|
+
dataURLOptions
|
|
14068
|
+
);
|
|
14043
14069
|
if (recordCanvas && typeof sampling === "number")
|
|
14044
14070
|
this.initCanvasFPSObserver(sampling, win, blockClass, blockSelector, {
|
|
14045
14071
|
dataURLOptions
|
|
@@ -14048,6 +14074,14 @@ class CanvasManager {
|
|
|
14048
14074
|
reset() {
|
|
14049
14075
|
this.pendingCanvasMutations.clear();
|
|
14050
14076
|
this.resetObservers && this.resetObservers();
|
|
14077
|
+
if (this.rafIdTimestamp !== null) {
|
|
14078
|
+
cancelAnimationFrame(this.rafIdTimestamp);
|
|
14079
|
+
this.rafIdTimestamp = null;
|
|
14080
|
+
}
|
|
14081
|
+
if (this.rafIdFlush !== null) {
|
|
14082
|
+
cancelAnimationFrame(this.rafIdFlush);
|
|
14083
|
+
this.rafIdFlush = null;
|
|
14084
|
+
}
|
|
14051
14085
|
}
|
|
14052
14086
|
freeze() {
|
|
14053
14087
|
this.frozen = true;
|
|
@@ -14168,7 +14202,7 @@ class CanvasManager {
|
|
|
14168
14202
|
cancelAnimationFrame(rafId);
|
|
14169
14203
|
};
|
|
14170
14204
|
}
|
|
14171
|
-
initCanvasMutationObserver(win, blockClass, blockSelector) {
|
|
14205
|
+
initCanvasMutationObserver(win, blockClass, blockSelector, dataURLOptions) {
|
|
14172
14206
|
this.startRAFTimestamping();
|
|
14173
14207
|
this.startPendingCanvasMutationFlusher();
|
|
14174
14208
|
const canvasContextReset = initCanvasContextObserver(
|
|
@@ -14181,13 +14215,15 @@ class CanvasManager {
|
|
|
14181
14215
|
this.processMutation.bind(this),
|
|
14182
14216
|
win,
|
|
14183
14217
|
blockClass,
|
|
14184
|
-
blockSelector
|
|
14218
|
+
blockSelector,
|
|
14219
|
+
dataURLOptions
|
|
14185
14220
|
);
|
|
14186
14221
|
const canvasWebGL1and2Reset = initCanvasWebGLMutationObserver(
|
|
14187
14222
|
this.processMutation.bind(this),
|
|
14188
14223
|
win,
|
|
14189
14224
|
blockClass,
|
|
14190
|
-
blockSelector
|
|
14225
|
+
blockSelector,
|
|
14226
|
+
dataURLOptions
|
|
14191
14227
|
);
|
|
14192
14228
|
this.resetObservers = () => {
|
|
14193
14229
|
canvasContextReset();
|
|
@@ -14196,14 +14232,16 @@ class CanvasManager {
|
|
|
14196
14232
|
};
|
|
14197
14233
|
}
|
|
14198
14234
|
startPendingCanvasMutationFlusher() {
|
|
14199
|
-
|
|
14235
|
+
this.rafIdFlush = requestAnimationFrame(
|
|
14236
|
+
() => this.flushPendingCanvasMutations()
|
|
14237
|
+
);
|
|
14200
14238
|
}
|
|
14201
14239
|
startRAFTimestamping() {
|
|
14202
14240
|
const setLatestRAFTimestamp = (timestamp) => {
|
|
14203
14241
|
this.rafStamps.latestId = timestamp;
|
|
14204
|
-
requestAnimationFrame(setLatestRAFTimestamp);
|
|
14242
|
+
this.rafIdTimestamp = requestAnimationFrame(setLatestRAFTimestamp);
|
|
14205
14243
|
};
|
|
14206
|
-
requestAnimationFrame(setLatestRAFTimestamp);
|
|
14244
|
+
this.rafIdTimestamp = requestAnimationFrame(setLatestRAFTimestamp);
|
|
14207
14245
|
}
|
|
14208
14246
|
flushPendingCanvasMutations() {
|
|
14209
14247
|
this.pendingCanvasMutations.forEach(
|
|
@@ -14212,7 +14250,9 @@ class CanvasManager {
|
|
|
14212
14250
|
this.flushPendingCanvasMutationFor(canvas, id);
|
|
14213
14251
|
}
|
|
14214
14252
|
);
|
|
14215
|
-
|
|
14253
|
+
this.rafIdFlush = requestAnimationFrame(
|
|
14254
|
+
() => this.flushPendingCanvasMutations()
|
|
14255
|
+
);
|
|
14216
14256
|
}
|
|
14217
14257
|
flushPendingCanvasMutationFor(canvas, id) {
|
|
14218
14258
|
if (this.frozen || this.locked) {
|
|
@@ -14791,6 +14831,7 @@ function record(options = {}) {
|
|
|
14791
14831
|
processedNodeManager.destroy();
|
|
14792
14832
|
iframeManager.removeLoadListener();
|
|
14793
14833
|
iframeManager.destroy();
|
|
14834
|
+
mirror.reset();
|
|
14794
14835
|
recording = false;
|
|
14795
14836
|
unregisterErrorHandler();
|
|
14796
14837
|
};
|