@newrelic/browser-agent 1.235.0 → 1.237.0
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 +41 -1
- package/dist/cjs/common/config/state/init.js +4 -0
- package/dist/cjs/common/config/state/runtime.js +6 -5
- package/dist/cjs/common/constants/env.cdn.js +2 -2
- package/dist/cjs/common/constants/env.npm.js +1 -1
- package/dist/cjs/common/constants/runtime.js +52 -0
- package/dist/cjs/common/deny-list/deny-list.js +14 -10
- package/dist/cjs/common/event-listener/event-listener-opts.js +3 -3
- package/dist/cjs/common/harvest/harvest-scheduler.js +22 -19
- package/dist/cjs/common/harvest/harvest.js +154 -148
- package/dist/cjs/common/harvest/types.js +54 -0
- package/dist/cjs/common/ids/id.js +2 -2
- package/dist/cjs/common/ids/unique-id.js +3 -3
- package/dist/cjs/common/session/session-entity.js +2 -2
- package/dist/cjs/common/timer/interaction-timer.js +2 -2
- package/dist/cjs/common/unload/eol.js +10 -11
- package/dist/cjs/common/url/canonicalize-url.js +2 -2
- package/dist/cjs/common/url/parse-url.js +3 -3
- package/dist/cjs/common/url/protocol.js +2 -2
- package/dist/cjs/common/util/submit-data.js +31 -81
- package/dist/cjs/common/window/nreum.js +14 -14
- package/dist/cjs/common/wrap/wrap-events.js +3 -3
- package/dist/cjs/common/wrap/wrap-fetch.js +5 -5
- package/dist/cjs/common/wrap/wrap-history.js +2 -2
- package/dist/cjs/common/wrap/wrap-jsonp.js +14 -8
- package/dist/cjs/common/wrap/wrap-mutation.js +2 -2
- package/dist/cjs/common/wrap/wrap-promise.js +2 -2
- package/dist/cjs/common/wrap/wrap-raf.js +2 -2
- package/dist/cjs/common/wrap/wrap-timer.js +4 -4
- package/dist/cjs/common/wrap/wrap-xhr.js +3 -3
- package/dist/cjs/features/ajax/aggregate/index.js +25 -28
- package/dist/cjs/features/ajax/instrument/distributed-tracing.js +2 -2
- package/dist/cjs/features/ajax/instrument/index.js +6 -7
- package/dist/cjs/features/jserrors/aggregate/compute-stack-trace.js +1 -1
- package/dist/cjs/features/jserrors/aggregate/index.js +7 -4
- package/dist/cjs/features/jserrors/constants.js +2 -4
- package/dist/cjs/features/jserrors/instrument/index.js +80 -89
- package/dist/cjs/features/jserrors/instrument/uncaught-error.js +22 -0
- package/dist/cjs/features/metrics/aggregate/framework-detection.js +2 -2
- package/dist/cjs/features/metrics/aggregate/index.js +3 -3
- package/dist/cjs/features/page_action/aggregate/index.js +3 -3
- package/dist/cjs/features/page_view_event/aggregate/index.js +10 -11
- package/dist/cjs/features/page_view_event/aggregate/initialized-features.js +23 -19
- package/dist/cjs/features/page_view_event/instrument/index.js +2 -2
- package/dist/cjs/features/page_view_timing/aggregate/index.js +3 -5
- package/dist/cjs/features/page_view_timing/instrument/index.js +2 -2
- package/dist/cjs/features/session_replay/aggregate/index.js +65 -34
- package/dist/cjs/features/session_replay/replay-mode.js +2 -2
- package/dist/cjs/features/session_trace/aggregate/index.js +3 -4
- package/dist/cjs/features/session_trace/instrument/index.js +2 -2
- package/dist/cjs/features/spa/aggregate/index.js +1 -1
- package/dist/cjs/features/spa/instrument/index.js +2 -2
- package/dist/cjs/features/utils/instrument-base.js +12 -15
- package/dist/cjs/index.js +7 -0
- package/dist/cjs/loaders/agent-base.js +87 -0
- package/dist/cjs/loaders/agent.js +48 -1
- package/dist/cjs/loaders/api/api.js +3 -3
- package/dist/cjs/loaders/api/apiAsync.js +6 -4
- package/dist/cjs/loaders/api/interaction-types.js +87 -0
- package/dist/cjs/loaders/configure/configure.js +4 -3
- package/dist/cjs/loaders/micro-agent.js +32 -39
- package/dist/esm/common/config/state/init.js +4 -0
- package/dist/esm/common/config/state/runtime.js +3 -2
- package/dist/esm/common/constants/env.cdn.js +2 -2
- package/dist/esm/common/constants/env.npm.js +1 -1
- package/dist/esm/common/constants/runtime.js +38 -0
- package/dist/esm/common/deny-list/deny-list.js +14 -10
- package/dist/esm/common/event-listener/event-listener-opts.js +1 -1
- package/dist/esm/common/harvest/harvest-scheduler.js +21 -20
- package/dist/esm/common/harvest/harvest.js +150 -146
- package/dist/esm/common/harvest/types.js +47 -0
- package/dist/esm/common/ids/id.js +1 -1
- package/dist/esm/common/ids/unique-id.js +1 -1
- package/dist/esm/common/session/session-entity.js +1 -1
- package/dist/esm/common/timer/interaction-timer.js +1 -1
- package/dist/esm/common/unload/eol.js +1 -2
- package/dist/esm/common/url/canonicalize-url.js +1 -1
- package/dist/esm/common/url/parse-url.js +1 -1
- package/dist/esm/common/url/protocol.js +1 -1
- package/dist/esm/common/util/submit-data.js +29 -78
- package/dist/esm/common/window/nreum.js +1 -1
- package/dist/esm/common/wrap/wrap-events.js +1 -1
- package/dist/esm/common/wrap/wrap-fetch.js +1 -1
- package/dist/esm/common/wrap/wrap-history.js +1 -1
- package/dist/esm/common/wrap/wrap-jsonp.js +13 -7
- package/dist/esm/common/wrap/wrap-mutation.js +1 -1
- package/dist/esm/common/wrap/wrap-promise.js +1 -1
- package/dist/esm/common/wrap/wrap-raf.js +1 -1
- package/dist/esm/common/wrap/wrap-timer.js +1 -1
- package/dist/esm/common/wrap/wrap-xhr.js +1 -1
- package/dist/esm/features/ajax/aggregate/index.js +26 -29
- package/dist/esm/features/ajax/instrument/distributed-tracing.js +1 -1
- package/dist/esm/features/ajax/instrument/index.js +1 -2
- package/dist/esm/features/jserrors/aggregate/compute-stack-trace.js +1 -1
- package/dist/esm/features/jserrors/aggregate/index.js +6 -3
- package/dist/esm/features/jserrors/constants.js +1 -2
- package/dist/esm/features/jserrors/instrument/index.js +79 -88
- package/dist/esm/features/jserrors/instrument/uncaught-error.js +15 -0
- package/dist/esm/features/metrics/aggregate/framework-detection.js +1 -1
- package/dist/esm/features/metrics/aggregate/index.js +1 -1
- package/dist/esm/features/page_action/aggregate/index.js +1 -1
- package/dist/esm/features/page_view_event/aggregate/index.js +1 -2
- package/dist/esm/features/page_view_event/aggregate/initialized-features.js +23 -19
- package/dist/esm/features/page_view_event/instrument/index.js +1 -1
- package/dist/esm/features/page_view_timing/aggregate/index.js +2 -4
- package/dist/esm/features/page_view_timing/instrument/index.js +1 -1
- package/dist/esm/features/session_replay/aggregate/index.js +65 -34
- package/dist/esm/features/session_replay/replay-mode.js +2 -2
- package/dist/esm/features/session_trace/aggregate/index.js +3 -4
- package/dist/esm/features/session_trace/instrument/index.js +1 -1
- package/dist/esm/features/spa/aggregate/index.js +1 -1
- package/dist/esm/features/spa/instrument/index.js +1 -1
- package/dist/esm/features/utils/instrument-base.js +11 -14
- package/dist/esm/index.js +1 -4
- package/dist/esm/loaders/agent-base.js +80 -0
- package/dist/esm/loaders/agent.js +48 -1
- package/dist/esm/loaders/api/api.js +2 -2
- package/dist/esm/loaders/api/apiAsync.js +3 -3
- package/dist/esm/loaders/api/interaction-types.js +80 -0
- package/dist/esm/loaders/configure/configure.js +4 -3
- package/dist/esm/loaders/micro-agent.js +32 -39
- package/dist/types/common/config/state/init.d.ts.map +1 -1
- package/dist/types/common/config/state/runtime.d.ts.map +1 -1
- package/dist/types/common/constants/runtime.d.ts +29 -0
- package/dist/types/common/constants/runtime.d.ts.map +1 -0
- package/dist/types/common/event-emitter/register-handler.d.ts +1 -1
- package/dist/types/common/harvest/harvest-scheduler.d.ts +1 -1
- package/dist/types/common/harvest/harvest-scheduler.d.ts.map +1 -1
- package/dist/types/common/harvest/harvest.d.ts +49 -38
- package/dist/types/common/harvest/harvest.d.ts.map +1 -1
- package/dist/types/common/harvest/types.d.ts +100 -0
- package/dist/types/common/harvest/types.d.ts.map +1 -0
- package/dist/types/common/session/session-entity.d.ts +6 -6
- package/dist/types/common/unload/eol.d.ts.map +1 -1
- package/dist/types/common/util/submit-data.d.ts +44 -64
- package/dist/types/common/util/submit-data.d.ts.map +1 -1
- package/dist/types/common/window/nreum.d.ts +2 -2
- package/dist/types/common/wrap/wrap-jsonp.d.ts.map +1 -1
- package/dist/types/features/ajax/aggregate/index.d.ts +5 -5
- package/dist/types/features/ajax/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/ajax/instrument/index.d.ts.map +1 -1
- package/dist/types/features/jserrors/aggregate/index.d.ts +1 -1
- package/dist/types/features/jserrors/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/jserrors/constants.d.ts +0 -1
- package/dist/types/features/jserrors/constants.d.ts.map +1 -1
- package/dist/types/features/jserrors/instrument/index.d.ts +0 -13
- package/dist/types/features/jserrors/instrument/index.d.ts.map +1 -1
- package/dist/types/features/jserrors/instrument/uncaught-error.d.ts +15 -0
- package/dist/types/features/jserrors/instrument/uncaught-error.d.ts.map +1 -0
- package/dist/types/features/metrics/aggregate/endpoint-map.d.ts +5 -5
- package/dist/types/features/page_view_event/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/page_view_event/aggregate/initialized-features.d.ts.map +1 -1
- package/dist/types/features/page_view_timing/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/session_replay/aggregate/index.d.ts +16 -30
- package/dist/types/features/session_replay/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/session_trace/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/utils/instrument-base.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/loaders/agent-base.d.ts +59 -0
- package/dist/types/loaders/agent-base.d.ts.map +1 -0
- package/dist/types/loaders/agent.d.ts +39 -5
- package/dist/types/loaders/agent.d.ts.map +1 -1
- package/dist/types/loaders/api/interaction-types.d.ts +122 -0
- package/dist/types/loaders/api/interaction-types.d.ts.map +1 -0
- package/dist/types/loaders/configure/configure.d.ts.map +1 -1
- package/dist/types/loaders/features/features.d.ts +9 -9
- package/dist/types/loaders/micro-agent.d.ts +6 -6
- package/dist/types/loaders/micro-agent.d.ts.map +1 -1
- package/package.json +6 -1
- package/src/common/config/__mocks__/config.js +11 -0
- package/src/common/config/state/init.js +2 -1
- package/src/common/config/state/runtime.js +3 -2
- package/src/common/constants/__mocks__/env.js +3 -0
- package/src/common/constants/__mocks__/runtime.js +8 -0
- package/src/common/constants/env.cdn.test.js +7 -0
- package/src/common/constants/env.npm.test.js +7 -0
- package/src/common/constants/env.test.js +7 -0
- package/src/common/constants/runtime.js +71 -0
- package/src/common/constants/runtime.test.js +168 -0
- package/src/common/context/__mocks__/shared-context.js +8 -0
- package/src/common/deny-list/deny-list.js +11 -11
- package/src/common/deny-list/deny-list.test.js +31 -0
- package/src/common/event-listener/__mocks__/event-listener-opts.js +7 -0
- package/src/common/event-listener/event-listener-opts.js +1 -1
- package/src/common/harvest/__mocks__/harvest.js +13 -0
- package/src/common/harvest/harvest-scheduler.js +21 -20
- package/src/common/harvest/harvest-scheduler.test.js +496 -0
- package/src/common/harvest/harvest.js +142 -134
- package/src/common/harvest/harvest.test.js +798 -0
- package/src/common/harvest/types.js +47 -0
- package/src/common/ids/id.js +1 -1
- package/src/common/ids/unique-id.js +1 -1
- package/src/common/session/__mocks__/session-entity.js +25 -0
- package/src/common/session/session-entity.component-test.js +1 -1
- package/src/common/session/session-entity.js +1 -1
- package/src/common/timer/interaction-timer.js +1 -1
- package/src/common/timing/__mocks__/now.js +1 -0
- package/src/common/unload/__mocks__/eol.js +1 -0
- package/src/common/unload/eol.js +1 -2
- package/src/common/url/__mocks__/clean-url.js +1 -0
- package/src/common/url/__mocks__/encode.js +7 -0
- package/src/common/url/__mocks__/location.js +1 -0
- package/src/common/url/canonicalize-url.js +1 -1
- package/src/common/url/canonicalize-url.test.js +2 -2
- package/src/common/url/parse-url.js +1 -1
- package/src/common/url/parse-url.test.js +3 -3
- package/src/common/url/protocol.js +1 -1
- package/src/common/util/__mocks__/obfuscate.js +10 -0
- package/src/common/util/__mocks__/stringify.js +1 -0
- package/src/common/util/__mocks__/submit-data.js +5 -0
- package/src/common/util/__mocks__/traverse.js +1 -0
- package/src/common/util/submit-data.js +22 -58
- package/src/common/util/submit-data.test.js +30 -73
- package/src/common/window/nreum.js +1 -1
- package/src/common/wrap/wrap-events.js +1 -1
- package/src/common/wrap/wrap-fetch.js +1 -1
- package/src/common/wrap/wrap-history.js +1 -1
- package/src/common/wrap/wrap-jsonp.js +12 -7
- package/src/common/wrap/wrap-mutation.js +1 -1
- package/src/common/wrap/wrap-promise.js +1 -1
- package/src/common/wrap/wrap-promise.test.js +2 -2
- package/src/common/wrap/wrap-raf.js +1 -1
- package/src/common/wrap/wrap-timer.js +1 -1
- package/src/common/wrap/wrap-xhr.js +1 -1
- package/src/features/ajax/aggregate/index.js +26 -32
- package/src/features/ajax/instrument/distributed-tracing.js +1 -1
- package/src/features/ajax/instrument/index.js +1 -2
- package/src/features/jserrors/aggregate/compute-stack-trace.js +1 -1
- package/src/features/jserrors/aggregate/compute-stack-trace.test.js +1 -1
- package/src/features/jserrors/aggregate/index.js +7 -3
- package/src/features/jserrors/constants.js +0 -1
- package/src/features/jserrors/instrument/index.js +92 -88
- package/src/features/jserrors/instrument/uncaught-error.js +15 -0
- package/src/features/metrics/aggregate/framework-detection.js +1 -1
- package/src/features/metrics/aggregate/framework-detection.test.js +2 -2
- package/src/features/metrics/aggregate/index.js +1 -1
- package/src/features/page_action/aggregate/index.js +1 -1
- package/src/features/page_view_event/aggregate/index.js +1 -2
- package/src/features/page_view_event/aggregate/initialized-features.js +18 -14
- package/src/features/page_view_event/instrument/index.js +1 -1
- package/src/features/page_view_timing/aggregate/index.js +2 -4
- package/src/features/page_view_timing/instrument/index.js +1 -1
- package/src/features/session_replay/aggregate/index.component-test.js +17 -56
- package/src/features/session_replay/aggregate/index.js +47 -28
- package/src/features/session_replay/replay-mode.js +2 -2
- package/src/features/session_trace/aggregate/index.js +3 -4
- package/src/features/session_trace/instrument/index.js +1 -1
- package/src/features/spa/aggregate/index.js +1 -1
- package/src/features/spa/instrument/index.js +1 -1
- package/src/features/utils/agent-session.test.js +2 -2
- package/src/features/utils/instrument-base.js +11 -14
- package/src/features/utils/instrument-base.test.js +29 -3
- package/src/index.js +1 -3
- package/src/loaders/agent-base.js +81 -0
- package/src/loaders/agent.js +50 -1
- package/src/loaders/api/api.js +2 -2
- package/src/loaders/api/apiAsync.js +3 -3
- package/src/loaders/api/interaction-types.js +80 -0
- package/src/loaders/configure/configure.js +5 -4
- package/src/loaders/micro-agent.js +30 -31
- package/dist/cjs/common/browser-version/firefox-version.js +0 -17
- package/dist/cjs/common/browser-version/ios-version.js +0 -19
- package/dist/cjs/common/event-emitter/contextual-ee.test.js +0 -282
- package/dist/cjs/common/event-emitter/handle.test.js +0 -58
- package/dist/cjs/common/event-emitter/register-handler.test.js +0 -55
- package/dist/cjs/common/harvest/harvest-scheduler.component-test.js +0 -39
- package/dist/cjs/common/harvest/harvest.component-test.js +0 -224
- package/dist/cjs/common/ids/id.test.js +0 -85
- package/dist/cjs/common/ids/unique-id.test.js +0 -49
- package/dist/cjs/common/session/session-entity.component-test.js +0 -497
- package/dist/cjs/common/storage/local-storage.test.js +0 -14
- package/dist/cjs/common/timer/interaction-timer.component-test.js +0 -216
- package/dist/cjs/common/timer/timer.test.js +0 -105
- package/dist/cjs/common/timing/nav-timing.test.js +0 -192
- package/dist/cjs/common/url/canonicalize-url.test.js +0 -38
- package/dist/cjs/common/url/clean-url.test.js +0 -9
- package/dist/cjs/common/url/encode.component-test.js +0 -74
- package/dist/cjs/common/url/location.test.js +0 -13
- package/dist/cjs/common/url/parse-url.test.js +0 -111
- package/dist/cjs/common/url/protocol.component-test.js +0 -15
- package/dist/cjs/common/util/console.test.js +0 -30
- package/dist/cjs/common/util/data-size.test.js +0 -64
- package/dist/cjs/common/util/feature-flags.test.js +0 -84
- package/dist/cjs/common/util/get-or-set.test.js +0 -47
- package/dist/cjs/common/util/global-scope.js +0 -27
- package/dist/cjs/common/util/global-scope.test.js +0 -72
- package/dist/cjs/common/util/invoke.test.js +0 -49
- package/dist/cjs/common/util/map-own.test.js +0 -49
- package/dist/cjs/common/util/obfuscate.component-test.js +0 -129
- package/dist/cjs/common/util/stringify.test.js +0 -48
- package/dist/cjs/common/util/submit-data.test.js +0 -245
- package/dist/cjs/common/util/traverse.test.js +0 -44
- package/dist/cjs/common/wrap/wrap-promise.test.js +0 -119
- package/dist/cjs/features/jserrors/aggregate/canonical-function-name.test.js +0 -31
- package/dist/cjs/features/jserrors/aggregate/compute-stack-trace.test.js +0 -383
- package/dist/cjs/features/jserrors/aggregate/format-stack-trace.test.js +0 -40
- package/dist/cjs/features/jserrors/aggregate/string-hash-code.test.js +0 -27
- package/dist/cjs/features/jserrors/instrument/debug.js +0 -40
- package/dist/cjs/features/metrics/aggregate/framework-detection.test.js +0 -137
- package/dist/cjs/features/metrics/aggregate/polyfill-detection.es5.test.js +0 -17
- package/dist/cjs/features/metrics/aggregate/polyfill-detection.test.js +0 -165
- package/dist/cjs/features/session_replay/aggregate/index.component-test.js +0 -457
- package/dist/cjs/features/spa/aggregate/interaction-node.test.js +0 -16
- package/dist/cjs/features/utils/agent-session.test.js +0 -211
- package/dist/cjs/features/utils/aggregate-base.test.js +0 -110
- package/dist/cjs/features/utils/feature-base.test.js +0 -42
- package/dist/cjs/features/utils/handler-cache.test.js +0 -53
- package/dist/cjs/features/utils/instrument-base.test.js +0 -179
- package/dist/cjs/features/utils/lazy-feature-loader.test.js +0 -30
- package/dist/esm/common/browser-version/firefox-version.js +0 -10
- package/dist/esm/common/browser-version/ios-version.js +0 -11
- package/dist/esm/common/event-emitter/contextual-ee.test.js +0 -278
- package/dist/esm/common/event-emitter/handle.test.js +0 -54
- package/dist/esm/common/event-emitter/register-handler.test.js +0 -51
- package/dist/esm/common/harvest/harvest-scheduler.component-test.js +0 -37
- package/dist/esm/common/harvest/harvest.component-test.js +0 -222
- package/dist/esm/common/ids/id.test.js +0 -81
- package/dist/esm/common/ids/unique-id.test.js +0 -44
- package/dist/esm/common/session/session-entity.component-test.js +0 -495
- package/dist/esm/common/storage/local-storage.test.js +0 -12
- package/dist/esm/common/timer/interaction-timer.component-test.js +0 -214
- package/dist/esm/common/timer/timer.test.js +0 -103
- package/dist/esm/common/timing/nav-timing.test.js +0 -190
- package/dist/esm/common/url/canonicalize-url.test.js +0 -34
- package/dist/esm/common/url/clean-url.test.js +0 -7
- package/dist/esm/common/url/encode.component-test.js +0 -70
- package/dist/esm/common/url/location.test.js +0 -11
- package/dist/esm/common/url/parse-url.test.js +0 -107
- package/dist/esm/common/url/protocol.component-test.js +0 -13
- package/dist/esm/common/util/console.test.js +0 -28
- package/dist/esm/common/util/data-size.test.js +0 -60
- package/dist/esm/common/util/feature-flags.test.js +0 -80
- package/dist/esm/common/util/get-or-set.test.js +0 -45
- package/dist/esm/common/util/global-scope.js +0 -17
- package/dist/esm/common/util/global-scope.test.js +0 -70
- package/dist/esm/common/util/invoke.test.js +0 -47
- package/dist/esm/common/util/map-own.test.js +0 -47
- package/dist/esm/common/util/obfuscate.component-test.js +0 -125
- package/dist/esm/common/util/stringify.test.js +0 -46
- package/dist/esm/common/util/submit-data.test.js +0 -241
- package/dist/esm/common/util/traverse.test.js +0 -42
- package/dist/esm/common/wrap/wrap-promise.test.js +0 -115
- package/dist/esm/features/jserrors/aggregate/canonical-function-name.test.js +0 -29
- package/dist/esm/features/jserrors/aggregate/compute-stack-trace.test.js +0 -379
- package/dist/esm/features/jserrors/aggregate/format-stack-trace.test.js +0 -38
- package/dist/esm/features/jserrors/aggregate/string-hash-code.test.js +0 -25
- package/dist/esm/features/jserrors/instrument/debug.js +0 -38
- package/dist/esm/features/metrics/aggregate/framework-detection.test.js +0 -133
- package/dist/esm/features/metrics/aggregate/polyfill-detection.es5.test.js +0 -15
- package/dist/esm/features/metrics/aggregate/polyfill-detection.test.js +0 -163
- package/dist/esm/features/session_replay/aggregate/index.component-test.js +0 -453
- package/dist/esm/features/spa/aggregate/interaction-node.test.js +0 -14
- package/dist/esm/features/utils/agent-session.test.js +0 -207
- package/dist/esm/features/utils/aggregate-base.test.js +0 -108
- package/dist/esm/features/utils/feature-base.test.js +0 -40
- package/dist/esm/features/utils/handler-cache.test.js +0 -51
- package/dist/esm/features/utils/instrument-base.test.js +0 -175
- package/dist/esm/features/utils/lazy-feature-loader.test.js +0 -29
- package/dist/types/common/browser-version/firefox-version.d.ts +0 -2
- package/dist/types/common/browser-version/firefox-version.d.ts.map +0 -1
- package/dist/types/common/browser-version/ios-version.d.ts +0 -3
- package/dist/types/common/browser-version/ios-version.d.ts.map +0 -1
- package/dist/types/common/harvest/harvest-scheduler.component-test.d.ts +0 -2
- package/dist/types/common/harvest/harvest-scheduler.component-test.d.ts.map +0 -1
- package/dist/types/common/harvest/harvest.component-test.d.ts +0 -2
- package/dist/types/common/harvest/harvest.component-test.d.ts.map +0 -1
- package/dist/types/common/session/session-entity.component-test.d.ts +0 -2
- package/dist/types/common/session/session-entity.component-test.d.ts.map +0 -1
- package/dist/types/common/timer/interaction-timer.component-test.d.ts +0 -2
- package/dist/types/common/timer/interaction-timer.component-test.d.ts.map +0 -1
- package/dist/types/common/url/encode.component-test.d.ts +0 -2
- package/dist/types/common/url/encode.component-test.d.ts.map +0 -1
- package/dist/types/common/url/protocol.component-test.d.ts +0 -2
- package/dist/types/common/url/protocol.component-test.d.ts.map +0 -1
- package/dist/types/common/util/global-scope.d.ts +0 -5
- package/dist/types/common/util/global-scope.d.ts.map +0 -1
- package/dist/types/common/util/obfuscate.component-test.d.ts +0 -2
- package/dist/types/common/util/obfuscate.component-test.d.ts.map +0 -1
- package/dist/types/features/jserrors/instrument/debug.d.ts +0 -2
- package/dist/types/features/jserrors/instrument/debug.d.ts.map +0 -1
- package/dist/types/features/session_replay/aggregate/index.component-test.d.ts +0 -2
- package/dist/types/features/session_replay/aggregate/index.component-test.d.ts.map +0 -1
- package/src/common/browser-version/firefox-version.js +0 -10
- package/src/common/browser-version/ios-version.js +0 -11
- package/src/common/harvest/harvest-scheduler.component-test.js +0 -25
- package/src/common/harvest/harvest.component-test.js +0 -169
- package/src/common/util/global-scope.js +0 -23
- package/src/common/util/global-scope.test.js +0 -87
- package/src/features/jserrors/instrument/debug.js +0 -36
|
@@ -15,7 +15,7 @@ var _handle = require("../../../common/event-emitter/handle");
|
|
|
15
15
|
var _mapOwn = require("../../../common/util/map-own");
|
|
16
16
|
var _config = require("../../../common/config/config");
|
|
17
17
|
var _now = require("../../../common/timing/now");
|
|
18
|
-
var
|
|
18
|
+
var _runtime = require("../../../common/constants/runtime");
|
|
19
19
|
var _constants = require("../constants");
|
|
20
20
|
var _drain = require("../../../common/drain/drain");
|
|
21
21
|
var _features = require("../../../loaders/features/features");
|
|
@@ -100,7 +100,7 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
100
100
|
(0, _mapOwn.mapOwn)(this.currentBody, (key, value) => {
|
|
101
101
|
for (var i = 0; i < value.length; i++) {
|
|
102
102
|
var bucket = value[i];
|
|
103
|
-
var name = this.getBucketName(bucket.params, bucket.custom);
|
|
103
|
+
var name = this.getBucketName(key, bucket.params, bucket.custom);
|
|
104
104
|
this.aggregator.merge(key, name, bucket.metrics, bucket.params, bucket.custom);
|
|
105
105
|
}
|
|
106
106
|
});
|
|
@@ -110,7 +110,10 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
110
110
|
nameHash(params) {
|
|
111
111
|
return (0, _stringHashCode.stringHashCode)("".concat(params.exceptionClass, "_").concat(params.message, "_").concat(params.stack_trace || params.browser_stack_hash));
|
|
112
112
|
}
|
|
113
|
-
getBucketName(params, customParams) {
|
|
113
|
+
getBucketName(objType, params, customParams) {
|
|
114
|
+
if (objType === 'xhr') {
|
|
115
|
+
return (0, _stringHashCode.stringHashCode)((0, _stringify.stringify)(params)) + ':' + (0, _stringHashCode.stringHashCode)((0, _stringify.stringify)(customParams));
|
|
116
|
+
}
|
|
114
117
|
return this.nameHash(params) + ':' + (0, _stringHashCode.stringHashCode)((0, _stringify.stringify)(customParams));
|
|
115
118
|
}
|
|
116
119
|
|
|
@@ -153,7 +156,7 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
153
156
|
const params = {
|
|
154
157
|
stackHash: (0, _stringHashCode.stringHashCode)(canonicalStackString),
|
|
155
158
|
exceptionClass: stackInfo.name,
|
|
156
|
-
request_uri:
|
|
159
|
+
request_uri: _runtime.globalScope?.location.pathname
|
|
157
160
|
};
|
|
158
161
|
if (stackInfo.message) params.message = '' + stackInfo.message;
|
|
159
162
|
// Notice if filterOutput isn't false|undefined OR our specified object, this func would've returned already (so it's unnecessary to req-check group).
|
|
@@ -3,9 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.FEATURE_NAME = void 0;
|
|
7
7
|
var _features = require("../../loaders/features/features");
|
|
8
8
|
const FEATURE_NAME = _features.FEATURE_NAMES.jserrors;
|
|
9
|
-
exports.FEATURE_NAME = FEATURE_NAME;
|
|
10
|
-
const NR_ERR_PROP = 'nr@seenError';
|
|
11
|
-
exports.NR_ERR_PROP = NR_ERR_PROP;
|
|
9
|
+
exports.FEATURE_NAME = FEATURE_NAME;
|
|
@@ -6,16 +6,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.Instrument = void 0;
|
|
7
7
|
var _handle = require("../../../common/event-emitter/handle");
|
|
8
8
|
var _now = require("../../../common/timing/now");
|
|
9
|
-
var _getOrSet = require("../../../common/util/get-or-set");
|
|
10
|
-
var _wrap = require("../../../common/wrap");
|
|
11
|
-
require("./debug");
|
|
12
9
|
var _instrumentBase = require("../../utils/instrument-base");
|
|
13
10
|
var _constants = require("../constants");
|
|
14
11
|
var _features = require("../../../loaders/features/features");
|
|
15
|
-
var
|
|
12
|
+
var _runtime = require("../../../common/constants/runtime");
|
|
16
13
|
var _eventListenerOpts = require("../../../common/event-listener/event-listener-opts");
|
|
17
|
-
var _config = require("../../../common/config/config");
|
|
18
14
|
var _stringify = require("../../../common/util/stringify");
|
|
15
|
+
var _uncaughtError = require("./uncaught-error");
|
|
19
16
|
/*
|
|
20
17
|
* Copyright 2020 New Relic Corporation. All rights reserved.
|
|
21
18
|
* SPDX-License-Identifier: Apache-2.0
|
|
@@ -23,51 +20,44 @@ var _stringify = require("../../../common/util/stringify");
|
|
|
23
20
|
|
|
24
21
|
class Instrument extends _instrumentBase.InstrumentBase {
|
|
25
22
|
static featureName = _constants.FEATURE_NAME;
|
|
23
|
+
#seenErrors = new Set();
|
|
26
24
|
constructor(agentIdentifier, aggregator) {
|
|
27
25
|
let auto = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
28
26
|
super(agentIdentifier, aggregator, _constants.FEATURE_NAME, auto);
|
|
29
|
-
// skipNext counter to keep track of uncaught
|
|
30
|
-
// errors that will be the same as caught errors.
|
|
31
|
-
this.skipNext = 0;
|
|
32
27
|
try {
|
|
33
28
|
// this try-catch can be removed when IE11 is completely unsupported & gone
|
|
34
29
|
this.removeOnAbort = new AbortController();
|
|
35
30
|
} catch (e) {}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
(0, _getOrSet.getOrSet)(err, _constants.NR_ERR_PROP, function getVal() {
|
|
43
|
-
return true;
|
|
44
|
-
});
|
|
45
|
-
this.thrown = true;
|
|
46
|
-
(0, _handle.handle)('err', [err, (0, _now.now)()], undefined, _features.FEATURE_NAMES.jserrors, thisInstrument.ee);
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
thisInstrument.ee.on('fn-end', function () {
|
|
50
|
-
if (!thisInstrument.abortHandler) return;
|
|
51
|
-
if (!this.thrown && thisInstrument.skipNext > 0) thisInstrument.skipNext -= 1;
|
|
31
|
+
|
|
32
|
+
// Capture function errors early in case the spa feature is loaded
|
|
33
|
+
this.ee.on('fn-err', (args, obj, error) => {
|
|
34
|
+
if (!this.abortHandler || this.#seenErrors.has(error)) return;
|
|
35
|
+
this.#seenErrors.add(error);
|
|
36
|
+
(0, _handle.handle)('err', [this.#castError(error), (0, _now.now)()], undefined, _features.FEATURE_NAMES.jserrors, this.ee);
|
|
52
37
|
});
|
|
53
|
-
|
|
54
|
-
|
|
38
|
+
this.ee.on('internal-error', error => {
|
|
39
|
+
if (!this.abortHandler) return;
|
|
40
|
+
(0, _handle.handle)('ierr', [this.#castError(error), (0, _now.now)(), true], undefined, _features.FEATURE_NAMES.jserrors, this.ee);
|
|
55
41
|
});
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
_globalScope.globalScope.onerror = this.onerrorHandler.bind(this);
|
|
60
|
-
_globalScope.globalScope.addEventListener('unhandledrejection', e => {
|
|
61
|
-
/** rejections can contain data of any type -- this is an effort to keep the message human readable */
|
|
62
|
-
const err = castReasonToError(e.reason);
|
|
63
|
-
(0, _handle.handle)('err', [err, (0, _now.now)(), false, {
|
|
42
|
+
_runtime.globalScope.addEventListener('unhandledrejection', promiseRejectionEvent => {
|
|
43
|
+
if (!this.abortHandler) return;
|
|
44
|
+
(0, _handle.handle)('err', [this.#castPromiseRejectionEvent(promiseRejectionEvent), (0, _now.now)(), false, {
|
|
64
45
|
unhandledPromiseRejection: 1
|
|
65
46
|
}], undefined, _features.FEATURE_NAMES.jserrors, this.ee);
|
|
66
47
|
}, (0, _eventListenerOpts.eventListenerOpts)(false, this.removeOnAbort?.signal));
|
|
67
|
-
(
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
48
|
+
_runtime.globalScope.addEventListener('error', errorEvent => {
|
|
49
|
+
if (!this.abortHandler) return;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* If the spa feature is loaded, errors may already have been captured in the `fn-err` listener above.
|
|
53
|
+
* This ensures those errors are not captured twice.
|
|
54
|
+
*/
|
|
55
|
+
if (this.#seenErrors.has(errorEvent.error)) {
|
|
56
|
+
this.#seenErrors.delete(errorEvent.error);
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
(0, _handle.handle)('err', [this.#castErrorEvent(errorEvent), (0, _now.now)()], undefined, _features.FEATURE_NAMES.jserrors, this.ee);
|
|
60
|
+
}, (0, _eventListenerOpts.eventListenerOpts)(false, this.removeOnAbort?.signal));
|
|
71
61
|
this.abortHandler = this.#abort; // we also use this as a flag to denote that the feature is active or on and handling errors
|
|
72
62
|
this.importAggregator();
|
|
73
63
|
}
|
|
@@ -75,66 +65,67 @@ class Instrument extends _instrumentBase.InstrumentBase {
|
|
|
75
65
|
/** Restoration and resource release tasks to be done if JS error loader is being aborted. Unwind changes to globals. */
|
|
76
66
|
#abort() {
|
|
77
67
|
this.removeOnAbort?.abort();
|
|
68
|
+
this.#seenErrors.clear();
|
|
78
69
|
this.abortHandler = undefined; // weakly allow this abort op to run only once
|
|
79
70
|
}
|
|
80
71
|
|
|
81
72
|
/**
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
* @param {
|
|
85
|
-
* @
|
|
86
|
-
* @param {number} lineno
|
|
87
|
-
* @param {number} column
|
|
88
|
-
* @param {Error | *} errorObj
|
|
89
|
-
* @returns
|
|
73
|
+
* Any value can be used with the `throw` keyword. This function ensures that the value is
|
|
74
|
+
* either a proper Error instance or attempts to convert it to an UncaughtError instance.
|
|
75
|
+
* @param {any} error The value thrown
|
|
76
|
+
* @returns {Error|UncaughtError} The converted error instance
|
|
90
77
|
*/
|
|
91
|
-
|
|
92
|
-
if (
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
78
|
+
#castError(error) {
|
|
79
|
+
if (error instanceof Error) {
|
|
80
|
+
return error;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* The thrown value may contain a message property. If it does, try to treat the thrown
|
|
85
|
+
* value as an Error-like object.
|
|
86
|
+
*/
|
|
87
|
+
if (typeof error?.message !== 'undefined') {
|
|
88
|
+
return new _uncaughtError.UncaughtError(error.message, error.filename || error.sourceURL, error.lineno || error.line, error.colno || error.col);
|
|
89
|
+
}
|
|
90
|
+
return new _uncaughtError.UncaughtError(typeof error === 'string' ? error : (0, _stringify.stringify)(error));
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Attempts to convert a PromiseRejectionEvent object to an Error object
|
|
95
|
+
* @param {PromiseRejectionEvent} unhandledRejectionEvent The unhandled promise rejection event
|
|
96
|
+
* @returns {Error} An Error object with the message as the casted reason
|
|
97
|
+
*/
|
|
98
|
+
#castPromiseRejectionEvent(promiseRejectionEvent) {
|
|
99
|
+
let prefix = 'Unhandled Promise Rejection: ';
|
|
100
|
+
if (promiseRejectionEvent?.reason instanceof Error) {
|
|
96
101
|
try {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
102
|
+
promiseRejectionEvent.reason.message = prefix + promiseRejectionEvent.reason.message;
|
|
103
|
+
return promiseRejectionEvent.reason;
|
|
104
|
+
} catch (e) {
|
|
105
|
+
return promiseRejectionEvent.reason;
|
|
100
106
|
}
|
|
101
107
|
}
|
|
102
|
-
|
|
108
|
+
if (typeof promiseRejectionEvent.reason === 'undefined') return new _uncaughtError.UncaughtError(prefix);
|
|
109
|
+
const error = this.#castError(promiseRejectionEvent.reason);
|
|
110
|
+
error.message = prefix + error.message;
|
|
111
|
+
return error;
|
|
103
112
|
}
|
|
104
|
-
}
|
|
105
113
|
|
|
106
|
-
/**
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
this.message = message || 'Uncaught error with no additional information';
|
|
115
|
-
this.sourceURL = filename;
|
|
116
|
-
this.line = lineno;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* Attempts to cast an unhandledPromiseRejection reason (reject(...)) to an Error object
|
|
121
|
-
* @param {*} reason - The reason property from an unhandled promise rejection
|
|
122
|
-
* @returns {Error} - An Error object with the message as the casted reason
|
|
123
|
-
*/
|
|
124
|
-
function castReasonToError(reason) {
|
|
125
|
-
let prefix = 'Unhandled Promise Rejection: ';
|
|
126
|
-
if (reason instanceof Error) {
|
|
127
|
-
try {
|
|
128
|
-
reason.message = prefix + reason.message;
|
|
129
|
-
return reason;
|
|
130
|
-
} catch (e) {
|
|
131
|
-
return reason;
|
|
114
|
+
/**
|
|
115
|
+
* Attempts to convert an ErrorEvent object to an Error object
|
|
116
|
+
* @param {ErrorEvent} errorEvent The error event
|
|
117
|
+
* @returns {Error|UncaughtError} The error event converted to an Error object
|
|
118
|
+
*/
|
|
119
|
+
#castErrorEvent(errorEvent) {
|
|
120
|
+
if (errorEvent.error instanceof Error) {
|
|
121
|
+
return errorEvent.error;
|
|
132
122
|
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Older browsers do not contain the `error` property on the ErrorEvent instance.
|
|
126
|
+
* https://caniuse.com/mdn-api_errorevent_error
|
|
127
|
+
*/
|
|
128
|
+
return new _uncaughtError.UncaughtError(errorEvent.message, errorEvent.filename, errorEvent.lineno, errorEvent.colno);
|
|
133
129
|
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
return new Error(prefix + (0, _stringify.stringify)(reason));
|
|
137
|
-
} catch (err) {
|
|
138
|
-
return new Error(prefix);
|
|
139
|
-
}
|
|
140
|
-
}
|
|
130
|
+
}
|
|
131
|
+
exports.Instrument = Instrument;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.UncaughtError = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* Represents an uncaught non Error type error. This class does
|
|
9
|
+
* not extend the Error class to prevent an invalid stack trace
|
|
10
|
+
* from being created. Use this class to cast thrown errors that
|
|
11
|
+
* do not use the Error class (strings, etc) to an object.
|
|
12
|
+
*/
|
|
13
|
+
class UncaughtError {
|
|
14
|
+
constructor(message, filename, lineno, colno) {
|
|
15
|
+
this.name = 'UncaughtError';
|
|
16
|
+
this.message = message;
|
|
17
|
+
this.sourceURL = filename;
|
|
18
|
+
this.line = lineno;
|
|
19
|
+
this.column = colno;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.UncaughtError = UncaughtError;
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.getFrameworks = getFrameworks;
|
|
7
|
-
var
|
|
7
|
+
var _runtime = require("../../../common/constants/runtime");
|
|
8
8
|
const FRAMEWORKS = {
|
|
9
9
|
REACT: 'React',
|
|
10
10
|
ANGULAR: 'Angular',
|
|
@@ -18,7 +18,7 @@ const FRAMEWORKS = {
|
|
|
18
18
|
MOOTOOLS: 'MooTools'
|
|
19
19
|
};
|
|
20
20
|
function getFrameworks() {
|
|
21
|
-
if (!
|
|
21
|
+
if (!_runtime.isBrowserScope) return []; // don't bother detecting frameworks if not in the main window context
|
|
22
22
|
|
|
23
23
|
const frameworks = [];
|
|
24
24
|
try {
|
|
@@ -16,7 +16,7 @@ var _obfuscate = require("../../../common/util/obfuscate");
|
|
|
16
16
|
var _env = require("../../../common/constants/env.npm");
|
|
17
17
|
var _load = require("../../../common/window/load");
|
|
18
18
|
var _eventListenerOpts = require("../../../common/event-listener/event-listener-opts");
|
|
19
|
-
var
|
|
19
|
+
var _runtime = require("../../../common/constants/runtime");
|
|
20
20
|
var _aggregateBase = require("../../utils/aggregate-base");
|
|
21
21
|
var _stringify = require("../../../common/util/stringify");
|
|
22
22
|
var _endpointMap = require("./endpoint-map");
|
|
@@ -77,7 +77,7 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
77
77
|
if (distMethod) this.storeSupportabilityMetrics("Generic/DistMethod/".concat(distMethod, "/Detected"));
|
|
78
78
|
|
|
79
79
|
// frameworks on page
|
|
80
|
-
if (
|
|
80
|
+
if (_runtime.isBrowserScope) {
|
|
81
81
|
(0, _load.onDOMContentLoaded)(() => {
|
|
82
82
|
(0, _frameworkDetection.getFrameworks)().forEach(framework => {
|
|
83
83
|
this.storeSupportabilityMetrics('Framework/' + framework + '/Detected');
|
|
@@ -99,7 +99,7 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
99
99
|
if (rules.length > 0 && !(0, _obfuscate.validateRules)(rules)) this.storeSupportabilityMetrics('Generic/Obfuscate/Invalid');
|
|
100
100
|
}
|
|
101
101
|
eachSessionChecks() {
|
|
102
|
-
if (!
|
|
102
|
+
if (!_runtime.isBrowserScope) return;
|
|
103
103
|
|
|
104
104
|
// [Temporary] Report restores from BFCache to NR1 while feature flag is in place in lieu of sending pageshow events.
|
|
105
105
|
(0, _eventListenerOpts.windowAddEventListener)('pageshow', evt => {
|
|
@@ -12,7 +12,7 @@ var _cleanUrl = require("../../../common/url/clean-url");
|
|
|
12
12
|
var _config = require("../../../common/config/config");
|
|
13
13
|
var _constants = require("../constants");
|
|
14
14
|
var _drain = require("../../../common/drain/drain");
|
|
15
|
-
var
|
|
15
|
+
var _runtime = require("../../../common/constants/runtime");
|
|
16
16
|
var _aggregateBase = require("../../utils/aggregate-base");
|
|
17
17
|
/*
|
|
18
18
|
* Copyright 2020 New Relic Corporation. All rights reserved.
|
|
@@ -33,7 +33,7 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
33
33
|
this.events = [];
|
|
34
34
|
this.att = (0, _config.getInfo)(this.agentIdentifier).jsAttributes; // per-agent, aggregators-shared info context
|
|
35
35
|
|
|
36
|
-
if (
|
|
36
|
+
if (_runtime.isBrowserScope && document.referrer) this.referrerUrl = (0, _cleanUrl.cleanURL)(document.referrer);
|
|
37
37
|
(0, _registerHandler.registerHandler)('api-addPageAction', function () {
|
|
38
38
|
return _this.addPageAction(...arguments);
|
|
39
39
|
}, this.featureName, this.ee);
|
|
@@ -89,7 +89,7 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
89
89
|
var width;
|
|
90
90
|
var height;
|
|
91
91
|
var eventAttributes = {};
|
|
92
|
-
if (
|
|
92
|
+
if (_runtime.isBrowserScope && window.document.documentElement) {
|
|
93
93
|
// Doesn't include the nav bar when it disappears in mobile safari
|
|
94
94
|
// https://github.com/jquery/jquery/blob/10399ddcf8a239acc27bdec9231b996b178224d3/src/dimensions.js#L23
|
|
95
95
|
width = window.document.documentElement.clientWidth;
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.Aggregate = void 0;
|
|
7
7
|
var _handle = require("../../../common/event-emitter/handle");
|
|
8
8
|
var _features = require("../../../loaders/features/features");
|
|
9
|
-
var
|
|
9
|
+
var _runtime = require("../../../common/constants/runtime");
|
|
10
10
|
var _webVitals = require("web-vitals");
|
|
11
11
|
var _navTiming = require("../../../common/timing/nav-timing");
|
|
12
12
|
var _stringify = require("../../../common/util/stringify");
|
|
@@ -15,7 +15,6 @@ var _config = require("../../../common/config/config");
|
|
|
15
15
|
var _harvest = require("../../../common/harvest/harvest");
|
|
16
16
|
var CONSTANTS = _interopRequireWildcard(require("../constants"));
|
|
17
17
|
var _initializedFeatures = require("./initialized-features");
|
|
18
|
-
var _globalScope = require("../../../common/util/global-scope");
|
|
19
18
|
var _drain = require("../../../common/drain/drain");
|
|
20
19
|
var _featureFlags = require("../../../common/util/feature-flags");
|
|
21
20
|
var _console = require("../../../common/util/console");
|
|
@@ -26,7 +25,7 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
26
25
|
static featureName = CONSTANTS.FEATURE_NAME;
|
|
27
26
|
constructor(agentIdentifier, aggregator) {
|
|
28
27
|
super(agentIdentifier, aggregator, CONSTANTS.FEATURE_NAME);
|
|
29
|
-
if (typeof PerformanceNavigationTiming !== 'undefined' && !
|
|
28
|
+
if (typeof PerformanceNavigationTiming !== 'undefined' && !_runtime.isiOS) {
|
|
30
29
|
this.alreadySent = false; // we don't support timings on BFCache restores
|
|
31
30
|
const agentRuntime = (0, _config.getRuntime)(agentIdentifier); // we'll store timing values on the runtime obj to be read by the aggregate module
|
|
32
31
|
|
|
@@ -74,13 +73,13 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
74
73
|
// Following PR #428, which demands that all agents send RUM call, these need to be sent even outside of the main window context where PerformanceTiming
|
|
75
74
|
// or PerformanceNavigationTiming do not exists. Hence, they'll be filled in by 0s instead in, for example, worker threads that still init the PVE module.
|
|
76
75
|
this.aggregator.store('measures', 'be', {
|
|
77
|
-
value:
|
|
76
|
+
value: _runtime.isBrowserScope ? agentRuntime[CONSTANTS.TTFB] : 0
|
|
78
77
|
});
|
|
79
78
|
this.aggregator.store('measures', 'fe', {
|
|
80
|
-
value:
|
|
79
|
+
value: _runtime.isBrowserScope ? agentRuntime[CONSTANTS.FBTWL] : 0
|
|
81
80
|
});
|
|
82
81
|
this.aggregator.store('measures', 'dc', {
|
|
83
|
-
value:
|
|
82
|
+
value: _runtime.isBrowserScope ? agentRuntime[CONSTANTS.FBTDC] : 0
|
|
84
83
|
});
|
|
85
84
|
const queryParameters = {
|
|
86
85
|
tt: info.ttGuid,
|
|
@@ -103,10 +102,10 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
103
102
|
ja: info.jsAttributes
|
|
104
103
|
};
|
|
105
104
|
}
|
|
106
|
-
if (
|
|
105
|
+
if (_runtime.globalScope.performance) {
|
|
107
106
|
if (typeof PerformanceNavigationTiming !== 'undefined') {
|
|
108
107
|
// Navigation Timing level 2 API that replaced PerformanceTiming & PerformanceNavigation
|
|
109
|
-
const navTimingEntry =
|
|
108
|
+
const navTimingEntry = _runtime.globalScope?.performance?.getEntriesByType('navigation')?.[0];
|
|
110
109
|
const perf = {
|
|
111
110
|
timing: (0, _navTiming.addPT)(agentRuntime.offset, navTimingEntry, {}),
|
|
112
111
|
navigation: (0, _navTiming.addPN)(navTimingEntry, {})
|
|
@@ -115,15 +114,15 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
115
114
|
} else if (typeof PerformanceTiming !== 'undefined') {
|
|
116
115
|
// Safari pre-15 did not support level 2 timing
|
|
117
116
|
const perf = {
|
|
118
|
-
timing: (0, _navTiming.addPT)(agentRuntime.offset,
|
|
119
|
-
navigation: (0, _navTiming.addPN)(
|
|
117
|
+
timing: (0, _navTiming.addPT)(agentRuntime.offset, _runtime.globalScope.performance.timing, {}, true),
|
|
118
|
+
navigation: (0, _navTiming.addPN)(_runtime.globalScope.performance.navigation, {})
|
|
120
119
|
};
|
|
121
120
|
queryParameters.perf = (0, _stringify.stringify)(perf);
|
|
122
121
|
}
|
|
123
122
|
}
|
|
124
123
|
try {
|
|
125
124
|
// PVTiming sends these too, albeit using web-vitals and slightly different; it's unknown why they're duplicated, but PVT should be the truth
|
|
126
|
-
var entries =
|
|
125
|
+
var entries = _runtime.globalScope.performance.getEntriesByType('paint');
|
|
127
126
|
entries.forEach(function (entry) {
|
|
128
127
|
if (!entry.startTime || entry.startTime <= 0) return;
|
|
129
128
|
if (entry.name === 'first-paint') {
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.getActivatedFeaturesFlags = getActivatedFeaturesFlags;
|
|
7
7
|
var _features = require("../../../loaders/features/features");
|
|
8
|
+
var _nreum = require("../../../common/window/nreum");
|
|
8
9
|
/**
|
|
9
10
|
* Get an array of flags required by downstream (NR UI) based on the features initialized in this agent
|
|
10
11
|
* (aka what is running on the page).
|
|
@@ -13,25 +14,28 @@ var _features = require("../../../loaders/features/features");
|
|
|
13
14
|
*/
|
|
14
15
|
function getActivatedFeaturesFlags(agentId) {
|
|
15
16
|
const flagArr = [];
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
17
|
+
const newrelic = (0, _nreum.gosNREUM)();
|
|
18
|
+
try {
|
|
19
|
+
Object.keys(newrelic.initializedAgents[agentId].features).forEach(featName => {
|
|
20
|
+
switch (featName) {
|
|
21
|
+
case _features.FEATURE_NAMES.ajax:
|
|
22
|
+
flagArr.push('xhr');
|
|
23
|
+
break;
|
|
24
|
+
case _features.FEATURE_NAMES.jserrors:
|
|
25
|
+
flagArr.push('err');
|
|
26
|
+
break;
|
|
27
|
+
case _features.FEATURE_NAMES.pageAction:
|
|
28
|
+
flagArr.push('ins');
|
|
29
|
+
break;
|
|
30
|
+
case _features.FEATURE_NAMES.sessionTrace:
|
|
31
|
+
flagArr.push('stn');
|
|
32
|
+
break;
|
|
33
|
+
case _features.FEATURE_NAMES.spa:
|
|
34
|
+
flagArr.push('spa');
|
|
35
|
+
break;
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
} catch (e) {}
|
|
35
39
|
return flagArr;
|
|
36
40
|
}
|
|
37
41
|
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.Instrument = void 0;
|
|
7
7
|
var _handle = require("../../../common/event-emitter/handle");
|
|
8
|
-
var
|
|
8
|
+
var _runtime = require("../../../common/constants/runtime");
|
|
9
9
|
var _instrumentBase = require("../../utils/instrument-base");
|
|
10
10
|
var CONSTANTS = _interopRequireWildcard(require("../constants"));
|
|
11
11
|
var _features = require("../../../loaders/features/features");
|
|
@@ -19,7 +19,7 @@ class Instrument extends _instrumentBase.InstrumentBase {
|
|
|
19
19
|
constructor(agentIdentifier, aggregator) {
|
|
20
20
|
let auto = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
21
21
|
super(agentIdentifier, aggregator, CONSTANTS.FEATURE_NAME, auto);
|
|
22
|
-
if ((typeof PerformanceNavigationTiming === 'undefined' ||
|
|
22
|
+
if ((typeof PerformanceNavigationTiming === 'undefined' || _runtime.isiOS) && typeof PerformanceTiming !== 'undefined') {
|
|
23
23
|
// For majority browser versions in which PNT exists, we can get load timings later from the nav entry (in the aggregate portion). At minimum, PT should exist for main window.
|
|
24
24
|
// *cli Mar'23 - iOS 15.2 & 15.4 testing in Sauce still fails with onTTFB. Hence, all iOS will fallback to this for now. Unknown if this is similar in nature to iOS_below16 bug.
|
|
25
25
|
const agentRuntime = (0, _config.getRuntime)(agentIdentifier);
|
|
@@ -7,7 +7,7 @@ exports.Aggregate = void 0;
|
|
|
7
7
|
var _webVitals = require("web-vitals");
|
|
8
8
|
var _firstPaint = require("../first-paint");
|
|
9
9
|
var _longTasks = require("../long-tasks");
|
|
10
|
-
var
|
|
10
|
+
var _runtime = require("../../../common/constants/runtime");
|
|
11
11
|
var _belSerializer = require("../../../common/serialize/bel-serializer");
|
|
12
12
|
var _mapOwn = require("../../../common/util/map-own");
|
|
13
13
|
var _harvestScheduler = require("../../../common/harvest/harvest-scheduler");
|
|
@@ -51,7 +51,7 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
51
51
|
});
|
|
52
52
|
|
|
53
53
|
/* First Contentful Paint - As of WV v3, it still imperfectly tries to detect document vis state asap and isn't supposed to report if page starts hidden. */
|
|
54
|
-
if (
|
|
54
|
+
if (_runtime.iOS_below16) {
|
|
55
55
|
try {
|
|
56
56
|
if (!pageStartedHidden) {
|
|
57
57
|
// see ios-version.js for detail on this following bug case; tldr: buffered flag doesn't work but getEntriesByType does
|
|
@@ -238,9 +238,7 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
238
238
|
}
|
|
239
239
|
onHarvestFinished(result) {
|
|
240
240
|
if (result.retry && this.timingsSent.length > 0) {
|
|
241
|
-
|
|
242
|
-
this.timings.push(this.timingsSent[i]);
|
|
243
|
-
}
|
|
241
|
+
this.timings.unshift(...this.timingsSent);
|
|
244
242
|
this.timingsSent = [];
|
|
245
243
|
}
|
|
246
244
|
}
|
|
@@ -11,7 +11,7 @@ var _eventListenerOpts = require("../../../common/event-listener/event-listener-
|
|
|
11
11
|
var _now = require("../../../common/timing/now");
|
|
12
12
|
var _instrumentBase = require("../../utils/instrument-base");
|
|
13
13
|
var _constants = require("../constants");
|
|
14
|
-
var
|
|
14
|
+
var _runtime = require("../../../common/constants/runtime");
|
|
15
15
|
/*
|
|
16
16
|
* Copyright 2020 New Relic Corporation. All rights reserved.
|
|
17
17
|
* SPDX-License-Identifier: Apache-2.0
|
|
@@ -22,7 +22,7 @@ class Instrument extends _instrumentBase.InstrumentBase {
|
|
|
22
22
|
constructor(agentIdentifier, aggregator) {
|
|
23
23
|
let auto = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
24
24
|
super(agentIdentifier, aggregator, _constants.FEATURE_NAME, auto);
|
|
25
|
-
if (!
|
|
25
|
+
if (!_runtime.isBrowserScope) return; // CWV is irrelevant outside web context
|
|
26
26
|
|
|
27
27
|
// Document visibility state becomes hidden; this should run as soon as possible in page life.
|
|
28
28
|
// While we try to replicate web-vital's visibilitywatcher logic in an effort to defer that library to post-pageload, this isn't perfect and doesn't consider prerendering.
|