@cloudcare/browser-rum 3.3.23 → 3.3.25
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/rum.js +7 -4
- 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 +9 -6
- package/cjs/domain/privacy.js.map +1 -1
- package/cjs/domain/replay/record/canvasCommandCapture.js +91 -179
- package/cjs/domain/replay/record/canvasCommandCapture.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 +25 -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/mutationObserver.js +3 -12
- package/cjs/domain/replay/record/mutationObserver.js.map +1 -1
- package/cjs/domain/replay/record/record.js +1 -1
- package/cjs/domain/replay/record/record.js.map +1 -1
- package/cjs/domain/replay/record/serialize.js +15 -13
- 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 +77 -45
- 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 +30 -40
- 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/trackViews.js +3 -0
- package/cjs/domain/rumEventsCollection/view/trackViews.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 +2 -5
- package/esm/boot/buildEnv.js.map +1 -1
- package/esm/boot/disabledRumPublicApi.js +2 -35
- 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 +2 -260
- package/esm/boot/perStartRum.js.map +1 -1
- package/esm/boot/recorderApi.js +2 -338
- package/esm/boot/recorderApi.js.map +1 -1
- package/esm/boot/recorderApiStub.js +2 -21
- package/esm/boot/recorderApiStub.js.map +1 -1
- package/esm/boot/rum.entry.js +2 -13
- package/esm/boot/rum.entry.js.map +1 -1
- package/esm/boot/rum.js +2 -184
- package/esm/boot/rum.js.map +1 -1
- package/esm/boot/rum.slim.entry.js +2 -7
- package/esm/boot/rum.slim.entry.js.map +1 -1
- package/esm/boot/rumEntryFactory.js +2 -18
- package/esm/boot/rumEntryFactory.js.map +1 -1
- package/esm/boot/rumPublicApi.js +2 -344
- package/esm/boot/rumPublicApi.js.map +1 -1
- package/esm/boot/rumRecorderApiStub.js +2 -13
- package/esm/boot/rumRecorderApiStub.js.map +1 -1
- package/esm/boot/rumSlimConfiguration.js +2 -10
- package/esm/boot/rumSlimConfiguration.js.map +1 -1
- package/esm/boot/sessionReplayPublicApi.js +2 -43
- package/esm/boot/sessionReplayPublicApi.js.map +1 -1
- package/esm/boot/startRecording.js +2 -444
- package/esm/boot/startRecording.js.map +1 -1
- package/esm/constants.js +2 -28
- package/esm/constants.js.map +1 -1
- package/esm/domain/assembly.js +2 -213
- package/esm/domain/assembly.js.map +1 -1
- package/esm/domain/configuration.js +2 -323
- package/esm/domain/configuration.js.map +1 -1
- package/esm/domain/contexts/commonContext.js +2 -8
- package/esm/domain/contexts/commonContext.js.map +1 -1
- package/esm/domain/contexts/displayContext.js +2 -16
- package/esm/domain/contexts/displayContext.js.map +1 -1
- package/esm/domain/contexts/foregroundContexts.js +2 -103
- package/esm/domain/contexts/foregroundContexts.js.map +1 -1
- package/esm/domain/contexts/internalContext.js +2 -41
- package/esm/domain/contexts/internalContext.js.map +1 -1
- package/esm/domain/contexts/pageStateHistory.js +2 -104
- package/esm/domain/contexts/pageStateHistory.js.map +1 -1
- package/esm/domain/contexts/urlContexts.js +2 -85
- package/esm/domain/contexts/urlContexts.js.map +1 -1
- package/esm/domain/contexts/viewContexts.js +2 -45
- package/esm/domain/contexts/viewContexts.js.map +1 -1
- package/esm/domain/deflate/deflateEncoder.js +2 -592
- package/esm/domain/deflate/deflateEncoder.js.map +1 -1
- package/esm/domain/deflate/deflateWorker.js +2 -225
- package/esm/domain/deflate/deflateWorker.js.map +1 -1
- package/esm/domain/deflate/index.js +2 -3
- package/esm/domain/deflate/index.js.map +1 -1
- package/esm/domain/domMutationObservable.js +2 -62
- package/esm/domain/domMutationObservable.js.map +1 -1
- package/esm/domain/encoderStreamId.js +2 -6
- package/esm/domain/encoderStreamId.js.map +1 -1
- package/esm/domain/firstInputPolyfill.js +2 -77
- package/esm/domain/firstInputPolyfill.js.map +1 -1
- package/esm/domain/initViewportObservable.js +2 -36
- package/esm/domain/initViewportObservable.js.map +1 -1
- package/esm/domain/locationChangeObservable.js +2 -65
- package/esm/domain/locationChangeObservable.js.map +1 -1
- package/esm/domain/performanceObservable.js +2 -116
- package/esm/domain/performanceObservable.js.map +1 -1
- package/esm/domain/performanceUtils.js +2 -45
- package/esm/domain/performanceUtils.js.map +1 -1
- package/esm/domain/plugins.js +2 -59
- package/esm/domain/plugins.js.map +1 -1
- package/esm/domain/privacy.js +2 -266
- package/esm/domain/privacy.js.map +1 -1
- package/esm/domain/replay/record/canvasAutoSnapshot.js +2 -9
- package/esm/domain/replay/record/canvasAutoSnapshot.js.map +1 -1
- package/esm/domain/replay/record/canvasCommandCapture.js +2 -1275
- package/esm/domain/replay/record/canvasCommandCapture.js.map +1 -1
- package/esm/domain/replay/record/canvasCommandObserver.js +2 -1207
- 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 +2 -111
- package/esm/domain/replay/record/canvasCommandSerializeArgs.js.map +1 -1
- package/esm/domain/replay/record/canvasContext.js +2 -50
- package/esm/domain/replay/record/canvasContext.js.map +1 -1
- package/esm/domain/replay/record/canvasContinuousScheduler.js +2 -378
- package/esm/domain/replay/record/canvasContinuousScheduler.js.map +1 -1
- package/esm/domain/replay/record/canvasEncodeBridge.js +2 -692
- package/esm/domain/replay/record/canvasEncodeBridge.js.map +1 -1
- package/esm/domain/replay/record/canvasEncodeWorker.js +2 -164
- package/esm/domain/replay/record/canvasEncodeWorker.js.map +1 -1
- package/esm/domain/replay/record/canvasFrameSignature.js +2 -75
- package/esm/domain/replay/record/canvasFrameSignature.js.map +1 -1
- package/esm/domain/replay/record/canvasMutationRecord.js +2 -26
- package/esm/domain/replay/record/canvasMutationRecord.js.map +1 -1
- package/esm/domain/replay/record/canvasObserver.js +2 -420
- package/esm/domain/replay/record/canvasObserver.js.map +1 -1
- package/esm/domain/replay/record/canvasSerializeArgs.js +2 -101
- package/esm/domain/replay/record/canvasSerializeArgs.js.map +1 -1
- package/esm/domain/replay/record/canvasWebGLPluginHost.js +2 -26
- package/esm/domain/replay/record/canvasWebGLPluginHost.js.map +1 -1
- package/esm/domain/replay/record/elementsScrollPositions.js +2 -23
- package/esm/domain/replay/record/elementsScrollPositions.js.map +1 -1
- package/esm/domain/replay/record/index.js +2 -4
- package/esm/domain/replay/record/index.js.map +1 -1
- package/esm/domain/replay/record/mutationBatch.js +2 -562
- package/esm/domain/replay/record/mutationBatch.js.map +1 -1
- package/esm/domain/replay/record/mutationObserver.js +2 -2332
- package/esm/domain/replay/record/mutationObserver.js.map +1 -1
- package/esm/domain/replay/record/mutationResourceBudget.js +2 -137
- package/esm/domain/replay/record/mutationResourceBudget.js.map +1 -1
- package/esm/domain/replay/record/observers.js +2 -624
- package/esm/domain/replay/record/observers.js.map +1 -1
- package/esm/domain/replay/record/privacy.js +2 -1
- package/esm/domain/replay/record/privacy.js.map +1 -1
- package/esm/domain/replay/record/record.js +2 -3511
- package/esm/domain/replay/record/record.js.map +1 -1
- package/esm/domain/replay/record/serializationUtils.js +2 -677
- package/esm/domain/replay/record/serializationUtils.js.map +1 -1
- package/esm/domain/replay/record/serialize.js +2 -735
- package/esm/domain/replay/record/serialize.js.map +1 -1
- package/esm/domain/replay/record/shadowRootsController.js +2 -902
- package/esm/domain/replay/record/shadowRootsController.js.map +1 -1
- package/esm/domain/replay/record/utils.js +2 -36
- package/esm/domain/replay/record/utils.js.map +1 -1
- package/esm/domain/replay/record/viewports.js +2 -58
- package/esm/domain/replay/record/viewports.js.map +1 -1
- package/esm/domain/replay/replayStats.js +2 -59
- package/esm/domain/replay/replayStats.js.map +1 -1
- package/esm/domain/replay/segmentCollection/buildReplayPayload.js +2 -31
- package/esm/domain/replay/segmentCollection/buildReplayPayload.js.map +1 -1
- package/esm/domain/replay/segmentCollection/index.js +2 -3
- package/esm/domain/replay/segmentCollection/index.js.map +1 -1
- package/esm/domain/replay/segmentCollection/segment.js +2 -415
- package/esm/domain/replay/segmentCollection/segment.js.map +1 -1
- package/esm/domain/replay/segmentCollection/segmentCollection.js +2 -1114
- package/esm/domain/replay/segmentCollection/segmentCollection.js.map +1 -1
- package/esm/domain/replay/startRecordBridge.js +2 -13
- package/esm/domain/replay/startRecordBridge.js.map +1 -1
- package/esm/domain/replay/timeAnchor.js +2 -20
- package/esm/domain/replay/timeAnchor.js.map +1 -1
- package/esm/domain/replayCanvasSupported.js +2 -0
- package/esm/domain/replayCanvasSupported.js.map +1 -0
- package/esm/domain/requestCollection.js +2 -121
- package/esm/domain/requestCollection.js.map +1 -1
- package/esm/domain/rumEventsCollection/actions/actionCollection.js +2 -83
- package/esm/domain/rumEventsCollection/actions/actionCollection.js.map +1 -1
- package/esm/domain/rumEventsCollection/actions/clickChain.js +2 -62
- package/esm/domain/rumEventsCollection/actions/clickChain.js.map +1 -1
- package/esm/domain/rumEventsCollection/actions/computeFrustration.js +2 -67
- package/esm/domain/rumEventsCollection/actions/computeFrustration.js.map +1 -1
- package/esm/domain/rumEventsCollection/actions/getActionNameFromElement.js +2 -279
- package/esm/domain/rumEventsCollection/actions/getActionNameFromElement.js.map +1 -1
- package/esm/domain/rumEventsCollection/actions/getSelectorsFromElement.js +2 -233
- package/esm/domain/rumEventsCollection/actions/getSelectorsFromElement.js.map +1 -1
- package/esm/domain/rumEventsCollection/actions/interactionSelectorCache.js +2 -21
- package/esm/domain/rumEventsCollection/actions/interactionSelectorCache.js.map +1 -1
- package/esm/domain/rumEventsCollection/actions/listenActionEvents.js +2 -67
- package/esm/domain/rumEventsCollection/actions/listenActionEvents.js.map +1 -1
- package/esm/domain/rumEventsCollection/actions/trackClickActions.js +2 -263
- package/esm/domain/rumEventsCollection/actions/trackClickActions.js.map +1 -1
- package/esm/domain/rumEventsCollection/error/errorCollection.js +2 -93
- package/esm/domain/rumEventsCollection/error/errorCollection.js.map +1 -1
- package/esm/domain/rumEventsCollection/error/trackConsoleError.js +2 -12
- package/esm/domain/rumEventsCollection/error/trackConsoleError.js.map +1 -1
- package/esm/domain/rumEventsCollection/error/trackReportError.js +2 -19
- package/esm/domain/rumEventsCollection/error/trackReportError.js.map +1 -1
- package/esm/domain/rumEventsCollection/longTask/longAnimationFrameCollection.js +2 -55
- package/esm/domain/rumEventsCollection/longTask/longAnimationFrameCollection.js.map +1 -1
- package/esm/domain/rumEventsCollection/longTask/longTaskCollection.js +2 -38
- package/esm/domain/rumEventsCollection/longTask/longTaskCollection.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 +2 -69
- package/esm/domain/rumEventsCollection/resource/matchRequestResourceEntry.js.map +1 -1
- package/esm/domain/rumEventsCollection/resource/resourceCollection.js +2 -294
- package/esm/domain/rumEventsCollection/resource/resourceCollection.js.map +1 -1
- package/esm/domain/rumEventsCollection/resource/resourceTrackerManager.js +2 -232
- package/esm/domain/rumEventsCollection/resource/resourceTrackerManager.js.map +1 -1
- package/esm/domain/rumEventsCollection/resource/resourceUtils.js +2 -218
- package/esm/domain/rumEventsCollection/resource/resourceUtils.js.map +1 -1
- package/esm/domain/rumEventsCollection/resource/retrieveInitialDocumentResourceTiming.js +2 -19
- package/esm/domain/rumEventsCollection/resource/retrieveInitialDocumentResourceTiming.js.map +1 -1
- package/esm/domain/rumEventsCollection/resource/webSocketCollection.js +2 -191
- package/esm/domain/rumEventsCollection/resource/webSocketCollection.js.map +1 -1
- package/esm/domain/rumEventsCollection/view/interactionCountPolyfill.js +2 -47
- package/esm/domain/rumEventsCollection/view/interactionCountPolyfill.js.map +1 -1
- package/esm/domain/rumEventsCollection/view/trackCommonViewMetrics.js +2 -42
- package/esm/domain/rumEventsCollection/view/trackCommonViewMetrics.js.map +1 -1
- package/esm/domain/rumEventsCollection/view/trackCumulativeLayoutShift.js +2 -117
- package/esm/domain/rumEventsCollection/view/trackCumulativeLayoutShift.js.map +1 -1
- package/esm/domain/rumEventsCollection/view/trackFirstContentfulPaint.js +2 -20
- package/esm/domain/rumEventsCollection/view/trackFirstContentfulPaint.js.map +1 -1
- package/esm/domain/rumEventsCollection/view/trackFirstHidden.js +2 -49
- package/esm/domain/rumEventsCollection/view/trackFirstHidden.js.map +1 -1
- package/esm/domain/rumEventsCollection/view/trackFirstInput.js +2 -41
- package/esm/domain/rumEventsCollection/view/trackFirstInput.js.map +1 -1
- package/esm/domain/rumEventsCollection/view/trackInitialViewTimings.js +2 -44
- package/esm/domain/rumEventsCollection/view/trackInitialViewTimings.js.map +1 -1
- package/esm/domain/rumEventsCollection/view/trackInteractionToNextPaint.js +2 -153
- package/esm/domain/rumEventsCollection/view/trackInteractionToNextPaint.js.map +1 -1
- package/esm/domain/rumEventsCollection/view/trackLargestContentfulPaint.js +2 -54
- package/esm/domain/rumEventsCollection/view/trackLargestContentfulPaint.js.map +1 -1
- package/esm/domain/rumEventsCollection/view/trackLoadingTime.js +2 -50
- package/esm/domain/rumEventsCollection/view/trackLoadingTime.js.map +1 -1
- package/esm/domain/rumEventsCollection/view/trackNavigationTimings.js +2 -73
- package/esm/domain/rumEventsCollection/view/trackNavigationTimings.js.map +1 -1
- package/esm/domain/rumEventsCollection/view/trackScrollMetrics.js +2 -84
- package/esm/domain/rumEventsCollection/view/trackScrollMetrics.js.map +1 -1
- package/esm/domain/rumEventsCollection/view/trackSoftNavigationMetrics.js +2 -38
- package/esm/domain/rumEventsCollection/view/trackSoftNavigationMetrics.js.map +1 -1
- package/esm/domain/rumEventsCollection/view/trackViewEventCounts.js +2 -15
- package/esm/domain/rumEventsCollection/view/trackViewEventCounts.js.map +1 -1
- package/esm/domain/rumEventsCollection/view/trackViews.js +2 -418
- package/esm/domain/rumEventsCollection/view/trackViews.js.map +1 -1
- package/esm/domain/rumEventsCollection/view/viewCollection.js +2 -127
- package/esm/domain/rumEventsCollection/view/viewCollection.js.map +1 -1
- package/esm/domain/rumSessionManager.js +2 -208
- package/esm/domain/rumSessionManager.js.map +1 -1
- package/esm/domain/tracing/ddtraceTracer.js +2 -40
- package/esm/domain/tracing/ddtraceTracer.js.map +1 -1
- package/esm/domain/tracing/getDocumentTraceId.js +2 -69
- package/esm/domain/tracing/getDocumentTraceId.js.map +1 -1
- package/esm/domain/tracing/jaegerTracer.js +2 -42
- package/esm/domain/tracing/jaegerTracer.js.map +1 -1
- package/esm/domain/tracing/sampler.js +2 -61
- package/esm/domain/tracing/sampler.js.map +1 -1
- package/esm/domain/tracing/skywalkingTracer.js +2 -90
- package/esm/domain/tracing/skywalkingTracer.js.map +1 -1
- package/esm/domain/tracing/traceIdentifier.js +2 -57
- package/esm/domain/tracing/traceIdentifier.js.map +1 -1
- package/esm/domain/tracing/tracer.js +2 -128
- package/esm/domain/tracing/tracer.js.map +1 -1
- package/esm/domain/tracing/w3cTraceParentTracer.js +2 -69
- package/esm/domain/tracing/w3cTraceParentTracer.js.map +1 -1
- package/esm/domain/tracing/zipkinMultiTracer.js +2 -42
- package/esm/domain/tracing/zipkinMultiTracer.js.map +1 -1
- package/esm/domain/tracing/zipkinSingleTracer.js +2 -41
- package/esm/domain/tracing/zipkinSingleTracer.js.map +1 -1
- package/esm/domain/trackEventCounts.js +2 -49
- package/esm/domain/trackEventCounts.js.map +1 -1
- package/esm/domain/usr/index.js +2 -38
- package/esm/domain/usr/index.js.map +1 -1
- package/esm/domain/visitorId/index.js +2 -406
- package/esm/domain/visitorId/index.js.map +1 -1
- package/esm/domain/waitPageActivityEnd.js +2 -142
- package/esm/domain/waitPageActivityEnd.js.map +1 -1
- package/esm/index.js +2 -4
- package/esm/index.js.map +1 -1
- package/esm/transport/startRumBatch.js +2 -74
- package/esm/transport/startRumBatch.js.map +1 -1
- package/esm/transport/startRumEventBridge.js +2 -9
- package/esm/transport/startRumEventBridge.js.map +1 -1
- package/esm/types/index.js +2 -1
- package/esm/types/index.js.map +1 -1
- package/esm/types/sessionReplayConstants.js +2 -46
- package/esm/types/sessionReplayConstants.js.map +1 -1
- package/package.json +8 -8
- package/src/boot/disabledRumPublicApi.js +5 -0
- package/src/boot/initCallbacks.js +16 -0
- package/src/boot/perStartRum.js +102 -59
- package/src/boot/rum.js +7 -4
- 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 +13 -13
- package/src/domain/replay/record/canvasCommandCapture.js +105 -239
- 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 +32 -0
- package/src/domain/replay/record/canvasObserver.js +5 -1
- package/src/domain/replay/record/mutationObserver.js +6 -22
- package/src/domain/replay/record/record.js +1 -1
- package/src/domain/replay/record/serialize.js +24 -11
- 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 +87 -64
- package/src/domain/rumEventsCollection/resource/resourceTrackerManager.js +10 -10
- package/src/domain/rumEventsCollection/resource/resourceUtils.js +36 -59
- package/src/domain/rumEventsCollection/resource/retrieveInitialDocumentResourceTiming.js +8 -2
- package/src/domain/rumEventsCollection/view/trackViews.js +3 -0
- 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 { isCanvasHidden } 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,7 @@ function isUnsupportedDrawImageSource(value) {
|
|
|
481
464
|
|
|
482
465
|
export function createCanvas2DCommandRecorder(options) {
|
|
483
466
|
options = options || {}
|
|
484
|
-
var emit = options.emit ||
|
|
467
|
+
var emit = options.emit || noop
|
|
485
468
|
var now = __BUILD_ENV__REPLAY_DEBUG_ENABLED__
|
|
486
469
|
? options.now || Date.now
|
|
487
470
|
: Date.now
|
|
@@ -517,8 +500,6 @@ export function createCanvas2DCommandRecorder(options) {
|
|
|
517
500
|
var snapshotFallbackPatchTargets = new WeakSet()
|
|
518
501
|
var pendingCommandsByContext = new SDKMap()
|
|
519
502
|
var pendingCommandApproxBytes = 0
|
|
520
|
-
var fallbackModeContexts = new WeakSet()
|
|
521
|
-
var persistentFallbackModeContexts = new WeakSet()
|
|
522
503
|
var fallbackReasonByContext = new WeakMap()
|
|
523
504
|
var persistentFallbackReasonByContext = new WeakMap()
|
|
524
505
|
var expiredUnpublishedContexts = new WeakSet()
|
|
@@ -547,7 +528,7 @@ export function createCanvas2DCommandRecorder(options) {
|
|
|
547
528
|
(__BUILD_ENV__REPLAY_DEBUG_ENABLED__ && options.objectRefRegistry) ||
|
|
548
529
|
createCanvasCommandObjectRefRegistry()
|
|
549
530
|
var onCommandOverflow = __BUILD_ENV__REPLAY_DEBUG_ENABLED__
|
|
550
|
-
? options.onCommandOverflow ||
|
|
531
|
+
? options.onCommandOverflow || noop
|
|
551
532
|
: undefined
|
|
552
533
|
var getCanvasId =
|
|
553
534
|
options.getCanvasId ||
|
|
@@ -560,11 +541,11 @@ export function createCanvas2DCommandRecorder(options) {
|
|
|
560
541
|
return '2D'
|
|
561
542
|
}
|
|
562
543
|
var requestSnapshotFallback =
|
|
563
|
-
options.requestSnapshotFallback ||
|
|
544
|
+
options.requestSnapshotFallback || noop
|
|
564
545
|
var onContextDiscovered =
|
|
565
|
-
options.onContextDiscovered ||
|
|
546
|
+
options.onContextDiscovered || noop
|
|
566
547
|
var onContextMutation =
|
|
567
|
-
options.onContextMutation ||
|
|
548
|
+
options.onContextMutation || noop
|
|
568
549
|
var shouldRecordContext =
|
|
569
550
|
options.shouldRecordContext ||
|
|
570
551
|
function () {
|
|
@@ -616,8 +597,8 @@ export function createCanvas2DCommandRecorder(options) {
|
|
|
616
597
|
|
|
617
598
|
function isSnapshotFallbackContext(context) {
|
|
618
599
|
return (
|
|
619
|
-
|
|
620
|
-
|
|
600
|
+
fallbackReasonByContext.has(context) ||
|
|
601
|
+
persistentFallbackReasonByContext.has(context)
|
|
621
602
|
)
|
|
622
603
|
}
|
|
623
604
|
|
|
@@ -656,7 +637,6 @@ export function createCanvas2DCommandRecorder(options) {
|
|
|
656
637
|
|
|
657
638
|
function expireUnpublishedBatch(context) {
|
|
658
639
|
deletePendingBatch(context)
|
|
659
|
-
persistentFallbackModeContexts.add(context)
|
|
660
640
|
expiredUnpublishedContexts.add(context)
|
|
661
641
|
if (!persistentFallbackReasonByContext.has(context)) {
|
|
662
642
|
persistentFallbackReasonByContext.set(
|
|
@@ -922,6 +902,10 @@ export function createCanvas2DCommandRecorder(options) {
|
|
|
922
902
|
if (!batch) {
|
|
923
903
|
return
|
|
924
904
|
}
|
|
905
|
+
if (isCanvasHidden(context.canvas)) {
|
|
906
|
+
markPersistentSnapshotFallback(context, 'canvas_state_reset')
|
|
907
|
+
return
|
|
908
|
+
}
|
|
925
909
|
if (isSnapshotFallbackContext(context)) {
|
|
926
910
|
if (batch.fallbackDirty && !batch.fallbackSnapshotRequested) {
|
|
927
911
|
requestSnapshotFallback(
|
|
@@ -1034,6 +1018,14 @@ export function createCanvas2DCommandRecorder(options) {
|
|
|
1034
1018
|
if (!trackedContextSet.has(context)) {
|
|
1035
1019
|
return false
|
|
1036
1020
|
}
|
|
1021
|
+
if (isCanvasHidden(context.canvas)) {
|
|
1022
|
+
// Drawing will still change the live context while its commands are private.
|
|
1023
|
+
// Resume with pixels once visible, as the previous command state is stale.
|
|
1024
|
+
if (!persistentFallbackReasonByContext.has(context)) {
|
|
1025
|
+
markPersistentSnapshotFallback(context, 'canvas_state_reset')
|
|
1026
|
+
}
|
|
1027
|
+
return false
|
|
1028
|
+
}
|
|
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,13 @@ 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 (isCanvasHidden(context.canvas)) {
|
|
1137
|
+
markPersistentSnapshotFallback(context, 'canvas_state_reset')
|
|
1138
|
+
return
|
|
1139
|
+
}
|
|
1141
1140
|
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)
|
|
1141
|
+
clearContext(context)
|
|
1149
1142
|
}
|
|
1150
1143
|
|
|
1151
1144
|
function enableSnapshotFallbackForContext(
|
|
@@ -1154,13 +1147,9 @@ export function createCanvas2DCommandRecorder(options) {
|
|
|
1154
1147
|
isGlobalOverflow,
|
|
1155
1148
|
persistent
|
|
1156
1149
|
) {
|
|
1157
|
-
var fallbackContexts = persistent
|
|
1158
|
-
? persistentFallbackModeContexts
|
|
1159
|
-
: fallbackModeContexts
|
|
1160
1150
|
var fallbackReasons = persistent
|
|
1161
1151
|
? persistentFallbackReasonByContext
|
|
1162
1152
|
: fallbackReasonByContext
|
|
1163
|
-
fallbackContexts.add(context)
|
|
1164
1153
|
if (!fallbackReasons.has(context)) {
|
|
1165
1154
|
fallbackReasons.set(
|
|
1166
1155
|
context,
|
|
@@ -1314,6 +1303,41 @@ export function createCanvas2DCommandRecorder(options) {
|
|
|
1314
1303
|
}
|
|
1315
1304
|
}
|
|
1316
1305
|
|
|
1306
|
+
function recordMutation(context, name, argsOrValue, setter, alwaysSnapshotFallback) {
|
|
1307
|
+
notifyContextMutation(context)
|
|
1308
|
+
try {
|
|
1309
|
+
if (isSnapshotFallbackContext(context)) {
|
|
1310
|
+
markSnapshotFallbackDirty(context)
|
|
1311
|
+
return false
|
|
1312
|
+
}
|
|
1313
|
+
if (alwaysSnapshotFallback) {
|
|
1314
|
+
enableSnapshotFallbackForContext(
|
|
1315
|
+
context,
|
|
1316
|
+
setter ? 'unsupported_canvas_property' : 'unsupported_canvas_method',
|
|
1317
|
+
false,
|
|
1318
|
+
true
|
|
1319
|
+
)
|
|
1320
|
+
return false
|
|
1321
|
+
}
|
|
1322
|
+
} catch (_) {
|
|
1323
|
+
return false
|
|
1324
|
+
}
|
|
1325
|
+
|
|
1326
|
+
try {
|
|
1327
|
+
var reason = !setter && name === 'drawImage' && isUnsupportedDrawImageSource(argsOrValue[0])
|
|
1328
|
+
if (reason) {
|
|
1329
|
+
enableSnapshotFallbackForContext(context, reason)
|
|
1330
|
+
} else {
|
|
1331
|
+
captureCommand(context, name, setter ? [argsOrValue] : argsOrValue, setter)
|
|
1332
|
+
}
|
|
1333
|
+
} catch (_) {
|
|
1334
|
+
try {
|
|
1335
|
+
enableSnapshotFallbackForContext(context, 'command_serialization_error')
|
|
1336
|
+
} catch (_) {}
|
|
1337
|
+
}
|
|
1338
|
+
return true
|
|
1339
|
+
}
|
|
1340
|
+
|
|
1317
1341
|
function patchMethodOnTarget(
|
|
1318
1342
|
target,
|
|
1319
1343
|
methodName,
|
|
@@ -1328,55 +1352,9 @@ export function createCanvas2DCommandRecorder(options) {
|
|
|
1328
1352
|
maybeTrackContext(this)
|
|
1329
1353
|
var shouldCapture = shouldCaptureContext(this)
|
|
1330
1354
|
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
1355
|
if (
|
|
1379
1356
|
shouldCapture &&
|
|
1357
|
+
recordMutation(this, methodName, arguments, false, alwaysSnapshotFallback) &&
|
|
1380
1358
|
(methodName === 'createLinearGradient' ||
|
|
1381
1359
|
methodName === 'createRadialGradient' ||
|
|
1382
1360
|
methodName === 'createConicGradient')
|
|
@@ -1424,40 +1402,8 @@ export function createCanvas2DCommandRecorder(options) {
|
|
|
1424
1402
|
if (originalDescriptor && originalDescriptor.set) {
|
|
1425
1403
|
originalDescriptor.set.call(this, value)
|
|
1426
1404
|
}
|
|
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
|
-
}
|
|
1405
|
+
if (shouldCaptureContext(this)) {
|
|
1406
|
+
recordMutation(this, propertyName, value, true, alwaysSnapshotFallback)
|
|
1461
1407
|
}
|
|
1462
1408
|
}
|
|
1463
1409
|
try {
|
|
@@ -1500,12 +1446,7 @@ export function createCanvas2DCommandRecorder(options) {
|
|
|
1500
1446
|
return
|
|
1501
1447
|
}
|
|
1502
1448
|
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
|
-
) {
|
|
1449
|
+
if (propertyName === 'constructor' || knownCanvasMembers[propertyName]) {
|
|
1509
1450
|
return
|
|
1510
1451
|
}
|
|
1511
1452
|
var descriptor
|
|
@@ -1546,54 +1487,6 @@ export function createCanvas2DCommandRecorder(options) {
|
|
|
1546
1487
|
})
|
|
1547
1488
|
}
|
|
1548
1489
|
|
|
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
1490
|
function patchSharedPrototype(prototype) {
|
|
1598
1491
|
if (!prototype || prototype === Object.prototype) {
|
|
1599
1492
|
return false
|
|
@@ -1612,23 +1505,7 @@ export function createCanvas2DCommandRecorder(options) {
|
|
|
1612
1505
|
}
|
|
1613
1506
|
|
|
1614
1507
|
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)
|
|
1508
|
+
patchContextTarget(prototype, restoreFns, true)
|
|
1632
1509
|
|
|
1633
1510
|
patchedPrototypeRecords.push({
|
|
1634
1511
|
prototype: prototype,
|
|
@@ -1641,44 +1518,47 @@ export function createCanvas2DCommandRecorder(options) {
|
|
|
1641
1518
|
return true
|
|
1642
1519
|
}
|
|
1643
1520
|
|
|
1644
|
-
function
|
|
1521
|
+
function patchContextTarget(target, restoreFns, isPrototype) {
|
|
1645
1522
|
CANVAS_2D_CAPTURED_METHODS.forEach(function (methodName) {
|
|
1646
1523
|
if (
|
|
1647
|
-
typeof
|
|
1648
|
-
!patchMethodOnTarget(
|
|
1524
|
+
typeof target[methodName] === 'function' &&
|
|
1525
|
+
!patchMethodOnTarget(target, methodName, restoreFns)
|
|
1649
1526
|
) {
|
|
1650
|
-
snapshotFallbackPatchTargets.add(
|
|
1527
|
+
snapshotFallbackPatchTargets.add(target)
|
|
1651
1528
|
}
|
|
1652
1529
|
})
|
|
1653
1530
|
|
|
1654
1531
|
CANVAS_2D_CAPTURED_PROPERTIES.forEach(function (propertyName) {
|
|
1655
|
-
if (
|
|
1656
|
-
|
|
1532
|
+
if (
|
|
1533
|
+
(!isPrototype || getPropertyDescriptor(target, propertyName)) &&
|
|
1534
|
+
!patchPropertyOnTarget(target, propertyName, restoreFns)
|
|
1535
|
+
) {
|
|
1536
|
+
snapshotFallbackPatchTargets.add(target)
|
|
1657
1537
|
}
|
|
1658
1538
|
})
|
|
1659
|
-
patchUnknownMutationsOnTarget(
|
|
1539
|
+
patchUnknownMutationsOnTarget(target, restoreFns)
|
|
1660
1540
|
}
|
|
1661
1541
|
|
|
1662
1542
|
function patchContext(context) {
|
|
1663
1543
|
if (stopped || !context || trackedContextSet.has(context)) {
|
|
1664
|
-
return
|
|
1544
|
+
return noop
|
|
1665
1545
|
}
|
|
1666
1546
|
|
|
1667
1547
|
var restoreFns = []
|
|
1668
1548
|
var prototype = Object.getPrototypeOf(context)
|
|
1669
1549
|
if (prototype && prototype !== Object.prototype) {
|
|
1670
|
-
if (!
|
|
1671
|
-
return
|
|
1550
|
+
if (!patchSharedPrototype(prototype)) {
|
|
1551
|
+
return noop
|
|
1672
1552
|
}
|
|
1673
1553
|
} else {
|
|
1674
|
-
|
|
1554
|
+
patchContextTarget(context, restoreFns, false)
|
|
1675
1555
|
}
|
|
1676
1556
|
|
|
1677
1557
|
if (!registerTrackedContext(context, restoreFns)) {
|
|
1678
1558
|
while (restoreFns.length) {
|
|
1679
1559
|
restoreFns.pop()()
|
|
1680
1560
|
}
|
|
1681
|
-
return
|
|
1561
|
+
return noop
|
|
1682
1562
|
}
|
|
1683
1563
|
if (
|
|
1684
1564
|
snapshotFallbackPatchTargets.has(context) ||
|
|
@@ -1693,13 +1573,7 @@ export function createCanvas2DCommandRecorder(options) {
|
|
|
1693
1573
|
}
|
|
1694
1574
|
|
|
1695
1575
|
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)
|
|
1576
|
+
clearContext(context)
|
|
1703
1577
|
var trackedIndex = trackedContexts.findIndex(function (tracked) {
|
|
1704
1578
|
return tracked.context === context
|
|
1705
1579
|
})
|
|
@@ -1716,8 +1590,6 @@ export function createCanvas2DCommandRecorder(options) {
|
|
|
1716
1590
|
scheduledFlushId = undefined
|
|
1717
1591
|
}
|
|
1718
1592
|
clearPendingBatches()
|
|
1719
|
-
fallbackModeContexts = new WeakSet()
|
|
1720
|
-
persistentFallbackModeContexts = new WeakSet()
|
|
1721
1593
|
fallbackReasonByContext = new WeakMap()
|
|
1722
1594
|
persistentFallbackReasonByContext = new WeakMap()
|
|
1723
1595
|
expiredUnpublishedContexts = new WeakSet()
|
|
@@ -1735,34 +1607,29 @@ export function createCanvas2DCommandRecorder(options) {
|
|
|
1735
1607
|
objectRefRegistry.reset()
|
|
1736
1608
|
}
|
|
1737
1609
|
|
|
1738
|
-
function
|
|
1739
|
-
paused = true
|
|
1610
|
+
function resetPendingCapture() {
|
|
1740
1611
|
if (scheduledFlushId !== undefined) {
|
|
1741
1612
|
cancelAnimationFrameImpl(scheduledFlushId)
|
|
1742
1613
|
scheduledFlushId = undefined
|
|
1743
1614
|
}
|
|
1744
1615
|
clearPendingBatches()
|
|
1745
|
-
fallbackModeContexts = new WeakSet()
|
|
1746
1616
|
fallbackReasonByContext = new WeakMap()
|
|
1747
1617
|
rejectedContextSet = new WeakSet()
|
|
1748
1618
|
objectRefRegistry.reset()
|
|
1749
1619
|
}
|
|
1750
1620
|
|
|
1621
|
+
function pause() {
|
|
1622
|
+
paused = true
|
|
1623
|
+
resetPendingCapture()
|
|
1624
|
+
}
|
|
1625
|
+
|
|
1751
1626
|
function resume() {
|
|
1752
1627
|
paused = false
|
|
1753
1628
|
}
|
|
1754
1629
|
|
|
1755
1630
|
function reset() {
|
|
1756
1631
|
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()
|
|
1632
|
+
resetPendingCapture()
|
|
1766
1633
|
}
|
|
1767
1634
|
|
|
1768
1635
|
function forceSnapshotFallback(context, reason) {
|
|
@@ -1786,7 +1653,6 @@ export function createCanvas2DCommandRecorder(options) {
|
|
|
1786
1653
|
return
|
|
1787
1654
|
}
|
|
1788
1655
|
expiredUnpublishedContexts.delete(context)
|
|
1789
|
-
persistentFallbackModeContexts.add(context)
|
|
1790
1656
|
if (!persistentFallbackReasonByContext.has(context)) {
|
|
1791
1657
|
persistentFallbackReasonByContext.set(
|
|
1792
1658
|
context,
|
|
@@ -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)]
|
|
@@ -1,3 +1,34 @@
|
|
|
1
|
+
import { isNodeShadowRoot } from '@cloudcare/browser-core'
|
|
2
|
+
import {
|
|
3
|
+
NodePrivacyLevel,
|
|
4
|
+
PRIVACY_ATTR_NAME,
|
|
5
|
+
PRIVACY_ATTR_VALUE_HIDDEN,
|
|
6
|
+
PRIVACY_CLASS_HIDDEN
|
|
7
|
+
} from '../../../constants'
|
|
8
|
+
import { getNodePrivacyLevel } from './privacy'
|
|
9
|
+
|
|
10
|
+
var hiddenCanvasSelector =
|
|
11
|
+
`.${PRIVACY_CLASS_HIDDEN},[${PRIVACY_ATTR_NAME}="${PRIVACY_ATTR_VALUE_HIDDEN}"]`
|
|
12
|
+
|
|
13
|
+
// This runs on the drawing path. Use native ancestor matching and cross shadow
|
|
14
|
+
// boundaries without allocating a privacy cache for every drawing command.
|
|
15
|
+
export function isCanvasHidden(canvas) {
|
|
16
|
+
try {
|
|
17
|
+
var element = canvas
|
|
18
|
+
while (element) {
|
|
19
|
+
if (!element.closest || !element.getRootNode) {
|
|
20
|
+
return getNodePrivacyLevel(element) === NodePrivacyLevel.HIDDEN
|
|
21
|
+
}
|
|
22
|
+
if (element.closest(hiddenCanvasSelector)) return true
|
|
23
|
+
var root = element.getRootNode()
|
|
24
|
+
element = isNodeShadowRoot(root) ? root.host : null
|
|
25
|
+
}
|
|
26
|
+
return false
|
|
27
|
+
} catch (_) {
|
|
28
|
+
return true
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
1
32
|
var contextTypeByCanvas = new WeakMap()
|
|
2
33
|
var replayInternalCanvases = new WeakSet()
|
|
3
34
|
|
|
@@ -58,6 +89,7 @@ export function isWebGLReplayCanvas(canvas) {
|
|
|
58
89
|
|
|
59
90
|
export function getReplayCanvasRecordingDecision(configuration, canvas) {
|
|
60
91
|
try {
|
|
92
|
+
if (isCanvasHidden(canvas)) return false
|
|
61
93
|
return configuration.shouldRecordCanvas
|
|
62
94
|
? configuration.shouldRecordCanvas(canvas)
|
|
63
95
|
: true
|
|
@@ -13,7 +13,8 @@ import {
|
|
|
13
13
|
isCanvasFrameBelowThreshold
|
|
14
14
|
} from './canvasFrameSignature'
|
|
15
15
|
import {
|
|
16
|
-
getReplayCanvasRecordingDecision
|
|
16
|
+
getReplayCanvasRecordingDecision,
|
|
17
|
+
isCanvasHidden
|
|
17
18
|
} from './canvasContext'
|
|
18
19
|
|
|
19
20
|
var DEFAULT_ENCODED_DATA_URL_CACHE_MAX_CHARACTERS = 1024 * 1024
|
|
@@ -402,6 +403,9 @@ export function createCanvasObserver(options) {
|
|
|
402
403
|
) {
|
|
403
404
|
return createSnapshotFailureResult('resized_during_snapshot')
|
|
404
405
|
}
|
|
406
|
+
if (isCanvasHidden(canvas)) {
|
|
407
|
+
return createSnapshotFailureResult('rejected_by_should_record_canvas')
|
|
408
|
+
}
|
|
405
409
|
if (!isNodeActive(canvas)) {
|
|
406
410
|
return createSnapshotFailureResult('not_serialized')
|
|
407
411
|
}
|