@newrelic/browser-agent 0.1.229 → 0.1.231
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 +65 -2
- package/dist/cjs/common/browser-version/ios-version.js +4 -3
- package/dist/cjs/common/config/state/configurable.js +3 -2
- package/dist/cjs/common/config/state/info.js +1 -1
- package/dist/cjs/common/config/state/init.js +1 -1
- package/dist/cjs/common/config/state/loader-config.js +1 -1
- package/dist/cjs/common/config/state/runtime.js +6 -5
- package/dist/cjs/common/constants/env.cdn.js +29 -0
- package/dist/cjs/common/constants/env.js +32 -0
- package/dist/cjs/common/constants/env.npm.js +30 -0
- package/dist/cjs/common/context/shared-context.js +2 -1
- package/dist/cjs/common/drain/drain.js +9 -3
- package/dist/cjs/common/event-emitter/contextual-ee.test.js +282 -0
- package/dist/cjs/common/event-emitter/handle.test.js +58 -0
- package/dist/cjs/common/event-emitter/register-handler.test.js +55 -0
- package/dist/cjs/common/event-listener/event-listener-opts.js +4 -2
- package/dist/cjs/common/harvest/harvest-scheduler.js +2 -1
- package/dist/cjs/common/harvest/harvest.js +15 -4
- package/dist/cjs/common/ids/id.js +14 -6
- package/dist/cjs/common/ids/id.test.js +85 -0
- package/dist/cjs/common/ids/unique-id.js +75 -51
- package/dist/cjs/common/ids/unique-id.test.js +49 -0
- package/dist/cjs/common/timing/nav-timing.js +51 -30
- package/dist/cjs/common/timing/nav-timing.test.js +192 -0
- package/dist/cjs/common/url/clean-url.test.js +9 -0
- package/dist/cjs/common/url/encode.test.js +74 -0
- package/dist/cjs/common/url/location.js +4 -0
- package/dist/cjs/common/url/location.test.js +13 -0
- package/dist/cjs/common/url/parse-url.test.js +111 -0
- package/dist/cjs/common/url/protocol.js +2 -12
- package/dist/cjs/common/url/protocol.test.js +16 -0
- package/dist/cjs/common/util/console.js +2 -2
- package/dist/cjs/common/util/map-own.js +21 -14
- package/dist/cjs/common/util/map-own.test.js +49 -0
- package/dist/cjs/common/util/obfuscate.js +1 -1
- package/dist/cjs/common/util/submit-data.js +11 -3
- package/dist/cjs/common/window/page-visibility.js +4 -2
- package/dist/cjs/common/window/session-storage.js +56 -11
- package/dist/cjs/common/wrap/index.js +4 -4
- package/dist/cjs/common/wrap/wrap-events.js +10 -10
- package/dist/cjs/common/wrap/wrap-fetch.js +6 -8
- package/dist/cjs/common/wrap/wrap-function.js +4 -18
- package/dist/cjs/common/wrap/wrap-history.js +7 -6
- package/dist/cjs/common/wrap/wrap-jsonp.js +7 -6
- package/dist/cjs/common/wrap/wrap-mutation.js +7 -6
- package/dist/cjs/common/wrap/wrap-promise.js +11 -7
- package/dist/cjs/common/wrap/wrap-promise.test.js +119 -0
- package/dist/cjs/common/wrap/wrap-raf.js +6 -6
- package/dist/cjs/common/wrap/wrap-timer.js +6 -6
- package/dist/cjs/common/wrap/wrap-xhr.js +5 -6
- package/dist/cjs/features/ajax/aggregate/index.js +1 -1
- package/dist/cjs/features/ajax/instrument/index.js +2 -1
- package/dist/cjs/features/jserrors/aggregate/canonical-function-name.test.js +5 -4
- package/dist/cjs/features/jserrors/aggregate/compute-stack-trace.js +1 -2
- package/dist/cjs/features/jserrors/aggregate/compute-stack-trace.test.js +5 -5
- package/dist/cjs/features/jserrors/aggregate/format-stack-trace.test.js +6 -5
- package/dist/cjs/features/jserrors/aggregate/index.js +35 -14
- package/dist/cjs/features/jserrors/aggregate/string-hash-code.test.js +5 -4
- package/dist/cjs/features/jserrors/instrument/index.js +9 -12
- package/dist/cjs/features/metrics/aggregate/index.js +16 -6
- package/dist/cjs/features/metrics/instrument/index.js +2 -1
- package/dist/cjs/features/metrics/instrument/workers-helper.js +9 -6
- package/dist/cjs/features/page_action/aggregate/index.js +12 -4
- package/dist/cjs/features/page_action/instrument/index.js +2 -1
- package/dist/cjs/features/page_view_event/aggregate/index.js +25 -10
- package/dist/cjs/features/page_view_event/instrument/index.js +2 -1
- package/dist/cjs/features/page_view_timing/aggregate/index.js +90 -61
- package/dist/cjs/features/page_view_timing/instrument/index.js +2 -1
- package/dist/cjs/features/session_trace/aggregate/index.js +69 -26
- package/dist/cjs/features/session_trace/instrument/index.js +2 -1
- package/dist/cjs/features/spa/instrument/index.js +2 -1
- package/dist/cjs/features/utils/instrument-base.js +8 -3
- package/dist/cjs/features/utils/lazy-loader.js +1 -1
- package/dist/cjs/index.js +9 -9
- package/dist/cjs/loaders/agent.js +3 -2
- package/dist/cjs/loaders/api/api.js +90 -22
- package/dist/cjs/loaders/api/apiAsync.js +3 -3
- package/dist/cjs/loaders/configure/configure.js +13 -7
- package/dist/cjs/loaders/features/enabled-features.js +1 -1
- package/dist/cjs/loaders/micro-agent.js +20 -14
- package/dist/esm/common/browser-version/ios-version.js +4 -3
- package/dist/esm/common/config/state/configurable.js +3 -2
- package/dist/esm/common/config/state/info.js +1 -1
- package/dist/esm/common/config/state/init.js +1 -1
- package/dist/esm/common/config/state/loader-config.js +1 -1
- package/dist/esm/common/config/state/runtime.js +3 -2
- package/dist/esm/common/constants/env.cdn.js +20 -0
- package/dist/esm/common/constants/env.js +23 -0
- package/dist/esm/common/constants/env.npm.js +21 -0
- package/dist/esm/common/context/shared-context.js +2 -1
- package/dist/esm/common/drain/drain.js +9 -3
- package/dist/esm/common/event-emitter/contextual-ee.test.js +278 -0
- package/dist/esm/common/event-emitter/handle.test.js +54 -0
- package/dist/esm/common/event-emitter/register-handler.test.js +51 -0
- package/dist/esm/common/event-listener/event-listener-opts.js +4 -2
- package/dist/esm/common/harvest/harvest-scheduler.js +2 -1
- package/dist/esm/common/harvest/harvest.js +14 -3
- package/dist/esm/common/ids/id.js +16 -6
- package/dist/esm/common/ids/id.test.js +81 -0
- package/dist/esm/common/ids/unique-id.js +75 -51
- package/dist/esm/common/ids/unique-id.test.js +44 -0
- package/dist/esm/common/timing/nav-timing.js +51 -29
- package/dist/esm/common/timing/nav-timing.test.js +190 -0
- package/dist/esm/common/url/clean-url.test.js +7 -0
- package/dist/esm/common/url/encode.test.js +70 -0
- package/dist/esm/common/url/location.js +4 -0
- package/dist/esm/common/url/location.test.js +11 -0
- package/dist/esm/common/url/parse-url.test.js +107 -0
- package/dist/esm/common/url/protocol.js +3 -12
- package/dist/esm/common/url/protocol.test.js +14 -0
- package/dist/esm/common/util/console.js +2 -2
- package/dist/esm/common/util/map-own.js +19 -13
- package/dist/esm/common/util/map-own.test.js +47 -0
- package/dist/esm/common/util/obfuscate.js +2 -2
- package/dist/esm/common/util/submit-data.js +11 -3
- package/dist/esm/common/window/page-visibility.js +4 -2
- package/dist/esm/common/window/session-storage.js +54 -13
- package/dist/esm/common/wrap/index.js +3 -3
- package/dist/esm/common/wrap/wrap-events.js +11 -11
- package/dist/esm/common/wrap/wrap-fetch.js +7 -9
- package/dist/esm/common/wrap/wrap-function.js +4 -17
- package/dist/esm/common/wrap/wrap-history.js +8 -7
- package/dist/esm/common/wrap/wrap-jsonp.js +8 -7
- package/dist/esm/common/wrap/wrap-mutation.js +7 -6
- package/dist/esm/common/wrap/wrap-promise.js +11 -7
- package/dist/esm/common/wrap/wrap-promise.test.js +115 -0
- package/dist/esm/common/wrap/wrap-raf.js +7 -7
- package/dist/esm/common/wrap/wrap-timer.js +7 -7
- package/dist/esm/common/wrap/wrap-xhr.js +7 -8
- package/dist/esm/features/ajax/aggregate/index.js +1 -1
- package/dist/esm/features/ajax/instrument/index.js +2 -1
- package/dist/esm/features/jserrors/aggregate/canonical-function-name.test.js +5 -4
- package/dist/esm/features/jserrors/aggregate/compute-stack-trace.js +1 -2
- package/dist/esm/features/jserrors/aggregate/compute-stack-trace.test.js +5 -5
- package/dist/esm/features/jserrors/aggregate/format-stack-trace.test.js +6 -5
- package/dist/esm/features/jserrors/aggregate/index.js +35 -14
- package/dist/esm/features/jserrors/aggregate/string-hash-code.test.js +5 -4
- package/dist/esm/features/jserrors/instrument/index.js +9 -12
- package/dist/esm/features/metrics/aggregate/index.js +17 -7
- package/dist/esm/features/metrics/instrument/index.js +2 -1
- package/dist/esm/features/metrics/instrument/workers-helper.js +9 -6
- package/dist/esm/features/page_action/aggregate/index.js +12 -4
- package/dist/esm/features/page_action/instrument/index.js +2 -1
- package/dist/esm/features/page_view_event/aggregate/index.js +25 -10
- package/dist/esm/features/page_view_event/instrument/index.js +2 -1
- package/dist/esm/features/page_view_timing/aggregate/index.js +90 -61
- package/dist/esm/features/page_view_timing/instrument/index.js +2 -1
- package/dist/esm/features/session_trace/aggregate/index.js +69 -26
- package/dist/esm/features/session_trace/instrument/index.js +2 -1
- package/dist/esm/features/spa/instrument/index.js +2 -1
- package/dist/esm/features/utils/instrument-base.js +3 -2
- package/dist/esm/features/utils/lazy-loader.js +1 -1
- package/dist/esm/index.js +4 -4
- package/dist/esm/loaders/agent.js +3 -2
- package/dist/esm/loaders/api/api.js +85 -21
- package/dist/esm/loaders/api/apiAsync.js +3 -3
- package/dist/esm/loaders/configure/configure.js +14 -8
- package/dist/esm/loaders/features/enabled-features.js +1 -1
- package/dist/esm/loaders/micro-agent.js +18 -13
- package/dist/types/cdn/lite.d.ts +2 -0
- package/dist/types/cdn/lite.d.ts.map +1 -0
- package/dist/types/cdn/polyfills/lite.d.ts +2 -0
- package/dist/types/cdn/polyfills/lite.d.ts.map +1 -0
- package/dist/types/cdn/polyfills/pro.d.ts +2 -0
- package/dist/types/cdn/polyfills/pro.d.ts.map +1 -0
- package/dist/types/cdn/polyfills/spa.d.ts +2 -0
- package/dist/types/cdn/polyfills/spa.d.ts.map +1 -0
- package/dist/types/cdn/polyfills.d.ts +2 -0
- package/dist/types/cdn/polyfills.d.ts.map +1 -0
- package/dist/types/cdn/pro.d.ts +2 -0
- package/dist/types/cdn/pro.d.ts.map +1 -0
- package/dist/types/cdn/spa.d.ts +2 -0
- package/dist/types/cdn/spa.d.ts.map +1 -0
- package/dist/types/cdn/worker.d.ts +2 -0
- package/dist/types/cdn/worker.d.ts.map +1 -0
- package/dist/types/common/aggregate/aggregator.d.ts +11 -0
- package/dist/types/common/aggregate/aggregator.d.ts.map +1 -0
- package/dist/types/common/browser-version/firefox-version.d.ts +2 -0
- package/dist/types/common/browser-version/firefox-version.d.ts.map +1 -0
- package/dist/types/common/browser-version/ios-version.d.ts +3 -0
- package/dist/types/common/browser-version/ios-version.d.ts.map +1 -0
- package/dist/types/common/config/config.d.ts +13 -0
- package/dist/types/common/config/config.d.ts.map +1 -0
- package/dist/types/common/config/state/configurable.d.ts +4 -0
- package/dist/types/common/config/state/configurable.d.ts.map +1 -0
- package/dist/types/common/config/state/info.d.ts +4 -0
- package/dist/types/common/config/state/info.d.ts.map +1 -0
- package/dist/types/common/config/state/init.d.ts +4 -0
- package/dist/types/common/config/state/init.d.ts.map +1 -0
- package/dist/types/common/config/state/loader-config.d.ts +3 -0
- package/dist/types/common/config/state/loader-config.d.ts.map +1 -0
- package/dist/types/common/config/state/originals.d.ts +2 -0
- package/dist/types/common/config/state/originals.d.ts.map +1 -0
- package/dist/types/common/config/state/runtime.d.ts +3 -0
- package/dist/types/common/config/state/runtime.d.ts.map +1 -0
- package/dist/types/common/constants/env.cdn.d.ts +18 -0
- package/dist/types/common/constants/env.cdn.d.ts.map +1 -0
- package/dist/types/common/constants/env.d.ts +13 -0
- package/dist/types/common/constants/env.d.ts.map +1 -0
- package/dist/types/common/constants/env.npm.d.ts +19 -0
- package/dist/types/common/constants/env.npm.d.ts.map +1 -0
- package/dist/types/common/context/shared-context.d.ts +5 -0
- package/dist/types/common/context/shared-context.d.ts.map +1 -0
- package/dist/types/common/deny-list/deny-list.d.ts +12 -0
- package/dist/types/common/deny-list/deny-list.d.ts.map +1 -0
- package/dist/types/common/drain/drain.d.ts +17 -0
- package/dist/types/common/drain/drain.d.ts.map +1 -0
- package/dist/types/common/event-emitter/contextual-ee.d.ts +4 -0
- package/dist/types/common/event-emitter/contextual-ee.d.ts.map +1 -0
- package/dist/types/common/event-emitter/handle.d.ts +3 -0
- package/dist/types/common/event-emitter/handle.d.ts.map +1 -0
- package/dist/types/common/event-emitter/register-handler.d.ts +8 -0
- package/dist/types/common/event-emitter/register-handler.d.ts.map +1 -0
- package/dist/types/common/event-listener/event-listener-opts.d.ts +10 -0
- package/dist/types/common/event-listener/event-listener-opts.d.ts.map +1 -0
- package/dist/types/common/harvest/harvest-scheduler.d.ts +21 -0
- package/dist/types/common/harvest/harvest-scheduler.d.ts.map +1 -0
- package/dist/types/common/harvest/harvest.d.ts +58 -0
- package/dist/types/common/harvest/harvest.d.ts.map +1 -0
- package/dist/types/common/ids/id.d.ts +12 -0
- package/dist/types/common/ids/id.d.ts.map +1 -0
- package/dist/types/common/ids/unique-id.d.ts +28 -0
- package/dist/types/common/ids/unique-id.d.ts.map +1 -0
- package/dist/types/common/metrics/framework-detection.d.ts +2 -0
- package/dist/types/common/metrics/framework-detection.d.ts.map +1 -0
- package/dist/types/common/metrics/paint-metrics.d.ts +2 -0
- package/dist/types/common/metrics/paint-metrics.d.ts.map +1 -0
- package/dist/types/common/serialize/bel-serializer.d.ts +5 -0
- package/dist/types/common/serialize/bel-serializer.d.ts.map +1 -0
- package/dist/types/common/timing/nav-timing.d.ts +4 -0
- package/dist/types/common/timing/nav-timing.d.ts.map +1 -0
- package/dist/types/common/timing/now.d.ts +2 -0
- package/dist/types/common/timing/now.d.ts.map +1 -0
- package/dist/types/common/unload/eol.d.ts +8 -0
- package/dist/types/common/unload/eol.d.ts.map +1 -0
- package/dist/types/common/url/clean-url.d.ts +2 -0
- package/dist/types/common/url/clean-url.d.ts.map +1 -0
- package/dist/types/common/url/encode.d.ts +5 -0
- package/dist/types/common/url/encode.d.ts.map +1 -0
- package/dist/types/common/url/location.d.ts +6 -0
- package/dist/types/common/url/location.d.ts.map +1 -0
- package/dist/types/common/url/parse-url.d.ts +2 -0
- package/dist/types/common/url/parse-url.d.ts.map +1 -0
- package/dist/types/common/url/protocol.d.ts +2 -0
- package/dist/types/common/url/protocol.d.ts.map +1 -0
- package/dist/types/common/util/console.d.ts +8 -0
- package/dist/types/common/util/console.d.ts.map +1 -0
- package/dist/types/common/util/data-size.d.ts +2 -0
- package/dist/types/common/util/data-size.d.ts.map +1 -0
- package/dist/types/common/util/feature-flags.d.ts +3 -0
- package/dist/types/common/util/feature-flags.d.ts.map +1 -0
- package/dist/types/common/util/get-or-set.d.ts +2 -0
- package/dist/types/common/util/get-or-set.d.ts.map +1 -0
- package/dist/types/common/util/global-scope.d.ts +13 -0
- package/dist/types/common/util/global-scope.d.ts.map +1 -0
- package/dist/types/common/util/map-own.d.ts +3 -0
- package/dist/types/common/util/map-own.d.ts.map +1 -0
- package/dist/types/common/util/obfuscate.d.ts +8 -0
- package/dist/types/common/util/obfuscate.d.ts.map +1 -0
- package/dist/types/common/util/s-hash.d.ts +2 -0
- package/dist/types/common/util/s-hash.d.ts.map +1 -0
- package/dist/types/common/util/single.d.ts +2 -0
- package/dist/types/common/util/single.d.ts.map +1 -0
- package/dist/types/common/util/stringify.d.ts +8 -0
- package/dist/types/common/util/stringify.d.ts.map +1 -0
- package/dist/types/common/util/submit-data.d.ts +35 -0
- package/dist/types/common/util/submit-data.d.ts.map +1 -0
- package/dist/types/common/util/traverse.d.ts +2 -0
- package/dist/types/common/util/traverse.d.ts.map +1 -0
- package/dist/types/common/util/user-agent.d.ts +5 -0
- package/dist/types/common/util/user-agent.d.ts.map +1 -0
- package/dist/types/common/window/load.d.ts +3 -0
- package/dist/types/common/window/load.d.ts.map +1 -0
- package/dist/types/common/window/nreum.d.ts +14 -0
- package/dist/types/common/window/nreum.d.ts.map +1 -0
- package/dist/types/common/window/page-visibility.d.ts +7 -0
- package/dist/types/common/window/page-visibility.d.ts.map +1 -0
- package/dist/types/common/window/session-storage.d.ts +18 -0
- package/dist/types/common/window/session-storage.d.ts.map +1 -0
- package/dist/types/common/window/supports-performance-observer.d.ts +2 -0
- package/dist/types/common/window/supports-performance-observer.d.ts.map +1 -0
- package/dist/types/common/wrap/index.d.ts +11 -0
- package/dist/types/common/wrap/index.d.ts.map +1 -0
- package/dist/types/common/wrap/wrap-events.d.ts +17 -0
- package/dist/types/common/wrap/wrap-events.d.ts.map +1 -0
- package/dist/types/common/wrap/wrap-fetch.d.ts +18 -0
- package/dist/types/common/wrap/wrap-fetch.d.ts.map +1 -0
- package/dist/types/common/wrap/wrap-function.d.ts +28 -0
- package/dist/types/common/wrap/wrap-function.d.ts.map +1 -0
- package/dist/types/common/wrap/wrap-history.d.ts +16 -0
- package/dist/types/common/wrap/wrap-history.d.ts.map +1 -0
- package/dist/types/common/wrap/wrap-jsonp.d.ts +16 -0
- package/dist/types/common/wrap/wrap-jsonp.d.ts.map +1 -0
- package/dist/types/common/wrap/wrap-mutation.d.ts +16 -0
- package/dist/types/common/wrap/wrap-mutation.d.ts.map +1 -0
- package/dist/types/common/wrap/wrap-promise.d.ts +17 -0
- package/dist/types/common/wrap/wrap-promise.d.ts.map +1 -0
- package/dist/types/common/wrap/wrap-raf.d.ts +16 -0
- package/dist/types/common/wrap/wrap-raf.d.ts.map +1 -0
- package/dist/types/common/wrap/wrap-timer.d.ts +17 -0
- package/dist/types/common/wrap/wrap-timer.d.ts.map +1 -0
- package/dist/types/common/wrap/wrap-xhr.d.ts +16 -0
- package/dist/types/common/wrap/wrap-xhr.d.ts.map +1 -0
- package/dist/types/features/ajax/aggregate/index.d.ts +16 -0
- package/dist/types/features/ajax/aggregate/index.d.ts.map +1 -0
- package/dist/types/features/ajax/constants.d.ts +2 -0
- package/dist/types/features/ajax/constants.d.ts.map +1 -0
- package/dist/types/features/ajax/index.d.ts +2 -0
- package/dist/types/features/ajax/index.d.ts.map +1 -0
- package/dist/types/features/ajax/instrument/distributed-tracing.d.ts +19 -0
- package/dist/types/features/ajax/instrument/distributed-tracing.d.ts.map +1 -0
- package/dist/types/features/ajax/instrument/index.d.ts +9 -0
- package/dist/types/features/ajax/instrument/index.d.ts.map +1 -0
- package/dist/types/features/ajax/instrument/response-size.d.ts +2 -0
- package/dist/types/features/ajax/instrument/response-size.d.ts.map +1 -0
- package/dist/types/features/jserrors/aggregate/canonical-function-name.d.ts +2 -0
- package/dist/types/features/jserrors/aggregate/canonical-function-name.d.ts.map +1 -0
- package/dist/types/features/jserrors/aggregate/compute-stack-trace.d.ts +22 -0
- package/dist/types/features/jserrors/aggregate/compute-stack-trace.d.ts.map +1 -0
- package/dist/types/features/jserrors/aggregate/format-stack-trace.d.ts +3 -0
- package/dist/types/features/jserrors/aggregate/format-stack-trace.d.ts.map +1 -0
- package/dist/types/features/jserrors/aggregate/index.d.ts +24 -0
- package/dist/types/features/jserrors/aggregate/index.d.ts.map +1 -0
- package/dist/types/features/jserrors/aggregate/string-hash-code.d.ts +2 -0
- package/dist/types/features/jserrors/aggregate/string-hash-code.d.ts.map +1 -0
- package/dist/types/features/jserrors/constants.d.ts +3 -0
- package/dist/types/features/jserrors/constants.d.ts.map +1 -0
- package/dist/types/features/jserrors/index.d.ts +2 -0
- package/dist/types/features/jserrors/index.d.ts.map +1 -0
- package/dist/types/features/jserrors/instrument/debug.d.ts +2 -0
- package/dist/types/features/jserrors/instrument/debug.d.ts.map +1 -0
- package/dist/types/features/jserrors/instrument/index.d.ts +22 -0
- package/dist/types/features/jserrors/instrument/index.d.ts.map +1 -0
- package/dist/types/features/metrics/aggregate/index.d.ts +12 -0
- package/dist/types/features/metrics/aggregate/index.d.ts.map +1 -0
- package/dist/types/features/metrics/constants.d.ts +6 -0
- package/dist/types/features/metrics/constants.d.ts.map +1 -0
- package/dist/types/features/metrics/index.d.ts +2 -0
- package/dist/types/features/metrics/index.d.ts.map +1 -0
- package/dist/types/features/metrics/instrument/index.d.ts +6 -0
- package/dist/types/features/metrics/instrument/index.d.ts.map +1 -0
- package/dist/types/features/metrics/instrument/workers-helper.d.ts +7 -0
- package/dist/types/features/metrics/instrument/workers-helper.d.ts.map +1 -0
- package/dist/types/features/page_action/aggregate/index.d.ts +24 -0
- package/dist/types/features/page_action/aggregate/index.d.ts.map +1 -0
- package/dist/types/features/page_action/constants.d.ts +2 -0
- package/dist/types/features/page_action/constants.d.ts.map +1 -0
- package/dist/types/features/page_action/index.d.ts +2 -0
- package/dist/types/features/page_action/index.d.ts.map +1 -0
- package/dist/types/features/page_action/instrument/index.d.ts +6 -0
- package/dist/types/features/page_action/instrument/index.d.ts.map +1 -0
- package/dist/types/features/page_view_event/aggregate/index.d.ts +9 -0
- package/dist/types/features/page_view_event/aggregate/index.d.ts.map +1 -0
- package/dist/types/features/page_view_event/aggregate/initialized-features.d.ts +8 -0
- package/dist/types/features/page_view_event/aggregate/initialized-features.d.ts.map +1 -0
- package/dist/types/features/page_view_event/constants.d.ts +5 -0
- package/dist/types/features/page_view_event/constants.d.ts.map +1 -0
- package/dist/types/features/page_view_event/index.d.ts +2 -0
- package/dist/types/features/page_view_event/index.d.ts.map +1 -0
- package/dist/types/features/page_view_event/instrument/index.d.ts +6 -0
- package/dist/types/features/page_view_event/instrument/index.d.ts.map +1 -0
- package/dist/types/features/page_view_timing/aggregate/index.d.ts +32 -0
- package/dist/types/features/page_view_timing/aggregate/index.d.ts.map +1 -0
- package/dist/types/features/page_view_timing/constants.d.ts +2 -0
- package/dist/types/features/page_view_timing/constants.d.ts.map +1 -0
- package/dist/types/features/page_view_timing/first-paint.d.ts +2 -0
- package/dist/types/features/page_view_timing/first-paint.d.ts.map +1 -0
- package/dist/types/features/page_view_timing/index.d.ts +2 -0
- package/dist/types/features/page_view_timing/index.d.ts.map +1 -0
- package/dist/types/features/page_view_timing/instrument/index.d.ts +6 -0
- package/dist/types/features/page_view_timing/instrument/index.d.ts.map +1 -0
- package/dist/types/features/page_view_timing/long-tasks.d.ts +2 -0
- package/dist/types/features/page_view_timing/long-tasks.d.ts.map +1 -0
- package/dist/types/features/session_trace/aggregate/index.d.ts +77 -0
- package/dist/types/features/session_trace/aggregate/index.d.ts.map +1 -0
- package/dist/types/features/session_trace/constants.d.ts +13 -0
- package/dist/types/features/session_trace/constants.d.ts.map +1 -0
- package/dist/types/features/session_trace/index.d.ts +2 -0
- package/dist/types/features/session_trace/index.d.ts.map +1 -0
- package/dist/types/features/session_trace/instrument/index.d.ts +11 -0
- package/dist/types/features/session_trace/instrument/index.d.ts.map +1 -0
- package/dist/types/features/spa/aggregate/index.d.ts +25 -0
- package/dist/types/features/spa/aggregate/index.d.ts.map +1 -0
- package/dist/types/features/spa/aggregate/interaction-node.d.ts +15 -0
- package/dist/types/features/spa/aggregate/interaction-node.d.ts.map +1 -0
- package/dist/types/features/spa/aggregate/interaction.d.ts +20 -0
- package/dist/types/features/spa/aggregate/interaction.d.ts.map +1 -0
- package/dist/types/features/spa/aggregate/serializer.d.ts +15 -0
- package/dist/types/features/spa/aggregate/serializer.d.ts.map +1 -0
- package/dist/types/features/spa/constants.d.ts +23 -0
- package/dist/types/features/spa/constants.d.ts.map +1 -0
- package/dist/types/features/spa/index.d.ts +2 -0
- package/dist/types/features/spa/index.d.ts.map +1 -0
- package/dist/types/features/spa/instrument/index.d.ts +8 -0
- package/dist/types/features/spa/instrument/index.d.ts.map +1 -0
- package/dist/types/features/utils/aggregate-base.d.ts +4 -0
- package/dist/types/features/utils/aggregate-base.d.ts.map +1 -0
- package/dist/types/features/utils/feature-base.d.ts +23 -0
- package/dist/types/features/utils/feature-base.d.ts.map +1 -0
- package/dist/types/features/utils/handler-cache.d.ts +22 -0
- package/dist/types/features/utils/handler-cache.d.ts.map +1 -0
- package/dist/types/features/utils/instrument-base.d.ts +27 -0
- package/dist/types/features/utils/instrument-base.d.ts.map +1 -0
- package/dist/types/features/utils/lazy-loader.d.ts +13 -0
- package/dist/types/features/utils/lazy-loader.d.ts.map +1 -0
- package/dist/types/index.d.ts +12 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/loaders/agent.d.ts +20 -0
- package/dist/types/loaders/agent.d.ts.map +1 -0
- package/dist/types/loaders/api/api.d.ts +17 -0
- package/dist/types/loaders/api/api.d.ts.map +1 -0
- package/dist/types/loaders/api/apiAsync.d.ts +2 -0
- package/dist/types/loaders/api/apiAsync.d.ts.map +1 -0
- package/dist/types/loaders/browser-agent.d.ts +9 -0
- package/dist/types/loaders/browser-agent.d.ts.map +1 -0
- package/dist/types/loaders/configure/configure.d.ts +10 -0
- package/dist/types/loaders/configure/configure.d.ts.map +1 -0
- package/dist/types/loaders/features/enabled-features.d.ts +2 -0
- package/dist/types/loaders/features/enabled-features.d.ts.map +1 -0
- package/dist/types/loaders/features/featureDependencies.d.ts +3 -0
- package/dist/types/loaders/features/featureDependencies.d.ts.map +1 -0
- package/dist/types/loaders/features/features.d.ts +18 -0
- package/dist/types/loaders/features/features.d.ts.map +1 -0
- package/dist/types/loaders/micro-agent.d.ts +25 -0
- package/dist/types/loaders/micro-agent.d.ts.map +1 -0
- package/dist/types/loaders/worker-agent.d.ts +8 -0
- package/dist/types/loaders/worker-agent.d.ts.map +1 -0
- package/package.json +67 -59
- package/src/cdn/lite.js +18 -0
- package/src/cdn/polyfills/lite.js +7 -0
- package/src/cdn/polyfills/pro.js +7 -0
- package/src/cdn/polyfills/spa.js +7 -0
- package/src/cdn/polyfills.js +17 -0
- package/src/cdn/pro.js +27 -0
- package/src/cdn/spa.js +28 -0
- package/src/cdn/worker.js +21 -0
- package/src/common/aggregate/aggregator.js +171 -0
- package/src/common/browser-version/firefox-version.js +10 -0
- package/src/common/browser-version/ios-version.js +11 -0
- package/src/common/config/config.js +12 -0
- package/src/common/config/state/configurable.js +26 -0
- package/src/common/config/state/info.js +49 -0
- package/src/common/config/state/init.js +56 -0
- package/src/common/config/state/loader-config.js +25 -0
- package/src/common/config/state/originals.js +3 -0
- package/src/common/config/state/runtime.js +47 -0
- package/src/common/constants/env.cdn.js +20 -0
- package/src/common/constants/env.js +23 -0
- package/src/common/constants/env.npm.js +21 -0
- package/src/common/context/shared-context.js +21 -0
- package/src/common/deny-list/deny-list.js +116 -0
- package/src/common/drain/drain.js +119 -0
- package/src/common/event-emitter/contextual-ee.js +159 -0
- package/src/common/event-emitter/contextual-ee.test.js +310 -0
- package/src/common/event-emitter/handle.js +17 -0
- package/src/common/event-emitter/handle.test.js +56 -0
- package/src/common/event-emitter/register-handler.js +25 -0
- package/src/common/event-emitter/register-handler.test.js +61 -0
- package/src/common/event-listener/event-listener-opts.js +41 -0
- package/src/common/harvest/harvest-scheduler.js +112 -0
- package/src/common/harvest/harvest.js +248 -0
- package/src/common/ids/id.js +32 -0
- package/src/common/ids/id.test.js +92 -0
- package/src/common/ids/unique-id.js +104 -0
- package/src/common/ids/unique-id.test.js +58 -0
- package/src/common/metrics/framework-detection.js +71 -0
- package/src/common/metrics/paint-metrics.js +6 -0
- package/src/common/serialize/bel-serializer.js +93 -0
- package/src/common/timing/nav-timing.js +90 -0
- package/src/common/timing/nav-timing.test.js +161 -0
- package/src/common/timing/now.js +9 -0
- package/src/common/unload/eol.js +62 -0
- package/src/common/url/clean-url.js +10 -0
- package/src/common/url/clean-url.test.js +25 -0
- package/src/common/url/encode.js +75 -0
- package/src/common/url/encode.test.js +80 -0
- package/src/common/url/location.js +12 -0
- package/src/common/url/location.test.js +15 -0
- package/src/common/url/parse-url.js +70 -0
- package/src/common/url/parse-url.test.js +110 -0
- package/src/common/url/protocol.js +9 -0
- package/src/common/url/protocol.test.js +18 -0
- package/src/common/util/console.js +11 -0
- package/src/common/util/data-size.js +21 -0
- package/src/common/util/feature-flags.js +38 -0
- package/src/common/util/get-or-set.js +34 -0
- package/src/common/util/global-scope.js +47 -0
- package/src/common/util/map-own.js +22 -0
- package/src/common/util/map-own.test.js +52 -0
- package/src/common/util/obfuscate.js +73 -0
- package/src/common/util/s-hash.js +14 -0
- package/src/common/util/single.js +18 -0
- package/src/common/util/stringify.js +42 -0
- package/src/common/util/submit-data.js +101 -0
- package/src/common/util/traverse.js +36 -0
- package/src/common/util/user-agent.js +56 -0
- package/src/common/window/load.js +15 -0
- package/src/common/window/nreum.js +110 -0
- package/src/common/window/page-visibility.js +24 -0
- package/src/common/window/session-storage.js +75 -0
- package/src/common/window/supports-performance-observer.js +10 -0
- package/src/common/wrap/index.js +17 -0
- package/src/common/wrap/wrap-events.js +106 -0
- package/src/common/wrap/wrap-fetch.js +110 -0
- package/src/common/wrap/wrap-function.js +248 -0
- package/src/common/wrap/wrap-history.js +51 -0
- package/src/common/wrap/wrap-jsonp.js +136 -0
- package/src/common/wrap/wrap-mutation.js +58 -0
- package/src/common/wrap/wrap-promise.js +166 -0
- package/src/common/wrap/wrap-promise.test.js +140 -0
- package/src/common/wrap/wrap-raf.js +52 -0
- package/src/common/wrap/wrap-timer.js +69 -0
- package/src/common/wrap/wrap-xhr.js +214 -0
- package/src/features/ajax/aggregate/index.js +248 -0
- package/src/features/ajax/constants.js +3 -0
- package/src/features/ajax/index.js +1 -0
- package/src/features/ajax/instrument/distributed-tracing.js +166 -0
- package/src/features/ajax/instrument/index.js +380 -0
- package/src/features/ajax/instrument/response-size.js +18 -0
- package/src/features/jserrors/aggregate/canonical-function-name.js +14 -0
- package/src/features/jserrors/aggregate/canonical-function-name.test.js +13 -0
- package/src/features/jserrors/aggregate/compute-stack-trace.js +231 -0
- package/src/features/jserrors/aggregate/compute-stack-trace.test.js +297 -0
- package/src/features/jserrors/aggregate/format-stack-trace.js +30 -0
- package/src/features/jserrors/aggregate/format-stack-trace.test.js +39 -0
- package/src/features/jserrors/aggregate/index.js +310 -0
- package/src/features/jserrors/aggregate/string-hash-code.js +17 -0
- package/src/features/jserrors/aggregate/string-hash-code.test.js +12 -0
- package/src/features/jserrors/constants.js +4 -0
- package/src/features/jserrors/index.js +1 -0
- package/src/features/jserrors/instrument/debug.js +36 -0
- package/src/features/jserrors/instrument/index.js +151 -0
- package/src/features/metrics/aggregate/index.js +133 -0
- package/src/features/metrics/constants.js +7 -0
- package/src/features/metrics/index.js +1 -0
- package/src/features/metrics/instrument/index.js +14 -0
- package/src/features/metrics/instrument/workers-helper.js +113 -0
- package/src/features/page_action/aggregate/index.js +113 -0
- package/src/features/page_action/constants.js +3 -0
- package/src/features/page_action/index.js +1 -0
- package/src/features/page_action/instrument/index.js +15 -0
- package/src/features/page_view_event/aggregate/index.js +143 -0
- package/src/features/page_view_event/aggregate/initialized-features.js +31 -0
- package/src/features/page_view_event/constants.js +6 -0
- package/src/features/page_view_event/index.js +1 -0
- package/src/features/page_view_event/instrument/index.js +33 -0
- package/src/features/page_view_timing/aggregate/index.js +257 -0
- package/src/features/page_view_timing/constants.js +3 -0
- package/src/features/page_view_timing/first-paint.js +41 -0
- package/src/features/page_view_timing/index.js +1 -0
- package/src/features/page_view_timing/instrument/index.js +30 -0
- package/src/features/page_view_timing/long-tasks.js +60 -0
- package/src/features/session_trace/aggregate/index.js +413 -0
- package/src/features/session_trace/constants.js +15 -0
- package/src/features/session_trace/index.js +1 -0
- package/src/features/session_trace/instrument/index.js +127 -0
- package/src/features/spa/aggregate/index.js +738 -0
- package/src/features/spa/aggregate/interaction-node.js +85 -0
- package/src/features/spa/aggregate/interaction-node.test.js +17 -0
- package/src/features/spa/aggregate/interaction.js +112 -0
- package/src/features/spa/aggregate/serializer.js +198 -0
- package/src/features/spa/constants.js +36 -0
- package/src/features/spa/index.js +1 -0
- package/src/features/spa/instrument/index.js +114 -0
- package/src/features/utils/aggregate-base.js +7 -0
- package/src/features/utils/feature-base.js +51 -0
- package/src/features/utils/handler-cache.js +60 -0
- package/src/features/utils/instrument-base.js +68 -0
- package/src/features/utils/lazy-loader.js +37 -0
- package/src/index.js +15 -0
- package/src/loaders/agent.js +80 -0
- package/src/loaders/api/api.js +175 -0
- package/src/loaders/api/apiAsync.js +92 -0
- package/src/loaders/browser-agent.js +33 -0
- package/src/loaders/configure/configure.js +39 -0
- package/src/loaders/features/enabled-features.js +16 -0
- package/src/loaders/features/featureDependencies.js +26 -0
- package/src/loaders/features/features.js +25 -0
- package/src/loaders/micro-agent.js +84 -0
- package/src/loaders/worker-agent.js +24 -0
- package/dist/cjs/common/constants/environment-variables.js +0 -20
- package/dist/cjs/common/util/reduce.js +0 -22
- package/dist/cjs/common/window/top-level-callers.js +0 -23
- package/dist/esm/common/constants/environment-variables.js +0 -11
- package/dist/esm/common/util/reduce.js +0 -16
- package/dist/esm/common/window/top-level-callers.js +0 -17
- package/types.ts +0 -221
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
afterEach(() => {
|
|
2
|
+
jest.resetModules();
|
|
3
|
+
jest.clearAllMocks();
|
|
4
|
+
});
|
|
5
|
+
const urlTests = [{
|
|
6
|
+
input: 'http://example.com/path/name?qs=5&a=b',
|
|
7
|
+
expected: {
|
|
8
|
+
hostname: 'example.com',
|
|
9
|
+
pathname: '/path/name',
|
|
10
|
+
protocol: 'http',
|
|
11
|
+
port: '80',
|
|
12
|
+
sameOrigin: false
|
|
13
|
+
}
|
|
14
|
+
}, {
|
|
15
|
+
input: 'http://foo:bar@example.com:8080/path/@name?qs=5&a=b',
|
|
16
|
+
expected: {
|
|
17
|
+
hostname: 'example.com',
|
|
18
|
+
pathname: '/path/@name',
|
|
19
|
+
protocol: 'http',
|
|
20
|
+
port: '8080',
|
|
21
|
+
sameOrigin: false
|
|
22
|
+
}
|
|
23
|
+
}, {
|
|
24
|
+
input: 'https://foo:bar@example.com/path/name?qs=5&a=b',
|
|
25
|
+
expected: {
|
|
26
|
+
hostname: 'example.com',
|
|
27
|
+
pathname: '/path/name',
|
|
28
|
+
protocol: 'https',
|
|
29
|
+
port: '443',
|
|
30
|
+
sameOrigin: false
|
|
31
|
+
}
|
|
32
|
+
}, {
|
|
33
|
+
input: '/path/name?qs=5&a=b',
|
|
34
|
+
expected: {
|
|
35
|
+
hostname: location.hostname,
|
|
36
|
+
pathname: '/path/name',
|
|
37
|
+
protocol: location.protocol.split(':')[0],
|
|
38
|
+
port: '80',
|
|
39
|
+
sameOrigin: true
|
|
40
|
+
}
|
|
41
|
+
}, {
|
|
42
|
+
input: location.protocol + '//' + location.hostname + ':' + location.port + '/path/name?qs=5&a=b',
|
|
43
|
+
expected: {
|
|
44
|
+
hostname: location.hostname,
|
|
45
|
+
pathname: '/path/name',
|
|
46
|
+
protocol: location.protocol.split(':')[0],
|
|
47
|
+
port: '80',
|
|
48
|
+
sameOrigin: true
|
|
49
|
+
}
|
|
50
|
+
}, {
|
|
51
|
+
input: 'data:text/plain;base64,SGVsbG8sIFdvcmxkIQ==',
|
|
52
|
+
expected: {
|
|
53
|
+
protocol: 'data'
|
|
54
|
+
}
|
|
55
|
+
}];
|
|
56
|
+
test.each(urlTests)('verify url parsing inside browser scope', async _ref => {
|
|
57
|
+
let {
|
|
58
|
+
input,
|
|
59
|
+
expected
|
|
60
|
+
} = _ref;
|
|
61
|
+
jest.doMock('../util/global-scope', () => ({
|
|
62
|
+
__esModule: true,
|
|
63
|
+
isBrowserScope: true,
|
|
64
|
+
globalScope: global
|
|
65
|
+
}));
|
|
66
|
+
const {
|
|
67
|
+
parseUrl
|
|
68
|
+
} = await import('./parse-url');
|
|
69
|
+
expect(parseUrl(input)).toEqual(expected);
|
|
70
|
+
});
|
|
71
|
+
test.each(urlTests)('verify url parsing outside browser scope', async _ref2 => {
|
|
72
|
+
let {
|
|
73
|
+
input,
|
|
74
|
+
expected
|
|
75
|
+
} = _ref2;
|
|
76
|
+
jest.doMock('../util/global-scope', () => ({
|
|
77
|
+
__esModule: true,
|
|
78
|
+
isBrowserScope: false,
|
|
79
|
+
globalScope: global
|
|
80
|
+
}));
|
|
81
|
+
const {
|
|
82
|
+
parseUrl
|
|
83
|
+
} = await import('./parse-url');
|
|
84
|
+
expect(parseUrl(input)).toEqual(expected);
|
|
85
|
+
});
|
|
86
|
+
test('should cache parsed urls', async () => {
|
|
87
|
+
jest.doMock('../util/global-scope', () => ({
|
|
88
|
+
__esModule: true,
|
|
89
|
+
isBrowserScope: true,
|
|
90
|
+
globalScope: global
|
|
91
|
+
}));
|
|
92
|
+
const input = 'http://example.com/';
|
|
93
|
+
const expected = {
|
|
94
|
+
hostname: 'example.com',
|
|
95
|
+
pathname: '/',
|
|
96
|
+
protocol: 'http',
|
|
97
|
+
port: '80',
|
|
98
|
+
sameOrigin: false
|
|
99
|
+
};
|
|
100
|
+
jest.spyOn(document, 'createElement');
|
|
101
|
+
const {
|
|
102
|
+
parseUrl
|
|
103
|
+
} = await import('./parse-url');
|
|
104
|
+
parseUrl(input);
|
|
105
|
+
expect(parseUrl(input)).toEqual(expected);
|
|
106
|
+
expect(document.createElement).toHaveBeenCalledTimes(1);
|
|
107
|
+
});
|
|
@@ -2,16 +2,7 @@
|
|
|
2
2
|
* Copyright 2020 New Relic Corporation. All rights reserved.
|
|
3
3
|
* SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
*/
|
|
5
|
-
import {
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
supportabilityMetricSent: false
|
|
9
|
-
};
|
|
10
|
-
function isFileProtocol() {
|
|
11
|
-
let isFile = Boolean(getGlobalScope()?.location?.protocol === 'file:');
|
|
12
|
-
if (isFile) {
|
|
13
|
-
//metrics.recordSupportability('Generic/FileProtocol/Detected') -- may be implemented later? Probably make sure it's once per window
|
|
14
|
-
protocol.supportabilityMetricSent = true;
|
|
15
|
-
}
|
|
16
|
-
return isFile;
|
|
5
|
+
import { globalScope } from '../util/global-scope';
|
|
6
|
+
export function isFileProtocol() {
|
|
7
|
+
return Boolean(globalScope?.location?.protocol === 'file:');
|
|
17
8
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { faker } from '@faker-js/faker';
|
|
2
|
+
import { isFileProtocol } from './protocol';
|
|
3
|
+
test('should return true when location url contains file protocol', () => {
|
|
4
|
+
jest.spyOn(window, 'location', 'get').mockReturnValue({
|
|
5
|
+
protocol: 'file:'
|
|
6
|
+
});
|
|
7
|
+
expect(isFileProtocol()).toEqual(true);
|
|
8
|
+
});
|
|
9
|
+
test('should return false when location url does not contains file protocol', () => {
|
|
10
|
+
jest.spyOn(window, 'location', 'get').mockReturnValue({
|
|
11
|
+
protocol: 'http:'
|
|
12
|
+
});
|
|
13
|
+
expect(isFileProtocol()).toEqual(false);
|
|
14
|
+
});
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* @returns
|
|
6
6
|
*/
|
|
7
7
|
export function warn(message, secondary) {
|
|
8
|
-
if (
|
|
9
|
-
console.warn(
|
|
8
|
+
if (typeof console.warn !== 'function') return;
|
|
9
|
+
console.warn("New Relic: ".concat(message));
|
|
10
10
|
if (secondary) console.warn(secondary);
|
|
11
11
|
}
|
|
@@ -3,16 +3,22 @@
|
|
|
3
3
|
* SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
6
|
+
/**
|
|
7
|
+
* @typedef {function} MapOwnCallback
|
|
8
|
+
* @param {string} key Object key
|
|
9
|
+
* @param {any} value Object value
|
|
10
|
+
* @returns {any}
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Iterates the own enumerable properties of an object passing the key and value pair to a given
|
|
15
|
+
* callback function.
|
|
16
|
+
* @param {object} obj Input object to iterate over. If null or undefined, an empty array will be returned.
|
|
17
|
+
* @param {MapOwnCallback} fn A callback function called for each property. The callback should take the key
|
|
18
|
+
* and value from the object iteration and return some value.
|
|
19
|
+
* @returns {any[]} An array of values returned by the callback function.
|
|
20
|
+
*/
|
|
21
|
+
export const mapOwn = (obj, fn) => Object.entries(obj || {}).map(_ref => {
|
|
22
|
+
let [key, value] = _ref;
|
|
23
|
+
return fn(key, value);
|
|
24
|
+
});
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { mapOwn } from './map-own';
|
|
2
|
+
test('enumerates the object properties', () => {
|
|
3
|
+
const callback = jest.fn();
|
|
4
|
+
const input = {
|
|
5
|
+
foo: 'bar'
|
|
6
|
+
};
|
|
7
|
+
mapOwn(input, callback);
|
|
8
|
+
expect(callback).toHaveBeenCalledWith('foo', 'bar');
|
|
9
|
+
});
|
|
10
|
+
test('return array of results from callback invocation', () => {
|
|
11
|
+
const callback = jest.fn((key, value) => "".concat(key, ":").concat(value));
|
|
12
|
+
const input = {
|
|
13
|
+
foo: 'bar',
|
|
14
|
+
biz: 'baz'
|
|
15
|
+
};
|
|
16
|
+
const result = mapOwn(input, callback);
|
|
17
|
+
expect(result.length).toEqual(2);
|
|
18
|
+
expect(result).toContain('foo:bar');
|
|
19
|
+
expect(result).toContain('biz:baz');
|
|
20
|
+
});
|
|
21
|
+
test('does not iterate symbol properties', () => {
|
|
22
|
+
const callback = jest.fn((key, value) => "".concat(key, ":").concat(value));
|
|
23
|
+
const input = {
|
|
24
|
+
foo: 'bar',
|
|
25
|
+
[Symbol.for('biz')]: 'baz'
|
|
26
|
+
};
|
|
27
|
+
const result = mapOwn(input, callback);
|
|
28
|
+
expect(result.length).toEqual(1);
|
|
29
|
+
});
|
|
30
|
+
test('does not iterate inherited properties', () => {
|
|
31
|
+
function F() {}
|
|
32
|
+
F.prototype = {
|
|
33
|
+
biz: 'baz'
|
|
34
|
+
};
|
|
35
|
+
const callback = jest.fn((key, value) => "".concat(key, ":").concat(value));
|
|
36
|
+
const input = new F();
|
|
37
|
+
input.foo = 'bar';
|
|
38
|
+
const result = mapOwn(input, callback);
|
|
39
|
+
expect(result.length).toEqual(1);
|
|
40
|
+
});
|
|
41
|
+
test.each([null, undefined])('returns empty array when passed object is null or undefined', input => {
|
|
42
|
+
const callback = jest.fn();
|
|
43
|
+
const result = mapOwn(input, callback);
|
|
44
|
+
expect(Array.isArray(result)).toEqual(true);
|
|
45
|
+
expect(result.length).toEqual(0);
|
|
46
|
+
expect(callback).toHaveBeenCalledTimes(0);
|
|
47
|
+
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getConfigurationValue } from '../config/config';
|
|
2
2
|
import { SharedContext } from '../context/shared-context';
|
|
3
|
-
import {
|
|
3
|
+
import { isFileProtocol } from '../url/protocol';
|
|
4
4
|
import { warn } from './console';
|
|
5
5
|
var fileProtocolRule = {
|
|
6
6
|
regex: /^file:\/\/(.*)/,
|
|
@@ -37,7 +37,7 @@ export function getRules(agentIdentifier) {
|
|
|
37
37
|
var rules = [];
|
|
38
38
|
var configRules = getConfigurationValue(agentIdentifier, 'obfuscate') || [];
|
|
39
39
|
rules = rules.concat(configRules);
|
|
40
|
-
if (
|
|
40
|
+
if (isFileProtocol()) rules.push(fileProtocolRule);
|
|
41
41
|
// could add additional runtime/environment-specific rules here
|
|
42
42
|
|
|
43
43
|
return rules;
|
|
@@ -45,7 +45,8 @@ submitData.xhrGet = function xhrGet(url) {
|
|
|
45
45
|
* @param {boolean} sync
|
|
46
46
|
* @returns {XMLHttpRequest}
|
|
47
47
|
*/
|
|
48
|
-
submitData.xhr = function xhr(url, body, sync
|
|
48
|
+
submitData.xhr = function xhr(url, body, sync) {
|
|
49
|
+
let method = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'POST';
|
|
49
50
|
var request = new XMLHttpRequest();
|
|
50
51
|
request.open(method, url, !sync);
|
|
51
52
|
try {
|
|
@@ -86,6 +87,13 @@ submitData.img = function img(url) {
|
|
|
86
87
|
submitData.beacon = function (url, body) {
|
|
87
88
|
// Navigator has to be bound to ensure it does not error in some browsers
|
|
88
89
|
// https://xgwang.me/posts/you-may-not-know-beacon/#it-may-throw-error%2C-be-sure-to-catch
|
|
89
|
-
const send = window.navigator.sendBeacon.bind(navigator);
|
|
90
|
-
|
|
90
|
+
const send = window.navigator.sendBeacon.bind(window.navigator);
|
|
91
|
+
try {
|
|
92
|
+
return send(url, body);
|
|
93
|
+
} catch (err) {
|
|
94
|
+
// if sendBeacon still trys to throw an illegal invocation error,
|
|
95
|
+
// we can catch here and return. The harvest module will fallback to use
|
|
96
|
+
// .img to try to send
|
|
97
|
+
return false;
|
|
98
|
+
}
|
|
91
99
|
};
|
|
@@ -10,13 +10,15 @@ import { documentAddEventListener } from '../event-listener/event-listener-opts'
|
|
|
10
10
|
* @param {boolean} [toHiddenOnly=false] - only execute the 'cb' when the vis is changing to the hidden state; no arg is passed to 'cb' if used
|
|
11
11
|
* @returns void
|
|
12
12
|
*/
|
|
13
|
-
export function subscribeToVisibilityChange(cb
|
|
13
|
+
export function subscribeToVisibilityChange(cb) {
|
|
14
|
+
let toHiddenOnly = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
14
15
|
documentAddEventListener('visibilitychange', handleVisibilityChange);
|
|
15
16
|
return;
|
|
16
17
|
function handleVisibilityChange() {
|
|
17
18
|
if (toHiddenOnly) {
|
|
18
19
|
// trigger cb on change to hidden state only
|
|
19
|
-
if (document.visibilityState == 'hidden') cb();
|
|
20
|
+
if (document.visibilityState == 'hidden') cb();
|
|
21
|
+
return;
|
|
20
22
|
}
|
|
21
23
|
cb(document.visibilityState);
|
|
22
24
|
}
|
|
@@ -6,31 +6,72 @@
|
|
|
6
6
|
* @environment Browser script
|
|
7
7
|
*/
|
|
8
8
|
import { generateRandomHexString } from '../ids/unique-id';
|
|
9
|
-
|
|
10
|
-
export { getCurrentSessionIdOrMakeNew };
|
|
11
|
-
const SESS_ID = 'NRBA_SESSION_ID'; // prevents potential key collisions in session storage
|
|
9
|
+
const AGENT_PREFIX = 'NRBA/';
|
|
12
10
|
|
|
13
11
|
/**
|
|
14
|
-
* @
|
|
12
|
+
* @param {string} key
|
|
13
|
+
* @param {string} value
|
|
14
|
+
* @returns true, if item was set successfully. false, if storage is full or setItem threw an exception.
|
|
15
15
|
*/
|
|
16
|
-
function
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
export function putInBrowserStorage(key, value) {
|
|
17
|
+
let subgroup = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
|
|
18
|
+
try {
|
|
19
|
+
window.sessionStorage.setItem(AGENT_PREFIX + subgroup + key, value);
|
|
20
|
+
return true;
|
|
21
|
+
} catch (ex) {
|
|
22
|
+
// Session storage may be full.
|
|
23
|
+
return false;
|
|
19
24
|
}
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Storage/getItem}
|
|
28
|
+
* @param {string} key
|
|
29
|
+
*/
|
|
30
|
+
function getFromBrowserStorage(key) {
|
|
31
|
+
let subgroup = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
32
|
+
return window.sessionStorage.getItem(AGENT_PREFIX + subgroup + key);
|
|
33
|
+
}
|
|
34
|
+
export function removeFromBrowserStorage(key) {
|
|
35
|
+
let subgroup = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
36
|
+
try {
|
|
37
|
+
window.sessionStorage.removeItem(AGENT_PREFIX + subgroup + key);
|
|
38
|
+
} catch (e) {}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* @returns {string} This tab|window's session identifier, or a new ID if not found in storage
|
|
43
|
+
*/
|
|
44
|
+
export function getCurrentSessionIdOrMakeNew() {
|
|
20
45
|
try {
|
|
21
46
|
let sessionId;
|
|
22
|
-
if ((sessionId =
|
|
47
|
+
if ((sessionId = getFromBrowserStorage('SESSION_ID')) === null) {
|
|
23
48
|
// Generate a new one if storage is empty (no previous ID was created or currently exists)
|
|
24
49
|
sessionId = generateRandomHexString(16);
|
|
25
|
-
|
|
50
|
+
putInBrowserStorage('SESSION_ID', sessionId);
|
|
26
51
|
}
|
|
27
52
|
return sessionId;
|
|
28
53
|
} catch (ex) {
|
|
29
|
-
//
|
|
30
|
-
// OR the agent is running in a security context that does not allow
|
|
31
|
-
// access to the browser sessionStorage
|
|
54
|
+
// The agent is running in a security context that does not allow access to the sessionStorage or is not in browser window context.
|
|
32
55
|
return null;
|
|
33
56
|
}
|
|
34
57
|
}
|
|
35
58
|
|
|
36
|
-
|
|
59
|
+
/**
|
|
60
|
+
* Look through the page's sessionStorage items and gather the ones that was set under some grouping label, if applicable.
|
|
61
|
+
* @param {string} [subgroup] - empty string by default, which will return all items set by browser agent
|
|
62
|
+
* @returns An object of the key-value items from putInBrowserStorage calls from agents with access to the same storage space.
|
|
63
|
+
*/
|
|
64
|
+
export function getAllStorageItemsOfGroup() {
|
|
65
|
+
let subgroup = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
66
|
+
const prefixFilter = AGENT_PREFIX + subgroup;
|
|
67
|
+
const groupItems = {};
|
|
68
|
+
try {
|
|
69
|
+
for (let i = 0; i < window.sessionStorage.length; i++) {
|
|
70
|
+
let key = window.sessionStorage.key(i);
|
|
71
|
+
if (!key.startsWith(prefixFilter)) continue;else key = key.slice(prefixFilter.length); // this removes the "NRBA/<subgroup>" prefix so we get back the original key putInBrowserStorage
|
|
72
|
+
|
|
73
|
+
groupItems[key] = getFromBrowserStorage(key, subgroup);
|
|
74
|
+
}
|
|
75
|
+
} catch (ex) {}
|
|
76
|
+
return groupItems;
|
|
77
|
+
}
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
* @file Wraps assorted native objects and functions for instrumentation.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
+
import { wrapEvents } from './wrap-events';
|
|
5
6
|
import { wrapFetch } from './wrap-fetch';
|
|
6
|
-
import { wrapTimer } from './wrap-timer';
|
|
7
|
-
import { wrapRaf } from './wrap-raf';
|
|
8
7
|
import { wrapHistory } from './wrap-history';
|
|
9
8
|
import { wrapJsonP } from './wrap-jsonp';
|
|
10
9
|
import { wrapMutation } from './wrap-mutation';
|
|
11
10
|
import { wrapPromise } from './wrap-promise';
|
|
11
|
+
import { wrapRaf } from './wrap-raf';
|
|
12
|
+
import { wrapTimer } from './wrap-timer';
|
|
12
13
|
import { wrapXhr } from './wrap-xhr';
|
|
13
|
-
import { wrapEvents } from './wrap-events';
|
|
14
14
|
export { wrapEvents, wrapFetch, wrapHistory, wrapJsonP, wrapMutation, wrapPromise, wrapRaf, wrapTimer, wrapXhr };
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* It is also called by -> wrapXhr <-, so see "wrap-xhr.js" for features that use this indirectly.
|
|
9
9
|
*/
|
|
10
10
|
import { ee as baseEE } from '../event-emitter/contextual-ee';
|
|
11
|
-
import { createWrapperWithEmitter as wfn
|
|
11
|
+
import { createWrapperWithEmitter as wfn } from './wrap-function';
|
|
12
12
|
import { getOrSet } from '../util/get-or-set';
|
|
13
13
|
import { globalScope, isBrowserScope } from '../util/global-scope';
|
|
14
14
|
const wrapped = {};
|
|
@@ -25,19 +25,16 @@ const REMOVE_EVENT_LISTENER = 'removeEventListener';
|
|
|
25
25
|
*/
|
|
26
26
|
export function wrapEvents(sharedEE) {
|
|
27
27
|
var ee = scopedEE(sharedEE);
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
wrapped[ee.debugId] = 1;
|
|
28
|
+
|
|
29
|
+
// Notice if our wrapping never ran yet, the falsy NaN will not early return; but if it has,
|
|
30
|
+
// then we increment the count to track # of feats using this at runtime.
|
|
31
|
+
if (wrapped[ee.debugId]++) return ee;
|
|
32
|
+
wrapped[ee.debugId] = 1; // otherwise, first feature to wrap events
|
|
34
33
|
var wrapFn = wfn(ee, true);
|
|
35
34
|
|
|
36
35
|
// Guard against instrumenting environments w/o necessary features
|
|
37
36
|
if ('getPrototypeOf' in Object) {
|
|
38
|
-
if (isBrowserScope)
|
|
39
|
-
findEventListenerProtoAndCb(document, wrapNode);
|
|
40
|
-
}
|
|
37
|
+
if (isBrowserScope) findEventListenerProtoAndCb(document, wrapNode);
|
|
41
38
|
findEventListenerProtoAndCb(globalScope, wrapNode);
|
|
42
39
|
findEventListenerProtoAndCb(XHR.prototype, wrapNode);
|
|
43
40
|
}
|
|
@@ -77,11 +74,14 @@ export function wrapEvents(sharedEE) {
|
|
|
77
74
|
* @param {Function} cb - the function to run on the ancestral object once found, accepts an object as a arg
|
|
78
75
|
* @param {Array} rest - [optional] any additional arguments to pass to the cb
|
|
79
76
|
*/
|
|
80
|
-
function findEventListenerProtoAndCb(object, cb
|
|
77
|
+
function findEventListenerProtoAndCb(object, cb) {
|
|
81
78
|
let step = object;
|
|
82
79
|
while (typeof step === 'object' && !Object.prototype.hasOwnProperty.call(step, ADD_EVENT_LISTENER)) {
|
|
83
80
|
step = Object.getPrototypeOf(step);
|
|
84
81
|
}
|
|
82
|
+
for (var _len = arguments.length, rest = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
83
|
+
rest[_key - 2] = arguments[_key];
|
|
84
|
+
}
|
|
85
85
|
if (step) cb(step, ...rest);
|
|
86
86
|
}
|
|
87
87
|
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
import { ee as baseEE } from '../event-emitter/contextual-ee';
|
|
10
10
|
import slice from 'lodash._slice';
|
|
11
11
|
import { globalScope } from '../util/global-scope';
|
|
12
|
-
import { flag
|
|
12
|
+
import { flag } from './wrap-function';
|
|
13
13
|
var prefix = 'fetch-';
|
|
14
14
|
var bodyPrefix = prefix + 'body-';
|
|
15
15
|
var bodyMethods = ['arrayBuffer', 'blob', 'json', 'text', 'formData'];
|
|
@@ -32,12 +32,12 @@ export function wrapFetch(sharedEE) {
|
|
|
32
32
|
if (!(Req && Res && globalScope.fetch)) {
|
|
33
33
|
return ee;
|
|
34
34
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
35
|
+
|
|
36
|
+
// Notice if our wrapping never ran yet, the falsy NaN will not early return; but if it has,
|
|
37
|
+
// then we increment the count to track # of feats using this at runtime.
|
|
38
|
+
if (wrapped[ee.debugId]++) return ee;
|
|
39
|
+
wrapped[ee.debugId] = 1; // otherwise, first feature to wrap fetch
|
|
40
|
+
|
|
41
41
|
bodyMethods.forEach(method => {
|
|
42
42
|
wrapPromiseMethod(Req[proto], method, bodyPrefix);
|
|
43
43
|
wrapPromiseMethod(Res[proto], method, bodyPrefix);
|
|
@@ -86,10 +86,8 @@ export function wrapFetch(sharedEE) {
|
|
|
86
86
|
throw err;
|
|
87
87
|
});
|
|
88
88
|
};
|
|
89
|
-
target[name][flag] = fn; // track original similar to in wrap-function.js, so that they can be unwrapped with ease
|
|
90
89
|
}
|
|
91
90
|
}
|
|
92
|
-
|
|
93
91
|
return ee;
|
|
94
92
|
}
|
|
95
93
|
|
|
@@ -103,7 +103,8 @@ export function createWrapperWithEmitter(emitter, always) {
|
|
|
103
103
|
* Creates wrapper functions around each of an array of methods on a specified object.
|
|
104
104
|
* @param {Object} obj - The object to which the specified methods belong.
|
|
105
105
|
* @param {string[]} methods - An array of method names to be wrapped.
|
|
106
|
-
* @param {string} [prefix=''] - A prefix to add to the names of emitted events.
|
|
106
|
+
* @param {string} [prefix=''] - A prefix to add to the names of emitted events. If `-` is the first character, also
|
|
107
|
+
* adds the method name before the prefix.
|
|
107
108
|
* @param {function|object} [getContext] - The function or object that will serve as the 'this' context for handlers
|
|
108
109
|
* of events emitted by this wrapper.
|
|
109
110
|
* @param {boolean} [bubble=false] - If `true`, emitted events should also bubble up to the old emitter upon which
|
|
@@ -111,8 +112,7 @@ export function createWrapperWithEmitter(emitter, always) {
|
|
|
111
112
|
*/
|
|
112
113
|
function inPlace(obj, methods, prefix, getContext, bubble) {
|
|
113
114
|
if (!prefix) prefix = '';
|
|
114
|
-
// If prefix starts with '-' set this boolean to add the method name to
|
|
115
|
-
// the prefix before passing each one to wrap.
|
|
115
|
+
// If prefix starts with '-' set this boolean to add the method name to the prefix before passing each one to wrap.
|
|
116
116
|
var prependMethodPrefix = prefix.charAt(0) === '-';
|
|
117
117
|
var fn;
|
|
118
118
|
var method;
|
|
@@ -121,8 +121,7 @@ export function createWrapperWithEmitter(emitter, always) {
|
|
|
121
121
|
method = methods[i];
|
|
122
122
|
fn = obj[method];
|
|
123
123
|
|
|
124
|
-
// Unless fn is both wrappable and unwrapped bail
|
|
125
|
-
// so we don't add extra properties with undefined values.
|
|
124
|
+
// Unless fn is both wrappable and unwrapped, bail so we don't add extra properties with undefined values.
|
|
126
125
|
if (notWrappable(fn)) continue;
|
|
127
126
|
obj[method] = wrapFn(fn, prependMethodPrefix ? method + prefix : prefix, getContext, method, bubble);
|
|
128
127
|
}
|
|
@@ -242,16 +241,4 @@ export function wrapFunction(fn, wrapper) {
|
|
|
242
241
|
export function wrapInPlace(obj, fnName, wrapper) {
|
|
243
242
|
var fn = obj[fnName];
|
|
244
243
|
obj[fnName] = wrapFunction(fn, wrapper);
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
/**
|
|
248
|
-
* If a function property on an object (e.g. window) was previously wrapped (by this module), removes the wrapper.
|
|
249
|
-
* @param {Object} obj - The object on which the named function is a property.
|
|
250
|
-
* @param {string} fnName - The name of the function to be unwrapped.
|
|
251
|
-
*/
|
|
252
|
-
export function unwrapFunction(obj, fnName) {
|
|
253
|
-
if (obj?.[fnName]?.[flag]) {
|
|
254
|
-
// previous state of the function property is stored under our wrapper's "flag"; we don't wrap properties that *were* undefined to begin with
|
|
255
|
-
obj[fnName] = obj[fnName][flag];
|
|
256
|
-
}
|
|
257
244
|
}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* This module is used by: session_trace, spa.
|
|
8
8
|
*/
|
|
9
9
|
import { ee as globalEE } from '../event-emitter/contextual-ee';
|
|
10
|
-
import { createWrapperWithEmitter as wfn
|
|
10
|
+
import { createWrapperWithEmitter as wfn } from './wrap-function';
|
|
11
11
|
import { isBrowserScope } from '../util/global-scope';
|
|
12
12
|
const wrapped = {};
|
|
13
13
|
const HISTORY_FNS = ['pushState', 'replaceState'];
|
|
@@ -20,12 +20,13 @@ const HISTORY_FNS = ['pushState', 'replaceState'];
|
|
|
20
20
|
*/
|
|
21
21
|
export function wrapHistory(sharedEE) {
|
|
22
22
|
const ee = scopedEE(sharedEE);
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
wrapped[ee.debugId] = 1;
|
|
23
|
+
|
|
24
|
+
// Notice if our wrapping never ran yet, the falsy NaN will not early return; but if it has,
|
|
25
|
+
// then we increment the count to track # of feats using this at runtime. History API is only
|
|
26
|
+
// available in browser DOM context.
|
|
27
|
+
if (!isBrowserScope || wrapped[ee.debugId]++) return ee;
|
|
28
|
+
wrapped[ee.debugId] = 1; // otherwise, first feature to wrap history
|
|
29
|
+
|
|
29
30
|
var wrapFn = wfn(ee);
|
|
30
31
|
/*
|
|
31
32
|
* For objects that will be instantiated more than once, we wrap the object's prototype methods. The history object
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
import { eventListenerOpts } from '../event-listener/event-listener-opts';
|
|
11
11
|
import { ee as baseEE } from '../event-emitter/contextual-ee';
|
|
12
|
-
import { createWrapperWithEmitter as wfn
|
|
12
|
+
import { createWrapperWithEmitter as wfn } from './wrap-function';
|
|
13
13
|
import { isBrowserScope } from '../util/global-scope';
|
|
14
14
|
const wrapped = {};
|
|
15
15
|
const domInsertMethods = ['appendChild', 'insertBefore', 'replaceChild'];
|
|
@@ -22,12 +22,13 @@ const domInsertMethods = ['appendChild', 'insertBefore', 'replaceChild'];
|
|
|
22
22
|
*/
|
|
23
23
|
export function wrapJsonP(sharedEE) {
|
|
24
24
|
const ee = scopedEE(sharedEE);
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
wrapped[ee.debugId] = true;
|
|
25
|
+
|
|
26
|
+
// Notice if our wrapping never ran yet, the falsy NaN will not early return; but if it has,
|
|
27
|
+
// then we increment the count to track # of feats using this at runtime. JSONP deals with DOM
|
|
28
|
+
// tags so browser window env is required.
|
|
29
|
+
if (!isBrowserScope || wrapped[ee.debugId]) return ee;
|
|
30
|
+
wrapped[ee.debugId] = true; // otherwise, first feature to wrap JSONP
|
|
31
|
+
|
|
31
32
|
var wrapFn = wfn(ee);
|
|
32
33
|
var CALLBACK_REGEX = /[?&](?:callback|cb)=([^&#]+)/;
|
|
33
34
|
var PARENT_REGEX = /(.*)\.([^.]+)/;
|
|
@@ -21,12 +21,13 @@ const wrapped = {};
|
|
|
21
21
|
*/
|
|
22
22
|
export function wrapMutation(sharedEE) {
|
|
23
23
|
const ee = scopedEE(sharedEE);
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
wrapped[ee.debugId] = true;
|
|
24
|
+
|
|
25
|
+
// Notice if our wrapping never ran yet, the falsy NaN will not early return; but if it has,
|
|
26
|
+
// then we increment the count to track # of feats using this at runtime. Mutations API is only
|
|
27
|
+
// available in browser DOM context.
|
|
28
|
+
if (!isBrowserScope || wrapped[ee.debugId]) return ee;
|
|
29
|
+
wrapped[ee.debugId] = true; // otherwise, first feature to wrap mutations
|
|
30
|
+
|
|
30
31
|
var wrapFn = wfn(ee);
|
|
31
32
|
var OriginalObserver = originals.MO;
|
|
32
33
|
if (OriginalObserver) {
|