@cloudcare/browser-rum 3.2.51 → 3.3.1
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/README.md +89 -1
- package/README.zh.md +105 -0
- package/bundle/dataflux-rum.js +1 -1
- package/cjs/boot/buildEnv.js +1 -1
- package/cjs/boot/perStartRum.js +16 -0
- package/cjs/boot/perStartRum.js.map +1 -1
- package/cjs/boot/recorderApi.js +197 -1
- package/cjs/boot/recorderApi.js.map +1 -1
- package/cjs/boot/rum.js +17 -2
- package/cjs/boot/rum.js.map +1 -1
- package/cjs/boot/rumPublicApi.js +63 -3
- package/cjs/boot/rumPublicApi.js.map +1 -1
- package/cjs/boot/startRecording.js +74 -4
- package/cjs/boot/startRecording.js.map +1 -1
- package/cjs/domain/configuration.js +99 -1
- package/cjs/domain/configuration.js.map +1 -1
- package/cjs/domain/deflate/deflateWorker.js +1 -1
- package/cjs/domain/replay/record/canvasAutoSnapshot.js +15 -0
- package/cjs/domain/replay/record/canvasAutoSnapshot.js.map +1 -0
- package/cjs/domain/replay/record/canvasCommandCapture.js +480 -0
- package/cjs/domain/replay/record/canvasCommandCapture.js.map +1 -0
- package/cjs/domain/replay/record/canvasCommandObserver.js +274 -0
- package/cjs/domain/replay/record/canvasCommandObserver.js.map +1 -0
- package/cjs/domain/replay/record/canvasCommandSerializeArgs.js +94 -0
- package/cjs/domain/replay/record/canvasCommandSerializeArgs.js.map +1 -0
- package/cjs/domain/replay/record/canvasContinuousScheduler.js +255 -0
- package/cjs/domain/replay/record/canvasContinuousScheduler.js.map +1 -0
- package/cjs/domain/replay/record/canvasEncodeBridge.js +247 -0
- package/cjs/domain/replay/record/canvasEncodeBridge.js.map +1 -0
- package/cjs/domain/replay/record/canvasEncodeWorker.js +154 -0
- package/cjs/domain/replay/record/canvasEncodeWorker.js.map +1 -0
- package/cjs/domain/replay/record/canvasFrameSignature.js +50 -0
- package/cjs/domain/replay/record/canvasFrameSignature.js.map +1 -0
- package/cjs/domain/replay/record/canvasMutationRecord.js +33 -0
- package/cjs/domain/replay/record/canvasMutationRecord.js.map +1 -0
- package/cjs/domain/replay/record/canvasObserver.js +190 -0
- package/cjs/domain/replay/record/canvasObserver.js.map +1 -0
- package/cjs/domain/replay/record/canvasReplayFixtures.js +105 -0
- package/cjs/domain/replay/record/canvasReplayFixtures.js.map +1 -0
- package/cjs/domain/replay/record/canvasSerializeArgs.js +110 -0
- package/cjs/domain/replay/record/canvasSerializeArgs.js.map +1 -0
- package/cjs/domain/replay/record/mutationBatch.js +7 -2
- package/cjs/domain/replay/record/mutationBatch.js.map +1 -1
- package/cjs/domain/replay/record/mutationObserver.js +382 -55
- package/cjs/domain/replay/record/mutationObserver.js.map +1 -1
- package/cjs/domain/replay/record/observers.js +8 -3
- package/cjs/domain/replay/record/observers.js.map +1 -1
- package/cjs/domain/replay/record/record.js +517 -1
- package/cjs/domain/replay/record/record.js.map +1 -1
- package/cjs/domain/replay/record/serializationUtils.js +60 -4
- package/cjs/domain/replay/record/serializationUtils.js.map +1 -1
- package/cjs/domain/replay/record/serialize.js +169 -46
- package/cjs/domain/replay/record/serialize.js.map +1 -1
- package/cjs/domain/replay/segmentCollection/segment.js +58 -1
- package/cjs/domain/replay/segmentCollection/segment.js.map +1 -1
- package/cjs/domain/replay/segmentCollection/segmentCollection.js +29 -3
- package/cjs/domain/replay/segmentCollection/segmentCollection.js.map +1 -1
- package/cjs/domain/requestCollection.js +1 -1
- package/cjs/domain/requestCollection.js.map +1 -1
- package/cjs/domain/rumEventsCollection/actions/clickChain.js +1 -1
- package/cjs/domain/rumEventsCollection/actions/clickChain.js.map +1 -1
- package/cjs/domain/rumEventsCollection/actions/interactionSelectorCache.js +2 -1
- package/cjs/domain/rumEventsCollection/actions/interactionSelectorCache.js.map +1 -1
- package/cjs/domain/rumEventsCollection/error/trackReportError.js +2 -2
- package/cjs/domain/rumEventsCollection/error/trackReportError.js.map +1 -1
- package/cjs/domain/rumEventsCollection/resource/matchRequestResourceEntry.js +43 -39
- package/cjs/domain/rumEventsCollection/resource/matchRequestResourceEntry.js.map +1 -1
- package/cjs/domain/rumEventsCollection/resource/resourceCollection.js +48 -8
- package/cjs/domain/rumEventsCollection/resource/resourceCollection.js.map +1 -1
- package/cjs/domain/rumEventsCollection/resource/resourceTrackerManager.js +237 -0
- package/cjs/domain/rumEventsCollection/resource/resourceTrackerManager.js.map +1 -0
- package/cjs/domain/rumEventsCollection/view/trackCumulativeLayoutShift.js.map +1 -1
- package/cjs/domain/rumSessionManager.js +2 -0
- package/cjs/domain/rumSessionManager.js.map +1 -1
- package/cjs/domain/tracing/jaegerTracer.js +6 -6
- package/cjs/domain/tracing/jaegerTracer.js.map +1 -1
- package/cjs/domain/tracing/skywalkingTracer.js +1 -1
- package/cjs/domain/tracing/skywalkingTracer.js.map +1 -1
- package/cjs/domain/tracing/traceIdentifier.js +22 -0
- package/cjs/domain/tracing/traceIdentifier.js.map +1 -1
- package/cjs/domain/tracing/zipkinMultiTracer.js +6 -6
- package/cjs/domain/tracing/zipkinMultiTracer.js.map +1 -1
- package/cjs/domain/tracing/zipkinSingleTracer.js +6 -6
- package/cjs/domain/tracing/zipkinSingleTracer.js.map +1 -1
- package/cjs/types/sessionReplayConstants.js +2 -2
- package/cjs/types/sessionReplayConstants.js.map +1 -1
- package/esm/boot/buildEnv.js +1 -1
- package/esm/boot/perStartRum.js +16 -0
- package/esm/boot/perStartRum.js.map +1 -1
- package/esm/boot/recorderApi.js +197 -1
- package/esm/boot/recorderApi.js.map +1 -1
- package/esm/boot/rum.js +17 -2
- package/esm/boot/rum.js.map +1 -1
- package/esm/boot/rumPublicApi.js +63 -3
- package/esm/boot/rumPublicApi.js.map +1 -1
- package/esm/boot/startRecording.js +75 -5
- package/esm/boot/startRecording.js.map +1 -1
- package/esm/domain/configuration.js +100 -2
- package/esm/domain/configuration.js.map +1 -1
- package/esm/domain/deflate/deflateWorker.js +1 -1
- package/esm/domain/replay/record/canvasAutoSnapshot.js +9 -0
- package/esm/domain/replay/record/canvasAutoSnapshot.js.map +1 -0
- package/esm/domain/replay/record/canvasCommandCapture.js +474 -0
- package/esm/domain/replay/record/canvasCommandCapture.js.map +1 -0
- package/esm/domain/replay/record/canvasCommandObserver.js +268 -0
- package/esm/domain/replay/record/canvasCommandObserver.js.map +1 -0
- package/esm/domain/replay/record/canvasCommandSerializeArgs.js +87 -0
- package/esm/domain/replay/record/canvasCommandSerializeArgs.js.map +1 -0
- package/esm/domain/replay/record/canvasContinuousScheduler.js +249 -0
- package/esm/domain/replay/record/canvasContinuousScheduler.js.map +1 -0
- package/esm/domain/replay/record/canvasEncodeBridge.js +240 -0
- package/esm/domain/replay/record/canvasEncodeBridge.js.map +1 -0
- package/esm/domain/replay/record/canvasEncodeWorker.js +146 -0
- package/esm/domain/replay/record/canvasEncodeWorker.js.map +1 -0
- package/esm/domain/replay/record/canvasFrameSignature.js +42 -0
- package/esm/domain/replay/record/canvasFrameSignature.js.map +1 -0
- package/esm/domain/replay/record/canvasMutationRecord.js +26 -0
- package/esm/domain/replay/record/canvasMutationRecord.js.map +1 -0
- package/esm/domain/replay/record/canvasObserver.js +184 -0
- package/esm/domain/replay/record/canvasObserver.js.map +1 -0
- package/esm/domain/replay/record/canvasReplayFixtures.js +96 -0
- package/esm/domain/replay/record/canvasReplayFixtures.js.map +1 -0
- package/esm/domain/replay/record/canvasSerializeArgs.js +101 -0
- package/esm/domain/replay/record/canvasSerializeArgs.js.map +1 -0
- package/esm/domain/replay/record/mutationBatch.js +7 -2
- package/esm/domain/replay/record/mutationBatch.js.map +1 -1
- package/esm/domain/replay/record/mutationObserver.js +382 -56
- package/esm/domain/replay/record/mutationObserver.js.map +1 -1
- package/esm/domain/replay/record/observers.js +8 -3
- package/esm/domain/replay/record/observers.js.map +1 -1
- package/esm/domain/replay/record/record.js +518 -2
- package/esm/domain/replay/record/record.js.map +1 -1
- package/esm/domain/replay/record/serializationUtils.js +58 -4
- package/esm/domain/replay/record/serializationUtils.js.map +1 -1
- package/esm/domain/replay/record/serialize.js +168 -47
- package/esm/domain/replay/record/serialize.js.map +1 -1
- package/esm/domain/replay/segmentCollection/segment.js +59 -2
- package/esm/domain/replay/segmentCollection/segment.js.map +1 -1
- package/esm/domain/replay/segmentCollection/segmentCollection.js +30 -4
- package/esm/domain/replay/segmentCollection/segmentCollection.js.map +1 -1
- package/esm/domain/requestCollection.js +1 -1
- package/esm/domain/requestCollection.js.map +1 -1
- package/esm/domain/rumEventsCollection/actions/clickChain.js +1 -1
- package/esm/domain/rumEventsCollection/actions/clickChain.js.map +1 -1
- package/esm/domain/rumEventsCollection/actions/interactionSelectorCache.js +2 -1
- package/esm/domain/rumEventsCollection/actions/interactionSelectorCache.js.map +1 -1
- package/esm/domain/rumEventsCollection/error/trackReportError.js +2 -2
- package/esm/domain/rumEventsCollection/error/trackReportError.js.map +1 -1
- package/esm/domain/rumEventsCollection/resource/matchRequestResourceEntry.js +43 -38
- package/esm/domain/rumEventsCollection/resource/matchRequestResourceEntry.js.map +1 -1
- package/esm/domain/rumEventsCollection/resource/resourceCollection.js +50 -10
- package/esm/domain/rumEventsCollection/resource/resourceCollection.js.map +1 -1
- package/esm/domain/rumEventsCollection/resource/resourceTrackerManager.js +231 -0
- package/esm/domain/rumEventsCollection/resource/resourceTrackerManager.js.map +1 -0
- package/esm/domain/rumEventsCollection/view/trackCumulativeLayoutShift.js.map +1 -1
- package/esm/domain/rumSessionManager.js +2 -0
- package/esm/domain/rumSessionManager.js.map +1 -1
- package/esm/domain/tracing/jaegerTracer.js +7 -7
- package/esm/domain/tracing/jaegerTracer.js.map +1 -1
- package/esm/domain/tracing/skywalkingTracer.js +1 -1
- package/esm/domain/tracing/skywalkingTracer.js.map +1 -1
- package/esm/domain/tracing/traceIdentifier.js +20 -0
- package/esm/domain/tracing/traceIdentifier.js.map +1 -1
- package/esm/domain/tracing/zipkinMultiTracer.js +7 -7
- package/esm/domain/tracing/zipkinMultiTracer.js.map +1 -1
- package/esm/domain/tracing/zipkinSingleTracer.js +7 -7
- package/esm/domain/tracing/zipkinSingleTracer.js.map +1 -1
- package/esm/types/sessionReplayConstants.js +2 -2
- package/esm/types/sessionReplayConstants.js.map +1 -1
- package/package.json +5 -5
- package/src/boot/perStartRum.js +16 -0
- package/src/boot/recorderApi.js +208 -1
- package/src/boot/rum.js +21 -2
- package/src/boot/rumPublicApi.js +70 -3
- package/src/boot/startRecording.js +99 -5
- package/src/domain/configuration.js +229 -1
- package/src/domain/replay/record/canvasAutoSnapshot.js +8 -0
- package/src/domain/replay/record/canvasCommandCapture.js +621 -0
- package/src/domain/replay/record/canvasCommandObserver.js +355 -0
- package/src/domain/replay/record/canvasCommandSerializeArgs.js +124 -0
- package/src/domain/replay/record/canvasContinuousScheduler.js +295 -0
- package/src/domain/replay/record/canvasEncodeBridge.js +299 -0
- package/src/domain/replay/record/canvasEncodeWorker.js +211 -0
- package/src/domain/replay/record/canvasFrameSignature.js +83 -0
- package/src/domain/replay/record/canvasMutationRecord.js +29 -0
- package/src/domain/replay/record/canvasObserver.js +279 -0
- package/src/domain/replay/record/canvasReplayFixtures.js +113 -0
- package/src/domain/replay/record/canvasSerializeArgs.js +129 -0
- package/src/domain/replay/record/mutationBatch.js +8 -2
- package/src/domain/replay/record/mutationObserver.js +462 -66
- package/src/domain/replay/record/observers.js +15 -3
- package/src/domain/replay/record/record.js +704 -2
- package/src/domain/replay/record/serializationUtils.js +75 -4
- package/src/domain/replay/record/serialize.js +217 -49
- package/src/domain/replay/segmentCollection/segment.js +65 -2
- package/src/domain/replay/segmentCollection/segmentCollection.js +46 -4
- package/src/domain/requestCollection.js +5 -1
- package/src/domain/rumEventsCollection/actions/clickChain.js +1 -1
- package/src/domain/rumEventsCollection/actions/interactionSelectorCache.js +2 -1
- package/src/domain/rumEventsCollection/error/trackReportError.js +3 -2
- package/src/domain/rumEventsCollection/resource/matchRequestResourceEntry.js +51 -46
- package/src/domain/rumEventsCollection/resource/resourceCollection.js +69 -10
- package/src/domain/rumEventsCollection/resource/resourceTrackerManager.js +264 -0
- package/src/domain/rumEventsCollection/view/trackCumulativeLayoutShift.js +0 -1
- package/src/domain/rumSessionManager.js +2 -0
- package/src/domain/tracing/jaegerTracer.js +16 -9
- package/src/domain/tracing/skywalkingTracer.js +1 -1
- package/src/domain/tracing/traceIdentifier.js +24 -0
- package/src/domain/tracing/zipkinMultiTracer.js +16 -9
- package/src/domain/tracing/zipkinSingleTracer.js +14 -7
- package/src/types/sessionReplayConstants.js +2 -2
- package/types/index.d.ts +148 -1
|
@@ -13,6 +13,20 @@ var _viewports = require("./viewports");
|
|
|
13
13
|
var _utils = require("./utils");
|
|
14
14
|
var _elementsScrollPositions = require("./elementsScrollPositions");
|
|
15
15
|
var _shadowRootsController = require("./shadowRootsController");
|
|
16
|
+
var _canvasObserver = require("./canvasObserver");
|
|
17
|
+
var _canvasCommandObserver = require("./canvasCommandObserver");
|
|
18
|
+
var _serializationUtils = require("./serializationUtils");
|
|
19
|
+
var _canvasContinuousScheduler = require("./canvasContinuousScheduler");
|
|
20
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
21
|
+
var MUTATION_EMIT_DELAY_MS = 16;
|
|
22
|
+
var MAX_MUTATION_EMIT_APPROX_BYTES = 200000;
|
|
23
|
+
var CANVAS_DEBUG_HISTORY_LIMIT = 200;
|
|
24
|
+
function shouldUseCommandCapture(configuration) {
|
|
25
|
+
return configuration.replayCanvasEnabled && configuration.replayCanvasMode === 'auto' && configuration.replayCanvasSampling === 'all';
|
|
26
|
+
}
|
|
27
|
+
function shouldUseContinuousCanvasSnapshot(configuration) {
|
|
28
|
+
return configuration.replayCanvasEnabled && configuration.replayCanvasMode === 'auto' && configuration.replayCanvasSampling !== 'all';
|
|
29
|
+
}
|
|
16
30
|
function record(options) {
|
|
17
31
|
var emit = options.emit;
|
|
18
32
|
// runtime checks for user options
|
|
@@ -20,9 +34,60 @@ function record(options) {
|
|
|
20
34
|
throw new Error('emit function is required');
|
|
21
35
|
}
|
|
22
36
|
var elementsScrollPositions = (0, _elementsScrollPositions.createElementsScrollPositions)();
|
|
37
|
+
var replayPerformanceStats = createReplayPerformanceStats();
|
|
38
|
+
var pendingMutationPayload;
|
|
39
|
+
var pendingMutationTimeout;
|
|
40
|
+
var updateReplayPerformanceStats = function updateReplayPerformanceStats(delta) {
|
|
41
|
+
accumulateReplayPerformanceStats(replayPerformanceStats, delta);
|
|
42
|
+
};
|
|
23
43
|
var mutationCb = function mutationCb(mutation) {
|
|
24
|
-
|
|
44
|
+
if (pendingMutationPayload && shouldFlushPendingMutationPayloadBeforeMerge(pendingMutationPayload, mutation)) {
|
|
45
|
+
flushPendingMutations();
|
|
46
|
+
}
|
|
47
|
+
pendingMutationPayload = mergeMutationPayloads(pendingMutationPayload, mutation);
|
|
48
|
+
scheduleMutationEmit();
|
|
25
49
|
};
|
|
50
|
+
function scheduleMutationEmit() {
|
|
51
|
+
if (pendingMutationTimeout) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
pendingMutationTimeout = setTimeout(function () {
|
|
55
|
+
pendingMutationTimeout = undefined;
|
|
56
|
+
flushPendingMutations();
|
|
57
|
+
}, MUTATION_EMIT_DELAY_MS);
|
|
58
|
+
}
|
|
59
|
+
function flushPendingMutations() {
|
|
60
|
+
if (pendingMutationTimeout) {
|
|
61
|
+
clearTimeout(pendingMutationTimeout);
|
|
62
|
+
pendingMutationTimeout = undefined;
|
|
63
|
+
}
|
|
64
|
+
if (!pendingMutationPayload) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
var mutationPayloads = splitPendingMutationPayloadForEmit(pendingMutationPayload);
|
|
68
|
+
pendingMutationPayload = undefined;
|
|
69
|
+
updateReplayPerformanceStats(mutationPayloads.reduce(function (stats, mutationPayload) {
|
|
70
|
+
stats.mutationCallbackCount += 1;
|
|
71
|
+
stats.mutationRecordCount += countMutationPayloadRecords(mutationPayload);
|
|
72
|
+
stats.mutationAddCount += mutationPayload.adds.length;
|
|
73
|
+
stats.mutationRemoveCount += mutationPayload.removes.length;
|
|
74
|
+
stats.mutationTextCount += mutationPayload.texts.length;
|
|
75
|
+
stats.mutationAttributeCount += mutationPayload.attributes.length;
|
|
76
|
+
return stats;
|
|
77
|
+
}, {
|
|
78
|
+
mutationCallbackCount: 0,
|
|
79
|
+
mutationRecordCount: 0,
|
|
80
|
+
mutationAddCount: 0,
|
|
81
|
+
mutationRemoveCount: 0,
|
|
82
|
+
mutationTextCount: 0,
|
|
83
|
+
mutationAttributeCount: 0
|
|
84
|
+
}));
|
|
85
|
+
mutationPayloads.forEach(function (mutationPayload) {
|
|
86
|
+
lastDomMutationForDebug = cloneDomMutationDebugResult(mutationPayload);
|
|
87
|
+
pushCanvasDebugHistoryEntry(domMutationHistoryForDebug, lastDomMutationForDebug);
|
|
88
|
+
emit((0, _utils.assembleIncrementalSnapshot)(_types.IncrementalSource.Mutation, mutationPayload));
|
|
89
|
+
});
|
|
90
|
+
}
|
|
26
91
|
var inputCb = function inputCb(s) {
|
|
27
92
|
emit((0, _utils.assembleIncrementalSnapshot)(_types.IncrementalSource.Input, s));
|
|
28
93
|
};
|
|
@@ -30,6 +95,75 @@ function record(options) {
|
|
|
30
95
|
mutationCb: mutationCb,
|
|
31
96
|
inputCb: inputCb
|
|
32
97
|
});
|
|
98
|
+
var lastAutoCanvasSnapshotResult;
|
|
99
|
+
var autoCanvasSnapshotDebugHistoryForDebug = [];
|
|
100
|
+
var lastCanvasMutationForDebug;
|
|
101
|
+
var canvasMutationHistoryForDebug = [];
|
|
102
|
+
var lastDomMutationForDebug;
|
|
103
|
+
var domMutationHistoryForDebug = [];
|
|
104
|
+
var shouldUseCanvasCommandCapture = shouldUseCommandCapture(options.configuration);
|
|
105
|
+
var canvasObserver = (options.createCanvasObserver || _canvasObserver.createCanvasObserver)({
|
|
106
|
+
configuration: options.configuration,
|
|
107
|
+
emit: emit,
|
|
108
|
+
onMutationDebug: function onMutationDebug(result) {
|
|
109
|
+
lastCanvasMutationForDebug = cloneCanvasMutationDebugResult(result);
|
|
110
|
+
pushCanvasDebugHistoryEntry(canvasMutationHistoryForDebug, lastCanvasMutationForDebug);
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
var startCanvasSnapshotLoop = options.startContinuousCanvasSnapshotLoop || _canvasContinuousScheduler.startContinuousCanvasSnapshotLoop;
|
|
114
|
+
var canvasSnapshotLoop = shouldUseCanvasCommandCapture ? {
|
|
115
|
+
stop: function stop() {},
|
|
116
|
+
reset: function reset() {}
|
|
117
|
+
} : startCanvasSnapshotLoop({
|
|
118
|
+
configuration: options.configuration,
|
|
119
|
+
getCanvases: function getCanvases() {
|
|
120
|
+
return (0, _serializationUtils.getSerializedCanvasNodes)();
|
|
121
|
+
},
|
|
122
|
+
getSerializedNodeId: function getSerializedNodeId(canvas) {
|
|
123
|
+
return (0, _serializationUtils.getSerializedNodeId)(canvas);
|
|
124
|
+
},
|
|
125
|
+
onDebug: function onDebug(result) {
|
|
126
|
+
var keepSessionAliveTriggered = false;
|
|
127
|
+
if (shouldKeepSessionAliveAfterAutoCanvasSnapshot(result) && options.sessionManager && options.sessionManager.keepSessionAlive) {
|
|
128
|
+
options.sessionManager.keepSessionAlive();
|
|
129
|
+
keepSessionAliveTriggered = true;
|
|
130
|
+
}
|
|
131
|
+
lastAutoCanvasSnapshotResult = cloneAutoCanvasSnapshotDebugResult(result, keepSessionAliveTriggered);
|
|
132
|
+
pushCanvasDebugHistoryEntry(autoCanvasSnapshotDebugHistoryForDebug, lastAutoCanvasSnapshotResult);
|
|
133
|
+
},
|
|
134
|
+
snapshotCanvas: function snapshotCanvas(canvas) {
|
|
135
|
+
return canvasObserver.snapshot(canvas, {
|
|
136
|
+
trigger: 'auto',
|
|
137
|
+
scheduler: 'continuous_snapshot'
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
var canvasCommandCapture = (options.startCanvasCommandCapture || _canvasCommandObserver.startCanvasCommandCapture)({
|
|
142
|
+
configuration: options.configuration,
|
|
143
|
+
emit: emit,
|
|
144
|
+
snapshotCanvas: function snapshotCanvas(canvas, snapshotOptions) {
|
|
145
|
+
return canvasObserver.snapshot(canvas, snapshotOptions);
|
|
146
|
+
},
|
|
147
|
+
getCanvases: function getCanvases() {
|
|
148
|
+
return (0, _serializationUtils.getSerializedCanvasNodes)();
|
|
149
|
+
},
|
|
150
|
+
getSerializedNodeId: function getSerializedNodeId(canvas) {
|
|
151
|
+
return (0, _serializationUtils.getSerializedNodeId)(canvas);
|
|
152
|
+
},
|
|
153
|
+
onDebug: function onDebug(result) {
|
|
154
|
+
var keepSessionAliveTriggered = false;
|
|
155
|
+
if (shouldKeepSessionAliveAfterAutoCanvasSnapshot(result) && options.sessionManager && options.sessionManager.keepSessionAlive) {
|
|
156
|
+
options.sessionManager.keepSessionAlive();
|
|
157
|
+
keepSessionAliveTriggered = true;
|
|
158
|
+
}
|
|
159
|
+
lastAutoCanvasSnapshotResult = cloneAutoCanvasSnapshotDebugResult(result, keepSessionAliveTriggered);
|
|
160
|
+
pushCanvasDebugHistoryEntry(autoCanvasSnapshotDebugHistoryForDebug, lastAutoCanvasSnapshotResult);
|
|
161
|
+
},
|
|
162
|
+
onMutationDebug: function onMutationDebug(result) {
|
|
163
|
+
lastCanvasMutationForDebug = cloneCanvasMutationDebugResult(result);
|
|
164
|
+
pushCanvasDebugHistoryEntry(canvasMutationHistoryForDebug, lastCanvasMutationForDebug);
|
|
165
|
+
}
|
|
166
|
+
});
|
|
33
167
|
var takeFullSnapshot = function takeFullSnapshot(timestamp, serializationContext) {
|
|
34
168
|
if (typeof timestamp === 'undefined') {
|
|
35
169
|
timestamp = (0, _browserCore.timeStampNow)();
|
|
@@ -80,6 +214,9 @@ function record(options) {
|
|
|
80
214
|
}
|
|
81
215
|
};
|
|
82
216
|
takeFullSnapshot();
|
|
217
|
+
if (canvasCommandCapture.scanExistingCanvases) {
|
|
218
|
+
canvasCommandCapture.scanExistingCanvases();
|
|
219
|
+
}
|
|
83
220
|
var _initObservers = (0, _observers.initObservers)({
|
|
84
221
|
lifeCycle: options.lifeCycle,
|
|
85
222
|
configuration: options.configuration,
|
|
@@ -97,6 +234,7 @@ function record(options) {
|
|
|
97
234
|
}));
|
|
98
235
|
},
|
|
99
236
|
mutationCb: mutationCb,
|
|
237
|
+
mutationPerfCb: updateReplayPerformanceStats,
|
|
100
238
|
scrollCb: function scrollCb(p) {
|
|
101
239
|
emit((0, _utils.assembleIncrementalSnapshot)(_types.IncrementalSource.Scroll, p));
|
|
102
240
|
},
|
|
@@ -127,25 +265,403 @@ function record(options) {
|
|
|
127
265
|
});
|
|
128
266
|
var stopObservers = _initObservers.stop;
|
|
129
267
|
var flushMutationsFromObservers = _initObservers.flush;
|
|
268
|
+
var resetMutationsFromObservers = _initObservers.reset || function () {};
|
|
130
269
|
function flushMutations() {
|
|
131
270
|
shadowRootsController.flush();
|
|
132
271
|
flushMutationsFromObservers();
|
|
272
|
+
flushPendingMutations();
|
|
133
273
|
}
|
|
134
274
|
return {
|
|
135
275
|
stop: function stop() {
|
|
276
|
+
flushPendingMutations();
|
|
136
277
|
shadowRootsController.stop();
|
|
278
|
+
canvasCommandCapture.stop();
|
|
279
|
+
canvasObserver.stop();
|
|
280
|
+
stopCanvasSnapshots(canvasSnapshotLoop);
|
|
137
281
|
stopObservers();
|
|
138
282
|
},
|
|
283
|
+
snapshotCanvas: function snapshotCanvas(canvas, snapshotOptions) {
|
|
284
|
+
return canvasObserver.snapshot(canvas, (0, _browserCore.assign)({
|
|
285
|
+
trigger: 'manual'
|
|
286
|
+
}, snapshotOptions));
|
|
287
|
+
},
|
|
288
|
+
getSerializedNodeIdForDebug: function getSerializedNodeIdForDebug(node) {
|
|
289
|
+
return (0, _serializationUtils.getSerializedNodeId)(node);
|
|
290
|
+
},
|
|
291
|
+
getLastAutoCanvasSnapshotResultForDebug: function getLastAutoCanvasSnapshotResultForDebug() {
|
|
292
|
+
return cloneAutoCanvasSnapshotDebugResult(lastAutoCanvasSnapshotResult);
|
|
293
|
+
},
|
|
294
|
+
getAutoCanvasSnapshotDebugHistoryForDebug: function getAutoCanvasSnapshotDebugHistoryForDebug() {
|
|
295
|
+
return autoCanvasSnapshotDebugHistoryForDebug.map(cloneAutoCanvasSnapshotDebugResult);
|
|
296
|
+
},
|
|
297
|
+
getLastCanvasMutationForDebug: function getLastCanvasMutationForDebug() {
|
|
298
|
+
return cloneCanvasMutationDebugResult(lastCanvasMutationForDebug);
|
|
299
|
+
},
|
|
300
|
+
getCanvasMutationHistoryForDebug: function getCanvasMutationHistoryForDebug() {
|
|
301
|
+
return canvasMutationHistoryForDebug.map(cloneCanvasMutationDebugResult);
|
|
302
|
+
},
|
|
303
|
+
getLastDomMutationForDebug: function getLastDomMutationForDebug() {
|
|
304
|
+
return cloneDomMutationDebugResult(lastDomMutationForDebug);
|
|
305
|
+
},
|
|
306
|
+
getDomMutationHistoryForDebug: function getDomMutationHistoryForDebug() {
|
|
307
|
+
return domMutationHistoryForDebug.map(cloneDomMutationDebugResult);
|
|
308
|
+
},
|
|
309
|
+
getReplayPerformanceForDebug: function getReplayPerformanceForDebug() {
|
|
310
|
+
return cloneReplayPerformanceStats(replayPerformanceStats);
|
|
311
|
+
},
|
|
139
312
|
takeSubsequentFullSnapshot: function takeSubsequentFullSnapshot(timestamp) {
|
|
140
313
|
flushMutations();
|
|
314
|
+
resetMutationsFromObservers();
|
|
315
|
+
if (canvasObserver.reset) {
|
|
316
|
+
canvasObserver.reset();
|
|
317
|
+
}
|
|
318
|
+
if (canvasCommandCapture.reset) {
|
|
319
|
+
canvasCommandCapture.reset();
|
|
320
|
+
}
|
|
321
|
+
resetCanvasSnapshots(canvasSnapshotLoop);
|
|
141
322
|
takeFullSnapshot(timestamp, {
|
|
142
323
|
shadowRootsController: shadowRootsController,
|
|
143
324
|
status: _serialize.SerializationContextStatus.SUBSEQUENT_FULL_SNAPSHOT,
|
|
144
325
|
elementsScrollPositions: elementsScrollPositions
|
|
145
326
|
});
|
|
327
|
+
if (canvasCommandCapture.scanExistingCanvases) {
|
|
328
|
+
canvasCommandCapture.scanExistingCanvases();
|
|
329
|
+
}
|
|
146
330
|
},
|
|
147
331
|
flushMutations: flushMutations,
|
|
148
332
|
shadowRootsController: shadowRootsController
|
|
149
333
|
};
|
|
150
334
|
}
|
|
335
|
+
function materializeMutationPayload(pendingMutationPayload) {
|
|
336
|
+
return {
|
|
337
|
+
adds: pendingMutationPayload.adds,
|
|
338
|
+
removes: pendingMutationPayload.removes,
|
|
339
|
+
texts: pendingMutationPayload.texts,
|
|
340
|
+
attributes: pendingMutationPayload.attributes
|
|
341
|
+
};
|
|
342
|
+
}
|
|
343
|
+
function createEmptyMutationPayload() {
|
|
344
|
+
return {
|
|
345
|
+
adds: [],
|
|
346
|
+
removes: [],
|
|
347
|
+
texts: [],
|
|
348
|
+
attributes: [],
|
|
349
|
+
approxBytes: 0,
|
|
350
|
+
addsApproxBytes: 0,
|
|
351
|
+
removesApproxBytes: 0,
|
|
352
|
+
textsApproxBytes: 0,
|
|
353
|
+
attributesApproxBytes: 0,
|
|
354
|
+
addApproxBytes: [],
|
|
355
|
+
removesByKey: new Map(),
|
|
356
|
+
removeApproxBytesByKey: new Map(),
|
|
357
|
+
textsById: new Map(),
|
|
358
|
+
textApproxBytesById: new Map(),
|
|
359
|
+
attributesById: new Map(),
|
|
360
|
+
attributeApproxBytesById: new Map()
|
|
361
|
+
};
|
|
362
|
+
}
|
|
363
|
+
function mergeMutationPayloads(target, source) {
|
|
364
|
+
var merged = target || createEmptyMutationPayload();
|
|
365
|
+
mergeAddMutations(merged, source.adds);
|
|
366
|
+
mergeRemoveMutations(merged, source.removes);
|
|
367
|
+
mergeTextMutations(merged, source.texts);
|
|
368
|
+
mergeAttributeMutations(merged, source.attributes);
|
|
369
|
+
updateMutationPayloadApproxBytes(merged);
|
|
370
|
+
return merged;
|
|
371
|
+
}
|
|
372
|
+
function mergeAddMutations(merged, sourceAdds) {
|
|
373
|
+
if (!sourceAdds.length) {
|
|
374
|
+
return;
|
|
375
|
+
}
|
|
376
|
+
sourceAdds.forEach(function (add) {
|
|
377
|
+
var addApproxBytes = estimateMutationEntryBytes(add);
|
|
378
|
+
merged.adds.push(add);
|
|
379
|
+
merged.addApproxBytes.push(addApproxBytes);
|
|
380
|
+
merged.addsApproxBytes += addApproxBytes;
|
|
381
|
+
});
|
|
382
|
+
}
|
|
383
|
+
function mergeRemoveMutations(merged, sourceRemoves) {
|
|
384
|
+
if (!sourceRemoves.length) {
|
|
385
|
+
return;
|
|
386
|
+
}
|
|
387
|
+
sourceRemoves.forEach(function (remove) {
|
|
388
|
+
var key = getRemoveMutationKey(remove);
|
|
389
|
+
if (!merged.removesByKey.has(key)) {
|
|
390
|
+
merged.removes.push(remove);
|
|
391
|
+
var removeApproxBytes = estimateMutationEntryBytes(remove);
|
|
392
|
+
merged.removeApproxBytesByKey.set(key, removeApproxBytes);
|
|
393
|
+
merged.removesApproxBytes += removeApproxBytes;
|
|
394
|
+
}
|
|
395
|
+
merged.removesByKey.set(key, remove);
|
|
396
|
+
});
|
|
397
|
+
}
|
|
398
|
+
function mergeTextMutations(merged, sourceTexts) {
|
|
399
|
+
if (!sourceTexts.length) {
|
|
400
|
+
return;
|
|
401
|
+
}
|
|
402
|
+
sourceTexts.forEach(function (textMutation) {
|
|
403
|
+
var existingTextMutation = merged.textsById.get(textMutation.id);
|
|
404
|
+
if (existingTextMutation) {
|
|
405
|
+
merged.textsApproxBytes -= merged.textApproxBytesById.get(textMutation.id) || 0;
|
|
406
|
+
existingTextMutation.value = textMutation.value;
|
|
407
|
+
var nextTextApproxBytes = estimateMutationEntryBytes(existingTextMutation);
|
|
408
|
+
merged.textApproxBytesById.set(textMutation.id, nextTextApproxBytes);
|
|
409
|
+
merged.textsApproxBytes += nextTextApproxBytes;
|
|
410
|
+
return;
|
|
411
|
+
}
|
|
412
|
+
merged.texts.push(textMutation);
|
|
413
|
+
merged.textsById.set(textMutation.id, textMutation);
|
|
414
|
+
var textApproxBytes = estimateMutationEntryBytes(textMutation);
|
|
415
|
+
merged.textApproxBytesById.set(textMutation.id, textApproxBytes);
|
|
416
|
+
merged.textsApproxBytes += textApproxBytes;
|
|
417
|
+
});
|
|
418
|
+
}
|
|
419
|
+
function mergeAttributeMutations(merged, sourceAttributes) {
|
|
420
|
+
if (!sourceAttributes.length) {
|
|
421
|
+
return;
|
|
422
|
+
}
|
|
423
|
+
sourceAttributes.forEach(function (attributeMutation) {
|
|
424
|
+
var existingAttributeMutation = merged.attributesById.get(attributeMutation.id);
|
|
425
|
+
if (!existingAttributeMutation) {
|
|
426
|
+
var nextAttributeMutation = {
|
|
427
|
+
id: attributeMutation.id,
|
|
428
|
+
attributes: (0, _browserCore.assign)({}, attributeMutation.attributes)
|
|
429
|
+
};
|
|
430
|
+
merged.attributes.push(nextAttributeMutation);
|
|
431
|
+
merged.attributesById.set(attributeMutation.id, nextAttributeMutation);
|
|
432
|
+
var attributeApproxBytes = estimateMutationEntryBytes(nextAttributeMutation);
|
|
433
|
+
merged.attributeApproxBytesById.set(attributeMutation.id, attributeApproxBytes);
|
|
434
|
+
merged.attributesApproxBytes += attributeApproxBytes;
|
|
435
|
+
return;
|
|
436
|
+
}
|
|
437
|
+
merged.attributesApproxBytes -= merged.attributeApproxBytesById.get(attributeMutation.id) || 0;
|
|
438
|
+
existingAttributeMutation.attributes = (0, _browserCore.assign)(existingAttributeMutation.attributes, attributeMutation.attributes);
|
|
439
|
+
var nextAttributeApproxBytes = estimateMutationEntryBytes(existingAttributeMutation);
|
|
440
|
+
merged.attributeApproxBytesById.set(attributeMutation.id, nextAttributeApproxBytes);
|
|
441
|
+
merged.attributesApproxBytes += nextAttributeApproxBytes;
|
|
442
|
+
});
|
|
443
|
+
}
|
|
444
|
+
function getRemoveMutationKey(remove) {
|
|
445
|
+
return remove.parentId + ':' + remove.id;
|
|
446
|
+
}
|
|
447
|
+
function shouldFlushPendingMutationPayloadBeforeMerge(target, source) {
|
|
448
|
+
return target.approxBytes + estimateMutationPayloadBytes(source) > MAX_MUTATION_EMIT_APPROX_BYTES;
|
|
449
|
+
}
|
|
450
|
+
function splitPendingMutationPayloadForEmit(pendingMutationPayload) {
|
|
451
|
+
var mutation = materializeMutationPayload(pendingMutationPayload);
|
|
452
|
+
if (!mutation.adds.length || pendingMutationPayload.approxBytes <= MAX_MUTATION_EMIT_APPROX_BYTES) {
|
|
453
|
+
return [mutation];
|
|
454
|
+
}
|
|
455
|
+
var addOnlyPayloads = [];
|
|
456
|
+
var currentAdds = [];
|
|
457
|
+
var currentAddsBytes = BASE_MUTATION_PAYLOAD_APPROX_BYTES;
|
|
458
|
+
mutation.adds.forEach(function (add, index) {
|
|
459
|
+
var addBytes = pendingMutationPayload.addApproxBytes[index];
|
|
460
|
+
if (currentAdds.length && currentAddsBytes + addBytes > MAX_MUTATION_EMIT_APPROX_BYTES) {
|
|
461
|
+
addOnlyPayloads.push({
|
|
462
|
+
adds: currentAdds,
|
|
463
|
+
removes: [],
|
|
464
|
+
texts: [],
|
|
465
|
+
attributes: []
|
|
466
|
+
});
|
|
467
|
+
currentAdds = [];
|
|
468
|
+
currentAddsBytes = BASE_MUTATION_PAYLOAD_APPROX_BYTES;
|
|
469
|
+
}
|
|
470
|
+
currentAdds.push(add);
|
|
471
|
+
currentAddsBytes += addBytes;
|
|
472
|
+
});
|
|
473
|
+
if (currentAdds.length) {
|
|
474
|
+
addOnlyPayloads.push({
|
|
475
|
+
adds: currentAdds,
|
|
476
|
+
removes: [],
|
|
477
|
+
texts: [],
|
|
478
|
+
attributes: []
|
|
479
|
+
});
|
|
480
|
+
}
|
|
481
|
+
if (mutation.removes.length || mutation.texts.length || mutation.attributes.length) {
|
|
482
|
+
addOnlyPayloads.push({
|
|
483
|
+
adds: [],
|
|
484
|
+
removes: mutation.removes,
|
|
485
|
+
texts: mutation.texts,
|
|
486
|
+
attributes: mutation.attributes
|
|
487
|
+
});
|
|
488
|
+
}
|
|
489
|
+
return addOnlyPayloads;
|
|
490
|
+
}
|
|
491
|
+
function createEmptyMutation() {
|
|
492
|
+
return {
|
|
493
|
+
adds: [],
|
|
494
|
+
removes: [],
|
|
495
|
+
texts: [],
|
|
496
|
+
attributes: []
|
|
497
|
+
};
|
|
498
|
+
}
|
|
499
|
+
var BASE_MUTATION_PAYLOAD_APPROX_BYTES = 64;
|
|
500
|
+
function estimateMutationPayloadBytes(mutation) {
|
|
501
|
+
return BASE_MUTATION_PAYLOAD_APPROX_BYTES + estimateMutationEntriesBytes(mutation.adds) + estimateMutationEntriesBytes(mutation.removes) + estimateMutationEntriesBytes(mutation.texts) + estimateMutationEntriesBytes(mutation.attributes);
|
|
502
|
+
}
|
|
503
|
+
function estimateMutationEntryBytes(entry) {
|
|
504
|
+
return JSON.stringify(entry).length;
|
|
505
|
+
}
|
|
506
|
+
function estimateMutationEntriesBytes(entries) {
|
|
507
|
+
var total = 0;
|
|
508
|
+
for (var i = 0; i < entries.length; i += 1) {
|
|
509
|
+
total += estimateMutationEntryBytes(entries[i]);
|
|
510
|
+
}
|
|
511
|
+
return total;
|
|
512
|
+
}
|
|
513
|
+
function updateMutationPayloadApproxBytes(mutationPayload) {
|
|
514
|
+
mutationPayload.approxBytes = BASE_MUTATION_PAYLOAD_APPROX_BYTES + mutationPayload.addsApproxBytes + mutationPayload.removesApproxBytes + mutationPayload.textsApproxBytes + mutationPayload.attributesApproxBytes;
|
|
515
|
+
}
|
|
516
|
+
function createReplayPerformanceStats() {
|
|
517
|
+
return {
|
|
518
|
+
processMutationsCount: 0,
|
|
519
|
+
processMutationsDuration: 0,
|
|
520
|
+
mutationCallbackCount: 0,
|
|
521
|
+
mutationRecordCount: 0,
|
|
522
|
+
mutationAddCount: 0,
|
|
523
|
+
mutationRemoveCount: 0,
|
|
524
|
+
mutationTextCount: 0,
|
|
525
|
+
mutationAttributeCount: 0
|
|
526
|
+
};
|
|
527
|
+
}
|
|
528
|
+
function accumulateReplayPerformanceStats(stats, delta) {
|
|
529
|
+
if (!delta) {
|
|
530
|
+
return;
|
|
531
|
+
}
|
|
532
|
+
stats.processMutationsCount += delta.processMutationsCount || 0;
|
|
533
|
+
stats.processMutationsDuration += delta.processMutationsDuration || 0;
|
|
534
|
+
stats.mutationCallbackCount += delta.mutationCallbackCount || 0;
|
|
535
|
+
stats.mutationRecordCount += delta.mutationRecordCount || 0;
|
|
536
|
+
stats.mutationAddCount += delta.mutationAddCount || 0;
|
|
537
|
+
stats.mutationRemoveCount += delta.mutationRemoveCount || 0;
|
|
538
|
+
stats.mutationTextCount += delta.mutationTextCount || 0;
|
|
539
|
+
stats.mutationAttributeCount += delta.mutationAttributeCount || 0;
|
|
540
|
+
}
|
|
541
|
+
function countMutationPayloadRecords(mutation) {
|
|
542
|
+
return mutation.adds.length + mutation.removes.length + mutation.texts.length + mutation.attributes.length;
|
|
543
|
+
}
|
|
544
|
+
function cloneReplayPerformanceStats(stats) {
|
|
545
|
+
if (!stats) {
|
|
546
|
+
return stats;
|
|
547
|
+
}
|
|
548
|
+
return {
|
|
549
|
+
processMutationsCount: stats.processMutationsCount,
|
|
550
|
+
processMutationsDuration: Math.round(stats.processMutationsDuration * 10) / 10,
|
|
551
|
+
mutationCallbackCount: stats.mutationCallbackCount,
|
|
552
|
+
mutationRecordCount: stats.mutationRecordCount,
|
|
553
|
+
mutationAddCount: stats.mutationAddCount,
|
|
554
|
+
mutationRemoveCount: stats.mutationRemoveCount,
|
|
555
|
+
mutationTextCount: stats.mutationTextCount,
|
|
556
|
+
mutationAttributeCount: stats.mutationAttributeCount
|
|
557
|
+
};
|
|
558
|
+
}
|
|
559
|
+
function pushCanvasDebugHistoryEntry(history, entry) {
|
|
560
|
+
if (!entry) {
|
|
561
|
+
return;
|
|
562
|
+
}
|
|
563
|
+
history.push(entry);
|
|
564
|
+
if (history.length > CANVAS_DEBUG_HISTORY_LIMIT) {
|
|
565
|
+
history.shift();
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
function stopCanvasSnapshots(canvasSnapshotLoop) {
|
|
569
|
+
if (typeof canvasSnapshotLoop === 'function') {
|
|
570
|
+
canvasSnapshotLoop();
|
|
571
|
+
return;
|
|
572
|
+
}
|
|
573
|
+
if (canvasSnapshotLoop && canvasSnapshotLoop.stop) {
|
|
574
|
+
canvasSnapshotLoop.stop();
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
function resetCanvasSnapshots(canvasSnapshotLoop) {
|
|
578
|
+
if (canvasSnapshotLoop && canvasSnapshotLoop.reset) {
|
|
579
|
+
canvasSnapshotLoop.reset();
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
function shouldKeepSessionAliveAfterAutoCanvasSnapshot(result) {
|
|
583
|
+
return !!(result && result.status === 'completed' && result.selectedCanvasCount > 0 && (result.results || []).some(function (entry) {
|
|
584
|
+
return isKeepAliveWorthyAutoCanvasResult(entry);
|
|
585
|
+
}));
|
|
586
|
+
}
|
|
587
|
+
function isKeepAliveWorthyAutoCanvasResult(entry) {
|
|
588
|
+
return !!(entry && (entry.ok || entry.reason === 'unchanged' || entry.reason === 'below_threshold'));
|
|
589
|
+
}
|
|
590
|
+
function cloneAutoCanvasSnapshotDebugResult(result, keepSessionAliveTriggered) {
|
|
591
|
+
if (!result) {
|
|
592
|
+
return result;
|
|
593
|
+
}
|
|
594
|
+
if (typeof keepSessionAliveTriggered === 'undefined') {
|
|
595
|
+
keepSessionAliveTriggered = result.keepSessionAliveTriggered;
|
|
596
|
+
}
|
|
597
|
+
return {
|
|
598
|
+
scheduler: result.scheduler,
|
|
599
|
+
status: result.status,
|
|
600
|
+
startedAt: typeof result.startedAt === 'number' ? result.startedAt : result.timestamp,
|
|
601
|
+
completedAt: typeof result.completedAt === 'number' ? result.completedAt : result.timestamp,
|
|
602
|
+
timestamp: result.timestamp,
|
|
603
|
+
eligibleCanvasCount: result.eligibleCanvasCount,
|
|
604
|
+
selectedCanvasCount: result.selectedCanvasCount,
|
|
605
|
+
skippedBudgetCount: result.skippedBudgetCount,
|
|
606
|
+
keepSessionAliveTriggered: !!keepSessionAliveTriggered,
|
|
607
|
+
results: (result.results || []).map(function (entry) {
|
|
608
|
+
return {
|
|
609
|
+
canvasId: entry.canvasId,
|
|
610
|
+
ok: entry.ok,
|
|
611
|
+
reason: entry.reason,
|
|
612
|
+
priority: entry.priority
|
|
613
|
+
};
|
|
614
|
+
})
|
|
615
|
+
};
|
|
616
|
+
}
|
|
617
|
+
function cloneCanvasMutationDebugResult(result) {
|
|
618
|
+
if (!result) {
|
|
619
|
+
return result;
|
|
620
|
+
}
|
|
621
|
+
var clonedResult = {
|
|
622
|
+
timestamp: result.timestamp,
|
|
623
|
+
canvasId: result.canvasId,
|
|
624
|
+
trigger: result.trigger,
|
|
625
|
+
encodedBytesCount: result.encodedBytesCount,
|
|
626
|
+
approxBytesCount: result.approxBytesCount,
|
|
627
|
+
commandCount: result.commandCount,
|
|
628
|
+
width: result.width,
|
|
629
|
+
height: result.height
|
|
630
|
+
};
|
|
631
|
+
if (typeof result.reason !== 'undefined') {
|
|
632
|
+
clonedResult.reason = result.reason;
|
|
633
|
+
}
|
|
634
|
+
if (typeof result.diagnostics !== 'undefined') {
|
|
635
|
+
clonedResult.diagnostics = result.diagnostics;
|
|
636
|
+
}
|
|
637
|
+
return clonedResult;
|
|
638
|
+
}
|
|
639
|
+
function cloneDomMutationDebugResult(result) {
|
|
640
|
+
if (!result) {
|
|
641
|
+
return result;
|
|
642
|
+
}
|
|
643
|
+
return {
|
|
644
|
+
timestamp: typeof result.timestamp === 'number' ? result.timestamp : (0, _browserCore.timeStampNow)(),
|
|
645
|
+
adds: (result.adds || []).map(cloneDebugValue),
|
|
646
|
+
removes: (result.removes || []).map(cloneDebugValue),
|
|
647
|
+
texts: (result.texts || []).map(cloneDebugValue),
|
|
648
|
+
attributes: (result.attributes || []).map(cloneDebugValue),
|
|
649
|
+
addsCount: (result.adds || []).length,
|
|
650
|
+
removesCount: (result.removes || []).length,
|
|
651
|
+
textsCount: (result.texts || []).length,
|
|
652
|
+
attributesCount: (result.attributes || []).length
|
|
653
|
+
};
|
|
654
|
+
}
|
|
655
|
+
function cloneDebugValue(value) {
|
|
656
|
+
if (!value || _typeof(value) !== 'object') {
|
|
657
|
+
return value;
|
|
658
|
+
}
|
|
659
|
+
if (Array.isArray(value)) {
|
|
660
|
+
return value.map(cloneDebugValue);
|
|
661
|
+
}
|
|
662
|
+
return Object.keys(value).reduce(function (accumulator, key) {
|
|
663
|
+
accumulator[key] = cloneDebugValue(value[key]);
|
|
664
|
+
return accumulator;
|
|
665
|
+
}, {});
|
|
666
|
+
}
|
|
151
667
|
//# sourceMappingURL=record.js.map
|