@microsoft/applicationinsights-properties-js 3.0.0-beta.2211-03 → 3.0.0-beta.2211-04
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-properties-js.integrity.json +9 -9
- package/browser/applicationinsights-properties-js.js +696 -697
- package/browser/applicationinsights-properties-js.js.map +1 -1
- package/browser/applicationinsights-properties-js.min.js +2 -2
- package/browser/applicationinsights-properties-js.min.js.map +1 -1
- package/dist/applicationinsights-properties-js.d.ts +1 -1
- package/dist/applicationinsights-properties-js.js +696 -697
- package/dist/applicationinsights-properties-js.js.map +1 -1
- package/dist/applicationinsights-properties-js.min.js +2 -2
- package/dist/applicationinsights-properties-js.min.js.map +1 -1
- package/dist/applicationinsights-properties-js.rollup.d.ts +1 -1
- package/dist-esm/Context/Application.js +1 -1
- package/dist-esm/Context/Device.js +1 -1
- package/dist-esm/Context/Internal.js +1 -1
- package/dist-esm/Context/Location.js +1 -1
- package/dist-esm/Context/Session.js +1 -1
- package/dist-esm/Context/TelemetryTrace.js +1 -1
- package/dist-esm/Context/User.js +1 -1
- package/dist-esm/Interfaces/IPropTelemetryContext.js +1 -1
- package/dist-esm/Interfaces/IPropertiesConfig.js +1 -1
- package/dist-esm/PropertiesPlugin.js +1 -1
- package/dist-esm/TelemetryContext.js +1 -1
- package/dist-esm/__DynamicConstants.js +1 -1
- package/dist-esm/applicationinsights-properties-js.js +1 -1
- package/package.json +3 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Application Insights JavaScript SDK - Properties Plugin, 3.0.0-beta.2211-
|
|
2
|
+
* Application Insights JavaScript SDK - Properties Plugin, 3.0.0-beta.2211-04
|
|
3
3
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
4
|
*/
|
|
5
5
|
(function (global, factory) {
|
|
@@ -931,13 +931,14 @@
|
|
|
931
931
|
var _DYN_INITIALIZE = "initialize";
|
|
932
932
|
var _DYN_IDENTIFIER = "identifier";
|
|
933
933
|
var _DYN_IS_INITIALIZED = "isInitialized";
|
|
934
|
+
var _DYN_GET_PLUGIN = "getPlugin";
|
|
934
935
|
var _DYN_NAME$1 = "name";
|
|
935
936
|
var _DYN_TIME = "time";
|
|
936
937
|
var _DYN_PROCESS_NEXT = "processNext";
|
|
937
938
|
var _DYN_GET_PROCESS_TEL_CONT0 = "getProcessTelContext";
|
|
938
939
|
var _DYN_CALL = "call";
|
|
939
|
-
var _DYN_GET_PLUGIN = "getPlugin";
|
|
940
940
|
var _DYN_LOGGING_LEVEL_CONSOL4 = "loggingLevelConsole";
|
|
941
|
+
var _DYN_CREATE_NEW = "createNew";
|
|
941
942
|
var _DYN_TEARDOWN = "teardown";
|
|
942
943
|
var _DYN_MESSAGE_ID = "messageId";
|
|
943
944
|
var _DYN_MESSAGE = "message";
|
|
@@ -947,8 +948,6 @@
|
|
|
947
948
|
var _DYN_UPDATE$1 = "update";
|
|
948
949
|
var _DYN_GET_NEXT = "getNext";
|
|
949
950
|
var _DYN_SET_NEXT_PLUGIN = "setNextPlugin";
|
|
950
|
-
var _DYN_CREATE_NEW = "createNew";
|
|
951
|
-
var _DYN_CONFIG = "config";
|
|
952
951
|
var _DYN_USER_AGENT = "userAgent";
|
|
953
952
|
var _DYN_SPLIT = "split";
|
|
954
953
|
var _DYN_NODE_TYPE = "nodeType";
|
|
@@ -1215,7 +1214,7 @@
|
|
|
1215
1214
|
}
|
|
1216
1215
|
|
|
1217
1216
|
var _objDefineProperty = ObjDefineProperty;
|
|
1218
|
-
var version = "3.0.0-beta.2211-
|
|
1217
|
+
var version = "3.0.0-beta.2211-04";
|
|
1219
1218
|
var instanceName = "." + newId(6);
|
|
1220
1219
|
var _dataUid = 0;
|
|
1221
1220
|
function _createAccessor(target, prop, value) {
|
|
@@ -1899,791 +1898,791 @@
|
|
|
1899
1898
|
_getLogger(logger)[_DYN_LOG_INTERNAL_MESSAGE ](severity, message);
|
|
1900
1899
|
}
|
|
1901
1900
|
|
|
1902
|
-
var
|
|
1903
|
-
var
|
|
1904
|
-
var
|
|
1905
|
-
var
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
if (key === PerfEvent[strParentContextKey]) {
|
|
1934
|
-
if (!_self[key]) {
|
|
1935
|
-
_self[_DYN_IS_CHILD_EVT ] = function () { return true; };
|
|
1936
|
-
}
|
|
1937
|
-
_self[key] = value;
|
|
1938
|
-
}
|
|
1939
|
-
else if (key === PerfEvent[strChildrenContextKey]) {
|
|
1940
|
-
_self[key] = value;
|
|
1941
|
-
}
|
|
1942
|
-
else {
|
|
1943
|
-
var ctx = _self[strExecutionContextKey] = _self[strExecutionContextKey] || {};
|
|
1944
|
-
ctx[key] = value;
|
|
1945
|
-
}
|
|
1946
|
-
}
|
|
1947
|
-
};
|
|
1948
|
-
_self[_DYN_COMPLETE ] = function () {
|
|
1949
|
-
var childTime = 0;
|
|
1950
|
-
var childEvts = _self[_DYN_GET_CTX ](PerfEvent[strChildrenContextKey]);
|
|
1951
|
-
if (isArray(childEvts)) {
|
|
1952
|
-
for (var lp = 0; lp < childEvts[_DYN_LENGTH$2 ]; lp++) {
|
|
1953
|
-
var childEvt = childEvts[lp];
|
|
1954
|
-
if (childEvt) {
|
|
1955
|
-
childTime += childEvt[_DYN_TIME ];
|
|
1956
|
-
}
|
|
1957
|
-
}
|
|
1958
|
-
}
|
|
1959
|
-
_self[_DYN_TIME ] = utcNow() - _self.start;
|
|
1960
|
-
_self.exTime = _self[_DYN_TIME ] - childTime;
|
|
1961
|
-
_self[_DYN_COMPLETE ] = function () { };
|
|
1962
|
-
};
|
|
1963
|
-
}
|
|
1964
|
-
PerfEvent.ParentContextKey = "parent";
|
|
1965
|
-
PerfEvent.ChildrenContextKey = "childEvts";
|
|
1966
|
-
return PerfEvent;
|
|
1967
|
-
}());
|
|
1968
|
-
var doPerfActiveKey = "CoreUtils.doPerf";
|
|
1969
|
-
function doPerf(mgrSource, getSource, func, details, isAsync) {
|
|
1970
|
-
if (mgrSource) {
|
|
1971
|
-
var perfMgr = mgrSource;
|
|
1972
|
-
if (perfMgr[STR_GET_PERF_MGR]) {
|
|
1973
|
-
perfMgr = perfMgr[STR_GET_PERF_MGR]();
|
|
1974
|
-
}
|
|
1975
|
-
if (perfMgr) {
|
|
1976
|
-
var perfEvt = void 0;
|
|
1977
|
-
var currentActive = perfMgr[_DYN_GET_CTX ](doPerfActiveKey);
|
|
1978
|
-
try {
|
|
1979
|
-
perfEvt = perfMgr.create(getSource(), details, isAsync);
|
|
1980
|
-
if (perfEvt) {
|
|
1981
|
-
if (currentActive && perfEvt[_DYN_SET_CTX ]) {
|
|
1982
|
-
perfEvt[_DYN_SET_CTX ](PerfEvent[strParentContextKey], currentActive);
|
|
1983
|
-
if (currentActive[_DYN_GET_CTX ] && currentActive[_DYN_SET_CTX ]) {
|
|
1984
|
-
var children = currentActive[_DYN_GET_CTX ](PerfEvent[strChildrenContextKey]);
|
|
1985
|
-
if (!children) {
|
|
1986
|
-
children = [];
|
|
1987
|
-
currentActive[_DYN_SET_CTX ](PerfEvent[strChildrenContextKey], children);
|
|
1988
|
-
}
|
|
1989
|
-
children[_DYN_PUSH ](perfEvt);
|
|
1990
|
-
}
|
|
1991
|
-
}
|
|
1992
|
-
perfMgr[_DYN_SET_CTX ](doPerfActiveKey, perfEvt);
|
|
1993
|
-
return func(perfEvt);
|
|
1994
|
-
}
|
|
1995
|
-
}
|
|
1996
|
-
catch (ex) {
|
|
1997
|
-
if (perfEvt && perfEvt[_DYN_SET_CTX ]) {
|
|
1998
|
-
perfEvt[_DYN_SET_CTX ]("exception", ex);
|
|
1999
|
-
}
|
|
2000
|
-
}
|
|
2001
|
-
finally {
|
|
2002
|
-
if (perfEvt) {
|
|
2003
|
-
perfMgr.fire(perfEvt);
|
|
2004
|
-
}
|
|
2005
|
-
perfMgr[_DYN_SET_CTX ](doPerfActiveKey, currentActive);
|
|
2006
|
-
}
|
|
2007
|
-
}
|
|
1901
|
+
var _a$2, _b;
|
|
1902
|
+
var strToGMTString = "toGMTString";
|
|
1903
|
+
var strToUTCString = "toUTCString";
|
|
1904
|
+
var strCookie = "cookie";
|
|
1905
|
+
var strExpires = "expires";
|
|
1906
|
+
var strIsCookieUseDisabled = "isCookieUseDisabled";
|
|
1907
|
+
var strDisableCookiesUsage = "disableCookiesUsage";
|
|
1908
|
+
var strConfigCookieMgr = "_ckMgr";
|
|
1909
|
+
var _supportsCookies = null;
|
|
1910
|
+
var _allowUaSameSite = null;
|
|
1911
|
+
var _parsedCookieValue = null;
|
|
1912
|
+
var _doc = getDocument();
|
|
1913
|
+
var _cookieCache = {};
|
|
1914
|
+
var _globalCookieConfig = {};
|
|
1915
|
+
var defaultConfig = objDeepFreeze((_a$2 = {},
|
|
1916
|
+
_a$2[STR_DOMAIN] = { fb: "cookieDomain", dfVal: isNotNullOrUndefined },
|
|
1917
|
+
_a$2.path = { fb: "cookiePath", dfVal: isNotNullOrUndefined },
|
|
1918
|
+
_a$2.enabled = UNDEFINED_VALUE,
|
|
1919
|
+
_a$2));
|
|
1920
|
+
var rootDefaultConfig = (_b = {
|
|
1921
|
+
cookieCfg: {},
|
|
1922
|
+
cookieDomain: UNDEFINED_VALUE,
|
|
1923
|
+
cookiePath: UNDEFINED_VALUE
|
|
1924
|
+
},
|
|
1925
|
+
_b[strDisableCookiesUsage] = UNDEFINED_VALUE,
|
|
1926
|
+
_b);
|
|
1927
|
+
function _gblCookieMgr(config, logger) {
|
|
1928
|
+
var inst = createCookieMgr[strConfigCookieMgr] || _globalCookieConfig[strConfigCookieMgr];
|
|
1929
|
+
if (!inst) {
|
|
1930
|
+
inst = createCookieMgr[strConfigCookieMgr] = createCookieMgr(config, logger);
|
|
1931
|
+
_globalCookieConfig[strConfigCookieMgr] = inst;
|
|
2008
1932
|
}
|
|
2009
|
-
return
|
|
1933
|
+
return inst;
|
|
2010
1934
|
}
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
var oct = STR_EMPTY, tmp;
|
|
2015
|
-
for (var a = 0; a < 4; a++) {
|
|
2016
|
-
tmp = random32();
|
|
2017
|
-
oct +=
|
|
2018
|
-
hexValues[tmp & 0xF] +
|
|
2019
|
-
hexValues[tmp >> 4 & 0xF] +
|
|
2020
|
-
hexValues[tmp >> 8 & 0xF] +
|
|
2021
|
-
hexValues[tmp >> 12 & 0xF] +
|
|
2022
|
-
hexValues[tmp >> 16 & 0xF] +
|
|
2023
|
-
hexValues[tmp >> 20 & 0xF] +
|
|
2024
|
-
hexValues[tmp >> 24 & 0xF] +
|
|
2025
|
-
hexValues[tmp >> 28 & 0xF];
|
|
1935
|
+
function _isMgrEnabled(cookieMgr) {
|
|
1936
|
+
if (cookieMgr) {
|
|
1937
|
+
return cookieMgr.isEnabled();
|
|
2026
1938
|
}
|
|
2027
|
-
|
|
2028
|
-
return strSubstr(oct, 0, 8) + strSubstr(oct, 9, 4) + "4" + strSubstr(oct, 13, 3) + clockSequenceHi + strSubstr(oct, 16, 3) + strSubstr(oct, 19, 12);
|
|
1939
|
+
return true;
|
|
2029
1940
|
}
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
function _isValid(value, len, invalidValue) {
|
|
2034
|
-
if (value && value[_DYN_LENGTH$2 ] === len && value !== invalidValue) {
|
|
2035
|
-
return !!value.match(/^[\da-f]*$/i);
|
|
1941
|
+
function _isIgnoredCookie(cookieMgrCfg, name) {
|
|
1942
|
+
if (name && cookieMgrCfg && isArray(cookieMgrCfg.ignoreCookies)) {
|
|
1943
|
+
return arrIndexOf(cookieMgrCfg.ignoreCookies, name) !== -1;
|
|
2036
1944
|
}
|
|
2037
1945
|
return false;
|
|
2038
1946
|
}
|
|
2039
|
-
function
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
return _isValid(value, 16, INVALID_SPAN_ID);
|
|
2044
|
-
}
|
|
2045
|
-
|
|
2046
|
-
var pluginStateData = createElmNodeData("plugin");
|
|
2047
|
-
function _getPluginState(plugin) {
|
|
2048
|
-
return pluginStateData.get(plugin, "state", {}, true);
|
|
2049
|
-
}
|
|
2050
|
-
|
|
2051
|
-
var strTelemetryPluginChain = "TelemetryPluginChain";
|
|
2052
|
-
var strHasRunFlags = "_hasRun";
|
|
2053
|
-
var strGetTelCtx = "_getTelCtx";
|
|
2054
|
-
var _chainId = 0;
|
|
2055
|
-
function _getNextProxyStart(proxy, core, startAt) {
|
|
2056
|
-
while (proxy) {
|
|
2057
|
-
if (proxy[_DYN_GET_PLUGIN ]() === startAt) {
|
|
2058
|
-
return proxy;
|
|
1947
|
+
function _isBlockedCookie(cookieMgrCfg, name) {
|
|
1948
|
+
if (name && cookieMgrCfg && isArray(cookieMgrCfg.blockedCookies)) {
|
|
1949
|
+
if (arrIndexOf(cookieMgrCfg.blockedCookies, name) !== -1) {
|
|
1950
|
+
return true;
|
|
2059
1951
|
}
|
|
2060
|
-
proxy = proxy[_DYN_GET_NEXT ]();
|
|
2061
1952
|
}
|
|
2062
|
-
return
|
|
1953
|
+
return _isIgnoredCookie(cookieMgrCfg, name);
|
|
2063
1954
|
}
|
|
2064
|
-
function
|
|
2065
|
-
var
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
dynamicHandler = createDynamicConfig({}, null, core[_DYN_LOGGER ]);
|
|
2069
|
-
}
|
|
2070
|
-
if (startAt !== null) {
|
|
2071
|
-
_nextProxy = startAt ? _getNextProxyStart(telemetryChain, core, startAt) : telemetryChain;
|
|
1955
|
+
function safeGetCookieMgr(core, config) {
|
|
1956
|
+
var cookieMgr;
|
|
1957
|
+
if (core) {
|
|
1958
|
+
cookieMgr = core.getCookieMgr();
|
|
2072
1959
|
}
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
return core;
|
|
2078
|
-
},
|
|
2079
|
-
diagLog: function () {
|
|
2080
|
-
return safeGetLogger(core, dynamicHandler.cfg);
|
|
2081
|
-
},
|
|
2082
|
-
getCfg: function () {
|
|
2083
|
-
return dynamicHandler.cfg;
|
|
2084
|
-
},
|
|
2085
|
-
getExtCfg: _resolveExtCfg,
|
|
2086
|
-
getConfig: _getConfig,
|
|
2087
|
-
hasNext: function () {
|
|
2088
|
-
return !!_nextProxy;
|
|
2089
|
-
},
|
|
2090
|
-
getNext: function () {
|
|
2091
|
-
return _nextProxy;
|
|
2092
|
-
},
|
|
2093
|
-
setNext: function (nextPlugin) {
|
|
2094
|
-
_nextProxy = nextPlugin;
|
|
2095
|
-
},
|
|
2096
|
-
iterate: _iterateChain,
|
|
2097
|
-
onComplete: _addOnComplete
|
|
2098
|
-
}
|
|
2099
|
-
};
|
|
2100
|
-
function _addOnComplete(onComplete, that) {
|
|
2101
|
-
var args = [];
|
|
2102
|
-
for (var _i = 2; _i < arguments.length; _i++) {
|
|
2103
|
-
args[_i - 2] = arguments[_i];
|
|
1960
|
+
else if (config) {
|
|
1961
|
+
var cookieCfg = config.cookieCfg;
|
|
1962
|
+
if (cookieCfg && cookieCfg[strConfigCookieMgr]) {
|
|
1963
|
+
cookieMgr = cookieCfg[strConfigCookieMgr];
|
|
2104
1964
|
}
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
func: onComplete,
|
|
2108
|
-
self: !isUndefined(that) ? that : context.ctx,
|
|
2109
|
-
args: args
|
|
2110
|
-
});
|
|
1965
|
+
else {
|
|
1966
|
+
cookieMgr = createCookieMgr(config);
|
|
2111
1967
|
}
|
|
2112
1968
|
}
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
_nextProxy = nextProxy ? nextProxy[_DYN_GET_NEXT ]() : null;
|
|
2116
|
-
if (!nextProxy) {
|
|
2117
|
-
var onComplete = _onComplete;
|
|
2118
|
-
if (onComplete && onComplete[_DYN_LENGTH$2 ] > 0) {
|
|
2119
|
-
arrForEach(onComplete, function (completeDetails) {
|
|
2120
|
-
try {
|
|
2121
|
-
completeDetails.func[_DYN_CALL ](completeDetails.self, completeDetails.args);
|
|
2122
|
-
}
|
|
2123
|
-
catch (e) {
|
|
2124
|
-
_throwInternal(core[_DYN_LOGGER ], 2 , 73 , "Unexpected Exception during onComplete - " + dumpObj(e));
|
|
2125
|
-
}
|
|
2126
|
-
});
|
|
2127
|
-
_onComplete = [];
|
|
2128
|
-
}
|
|
2129
|
-
}
|
|
2130
|
-
return nextProxy;
|
|
1969
|
+
if (!cookieMgr) {
|
|
1970
|
+
cookieMgr = _gblCookieMgr(config, (core || {})[_DYN_LOGGER ]);
|
|
2131
1971
|
}
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
1972
|
+
return cookieMgr;
|
|
1973
|
+
}
|
|
1974
|
+
function createCookieMgr(rootConfig, logger) {
|
|
1975
|
+
var cookieMgrConfig;
|
|
1976
|
+
var _path;
|
|
1977
|
+
var _domain;
|
|
1978
|
+
var _enabled;
|
|
1979
|
+
var _getCookieFn;
|
|
1980
|
+
var _setCookieFn;
|
|
1981
|
+
var _delCookieFn;
|
|
1982
|
+
rootConfig = createDynamicConfig(rootConfig || _globalCookieConfig, null, logger).cfg;
|
|
1983
|
+
onConfigChange(rootConfig, function (details) {
|
|
1984
|
+
details[_DYN_SET_DF ](details.cfg, rootDefaultConfig);
|
|
1985
|
+
cookieMgrConfig = details[_DYN_SET_DF ](details.cfg.cookieCfg, defaultConfig);
|
|
1986
|
+
var isEnabled = cookieMgrConfig.enabled;
|
|
1987
|
+
if (isNullOrUndefined(isEnabled)) {
|
|
1988
|
+
var cookieEnabled = void 0;
|
|
1989
|
+
if (!isUndefined(rootConfig[strIsCookieUseDisabled])) {
|
|
1990
|
+
cookieEnabled = !rootConfig[strIsCookieUseDisabled];
|
|
2139
1991
|
}
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
if (extCfg) {
|
|
2143
|
-
idCfg = extCfg[identifier];
|
|
2144
|
-
if (!idCfg && createIfMissing) {
|
|
2145
|
-
idCfg = {};
|
|
2146
|
-
}
|
|
2147
|
-
dynamicHandler.set(extCfg, identifier, idCfg);
|
|
2148
|
-
idCfg = extCfg[identifier];
|
|
1992
|
+
if (!isUndefined(rootConfig[strDisableCookiesUsage])) {
|
|
1993
|
+
cookieEnabled = !rootConfig[strDisableCookiesUsage];
|
|
2149
1994
|
}
|
|
1995
|
+
isEnabled = cookieEnabled;
|
|
2150
1996
|
}
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
1997
|
+
_path = cookieMgrConfig[STR_PATH ] || "/";
|
|
1998
|
+
_domain = cookieMgrConfig[STR_DOMAIN ];
|
|
1999
|
+
_enabled = isEnabled !== false;
|
|
2000
|
+
_getCookieFn = cookieMgrConfig.getCookie || _getCookieValue;
|
|
2001
|
+
_setCookieFn = cookieMgrConfig.setCookie || _setCookieValue;
|
|
2002
|
+
_delCookieFn = cookieMgrConfig.delCookie || _setCookieValue;
|
|
2003
|
+
}, logger);
|
|
2004
|
+
var cookieMgr = {
|
|
2005
|
+
isEnabled: function () {
|
|
2006
|
+
var enabled = _enabled && areCookiesSupported(logger);
|
|
2007
|
+
var gblManager = _globalCookieConfig[strConfigCookieMgr];
|
|
2008
|
+
if (enabled && gblManager && cookieMgr !== gblManager) {
|
|
2009
|
+
enabled = _isMgrEnabled(gblManager);
|
|
2010
|
+
}
|
|
2011
|
+
return enabled;
|
|
2012
|
+
},
|
|
2013
|
+
setEnabled: function (value) {
|
|
2014
|
+
_enabled = value !== false;
|
|
2015
|
+
},
|
|
2016
|
+
set: function (name, value, maxAgeSec, domain, path) {
|
|
2017
|
+
var result = false;
|
|
2018
|
+
if (_isMgrEnabled(cookieMgr) && !_isBlockedCookie(cookieMgrConfig, name)) {
|
|
2019
|
+
var values = {};
|
|
2020
|
+
var theValue = strTrim(value || STR_EMPTY);
|
|
2021
|
+
var idx = strIndexOf(theValue, ";");
|
|
2022
|
+
if (idx !== -1) {
|
|
2023
|
+
theValue = strTrim(strLeft(value, idx));
|
|
2024
|
+
values = _extractParts(strSubstring(value, idx + 1));
|
|
2025
|
+
}
|
|
2026
|
+
setValue(values, STR_DOMAIN, domain || _domain, isTruthy, isUndefined);
|
|
2027
|
+
if (!isNullOrUndefined(maxAgeSec)) {
|
|
2028
|
+
var _isIE = isIE();
|
|
2029
|
+
if (isUndefined(values[strExpires])) {
|
|
2030
|
+
var nowMs = utcNow();
|
|
2031
|
+
var expireMs = nowMs + (maxAgeSec * 1000);
|
|
2032
|
+
if (expireMs > 0) {
|
|
2033
|
+
var expiry = new Date();
|
|
2034
|
+
expiry.setTime(expireMs);
|
|
2035
|
+
setValue(values, strExpires, _formatDate(expiry, !_isIE ? strToUTCString : strToGMTString) || _formatDate(expiry, _isIE ? strToGMTString : strToUTCString) || STR_EMPTY, isTruthy);
|
|
2036
|
+
}
|
|
2037
|
+
}
|
|
2038
|
+
if (!_isIE) {
|
|
2039
|
+
setValue(values, "max-age", STR_EMPTY + maxAgeSec, null, isUndefined);
|
|
2161
2040
|
}
|
|
2162
2041
|
}
|
|
2163
|
-
|
|
2164
|
-
|
|
2042
|
+
var location_1 = getLocation();
|
|
2043
|
+
if (location_1 && location_1.protocol === "https:") {
|
|
2044
|
+
setValue(values, "secure", null, null, isUndefined);
|
|
2045
|
+
if (_allowUaSameSite === null) {
|
|
2046
|
+
_allowUaSameSite = !uaDisallowsSameSiteNone((getNavigator() || {})[_DYN_USER_AGENT ]);
|
|
2047
|
+
}
|
|
2048
|
+
if (_allowUaSameSite) {
|
|
2049
|
+
setValue(values, "SameSite", "None", null, isUndefined);
|
|
2050
|
+
}
|
|
2051
|
+
}
|
|
2052
|
+
setValue(values, STR_PATH, path || _path, null, isUndefined);
|
|
2053
|
+
_setCookieFn(name, _formatCookieValue(theValue, values));
|
|
2054
|
+
result = true;
|
|
2055
|
+
}
|
|
2056
|
+
return result;
|
|
2057
|
+
},
|
|
2058
|
+
get: function (name) {
|
|
2059
|
+
var value = STR_EMPTY;
|
|
2060
|
+
if (_isMgrEnabled(cookieMgr) && !_isIgnoredCookie(cookieMgrConfig, name)) {
|
|
2061
|
+
value = _getCookieFn(name);
|
|
2062
|
+
}
|
|
2063
|
+
return value;
|
|
2064
|
+
},
|
|
2065
|
+
del: function (name, path) {
|
|
2066
|
+
var result = false;
|
|
2067
|
+
if (_isMgrEnabled(cookieMgr)) {
|
|
2068
|
+
result = cookieMgr.purge(name, path);
|
|
2069
|
+
}
|
|
2070
|
+
return result;
|
|
2071
|
+
},
|
|
2072
|
+
purge: function (name, path) {
|
|
2073
|
+
var _a;
|
|
2074
|
+
var result = false;
|
|
2075
|
+
if (areCookiesSupported(logger)) {
|
|
2076
|
+
var values = (_a = {},
|
|
2077
|
+
_a[STR_PATH] = path ? path : "/",
|
|
2078
|
+
_a[strExpires] = "Thu, 01 Jan 1970 00:00:01 GMT",
|
|
2079
|
+
_a);
|
|
2080
|
+
if (!isIE()) {
|
|
2081
|
+
values["max-age"] = "0";
|
|
2082
|
+
}
|
|
2083
|
+
_delCookieFn(name, _formatCookieValue(STR_EMPTY, values));
|
|
2084
|
+
result = true;
|
|
2085
|
+
}
|
|
2086
|
+
return result;
|
|
2165
2087
|
}
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2088
|
+
};
|
|
2089
|
+
cookieMgr[strConfigCookieMgr] = cookieMgr;
|
|
2090
|
+
return cookieMgr;
|
|
2091
|
+
}
|
|
2092
|
+
function areCookiesSupported(logger) {
|
|
2093
|
+
if (_supportsCookies === null) {
|
|
2094
|
+
_supportsCookies = false;
|
|
2095
|
+
try {
|
|
2096
|
+
var doc = _doc || {};
|
|
2097
|
+
_supportsCookies = doc[strCookie] !== undefined;
|
|
2175
2098
|
}
|
|
2176
|
-
|
|
2177
|
-
|
|
2099
|
+
catch (e) {
|
|
2100
|
+
_throwInternal(logger, 2 , 68 , "Cannot access document.cookie - " + getExceptionName(e), { exception: dumpObj(e) });
|
|
2178
2101
|
}
|
|
2179
|
-
return (theValue || !isNullOrUndefined(theValue)) ? theValue : defaultValue;
|
|
2180
2102
|
}
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2103
|
+
return _supportsCookies;
|
|
2104
|
+
}
|
|
2105
|
+
function _extractParts(theValue) {
|
|
2106
|
+
var values = {};
|
|
2107
|
+
if (theValue && theValue[_DYN_LENGTH$2 ]) {
|
|
2108
|
+
var parts = strTrim(theValue)[_DYN_SPLIT ](";");
|
|
2109
|
+
arrForEach(parts, function (thePart) {
|
|
2110
|
+
thePart = strTrim(thePart || STR_EMPTY);
|
|
2111
|
+
if (thePart) {
|
|
2112
|
+
var idx = strIndexOf(thePart, "=");
|
|
2113
|
+
if (idx === -1) {
|
|
2114
|
+
values[thePart] = null;
|
|
2115
|
+
}
|
|
2116
|
+
else {
|
|
2117
|
+
values[strTrim(strLeft(thePart, idx))] = strTrim(strSubstring(thePart, idx + 1));
|
|
2118
|
+
}
|
|
2187
2119
|
}
|
|
2188
|
-
}
|
|
2120
|
+
});
|
|
2189
2121
|
}
|
|
2190
|
-
return
|
|
2122
|
+
return values;
|
|
2191
2123
|
}
|
|
2192
|
-
function
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
var context = internalContext.ctx;
|
|
2196
|
-
function _processNext(env) {
|
|
2197
|
-
var nextPlugin = internalContext._next();
|
|
2198
|
-
if (nextPlugin) {
|
|
2199
|
-
nextPlugin[STR_PROCESS_TELEMETRY ](env, context);
|
|
2200
|
-
}
|
|
2201
|
-
return !nextPlugin;
|
|
2124
|
+
function _formatDate(theDate, func) {
|
|
2125
|
+
if (isFunction(theDate[func])) {
|
|
2126
|
+
return theDate[func]();
|
|
2202
2127
|
}
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2128
|
+
return null;
|
|
2129
|
+
}
|
|
2130
|
+
function _formatCookieValue(value, values) {
|
|
2131
|
+
var cookieValue = value || STR_EMPTY;
|
|
2132
|
+
objForEachKey(values, function (name, theValue) {
|
|
2133
|
+
cookieValue += "; " + name + (!isNullOrUndefined(theValue) ? "=" + theValue : STR_EMPTY);
|
|
2134
|
+
});
|
|
2135
|
+
return cookieValue;
|
|
2136
|
+
}
|
|
2137
|
+
function _getCookieValue(name) {
|
|
2138
|
+
var cookieValue = STR_EMPTY;
|
|
2139
|
+
if (_doc) {
|
|
2140
|
+
var theCookie = _doc[strCookie] || STR_EMPTY;
|
|
2141
|
+
if (_parsedCookieValue !== theCookie) {
|
|
2142
|
+
_cookieCache = _extractParts(theCookie);
|
|
2143
|
+
_parsedCookieValue = theCookie;
|
|
2207
2144
|
}
|
|
2208
|
-
|
|
2145
|
+
cookieValue = strTrim(_cookieCache[name] || STR_EMPTY);
|
|
2209
2146
|
}
|
|
2210
|
-
|
|
2211
|
-
context[_DYN_CREATE_NEW ] = _createNew;
|
|
2212
|
-
return context;
|
|
2147
|
+
return cookieValue;
|
|
2213
2148
|
}
|
|
2214
|
-
function
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
var context = internalContext.ctx;
|
|
2218
|
-
function _processNext(unloadState) {
|
|
2219
|
-
var nextPlugin = internalContext._next();
|
|
2220
|
-
nextPlugin && nextPlugin.unload(context, unloadState);
|
|
2221
|
-
return !nextPlugin;
|
|
2149
|
+
function _setCookieValue(name, cookieValue) {
|
|
2150
|
+
if (_doc) {
|
|
2151
|
+
_doc[strCookie] = name + "=" + cookieValue;
|
|
2222
2152
|
}
|
|
2223
|
-
function _createNew(plugins, startAt) {
|
|
2224
|
-
if (plugins === void 0) { plugins = null; }
|
|
2225
|
-
if (isArray(plugins)) {
|
|
2226
|
-
plugins = createTelemetryProxyChain(plugins, config.cfg, core, startAt);
|
|
2227
|
-
}
|
|
2228
|
-
return createProcessTelemetryUnloadContext(plugins || context[_DYN_GET_NEXT ](), core, startAt);
|
|
2229
|
-
}
|
|
2230
|
-
context[_DYN_PROCESS_NEXT ] = _processNext;
|
|
2231
|
-
context[_DYN_CREATE_NEW ] = _createNew;
|
|
2232
|
-
return context;
|
|
2233
2153
|
}
|
|
2234
|
-
function
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
var context = internalContext.ctx;
|
|
2238
|
-
function _processNext(updateState) {
|
|
2239
|
-
return context.iterate(function (plugin) {
|
|
2240
|
-
if (isFunction(plugin[_DYN_UPDATE$1 ])) {
|
|
2241
|
-
plugin[_DYN_UPDATE$1 ](context, updateState);
|
|
2242
|
-
}
|
|
2243
|
-
});
|
|
2154
|
+
function uaDisallowsSameSiteNone(userAgent) {
|
|
2155
|
+
if (!isString(userAgent)) {
|
|
2156
|
+
return false;
|
|
2244
2157
|
}
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
if (isArray(plugins)) {
|
|
2248
|
-
plugins = createTelemetryProxyChain(plugins, config.cfg, core, startAt);
|
|
2249
|
-
}
|
|
2250
|
-
return createProcessTelemetryUpdateContext(plugins || context[_DYN_GET_NEXT ](), core, startAt);
|
|
2158
|
+
if (strContains(userAgent, "CPU iPhone OS 12") || strContains(userAgent, "iPad; CPU OS 12")) {
|
|
2159
|
+
return true;
|
|
2251
2160
|
}
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
return context;
|
|
2255
|
-
}
|
|
2256
|
-
function createTelemetryProxyChain(plugins, config, core, startAt) {
|
|
2257
|
-
var firstProxy = null;
|
|
2258
|
-
var add = startAt ? false : true;
|
|
2259
|
-
if (isArray(plugins) && plugins[_DYN_LENGTH$2 ] > 0) {
|
|
2260
|
-
var lastProxy_1 = null;
|
|
2261
|
-
arrForEach(plugins, function (thePlugin) {
|
|
2262
|
-
if (!add && startAt === thePlugin) {
|
|
2263
|
-
add = true;
|
|
2264
|
-
}
|
|
2265
|
-
if (add && thePlugin && isFunction(thePlugin[STR_PROCESS_TELEMETRY ])) {
|
|
2266
|
-
var newProxy = createTelemetryPluginProxy(thePlugin, config, core);
|
|
2267
|
-
if (!firstProxy) {
|
|
2268
|
-
firstProxy = newProxy;
|
|
2269
|
-
}
|
|
2270
|
-
if (lastProxy_1) {
|
|
2271
|
-
lastProxy_1._setNext(newProxy);
|
|
2272
|
-
}
|
|
2273
|
-
lastProxy_1 = newProxy;
|
|
2274
|
-
}
|
|
2275
|
-
});
|
|
2161
|
+
if (strContains(userAgent, "Macintosh; Intel Mac OS X 10_14") && strContains(userAgent, "Version/") && strContains(userAgent, "Safari")) {
|
|
2162
|
+
return true;
|
|
2276
2163
|
}
|
|
2277
|
-
if (
|
|
2278
|
-
return
|
|
2164
|
+
if (strContains(userAgent, "Macintosh; Intel Mac OS X 10_14") && strEndsWith(userAgent, "AppleWebKit/605.1.15 (KHTML, like Gecko)")) {
|
|
2165
|
+
return true;
|
|
2279
2166
|
}
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
function createTelemetryPluginProxy(plugin, config, core) {
|
|
2283
|
-
var nextProxy = null;
|
|
2284
|
-
var hasProcessTelemetry = isFunction(plugin[STR_PROCESS_TELEMETRY ]);
|
|
2285
|
-
var hasSetNext = isFunction(plugin[_DYN_SET_NEXT_PLUGIN ]);
|
|
2286
|
-
var chainId;
|
|
2287
|
-
if (plugin) {
|
|
2288
|
-
chainId = plugin[_DYN_IDENTIFIER ] + "-" + plugin[STR_PRIORITY ] + "-" + _chainId++;
|
|
2167
|
+
if (strContains(userAgent, "Chrome/5") || strContains(userAgent, "Chrome/6")) {
|
|
2168
|
+
return true;
|
|
2289
2169
|
}
|
|
2290
|
-
|
|
2291
|
-
|
|
2170
|
+
if (strContains(userAgent, "UnrealEngine") && !strContains(userAgent, "Chrome")) {
|
|
2171
|
+
return true;
|
|
2292
2172
|
}
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
return plugin;
|
|
2296
|
-
},
|
|
2297
|
-
getNext: function () {
|
|
2298
|
-
return nextProxy;
|
|
2299
|
-
},
|
|
2300
|
-
processTelemetry: _processTelemetry,
|
|
2301
|
-
unload: _unloadPlugin,
|
|
2302
|
-
update: _updatePlugin,
|
|
2303
|
-
_id: chainId,
|
|
2304
|
-
_setNext: function (nextPlugin) {
|
|
2305
|
-
nextProxy = nextPlugin;
|
|
2306
|
-
}
|
|
2307
|
-
};
|
|
2308
|
-
function _getTelCtx() {
|
|
2309
|
-
var itemCtx;
|
|
2310
|
-
if (plugin && isFunction(plugin[strGetTelCtx])) {
|
|
2311
|
-
itemCtx = plugin[strGetTelCtx]();
|
|
2312
|
-
}
|
|
2313
|
-
if (!itemCtx) {
|
|
2314
|
-
itemCtx = createProcessTelemetryContext(proxyChain, config, core);
|
|
2315
|
-
}
|
|
2316
|
-
return itemCtx;
|
|
2173
|
+
if (strContains(userAgent, "UCBrowser/12") || strContains(userAgent, "UCBrowser/11")) {
|
|
2174
|
+
return true;
|
|
2317
2175
|
}
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2176
|
+
return false;
|
|
2177
|
+
}
|
|
2178
|
+
|
|
2179
|
+
var strExecutionContextKey = "ctx";
|
|
2180
|
+
var strParentContextKey = "ParentContextKey";
|
|
2181
|
+
var strChildrenContextKey = "ChildrenContextKey";
|
|
2182
|
+
var PerfEvent = /** @class */ (function () {
|
|
2183
|
+
function PerfEvent(name, payloadDetails, isAsync) {
|
|
2184
|
+
var _self = this;
|
|
2185
|
+
_self.start = utcNow();
|
|
2186
|
+
_self[_DYN_NAME$1 ] = name;
|
|
2187
|
+
_self[_DYN_IS_ASYNC ] = isAsync;
|
|
2188
|
+
_self[_DYN_IS_CHILD_EVT ] = function () { return false; };
|
|
2189
|
+
if (isFunction(payloadDetails)) {
|
|
2190
|
+
var theDetails_1;
|
|
2191
|
+
objDefineAccessors(_self, "payload", function () {
|
|
2192
|
+
if (!theDetails_1 && isFunction(payloadDetails)) {
|
|
2193
|
+
theDetails_1 = payloadDetails();
|
|
2194
|
+
payloadDetails = null;
|
|
2195
|
+
}
|
|
2196
|
+
return theDetails_1;
|
|
2197
|
+
});
|
|
2324
2198
|
}
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
try {
|
|
2330
|
-
var nextId = nextProxy ? nextProxy._id : STR_EMPTY;
|
|
2331
|
-
if (nextId) {
|
|
2332
|
-
hasRunContext[nextId] = false;
|
|
2333
|
-
}
|
|
2334
|
-
hasRun = processPluginFn(itemCtx);
|
|
2199
|
+
_self[_DYN_GET_CTX ] = function (key) {
|
|
2200
|
+
if (key) {
|
|
2201
|
+
if (key === PerfEvent[strParentContextKey] || key === PerfEvent[strChildrenContextKey]) {
|
|
2202
|
+
return _self[key];
|
|
2335
2203
|
}
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2204
|
+
return (_self[strExecutionContextKey] || {})[key];
|
|
2205
|
+
}
|
|
2206
|
+
return null;
|
|
2207
|
+
};
|
|
2208
|
+
_self[_DYN_SET_CTX ] = function (key, value) {
|
|
2209
|
+
if (key) {
|
|
2210
|
+
if (key === PerfEvent[strParentContextKey]) {
|
|
2211
|
+
if (!_self[key]) {
|
|
2212
|
+
_self[_DYN_IS_CHILD_EVT ] = function () { return true; };
|
|
2343
2213
|
}
|
|
2214
|
+
_self[key] = value;
|
|
2215
|
+
}
|
|
2216
|
+
else if (key === PerfEvent[strChildrenContextKey]) {
|
|
2217
|
+
_self[key] = value;
|
|
2218
|
+
}
|
|
2219
|
+
else {
|
|
2220
|
+
var ctx = _self[strExecutionContextKey] = _self[strExecutionContextKey] || {};
|
|
2221
|
+
ctx[key] = value;
|
|
2344
2222
|
}
|
|
2345
|
-
}, details, isAsync);
|
|
2346
|
-
}
|
|
2347
|
-
return hasRun;
|
|
2348
|
-
}
|
|
2349
|
-
function _processTelemetry(env, itemCtx) {
|
|
2350
|
-
itemCtx = itemCtx || _getTelCtx();
|
|
2351
|
-
function _callProcessTelemetry(itemCtx) {
|
|
2352
|
-
if (!plugin || !hasProcessTelemetry) {
|
|
2353
|
-
return false;
|
|
2354
|
-
}
|
|
2355
|
-
var pluginState = _getPluginState(plugin);
|
|
2356
|
-
if (pluginState[_DYN_TEARDOWN ] || pluginState[STR_DISABLED]) {
|
|
2357
|
-
return false;
|
|
2358
2223
|
}
|
|
2359
|
-
|
|
2360
|
-
|
|
2224
|
+
};
|
|
2225
|
+
_self[_DYN_COMPLETE ] = function () {
|
|
2226
|
+
var childTime = 0;
|
|
2227
|
+
var childEvts = _self[_DYN_GET_CTX ](PerfEvent[strChildrenContextKey]);
|
|
2228
|
+
if (isArray(childEvts)) {
|
|
2229
|
+
for (var lp = 0; lp < childEvts[_DYN_LENGTH$2 ]; lp++) {
|
|
2230
|
+
var childEvt = childEvts[lp];
|
|
2231
|
+
if (childEvt) {
|
|
2232
|
+
childTime += childEvt[_DYN_TIME ];
|
|
2233
|
+
}
|
|
2234
|
+
}
|
|
2361
2235
|
}
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
itemCtx[_DYN_PROCESS_NEXT ](env);
|
|
2367
|
-
}
|
|
2236
|
+
_self[_DYN_TIME ] = utcNow() - _self.start;
|
|
2237
|
+
_self.exTime = _self[_DYN_TIME ] - childTime;
|
|
2238
|
+
_self[_DYN_COMPLETE ] = function () { };
|
|
2239
|
+
};
|
|
2368
2240
|
}
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2241
|
+
PerfEvent.ParentContextKey = "parent";
|
|
2242
|
+
PerfEvent.ChildrenContextKey = "childEvts";
|
|
2243
|
+
return PerfEvent;
|
|
2244
|
+
}());
|
|
2245
|
+
var doPerfActiveKey = "CoreUtils.doPerf";
|
|
2246
|
+
function doPerf(mgrSource, getSource, func, details, isAsync) {
|
|
2247
|
+
if (mgrSource) {
|
|
2248
|
+
var perfMgr = mgrSource;
|
|
2249
|
+
if (perfMgr[STR_GET_PERF_MGR]) {
|
|
2250
|
+
perfMgr = perfMgr[STR_GET_PERF_MGR]();
|
|
2251
|
+
}
|
|
2252
|
+
if (perfMgr) {
|
|
2253
|
+
var perfEvt = void 0;
|
|
2254
|
+
var currentActive = perfMgr[_DYN_GET_CTX ](doPerfActiveKey);
|
|
2255
|
+
try {
|
|
2256
|
+
perfEvt = perfMgr.create(getSource(), details, isAsync);
|
|
2257
|
+
if (perfEvt) {
|
|
2258
|
+
if (currentActive && perfEvt[_DYN_SET_CTX ]) {
|
|
2259
|
+
perfEvt[_DYN_SET_CTX ](PerfEvent[strParentContextKey], currentActive);
|
|
2260
|
+
if (currentActive[_DYN_GET_CTX ] && currentActive[_DYN_SET_CTX ]) {
|
|
2261
|
+
var children = currentActive[_DYN_GET_CTX ](PerfEvent[strChildrenContextKey]);
|
|
2262
|
+
if (!children) {
|
|
2263
|
+
children = [];
|
|
2264
|
+
currentActive[_DYN_SET_CTX ](PerfEvent[strChildrenContextKey], children);
|
|
2265
|
+
}
|
|
2266
|
+
children[_DYN_PUSH ](perfEvt);
|
|
2267
|
+
}
|
|
2381
2268
|
}
|
|
2269
|
+
perfMgr[_DYN_SET_CTX ](doPerfActiveKey, perfEvt);
|
|
2270
|
+
return func(perfEvt);
|
|
2382
2271
|
}
|
|
2383
2272
|
}
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2273
|
+
catch (ex) {
|
|
2274
|
+
if (perfEvt && perfEvt[_DYN_SET_CTX ]) {
|
|
2275
|
+
perfEvt[_DYN_SET_CTX ]("exception", ex);
|
|
2276
|
+
}
|
|
2277
|
+
}
|
|
2278
|
+
finally {
|
|
2279
|
+
if (perfEvt) {
|
|
2280
|
+
perfMgr.fire(perfEvt);
|
|
2281
|
+
}
|
|
2282
|
+
perfMgr[_DYN_SET_CTX ](doPerfActiveKey, currentActive);
|
|
2283
|
+
}
|
|
2388
2284
|
}
|
|
2389
2285
|
}
|
|
2390
|
-
|
|
2391
|
-
function _callUpdate() {
|
|
2392
|
-
var hasRun = false;
|
|
2393
|
-
if (plugin) {
|
|
2394
|
-
var pluginState = _getPluginState(plugin);
|
|
2395
|
-
var pluginCore = plugin[STR_CORE] || pluginState[STR_CORE ];
|
|
2396
|
-
if (plugin && (!pluginCore || pluginCore === updateCtx.core()) && !pluginState[_DYN_TEARDOWN ]) {
|
|
2397
|
-
if (plugin[_DYN_UPDATE$1 ] && plugin[_DYN_UPDATE$1 ](updateCtx, updateState) === true) {
|
|
2398
|
-
hasRun = true;
|
|
2399
|
-
}
|
|
2400
|
-
}
|
|
2401
|
-
}
|
|
2402
|
-
return hasRun;
|
|
2403
|
-
}
|
|
2404
|
-
if (!_processChain(updateCtx, _callUpdate, "update", function () { }, false)) {
|
|
2405
|
-
updateCtx[_DYN_PROCESS_NEXT ](updateState);
|
|
2406
|
-
}
|
|
2407
|
-
}
|
|
2408
|
-
return objFreeze(proxyChain);
|
|
2286
|
+
return func();
|
|
2409
2287
|
}
|
|
2410
2288
|
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
var defaultConfig = objDeepFreeze((_a$2 = {},
|
|
2426
|
-
_a$2[STR_DOMAIN] = { fb: "cookieDomain", dfVal: isNotNullOrUndefined },
|
|
2427
|
-
_a$2.path = { fb: "cookiePath", dfVal: isNotNullOrUndefined },
|
|
2428
|
-
_a$2.enabled = UNDEFINED_VALUE,
|
|
2429
|
-
_a$2));
|
|
2430
|
-
var rootDefaultConfig = (_b = {
|
|
2431
|
-
cookieCfg: {},
|
|
2432
|
-
cookieDomain: UNDEFINED_VALUE,
|
|
2433
|
-
cookiePath: UNDEFINED_VALUE
|
|
2434
|
-
},
|
|
2435
|
-
_b[strDisableCookiesUsage] = UNDEFINED_VALUE,
|
|
2436
|
-
_b);
|
|
2437
|
-
function _gblCookieMgr(config, logger) {
|
|
2438
|
-
var inst = createCookieMgr[strConfigCookieMgr] || _globalCookieConfig[strConfigCookieMgr];
|
|
2439
|
-
if (!inst) {
|
|
2440
|
-
inst = createCookieMgr[strConfigCookieMgr] = createCookieMgr(config, logger);
|
|
2441
|
-
_globalCookieConfig[strConfigCookieMgr] = inst;
|
|
2442
|
-
}
|
|
2443
|
-
return inst;
|
|
2444
|
-
}
|
|
2445
|
-
function _isMgrEnabled(cookieMgr) {
|
|
2446
|
-
if (cookieMgr) {
|
|
2447
|
-
return cookieMgr.isEnabled();
|
|
2289
|
+
function generateW3CId() {
|
|
2290
|
+
var hexValues = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"];
|
|
2291
|
+
var oct = STR_EMPTY, tmp;
|
|
2292
|
+
for (var a = 0; a < 4; a++) {
|
|
2293
|
+
tmp = random32();
|
|
2294
|
+
oct +=
|
|
2295
|
+
hexValues[tmp & 0xF] +
|
|
2296
|
+
hexValues[tmp >> 4 & 0xF] +
|
|
2297
|
+
hexValues[tmp >> 8 & 0xF] +
|
|
2298
|
+
hexValues[tmp >> 12 & 0xF] +
|
|
2299
|
+
hexValues[tmp >> 16 & 0xF] +
|
|
2300
|
+
hexValues[tmp >> 20 & 0xF] +
|
|
2301
|
+
hexValues[tmp >> 24 & 0xF] +
|
|
2302
|
+
hexValues[tmp >> 28 & 0xF];
|
|
2448
2303
|
}
|
|
2449
|
-
|
|
2304
|
+
var clockSequenceHi = hexValues[8 + (random32() & 0x03) | 0];
|
|
2305
|
+
return strSubstr(oct, 0, 8) + strSubstr(oct, 9, 4) + "4" + strSubstr(oct, 13, 3) + clockSequenceHi + strSubstr(oct, 16, 3) + strSubstr(oct, 19, 12);
|
|
2450
2306
|
}
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2307
|
+
|
|
2308
|
+
var INVALID_TRACE_ID = "00000000000000000000000000000000";
|
|
2309
|
+
var INVALID_SPAN_ID = "0000000000000000";
|
|
2310
|
+
function _isValid(value, len, invalidValue) {
|
|
2311
|
+
if (value && value[_DYN_LENGTH$2 ] === len && value !== invalidValue) {
|
|
2312
|
+
return !!value.match(/^[\da-f]*$/i);
|
|
2454
2313
|
}
|
|
2455
2314
|
return false;
|
|
2456
2315
|
}
|
|
2457
|
-
function
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2316
|
+
function isValidTraceId(value) {
|
|
2317
|
+
return _isValid(value, 32, INVALID_TRACE_ID);
|
|
2318
|
+
}
|
|
2319
|
+
function isValidSpanId(value) {
|
|
2320
|
+
return _isValid(value, 16, INVALID_SPAN_ID);
|
|
2321
|
+
}
|
|
2322
|
+
|
|
2323
|
+
var pluginStateData = createElmNodeData("plugin");
|
|
2324
|
+
function _getPluginState(plugin) {
|
|
2325
|
+
return pluginStateData.get(plugin, "state", {}, true);
|
|
2326
|
+
}
|
|
2327
|
+
|
|
2328
|
+
var strTelemetryPluginChain = "TelemetryPluginChain";
|
|
2329
|
+
var strHasRunFlags = "_hasRun";
|
|
2330
|
+
var strGetTelCtx = "_getTelCtx";
|
|
2331
|
+
var _chainId = 0;
|
|
2332
|
+
function _getNextProxyStart(proxy, core, startAt) {
|
|
2333
|
+
while (proxy) {
|
|
2334
|
+
if (proxy[_DYN_GET_PLUGIN ]() === startAt) {
|
|
2335
|
+
return proxy;
|
|
2461
2336
|
}
|
|
2337
|
+
proxy = proxy[_DYN_GET_NEXT ]();
|
|
2462
2338
|
}
|
|
2463
|
-
return
|
|
2339
|
+
return createTelemetryProxyChain([startAt], core.config || {}, core);
|
|
2464
2340
|
}
|
|
2465
|
-
function
|
|
2466
|
-
var
|
|
2467
|
-
|
|
2468
|
-
|
|
2341
|
+
function _createInternalContext(telemetryChain, dynamicHandler, core, startAt) {
|
|
2342
|
+
var _nextProxy = null;
|
|
2343
|
+
var _onComplete = [];
|
|
2344
|
+
if (!dynamicHandler) {
|
|
2345
|
+
dynamicHandler = createDynamicConfig({}, null, core[_DYN_LOGGER ]);
|
|
2469
2346
|
}
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2347
|
+
if (startAt !== null) {
|
|
2348
|
+
_nextProxy = startAt ? _getNextProxyStart(telemetryChain, core, startAt) : telemetryChain;
|
|
2349
|
+
}
|
|
2350
|
+
var context = {
|
|
2351
|
+
_next: _moveNext,
|
|
2352
|
+
ctx: {
|
|
2353
|
+
core: function () {
|
|
2354
|
+
return core;
|
|
2355
|
+
},
|
|
2356
|
+
diagLog: function () {
|
|
2357
|
+
return safeGetLogger(core, dynamicHandler.cfg);
|
|
2358
|
+
},
|
|
2359
|
+
getCfg: function () {
|
|
2360
|
+
return dynamicHandler.cfg;
|
|
2361
|
+
},
|
|
2362
|
+
getExtCfg: _resolveExtCfg,
|
|
2363
|
+
getConfig: _getConfig,
|
|
2364
|
+
hasNext: function () {
|
|
2365
|
+
return !!_nextProxy;
|
|
2366
|
+
},
|
|
2367
|
+
getNext: function () {
|
|
2368
|
+
return _nextProxy;
|
|
2369
|
+
},
|
|
2370
|
+
setNext: function (nextPlugin) {
|
|
2371
|
+
_nextProxy = nextPlugin;
|
|
2372
|
+
},
|
|
2373
|
+
iterate: _iterateChain,
|
|
2374
|
+
onComplete: _addOnComplete
|
|
2474
2375
|
}
|
|
2475
|
-
|
|
2476
|
-
|
|
2376
|
+
};
|
|
2377
|
+
function _addOnComplete(onComplete, that) {
|
|
2378
|
+
var args = [];
|
|
2379
|
+
for (var _i = 2; _i < arguments.length; _i++) {
|
|
2380
|
+
args[_i - 2] = arguments[_i];
|
|
2477
2381
|
}
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
function createCookieMgr(rootConfig, logger) {
|
|
2485
|
-
var cookieMgrConfig;
|
|
2486
|
-
var _path;
|
|
2487
|
-
var _domain;
|
|
2488
|
-
var _enabled;
|
|
2489
|
-
var _getCookieFn;
|
|
2490
|
-
var _setCookieFn;
|
|
2491
|
-
var _delCookieFn;
|
|
2492
|
-
rootConfig = createDynamicConfig(rootConfig || _globalCookieConfig, null, logger).cfg;
|
|
2493
|
-
onConfigChange(rootConfig, function (details) {
|
|
2494
|
-
details[_DYN_SET_DF ](details.cfg, rootDefaultConfig);
|
|
2495
|
-
cookieMgrConfig = details[_DYN_SET_DF ](details.cfg.cookieCfg, defaultConfig);
|
|
2496
|
-
var isEnabled = cookieMgrConfig.enabled;
|
|
2497
|
-
if (isNullOrUndefined(isEnabled)) {
|
|
2498
|
-
var cookieEnabled = void 0;
|
|
2499
|
-
if (!isUndefined(rootConfig[strIsCookieUseDisabled])) {
|
|
2500
|
-
cookieEnabled = !rootConfig[strIsCookieUseDisabled];
|
|
2501
|
-
}
|
|
2502
|
-
if (!isUndefined(rootConfig[strDisableCookiesUsage])) {
|
|
2503
|
-
cookieEnabled = !rootConfig[strDisableCookiesUsage];
|
|
2504
|
-
}
|
|
2505
|
-
isEnabled = cookieEnabled;
|
|
2382
|
+
if (onComplete) {
|
|
2383
|
+
_onComplete[_DYN_PUSH ]({
|
|
2384
|
+
func: onComplete,
|
|
2385
|
+
self: !isUndefined(that) ? that : context.ctx,
|
|
2386
|
+
args: args
|
|
2387
|
+
});
|
|
2506
2388
|
}
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
var gblManager = _globalCookieConfig[strConfigCookieMgr];
|
|
2518
|
-
if (enabled && gblManager && cookieMgr !== gblManager) {
|
|
2519
|
-
enabled = _isMgrEnabled(gblManager);
|
|
2520
|
-
}
|
|
2521
|
-
return enabled;
|
|
2522
|
-
},
|
|
2523
|
-
setEnabled: function (value) {
|
|
2524
|
-
_enabled = value !== false;
|
|
2525
|
-
},
|
|
2526
|
-
set: function (name, value, maxAgeSec, domain, path) {
|
|
2527
|
-
var result = false;
|
|
2528
|
-
if (_isMgrEnabled(cookieMgr) && !_isBlockedCookie(cookieMgrConfig, name)) {
|
|
2529
|
-
var values = {};
|
|
2530
|
-
var theValue = strTrim(value || STR_EMPTY);
|
|
2531
|
-
var idx = strIndexOf(theValue, ";");
|
|
2532
|
-
if (idx !== -1) {
|
|
2533
|
-
theValue = strTrim(strLeft(value, idx));
|
|
2534
|
-
values = _extractParts(strSubstring(value, idx + 1));
|
|
2535
|
-
}
|
|
2536
|
-
setValue(values, STR_DOMAIN, domain || _domain, isTruthy, isUndefined);
|
|
2537
|
-
if (!isNullOrUndefined(maxAgeSec)) {
|
|
2538
|
-
var _isIE = isIE();
|
|
2539
|
-
if (isUndefined(values[strExpires])) {
|
|
2540
|
-
var nowMs = utcNow();
|
|
2541
|
-
var expireMs = nowMs + (maxAgeSec * 1000);
|
|
2542
|
-
if (expireMs > 0) {
|
|
2543
|
-
var expiry = new Date();
|
|
2544
|
-
expiry.setTime(expireMs);
|
|
2545
|
-
setValue(values, strExpires, _formatDate(expiry, !_isIE ? strToUTCString : strToGMTString) || _formatDate(expiry, _isIE ? strToGMTString : strToUTCString) || STR_EMPTY, isTruthy);
|
|
2546
|
-
}
|
|
2547
|
-
}
|
|
2548
|
-
if (!_isIE) {
|
|
2549
|
-
setValue(values, "max-age", STR_EMPTY + maxAgeSec, null, isUndefined);
|
|
2550
|
-
}
|
|
2551
|
-
}
|
|
2552
|
-
var location_1 = getLocation();
|
|
2553
|
-
if (location_1 && location_1.protocol === "https:") {
|
|
2554
|
-
setValue(values, "secure", null, null, isUndefined);
|
|
2555
|
-
if (_allowUaSameSite === null) {
|
|
2556
|
-
_allowUaSameSite = !uaDisallowsSameSiteNone((getNavigator() || {})[_DYN_USER_AGENT ]);
|
|
2389
|
+
}
|
|
2390
|
+
function _moveNext() {
|
|
2391
|
+
var nextProxy = _nextProxy;
|
|
2392
|
+
_nextProxy = nextProxy ? nextProxy[_DYN_GET_NEXT ]() : null;
|
|
2393
|
+
if (!nextProxy) {
|
|
2394
|
+
var onComplete = _onComplete;
|
|
2395
|
+
if (onComplete && onComplete[_DYN_LENGTH$2 ] > 0) {
|
|
2396
|
+
arrForEach(onComplete, function (completeDetails) {
|
|
2397
|
+
try {
|
|
2398
|
+
completeDetails.func[_DYN_CALL ](completeDetails.self, completeDetails.args);
|
|
2557
2399
|
}
|
|
2558
|
-
|
|
2559
|
-
|
|
2400
|
+
catch (e) {
|
|
2401
|
+
_throwInternal(core[_DYN_LOGGER ], 2 , 73 , "Unexpected Exception during onComplete - " + dumpObj(e));
|
|
2560
2402
|
}
|
|
2561
|
-
}
|
|
2562
|
-
|
|
2563
|
-
_setCookieFn(name, _formatCookieValue(theValue, values));
|
|
2564
|
-
result = true;
|
|
2403
|
+
});
|
|
2404
|
+
_onComplete = [];
|
|
2565
2405
|
}
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2406
|
+
}
|
|
2407
|
+
return nextProxy;
|
|
2408
|
+
}
|
|
2409
|
+
function _getExtCfg(identifier, createIfMissing) {
|
|
2410
|
+
var idCfg = null;
|
|
2411
|
+
var cfg = dynamicHandler.cfg;
|
|
2412
|
+
if (cfg && identifier) {
|
|
2413
|
+
var extCfg = cfg[STR_EXTENSION_CONFIG ];
|
|
2414
|
+
if (!extCfg && createIfMissing) {
|
|
2415
|
+
extCfg = {};
|
|
2572
2416
|
}
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2417
|
+
dynamicHandler.set(cfg, STR_EXTENSION_CONFIG, extCfg);
|
|
2418
|
+
extCfg = cfg[STR_EXTENSION_CONFIG ];
|
|
2419
|
+
if (extCfg) {
|
|
2420
|
+
idCfg = extCfg[identifier];
|
|
2421
|
+
if (!idCfg && createIfMissing) {
|
|
2422
|
+
idCfg = {};
|
|
2423
|
+
}
|
|
2424
|
+
dynamicHandler.set(extCfg, identifier, idCfg);
|
|
2425
|
+
idCfg = extCfg[identifier];
|
|
2579
2426
|
}
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2427
|
+
}
|
|
2428
|
+
return idCfg;
|
|
2429
|
+
}
|
|
2430
|
+
function _resolveExtCfg(identifier, defaultValues) {
|
|
2431
|
+
var newConfig = _getExtCfg(identifier, true);
|
|
2432
|
+
if (defaultValues) {
|
|
2433
|
+
objForEachKey(defaultValues, function (field, defaultValue) {
|
|
2434
|
+
if (isNullOrUndefined(newConfig[field])) {
|
|
2435
|
+
var cfgValue = dynamicHandler.cfg[field];
|
|
2436
|
+
if (cfgValue || !isNullOrUndefined(cfgValue)) {
|
|
2437
|
+
newConfig[field] = cfgValue;
|
|
2438
|
+
}
|
|
2592
2439
|
}
|
|
2593
|
-
|
|
2594
|
-
|
|
2440
|
+
_applyDefaultValue(dynamicHandler, newConfig, field, defaultValue);
|
|
2441
|
+
});
|
|
2442
|
+
}
|
|
2443
|
+
return dynamicHandler[_DYN_SET_DF ](newConfig, defaultValues);
|
|
2444
|
+
}
|
|
2445
|
+
function _getConfig(identifier, field, defaultValue) {
|
|
2446
|
+
if (defaultValue === void 0) { defaultValue = false; }
|
|
2447
|
+
var theValue;
|
|
2448
|
+
var extConfig = _getExtCfg(identifier, false);
|
|
2449
|
+
var rootConfig = dynamicHandler.cfg;
|
|
2450
|
+
if (extConfig && (extConfig[field] || !isNullOrUndefined(extConfig[field]))) {
|
|
2451
|
+
theValue = extConfig[field];
|
|
2452
|
+
}
|
|
2453
|
+
else if (rootConfig[field] || !isNullOrUndefined(rootConfig[field])) {
|
|
2454
|
+
theValue = rootConfig[field];
|
|
2455
|
+
}
|
|
2456
|
+
return (theValue || !isNullOrUndefined(theValue)) ? theValue : defaultValue;
|
|
2457
|
+
}
|
|
2458
|
+
function _iterateChain(cb) {
|
|
2459
|
+
var nextPlugin;
|
|
2460
|
+
while (!!(nextPlugin = context._next())) {
|
|
2461
|
+
var plugin = nextPlugin[_DYN_GET_PLUGIN ]();
|
|
2462
|
+
if (plugin) {
|
|
2463
|
+
cb(plugin);
|
|
2595
2464
|
}
|
|
2596
|
-
return result;
|
|
2597
2465
|
}
|
|
2598
|
-
}
|
|
2599
|
-
|
|
2600
|
-
|
|
2466
|
+
}
|
|
2467
|
+
return context;
|
|
2468
|
+
}
|
|
2469
|
+
function createProcessTelemetryContext(telemetryChain, cfg, core, startAt) {
|
|
2470
|
+
var config = createDynamicConfig(cfg);
|
|
2471
|
+
var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
|
|
2472
|
+
var context = internalContext.ctx;
|
|
2473
|
+
function _processNext(env) {
|
|
2474
|
+
var nextPlugin = internalContext._next();
|
|
2475
|
+
if (nextPlugin) {
|
|
2476
|
+
nextPlugin[STR_PROCESS_TELEMETRY ](env, context);
|
|
2477
|
+
}
|
|
2478
|
+
return !nextPlugin;
|
|
2479
|
+
}
|
|
2480
|
+
function _createNew(plugins, startAt) {
|
|
2481
|
+
if (plugins === void 0) { plugins = null; }
|
|
2482
|
+
if (isArray(plugins)) {
|
|
2483
|
+
plugins = createTelemetryProxyChain(plugins, config.cfg, core, startAt);
|
|
2484
|
+
}
|
|
2485
|
+
return createProcessTelemetryContext(plugins || context[_DYN_GET_NEXT ](), config.cfg, core, startAt);
|
|
2486
|
+
}
|
|
2487
|
+
context[_DYN_PROCESS_NEXT ] = _processNext;
|
|
2488
|
+
context[_DYN_CREATE_NEW ] = _createNew;
|
|
2489
|
+
return context;
|
|
2601
2490
|
}
|
|
2602
|
-
function
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2491
|
+
function createProcessTelemetryUnloadContext(telemetryChain, core, startAt) {
|
|
2492
|
+
var config = createDynamicConfig(core.config);
|
|
2493
|
+
var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
|
|
2494
|
+
var context = internalContext.ctx;
|
|
2495
|
+
function _processNext(unloadState) {
|
|
2496
|
+
var nextPlugin = internalContext._next();
|
|
2497
|
+
nextPlugin && nextPlugin.unload(context, unloadState);
|
|
2498
|
+
return !nextPlugin;
|
|
2499
|
+
}
|
|
2500
|
+
function _createNew(plugins, startAt) {
|
|
2501
|
+
if (plugins === void 0) { plugins = null; }
|
|
2502
|
+
if (isArray(plugins)) {
|
|
2503
|
+
plugins = createTelemetryProxyChain(plugins, config.cfg, core, startAt);
|
|
2611
2504
|
}
|
|
2505
|
+
return createProcessTelemetryUnloadContext(plugins || context[_DYN_GET_NEXT ](), core, startAt);
|
|
2612
2506
|
}
|
|
2613
|
-
|
|
2507
|
+
context[_DYN_PROCESS_NEXT ] = _processNext;
|
|
2508
|
+
context[_DYN_CREATE_NEW ] = _createNew;
|
|
2509
|
+
return context;
|
|
2614
2510
|
}
|
|
2615
|
-
function
|
|
2616
|
-
var
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
if (
|
|
2622
|
-
|
|
2623
|
-
if (idx === -1) {
|
|
2624
|
-
values[thePart] = null;
|
|
2625
|
-
}
|
|
2626
|
-
else {
|
|
2627
|
-
values[strTrim(strLeft(thePart, idx))] = strTrim(strSubstring(thePart, idx + 1));
|
|
2628
|
-
}
|
|
2511
|
+
function createProcessTelemetryUpdateContext(telemetryChain, core, startAt) {
|
|
2512
|
+
var config = createDynamicConfig(core.config);
|
|
2513
|
+
var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
|
|
2514
|
+
var context = internalContext.ctx;
|
|
2515
|
+
function _processNext(updateState) {
|
|
2516
|
+
return context.iterate(function (plugin) {
|
|
2517
|
+
if (isFunction(plugin[_DYN_UPDATE$1 ])) {
|
|
2518
|
+
plugin[_DYN_UPDATE$1 ](context, updateState);
|
|
2629
2519
|
}
|
|
2630
2520
|
});
|
|
2631
2521
|
}
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
return theDate[func]();
|
|
2637
|
-
}
|
|
2638
|
-
return null;
|
|
2639
|
-
}
|
|
2640
|
-
function _formatCookieValue(value, values) {
|
|
2641
|
-
var cookieValue = value || STR_EMPTY;
|
|
2642
|
-
objForEachKey(values, function (name, theValue) {
|
|
2643
|
-
cookieValue += "; " + name + (!isNullOrUndefined(theValue) ? "=" + theValue : STR_EMPTY);
|
|
2644
|
-
});
|
|
2645
|
-
return cookieValue;
|
|
2646
|
-
}
|
|
2647
|
-
function _getCookieValue(name) {
|
|
2648
|
-
var cookieValue = STR_EMPTY;
|
|
2649
|
-
if (_doc) {
|
|
2650
|
-
var theCookie = _doc[strCookie] || STR_EMPTY;
|
|
2651
|
-
if (_parsedCookieValue !== theCookie) {
|
|
2652
|
-
_cookieCache = _extractParts(theCookie);
|
|
2653
|
-
_parsedCookieValue = theCookie;
|
|
2522
|
+
function _createNew(plugins, startAt) {
|
|
2523
|
+
if (plugins === void 0) { plugins = null; }
|
|
2524
|
+
if (isArray(plugins)) {
|
|
2525
|
+
plugins = createTelemetryProxyChain(plugins, config.cfg, core, startAt);
|
|
2654
2526
|
}
|
|
2655
|
-
|
|
2527
|
+
return createProcessTelemetryUpdateContext(plugins || context[_DYN_GET_NEXT ](), core, startAt);
|
|
2656
2528
|
}
|
|
2657
|
-
|
|
2529
|
+
context[_DYN_PROCESS_NEXT ] = _processNext;
|
|
2530
|
+
context[_DYN_CREATE_NEW ] = _createNew;
|
|
2531
|
+
return context;
|
|
2658
2532
|
}
|
|
2659
|
-
function
|
|
2660
|
-
|
|
2661
|
-
|
|
2533
|
+
function createTelemetryProxyChain(plugins, config, core, startAt) {
|
|
2534
|
+
var firstProxy = null;
|
|
2535
|
+
var add = startAt ? false : true;
|
|
2536
|
+
if (isArray(plugins) && plugins[_DYN_LENGTH$2 ] > 0) {
|
|
2537
|
+
var lastProxy_1 = null;
|
|
2538
|
+
arrForEach(plugins, function (thePlugin) {
|
|
2539
|
+
if (!add && startAt === thePlugin) {
|
|
2540
|
+
add = true;
|
|
2541
|
+
}
|
|
2542
|
+
if (add && thePlugin && isFunction(thePlugin[STR_PROCESS_TELEMETRY ])) {
|
|
2543
|
+
var newProxy = createTelemetryPluginProxy(thePlugin, config, core);
|
|
2544
|
+
if (!firstProxy) {
|
|
2545
|
+
firstProxy = newProxy;
|
|
2546
|
+
}
|
|
2547
|
+
if (lastProxy_1) {
|
|
2548
|
+
lastProxy_1._setNext(newProxy);
|
|
2549
|
+
}
|
|
2550
|
+
lastProxy_1 = newProxy;
|
|
2551
|
+
}
|
|
2552
|
+
});
|
|
2662
2553
|
}
|
|
2554
|
+
if (startAt && !firstProxy) {
|
|
2555
|
+
return createTelemetryProxyChain([startAt], config, core);
|
|
2556
|
+
}
|
|
2557
|
+
return firstProxy;
|
|
2663
2558
|
}
|
|
2664
|
-
function
|
|
2665
|
-
|
|
2666
|
-
|
|
2559
|
+
function createTelemetryPluginProxy(plugin, config, core) {
|
|
2560
|
+
var nextProxy = null;
|
|
2561
|
+
var hasProcessTelemetry = isFunction(plugin[STR_PROCESS_TELEMETRY ]);
|
|
2562
|
+
var hasSetNext = isFunction(plugin[_DYN_SET_NEXT_PLUGIN ]);
|
|
2563
|
+
var chainId;
|
|
2564
|
+
if (plugin) {
|
|
2565
|
+
chainId = plugin[_DYN_IDENTIFIER ] + "-" + plugin[STR_PRIORITY ] + "-" + _chainId++;
|
|
2667
2566
|
}
|
|
2668
|
-
|
|
2669
|
-
|
|
2567
|
+
else {
|
|
2568
|
+
chainId = "Unknown-0-" + _chainId++;
|
|
2670
2569
|
}
|
|
2671
|
-
|
|
2672
|
-
|
|
2570
|
+
var proxyChain = {
|
|
2571
|
+
getPlugin: function () {
|
|
2572
|
+
return plugin;
|
|
2573
|
+
},
|
|
2574
|
+
getNext: function () {
|
|
2575
|
+
return nextProxy;
|
|
2576
|
+
},
|
|
2577
|
+
processTelemetry: _processTelemetry,
|
|
2578
|
+
unload: _unloadPlugin,
|
|
2579
|
+
update: _updatePlugin,
|
|
2580
|
+
_id: chainId,
|
|
2581
|
+
_setNext: function (nextPlugin) {
|
|
2582
|
+
nextProxy = nextPlugin;
|
|
2583
|
+
}
|
|
2584
|
+
};
|
|
2585
|
+
function _getTelCtx() {
|
|
2586
|
+
var itemCtx;
|
|
2587
|
+
if (plugin && isFunction(plugin[strGetTelCtx])) {
|
|
2588
|
+
itemCtx = plugin[strGetTelCtx]();
|
|
2589
|
+
}
|
|
2590
|
+
if (!itemCtx) {
|
|
2591
|
+
itemCtx = createProcessTelemetryContext(proxyChain, config, core);
|
|
2592
|
+
}
|
|
2593
|
+
return itemCtx;
|
|
2673
2594
|
}
|
|
2674
|
-
|
|
2675
|
-
|
|
2595
|
+
function _processChain(itemCtx, processPluginFn, name, details, isAsync) {
|
|
2596
|
+
var hasRun = false;
|
|
2597
|
+
var identifier = plugin ? plugin[_DYN_IDENTIFIER ] : strTelemetryPluginChain;
|
|
2598
|
+
var hasRunContext = itemCtx[strHasRunFlags];
|
|
2599
|
+
if (!hasRunContext) {
|
|
2600
|
+
hasRunContext = itemCtx[strHasRunFlags] = {};
|
|
2601
|
+
}
|
|
2602
|
+
itemCtx.setNext(nextProxy);
|
|
2603
|
+
if (plugin) {
|
|
2604
|
+
doPerf(itemCtx[STR_CORE ](), function () { return identifier + ":" + name; }, function () {
|
|
2605
|
+
hasRunContext[chainId] = true;
|
|
2606
|
+
try {
|
|
2607
|
+
var nextId = nextProxy ? nextProxy._id : STR_EMPTY;
|
|
2608
|
+
if (nextId) {
|
|
2609
|
+
hasRunContext[nextId] = false;
|
|
2610
|
+
}
|
|
2611
|
+
hasRun = processPluginFn(itemCtx);
|
|
2612
|
+
}
|
|
2613
|
+
catch (error) {
|
|
2614
|
+
var hasNextRun = nextProxy ? hasRunContext[nextProxy._id] : true;
|
|
2615
|
+
if (hasNextRun) {
|
|
2616
|
+
hasRun = true;
|
|
2617
|
+
}
|
|
2618
|
+
if (!nextProxy || !hasNextRun) {
|
|
2619
|
+
_throwInternal(itemCtx[_DYN_DIAG_LOG ](), 1 , 73 , "Plugin [" + identifier + "] failed during " + name + " - " + dumpObj(error) + ", run flags: " + dumpObj(hasRunContext));
|
|
2620
|
+
}
|
|
2621
|
+
}
|
|
2622
|
+
}, details, isAsync);
|
|
2623
|
+
}
|
|
2624
|
+
return hasRun;
|
|
2676
2625
|
}
|
|
2677
|
-
|
|
2678
|
-
|
|
2626
|
+
function _processTelemetry(env, itemCtx) {
|
|
2627
|
+
itemCtx = itemCtx || _getTelCtx();
|
|
2628
|
+
function _callProcessTelemetry(itemCtx) {
|
|
2629
|
+
if (!plugin || !hasProcessTelemetry) {
|
|
2630
|
+
return false;
|
|
2631
|
+
}
|
|
2632
|
+
var pluginState = _getPluginState(plugin);
|
|
2633
|
+
if (pluginState[_DYN_TEARDOWN ] || pluginState[STR_DISABLED]) {
|
|
2634
|
+
return false;
|
|
2635
|
+
}
|
|
2636
|
+
if (hasSetNext) {
|
|
2637
|
+
plugin[_DYN_SET_NEXT_PLUGIN ](nextProxy);
|
|
2638
|
+
}
|
|
2639
|
+
plugin[STR_PROCESS_TELEMETRY ](env, itemCtx);
|
|
2640
|
+
return true;
|
|
2641
|
+
}
|
|
2642
|
+
if (!_processChain(itemCtx, _callProcessTelemetry, "processTelemetry", function () { return ({ item: env }); }, !(env.sync))) {
|
|
2643
|
+
itemCtx[_DYN_PROCESS_NEXT ](env);
|
|
2644
|
+
}
|
|
2679
2645
|
}
|
|
2680
|
-
|
|
2681
|
-
|
|
2646
|
+
function _unloadPlugin(unloadCtx, unloadState) {
|
|
2647
|
+
function _callTeardown() {
|
|
2648
|
+
var hasRun = false;
|
|
2649
|
+
if (plugin) {
|
|
2650
|
+
var pluginState = _getPluginState(plugin);
|
|
2651
|
+
var pluginCore = plugin[STR_CORE] || pluginState[STR_CORE ];
|
|
2652
|
+
if (plugin && (!pluginCore || pluginCore === unloadCtx.core()) && !pluginState[_DYN_TEARDOWN ]) {
|
|
2653
|
+
pluginState[STR_CORE ] = null;
|
|
2654
|
+
pluginState[_DYN_TEARDOWN ] = true;
|
|
2655
|
+
pluginState[_DYN_IS_INITIALIZED ] = false;
|
|
2656
|
+
if (plugin[_DYN_TEARDOWN ] && plugin[_DYN_TEARDOWN ](unloadCtx, unloadState) === true) {
|
|
2657
|
+
hasRun = true;
|
|
2658
|
+
}
|
|
2659
|
+
}
|
|
2660
|
+
}
|
|
2661
|
+
return hasRun;
|
|
2662
|
+
}
|
|
2663
|
+
if (!_processChain(unloadCtx, _callTeardown, "unload", function () { }, unloadState[_DYN_IS_ASYNC ])) {
|
|
2664
|
+
unloadCtx[_DYN_PROCESS_NEXT ](unloadState);
|
|
2665
|
+
}
|
|
2682
2666
|
}
|
|
2683
|
-
|
|
2684
|
-
|
|
2667
|
+
function _updatePlugin(updateCtx, updateState) {
|
|
2668
|
+
function _callUpdate() {
|
|
2669
|
+
var hasRun = false;
|
|
2670
|
+
if (plugin) {
|
|
2671
|
+
var pluginState = _getPluginState(plugin);
|
|
2672
|
+
var pluginCore = plugin[STR_CORE] || pluginState[STR_CORE ];
|
|
2673
|
+
if (plugin && (!pluginCore || pluginCore === updateCtx.core()) && !pluginState[_DYN_TEARDOWN ]) {
|
|
2674
|
+
if (plugin[_DYN_UPDATE$1 ] && plugin[_DYN_UPDATE$1 ](updateCtx, updateState) === true) {
|
|
2675
|
+
hasRun = true;
|
|
2676
|
+
}
|
|
2677
|
+
}
|
|
2678
|
+
}
|
|
2679
|
+
return hasRun;
|
|
2680
|
+
}
|
|
2681
|
+
if (!_processChain(updateCtx, _callUpdate, "update", function () { }, false)) {
|
|
2682
|
+
updateCtx[_DYN_PROCESS_NEXT ](updateState);
|
|
2683
|
+
}
|
|
2685
2684
|
}
|
|
2686
|
-
return
|
|
2685
|
+
return objFreeze(proxyChain);
|
|
2687
2686
|
}
|
|
2688
2687
|
|
|
2689
2688
|
function createUnloadHandlerContainer() {
|