@microsoft/applicationinsights-core-js 3.0.0-beta.2303-03 → 3.0.0-beta.2303-05
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/browser/applicationinsights-core-js.integrity.json +9 -9
- package/browser/applicationinsights-core-js.js +2 -2
- package/browser/applicationinsights-core-js.js.map +1 -1
- package/browser/applicationinsights-core-js.min.js +2 -2
- package/browser/applicationinsights-core-js.min.js.map +1 -1
- package/dist/applicationinsights-core-js.api.json +113 -206
- package/dist/applicationinsights-core-js.api.md +11 -14
- package/dist/applicationinsights-core-js.d.ts +15 -13
- package/dist/applicationinsights-core-js.js +2 -2
- package/dist/applicationinsights-core-js.js.map +1 -1
- package/dist/applicationinsights-core-js.min.js +2 -2
- package/dist/applicationinsights-core-js.min.js.map +1 -1
- package/dist/applicationinsights-core-js.rollup.d.ts +15 -13
- package/dist-esm/Config/ConfigDefaultHelpers.js +1 -1
- package/dist-esm/Config/ConfigDefaults.js +1 -1
- package/dist-esm/Config/DynamicConfig.js +1 -1
- package/dist-esm/Config/DynamicProperty.js +1 -1
- package/dist-esm/Config/DynamicState.js +1 -1
- package/dist-esm/Config/DynamicSupport.js +1 -1
- package/dist-esm/Config/IConfigDefaults.js +1 -1
- package/dist-esm/Config/IDynamicConfigHandler.js +1 -1
- package/dist-esm/Config/IDynamicPropertyHandler.js +1 -1
- package/dist-esm/Config/IDynamicWatcher.js +1 -1
- package/dist-esm/Config/_IDynamicConfigHandlerState.js +1 -1
- package/dist-esm/JavaScriptSDK/AggregationError.js +1 -1
- package/dist-esm/JavaScriptSDK/AppInsightsCore.js +1 -1
- package/dist-esm/JavaScriptSDK/BaseTelemetryPlugin.js +1 -1
- package/dist-esm/JavaScriptSDK/Constants.js +1 -1
- package/dist-esm/JavaScriptSDK/CookieMgr.js +1 -1
- package/dist-esm/JavaScriptSDK/CoreUtils.js +1 -1
- package/dist-esm/JavaScriptSDK/DataCacheHelper.js +2 -2
- package/dist-esm/JavaScriptSDK/DataCacheHelper.js.map +1 -1
- package/dist-esm/JavaScriptSDK/DbgExtensionUtils.js +1 -1
- package/dist-esm/JavaScriptSDK/DiagnosticLogger.js +1 -1
- package/dist-esm/JavaScriptSDK/EnvUtils.js +1 -1
- package/dist-esm/JavaScriptSDK/EventHelpers.js +1 -1
- package/dist-esm/JavaScriptSDK/HelperFuncs.js +1 -1
- package/dist-esm/JavaScriptSDK/InstrumentHooks.js +1 -1
- package/dist-esm/JavaScriptSDK/InternalConstants.js +1 -1
- package/dist-esm/JavaScriptSDK/NotificationManager.js +1 -1
- package/dist-esm/JavaScriptSDK/PerfManager.js +1 -1
- package/dist-esm/JavaScriptSDK/ProcessTelemetryContext.js +1 -1
- package/dist-esm/JavaScriptSDK/RandomHelper.js +1 -1
- package/dist-esm/JavaScriptSDK/TelemetryHelpers.js +1 -1
- package/dist-esm/JavaScriptSDK/TelemetryInitializerPlugin.js +1 -1
- package/dist-esm/JavaScriptSDK/UnloadHandlerContainer.js +1 -1
- package/dist-esm/JavaScriptSDK/UnloadHookContainer.js +1 -1
- package/dist-esm/JavaScriptSDK/W3cTraceParent.js +1 -1
- package/dist-esm/JavaScriptSDK.Enums/EnumHelperFuncs.js +1 -1
- package/dist-esm/JavaScriptSDK.Enums/EventsDiscardedReason.js +1 -1
- package/dist-esm/JavaScriptSDK.Enums/LoggingEnums.js +1 -1
- package/dist-esm/JavaScriptSDK.Enums/SendRequestReason.js +1 -1
- package/dist-esm/JavaScriptSDK.Enums/TelemetryUnloadReason.js +1 -1
- package/dist-esm/JavaScriptSDK.Enums/TelemetryUpdateReason.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IAppInsightsCore.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IChannelControls.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IConfiguration.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ICookieMgr.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IDbgExtension.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IDiagnosticLogger.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IDistributedTraceContext.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IInstrumentHooks.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/INotificationListener.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/INotificationManager.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IPerfEvent.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IPerfManager.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IProcessTelemetryContext.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryInitializers.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryItem.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryPlugin.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryPluginChain.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryUnloadState.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryUpdateState.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ITraceParent.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IUnloadHook.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IUnloadableComponent.js +1 -1
- package/dist-esm/__DynamicConstants.js +1 -1
- package/dist-esm/applicationinsights-core-js.js +1 -1
- package/package.json +1 -1
- package/types/JavaScriptSDK/AppInsightsCore.d.ts +5 -6
- package/types/JavaScriptSDK.Interfaces/IAppInsightsCore.d.ts +9 -6
- package/src/JavaScriptSDK/AggregationError.ts +0 -36
- package/src/JavaScriptSDK/AppInsightsCore.ts +0 -1322
- package/src/JavaScriptSDK/BaseTelemetryPlugin.ts +0 -343
- package/src/JavaScriptSDK/Constants.ts +0 -4
- package/src/JavaScriptSDK/CookieMgr.ts +0 -449
- package/src/JavaScriptSDK/CoreUtils.ts +0 -58
- package/src/JavaScriptSDK/DataCacheHelper.ts +0 -107
- package/src/JavaScriptSDK/DbgExtensionUtils.ts +0 -56
- package/src/JavaScriptSDK/DiagnosticLogger.ts +0 -380
- package/src/JavaScriptSDK/EnvUtils.ts +0 -312
- package/src/JavaScriptSDK/EventHelpers.ts +0 -550
- package/src/JavaScriptSDK/HelperFuncs.ts +0 -351
- package/src/JavaScriptSDK/InstrumentHooks.ts +0 -280
- package/src/JavaScriptSDK/InternalConstants.ts +0 -31
- package/src/JavaScriptSDK/NotificationManager.ts +0 -165
- package/src/JavaScriptSDK/PerfManager.ts +0 -288
- package/src/JavaScriptSDK/ProcessTelemetryContext.ts +0 -674
- package/src/JavaScriptSDK/RandomHelper.ts +0 -145
- package/src/JavaScriptSDK/TelemetryHelpers.ts +0 -184
- package/src/JavaScriptSDK/TelemetryInitializerPlugin.ts +0 -112
- package/src/JavaScriptSDK/UnloadHandlerContainer.ts +0 -45
- package/src/JavaScriptSDK/UnloadHookContainer.ts +0 -52
- package/src/JavaScriptSDK/W3cTraceParent.ts +0 -197
- package/src/JavaScriptSDK.Enums/EnumHelperFuncs.ts +0 -24
- package/src/JavaScriptSDK.Enums/EventsDiscardedReason.ts +0 -71
- package/src/JavaScriptSDK.Enums/LoggingEnums.ts +0 -121
- package/src/JavaScriptSDK.Enums/SendRequestReason.ts +0 -56
- package/src/JavaScriptSDK.Enums/TelemetryUnloadReason.ts +0 -27
- package/src/JavaScriptSDK.Enums/TelemetryUpdateReason.ts +0 -27
- package/src/JavaScriptSDK.Interfaces/IAppInsightsCore.ts +0 -216
- package/src/JavaScriptSDK.Interfaces/IChannelControls.ts +0 -46
- package/src/JavaScriptSDK.Interfaces/IConfiguration.ts +0 -176
- package/src/JavaScriptSDK.Interfaces/ICookieMgr.ts +0 -116
- package/src/JavaScriptSDK.Interfaces/IDbgExtension.ts +0 -14
- package/src/JavaScriptSDK.Interfaces/IDiagnosticLogger.ts +0 -75
- package/src/JavaScriptSDK.Interfaces/IDistributedTraceContext.ts +0 -54
- package/src/JavaScriptSDK.Interfaces/IInstrumentHooks.ts +0 -100
- package/src/JavaScriptSDK.Interfaces/INotificationListener.ts +0 -39
- package/src/JavaScriptSDK.Interfaces/INotificationManager.ts +0 -52
- package/src/JavaScriptSDK.Interfaces/IPerfEvent.ts +0 -69
- package/src/JavaScriptSDK.Interfaces/IPerfManager.ts +0 -53
- package/src/JavaScriptSDK.Interfaces/IProcessTelemetryContext.ts +0 -157
- package/src/JavaScriptSDK.Interfaces/ITelemetryInitializers.ts +0 -17
- package/src/JavaScriptSDK.Interfaces/ITelemetryItem.ts +0 -62
- package/src/JavaScriptSDK.Interfaces/ITelemetryPlugin.ts +0 -94
- package/src/JavaScriptSDK.Interfaces/ITelemetryPluginChain.ts +0 -30
- package/src/JavaScriptSDK.Interfaces/ITelemetryUnloadState.ts +0 -10
- package/src/JavaScriptSDK.Interfaces/ITelemetryUpdateState.ts +0 -44
- package/src/JavaScriptSDK.Interfaces/ITraceParent.ts +0 -38
- package/src/JavaScriptSDK.Interfaces/IUnloadHook.ts +0 -22
- package/src/JavaScriptSDK.Interfaces/IUnloadableComponent.ts +0 -17
|
@@ -1,449 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
-
// Licensed under the MIT License.
|
|
3
|
-
import {
|
|
4
|
-
arrForEach, arrIndexOf, dumpObj, getDocument, getNavigator, isArray, isFunction, isNullOrUndefined, isString, isTruthy, isUndefined,
|
|
5
|
-
objForEachKey, strEndsWith, strIndexOf, strLeft, strSubstring, strTrim, utcNow
|
|
6
|
-
} from "@nevware21/ts-utils";
|
|
7
|
-
import { cfgDfMerge } from "../Config/ConfigDefaultHelpers";
|
|
8
|
-
import { createDynamicConfig, onConfigChange } from "../Config/DynamicConfig";
|
|
9
|
-
import { IConfigDefaults } from "../Config/IConfigDefaults";
|
|
10
|
-
import { _eInternalMessageId, eLoggingSeverity } from "../JavaScriptSDK.Enums/LoggingEnums";
|
|
11
|
-
import { IAppInsightsCore } from "../JavaScriptSDK.Interfaces/IAppInsightsCore";
|
|
12
|
-
import { IConfiguration } from "../JavaScriptSDK.Interfaces/IConfiguration";
|
|
13
|
-
import { ICookieMgr, ICookieMgrConfig } from "../JavaScriptSDK.Interfaces/ICookieMgr";
|
|
14
|
-
import { IDiagnosticLogger } from "../JavaScriptSDK.Interfaces/IDiagnosticLogger";
|
|
15
|
-
import { _throwInternal } from "./DiagnosticLogger";
|
|
16
|
-
import { getLocation, isIE } from "./EnvUtils";
|
|
17
|
-
import { getExceptionName, isNotNullOrUndefined, setValue, strContains } from "./HelperFuncs";
|
|
18
|
-
import { STR_DOMAIN, STR_EMPTY, STR_PATH, UNDEFINED_VALUE } from "./InternalConstants";
|
|
19
|
-
|
|
20
|
-
const strToGMTString = "toGMTString";
|
|
21
|
-
const strToUTCString = "toUTCString";
|
|
22
|
-
const strCookie = "cookie";
|
|
23
|
-
const strExpires = "expires";
|
|
24
|
-
const strIsCookieUseDisabled = "isCookieUseDisabled";
|
|
25
|
-
const strDisableCookiesUsage = "disableCookiesUsage";
|
|
26
|
-
const strConfigCookieMgr = "_ckMgr";
|
|
27
|
-
|
|
28
|
-
let _supportsCookies: boolean = null;
|
|
29
|
-
let _allowUaSameSite: boolean = null;
|
|
30
|
-
let _parsedCookieValue: string = null;
|
|
31
|
-
let _doc = getDocument();
|
|
32
|
-
let _cookieCache = {};
|
|
33
|
-
let _globalCookieConfig = {};
|
|
34
|
-
|
|
35
|
-
// // `isCookieUseDisabled` is deprecated, so explicitly casting as a key of IConfiguration to avoid typing error
|
|
36
|
-
// // when both isCookieUseDisabled and disableCookiesUsage are used disableCookiesUsage will take precedent, which is
|
|
37
|
-
// // why its listed first
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Set the supported dynamic config values as undefined (or an empty object) so that
|
|
41
|
-
* any listeners will be informed of any changes.
|
|
42
|
-
* Explicitly NOT including the deprecated `isCookieUseDisabled` as we don't want to support
|
|
43
|
-
* the v1 deprecated field as dynamic for updates
|
|
44
|
-
*/
|
|
45
|
-
const rootDefaultConfig: IConfigDefaults<IConfiguration> = {
|
|
46
|
-
cookieCfg: cfgDfMerge<ICookieMgrConfig>({
|
|
47
|
-
[STR_DOMAIN]: { fb: "cookieDomain", dfVal: isNotNullOrUndefined },
|
|
48
|
-
path: { fb: "cookiePath", dfVal: isNotNullOrUndefined },
|
|
49
|
-
enabled: UNDEFINED_VALUE,
|
|
50
|
-
ignoreCookies: UNDEFINED_VALUE,
|
|
51
|
-
blockedCookies: UNDEFINED_VALUE
|
|
52
|
-
}),
|
|
53
|
-
cookieDomain: UNDEFINED_VALUE,
|
|
54
|
-
cookiePath: UNDEFINED_VALUE,
|
|
55
|
-
[strDisableCookiesUsage]: UNDEFINED_VALUE
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* @ignore
|
|
60
|
-
* DO NOT USE or export from the module, this is exposed as public to support backward compatibility of previous static utility methods only.
|
|
61
|
-
* If you want to manager cookies either use the ICookieMgr available from the core instance via getCookieMgr() or create
|
|
62
|
-
* your own instance of the CookieMgr and use that.
|
|
63
|
-
* Using this directly for enabling / disabling cookie handling will not only affect your usage but EVERY user of cookies.
|
|
64
|
-
* Example, if you are using a shared component that is also using Application Insights you will affect their cookie handling.
|
|
65
|
-
* @param logger - The DiagnosticLogger to use for reporting errors.
|
|
66
|
-
*/
|
|
67
|
-
function _gblCookieMgr(config?: IConfiguration, logger?: IDiagnosticLogger): ICookieMgr {
|
|
68
|
-
// Stash the global instance against the BaseCookieMgr class
|
|
69
|
-
let inst = createCookieMgr[strConfigCookieMgr] || _globalCookieConfig[strConfigCookieMgr];
|
|
70
|
-
if (!inst) {
|
|
71
|
-
// Note: not using the getSetValue() helper as that would require always creating a temporary cookieMgr
|
|
72
|
-
// that ultimately is never used
|
|
73
|
-
inst = createCookieMgr[strConfigCookieMgr] = createCookieMgr(config, logger);
|
|
74
|
-
_globalCookieConfig[strConfigCookieMgr] = inst;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
return inst;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
function _isMgrEnabled(cookieMgr: ICookieMgr) {
|
|
81
|
-
if (cookieMgr) {
|
|
82
|
-
return cookieMgr.isEnabled();
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
return true;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
function _isIgnoredCookie(cookieMgrCfg: ICookieMgrConfig, name: string) {
|
|
89
|
-
if (name && cookieMgrCfg && isArray(cookieMgrCfg.ignoreCookies)) {
|
|
90
|
-
return arrIndexOf(cookieMgrCfg.ignoreCookies, name) !== -1;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
return false;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
function _isBlockedCookie(cookieMgrCfg: ICookieMgrConfig, name: string) {
|
|
97
|
-
if (name && cookieMgrCfg && isArray(cookieMgrCfg.blockedCookies)) {
|
|
98
|
-
if (arrIndexOf(cookieMgrCfg.blockedCookies, name) !== -1) {
|
|
99
|
-
return true;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
return _isIgnoredCookie(cookieMgrCfg, name);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* Helper to return the ICookieMgr from the core (if not null/undefined) or a default implementation
|
|
108
|
-
* associated with the configuration or a legacy default.
|
|
109
|
-
* @param core
|
|
110
|
-
* @param config
|
|
111
|
-
* @returns
|
|
112
|
-
*/
|
|
113
|
-
export function safeGetCookieMgr(core: IAppInsightsCore, config?: IConfiguration) {
|
|
114
|
-
let cookieMgr: ICookieMgr;
|
|
115
|
-
if (core) {
|
|
116
|
-
// Always returns an instance
|
|
117
|
-
cookieMgr = core.getCookieMgr();
|
|
118
|
-
} else if (config) {
|
|
119
|
-
let cookieCfg = config.cookieCfg;
|
|
120
|
-
if (cookieCfg && cookieCfg[strConfigCookieMgr]) {
|
|
121
|
-
cookieMgr = cookieCfg[strConfigCookieMgr];
|
|
122
|
-
} else {
|
|
123
|
-
cookieMgr = createCookieMgr(config);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
if (!cookieMgr) {
|
|
128
|
-
// Get or initialize the default global (legacy) cookie manager if we couldn't find one
|
|
129
|
-
cookieMgr = _gblCookieMgr(config, (core || {} as any).logger);
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
return cookieMgr;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
export function createCookieMgr(rootConfig?: IConfiguration, logger?: IDiagnosticLogger): ICookieMgr {
|
|
136
|
-
let cookieMgrConfig: ICookieMgrConfig;
|
|
137
|
-
let _path: string;
|
|
138
|
-
let _domain: string;
|
|
139
|
-
|
|
140
|
-
// Explicitly checking against false, so that setting to undefined will === true
|
|
141
|
-
let _enabled: boolean;
|
|
142
|
-
let _getCookieFn: (name: string) => string;
|
|
143
|
-
let _setCookieFn: (name: string, cookieValue: string) => void;
|
|
144
|
-
let _delCookieFn: (name: string, cookieValue: string) => void;
|
|
145
|
-
|
|
146
|
-
// Make sure the root config is dynamic as it may be the global config
|
|
147
|
-
rootConfig = createDynamicConfig(rootConfig || _globalCookieConfig, null, logger).cfg;
|
|
148
|
-
|
|
149
|
-
// Will get recalled if the referenced configuration is changed
|
|
150
|
-
onConfigChange(rootConfig, (details) => {
|
|
151
|
-
|
|
152
|
-
// Make sure the root config has all of the the defaults to the root config to ensure they are dynamic
|
|
153
|
-
details.setDf(details.cfg, rootDefaultConfig);
|
|
154
|
-
|
|
155
|
-
// Create and apply the defaults to the cookieCfg element
|
|
156
|
-
cookieMgrConfig = details.ref(details.cfg, "cookieCfg"); // details.setDf(details.cfg.cookieCfg, defaultConfig);
|
|
157
|
-
let isEnabled = cookieMgrConfig.enabled;
|
|
158
|
-
if (isNullOrUndefined(isEnabled)) {
|
|
159
|
-
// Set the enabled from the provided setting or the legacy root values
|
|
160
|
-
let cookieEnabled: boolean;
|
|
161
|
-
|
|
162
|
-
// This field is deprecated and dynamic updates will not be fully supported
|
|
163
|
-
if (!isUndefined(rootConfig[strIsCookieUseDisabled])) {
|
|
164
|
-
cookieEnabled = !rootConfig[strIsCookieUseDisabled];
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
// If this value is defined it takes precedent over the above
|
|
168
|
-
if (!isUndefined(rootConfig[strDisableCookiesUsage])) {
|
|
169
|
-
cookieEnabled = !rootConfig[strDisableCookiesUsage];
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
// Not setting the cookieMgrConfig.enabled as that will update (set) the global dynamic config
|
|
173
|
-
// So future "updates" then may not be as expected
|
|
174
|
-
isEnabled = cookieEnabled;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
_path = cookieMgrConfig.path || "/";
|
|
178
|
-
_domain = cookieMgrConfig.domain;
|
|
179
|
-
// Explicitly checking against false, so that setting to undefined will === true
|
|
180
|
-
_enabled = isEnabled !== false;
|
|
181
|
-
|
|
182
|
-
_getCookieFn = cookieMgrConfig.getCookie || _getCookieValue;
|
|
183
|
-
_setCookieFn = cookieMgrConfig.setCookie || _setCookieValue;
|
|
184
|
-
_delCookieFn = cookieMgrConfig.delCookie || _setCookieValue;
|
|
185
|
-
}, logger);
|
|
186
|
-
|
|
187
|
-
let cookieMgr: ICookieMgr = {
|
|
188
|
-
isEnabled: () => {
|
|
189
|
-
let enabled = _enabled && areCookiesSupported(logger);
|
|
190
|
-
// Using an indirect lookup for any global cookie manager to support tree shaking for SDK's
|
|
191
|
-
// that don't use the "applicationinsights-core" version of the default cookie function
|
|
192
|
-
let gblManager = _globalCookieConfig[strConfigCookieMgr];
|
|
193
|
-
if (enabled && gblManager && cookieMgr !== gblManager) {
|
|
194
|
-
// Make sure the GlobalCookie Manager instance (if not this instance) is also enabled.
|
|
195
|
-
// As the global (deprecated) functions may have been called (for backward compatibility)
|
|
196
|
-
enabled = _isMgrEnabled(gblManager);
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
return enabled;
|
|
200
|
-
},
|
|
201
|
-
setEnabled: (value: boolean) => {
|
|
202
|
-
// Explicitly checking against false, so that setting to undefined will === true
|
|
203
|
-
_enabled = value !== false;
|
|
204
|
-
},
|
|
205
|
-
set: (name: string, value: string, maxAgeSec?: number, domain?: string, path?: string) => {
|
|
206
|
-
let result = false;
|
|
207
|
-
if (_isMgrEnabled(cookieMgr) && !_isBlockedCookie(cookieMgrConfig, name)) {
|
|
208
|
-
let values: any = {};
|
|
209
|
-
let theValue = strTrim(value || STR_EMPTY);
|
|
210
|
-
let idx = strIndexOf(theValue, ";");
|
|
211
|
-
if (idx !== -1) {
|
|
212
|
-
theValue = strTrim(strLeft(value, idx));
|
|
213
|
-
values = _extractParts(strSubstring(value, idx + 1));
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
// Only update domain if not already present (isUndefined) and the value is truthy (not null, undefined or empty string)
|
|
217
|
-
setValue(values, STR_DOMAIN, domain || _domain, isTruthy, isUndefined);
|
|
218
|
-
|
|
219
|
-
if (!isNullOrUndefined(maxAgeSec)) {
|
|
220
|
-
const _isIE = isIE();
|
|
221
|
-
if (isUndefined(values[strExpires])) {
|
|
222
|
-
const nowMs = utcNow();
|
|
223
|
-
// Only add expires if not already present
|
|
224
|
-
let expireMs = nowMs + (maxAgeSec * 1000);
|
|
225
|
-
|
|
226
|
-
// Sanity check, if zero or -ve then ignore
|
|
227
|
-
if (expireMs > 0) {
|
|
228
|
-
let expiry = new Date();
|
|
229
|
-
expiry.setTime(expireMs);
|
|
230
|
-
setValue(values, strExpires,
|
|
231
|
-
_formatDate(expiry, !_isIE ? strToUTCString : strToGMTString) || _formatDate(expiry, _isIE ? strToGMTString : strToUTCString) || STR_EMPTY,
|
|
232
|
-
isTruthy);
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
if (!_isIE) {
|
|
237
|
-
// Only replace if not already present
|
|
238
|
-
setValue(values, "max-age", STR_EMPTY + maxAgeSec, null, isUndefined);
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
let location = getLocation();
|
|
243
|
-
if (location && location.protocol === "https:") {
|
|
244
|
-
setValue(values, "secure", null, null, isUndefined);
|
|
245
|
-
|
|
246
|
-
// Only set same site if not also secure
|
|
247
|
-
if (_allowUaSameSite === null) {
|
|
248
|
-
_allowUaSameSite = !uaDisallowsSameSiteNone((getNavigator() || {} as Navigator).userAgent);
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
if (_allowUaSameSite) {
|
|
252
|
-
setValue(values, "SameSite", "None", null, isUndefined);
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
setValue(values, STR_PATH, path || _path, null, isUndefined);
|
|
257
|
-
|
|
258
|
-
//let setCookieFn = cookieMgrConfig.setCookie || _setCookieValue;
|
|
259
|
-
_setCookieFn(name, _formatCookieValue(theValue, values));
|
|
260
|
-
result = true;
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
return result;
|
|
264
|
-
},
|
|
265
|
-
get: (name: string): string => {
|
|
266
|
-
let value = STR_EMPTY
|
|
267
|
-
if (_isMgrEnabled(cookieMgr) && !_isIgnoredCookie(cookieMgrConfig, name)) {
|
|
268
|
-
value = _getCookieFn(name);
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
return value;
|
|
272
|
-
},
|
|
273
|
-
del: (name: string, path?: string) => {
|
|
274
|
-
let result = false;
|
|
275
|
-
if (_isMgrEnabled(cookieMgr)) {
|
|
276
|
-
// Only remove the cookie if the manager and cookie support has not been disabled
|
|
277
|
-
result = cookieMgr.purge(name, path);
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
return result;
|
|
281
|
-
},
|
|
282
|
-
purge: (name: string, path?: string) => {
|
|
283
|
-
let result = false;
|
|
284
|
-
if (areCookiesSupported(logger)) {
|
|
285
|
-
// Setting the expiration date in the past immediately removes the cookie
|
|
286
|
-
let values = {
|
|
287
|
-
[STR_PATH]: path ? path : "/",
|
|
288
|
-
[strExpires]: "Thu, 01 Jan 1970 00:00:01 GMT"
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
if (!isIE()) {
|
|
292
|
-
// Set max age to expire now
|
|
293
|
-
values["max-age"] = "0"
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
// let delCookie = cookieMgrConfig.delCookie || _setCookieValue;
|
|
297
|
-
_delCookieFn(name, _formatCookieValue(STR_EMPTY, values));
|
|
298
|
-
result = true;
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
return result;
|
|
302
|
-
}
|
|
303
|
-
};
|
|
304
|
-
|
|
305
|
-
// Associated this cookie manager with the config
|
|
306
|
-
cookieMgr[strConfigCookieMgr] = cookieMgr;
|
|
307
|
-
|
|
308
|
-
return cookieMgr;
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
/*
|
|
312
|
-
* Helper method to tell if document.cookie object is supported by the runtime
|
|
313
|
-
*/
|
|
314
|
-
export function areCookiesSupported(logger?: IDiagnosticLogger): any {
|
|
315
|
-
if (_supportsCookies === null) {
|
|
316
|
-
_supportsCookies = false;
|
|
317
|
-
|
|
318
|
-
try {
|
|
319
|
-
let doc = _doc || {} as Document;
|
|
320
|
-
_supportsCookies = doc[strCookie] !== undefined;
|
|
321
|
-
} catch (e) {
|
|
322
|
-
_throwInternal(
|
|
323
|
-
logger,
|
|
324
|
-
eLoggingSeverity.WARNING,
|
|
325
|
-
_eInternalMessageId.CannotAccessCookie,
|
|
326
|
-
"Cannot access document.cookie - " + getExceptionName(e),
|
|
327
|
-
{ exception: dumpObj(e) });
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
return _supportsCookies;
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
function _extractParts(theValue: string) {
|
|
335
|
-
let values: { [key: string]: string } = {};
|
|
336
|
-
if (theValue && theValue.length) {
|
|
337
|
-
let parts = strTrim(theValue).split(";");
|
|
338
|
-
arrForEach(parts, (thePart) => {
|
|
339
|
-
thePart = strTrim(thePart || STR_EMPTY);
|
|
340
|
-
if (thePart) {
|
|
341
|
-
let idx = strIndexOf(thePart, "=");
|
|
342
|
-
if (idx === -1) {
|
|
343
|
-
values[thePart] = null;
|
|
344
|
-
} else {
|
|
345
|
-
values[strTrim(strLeft(thePart, idx))] = strTrim(strSubstring(thePart, idx + 1));
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
});
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
return values;
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
function _formatDate(theDate: Date, func: string) {
|
|
355
|
-
if (isFunction(theDate[func])) {
|
|
356
|
-
return theDate[func]();
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
return null;
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
function _formatCookieValue(value: string, values: any) {
|
|
363
|
-
let cookieValue = value || STR_EMPTY;
|
|
364
|
-
objForEachKey(values, (name, theValue) => {
|
|
365
|
-
cookieValue += "; " + name + (!isNullOrUndefined(theValue) ? "=" + theValue : STR_EMPTY);
|
|
366
|
-
});
|
|
367
|
-
|
|
368
|
-
return cookieValue;
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
function _getCookieValue(name: string) {
|
|
372
|
-
let cookieValue = STR_EMPTY;
|
|
373
|
-
if (_doc) {
|
|
374
|
-
let theCookie = _doc[strCookie] || STR_EMPTY;
|
|
375
|
-
if (_parsedCookieValue !== theCookie) {
|
|
376
|
-
_cookieCache = _extractParts(theCookie);
|
|
377
|
-
_parsedCookieValue = theCookie;
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
cookieValue = strTrim(_cookieCache[name] || STR_EMPTY);
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
return cookieValue;
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
function _setCookieValue(name: string, cookieValue: string) {
|
|
387
|
-
if (_doc) {
|
|
388
|
-
_doc[strCookie] = name + "=" + cookieValue;
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
export function uaDisallowsSameSiteNone(userAgent: string) {
|
|
393
|
-
if (!isString(userAgent)) {
|
|
394
|
-
return false;
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
// Cover all iOS based browsers here. This includes:
|
|
398
|
-
// - Safari on iOS 12 for iPhone, iPod Touch, iPad
|
|
399
|
-
// - WkWebview on iOS 12 for iPhone, iPod Touch, iPad
|
|
400
|
-
// - Chrome on iOS 12 for iPhone, iPod Touch, iPad
|
|
401
|
-
// All of which are broken by SameSite=None, because they use the iOS networking stack
|
|
402
|
-
if (strContains(userAgent, "CPU iPhone OS 12") || strContains(userAgent, "iPad; CPU OS 12")) {
|
|
403
|
-
return true;
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
// Cover Mac OS X based browsers that use the Mac OS networking stack. This includes:
|
|
407
|
-
// - Safari on Mac OS X
|
|
408
|
-
// This does not include:
|
|
409
|
-
// - Internal browser on Mac OS X
|
|
410
|
-
// - Chrome on Mac OS X
|
|
411
|
-
// - Chromium on Mac OS X
|
|
412
|
-
// Because they do not use the Mac OS networking stack.
|
|
413
|
-
if (strContains(userAgent, "Macintosh; Intel Mac OS X 10_14") && strContains(userAgent, "Version/") && strContains(userAgent, "Safari")) {
|
|
414
|
-
return true;
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
// Cover Mac OS X internal browsers that use the Mac OS networking stack. This includes:
|
|
418
|
-
// - Internal browser on Mac OS X
|
|
419
|
-
// This does not include:
|
|
420
|
-
// - Safari on Mac OS X
|
|
421
|
-
// - Chrome on Mac OS X
|
|
422
|
-
// - Chromium on Mac OS X
|
|
423
|
-
// Because they do not use the Mac OS networking stack.
|
|
424
|
-
if (strContains(userAgent, "Macintosh; Intel Mac OS X 10_14") && strEndsWith(userAgent, "AppleWebKit/605.1.15 (KHTML, like Gecko)")) {
|
|
425
|
-
return true;
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
// Cover Chrome 50-69, because some versions are broken by SameSite=None, and none in this range require it.
|
|
429
|
-
// Note: this covers some pre-Chromium Edge versions, but pre-Chromim Edge does not require SameSite=None, so this is fine.
|
|
430
|
-
// Note: this regex applies to Windows, Mac OS X, and Linux, deliberately.
|
|
431
|
-
if (strContains(userAgent, "Chrome/5") || strContains(userAgent, "Chrome/6")) {
|
|
432
|
-
return true;
|
|
433
|
-
}
|
|
434
|
-
|
|
435
|
-
// Unreal Engine runs Chromium 59, but does not advertise as Chrome until 4.23. Treat versions of Unreal
|
|
436
|
-
// that don't specify their Chrome version as lacking support for SameSite=None.
|
|
437
|
-
if (strContains(userAgent, "UnrealEngine") && !strContains(userAgent, "Chrome")) {
|
|
438
|
-
return true;
|
|
439
|
-
}
|
|
440
|
-
|
|
441
|
-
// UCBrowser < 12.13.2 ignores Set-Cookie headers with SameSite=None
|
|
442
|
-
// NB: this rule isn't complete - you need regex to make a complete rule.
|
|
443
|
-
// See: https://www.chromium.org/updates/same-site/incompatible-clients
|
|
444
|
-
if (strContains(userAgent, "UCBrowser/12") || strContains(userAgent, "UCBrowser/11")) {
|
|
445
|
-
return true;
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
return false;
|
|
449
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
-
// Licensed under the MIT License.
|
|
3
|
-
"use strict";
|
|
4
|
-
import { strShimUndefined } from "@microsoft/applicationinsights-shims";
|
|
5
|
-
import { strSubstr, strSubstring } from "@nevware21/ts-utils";
|
|
6
|
-
import { STR_EMPTY } from "./InternalConstants";
|
|
7
|
-
import { random32 } from "./RandomHelper";
|
|
8
|
-
|
|
9
|
-
// Added to help with minfication
|
|
10
|
-
export const Undefined = strShimUndefined;
|
|
11
|
-
|
|
12
|
-
export function newGuid(): string {
|
|
13
|
-
const uuid = generateW3CId();
|
|
14
|
-
|
|
15
|
-
return strSubstring(uuid, 0, 8) + "-" + strSubstring(uuid, 8, 12) + "-" + strSubstring(uuid, 12, 16) + "-" + strSubstring(uuid, 16, 20) + "-" + strSubstring(uuid, 20);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* The strEndsWith() method determines whether a string ends with the characters of a specified string, returning true or false as appropriate.
|
|
20
|
-
* @param value - The value to check whether it ends with the search value.
|
|
21
|
-
* @param search - The characters to be searched for at the end of the value.
|
|
22
|
-
* @returns true if the given search value is found at the end of the string, otherwise false.
|
|
23
|
-
*/
|
|
24
|
-
export function strEndsWith(value: string, search: string) {
|
|
25
|
-
if (value && search) {
|
|
26
|
-
let len = value.length;
|
|
27
|
-
let start = len - search.length;
|
|
28
|
-
return strSubstring(value, start >= 0 ? start : 0, len) === search;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
return false;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* generate W3C trace id
|
|
36
|
-
*/
|
|
37
|
-
export function generateW3CId(): string {
|
|
38
|
-
const hexValues = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"];
|
|
39
|
-
|
|
40
|
-
// rfc4122 version 4 UUID without dashes and with lowercase letters
|
|
41
|
-
let oct = STR_EMPTY, tmp;
|
|
42
|
-
for (let a = 0; a < 4; a++) {
|
|
43
|
-
tmp = random32();
|
|
44
|
-
oct +=
|
|
45
|
-
hexValues[tmp & 0xF] +
|
|
46
|
-
hexValues[tmp >> 4 & 0xF] +
|
|
47
|
-
hexValues[tmp >> 8 & 0xF] +
|
|
48
|
-
hexValues[tmp >> 12 & 0xF] +
|
|
49
|
-
hexValues[tmp >> 16 & 0xF] +
|
|
50
|
-
hexValues[tmp >> 20 & 0xF] +
|
|
51
|
-
hexValues[tmp >> 24 & 0xF] +
|
|
52
|
-
hexValues[tmp >> 28 & 0xF];
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
// "Set the two most significant bits (bits 6 and 7) of the clock_seq_hi_and_reserved to zero and one, respectively"
|
|
56
|
-
const clockSequenceHi = hexValues[8 + (random32() & 0x03) | 0];
|
|
57
|
-
return strSubstr(oct, 0, 8) + strSubstr(oct, 9, 4) + "4" + strSubstr(oct, 13, 3) + clockSequenceHi +strSubstr(oct, 16, 3) + strSubstr(oct, 19, 12);
|
|
58
|
-
}
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
-
// Licensed under the MIT License.
|
|
3
|
-
|
|
4
|
-
import { ObjDefineProperty } from "@microsoft/applicationinsights-shims";
|
|
5
|
-
import { normalizeJsName } from "./HelperFuncs";
|
|
6
|
-
import { STR_EMPTY } from "./InternalConstants";
|
|
7
|
-
import { newId } from "./RandomHelper";
|
|
8
|
-
|
|
9
|
-
const _objDefineProperty = ObjDefineProperty;
|
|
10
|
-
|
|
11
|
-
const version = "#version#";
|
|
12
|
-
let instanceName = "." + newId(6);
|
|
13
|
-
let _dataUid = 0;
|
|
14
|
-
|
|
15
|
-
export interface IDataCache {
|
|
16
|
-
id: string;
|
|
17
|
-
accept: (target: any) => boolean,
|
|
18
|
-
get: <T>(target: any, name: string, defValue?: T, addDefault?: boolean) => T;
|
|
19
|
-
kill: (target: any, name: string) => void;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
function _createAccessor<T>(target: any, prop: string, value: T): boolean {
|
|
23
|
-
if (_objDefineProperty) {
|
|
24
|
-
try {
|
|
25
|
-
_objDefineProperty(target, prop, {
|
|
26
|
-
value: value,
|
|
27
|
-
enumerable: false,
|
|
28
|
-
configurable: true
|
|
29
|
-
});
|
|
30
|
-
return true;
|
|
31
|
-
} catch (e) {
|
|
32
|
-
// IE8 Defines a defineProperty on Object but it's only supported for DOM elements so it will throw
|
|
33
|
-
// We will just ignore this here.
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
return false;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// Accepts only:
|
|
41
|
-
// - Node
|
|
42
|
-
// - Node.ELEMENT_NODE
|
|
43
|
-
// - Node.DOCUMENT_NODE
|
|
44
|
-
// - Object
|
|
45
|
-
// - Any
|
|
46
|
-
function _canAcceptData(target: any) {
|
|
47
|
-
return target.nodeType === 1 || target.nodeType === 9 || !( +target.nodeType );
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
function _getCache(data: IDataCache, target: Node) {
|
|
51
|
-
let theCache = target[data.id];
|
|
52
|
-
if (!theCache) {
|
|
53
|
-
theCache = {};
|
|
54
|
-
|
|
55
|
-
try {
|
|
56
|
-
if (_canAcceptData(target)) {
|
|
57
|
-
if (!_createAccessor(target, data.id, theCache)) {
|
|
58
|
-
// Environment doesn't support accessor, so just use direct assignment
|
|
59
|
-
target[data.id] = theCache;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
} catch (e) {
|
|
63
|
-
// Not all environments allow extending all objects, so just ignore the cache in those cases
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
return theCache;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export function createUniqueNamespace(name: string, includeVersion: boolean = false): string {
|
|
71
|
-
return normalizeJsName(name + (_dataUid++) + (includeVersion ? "." + version : STR_EMPTY) + instanceName);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export function createElmNodeData(name?: string) {
|
|
75
|
-
|
|
76
|
-
let data = {
|
|
77
|
-
id: createUniqueNamespace("_aiData-" + (name || STR_EMPTY) + "." + version),
|
|
78
|
-
accept: function (target: any) {
|
|
79
|
-
return _canAcceptData(target);
|
|
80
|
-
},
|
|
81
|
-
get: function <T>(target: any, name: string, defValue?: T, addDefault?: boolean): T {
|
|
82
|
-
let theCache = target[data.id];
|
|
83
|
-
if (!theCache) {
|
|
84
|
-
if (addDefault) {
|
|
85
|
-
// Side effect is adds the cache
|
|
86
|
-
theCache = _getCache(data, target);
|
|
87
|
-
theCache[normalizeJsName(name)] = defValue;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
return defValue;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
return theCache[normalizeJsName(name)];
|
|
94
|
-
},
|
|
95
|
-
kill: function(target: any, name: string) {
|
|
96
|
-
if (target && target[name]) {
|
|
97
|
-
try {
|
|
98
|
-
delete target[name];
|
|
99
|
-
} catch (e) {
|
|
100
|
-
// Just cleaning up, so if this fails -- ignore
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
return data;
|
|
107
|
-
}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
-
// Licensed under the MIT License.
|
|
3
|
-
|
|
4
|
-
import { getInst } from "@nevware21/ts-utils";
|
|
5
|
-
import { IConfiguration } from "../JavaScriptSDK.Interfaces/IConfiguration";
|
|
6
|
-
import { IDbgExtension } from "../JavaScriptSDK.Interfaces/IDbgExtension";
|
|
7
|
-
import { INotificationListener } from "../JavaScriptSDK.Interfaces/INotificationListener";
|
|
8
|
-
import { STR_EVENTS_DISCARDED, STR_EVENTS_SEND_REQUEST, STR_EVENTS_SENT, STR_PERF_EVENT } from "./InternalConstants";
|
|
9
|
-
|
|
10
|
-
const listenerFuncs = [ STR_EVENTS_SENT, STR_EVENTS_DISCARDED, STR_EVENTS_SEND_REQUEST, STR_PERF_EVENT ];
|
|
11
|
-
|
|
12
|
-
let _aiNamespace: any = null;
|
|
13
|
-
let _debugListener: INotificationListener;
|
|
14
|
-
|
|
15
|
-
function _listenerProxyFunc(name: string, config: IConfiguration) {
|
|
16
|
-
return function() {
|
|
17
|
-
let args = arguments;
|
|
18
|
-
let dbgExt = getDebugExt(config);
|
|
19
|
-
if (dbgExt) {
|
|
20
|
-
let listener = dbgExt.listener;
|
|
21
|
-
if (listener && listener[name]) {
|
|
22
|
-
listener[name].apply(listener, args);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function _getExtensionNamespace() {
|
|
29
|
-
// Cache the lookup of the global namespace object
|
|
30
|
-
let target = getInst("Microsoft");
|
|
31
|
-
if (target) {
|
|
32
|
-
_aiNamespace = target["ApplicationInsights"];
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return _aiNamespace;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export function getDebugExt(config: IConfiguration): IDbgExtension {
|
|
39
|
-
let ns = _aiNamespace;
|
|
40
|
-
if (!ns && config.disableDbgExt !== true) {
|
|
41
|
-
ns = _aiNamespace || _getExtensionNamespace();
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
return ns ? ns["ChromeDbgExt"] : null;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export function getDebugListener(config: IConfiguration): INotificationListener {
|
|
48
|
-
if (!_debugListener) {
|
|
49
|
-
_debugListener = {};
|
|
50
|
-
for (let lp = 0; lp < listenerFuncs.length; lp++) {
|
|
51
|
-
_debugListener[listenerFuncs[lp]] = _listenerProxyFunc(listenerFuncs[lp], config);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
return _debugListener;
|
|
56
|
-
}
|