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