@cloudcare/browser-rum 2.2.15 → 3.0.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/bundle/dataflux-rum.js +1 -1
- package/cjs/boot/buildEnv.js +1 -1
- package/cjs/boot/recorderApi.js +161 -0
- package/cjs/boot/rum.entry.js +6 -1
- package/cjs/boot/rum.js +15 -5
- package/cjs/boot/rumPublicApi.js +8 -4
- package/cjs/boot/startRecording.js +55 -0
- package/cjs/constants.js +52 -0
- package/cjs/domain/assembly.js +1 -7
- package/cjs/domain/configuration.js +3 -2
- package/cjs/domain/contexts/foregroundContexts.js +138 -0
- package/cjs/domain/contexts/internalContext.js +1 -1
- package/cjs/domain/contexts/urlContexts.js +9 -2
- package/cjs/domain/domMutationCollection.js +4 -5
- package/cjs/domain/initViewportObservable.js +52 -0
- package/cjs/domain/locationChangeObservable.js +12 -26
- package/cjs/domain/performanceCollection.js +2 -13
- package/cjs/domain/replay/record/elementsScrollPositions.js +27 -0
- package/cjs/domain/replay/record/index.js +41 -0
- package/cjs/domain/replay/record/mutationBatch.js +58 -0
- package/cjs/domain/replay/record/mutationObserver.js +388 -0
- package/cjs/domain/replay/record/observers.js +470 -0
- package/cjs/domain/replay/record/privacy.js +256 -0
- package/cjs/domain/replay/record/record.js +174 -0
- package/cjs/domain/replay/record/serializationUtils.js +137 -0
- package/cjs/domain/replay/record/serialize.js +488 -0
- package/cjs/domain/replay/record/shadowRootsController.js +61 -0
- package/cjs/domain/replay/record/utils.js +53 -0
- package/cjs/domain/replay/record/viewports.js +104 -0
- package/cjs/domain/replay/replayStats.js +83 -0
- package/cjs/domain/replay/segmentCollection/buildReplayPayload.js +43 -0
- package/cjs/domain/replay/segmentCollection/deflateWorker.js +4400 -0
- package/cjs/domain/replay/segmentCollection/index.js +33 -0
- package/cjs/domain/replay/segmentCollection/segment.js +101 -0
- package/cjs/domain/replay/segmentCollection/segmentCollection.js +179 -0
- package/cjs/domain/replay/segmentCollection/startDeflateWorker.js +127 -0
- package/cjs/domain/requestCollection.js +35 -17
- package/cjs/domain/rumEventsCollection/actions/actionCollection.js +12 -4
- package/cjs/domain/rumEventsCollection/actions/clickChain.js +3 -3
- package/cjs/domain/rumEventsCollection/actions/computeFrustration.js +6 -5
- package/cjs/domain/rumEventsCollection/actions/getActionNameFromElement.js +8 -6
- package/cjs/domain/rumEventsCollection/actions/getSelectorsFromElement.js +111 -75
- package/cjs/domain/rumEventsCollection/actions/listenActionEvents.js +22 -28
- package/cjs/domain/rumEventsCollection/actions/trackClickActions.js +94 -54
- package/cjs/domain/rumEventsCollection/error/errorCollection.js +13 -5
- package/cjs/domain/rumEventsCollection/view/trackViewEventCounts.js +45 -0
- package/cjs/domain/rumEventsCollection/view/trackViewMetrics.js +1 -19
- package/cjs/domain/rumEventsCollection/view/trackViews.js +21 -18
- package/cjs/domain/rumEventsCollection/view/viewCollection.js +12 -9
- package/cjs/domain/rumSessionManager.js +6 -3
- package/cjs/domain/tracing/getDocumentTraceId.js +2 -10
- package/cjs/domain/trackEventCounts.js +10 -2
- package/cjs/domain/waitPageActivityEnd.js +5 -1
- package/cjs/transport/startRumBatch.js +5 -7
- package/cjs/types/index.js +18 -0
- package/cjs/types/sessionReplayConstants.js +56 -0
- package/esm/boot/buildEnv.js +1 -1
- package/esm/boot/recorderApi.js +149 -0
- package/esm/boot/rum.entry.js +4 -1
- package/esm/boot/rum.js +15 -6
- package/esm/boot/rumPublicApi.js +8 -4
- package/esm/boot/startRecording.js +44 -0
- package/esm/constants.js +31 -0
- package/esm/domain/assembly.js +1 -7
- package/esm/domain/configuration.js +4 -3
- package/esm/domain/contexts/foregroundContexts.js +122 -0
- package/esm/domain/contexts/internalContext.js +1 -1
- package/esm/domain/contexts/urlContexts.js +10 -3
- package/esm/domain/domMutationCollection.js +5 -6
- package/esm/domain/initViewportObservable.js +39 -0
- package/esm/domain/locationChangeObservable.js +13 -27
- package/esm/domain/performanceCollection.js +1 -12
- package/esm/domain/replay/record/elementsScrollPositions.js +20 -0
- package/esm/domain/replay/record/index.js +3 -0
- package/esm/domain/replay/record/mutationBatch.js +35 -0
- package/esm/domain/replay/record/mutationObserver.js +336 -0
- package/esm/domain/replay/record/observers.js +454 -0
- package/esm/domain/replay/record/privacy.js +233 -0
- package/esm/domain/replay/record/record.js +158 -0
- package/esm/domain/replay/record/serializationUtils.js +107 -0
- package/esm/domain/replay/record/serialize.js +461 -0
- package/esm/domain/replay/record/shadowRootsController.js +49 -0
- package/esm/domain/replay/record/utils.js +38 -0
- package/esm/domain/replay/record/viewports.js +87 -0
- package/esm/domain/replay/replayStats.js +64 -0
- package/esm/domain/replay/segmentCollection/buildReplayPayload.js +31 -0
- package/esm/domain/replay/segmentCollection/deflateWorker.js +4393 -0
- package/esm/domain/replay/segmentCollection/index.js +3 -0
- package/esm/domain/replay/segmentCollection/segment.js +84 -0
- package/esm/domain/replay/segmentCollection/segmentCollection.js +158 -0
- package/esm/domain/replay/segmentCollection/startDeflateWorker.js +114 -0
- package/esm/domain/requestCollection.js +36 -18
- package/esm/domain/rumEventsCollection/actions/actionCollection.js +12 -4
- package/esm/domain/rumEventsCollection/actions/clickChain.js +3 -3
- package/esm/domain/rumEventsCollection/actions/computeFrustration.js +6 -5
- package/esm/domain/rumEventsCollection/actions/getActionNameFromElement.js +6 -6
- package/esm/domain/rumEventsCollection/actions/getSelectorsFromElement.js +105 -74
- package/esm/domain/rumEventsCollection/actions/listenActionEvents.js +22 -28
- package/esm/domain/rumEventsCollection/actions/trackClickActions.js +99 -59
- package/esm/domain/rumEventsCollection/error/errorCollection.js +13 -5
- package/esm/domain/rumEventsCollection/view/trackViewEventCounts.js +33 -0
- package/esm/domain/rumEventsCollection/view/trackViewMetrics.js +1 -18
- package/esm/domain/rumEventsCollection/view/trackViews.js +21 -19
- package/esm/domain/rumEventsCollection/view/viewCollection.js +12 -9
- package/esm/domain/rumSessionManager.js +6 -3
- package/esm/domain/tracing/getDocumentTraceId.js +1 -9
- package/esm/domain/trackEventCounts.js +10 -2
- package/esm/domain/waitPageActivityEnd.js +5 -1
- package/esm/transport/startRumBatch.js +5 -7
- package/esm/types/index.js +1 -0
- package/esm/types/sessionReplayConstants.js +45 -0
- package/package.json +3 -3
- package/src/boot/recorderApi.js +166 -0
- package/src/boot/rum.entry.js +4 -1
- package/src/boot/rum.js +38 -10
- package/src/boot/rumPublicApi.js +13 -3
- package/src/boot/startRecording.js +77 -0
- package/src/constants.js +37 -0
- package/src/domain/assembly.js +1 -6
- package/src/domain/configuration.js +10 -2
- package/src/domain/contexts/foregroundContexts.js +140 -0
- package/src/domain/contexts/internalContext.js +10 -4
- package/src/domain/contexts/urlContexts.js +29 -15
- package/src/domain/domMutationCollection.js +14 -6
- package/src/domain/initViewportObservable.js +46 -0
- package/src/domain/locationChangeObservable.js +17 -25
- package/src/domain/performanceCollection.js +42 -42
- package/src/domain/replay/record/elementsScrollPositions.js +22 -0
- package/src/domain/replay/record/index.js +7 -0
- package/src/domain/replay/record/mutationBatch.js +38 -0
- package/src/domain/replay/record/mutationObserver.js +403 -0
- package/src/domain/replay/record/observers.js +565 -0
- package/src/domain/replay/record/privacy.js +304 -0
- package/src/domain/replay/record/record.js +158 -0
- package/src/domain/replay/record/serializationUtils.js +134 -0
- package/src/domain/replay/record/serialize.js +497 -0
- package/src/domain/replay/record/shadowRootsController.js +58 -0
- package/src/domain/replay/record/utils.js +44 -0
- package/src/domain/replay/record/viewports.js +89 -0
- package/src/domain/replay/replayStats.js +67 -0
- package/src/domain/replay/segmentCollection/buildReplayPayload.js +34 -0
- package/src/domain/replay/segmentCollection/deflateWorker.js +4584 -0
- package/src/domain/replay/segmentCollection/index.js +6 -0
- package/src/domain/replay/segmentCollection/segment.js +86 -0
- package/src/domain/replay/segmentCollection/segmentCollection.js +205 -0
- package/src/domain/replay/segmentCollection/startDeflateWorker.js +102 -0
- package/src/domain/requestCollection.js +64 -28
- package/src/domain/rumEventsCollection/actions/actionCollection.js +11 -4
- package/src/domain/rumEventsCollection/actions/clickChain.js +3 -3
- package/src/domain/rumEventsCollection/actions/computeFrustration.js +7 -4
- package/src/domain/rumEventsCollection/actions/getActionNameFromElement.js +9 -6
- package/src/domain/rumEventsCollection/actions/getSelectorsFromElement.js +130 -108
- package/src/domain/rumEventsCollection/actions/listenActionEvents.js +26 -27
- package/src/domain/rumEventsCollection/actions/trackClickActions.js +162 -92
- package/src/domain/rumEventsCollection/error/errorCollection.js +11 -5
- package/src/domain/rumEventsCollection/view/trackViewEventCounts.js +38 -0
- package/src/domain/rumEventsCollection/view/trackViewMetrics.js +1 -19
- package/src/domain/rumEventsCollection/view/trackViews.js +98 -68
- package/src/domain/rumEventsCollection/view/viewCollection.js +15 -7
- package/src/domain/rumSessionManager.js +33 -19
- package/src/domain/tracing/getDocumentTraceId.js +6 -9
- package/src/domain/trackEventCounts.js +10 -4
- package/src/domain/waitPageActivityEnd.js +4 -1
- package/src/transport/startRumBatch.js +29 -24
- package/src/types/index.js +1 -0
- package/src/types/sessionReplayConstants.js +49 -0
package/cjs/boot/buildEnv.js
CHANGED
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.makeRecorderApi = makeRecorderApi;
|
|
7
|
+
|
|
8
|
+
var _browserCore = require("@cloudcare/browser-core");
|
|
9
|
+
|
|
10
|
+
var _replayStats = require("../domain/replay/replayStats");
|
|
11
|
+
|
|
12
|
+
var _segmentCollection = require("../domain/replay/segmentCollection");
|
|
13
|
+
|
|
14
|
+
var RecorderStatus = {
|
|
15
|
+
// The recorder is stopped.
|
|
16
|
+
Stopped: 0,
|
|
17
|
+
// The user started the recording while it wasn't possible yet. The recorder should start as soon
|
|
18
|
+
// as possible.
|
|
19
|
+
IntentToStart: 1,
|
|
20
|
+
// The recorder is starting. It does not record anything yet.
|
|
21
|
+
Starting: 2,
|
|
22
|
+
// The recorder is started, it records the session.
|
|
23
|
+
Started: 3
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
function makeRecorderApi(startRecordingImpl, startDeflateWorkerImpl) {
|
|
27
|
+
if (typeof startDeflateWorkerImpl === 'undefined') {
|
|
28
|
+
startDeflateWorkerImpl = _segmentCollection.startDeflateWorker;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (!isBrowserSupported()) {
|
|
32
|
+
return {
|
|
33
|
+
start: _browserCore.noop,
|
|
34
|
+
stop: _browserCore.noop,
|
|
35
|
+
getReplayStats: function getReplayStats() {
|
|
36
|
+
return undefined;
|
|
37
|
+
},
|
|
38
|
+
onRumStart: _browserCore.noop,
|
|
39
|
+
isRecording: function isRecording() {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
var state = {
|
|
46
|
+
status: RecorderStatus.Stopped
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
var startStrategy = function startStrategy() {
|
|
50
|
+
state = {
|
|
51
|
+
status: RecorderStatus.IntentToStart
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
var stopStrategy = function stopStrategy() {
|
|
56
|
+
state = {
|
|
57
|
+
status: RecorderStatus.Stopped
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
return {
|
|
62
|
+
start: function start() {
|
|
63
|
+
startStrategy();
|
|
64
|
+
},
|
|
65
|
+
stop: function stop() {
|
|
66
|
+
stopStrategy();
|
|
67
|
+
},
|
|
68
|
+
getReplayStats: _replayStats.getReplayStats,
|
|
69
|
+
onRumStart: function onRumStart(lifeCycle, configuration, sessionManager, viewContexts) {
|
|
70
|
+
lifeCycle.subscribe(_browserCore.LifeCycleEventType.SESSION_EXPIRED, function () {
|
|
71
|
+
if (state.status === RecorderStatus.Starting || state.status === RecorderStatus.Started) {
|
|
72
|
+
stopStrategy();
|
|
73
|
+
state = {
|
|
74
|
+
status: RecorderStatus.IntentToStart
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
lifeCycle.subscribe(_browserCore.LifeCycleEventType.SESSION_RENEWED, function () {
|
|
79
|
+
if (state.status === RecorderStatus.IntentToStart) {
|
|
80
|
+
startStrategy();
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
startStrategy = function startStrategy() {
|
|
85
|
+
var session = sessionManager.findTrackedSession();
|
|
86
|
+
|
|
87
|
+
if (!session || !session.sessionReplayAllowed) {
|
|
88
|
+
state = {
|
|
89
|
+
status: RecorderStatus.IntentToStart
|
|
90
|
+
};
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
if (state.status === RecorderStatus.Starting || state.status === RecorderStatus.Started) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
state = {
|
|
99
|
+
status: RecorderStatus.Starting
|
|
100
|
+
};
|
|
101
|
+
(0, _browserCore.runOnReadyState)('interactive', function () {
|
|
102
|
+
if (state.status !== RecorderStatus.Starting) {
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
startDeflateWorkerImpl(function (worker) {
|
|
107
|
+
if (state.status !== RecorderStatus.Starting) {
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
if (!worker) {
|
|
112
|
+
state = {
|
|
113
|
+
status: RecorderStatus.Stopped
|
|
114
|
+
};
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
var recordingImpl = startRecordingImpl(lifeCycle, configuration, sessionManager, viewContexts, worker);
|
|
119
|
+
state = {
|
|
120
|
+
status: RecorderStatus.Started,
|
|
121
|
+
stopRecording: recordingImpl.stop
|
|
122
|
+
};
|
|
123
|
+
});
|
|
124
|
+
});
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
stopStrategy = function stopStrategy() {
|
|
128
|
+
if (state.status === RecorderStatus.Stopped) {
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
if (state.status === RecorderStatus.Started) {
|
|
133
|
+
state.stopRecording();
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
state = {
|
|
137
|
+
status: RecorderStatus.Stopped
|
|
138
|
+
};
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
if (state.status === RecorderStatus.IntentToStart) {
|
|
142
|
+
startStrategy();
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
isRecording: function isRecording() {
|
|
146
|
+
return state.status === RecorderStatus.Started;
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Test for Browser features used while recording
|
|
152
|
+
*/
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
function isBrowserSupported() {
|
|
156
|
+
return (// Array.from is a bit less supported by browsers than CSSSupportsRule, but has higher chances
|
|
157
|
+
// to be polyfilled. Test for both to be more confident. We could add more things if we find out
|
|
158
|
+
// this test is not sufficient.
|
|
159
|
+
typeof Array.from === 'function' && typeof CSSSupportsRule === 'function' && 'forEach' in NodeList.prototype
|
|
160
|
+
);
|
|
161
|
+
}
|
package/cjs/boot/rum.entry.js
CHANGED
|
@@ -11,6 +11,11 @@ var _rum = require("./rum");
|
|
|
11
11
|
|
|
12
12
|
var _rumPublicApi = require("./rumPublicApi");
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _startRecording = require("./startRecording");
|
|
15
|
+
|
|
16
|
+
var _recorderApi = require("./recorderApi");
|
|
17
|
+
|
|
18
|
+
var recorderApi = (0, _recorderApi.makeRecorderApi)(_startRecording.startRecording);
|
|
19
|
+
var datafluxRum = (0, _rumPublicApi.makeRumPublicApi)(_rum.startRum, recorderApi);
|
|
15
20
|
exports.datafluxRum = datafluxRum;
|
|
16
21
|
(0, _browserCore.defineGlobal)((0, _browserCore.getGlobalObject)(), 'DATAFLUX_RUM', datafluxRum);
|
package/cjs/boot/rum.js
CHANGED
|
@@ -28,6 +28,8 @@ var _assembly = require("../domain/assembly");
|
|
|
28
28
|
|
|
29
29
|
var _internalContext = require("../domain/contexts/internalContext");
|
|
30
30
|
|
|
31
|
+
var _foregroundContexts = require("../domain/contexts/foregroundContexts");
|
|
32
|
+
|
|
31
33
|
var _urlContexts = require("../domain/contexts/urlContexts");
|
|
32
34
|
|
|
33
35
|
var _viewContexts = require("../domain/contexts/viewContexts");
|
|
@@ -40,7 +42,7 @@ var _requestCollection = require("../domain/requestCollection");
|
|
|
40
42
|
|
|
41
43
|
var _resourceCollection = require("../domain/rumEventsCollection/resource/resourceCollection");
|
|
42
44
|
|
|
43
|
-
function startRum(configuration, getCommonContext, initialViewOptions) {
|
|
45
|
+
function startRum(configuration, getCommonContext, recorderApi, initialViewOptions) {
|
|
44
46
|
var lifeCycle = new _browserCore.LifeCycle();
|
|
45
47
|
|
|
46
48
|
var reportError = function reportError(error) {
|
|
@@ -49,7 +51,11 @@ function startRum(configuration, getCommonContext, initialViewOptions) {
|
|
|
49
51
|
});
|
|
50
52
|
};
|
|
51
53
|
|
|
52
|
-
(0,
|
|
54
|
+
var pageExitObservable = (0, _browserCore.createPageExitObservable)();
|
|
55
|
+
pageExitObservable.subscribe(function (event) {
|
|
56
|
+
lifeCycle.notify(_browserCore.LifeCycleEventType.PAGE_EXITED, event);
|
|
57
|
+
});
|
|
58
|
+
(0, _startRumBatch.startRumBatch)(configuration, lifeCycle, reportError, pageExitObservable);
|
|
53
59
|
var session = (0, _rumSessionManager.startRumSessionManager)(configuration, lifeCycle);
|
|
54
60
|
var userSession = (0, _usr.startCacheUsrCache)(configuration);
|
|
55
61
|
var domMutationObservable = (0, _domMutationCollection.createDOMMutationObservable)();
|
|
@@ -60,15 +66,16 @@ function startRum(configuration, getCommonContext, initialViewOptions) {
|
|
|
60
66
|
var viewContexts = _startRumEventCollection.viewContexts;
|
|
61
67
|
var urlContexts = _startRumEventCollection.urlContexts;
|
|
62
68
|
var actionContexts = _startRumEventCollection.actionContexts;
|
|
69
|
+
var foregroundContexts = _startRumEventCollection.foregroundContexts;
|
|
63
70
|
(0, _longTaskCollection.startLongTaskCollection)(lifeCycle, session);
|
|
64
71
|
(0, _resourceCollection.startResourceCollection)(lifeCycle, configuration);
|
|
65
72
|
|
|
66
|
-
var _startViewCollection = (0, _viewCollection.startViewCollection)(lifeCycle, configuration, location, domMutationObservable, locationChangeObservable, initialViewOptions);
|
|
73
|
+
var _startViewCollection = (0, _viewCollection.startViewCollection)(lifeCycle, configuration, location, domMutationObservable, locationChangeObservable, foregroundContexts, recorderApi, initialViewOptions);
|
|
67
74
|
|
|
68
75
|
var addTiming = _startViewCollection.addTiming;
|
|
69
76
|
var startView = _startViewCollection.startView;
|
|
70
77
|
|
|
71
|
-
var _startErrorCollection = (0, _errorCollection.startErrorCollection)(lifeCycle,
|
|
78
|
+
var _startErrorCollection = (0, _errorCollection.startErrorCollection)(lifeCycle, foregroundContexts);
|
|
72
79
|
|
|
73
80
|
var addError = _startErrorCollection.addError;
|
|
74
81
|
(0, _requestCollection.startRequestCollection)(lifeCycle, configuration, session);
|
|
@@ -90,18 +97,21 @@ function startRum(configuration, getCommonContext, initialViewOptions) {
|
|
|
90
97
|
function startRumEventCollection(location, lifeCycle, configuration, sessionManager, userSessionManager, locationChangeObservable, domMutationObservable, getCommonContext, reportError) {
|
|
91
98
|
var viewContexts = (0, _viewContexts.startViewContexts)(lifeCycle);
|
|
92
99
|
var urlContexts = (0, _urlContexts.startUrlContexts)(lifeCycle, locationChangeObservable, location);
|
|
100
|
+
var foregroundContexts = (0, _foregroundContexts.startForegroundContexts)();
|
|
93
101
|
|
|
94
|
-
var _startActionCollection = (0, _actionCollection.startActionCollection)(lifeCycle, domMutationObservable, configuration);
|
|
102
|
+
var _startActionCollection = (0, _actionCollection.startActionCollection)(lifeCycle, domMutationObservable, configuration, foregroundContexts);
|
|
95
103
|
|
|
96
104
|
var actionContexts = _startActionCollection.actionContexts;
|
|
97
105
|
(0, _assembly.startRumAssembly)(configuration, lifeCycle, sessionManager, userSessionManager, viewContexts, urlContexts, actionContexts, getCommonContext, reportError);
|
|
98
106
|
return {
|
|
99
107
|
viewContexts: viewContexts,
|
|
100
108
|
urlContexts: urlContexts,
|
|
109
|
+
foregroundContexts: foregroundContexts,
|
|
101
110
|
addAction: _startActionCollection.addAction,
|
|
102
111
|
actionContexts: actionContexts,
|
|
103
112
|
stop: function stop() {
|
|
104
113
|
viewContexts.stop();
|
|
114
|
+
foregroundContexts.stop();
|
|
105
115
|
}
|
|
106
116
|
};
|
|
107
117
|
}
|
package/cjs/boot/rumPublicApi.js
CHANGED
|
@@ -11,7 +11,7 @@ var _configuration = require("../domain/configuration");
|
|
|
11
11
|
|
|
12
12
|
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
13
13
|
|
|
14
|
-
function makeRumPublicApi(startRumImpl) {
|
|
14
|
+
function makeRumPublicApi(startRumImpl, recorderApi) {
|
|
15
15
|
var isAlreadyInitialized = false;
|
|
16
16
|
var globalContextManager = (0, _browserCore.createContextManager)();
|
|
17
17
|
var userContextManager = (0, _browserCore.createContextManager)();
|
|
@@ -113,15 +113,17 @@ function makeRumPublicApi(startRumImpl) {
|
|
|
113
113
|
var startRumResults = startRumImpl(configuration, function () {
|
|
114
114
|
return {
|
|
115
115
|
user: userContextManager.getContext(),
|
|
116
|
-
context: globalContextManager.getContext()
|
|
116
|
+
context: globalContextManager.getContext(),
|
|
117
|
+
hasReplay: recorderApi.isRecording() ? true : undefined
|
|
117
118
|
};
|
|
118
|
-
}, initialViewOptions);
|
|
119
|
+
}, recorderApi, initialViewOptions);
|
|
119
120
|
_startViewStrategy = startRumResults.startView;
|
|
120
121
|
_addActionStrategy = startRumResults.addAction;
|
|
121
122
|
_addErrorStrategy = startRumResults.addError;
|
|
122
123
|
_addTimingStrategy = startRumResults.addTiming;
|
|
123
124
|
getInternalContextStrategy = startRumResults.getInternalContext;
|
|
124
125
|
bufferApiCalls.drain();
|
|
126
|
+
recorderApi.onRumStart(startRumResults.lifeCycle, configuration, startRumResults.session, startRumResults.viewContexts);
|
|
125
127
|
}
|
|
126
128
|
|
|
127
129
|
var startView = function startView(options) {
|
|
@@ -207,7 +209,9 @@ function makeRumPublicApi(startRumImpl) {
|
|
|
207
209
|
/** @deprecated: renamed to clearUser */
|
|
208
210
|
removeUser: userContextManager.clearContext,
|
|
209
211
|
clearUser: userContextManager.clearContext,
|
|
210
|
-
startView: startView
|
|
212
|
+
startView: startView,
|
|
213
|
+
startSessionReplayRecording: recorderApi.start,
|
|
214
|
+
stopSessionReplayRecording: recorderApi.stop
|
|
211
215
|
});
|
|
212
216
|
return rumPublicApi;
|
|
213
217
|
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.startRecording = startRecording;
|
|
7
|
+
|
|
8
|
+
var _browserCore = require("@cloudcare/browser-core");
|
|
9
|
+
|
|
10
|
+
var _record2 = require("../domain/replay/record");
|
|
11
|
+
|
|
12
|
+
var _segmentCollection = require("../domain/replay/segmentCollection");
|
|
13
|
+
|
|
14
|
+
var _types = require("../types");
|
|
15
|
+
|
|
16
|
+
function startRecording(lifeCycle, configuration, sessionManager, viewContexts, worker, httpRequest) {
|
|
17
|
+
var reportError = function reportError(error) {
|
|
18
|
+
lifeCycle.notify(_browserCore.LifeCycleEventType.RAW_ERROR_COLLECTED, {
|
|
19
|
+
error: error
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
var replayRequest = httpRequest || (0, _browserCore.createHttpRequest)(configuration.sessionReplayEndPoint, _segmentCollection.SEGMENT_BYTES_LIMIT, reportError);
|
|
24
|
+
var segmentCollection = (0, _segmentCollection.startSegmentCollection)(lifeCycle, configuration, sessionManager, viewContexts, replayRequest, worker);
|
|
25
|
+
var addRecord = segmentCollection.addRecord;
|
|
26
|
+
var stopSegmentCollection = segmentCollection.stop;
|
|
27
|
+
|
|
28
|
+
var _record = (0, _record2.record)({
|
|
29
|
+
emit: addRecord,
|
|
30
|
+
configuration: configuration,
|
|
31
|
+
lifeCycle: lifeCycle
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
var stopRecording = _record.stop;
|
|
35
|
+
var takeSubsequentFullSnapshot = _record.takeSubsequentFullSnapshot;
|
|
36
|
+
var flushMutations = _record.flushMutations;
|
|
37
|
+
var subscribeViewEnded = lifeCycle.subscribe(_browserCore.LifeCycleEventType.VIEW_ENDED, function () {
|
|
38
|
+
flushMutations();
|
|
39
|
+
addRecord({
|
|
40
|
+
timestamp: (0, _browserCore.timeStampNow)(),
|
|
41
|
+
type: _types.RecordType.ViewEnd
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
var scribeViewCreated = lifeCycle.subscribe(_browserCore.LifeCycleEventType.VIEW_CREATED, function (view) {
|
|
45
|
+
takeSubsequentFullSnapshot(view.startClocks.timeStamp);
|
|
46
|
+
});
|
|
47
|
+
return {
|
|
48
|
+
stop: function stop() {
|
|
49
|
+
subscribeViewEnded.unsubscribe();
|
|
50
|
+
scribeViewCreated.unsubscribe();
|
|
51
|
+
stopRecording();
|
|
52
|
+
stopSegmentCollection();
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
}
|
package/cjs/constants.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.PRIVACY_CLASS_MASK_USER_INPUT = exports.PRIVACY_CLASS_MASK = exports.PRIVACY_CLASS_HIDDEN = exports.PRIVACY_CLASS_ALLOW = exports.PRIVACY_ATTR_VALUE_MASK_USER_INPUT = exports.PRIVACY_ATTR_VALUE_MASK = exports.PRIVACY_ATTR_VALUE_HIDDEN = exports.PRIVACY_ATTR_VALUE_ALLOW = exports.PRIVACY_ATTR_NAME = exports.NodePrivacyLevel = exports.FORM_PRIVATE_TAG_NAMES = exports.CENSORED_STRING_MARK = exports.CENSORED_IMG_MARK = void 0;
|
|
7
|
+
|
|
8
|
+
var _browserCore = require("@cloudcare/browser-core");
|
|
9
|
+
|
|
10
|
+
var NodePrivacyLevel = {
|
|
11
|
+
IGNORE: 'ignore',
|
|
12
|
+
HIDDEN: 'hidden',
|
|
13
|
+
ALLOW: _browserCore.DefaultPrivacyLevel.ALLOW,
|
|
14
|
+
MASK: _browserCore.DefaultPrivacyLevel.MASK,
|
|
15
|
+
MASK_USER_INPUT: _browserCore.DefaultPrivacyLevel.MASK_USER_INPUT
|
|
16
|
+
};
|
|
17
|
+
exports.NodePrivacyLevel = NodePrivacyLevel;
|
|
18
|
+
var PRIVACY_ATTR_NAME = 'data-gc-privacy'; // Privacy Attrs
|
|
19
|
+
|
|
20
|
+
exports.PRIVACY_ATTR_NAME = PRIVACY_ATTR_NAME;
|
|
21
|
+
var PRIVACY_ATTR_VALUE_ALLOW = 'allow';
|
|
22
|
+
exports.PRIVACY_ATTR_VALUE_ALLOW = PRIVACY_ATTR_VALUE_ALLOW;
|
|
23
|
+
var PRIVACY_ATTR_VALUE_MASK = 'mask';
|
|
24
|
+
exports.PRIVACY_ATTR_VALUE_MASK = PRIVACY_ATTR_VALUE_MASK;
|
|
25
|
+
var PRIVACY_ATTR_VALUE_MASK_USER_INPUT = 'mask-user-input';
|
|
26
|
+
exports.PRIVACY_ATTR_VALUE_MASK_USER_INPUT = PRIVACY_ATTR_VALUE_MASK_USER_INPUT;
|
|
27
|
+
var PRIVACY_ATTR_VALUE_HIDDEN = 'hidden'; // Privacy Classes - not all customers can set plain HTML attributes, so support classes too
|
|
28
|
+
|
|
29
|
+
exports.PRIVACY_ATTR_VALUE_HIDDEN = PRIVACY_ATTR_VALUE_HIDDEN;
|
|
30
|
+
var PRIVACY_CLASS_ALLOW = 'gc-privacy-allow';
|
|
31
|
+
exports.PRIVACY_CLASS_ALLOW = PRIVACY_CLASS_ALLOW;
|
|
32
|
+
var PRIVACY_CLASS_MASK = 'gc-privacy-mask';
|
|
33
|
+
exports.PRIVACY_CLASS_MASK = PRIVACY_CLASS_MASK;
|
|
34
|
+
var PRIVACY_CLASS_MASK_USER_INPUT = 'gc-privacy-mask-user-input';
|
|
35
|
+
exports.PRIVACY_CLASS_MASK_USER_INPUT = PRIVACY_CLASS_MASK_USER_INPUT;
|
|
36
|
+
var PRIVACY_CLASS_HIDDEN = 'gc-privacy-hidden'; // Private Replacement Templates
|
|
37
|
+
|
|
38
|
+
exports.PRIVACY_CLASS_HIDDEN = PRIVACY_CLASS_HIDDEN;
|
|
39
|
+
var CENSORED_STRING_MARK = '***';
|
|
40
|
+
exports.CENSORED_STRING_MARK = CENSORED_STRING_MARK;
|
|
41
|
+
var CENSORED_IMG_MARK = 'data:image/gif;base64,R0lGODlhAQABAIAAAMLCwgAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==';
|
|
42
|
+
exports.CENSORED_IMG_MARK = CENSORED_IMG_MARK;
|
|
43
|
+
var FORM_PRIVATE_TAG_NAMES = {
|
|
44
|
+
INPUT: true,
|
|
45
|
+
OUTPUT: true,
|
|
46
|
+
TEXTAREA: true,
|
|
47
|
+
SELECT: true,
|
|
48
|
+
OPTION: true,
|
|
49
|
+
DATALIST: true,
|
|
50
|
+
OPTGROUP: true
|
|
51
|
+
};
|
|
52
|
+
exports.FORM_PRIVATE_TAG_NAMES = FORM_PRIVATE_TAG_NAMES;
|
package/cjs/domain/assembly.js
CHANGED
|
@@ -98,13 +98,7 @@ function startRumAssembly(configuration, lifeCycle, sessionManager, userSessionM
|
|
|
98
98
|
if (shouldSend(serverRumEvent, configuration.beforeSend, eventRateLimiters, domainContext)) {
|
|
99
99
|
if ((0, _browserCore.isEmptyObject)(serverRumEvent.tags)) {
|
|
100
100
|
delete serverRumEvent.tags;
|
|
101
|
-
}
|
|
102
|
-
// serverRumEvent.type === 'error'
|
|
103
|
-
// ) {
|
|
104
|
-
// console.log(serverRumEvent, '======serverRumEvent-====')
|
|
105
|
-
// }
|
|
106
|
-
// console.log('======serverRumEvent-====', serverRumEvent )
|
|
107
|
-
|
|
101
|
+
}
|
|
108
102
|
|
|
109
103
|
lifeCycle.notify(_browserCore.LifeCycleEventType.RUM_EVENT_COLLECTED, serverRumEvent);
|
|
110
104
|
}
|
|
@@ -76,7 +76,8 @@ function validateAndBuildRumConfiguration(initConfiguration) {
|
|
|
76
76
|
trackViewsManually: !!initConfiguration.trackViewsManually,
|
|
77
77
|
traceType: (0, _browserCore.isNullUndefinedDefaultValue)(initConfiguration.traceType, _browserCore.TraceType.DDTRACE),
|
|
78
78
|
traceId128Bit: !!initConfiguration.traceId128Bit,
|
|
79
|
-
isJsBirdge: !!initConfiguration.isJsBirdge
|
|
80
|
-
|
|
79
|
+
isJsBirdge: !!initConfiguration.isJsBirdge,
|
|
80
|
+
// 是否需要对webview 发送数据,需要装我们对应ios sdk
|
|
81
|
+
defaultPrivacyLevel: (0, _browserCore.objectHasValue)(_browserCore.DefaultPrivacyLevel, initConfiguration.defaultPrivacyLevel) ? initConfiguration.defaultPrivacyLevel : _browserCore.DefaultPrivacyLevel.MASK_USER_INPUT
|
|
81
82
|
}, baseConfiguration, _buildEnv.buildEnv);
|
|
82
83
|
}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.MAX_NUMBER_OF_STORED_FOREGROUND_PERIODS = exports.MAX_NUMBER_OF_SELECTABLE_FOREGROUND_PERIODS = void 0;
|
|
7
|
+
exports.addNewForegroundPeriod = addNewForegroundPeriod;
|
|
8
|
+
exports.closeForegroundPeriod = closeForegroundPeriod;
|
|
9
|
+
exports.startForegroundContexts = startForegroundContexts;
|
|
10
|
+
|
|
11
|
+
var _browserCore = require("@cloudcare/browser-core");
|
|
12
|
+
|
|
13
|
+
// Arbitrary value to cap number of element mostly for backend & to save bandwidth
|
|
14
|
+
var MAX_NUMBER_OF_SELECTABLE_FOREGROUND_PERIODS = 500; // Arbitrary value to cap number of element mostly for memory consumption in the browser
|
|
15
|
+
|
|
16
|
+
exports.MAX_NUMBER_OF_SELECTABLE_FOREGROUND_PERIODS = MAX_NUMBER_OF_SELECTABLE_FOREGROUND_PERIODS;
|
|
17
|
+
var MAX_NUMBER_OF_STORED_FOREGROUND_PERIODS = 2500;
|
|
18
|
+
exports.MAX_NUMBER_OF_STORED_FOREGROUND_PERIODS = MAX_NUMBER_OF_STORED_FOREGROUND_PERIODS;
|
|
19
|
+
var foregroundPeriods = [];
|
|
20
|
+
|
|
21
|
+
function startForegroundContexts() {
|
|
22
|
+
if (document.hasFocus()) {
|
|
23
|
+
addNewForegroundPeriod();
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
var foregroundTracking = trackFocus(addNewForegroundPeriod);
|
|
27
|
+
var blurTracking = trackBlur(closeForegroundPeriod);
|
|
28
|
+
return {
|
|
29
|
+
isInForegroundAt: isInForegroundAt,
|
|
30
|
+
selectInForegroundPeriodsFor: selectInForegroundPeriodsFor,
|
|
31
|
+
stop: function stop() {
|
|
32
|
+
foregroundPeriods = [];
|
|
33
|
+
foregroundTracking.stop();
|
|
34
|
+
blurTracking.stop();
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function addNewForegroundPeriod() {
|
|
40
|
+
if (foregroundPeriods.length > MAX_NUMBER_OF_STORED_FOREGROUND_PERIODS) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
var currentForegroundPeriod = foregroundPeriods[foregroundPeriods.length - 1];
|
|
45
|
+
var now = (0, _browserCore.relativeNow)();
|
|
46
|
+
|
|
47
|
+
if (currentForegroundPeriod !== undefined && currentForegroundPeriod.end === undefined) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
foregroundPeriods.push({
|
|
52
|
+
start: now
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function closeForegroundPeriod() {
|
|
57
|
+
if (foregroundPeriods.length === 0) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
var currentForegroundPeriod = foregroundPeriods[foregroundPeriods.length - 1];
|
|
62
|
+
var now = (0, _browserCore.relativeNow)();
|
|
63
|
+
|
|
64
|
+
if (currentForegroundPeriod.end !== undefined) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
currentForegroundPeriod.end = now;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function trackFocus(onFocusChange) {
|
|
72
|
+
return (0, _browserCore.addEventListener)(window, _browserCore.DOM_EVENT.FOCUS, function (event) {
|
|
73
|
+
if (!event.isTrusted) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
onFocusChange();
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function trackBlur(onBlurChange) {
|
|
82
|
+
return (0, _browserCore.addEventListener)(window, _browserCore.DOM_EVENT.BLUR, function (event) {
|
|
83
|
+
if (!event.isTrusted) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
onBlurChange();
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function isInForegroundAt(startTime) {
|
|
92
|
+
for (var i = foregroundPeriods.length - 1; i >= 0; i--) {
|
|
93
|
+
var foregroundPeriod = foregroundPeriods[i];
|
|
94
|
+
|
|
95
|
+
if (foregroundPeriod.end !== undefined && startTime > foregroundPeriod.end) {
|
|
96
|
+
break;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
if (startTime > foregroundPeriod.start && (foregroundPeriod.end === undefined || startTime < foregroundPeriod.end)) {
|
|
100
|
+
return true;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function selectInForegroundPeriodsFor(eventStartTime, duration) {
|
|
108
|
+
var eventEndTime = (0, _browserCore.addDuration)(eventStartTime, duration);
|
|
109
|
+
var filteredForegroundPeriods = [];
|
|
110
|
+
var earliestIndex = Math.max(0, foregroundPeriods.length - MAX_NUMBER_OF_SELECTABLE_FOREGROUND_PERIODS);
|
|
111
|
+
|
|
112
|
+
for (var i = foregroundPeriods.length - 1; i >= earliestIndex; i--) {
|
|
113
|
+
var foregroundPeriod = foregroundPeriods[i];
|
|
114
|
+
|
|
115
|
+
if (foregroundPeriod.end !== undefined && eventStartTime > foregroundPeriod.end) {
|
|
116
|
+
// event starts after the end of the current focus period
|
|
117
|
+
// since the array is sorted, we can stop looking for foreground periods
|
|
118
|
+
break;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
if (eventEndTime < foregroundPeriod.start) {
|
|
122
|
+
// event ends before the start of the current focus period
|
|
123
|
+
// continue to previous one
|
|
124
|
+
continue;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
var startTime = eventStartTime > foregroundPeriod.start ? eventStartTime : foregroundPeriod.start;
|
|
128
|
+
var startDuration = (0, _browserCore.elapsed)(eventStartTime, startTime);
|
|
129
|
+
var endTime = foregroundPeriod.end === undefined || eventEndTime < foregroundPeriod.end ? eventEndTime : foregroundPeriod.end;
|
|
130
|
+
var endDuration = (0, _browserCore.elapsed)(startTime, endTime);
|
|
131
|
+
filteredForegroundPeriods.unshift({
|
|
132
|
+
start: (0, _browserCore.toServerDuration)(startDuration),
|
|
133
|
+
duration: (0, _browserCore.toServerDuration)(endDuration)
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
return filteredForegroundPeriods;
|
|
138
|
+
}
|
|
@@ -34,7 +34,7 @@ function startInternalContext(applicationId, sessionManager, viewContexts, actio
|
|
|
34
34
|
url: urlContext.url,
|
|
35
35
|
referrer: urlContext.referrer,
|
|
36
36
|
host: urlContext.host,
|
|
37
|
-
path: urlContext.
|
|
37
|
+
path: urlContext.path,
|
|
38
38
|
pathGroup: urlContext.pathGroup,
|
|
39
39
|
urlQuery: urlContext.urlQuery
|
|
40
40
|
}
|
|
@@ -46,12 +46,19 @@ function startUrlContexts(lifeCycle, locationChangeObservable, location) {
|
|
|
46
46
|
});
|
|
47
47
|
|
|
48
48
|
function buildUrlContext(data) {
|
|
49
|
+
var path = data.location.pathname;
|
|
50
|
+
var hash = data.location.hash;
|
|
51
|
+
|
|
52
|
+
if (path === '/' && hash && !(0, _browserCore.isHashAnAnchor)(hash)) {
|
|
53
|
+
path = '/' + (0, _browserCore.getPathFromHash)(hash);
|
|
54
|
+
}
|
|
55
|
+
|
|
49
56
|
return {
|
|
50
57
|
url: data.url,
|
|
51
58
|
referrer: data.referrer,
|
|
52
59
|
host: data.location.host,
|
|
53
|
-
path:
|
|
54
|
-
pathGroup: (0, _browserCore.replaceNumberCharByPath)(
|
|
60
|
+
path: path,
|
|
61
|
+
pathGroup: (0, _browserCore.replaceNumberCharByPath)(path),
|
|
55
62
|
urlQuery: (0, _browserCore.jsonStringify)((0, _browserCore.getQueryParamsFromUrl)(data.location.href))
|
|
56
63
|
};
|
|
57
64
|
}
|
|
@@ -46,13 +46,12 @@ function getMutationObserverConstructor() {
|
|
|
46
46
|
// [2] https://github.com/angular/angular/issues/31712
|
|
47
47
|
|
|
48
48
|
if (browserWindow.Zone) {
|
|
49
|
-
|
|
49
|
+
// Zone.js 0.8.6+ is storing original class constructors into the browser 'window' object[3].
|
|
50
50
|
//
|
|
51
51
|
// [3] https://github.com/angular/angular/blob/6375fa79875c0fe7b815efc45940a6e6f5c9c9eb/packages/zone.js/lib/common/utils.ts#L288
|
|
52
|
+
constructor = (0, _browserCore.getZoneJsOriginalValue)(browserWindow, 'MutationObserver');
|
|
52
53
|
|
|
53
|
-
constructor
|
|
54
|
-
|
|
55
|
-
if (!constructor && browserWindow.MutationObserver) {
|
|
54
|
+
if (browserWindow.MutationObserver && constructor === browserWindow.MutationObserver) {
|
|
56
55
|
// Anterior Zone.js versions (used in Angular 2) does not expose the original MutationObserver
|
|
57
56
|
// in the 'window' object. Luckily, the patched MutationObserver class is storing an original
|
|
58
57
|
// instance in its properties[4]. Let's get the original MutationObserver constructor from
|
|
@@ -60,7 +59,7 @@ function getMutationObserverConstructor() {
|
|
|
60
59
|
//
|
|
61
60
|
// [4] https://github.com/angular/zone.js/blob/v0.8.5/lib/common/utils.ts#L412
|
|
62
61
|
var patchedInstance = new browserWindow.MutationObserver(_browserCore.noop);
|
|
63
|
-
var originalInstance = patchedInstance
|
|
62
|
+
var originalInstance = (0, _browserCore.getZoneJsOriginalValue)(patchedInstance, 'originalInstance');
|
|
64
63
|
constructor = originalInstance && originalInstance.constructor;
|
|
65
64
|
}
|
|
66
65
|
}
|