@cloudcare/browser-rum 3.3.24 → 3.3.26
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 +33 -0
- package/README.zh.md +30 -0
- package/bundle/dataflux-rum.js +1 -1
- package/cjs/boot/buildEnv.js +1 -1
- package/cjs/boot/disabledRumPublicApi.js +5 -0
- package/cjs/boot/disabledRumPublicApi.js.map +1 -1
- package/cjs/boot/initCallbacks.js +25 -0
- package/cjs/boot/initCallbacks.js.map +1 -0
- package/cjs/boot/perStartRum.js +99 -50
- package/cjs/boot/perStartRum.js.map +1 -1
- package/cjs/boot/recorderApi.js +36 -1
- package/cjs/boot/recorderApi.js.map +1 -1
- package/cjs/boot/rum.js +8 -9
- package/cjs/boot/rum.js.map +1 -1
- package/cjs/boot/rumPublicApi.js +6 -7
- package/cjs/boot/rumPublicApi.js.map +1 -1
- package/cjs/boot/startRecording.js +2 -0
- package/cjs/boot/startRecording.js.map +1 -1
- package/cjs/domain/configuration.js +15 -2
- package/cjs/domain/configuration.js.map +1 -1
- package/cjs/domain/contexts/urlContexts.js +32 -21
- package/cjs/domain/contexts/urlContexts.js.map +1 -1
- package/cjs/domain/contexts/viewContexts.js +1 -1
- package/cjs/domain/contexts/viewContexts.js.map +1 -1
- package/cjs/domain/deflate/deflateWorker.js +39 -27
- package/cjs/domain/deflate/deflateWorker.js.map +1 -1
- package/cjs/domain/privacy.js +79 -107
- package/cjs/domain/privacy.js.map +1 -1
- package/cjs/domain/replay/record/canvasCommandCapture.js +87 -179
- package/cjs/domain/replay/record/canvasCommandCapture.js.map +1 -1
- package/cjs/domain/replay/record/canvasCommandObserver.js +10 -6
- package/cjs/domain/replay/record/canvasCommandObserver.js.map +1 -1
- package/cjs/domain/replay/record/canvasCommandObserverStub.js +24 -0
- package/cjs/domain/replay/record/canvasCommandObserverStub.js.map +1 -0
- package/cjs/domain/replay/record/canvasCommandSerializeArgs.js +3 -2
- package/cjs/domain/replay/record/canvasCommandSerializeArgs.js.map +1 -1
- package/cjs/domain/replay/record/canvasContext.js +15 -0
- package/cjs/domain/replay/record/canvasContext.js.map +1 -1
- package/cjs/domain/replay/record/canvasEncodeWorker.js +1 -1
- package/cjs/domain/replay/record/canvasObserver.js +3 -0
- package/cjs/domain/replay/record/canvasObserver.js.map +1 -1
- package/cjs/domain/replay/record/canvasWebGLPluginHost.js +5 -1
- package/cjs/domain/replay/record/canvasWebGLPluginHost.js.map +1 -1
- package/cjs/domain/replay/record/mutationObserver.js +3 -12
- package/cjs/domain/replay/record/mutationObserver.js.map +1 -1
- package/cjs/domain/replay/record/observers.js +3 -7
- package/cjs/domain/replay/record/observers.js.map +1 -1
- package/cjs/domain/replay/record/record.js +15 -2
- package/cjs/domain/replay/record/record.js.map +1 -1
- package/cjs/domain/replay/record/serializationUtils.js +8 -23
- package/cjs/domain/replay/record/serializationUtils.js.map +1 -1
- package/cjs/domain/replay/record/serialize.js +19 -33
- package/cjs/domain/replay/record/serialize.js.map +1 -1
- package/cjs/domain/replay/segmentCollection/buildReplayPayload.js +21 -6
- package/cjs/domain/replay/segmentCollection/buildReplayPayload.js.map +1 -1
- package/cjs/domain/replay/segmentCollection/segmentCollection.js +91 -143
- package/cjs/domain/replay/segmentCollection/segmentCollection.js.map +1 -1
- package/cjs/domain/replayCanvasSupported.js +8 -0
- package/cjs/domain/replayCanvasSupported.js.map +1 -0
- package/cjs/domain/requestCollection.js +38 -39
- package/cjs/domain/requestCollection.js.map +1 -1
- package/cjs/domain/rumEventsCollection/actions/listenActionEvents.js +1 -1
- package/cjs/domain/rumEventsCollection/actions/listenActionEvents.js.map +1 -1
- package/cjs/domain/rumEventsCollection/resource/fetchTimingRegistry.js +143 -0
- package/cjs/domain/rumEventsCollection/resource/fetchTimingRegistry.js.map +1 -0
- package/cjs/domain/rumEventsCollection/resource/matchRequestResourceEntry.js +2 -2
- package/cjs/domain/rumEventsCollection/resource/matchRequestResourceEntry.js.map +1 -1
- package/cjs/domain/rumEventsCollection/resource/resourceCollection.js +91 -66
- package/cjs/domain/rumEventsCollection/resource/resourceCollection.js.map +1 -1
- package/cjs/domain/rumEventsCollection/resource/resourceTrackerManager.js +11 -9
- package/cjs/domain/rumEventsCollection/resource/resourceTrackerManager.js.map +1 -1
- package/cjs/domain/rumEventsCollection/resource/resourceUtils.js +35 -50
- package/cjs/domain/rumEventsCollection/resource/resourceUtils.js.map +1 -1
- package/cjs/domain/rumEventsCollection/resource/retrieveInitialDocumentResourceTiming.js +7 -1
- package/cjs/domain/rumEventsCollection/resource/retrieveInitialDocumentResourceTiming.js.map +1 -1
- package/cjs/domain/rumEventsCollection/view/trackCumulativeLayoutShift.js +1 -1
- package/cjs/domain/rumEventsCollection/view/trackCumulativeLayoutShift.js.map +1 -1
- package/cjs/domain/rumEventsCollection/view/trackViews.js +3 -0
- package/cjs/domain/rumEventsCollection/view/trackViews.js.map +1 -1
- package/cjs/domain/rumEventsCollection/view/viewCollection.js +1 -1
- package/cjs/domain/rumEventsCollection/view/viewCollection.js.map +1 -1
- package/cjs/domain/tracing/skywalkingTracer.js +4 -50
- package/cjs/domain/tracing/skywalkingTracer.js.map +1 -1
- package/cjs/domain/tracing/tracer.js +26 -3
- package/cjs/domain/tracing/tracer.js.map +1 -1
- package/esm/boot/buildEnv.js +1 -1
- package/esm/boot/disabledRumPublicApi.js +1 -1
- package/esm/boot/disabledRumPublicApi.js.map +1 -1
- package/esm/boot/initCallbacks.js +2 -0
- package/esm/boot/initCallbacks.js.map +1 -0
- package/esm/boot/perStartRum.js +1 -1
- package/esm/boot/perStartRum.js.map +1 -1
- package/esm/boot/recorderApi.js +1 -1
- package/esm/boot/recorderApi.js.map +1 -1
- package/esm/boot/rum.js +1 -1
- package/esm/boot/rum.js.map +1 -1
- package/esm/boot/rumPublicApi.js +1 -1
- package/esm/boot/rumPublicApi.js.map +1 -1
- package/esm/boot/startRecording.js +1 -1
- package/esm/boot/startRecording.js.map +1 -1
- package/esm/domain/configuration.js +1 -1
- package/esm/domain/configuration.js.map +1 -1
- package/esm/domain/contexts/urlContexts.js +1 -1
- package/esm/domain/contexts/urlContexts.js.map +1 -1
- package/esm/domain/contexts/viewContexts.js +1 -1
- package/esm/domain/contexts/viewContexts.js.map +1 -1
- package/esm/domain/deflate/deflateWorker.js +1 -1
- package/esm/domain/deflate/deflateWorker.js.map +1 -1
- package/esm/domain/privacy.js +1 -1
- package/esm/domain/privacy.js.map +1 -1
- package/esm/domain/replay/record/canvasCommandCapture.js +1 -1
- package/esm/domain/replay/record/canvasCommandCapture.js.map +1 -1
- package/esm/domain/replay/record/canvasCommandObserver.js +1 -1
- package/esm/domain/replay/record/canvasCommandObserver.js.map +1 -1
- package/esm/domain/replay/record/canvasCommandObserverStub.js +2 -0
- package/esm/domain/replay/record/canvasCommandObserverStub.js.map +1 -0
- package/esm/domain/replay/record/canvasCommandSerializeArgs.js +1 -1
- package/esm/domain/replay/record/canvasCommandSerializeArgs.js.map +1 -1
- package/esm/domain/replay/record/canvasContext.js +1 -1
- package/esm/domain/replay/record/canvasContext.js.map +1 -1
- package/esm/domain/replay/record/canvasEncodeWorker.js +1 -1
- package/esm/domain/replay/record/canvasObserver.js +1 -1
- package/esm/domain/replay/record/canvasObserver.js.map +1 -1
- package/esm/domain/replay/record/canvasWebGLPluginHost.js +1 -1
- package/esm/domain/replay/record/canvasWebGLPluginHost.js.map +1 -1
- package/esm/domain/replay/record/mutationObserver.js +1 -1
- package/esm/domain/replay/record/mutationObserver.js.map +1 -1
- package/esm/domain/replay/record/observers.js +1 -1
- package/esm/domain/replay/record/observers.js.map +1 -1
- package/esm/domain/replay/record/record.js +1 -1
- package/esm/domain/replay/record/record.js.map +1 -1
- package/esm/domain/replay/record/serializationUtils.js +1 -1
- package/esm/domain/replay/record/serializationUtils.js.map +1 -1
- package/esm/domain/replay/record/serialize.js +1 -1
- package/esm/domain/replay/record/serialize.js.map +1 -1
- package/esm/domain/replay/segmentCollection/buildReplayPayload.js +1 -1
- package/esm/domain/replay/segmentCollection/buildReplayPayload.js.map +1 -1
- package/esm/domain/replay/segmentCollection/segmentCollection.js +1 -1
- package/esm/domain/replay/segmentCollection/segmentCollection.js.map +1 -1
- package/esm/domain/replayCanvasSupported.js +2 -0
- package/esm/domain/replayCanvasSupported.js.map +1 -0
- package/esm/domain/requestCollection.js +1 -1
- package/esm/domain/requestCollection.js.map +1 -1
- package/esm/domain/rumEventsCollection/actions/listenActionEvents.js +1 -1
- package/esm/domain/rumEventsCollection/actions/listenActionEvents.js.map +1 -1
- package/esm/domain/rumEventsCollection/resource/fetchTimingRegistry.js +2 -0
- package/esm/domain/rumEventsCollection/resource/fetchTimingRegistry.js.map +1 -0
- package/esm/domain/rumEventsCollection/resource/matchRequestResourceEntry.js +1 -1
- package/esm/domain/rumEventsCollection/resource/matchRequestResourceEntry.js.map +1 -1
- package/esm/domain/rumEventsCollection/resource/resourceCollection.js +1 -1
- package/esm/domain/rumEventsCollection/resource/resourceCollection.js.map +1 -1
- package/esm/domain/rumEventsCollection/resource/resourceTrackerManager.js +1 -1
- package/esm/domain/rumEventsCollection/resource/resourceTrackerManager.js.map +1 -1
- package/esm/domain/rumEventsCollection/resource/resourceUtils.js +1 -1
- package/esm/domain/rumEventsCollection/resource/resourceUtils.js.map +1 -1
- package/esm/domain/rumEventsCollection/resource/retrieveInitialDocumentResourceTiming.js +1 -1
- package/esm/domain/rumEventsCollection/resource/retrieveInitialDocumentResourceTiming.js.map +1 -1
- package/esm/domain/rumEventsCollection/view/trackCumulativeLayoutShift.js +1 -1
- package/esm/domain/rumEventsCollection/view/trackCumulativeLayoutShift.js.map +1 -1
- package/esm/domain/rumEventsCollection/view/trackViews.js +1 -1
- package/esm/domain/rumEventsCollection/view/trackViews.js.map +1 -1
- package/esm/domain/rumEventsCollection/view/viewCollection.js +1 -1
- package/esm/domain/rumEventsCollection/view/viewCollection.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/tracer.js +1 -1
- package/esm/domain/tracing/tracer.js.map +1 -1
- package/package.json +7 -7
- package/src/boot/disabledRumPublicApi.js +5 -0
- package/src/boot/initCallbacks.js +16 -0
- package/src/boot/perStartRum.js +102 -59
- package/src/boot/recorderApi.js +51 -2
- package/src/boot/rum.js +12 -18
- package/src/boot/rumPublicApi.js +6 -8
- package/src/boot/startRecording.js +2 -0
- package/src/domain/configuration.js +13 -2
- package/src/domain/contexts/urlContexts.js +34 -27
- package/src/domain/contexts/viewContexts.js +2 -2
- package/src/domain/deflate/deflateWorker.js +35 -21
- package/src/domain/privacy.js +93 -157
- package/src/domain/replay/record/canvasCommandCapture.js +102 -239
- package/src/domain/replay/record/canvasCommandObserver.js +11 -18
- package/src/domain/replay/record/canvasCommandObserverStub.js +11 -0
- package/src/domain/replay/record/canvasCommandSerializeArgs.js +2 -2
- package/src/domain/replay/record/canvasContext.js +18 -0
- package/src/domain/replay/record/canvasObserver.js +5 -1
- package/src/domain/replay/record/canvasWebGLPluginHost.js +4 -1
- package/src/domain/replay/record/mutationObserver.js +6 -22
- package/src/domain/replay/record/observers.js +4 -8
- package/src/domain/replay/record/record.js +20 -5
- package/src/domain/replay/record/serializationUtils.js +10 -33
- package/src/domain/replay/record/serialize.js +30 -38
- package/src/domain/replay/segmentCollection/buildReplayPayload.js +24 -14
- package/src/domain/replay/segmentCollection/segmentCollection.js +97 -227
- package/src/domain/replayCanvasSupported.js +1 -0
- package/src/domain/requestCollection.js +39 -51
- package/src/domain/rumEventsCollection/actions/listenActionEvents.js +8 -2
- package/src/domain/rumEventsCollection/resource/fetchTimingRegistry.js +138 -0
- package/src/domain/rumEventsCollection/resource/matchRequestResourceEntry.js +2 -2
- package/src/domain/rumEventsCollection/resource/resourceCollection.js +103 -88
- package/src/domain/rumEventsCollection/resource/resourceTrackerManager.js +10 -10
- package/src/domain/rumEventsCollection/resource/resourceUtils.js +41 -69
- package/src/domain/rumEventsCollection/resource/retrieveInitialDocumentResourceTiming.js +8 -2
- package/src/domain/rumEventsCollection/view/trackCumulativeLayoutShift.js +1 -1
- package/src/domain/rumEventsCollection/view/trackViews.js +3 -0
- package/src/domain/rumEventsCollection/view/viewCollection.js +2 -3
- package/src/domain/tracing/skywalkingTracer.js +14 -91
- package/src/domain/tracing/tracer.js +28 -4
- package/types/index.d.ts +9 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { isCanvasPrivate } from './canvasContext'
|
|
2
|
+
import { noop, SDKMap } from '@cloudcare/browser-core'
|
|
3
|
+
import { createCanvasCommandObjectRefRegistry, isSerializedTypedArray } from './canvasCommandSerializeArgs'
|
|
3
4
|
import { createCanvasMutationRecord } from './canvasMutationRecord'
|
|
4
5
|
|
|
5
6
|
var CANVAS_2D_CAPTURED_METHODS = [
|
|
@@ -69,7 +70,8 @@ var CANVAS_2D_CAPTURED_PROPERTIES = [
|
|
|
69
70
|
'filter'
|
|
70
71
|
]
|
|
71
72
|
|
|
72
|
-
|
|
73
|
+
// Known API members are handled separately from unknown canvas mutations.
|
|
74
|
+
var knownCanvasMembers = {
|
|
73
75
|
createImageData: true,
|
|
74
76
|
getContextAttributes: true,
|
|
75
77
|
getImageData: true,
|
|
@@ -80,13 +82,8 @@ var CANVAS_2D_NON_MUTATING_METHODS = {
|
|
|
80
82
|
isPointInStroke: true,
|
|
81
83
|
measureText: true
|
|
82
84
|
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
CANVAS_2D_CAPTURED_METHODS.forEach(function (methodName) {
|
|
86
|
-
CANVAS_2D_CAPTURED_METHOD_NAMES[methodName] = true
|
|
87
|
-
})
|
|
88
|
-
CANVAS_2D_CAPTURED_PROPERTIES.forEach(function (propertyName) {
|
|
89
|
-
CANVAS_2D_CAPTURED_PROPERTY_NAMES[propertyName] = true
|
|
85
|
+
CANVAS_2D_CAPTURED_METHODS.concat(CANVAS_2D_CAPTURED_PROPERTIES).forEach(function (name) {
|
|
86
|
+
knownCanvasMembers[name] = true
|
|
90
87
|
})
|
|
91
88
|
|
|
92
89
|
var UNSUPPORTED_REPLAY_OBJECT_NAMES = {
|
|
@@ -243,20 +240,6 @@ function getTypedArrayElementApproxBytes(value) {
|
|
|
243
240
|
return 25
|
|
244
241
|
}
|
|
245
242
|
|
|
246
|
-
function isSerializedTypedArray(value) {
|
|
247
|
-
return (
|
|
248
|
-
value instanceof Float32Array ||
|
|
249
|
-
value instanceof Float64Array ||
|
|
250
|
-
value instanceof Int32Array ||
|
|
251
|
-
value instanceof Uint32Array ||
|
|
252
|
-
value instanceof Uint8Array ||
|
|
253
|
-
value instanceof Uint16Array ||
|
|
254
|
-
value instanceof Int16Array ||
|
|
255
|
-
value instanceof Int8Array ||
|
|
256
|
-
value instanceof Uint8ClampedArray
|
|
257
|
-
)
|
|
258
|
-
}
|
|
259
|
-
|
|
260
243
|
function addTypedArrayApproxBytes(state, value) {
|
|
261
244
|
var elementCount = value.length
|
|
262
245
|
var perElementBytes = getTypedArrayElementApproxBytes(value)
|
|
@@ -481,7 +464,8 @@ function isUnsupportedDrawImageSource(value) {
|
|
|
481
464
|
|
|
482
465
|
export function createCanvas2DCommandRecorder(options) {
|
|
483
466
|
options = options || {}
|
|
484
|
-
var
|
|
467
|
+
var configuration = options.configuration || {}
|
|
468
|
+
var emit = options.emit || noop
|
|
485
469
|
var now = __BUILD_ENV__REPLAY_DEBUG_ENABLED__
|
|
486
470
|
? options.now || Date.now
|
|
487
471
|
: Date.now
|
|
@@ -517,8 +501,6 @@ export function createCanvas2DCommandRecorder(options) {
|
|
|
517
501
|
var snapshotFallbackPatchTargets = new WeakSet()
|
|
518
502
|
var pendingCommandsByContext = new SDKMap()
|
|
519
503
|
var pendingCommandApproxBytes = 0
|
|
520
|
-
var fallbackModeContexts = new WeakSet()
|
|
521
|
-
var persistentFallbackModeContexts = new WeakSet()
|
|
522
504
|
var fallbackReasonByContext = new WeakMap()
|
|
523
505
|
var persistentFallbackReasonByContext = new WeakMap()
|
|
524
506
|
var expiredUnpublishedContexts = new WeakSet()
|
|
@@ -547,7 +529,7 @@ export function createCanvas2DCommandRecorder(options) {
|
|
|
547
529
|
(__BUILD_ENV__REPLAY_DEBUG_ENABLED__ && options.objectRefRegistry) ||
|
|
548
530
|
createCanvasCommandObjectRefRegistry()
|
|
549
531
|
var onCommandOverflow = __BUILD_ENV__REPLAY_DEBUG_ENABLED__
|
|
550
|
-
? options.onCommandOverflow ||
|
|
532
|
+
? options.onCommandOverflow || noop
|
|
551
533
|
: undefined
|
|
552
534
|
var getCanvasId =
|
|
553
535
|
options.getCanvasId ||
|
|
@@ -560,11 +542,11 @@ export function createCanvas2DCommandRecorder(options) {
|
|
|
560
542
|
return '2D'
|
|
561
543
|
}
|
|
562
544
|
var requestSnapshotFallback =
|
|
563
|
-
options.requestSnapshotFallback ||
|
|
545
|
+
options.requestSnapshotFallback || noop
|
|
564
546
|
var onContextDiscovered =
|
|
565
|
-
options.onContextDiscovered ||
|
|
547
|
+
options.onContextDiscovered || noop
|
|
566
548
|
var onContextMutation =
|
|
567
|
-
options.onContextMutation ||
|
|
549
|
+
options.onContextMutation || noop
|
|
568
550
|
var shouldRecordContext =
|
|
569
551
|
options.shouldRecordContext ||
|
|
570
552
|
function () {
|
|
@@ -616,8 +598,8 @@ export function createCanvas2DCommandRecorder(options) {
|
|
|
616
598
|
|
|
617
599
|
function isSnapshotFallbackContext(context) {
|
|
618
600
|
return (
|
|
619
|
-
|
|
620
|
-
|
|
601
|
+
fallbackReasonByContext.has(context) ||
|
|
602
|
+
persistentFallbackReasonByContext.has(context)
|
|
621
603
|
)
|
|
622
604
|
}
|
|
623
605
|
|
|
@@ -656,7 +638,6 @@ export function createCanvas2DCommandRecorder(options) {
|
|
|
656
638
|
|
|
657
639
|
function expireUnpublishedBatch(context) {
|
|
658
640
|
deletePendingBatch(context)
|
|
659
|
-
persistentFallbackModeContexts.add(context)
|
|
660
641
|
expiredUnpublishedContexts.add(context)
|
|
661
642
|
if (!persistentFallbackReasonByContext.has(context)) {
|
|
662
643
|
persistentFallbackReasonByContext.set(
|
|
@@ -917,11 +898,21 @@ export function createCanvas2DCommandRecorder(options) {
|
|
|
917
898
|
scheduleFlush()
|
|
918
899
|
}
|
|
919
900
|
|
|
901
|
+
function discardPrivateCommands(context) {
|
|
902
|
+
if (!isCanvasPrivate(context.canvas, configuration)) return false
|
|
903
|
+
// Private draws change the live bitmap. Resume from pixels when allowed.
|
|
904
|
+
if (!persistentFallbackReasonByContext.has(context) || pendingCommandsByContext.has(context)) {
|
|
905
|
+
markPersistentSnapshotFallback(context, 'canvas_state_reset')
|
|
906
|
+
}
|
|
907
|
+
return true
|
|
908
|
+
}
|
|
909
|
+
|
|
920
910
|
function flushPendingContext(context, flushedAt) {
|
|
921
911
|
var batch = pendingCommandsByContext.get(context)
|
|
922
912
|
if (!batch) {
|
|
923
913
|
return
|
|
924
914
|
}
|
|
915
|
+
if (discardPrivateCommands(context)) return
|
|
925
916
|
if (isSnapshotFallbackContext(context)) {
|
|
926
917
|
if (batch.fallbackDirty && !batch.fallbackSnapshotRequested) {
|
|
927
918
|
requestSnapshotFallback(
|
|
@@ -1034,6 +1025,7 @@ export function createCanvas2DCommandRecorder(options) {
|
|
|
1034
1025
|
if (!trackedContextSet.has(context)) {
|
|
1035
1026
|
return false
|
|
1036
1027
|
}
|
|
1028
|
+
if (discardPrivateCommands(context)) return false
|
|
1037
1029
|
if (captureGenerationByContext.get(context) !== captureGeneration) {
|
|
1038
1030
|
captureGenerationByContext.set(context, captureGeneration)
|
|
1039
1031
|
// reset() accompanies a new replay/full-snapshot canvas baseline, but
|
|
@@ -1049,6 +1041,14 @@ export function createCanvas2DCommandRecorder(options) {
|
|
|
1049
1041
|
return true
|
|
1050
1042
|
}
|
|
1051
1043
|
|
|
1044
|
+
function clearContext(context) {
|
|
1045
|
+
trackedContextSet.delete(context)
|
|
1046
|
+
deletePendingBatch(context)
|
|
1047
|
+
expiredUnpublishedContexts.delete(context)
|
|
1048
|
+
fallbackReasonByContext.delete(context)
|
|
1049
|
+
persistentFallbackReasonByContext.delete(context)
|
|
1050
|
+
}
|
|
1051
|
+
|
|
1052
1052
|
function registerTrackedContext(context, restoreFns) {
|
|
1053
1053
|
if (!context || trackedContextSet.has(context)) {
|
|
1054
1054
|
return false
|
|
@@ -1067,13 +1067,7 @@ export function createCanvas2DCommandRecorder(options) {
|
|
|
1067
1067
|
trackedContexts.push({
|
|
1068
1068
|
context: context,
|
|
1069
1069
|
restore: function () {
|
|
1070
|
-
|
|
1071
|
-
deletePendingBatch(context)
|
|
1072
|
-
expiredUnpublishedContexts.delete(context)
|
|
1073
|
-
fallbackModeContexts.delete(context)
|
|
1074
|
-
persistentFallbackModeContexts.delete(context)
|
|
1075
|
-
fallbackReasonByContext.delete(context)
|
|
1076
|
-
persistentFallbackReasonByContext.delete(context)
|
|
1070
|
+
clearContext(context)
|
|
1077
1071
|
while (restoreFns.length) {
|
|
1078
1072
|
restoreFns.pop()()
|
|
1079
1073
|
}
|
|
@@ -1096,7 +1090,7 @@ export function createCanvas2DCommandRecorder(options) {
|
|
|
1096
1090
|
return false
|
|
1097
1091
|
}
|
|
1098
1092
|
if (shouldRecordContext(context) === false) {
|
|
1099
|
-
|
|
1093
|
+
rejectContext(context)
|
|
1100
1094
|
return false
|
|
1101
1095
|
}
|
|
1102
1096
|
if (!registerTrackedContext(context, [])) {
|
|
@@ -1138,14 +1132,10 @@ export function createCanvas2DCommandRecorder(options) {
|
|
|
1138
1132
|
if (!context) {
|
|
1139
1133
|
return
|
|
1140
1134
|
}
|
|
1135
|
+
// A hidden region can become visible while the same context stays alive.
|
|
1136
|
+
if (discardPrivateCommands(context)) return
|
|
1141
1137
|
rejectedContextSet.add(context)
|
|
1142
|
-
|
|
1143
|
-
deletePendingBatch(context)
|
|
1144
|
-
expiredUnpublishedContexts.delete(context)
|
|
1145
|
-
fallbackModeContexts.delete(context)
|
|
1146
|
-
persistentFallbackModeContexts.delete(context)
|
|
1147
|
-
fallbackReasonByContext.delete(context)
|
|
1148
|
-
persistentFallbackReasonByContext.delete(context)
|
|
1138
|
+
clearContext(context)
|
|
1149
1139
|
}
|
|
1150
1140
|
|
|
1151
1141
|
function enableSnapshotFallbackForContext(
|
|
@@ -1154,13 +1144,9 @@ export function createCanvas2DCommandRecorder(options) {
|
|
|
1154
1144
|
isGlobalOverflow,
|
|
1155
1145
|
persistent
|
|
1156
1146
|
) {
|
|
1157
|
-
var fallbackContexts = persistent
|
|
1158
|
-
? persistentFallbackModeContexts
|
|
1159
|
-
: fallbackModeContexts
|
|
1160
1147
|
var fallbackReasons = persistent
|
|
1161
1148
|
? persistentFallbackReasonByContext
|
|
1162
1149
|
: fallbackReasonByContext
|
|
1163
|
-
fallbackContexts.add(context)
|
|
1164
1150
|
if (!fallbackReasons.has(context)) {
|
|
1165
1151
|
fallbackReasons.set(
|
|
1166
1152
|
context,
|
|
@@ -1314,6 +1300,41 @@ export function createCanvas2DCommandRecorder(options) {
|
|
|
1314
1300
|
}
|
|
1315
1301
|
}
|
|
1316
1302
|
|
|
1303
|
+
function recordMutation(context, name, argsOrValue, setter, alwaysSnapshotFallback) {
|
|
1304
|
+
notifyContextMutation(context)
|
|
1305
|
+
try {
|
|
1306
|
+
if (isSnapshotFallbackContext(context)) {
|
|
1307
|
+
markSnapshotFallbackDirty(context)
|
|
1308
|
+
return false
|
|
1309
|
+
}
|
|
1310
|
+
if (alwaysSnapshotFallback) {
|
|
1311
|
+
enableSnapshotFallbackForContext(
|
|
1312
|
+
context,
|
|
1313
|
+
setter ? 'unsupported_canvas_property' : 'unsupported_canvas_method',
|
|
1314
|
+
false,
|
|
1315
|
+
true
|
|
1316
|
+
)
|
|
1317
|
+
return false
|
|
1318
|
+
}
|
|
1319
|
+
} catch (_) {
|
|
1320
|
+
return false
|
|
1321
|
+
}
|
|
1322
|
+
|
|
1323
|
+
try {
|
|
1324
|
+
var reason = !setter && name === 'drawImage' && isUnsupportedDrawImageSource(argsOrValue[0])
|
|
1325
|
+
if (reason) {
|
|
1326
|
+
enableSnapshotFallbackForContext(context, reason)
|
|
1327
|
+
} else {
|
|
1328
|
+
captureCommand(context, name, setter ? [argsOrValue] : argsOrValue, setter)
|
|
1329
|
+
}
|
|
1330
|
+
} catch (_) {
|
|
1331
|
+
try {
|
|
1332
|
+
enableSnapshotFallbackForContext(context, 'command_serialization_error')
|
|
1333
|
+
} catch (_) {}
|
|
1334
|
+
}
|
|
1335
|
+
return true
|
|
1336
|
+
}
|
|
1337
|
+
|
|
1317
1338
|
function patchMethodOnTarget(
|
|
1318
1339
|
target,
|
|
1319
1340
|
methodName,
|
|
@@ -1328,55 +1349,9 @@ export function createCanvas2DCommandRecorder(options) {
|
|
|
1328
1349
|
maybeTrackContext(this)
|
|
1329
1350
|
var shouldCapture = shouldCaptureContext(this)
|
|
1330
1351
|
var result = originalMethod.apply(this, arguments)
|
|
1331
|
-
if (shouldCapture) {
|
|
1332
|
-
notifyContextMutation(this)
|
|
1333
|
-
}
|
|
1334
|
-
if (shouldCapture && alwaysSnapshotFallback) {
|
|
1335
|
-
try {
|
|
1336
|
-
if (isSnapshotFallbackContext(this)) {
|
|
1337
|
-
markSnapshotFallbackDirty(this)
|
|
1338
|
-
} else {
|
|
1339
|
-
enableSnapshotFallbackForContext(
|
|
1340
|
-
this,
|
|
1341
|
-
'unsupported_canvas_method',
|
|
1342
|
-
false,
|
|
1343
|
-
true
|
|
1344
|
-
)
|
|
1345
|
-
}
|
|
1346
|
-
} catch (_) {}
|
|
1347
|
-
return result
|
|
1348
|
-
}
|
|
1349
|
-
if (shouldCapture && isSnapshotFallbackContext(this)) {
|
|
1350
|
-
try {
|
|
1351
|
-
markSnapshotFallbackDirty(this)
|
|
1352
|
-
} catch (_) {}
|
|
1353
|
-
return result
|
|
1354
|
-
}
|
|
1355
|
-
if (shouldCapture) {
|
|
1356
|
-
try {
|
|
1357
|
-
var drawImageFallbackReason =
|
|
1358
|
-
methodName === 'drawImage'
|
|
1359
|
-
? isUnsupportedDrawImageSource(arguments[0])
|
|
1360
|
-
: undefined
|
|
1361
|
-
if (drawImageFallbackReason) {
|
|
1362
|
-
enableSnapshotFallbackForContext(
|
|
1363
|
-
this,
|
|
1364
|
-
drawImageFallbackReason
|
|
1365
|
-
)
|
|
1366
|
-
} else {
|
|
1367
|
-
captureCommand(this, methodName, arguments, false)
|
|
1368
|
-
}
|
|
1369
|
-
} catch (_) {
|
|
1370
|
-
try {
|
|
1371
|
-
enableSnapshotFallbackForContext(
|
|
1372
|
-
this,
|
|
1373
|
-
'command_serialization_error'
|
|
1374
|
-
)
|
|
1375
|
-
} catch (_) {}
|
|
1376
|
-
}
|
|
1377
|
-
}
|
|
1378
1352
|
if (
|
|
1379
1353
|
shouldCapture &&
|
|
1354
|
+
recordMutation(this, methodName, arguments, false, alwaysSnapshotFallback) &&
|
|
1380
1355
|
(methodName === 'createLinearGradient' ||
|
|
1381
1356
|
methodName === 'createRadialGradient' ||
|
|
1382
1357
|
methodName === 'createConicGradient')
|
|
@@ -1424,40 +1399,8 @@ export function createCanvas2DCommandRecorder(options) {
|
|
|
1424
1399
|
if (originalDescriptor && originalDescriptor.set) {
|
|
1425
1400
|
originalDescriptor.set.call(this, value)
|
|
1426
1401
|
}
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
notifyContextMutation(this)
|
|
1430
|
-
if (alwaysSnapshotFallback) {
|
|
1431
|
-
try {
|
|
1432
|
-
if (isSnapshotFallbackContext(this)) {
|
|
1433
|
-
markSnapshotFallbackDirty(this)
|
|
1434
|
-
} else {
|
|
1435
|
-
enableSnapshotFallbackForContext(
|
|
1436
|
-
this,
|
|
1437
|
-
'unsupported_canvas_property',
|
|
1438
|
-
false,
|
|
1439
|
-
true
|
|
1440
|
-
)
|
|
1441
|
-
}
|
|
1442
|
-
} catch (_) {}
|
|
1443
|
-
return
|
|
1444
|
-
}
|
|
1445
|
-
if (isSnapshotFallbackContext(this)) {
|
|
1446
|
-
try {
|
|
1447
|
-
markSnapshotFallbackDirty(this)
|
|
1448
|
-
} catch (_) {}
|
|
1449
|
-
return
|
|
1450
|
-
}
|
|
1451
|
-
try {
|
|
1452
|
-
captureCommand(this, propertyName, [value], true)
|
|
1453
|
-
} catch (_) {
|
|
1454
|
-
try {
|
|
1455
|
-
enableSnapshotFallbackForContext(
|
|
1456
|
-
this,
|
|
1457
|
-
'command_serialization_error'
|
|
1458
|
-
)
|
|
1459
|
-
} catch (_) {}
|
|
1460
|
-
}
|
|
1402
|
+
if (shouldCaptureContext(this)) {
|
|
1403
|
+
recordMutation(this, propertyName, value, true, alwaysSnapshotFallback)
|
|
1461
1404
|
}
|
|
1462
1405
|
}
|
|
1463
1406
|
try {
|
|
@@ -1500,12 +1443,7 @@ export function createCanvas2DCommandRecorder(options) {
|
|
|
1500
1443
|
return
|
|
1501
1444
|
}
|
|
1502
1445
|
propertyNames.forEach(function (propertyName) {
|
|
1503
|
-
if (
|
|
1504
|
-
propertyName === 'constructor' ||
|
|
1505
|
-
CANVAS_2D_CAPTURED_METHOD_NAMES[propertyName] ||
|
|
1506
|
-
CANVAS_2D_CAPTURED_PROPERTY_NAMES[propertyName] ||
|
|
1507
|
-
CANVAS_2D_NON_MUTATING_METHODS[propertyName]
|
|
1508
|
-
) {
|
|
1446
|
+
if (propertyName === 'constructor' || knownCanvasMembers[propertyName]) {
|
|
1509
1447
|
return
|
|
1510
1448
|
}
|
|
1511
1449
|
var descriptor
|
|
@@ -1546,54 +1484,6 @@ export function createCanvas2DCommandRecorder(options) {
|
|
|
1546
1484
|
})
|
|
1547
1485
|
}
|
|
1548
1486
|
|
|
1549
|
-
function patchPrototype(context) {
|
|
1550
|
-
var prototype = Object.getPrototypeOf(context)
|
|
1551
|
-
if (!prototype || prototype === Object.prototype) {
|
|
1552
|
-
return false
|
|
1553
|
-
}
|
|
1554
|
-
var existingRecord = patchedPrototypeRecords.find(function (record) {
|
|
1555
|
-
return record.prototype === prototype
|
|
1556
|
-
})
|
|
1557
|
-
if (existingRecord) {
|
|
1558
|
-
return true
|
|
1559
|
-
}
|
|
1560
|
-
if (
|
|
1561
|
-
patchedPrototypeRecords.length >=
|
|
1562
|
-
MAX_PATCHED_CANVAS_PROTOTYPE_RECORDS
|
|
1563
|
-
) {
|
|
1564
|
-
return false
|
|
1565
|
-
}
|
|
1566
|
-
|
|
1567
|
-
var restoreFns = []
|
|
1568
|
-
CANVAS_2D_CAPTURED_METHODS.forEach(function (methodName) {
|
|
1569
|
-
if (
|
|
1570
|
-
typeof prototype[methodName] === 'function' &&
|
|
1571
|
-
!patchMethodOnTarget(prototype, methodName, restoreFns)
|
|
1572
|
-
) {
|
|
1573
|
-
snapshotFallbackPatchTargets.add(prototype)
|
|
1574
|
-
}
|
|
1575
|
-
})
|
|
1576
|
-
CANVAS_2D_CAPTURED_PROPERTIES.forEach(function (propertyName) {
|
|
1577
|
-
if (
|
|
1578
|
-
getPropertyDescriptor(prototype, propertyName) &&
|
|
1579
|
-
!patchPropertyOnTarget(prototype, propertyName, restoreFns)
|
|
1580
|
-
) {
|
|
1581
|
-
snapshotFallbackPatchTargets.add(prototype)
|
|
1582
|
-
}
|
|
1583
|
-
})
|
|
1584
|
-
patchUnknownMutationsOnTarget(prototype, restoreFns)
|
|
1585
|
-
|
|
1586
|
-
patchedPrototypeRecords.push({
|
|
1587
|
-
prototype: prototype,
|
|
1588
|
-
restore: function () {
|
|
1589
|
-
while (restoreFns.length) {
|
|
1590
|
-
restoreFns.pop()()
|
|
1591
|
-
}
|
|
1592
|
-
}
|
|
1593
|
-
})
|
|
1594
|
-
return true
|
|
1595
|
-
}
|
|
1596
|
-
|
|
1597
1487
|
function patchSharedPrototype(prototype) {
|
|
1598
1488
|
if (!prototype || prototype === Object.prototype) {
|
|
1599
1489
|
return false
|
|
@@ -1612,23 +1502,7 @@ export function createCanvas2DCommandRecorder(options) {
|
|
|
1612
1502
|
}
|
|
1613
1503
|
|
|
1614
1504
|
var restoreFns = []
|
|
1615
|
-
|
|
1616
|
-
if (
|
|
1617
|
-
typeof prototype[methodName] === 'function' &&
|
|
1618
|
-
!patchMethodOnTarget(prototype, methodName, restoreFns)
|
|
1619
|
-
) {
|
|
1620
|
-
snapshotFallbackPatchTargets.add(prototype)
|
|
1621
|
-
}
|
|
1622
|
-
})
|
|
1623
|
-
CANVAS_2D_CAPTURED_PROPERTIES.forEach(function (propertyName) {
|
|
1624
|
-
if (
|
|
1625
|
-
getPropertyDescriptor(prototype, propertyName) &&
|
|
1626
|
-
!patchPropertyOnTarget(prototype, propertyName, restoreFns)
|
|
1627
|
-
) {
|
|
1628
|
-
snapshotFallbackPatchTargets.add(prototype)
|
|
1629
|
-
}
|
|
1630
|
-
})
|
|
1631
|
-
patchUnknownMutationsOnTarget(prototype, restoreFns)
|
|
1505
|
+
patchContextTarget(prototype, restoreFns, true)
|
|
1632
1506
|
|
|
1633
1507
|
patchedPrototypeRecords.push({
|
|
1634
1508
|
prototype: prototype,
|
|
@@ -1641,44 +1515,47 @@ export function createCanvas2DCommandRecorder(options) {
|
|
|
1641
1515
|
return true
|
|
1642
1516
|
}
|
|
1643
1517
|
|
|
1644
|
-
function
|
|
1518
|
+
function patchContextTarget(target, restoreFns, isPrototype) {
|
|
1645
1519
|
CANVAS_2D_CAPTURED_METHODS.forEach(function (methodName) {
|
|
1646
1520
|
if (
|
|
1647
|
-
typeof
|
|
1648
|
-
!patchMethodOnTarget(
|
|
1521
|
+
typeof target[methodName] === 'function' &&
|
|
1522
|
+
!patchMethodOnTarget(target, methodName, restoreFns)
|
|
1649
1523
|
) {
|
|
1650
|
-
snapshotFallbackPatchTargets.add(
|
|
1524
|
+
snapshotFallbackPatchTargets.add(target)
|
|
1651
1525
|
}
|
|
1652
1526
|
})
|
|
1653
1527
|
|
|
1654
1528
|
CANVAS_2D_CAPTURED_PROPERTIES.forEach(function (propertyName) {
|
|
1655
|
-
if (
|
|
1656
|
-
|
|
1529
|
+
if (
|
|
1530
|
+
(!isPrototype || getPropertyDescriptor(target, propertyName)) &&
|
|
1531
|
+
!patchPropertyOnTarget(target, propertyName, restoreFns)
|
|
1532
|
+
) {
|
|
1533
|
+
snapshotFallbackPatchTargets.add(target)
|
|
1657
1534
|
}
|
|
1658
1535
|
})
|
|
1659
|
-
patchUnknownMutationsOnTarget(
|
|
1536
|
+
patchUnknownMutationsOnTarget(target, restoreFns)
|
|
1660
1537
|
}
|
|
1661
1538
|
|
|
1662
1539
|
function patchContext(context) {
|
|
1663
1540
|
if (stopped || !context || trackedContextSet.has(context)) {
|
|
1664
|
-
return
|
|
1541
|
+
return noop
|
|
1665
1542
|
}
|
|
1666
1543
|
|
|
1667
1544
|
var restoreFns = []
|
|
1668
1545
|
var prototype = Object.getPrototypeOf(context)
|
|
1669
1546
|
if (prototype && prototype !== Object.prototype) {
|
|
1670
|
-
if (!
|
|
1671
|
-
return
|
|
1547
|
+
if (!patchSharedPrototype(prototype)) {
|
|
1548
|
+
return noop
|
|
1672
1549
|
}
|
|
1673
1550
|
} else {
|
|
1674
|
-
|
|
1551
|
+
patchContextTarget(context, restoreFns, false)
|
|
1675
1552
|
}
|
|
1676
1553
|
|
|
1677
1554
|
if (!registerTrackedContext(context, restoreFns)) {
|
|
1678
1555
|
while (restoreFns.length) {
|
|
1679
1556
|
restoreFns.pop()()
|
|
1680
1557
|
}
|
|
1681
|
-
return
|
|
1558
|
+
return noop
|
|
1682
1559
|
}
|
|
1683
1560
|
if (
|
|
1684
1561
|
snapshotFallbackPatchTargets.has(context) ||
|
|
@@ -1693,13 +1570,7 @@ export function createCanvas2DCommandRecorder(options) {
|
|
|
1693
1570
|
}
|
|
1694
1571
|
|
|
1695
1572
|
return function () {
|
|
1696
|
-
|
|
1697
|
-
deletePendingBatch(context)
|
|
1698
|
-
expiredUnpublishedContexts.delete(context)
|
|
1699
|
-
fallbackModeContexts.delete(context)
|
|
1700
|
-
persistentFallbackModeContexts.delete(context)
|
|
1701
|
-
fallbackReasonByContext.delete(context)
|
|
1702
|
-
persistentFallbackReasonByContext.delete(context)
|
|
1573
|
+
clearContext(context)
|
|
1703
1574
|
var trackedIndex = trackedContexts.findIndex(function (tracked) {
|
|
1704
1575
|
return tracked.context === context
|
|
1705
1576
|
})
|
|
@@ -1716,8 +1587,6 @@ export function createCanvas2DCommandRecorder(options) {
|
|
|
1716
1587
|
scheduledFlushId = undefined
|
|
1717
1588
|
}
|
|
1718
1589
|
clearPendingBatches()
|
|
1719
|
-
fallbackModeContexts = new WeakSet()
|
|
1720
|
-
persistentFallbackModeContexts = new WeakSet()
|
|
1721
1590
|
fallbackReasonByContext = new WeakMap()
|
|
1722
1591
|
persistentFallbackReasonByContext = new WeakMap()
|
|
1723
1592
|
expiredUnpublishedContexts = new WeakSet()
|
|
@@ -1735,34 +1604,29 @@ export function createCanvas2DCommandRecorder(options) {
|
|
|
1735
1604
|
objectRefRegistry.reset()
|
|
1736
1605
|
}
|
|
1737
1606
|
|
|
1738
|
-
function
|
|
1739
|
-
paused = true
|
|
1607
|
+
function resetPendingCapture() {
|
|
1740
1608
|
if (scheduledFlushId !== undefined) {
|
|
1741
1609
|
cancelAnimationFrameImpl(scheduledFlushId)
|
|
1742
1610
|
scheduledFlushId = undefined
|
|
1743
1611
|
}
|
|
1744
1612
|
clearPendingBatches()
|
|
1745
|
-
fallbackModeContexts = new WeakSet()
|
|
1746
1613
|
fallbackReasonByContext = new WeakMap()
|
|
1747
1614
|
rejectedContextSet = new WeakSet()
|
|
1748
1615
|
objectRefRegistry.reset()
|
|
1749
1616
|
}
|
|
1750
1617
|
|
|
1618
|
+
function pause() {
|
|
1619
|
+
paused = true
|
|
1620
|
+
resetPendingCapture()
|
|
1621
|
+
}
|
|
1622
|
+
|
|
1751
1623
|
function resume() {
|
|
1752
1624
|
paused = false
|
|
1753
1625
|
}
|
|
1754
1626
|
|
|
1755
1627
|
function reset() {
|
|
1756
1628
|
captureGeneration += 1
|
|
1757
|
-
|
|
1758
|
-
cancelAnimationFrameImpl(scheduledFlushId)
|
|
1759
|
-
scheduledFlushId = undefined
|
|
1760
|
-
}
|
|
1761
|
-
clearPendingBatches()
|
|
1762
|
-
fallbackModeContexts = new WeakSet()
|
|
1763
|
-
fallbackReasonByContext = new WeakMap()
|
|
1764
|
-
rejectedContextSet = new WeakSet()
|
|
1765
|
-
objectRefRegistry.reset()
|
|
1629
|
+
resetPendingCapture()
|
|
1766
1630
|
}
|
|
1767
1631
|
|
|
1768
1632
|
function forceSnapshotFallback(context, reason) {
|
|
@@ -1786,7 +1650,6 @@ export function createCanvas2DCommandRecorder(options) {
|
|
|
1786
1650
|
return
|
|
1787
1651
|
}
|
|
1788
1652
|
expiredUnpublishedContexts.delete(context)
|
|
1789
|
-
persistentFallbackModeContexts.add(context)
|
|
1790
1653
|
if (!persistentFallbackReasonByContext.has(context)) {
|
|
1791
1654
|
persistentFallbackReasonByContext.set(
|
|
1792
1655
|
context,
|
|
@@ -54,6 +54,10 @@ export function startCanvasCommandCapture(options) {
|
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
+
function getRecordingDecision(canvas) {
|
|
58
|
+
return getReplayCanvasRecordingDecision(configuration, canvas)
|
|
59
|
+
}
|
|
60
|
+
|
|
57
61
|
var emit = options.emit
|
|
58
62
|
var now = __BUILD_ENV__REPLAY_DEBUG_ENABLED__
|
|
59
63
|
? options.now || Date.now
|
|
@@ -737,10 +741,7 @@ export function startCanvasCommandCapture(options) {
|
|
|
737
741
|
return
|
|
738
742
|
}
|
|
739
743
|
|
|
740
|
-
var recordingDecision =
|
|
741
|
-
configuration,
|
|
742
|
-
canvas
|
|
743
|
-
)
|
|
744
|
+
var recordingDecision = getRecordingDecision(canvas)
|
|
744
745
|
if (recordingDecision === false) {
|
|
745
746
|
state.$rDirty = false
|
|
746
747
|
state.$rReason = undefined
|
|
@@ -904,10 +905,7 @@ export function startCanvasCommandCapture(options) {
|
|
|
904
905
|
}
|
|
905
906
|
var canvas = context.canvas
|
|
906
907
|
var state = getFallbackState(canvas)
|
|
907
|
-
var recordingDecision =
|
|
908
|
-
configuration,
|
|
909
|
-
canvas
|
|
910
|
-
)
|
|
908
|
+
var recordingDecision = getRecordingDecision(canvas)
|
|
911
909
|
if (recordingDecision === false) {
|
|
912
910
|
clearFallbackTimer(state)
|
|
913
911
|
state.$rDirty = false
|
|
@@ -1002,15 +1000,13 @@ export function startCanvasCommandCapture(options) {
|
|
|
1002
1000
|
var recorder =
|
|
1003
1001
|
(__BUILD_ENV__REPLAY_DEBUG_ENABLED__ && options.commandRecorder) ||
|
|
1004
1002
|
createCanvas2DCommandRecorder({
|
|
1003
|
+
configuration: configuration,
|
|
1005
1004
|
shouldRecordContext: function (context) {
|
|
1006
1005
|
return (
|
|
1007
1006
|
context &&
|
|
1008
1007
|
context.canvas &&
|
|
1009
1008
|
!isReplayInternalCanvas(context.canvas) &&
|
|
1010
|
-
|
|
1011
|
-
configuration,
|
|
1012
|
-
context.canvas
|
|
1013
|
-
) !== false
|
|
1009
|
+
getRecordingDecision(context.canvas) !== false
|
|
1014
1010
|
)
|
|
1015
1011
|
},
|
|
1016
1012
|
getCanvasId: function (context) {
|
|
@@ -1360,7 +1356,7 @@ export function startCanvasCommandCapture(options) {
|
|
|
1360
1356
|
foundUnseenCanvas = true
|
|
1361
1357
|
if (
|
|
1362
1358
|
stopped ||
|
|
1363
|
-
|
|
1359
|
+
getRecordingDecision(canvas) === false
|
|
1364
1360
|
) {
|
|
1365
1361
|
return
|
|
1366
1362
|
}
|
|
@@ -1474,10 +1470,7 @@ export function startCanvasCommandCapture(options) {
|
|
|
1474
1470
|
continue
|
|
1475
1471
|
}
|
|
1476
1472
|
canvasId = getSerializedNodeId(canvas)
|
|
1477
|
-
recordingDecision =
|
|
1478
|
-
configuration,
|
|
1479
|
-
canvas
|
|
1480
|
-
)
|
|
1473
|
+
recordingDecision = getRecordingDecision(canvas)
|
|
1481
1474
|
if (
|
|
1482
1475
|
(!canvasId && canvasId !== 0) ||
|
|
1483
1476
|
initialSnapshotCanvases.has(canvas) ||
|
|
@@ -1639,7 +1632,7 @@ export function startCanvasCommandCapture(options) {
|
|
|
1639
1632
|
!isReplayInternalCanvas(this)
|
|
1640
1633
|
if (
|
|
1641
1634
|
shouldRecordContext &&
|
|
1642
|
-
|
|
1635
|
+
getRecordingDecision(this) === false
|
|
1643
1636
|
) {
|
|
1644
1637
|
shouldRecordContext = false
|
|
1645
1638
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { noop } from '@cloudcare/browser-core'
|
|
2
|
+
|
|
3
|
+
export const replayCanvasSupported = false
|
|
4
|
+
|
|
5
|
+
export function startCanvasCommandCapture() {
|
|
6
|
+
return { flush: noop, reset: noop, stop: noop }
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function startContinuousCanvasSnapshotLoop() {
|
|
10
|
+
return { reset: noop, stop: noop }
|
|
11
|
+
}
|
|
@@ -8,7 +8,7 @@ function arrayBufferToBase64(buffer) {
|
|
|
8
8
|
return btoa(binary)
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
function
|
|
11
|
+
export function isSerializedTypedArray(value) {
|
|
12
12
|
return (
|
|
13
13
|
value instanceof Float32Array ||
|
|
14
14
|
value instanceof Float64Array ||
|
|
@@ -39,7 +39,7 @@ function serializeCanvasCommandArgWithRegistry(value, context, registry) {
|
|
|
39
39
|
return value
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
if (
|
|
42
|
+
if (isSerializedTypedArray(value)) {
|
|
43
43
|
return {
|
|
44
44
|
rr_type: value.constructor.name,
|
|
45
45
|
args: [Array.prototype.slice.call(value)]
|