@microsoft/applicationinsights-dependencies-js 2.8.0-nightly.2204-04 → 2.8.0-nightly.2204-07
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-dependencies-js.integrity.json +9 -9
- package/browser/applicationinsights-dependencies-js.js +539 -605
- package/browser/applicationinsights-dependencies-js.js.map +1 -1
- package/browser/applicationinsights-dependencies-js.min.js +2 -2
- package/browser/applicationinsights-dependencies-js.min.js.map +1 -1
- package/dist/applicationinsights-dependencies-js.d.ts +1 -1
- package/dist/applicationinsights-dependencies-js.js +539 -605
- package/dist/applicationinsights-dependencies-js.js.map +1 -1
- package/dist/applicationinsights-dependencies-js.min.js +2 -2
- package/dist/applicationinsights-dependencies-js.min.js.map +1 -1
- package/dist/applicationinsights-dependencies-js.rollup.d.ts +1 -1
- package/dist-esm/ajax.js +39 -41
- package/dist-esm/ajax.js.map +1 -1
- package/dist-esm/ajaxRecord.js +1 -1
- package/dist-esm/ajaxUtils.js +1 -1
- package/dist-esm/applicationinsights-dependencies-js.js +1 -1
- package/package.json +3 -3
- package/src/ajax.ts +45 -46
- package/dist-esm/TraceParent.js +0 -39
- package/dist-esm/TraceParent.js.map +0 -1
- package/src/TraceParent.ts +0 -40
- package/types/TraceParent.d.ts +0 -12
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Application Insights JavaScript SDK - Dependencies Plugin, 2.8.0-nightly.2204-
|
|
2
|
+
* Application Insights JavaScript SDK - Dependencies Plugin, 2.8.0-nightly.2204-07
|
|
3
3
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
4
|
*/
|
|
5
5
|
(function (global, factory) {
|
|
@@ -98,247 +98,6 @@
|
|
|
98
98
|
d[strShimPrototype] = b === null ? objCreateFn(b) : (__[strShimPrototype] = b[strShimPrototype], new __());
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
-
/*!
|
|
102
|
-
* Microsoft Dynamic Proto Utility, 1.1.4
|
|
103
|
-
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
104
|
-
*/
|
|
105
|
-
var Constructor = 'constructor';
|
|
106
|
-
var Prototype = 'prototype';
|
|
107
|
-
var strFunction = 'function';
|
|
108
|
-
var DynInstFuncTable = '_dynInstFuncs';
|
|
109
|
-
var DynProxyTag = '_isDynProxy';
|
|
110
|
-
var DynClassName = '_dynClass';
|
|
111
|
-
var DynClassNamePrefix = '_dynCls$';
|
|
112
|
-
var DynInstChkTag = '_dynInstChk';
|
|
113
|
-
var DynAllowInstChkTag = DynInstChkTag;
|
|
114
|
-
var DynProtoDefaultOptions = '_dfOpts';
|
|
115
|
-
var UnknownValue = '_unknown_';
|
|
116
|
-
var str__Proto$1 = "__proto__";
|
|
117
|
-
var strUseBaseInst = 'useBaseInst';
|
|
118
|
-
var strSetInstFuncs = 'setInstFuncs';
|
|
119
|
-
var Obj = Object;
|
|
120
|
-
var _objGetPrototypeOf$1 = Obj["getPrototypeOf"];
|
|
121
|
-
var _dynamicNames = 0;
|
|
122
|
-
function _hasOwnProperty(obj, prop) {
|
|
123
|
-
return obj && Obj[Prototype].hasOwnProperty.call(obj, prop);
|
|
124
|
-
}
|
|
125
|
-
function _isObjectOrArrayPrototype(target) {
|
|
126
|
-
return target && (target === Obj[Prototype] || target === Array[Prototype]);
|
|
127
|
-
}
|
|
128
|
-
function _isObjectArrayOrFunctionPrototype(target) {
|
|
129
|
-
return _isObjectOrArrayPrototype(target) || target === Function[Prototype];
|
|
130
|
-
}
|
|
131
|
-
function _getObjProto$1(target) {
|
|
132
|
-
if (target) {
|
|
133
|
-
if (_objGetPrototypeOf$1) {
|
|
134
|
-
return _objGetPrototypeOf$1(target);
|
|
135
|
-
}
|
|
136
|
-
var newProto = target[str__Proto$1] || target[Prototype] || (target[Constructor] ? target[Constructor][Prototype] : null);
|
|
137
|
-
if (newProto) {
|
|
138
|
-
return newProto;
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
return null;
|
|
142
|
-
}
|
|
143
|
-
function _forEachProp(target, func) {
|
|
144
|
-
var props = [];
|
|
145
|
-
var getOwnProps = Obj["getOwnPropertyNames"];
|
|
146
|
-
if (getOwnProps) {
|
|
147
|
-
props = getOwnProps(target);
|
|
148
|
-
}
|
|
149
|
-
else {
|
|
150
|
-
for (var name_1 in target) {
|
|
151
|
-
if (typeof name_1 === "string" && _hasOwnProperty(target, name_1)) {
|
|
152
|
-
props.push(name_1);
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
if (props && props.length > 0) {
|
|
157
|
-
for (var lp = 0; lp < props.length; lp++) {
|
|
158
|
-
func(props[lp]);
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
function _isDynamicCandidate(target, funcName, skipOwn) {
|
|
163
|
-
return (funcName !== Constructor && typeof target[funcName] === strFunction && (skipOwn || _hasOwnProperty(target, funcName)));
|
|
164
|
-
}
|
|
165
|
-
function _throwTypeError(message) {
|
|
166
|
-
throw new TypeError("DynamicProto: " + message);
|
|
167
|
-
}
|
|
168
|
-
function _getInstanceFuncs(thisTarget) {
|
|
169
|
-
var instFuncs = {};
|
|
170
|
-
_forEachProp(thisTarget, function (name) {
|
|
171
|
-
if (!instFuncs[name] && _isDynamicCandidate(thisTarget, name, false)) {
|
|
172
|
-
instFuncs[name] = thisTarget[name];
|
|
173
|
-
}
|
|
174
|
-
});
|
|
175
|
-
return instFuncs;
|
|
176
|
-
}
|
|
177
|
-
function _hasVisited(values, value) {
|
|
178
|
-
for (var lp = values.length - 1; lp >= 0; lp--) {
|
|
179
|
-
if (values[lp] === value) {
|
|
180
|
-
return true;
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
return false;
|
|
184
|
-
}
|
|
185
|
-
function _getBaseFuncs(classProto, thisTarget, instFuncs, useBaseInst) {
|
|
186
|
-
function _instFuncProxy(target, funcHost, funcName) {
|
|
187
|
-
var theFunc = funcHost[funcName];
|
|
188
|
-
if (theFunc[DynProxyTag] && useBaseInst) {
|
|
189
|
-
var instFuncTable = target[DynInstFuncTable] || {};
|
|
190
|
-
if (instFuncTable[DynAllowInstChkTag] !== false) {
|
|
191
|
-
theFunc = (instFuncTable[funcHost[DynClassName]] || {})[funcName] || theFunc;
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
return function () {
|
|
195
|
-
return theFunc.apply(target, arguments);
|
|
196
|
-
};
|
|
197
|
-
}
|
|
198
|
-
var baseFuncs = {};
|
|
199
|
-
_forEachProp(instFuncs, function (name) {
|
|
200
|
-
baseFuncs[name] = _instFuncProxy(thisTarget, instFuncs, name);
|
|
201
|
-
});
|
|
202
|
-
var baseProto = _getObjProto$1(classProto);
|
|
203
|
-
var visited = [];
|
|
204
|
-
while (baseProto && !_isObjectArrayOrFunctionPrototype(baseProto) && !_hasVisited(visited, baseProto)) {
|
|
205
|
-
_forEachProp(baseProto, function (name) {
|
|
206
|
-
if (!baseFuncs[name] && _isDynamicCandidate(baseProto, name, !_objGetPrototypeOf$1)) {
|
|
207
|
-
baseFuncs[name] = _instFuncProxy(thisTarget, baseProto, name);
|
|
208
|
-
}
|
|
209
|
-
});
|
|
210
|
-
visited.push(baseProto);
|
|
211
|
-
baseProto = _getObjProto$1(baseProto);
|
|
212
|
-
}
|
|
213
|
-
return baseFuncs;
|
|
214
|
-
}
|
|
215
|
-
function _getInstFunc(target, funcName, proto, currentDynProtoProxy) {
|
|
216
|
-
var instFunc = null;
|
|
217
|
-
if (target && _hasOwnProperty(proto, DynClassName)) {
|
|
218
|
-
var instFuncTable = target[DynInstFuncTable] || {};
|
|
219
|
-
instFunc = (instFuncTable[proto[DynClassName]] || {})[funcName];
|
|
220
|
-
if (!instFunc) {
|
|
221
|
-
_throwTypeError("Missing [" + funcName + "] " + strFunction);
|
|
222
|
-
}
|
|
223
|
-
if (!instFunc[DynInstChkTag] && instFuncTable[DynAllowInstChkTag] !== false) {
|
|
224
|
-
var canAddInst = !_hasOwnProperty(target, funcName);
|
|
225
|
-
var objProto = _getObjProto$1(target);
|
|
226
|
-
var visited = [];
|
|
227
|
-
while (canAddInst && objProto && !_isObjectArrayOrFunctionPrototype(objProto) && !_hasVisited(visited, objProto)) {
|
|
228
|
-
var protoFunc = objProto[funcName];
|
|
229
|
-
if (protoFunc) {
|
|
230
|
-
canAddInst = (protoFunc === currentDynProtoProxy);
|
|
231
|
-
break;
|
|
232
|
-
}
|
|
233
|
-
visited.push(objProto);
|
|
234
|
-
objProto = _getObjProto$1(objProto);
|
|
235
|
-
}
|
|
236
|
-
try {
|
|
237
|
-
if (canAddInst) {
|
|
238
|
-
target[funcName] = instFunc;
|
|
239
|
-
}
|
|
240
|
-
instFunc[DynInstChkTag] = 1;
|
|
241
|
-
}
|
|
242
|
-
catch (e) {
|
|
243
|
-
instFuncTable[DynAllowInstChkTag] = false;
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
return instFunc;
|
|
248
|
-
}
|
|
249
|
-
function _getProtoFunc(funcName, proto, currentDynProtoProxy) {
|
|
250
|
-
var protoFunc = proto[funcName];
|
|
251
|
-
if (protoFunc === currentDynProtoProxy) {
|
|
252
|
-
protoFunc = _getObjProto$1(proto)[funcName];
|
|
253
|
-
}
|
|
254
|
-
if (typeof protoFunc !== strFunction) {
|
|
255
|
-
_throwTypeError("[" + funcName + "] is not a " + strFunction);
|
|
256
|
-
}
|
|
257
|
-
return protoFunc;
|
|
258
|
-
}
|
|
259
|
-
function _populatePrototype(proto, className, target, baseInstFuncs, setInstanceFunc) {
|
|
260
|
-
function _createDynamicPrototype(proto, funcName) {
|
|
261
|
-
var dynProtoProxy = function () {
|
|
262
|
-
var instFunc = _getInstFunc(this, funcName, proto, dynProtoProxy) || _getProtoFunc(funcName, proto, dynProtoProxy);
|
|
263
|
-
return instFunc.apply(this, arguments);
|
|
264
|
-
};
|
|
265
|
-
dynProtoProxy[DynProxyTag] = 1;
|
|
266
|
-
return dynProtoProxy;
|
|
267
|
-
}
|
|
268
|
-
if (!_isObjectOrArrayPrototype(proto)) {
|
|
269
|
-
var instFuncTable = target[DynInstFuncTable] = target[DynInstFuncTable] || {};
|
|
270
|
-
var instFuncs_1 = instFuncTable[className] = (instFuncTable[className] || {});
|
|
271
|
-
if (instFuncTable[DynAllowInstChkTag] !== false) {
|
|
272
|
-
instFuncTable[DynAllowInstChkTag] = !!setInstanceFunc;
|
|
273
|
-
}
|
|
274
|
-
_forEachProp(target, function (name) {
|
|
275
|
-
if (_isDynamicCandidate(target, name, false) && target[name] !== baseInstFuncs[name]) {
|
|
276
|
-
instFuncs_1[name] = target[name];
|
|
277
|
-
delete target[name];
|
|
278
|
-
if (!_hasOwnProperty(proto, name) || (proto[name] && !proto[name][DynProxyTag])) {
|
|
279
|
-
proto[name] = _createDynamicPrototype(proto, name);
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
});
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
function _checkPrototype(classProto, thisTarget) {
|
|
286
|
-
if (_objGetPrototypeOf$1) {
|
|
287
|
-
var visited = [];
|
|
288
|
-
var thisProto = _getObjProto$1(thisTarget);
|
|
289
|
-
while (thisProto && !_isObjectArrayOrFunctionPrototype(thisProto) && !_hasVisited(visited, thisProto)) {
|
|
290
|
-
if (thisProto === classProto) {
|
|
291
|
-
return true;
|
|
292
|
-
}
|
|
293
|
-
visited.push(thisProto);
|
|
294
|
-
thisProto = _getObjProto$1(thisProto);
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
return false;
|
|
298
|
-
}
|
|
299
|
-
function _getObjName(target, unknownValue) {
|
|
300
|
-
if (_hasOwnProperty(target, Prototype)) {
|
|
301
|
-
return target.name || unknownValue || UnknownValue;
|
|
302
|
-
}
|
|
303
|
-
return (((target || {})[Constructor]) || {}).name || unknownValue || UnknownValue;
|
|
304
|
-
}
|
|
305
|
-
function dynamicProto(theClass, target, delegateFunc, options) {
|
|
306
|
-
if (!_hasOwnProperty(theClass, Prototype)) {
|
|
307
|
-
_throwTypeError("theClass is an invalid class definition.");
|
|
308
|
-
}
|
|
309
|
-
var classProto = theClass[Prototype];
|
|
310
|
-
if (!_checkPrototype(classProto, target)) {
|
|
311
|
-
_throwTypeError("[" + _getObjName(theClass) + "] is not in class hierarchy of [" + _getObjName(target) + "]");
|
|
312
|
-
}
|
|
313
|
-
var className = null;
|
|
314
|
-
if (_hasOwnProperty(classProto, DynClassName)) {
|
|
315
|
-
className = classProto[DynClassName];
|
|
316
|
-
}
|
|
317
|
-
else {
|
|
318
|
-
className = DynClassNamePrefix + _getObjName(theClass, "_") + "$" + _dynamicNames;
|
|
319
|
-
_dynamicNames++;
|
|
320
|
-
classProto[DynClassName] = className;
|
|
321
|
-
}
|
|
322
|
-
var perfOptions = dynamicProto[DynProtoDefaultOptions];
|
|
323
|
-
var useBaseInst = !!perfOptions[strUseBaseInst];
|
|
324
|
-
if (useBaseInst && options && options[strUseBaseInst] !== undefined) {
|
|
325
|
-
useBaseInst = !!options[strUseBaseInst];
|
|
326
|
-
}
|
|
327
|
-
var instFuncs = _getInstanceFuncs(target);
|
|
328
|
-
var baseFuncs = _getBaseFuncs(classProto, target, instFuncs, useBaseInst);
|
|
329
|
-
delegateFunc(target, baseFuncs);
|
|
330
|
-
var setInstanceFunc = !!_objGetPrototypeOf$1 && !!perfOptions[strSetInstFuncs];
|
|
331
|
-
if (setInstanceFunc && options) {
|
|
332
|
-
setInstanceFunc = !!options[strSetInstFuncs];
|
|
333
|
-
}
|
|
334
|
-
_populatePrototype(classProto, className, target, instFuncs, setInstanceFunc !== false);
|
|
335
|
-
}
|
|
336
|
-
var perfDefaults = {
|
|
337
|
-
setInstFuncs: true,
|
|
338
|
-
useBaseInst: true
|
|
339
|
-
};
|
|
340
|
-
dynamicProto[DynProtoDefaultOptions] = perfDefaults;
|
|
341
|
-
|
|
342
101
|
var strEmpty$1 = "";
|
|
343
102
|
var strSetNextPlugin = "setNextPlugin";
|
|
344
103
|
var strIsInitialized = "isInitialized";
|
|
@@ -351,7 +110,7 @@
|
|
|
351
110
|
var strToISOString = "toISOString";
|
|
352
111
|
var cStrTrim = "trim";
|
|
353
112
|
var strToString = "toString";
|
|
354
|
-
var str__Proto = "__proto__";
|
|
113
|
+
var str__Proto$1 = "__proto__";
|
|
355
114
|
var strConstructor = "constructor";
|
|
356
115
|
var _objDefineProperty$1 = ObjDefineProperty;
|
|
357
116
|
var _objFreeze = ObjClass.freeze;
|
|
@@ -367,13 +126,13 @@
|
|
|
367
126
|
var rCamelCase = /-([a-z])/g;
|
|
368
127
|
var rNormalizeInvalid = /([^\w\d_$])/g;
|
|
369
128
|
var rLeadingNumeric = /^(\d+[\w\d_$])/;
|
|
370
|
-
var _objGetPrototypeOf = Object["getPrototypeOf"];
|
|
371
|
-
function _getObjProto(target) {
|
|
129
|
+
var _objGetPrototypeOf$1 = Object["getPrototypeOf"];
|
|
130
|
+
function _getObjProto$1(target) {
|
|
372
131
|
if (target) {
|
|
373
|
-
if (_objGetPrototypeOf) {
|
|
374
|
-
return _objGetPrototypeOf(target);
|
|
132
|
+
if (_objGetPrototypeOf$1) {
|
|
133
|
+
return _objGetPrototypeOf$1(target);
|
|
375
134
|
}
|
|
376
|
-
var newProto = target[str__Proto] || target[strShimPrototype] || target[strConstructor];
|
|
135
|
+
var newProto = target[str__Proto$1] || target[strShimPrototype] || target[strConstructor];
|
|
377
136
|
if (newProto) {
|
|
378
137
|
return newProto;
|
|
379
138
|
}
|
|
@@ -439,7 +198,7 @@
|
|
|
439
198
|
function isPlainObject(value) {
|
|
440
199
|
var result = false;
|
|
441
200
|
if (value && typeof value === "object") {
|
|
442
|
-
var proto = _objGetPrototypeOf ? _objGetPrototypeOf(value) : _getObjProto(value);
|
|
201
|
+
var proto = _objGetPrototypeOf$1 ? _objGetPrototypeOf$1(value) : _getObjProto$1(value);
|
|
443
202
|
if (!proto) {
|
|
444
203
|
result = true;
|
|
445
204
|
}
|
|
@@ -487,174 +246,422 @@
|
|
|
487
246
|
}
|
|
488
247
|
}
|
|
489
248
|
}
|
|
490
|
-
catch (e) {
|
|
491
|
-
}
|
|
249
|
+
catch (e) {
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
function strTrim(str) {
|
|
253
|
+
if (str) {
|
|
254
|
+
str = (_strTrim && str[cStrTrim]) ? str[cStrTrim]() : (str.replace ? str.replace(/^\s+|\s+$/g, "") : str);
|
|
255
|
+
}
|
|
256
|
+
return str;
|
|
257
|
+
}
|
|
258
|
+
var _objKeysHasDontEnumBug = !({ toString: null }).propertyIsEnumerable("toString");
|
|
259
|
+
var _objKeysDontEnums = [
|
|
260
|
+
"toString",
|
|
261
|
+
"toLocaleString",
|
|
262
|
+
"valueOf",
|
|
263
|
+
"hasOwnProperty",
|
|
264
|
+
"isPrototypeOf",
|
|
265
|
+
"propertyIsEnumerable",
|
|
266
|
+
"constructor"
|
|
267
|
+
];
|
|
268
|
+
function objKeys(obj) {
|
|
269
|
+
var objType = typeof obj;
|
|
270
|
+
if (objType !== strShimFunction && (objType !== strShimObject || obj === null)) {
|
|
271
|
+
throwTypeError("objKeys called on non-object");
|
|
272
|
+
}
|
|
273
|
+
if (!_objKeysHasDontEnumBug && _objKeys) {
|
|
274
|
+
return _objKeys(obj);
|
|
275
|
+
}
|
|
276
|
+
var result = [];
|
|
277
|
+
for (var prop in obj) {
|
|
278
|
+
if (obj && ObjHasOwnProperty.call(obj, prop)) {
|
|
279
|
+
result.push(prop);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
if (_objKeysHasDontEnumBug) {
|
|
283
|
+
var dontEnumsLength = _objKeysDontEnums.length;
|
|
284
|
+
for (var lp = 0; lp < dontEnumsLength; lp++) {
|
|
285
|
+
if (obj && ObjHasOwnProperty.call(obj, _objKeysDontEnums[lp])) {
|
|
286
|
+
result.push(_objKeysDontEnums[lp]);
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
return result;
|
|
291
|
+
}
|
|
292
|
+
function objDefineAccessors(target, prop, getProp, setProp) {
|
|
293
|
+
if (_objDefineProperty$1) {
|
|
294
|
+
try {
|
|
295
|
+
var descriptor = {
|
|
296
|
+
enumerable: true,
|
|
297
|
+
configurable: true
|
|
298
|
+
};
|
|
299
|
+
if (getProp) {
|
|
300
|
+
descriptor.get = getProp;
|
|
301
|
+
}
|
|
302
|
+
if (setProp) {
|
|
303
|
+
descriptor.set = setProp;
|
|
304
|
+
}
|
|
305
|
+
_objDefineProperty$1(target, prop, descriptor);
|
|
306
|
+
return true;
|
|
307
|
+
}
|
|
308
|
+
catch (e) {
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
return false;
|
|
312
|
+
}
|
|
313
|
+
function _doNothing(value) {
|
|
314
|
+
return value;
|
|
315
|
+
}
|
|
316
|
+
function deepFreeze(obj) {
|
|
317
|
+
if (_objFreeze) {
|
|
318
|
+
objForEachKey(obj, function (name, value) {
|
|
319
|
+
if (isArray(value) || isObject(value)) {
|
|
320
|
+
_objFreeze(value);
|
|
321
|
+
}
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
return objFreeze(obj);
|
|
325
|
+
}
|
|
326
|
+
var objFreeze = _objFreeze || _doNothing;
|
|
327
|
+
function dateNow() {
|
|
328
|
+
var dt = Date;
|
|
329
|
+
return dt.now ? dt.now() : new dt().getTime();
|
|
330
|
+
}
|
|
331
|
+
function setValue(target, field, value, valChk, srcChk) {
|
|
332
|
+
var theValue = value;
|
|
333
|
+
if (target) {
|
|
334
|
+
theValue = target[field];
|
|
335
|
+
if (theValue !== value && (!srcChk || srcChk(theValue)) && (!valChk || valChk(value))) {
|
|
336
|
+
theValue = value;
|
|
337
|
+
target[field] = theValue;
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
return theValue;
|
|
341
|
+
}
|
|
342
|
+
function throwError(message) {
|
|
343
|
+
throw new Error(message);
|
|
344
|
+
}
|
|
345
|
+
function _createProxyFunction(source, funcName) {
|
|
346
|
+
var srcFunc = null;
|
|
347
|
+
var src = null;
|
|
348
|
+
if (isFunction(source)) {
|
|
349
|
+
srcFunc = source;
|
|
350
|
+
}
|
|
351
|
+
else {
|
|
352
|
+
src = source;
|
|
353
|
+
}
|
|
354
|
+
return function () {
|
|
355
|
+
var originalArguments = arguments;
|
|
356
|
+
if (srcFunc) {
|
|
357
|
+
src = srcFunc();
|
|
358
|
+
}
|
|
359
|
+
if (src) {
|
|
360
|
+
return src[funcName].apply(src, originalArguments);
|
|
361
|
+
}
|
|
362
|
+
};
|
|
363
|
+
}
|
|
364
|
+
function proxyFunctionAs(target, name, source, theFunc, overwriteTarget) {
|
|
365
|
+
if (target && name && source) {
|
|
366
|
+
if (overwriteTarget !== false || isUndefined(target[name])) {
|
|
367
|
+
target[name] = _createProxyFunction(source, theFunc);
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
function objExtend(obj1, obj2, obj3, obj4, obj5, obj6) {
|
|
372
|
+
var theArgs = arguments;
|
|
373
|
+
var extended = theArgs[0] || {};
|
|
374
|
+
var argLen = theArgs.length;
|
|
375
|
+
var deep = false;
|
|
376
|
+
var idx = 1;
|
|
377
|
+
if (argLen > 0 && isBoolean(extended)) {
|
|
378
|
+
deep = extended;
|
|
379
|
+
extended = theArgs[idx] || {};
|
|
380
|
+
idx++;
|
|
381
|
+
}
|
|
382
|
+
if (!isObject(extended)) {
|
|
383
|
+
extended = {};
|
|
384
|
+
}
|
|
385
|
+
for (; idx < argLen; idx++) {
|
|
386
|
+
var arg = theArgs[idx];
|
|
387
|
+
var isArgArray = isArray(arg);
|
|
388
|
+
var isArgObj = isObject(arg);
|
|
389
|
+
for (var prop in arg) {
|
|
390
|
+
var propOk = (isArgArray && (prop in arg)) || (isArgObj && (ObjHasOwnProperty.call(arg, prop)));
|
|
391
|
+
if (!propOk) {
|
|
392
|
+
continue;
|
|
393
|
+
}
|
|
394
|
+
var newValue = arg[prop];
|
|
395
|
+
var isNewArray = void 0;
|
|
396
|
+
if (deep && newValue && ((isNewArray = isArray(newValue)) || isPlainObject(newValue))) {
|
|
397
|
+
var clone = extended[prop];
|
|
398
|
+
if (isNewArray) {
|
|
399
|
+
if (!isArray(clone)) {
|
|
400
|
+
clone = [];
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
else if (!isPlainObject(clone)) {
|
|
404
|
+
clone = {};
|
|
405
|
+
}
|
|
406
|
+
newValue = objExtend(deep, clone, newValue);
|
|
407
|
+
}
|
|
408
|
+
if (newValue !== undefined) {
|
|
409
|
+
extended[prop] = newValue;
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
return extended;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
function createValueMap(values) {
|
|
417
|
+
var mapClass = {};
|
|
418
|
+
objForEachKey(values, function (field, value) {
|
|
419
|
+
mapClass[field] = value[1];
|
|
420
|
+
mapClass[value[0]] = value[1];
|
|
421
|
+
});
|
|
422
|
+
return deepFreeze(mapClass);
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
/*!
|
|
426
|
+
* Microsoft Dynamic Proto Utility, 1.1.4
|
|
427
|
+
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
428
|
+
*/
|
|
429
|
+
var Constructor = 'constructor';
|
|
430
|
+
var Prototype = 'prototype';
|
|
431
|
+
var strFunction = 'function';
|
|
432
|
+
var DynInstFuncTable = '_dynInstFuncs';
|
|
433
|
+
var DynProxyTag = '_isDynProxy';
|
|
434
|
+
var DynClassName = '_dynClass';
|
|
435
|
+
var DynClassNamePrefix = '_dynCls$';
|
|
436
|
+
var DynInstChkTag = '_dynInstChk';
|
|
437
|
+
var DynAllowInstChkTag = DynInstChkTag;
|
|
438
|
+
var DynProtoDefaultOptions = '_dfOpts';
|
|
439
|
+
var UnknownValue = '_unknown_';
|
|
440
|
+
var str__Proto = "__proto__";
|
|
441
|
+
var strUseBaseInst = 'useBaseInst';
|
|
442
|
+
var strSetInstFuncs = 'setInstFuncs';
|
|
443
|
+
var Obj = Object;
|
|
444
|
+
var _objGetPrototypeOf = Obj["getPrototypeOf"];
|
|
445
|
+
var _dynamicNames = 0;
|
|
446
|
+
function _hasOwnProperty(obj, prop) {
|
|
447
|
+
return obj && Obj[Prototype].hasOwnProperty.call(obj, prop);
|
|
448
|
+
}
|
|
449
|
+
function _isObjectOrArrayPrototype(target) {
|
|
450
|
+
return target && (target === Obj[Prototype] || target === Array[Prototype]);
|
|
451
|
+
}
|
|
452
|
+
function _isObjectArrayOrFunctionPrototype(target) {
|
|
453
|
+
return _isObjectOrArrayPrototype(target) || target === Function[Prototype];
|
|
454
|
+
}
|
|
455
|
+
function _getObjProto(target) {
|
|
456
|
+
if (target) {
|
|
457
|
+
if (_objGetPrototypeOf) {
|
|
458
|
+
return _objGetPrototypeOf(target);
|
|
459
|
+
}
|
|
460
|
+
var newProto = target[str__Proto] || target[Prototype] || (target[Constructor] ? target[Constructor][Prototype] : null);
|
|
461
|
+
if (newProto) {
|
|
462
|
+
return newProto;
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
return null;
|
|
466
|
+
}
|
|
467
|
+
function _forEachProp(target, func) {
|
|
468
|
+
var props = [];
|
|
469
|
+
var getOwnProps = Obj["getOwnPropertyNames"];
|
|
470
|
+
if (getOwnProps) {
|
|
471
|
+
props = getOwnProps(target);
|
|
472
|
+
}
|
|
473
|
+
else {
|
|
474
|
+
for (var name_1 in target) {
|
|
475
|
+
if (typeof name_1 === "string" && _hasOwnProperty(target, name_1)) {
|
|
476
|
+
props.push(name_1);
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
if (props && props.length > 0) {
|
|
481
|
+
for (var lp = 0; lp < props.length; lp++) {
|
|
482
|
+
func(props[lp]);
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
function _isDynamicCandidate(target, funcName, skipOwn) {
|
|
487
|
+
return (funcName !== Constructor && typeof target[funcName] === strFunction && (skipOwn || _hasOwnProperty(target, funcName)));
|
|
488
|
+
}
|
|
489
|
+
function _throwTypeError(message) {
|
|
490
|
+
throw new TypeError("DynamicProto: " + message);
|
|
491
|
+
}
|
|
492
|
+
function _getInstanceFuncs(thisTarget) {
|
|
493
|
+
var instFuncs = {};
|
|
494
|
+
_forEachProp(thisTarget, function (name) {
|
|
495
|
+
if (!instFuncs[name] && _isDynamicCandidate(thisTarget, name, false)) {
|
|
496
|
+
instFuncs[name] = thisTarget[name];
|
|
497
|
+
}
|
|
498
|
+
});
|
|
499
|
+
return instFuncs;
|
|
500
|
+
}
|
|
501
|
+
function _hasVisited(values, value) {
|
|
502
|
+
for (var lp = values.length - 1; lp >= 0; lp--) {
|
|
503
|
+
if (values[lp] === value) {
|
|
504
|
+
return true;
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
return false;
|
|
508
|
+
}
|
|
509
|
+
function _getBaseFuncs(classProto, thisTarget, instFuncs, useBaseInst) {
|
|
510
|
+
function _instFuncProxy(target, funcHost, funcName) {
|
|
511
|
+
var theFunc = funcHost[funcName];
|
|
512
|
+
if (theFunc[DynProxyTag] && useBaseInst) {
|
|
513
|
+
var instFuncTable = target[DynInstFuncTable] || {};
|
|
514
|
+
if (instFuncTable[DynAllowInstChkTag] !== false) {
|
|
515
|
+
theFunc = (instFuncTable[funcHost[DynClassName]] || {})[funcName] || theFunc;
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
return function () {
|
|
519
|
+
return theFunc.apply(target, arguments);
|
|
520
|
+
};
|
|
521
|
+
}
|
|
522
|
+
var baseFuncs = {};
|
|
523
|
+
_forEachProp(instFuncs, function (name) {
|
|
524
|
+
baseFuncs[name] = _instFuncProxy(thisTarget, instFuncs, name);
|
|
525
|
+
});
|
|
526
|
+
var baseProto = _getObjProto(classProto);
|
|
527
|
+
var visited = [];
|
|
528
|
+
while (baseProto && !_isObjectArrayOrFunctionPrototype(baseProto) && !_hasVisited(visited, baseProto)) {
|
|
529
|
+
_forEachProp(baseProto, function (name) {
|
|
530
|
+
if (!baseFuncs[name] && _isDynamicCandidate(baseProto, name, !_objGetPrototypeOf)) {
|
|
531
|
+
baseFuncs[name] = _instFuncProxy(thisTarget, baseProto, name);
|
|
532
|
+
}
|
|
533
|
+
});
|
|
534
|
+
visited.push(baseProto);
|
|
535
|
+
baseProto = _getObjProto(baseProto);
|
|
536
|
+
}
|
|
537
|
+
return baseFuncs;
|
|
538
|
+
}
|
|
539
|
+
function _getInstFunc(target, funcName, proto, currentDynProtoProxy) {
|
|
540
|
+
var instFunc = null;
|
|
541
|
+
if (target && _hasOwnProperty(proto, DynClassName)) {
|
|
542
|
+
var instFuncTable = target[DynInstFuncTable] || {};
|
|
543
|
+
instFunc = (instFuncTable[proto[DynClassName]] || {})[funcName];
|
|
544
|
+
if (!instFunc) {
|
|
545
|
+
_throwTypeError("Missing [" + funcName + "] " + strFunction);
|
|
546
|
+
}
|
|
547
|
+
if (!instFunc[DynInstChkTag] && instFuncTable[DynAllowInstChkTag] !== false) {
|
|
548
|
+
var canAddInst = !_hasOwnProperty(target, funcName);
|
|
549
|
+
var objProto = _getObjProto(target);
|
|
550
|
+
var visited = [];
|
|
551
|
+
while (canAddInst && objProto && !_isObjectArrayOrFunctionPrototype(objProto) && !_hasVisited(visited, objProto)) {
|
|
552
|
+
var protoFunc = objProto[funcName];
|
|
553
|
+
if (protoFunc) {
|
|
554
|
+
canAddInst = (protoFunc === currentDynProtoProxy);
|
|
555
|
+
break;
|
|
556
|
+
}
|
|
557
|
+
visited.push(objProto);
|
|
558
|
+
objProto = _getObjProto(objProto);
|
|
559
|
+
}
|
|
560
|
+
try {
|
|
561
|
+
if (canAddInst) {
|
|
562
|
+
target[funcName] = instFunc;
|
|
563
|
+
}
|
|
564
|
+
instFunc[DynInstChkTag] = 1;
|
|
565
|
+
}
|
|
566
|
+
catch (e) {
|
|
567
|
+
instFuncTable[DynAllowInstChkTag] = false;
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
return instFunc;
|
|
492
572
|
}
|
|
493
|
-
function
|
|
494
|
-
|
|
495
|
-
|
|
573
|
+
function _getProtoFunc(funcName, proto, currentDynProtoProxy) {
|
|
574
|
+
var protoFunc = proto[funcName];
|
|
575
|
+
if (protoFunc === currentDynProtoProxy) {
|
|
576
|
+
protoFunc = _getObjProto(proto)[funcName];
|
|
496
577
|
}
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
var _objKeysHasDontEnumBug = !({ toString: null }).propertyIsEnumerable("toString");
|
|
500
|
-
var _objKeysDontEnums = [
|
|
501
|
-
"toString",
|
|
502
|
-
"toLocaleString",
|
|
503
|
-
"valueOf",
|
|
504
|
-
"hasOwnProperty",
|
|
505
|
-
"isPrototypeOf",
|
|
506
|
-
"propertyIsEnumerable",
|
|
507
|
-
"constructor"
|
|
508
|
-
];
|
|
509
|
-
function objKeys(obj) {
|
|
510
|
-
var objType = typeof obj;
|
|
511
|
-
if (objType !== strShimFunction && (objType !== strShimObject || obj === null)) {
|
|
512
|
-
throwTypeError("objKeys called on non-object");
|
|
578
|
+
if (typeof protoFunc !== strFunction) {
|
|
579
|
+
_throwTypeError("[" + funcName + "] is not a " + strFunction);
|
|
513
580
|
}
|
|
514
|
-
|
|
515
|
-
|
|
581
|
+
return protoFunc;
|
|
582
|
+
}
|
|
583
|
+
function _populatePrototype(proto, className, target, baseInstFuncs, setInstanceFunc) {
|
|
584
|
+
function _createDynamicPrototype(proto, funcName) {
|
|
585
|
+
var dynProtoProxy = function () {
|
|
586
|
+
var instFunc = _getInstFunc(this, funcName, proto, dynProtoProxy) || _getProtoFunc(funcName, proto, dynProtoProxy);
|
|
587
|
+
return instFunc.apply(this, arguments);
|
|
588
|
+
};
|
|
589
|
+
dynProtoProxy[DynProxyTag] = 1;
|
|
590
|
+
return dynProtoProxy;
|
|
516
591
|
}
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
592
|
+
if (!_isObjectOrArrayPrototype(proto)) {
|
|
593
|
+
var instFuncTable = target[DynInstFuncTable] = target[DynInstFuncTable] || {};
|
|
594
|
+
var instFuncs_1 = instFuncTable[className] = (instFuncTable[className] || {});
|
|
595
|
+
if (instFuncTable[DynAllowInstChkTag] !== false) {
|
|
596
|
+
instFuncTable[DynAllowInstChkTag] = !!setInstanceFunc;
|
|
521
597
|
}
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
598
|
+
_forEachProp(target, function (name) {
|
|
599
|
+
if (_isDynamicCandidate(target, name, false) && target[name] !== baseInstFuncs[name]) {
|
|
600
|
+
instFuncs_1[name] = target[name];
|
|
601
|
+
delete target[name];
|
|
602
|
+
if (!_hasOwnProperty(proto, name) || (proto[name] && !proto[name][DynProxyTag])) {
|
|
603
|
+
proto[name] = _createDynamicPrototype(proto, name);
|
|
604
|
+
}
|
|
528
605
|
}
|
|
529
|
-
}
|
|
606
|
+
});
|
|
530
607
|
}
|
|
531
|
-
return result;
|
|
532
608
|
}
|
|
533
|
-
function
|
|
534
|
-
if (
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
if (getProp) {
|
|
541
|
-
descriptor.get = getProp;
|
|
542
|
-
}
|
|
543
|
-
if (setProp) {
|
|
544
|
-
descriptor.set = setProp;
|
|
609
|
+
function _checkPrototype(classProto, thisTarget) {
|
|
610
|
+
if (_objGetPrototypeOf) {
|
|
611
|
+
var visited = [];
|
|
612
|
+
var thisProto = _getObjProto(thisTarget);
|
|
613
|
+
while (thisProto && !_isObjectArrayOrFunctionPrototype(thisProto) && !_hasVisited(visited, thisProto)) {
|
|
614
|
+
if (thisProto === classProto) {
|
|
615
|
+
return true;
|
|
545
616
|
}
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
}
|
|
549
|
-
catch (e) {
|
|
617
|
+
visited.push(thisProto);
|
|
618
|
+
thisProto = _getObjProto(thisProto);
|
|
550
619
|
}
|
|
551
620
|
}
|
|
552
621
|
return false;
|
|
553
622
|
}
|
|
554
|
-
function
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
var objFreeze = _objFreeze || _doNothing;
|
|
558
|
-
function dateNow() {
|
|
559
|
-
var dt = Date;
|
|
560
|
-
return dt.now ? dt.now() : new dt().getTime();
|
|
561
|
-
}
|
|
562
|
-
function setValue(target, field, value, valChk, srcChk) {
|
|
563
|
-
var theValue = value;
|
|
564
|
-
if (target) {
|
|
565
|
-
theValue = target[field];
|
|
566
|
-
if (theValue !== value && (!srcChk || srcChk(theValue)) && (!valChk || valChk(value))) {
|
|
567
|
-
theValue = value;
|
|
568
|
-
target[field] = theValue;
|
|
569
|
-
}
|
|
623
|
+
function _getObjName(target, unknownValue) {
|
|
624
|
+
if (_hasOwnProperty(target, Prototype)) {
|
|
625
|
+
return target.name || unknownValue || UnknownValue;
|
|
570
626
|
}
|
|
571
|
-
return
|
|
572
|
-
}
|
|
573
|
-
function throwError(message) {
|
|
574
|
-
throw new Error(message);
|
|
627
|
+
return (((target || {})[Constructor]) || {}).name || unknownValue || UnknownValue;
|
|
575
628
|
}
|
|
576
|
-
function
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
if (isFunction(source)) {
|
|
580
|
-
srcFunc = source;
|
|
629
|
+
function dynamicProto(theClass, target, delegateFunc, options) {
|
|
630
|
+
if (!_hasOwnProperty(theClass, Prototype)) {
|
|
631
|
+
_throwTypeError("theClass is an invalid class definition.");
|
|
581
632
|
}
|
|
582
|
-
|
|
583
|
-
|
|
633
|
+
var classProto = theClass[Prototype];
|
|
634
|
+
if (!_checkPrototype(classProto, target)) {
|
|
635
|
+
_throwTypeError("[" + _getObjName(theClass) + "] is not in class hierarchy of [" + _getObjName(target) + "]");
|
|
584
636
|
}
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
src = srcFunc();
|
|
589
|
-
}
|
|
590
|
-
if (src) {
|
|
591
|
-
return src[funcName].apply(src, originalArguments);
|
|
592
|
-
}
|
|
593
|
-
};
|
|
594
|
-
}
|
|
595
|
-
function proxyFunctionAs(target, name, source, theFunc, overwriteTarget) {
|
|
596
|
-
if (overwriteTarget === void 0) { overwriteTarget = true; }
|
|
597
|
-
if (target && name && source) {
|
|
598
|
-
if (overwriteTarget || isUndefined(target[name])) {
|
|
599
|
-
target[name] = _createProxyFunction(source, theFunc);
|
|
600
|
-
}
|
|
637
|
+
var className = null;
|
|
638
|
+
if (_hasOwnProperty(classProto, DynClassName)) {
|
|
639
|
+
className = classProto[DynClassName];
|
|
601
640
|
}
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
enumClass[field] = value;
|
|
607
|
-
if (!isUndefined(enumClass[value])) {
|
|
608
|
-
throwError("[" + value + "] exists for " + field);
|
|
609
|
-
}
|
|
610
|
-
enumClass[value] = field;
|
|
611
|
-
});
|
|
612
|
-
return objFreeze(enumClass);
|
|
613
|
-
}
|
|
614
|
-
function objExtend(obj1, obj2, obj3, obj4, obj5, obj6) {
|
|
615
|
-
var theArgs = arguments;
|
|
616
|
-
var extended = theArgs[0] || {};
|
|
617
|
-
var argLen = theArgs.length;
|
|
618
|
-
var deep = false;
|
|
619
|
-
var idx = 1;
|
|
620
|
-
if (argLen > 0 && isBoolean(extended)) {
|
|
621
|
-
deep = extended;
|
|
622
|
-
extended = theArgs[idx] || {};
|
|
623
|
-
idx++;
|
|
641
|
+
else {
|
|
642
|
+
className = DynClassNamePrefix + _getObjName(theClass, "_") + "$" + _dynamicNames;
|
|
643
|
+
_dynamicNames++;
|
|
644
|
+
classProto[DynClassName] = className;
|
|
624
645
|
}
|
|
625
|
-
|
|
626
|
-
|
|
646
|
+
var perfOptions = dynamicProto[DynProtoDefaultOptions];
|
|
647
|
+
var useBaseInst = !!perfOptions[strUseBaseInst];
|
|
648
|
+
if (useBaseInst && options && options[strUseBaseInst] !== undefined) {
|
|
649
|
+
useBaseInst = !!options[strUseBaseInst];
|
|
627
650
|
}
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
if (!propOk) {
|
|
635
|
-
continue;
|
|
636
|
-
}
|
|
637
|
-
var newValue = arg[prop];
|
|
638
|
-
var isNewArray = void 0;
|
|
639
|
-
if (deep && newValue && ((isNewArray = isArray(newValue)) || isPlainObject(newValue))) {
|
|
640
|
-
var clone = extended[prop];
|
|
641
|
-
if (isNewArray) {
|
|
642
|
-
if (!isArray(clone)) {
|
|
643
|
-
clone = [];
|
|
644
|
-
}
|
|
645
|
-
}
|
|
646
|
-
else if (!isPlainObject(clone)) {
|
|
647
|
-
clone = {};
|
|
648
|
-
}
|
|
649
|
-
newValue = objExtend(deep, clone, newValue);
|
|
650
|
-
}
|
|
651
|
-
if (newValue !== undefined) {
|
|
652
|
-
extended[prop] = newValue;
|
|
653
|
-
}
|
|
654
|
-
}
|
|
651
|
+
var instFuncs = _getInstanceFuncs(target);
|
|
652
|
+
var baseFuncs = _getBaseFuncs(classProto, target, instFuncs, useBaseInst);
|
|
653
|
+
delegateFunc(target, baseFuncs);
|
|
654
|
+
var setInstanceFunc = !!_objGetPrototypeOf && !!perfOptions[strSetInstFuncs];
|
|
655
|
+
if (setInstanceFunc && options) {
|
|
656
|
+
setInstanceFunc = !!options[strSetInstFuncs];
|
|
655
657
|
}
|
|
656
|
-
|
|
658
|
+
_populatePrototype(classProto, className, target, instFuncs, setInstanceFunc !== false);
|
|
657
659
|
}
|
|
660
|
+
var perfDefaults = {
|
|
661
|
+
setInstFuncs: true,
|
|
662
|
+
useBaseInst: true
|
|
663
|
+
};
|
|
664
|
+
dynamicProto[DynProtoDefaultOptions] = perfDefaults;
|
|
658
665
|
|
|
659
666
|
var strWindow = "window";
|
|
660
667
|
var strDocument = "document";
|
|
@@ -1142,7 +1149,7 @@
|
|
|
1142
1149
|
}
|
|
1143
1150
|
|
|
1144
1151
|
var _objDefineProperty = ObjDefineProperty;
|
|
1145
|
-
var version = "2.8.0-nightly.2204-
|
|
1152
|
+
var version = "2.8.0-nightly.2204-07";
|
|
1146
1153
|
var instanceName = "." + newId(6);
|
|
1147
1154
|
var _dataUid = 0;
|
|
1148
1155
|
function _createAccessor(target, prop, value) {
|
|
@@ -1863,95 +1870,6 @@
|
|
|
1863
1870
|
return oct.substr(0, 8) + oct.substr(9, 4) + "4" + oct.substr(13, 3) + clockSequenceHi + oct.substr(16, 3) + oct.substr(19, 12);
|
|
1864
1871
|
}
|
|
1865
1872
|
|
|
1866
|
-
var LoggingSeverity = createEnumStyle({
|
|
1867
|
-
CRITICAL: 1 ,
|
|
1868
|
-
WARNING: 2
|
|
1869
|
-
});
|
|
1870
|
-
var _InternalMessageId = createEnumStyle({
|
|
1871
|
-
BrowserDoesNotSupportLocalStorage: 0 ,
|
|
1872
|
-
BrowserCannotReadLocalStorage: 1 ,
|
|
1873
|
-
BrowserCannotReadSessionStorage: 2 ,
|
|
1874
|
-
BrowserCannotWriteLocalStorage: 3 ,
|
|
1875
|
-
BrowserCannotWriteSessionStorage: 4 ,
|
|
1876
|
-
BrowserFailedRemovalFromLocalStorage: 5 ,
|
|
1877
|
-
BrowserFailedRemovalFromSessionStorage: 6 ,
|
|
1878
|
-
CannotSendEmptyTelemetry: 7 ,
|
|
1879
|
-
ClientPerformanceMathError: 8 ,
|
|
1880
|
-
ErrorParsingAISessionCookie: 9 ,
|
|
1881
|
-
ErrorPVCalc: 10 ,
|
|
1882
|
-
ExceptionWhileLoggingError: 11 ,
|
|
1883
|
-
FailedAddingTelemetryToBuffer: 12 ,
|
|
1884
|
-
FailedMonitorAjaxAbort: 13 ,
|
|
1885
|
-
FailedMonitorAjaxDur: 14 ,
|
|
1886
|
-
FailedMonitorAjaxOpen: 15 ,
|
|
1887
|
-
FailedMonitorAjaxRSC: 16 ,
|
|
1888
|
-
FailedMonitorAjaxSend: 17 ,
|
|
1889
|
-
FailedMonitorAjaxGetCorrelationHeader: 18 ,
|
|
1890
|
-
FailedToAddHandlerForOnBeforeUnload: 19 ,
|
|
1891
|
-
FailedToSendQueuedTelemetry: 20 ,
|
|
1892
|
-
FailedToReportDataLoss: 21 ,
|
|
1893
|
-
FlushFailed: 22 ,
|
|
1894
|
-
MessageLimitPerPVExceeded: 23 ,
|
|
1895
|
-
MissingRequiredFieldSpecification: 24 ,
|
|
1896
|
-
NavigationTimingNotSupported: 25 ,
|
|
1897
|
-
OnError: 26 ,
|
|
1898
|
-
SessionRenewalDateIsZero: 27 ,
|
|
1899
|
-
SenderNotInitialized: 28 ,
|
|
1900
|
-
StartTrackEventFailed: 29 ,
|
|
1901
|
-
StopTrackEventFailed: 30 ,
|
|
1902
|
-
StartTrackFailed: 31 ,
|
|
1903
|
-
StopTrackFailed: 32 ,
|
|
1904
|
-
TelemetrySampledAndNotSent: 33 ,
|
|
1905
|
-
TrackEventFailed: 34 ,
|
|
1906
|
-
TrackExceptionFailed: 35 ,
|
|
1907
|
-
TrackMetricFailed: 36 ,
|
|
1908
|
-
TrackPVFailed: 37 ,
|
|
1909
|
-
TrackPVFailedCalc: 38 ,
|
|
1910
|
-
TrackTraceFailed: 39 ,
|
|
1911
|
-
TransmissionFailed: 40 ,
|
|
1912
|
-
FailedToSetStorageBuffer: 41 ,
|
|
1913
|
-
FailedToRestoreStorageBuffer: 42 ,
|
|
1914
|
-
InvalidBackendResponse: 43 ,
|
|
1915
|
-
FailedToFixDepricatedValues: 44 ,
|
|
1916
|
-
InvalidDurationValue: 45 ,
|
|
1917
|
-
TelemetryEnvelopeInvalid: 46 ,
|
|
1918
|
-
CreateEnvelopeError: 47 ,
|
|
1919
|
-
CannotSerializeObject: 48 ,
|
|
1920
|
-
CannotSerializeObjectNonSerializable: 49 ,
|
|
1921
|
-
CircularReferenceDetected: 50 ,
|
|
1922
|
-
ClearAuthContextFailed: 51 ,
|
|
1923
|
-
ExceptionTruncated: 52 ,
|
|
1924
|
-
IllegalCharsInName: 53 ,
|
|
1925
|
-
ItemNotInArray: 54 ,
|
|
1926
|
-
MaxAjaxPerPVExceeded: 55 ,
|
|
1927
|
-
MessageTruncated: 56 ,
|
|
1928
|
-
NameTooLong: 57 ,
|
|
1929
|
-
SampleRateOutOfRange: 58 ,
|
|
1930
|
-
SetAuthContextFailed: 59 ,
|
|
1931
|
-
SetAuthContextFailedAccountName: 60 ,
|
|
1932
|
-
StringValueTooLong: 61 ,
|
|
1933
|
-
StartCalledMoreThanOnce: 62 ,
|
|
1934
|
-
StopCalledWithoutStart: 63 ,
|
|
1935
|
-
TelemetryInitializerFailed: 64 ,
|
|
1936
|
-
TrackArgumentsNotSpecified: 65 ,
|
|
1937
|
-
UrlTooLong: 66 ,
|
|
1938
|
-
SessionStorageBufferFull: 67 ,
|
|
1939
|
-
CannotAccessCookie: 68 ,
|
|
1940
|
-
IdTooLong: 69 ,
|
|
1941
|
-
InvalidEvent: 70 ,
|
|
1942
|
-
FailedMonitorAjaxSetRequestHeader: 71 ,
|
|
1943
|
-
SendBrowserInfoOnUserInit: 72 ,
|
|
1944
|
-
PluginException: 73 ,
|
|
1945
|
-
NotificationException: 74 ,
|
|
1946
|
-
SnippetScriptLoadFailure: 99 ,
|
|
1947
|
-
InvalidInstrumentationKey: 100 ,
|
|
1948
|
-
CannotParseAiBlobValue: 101 ,
|
|
1949
|
-
InvalidContentBlob: 102 ,
|
|
1950
|
-
TrackPageActionEventFailed: 103 ,
|
|
1951
|
-
FailedAddingCustomDefinedRequestContext: 104 ,
|
|
1952
|
-
InMemoryStorageBufferFull: 105
|
|
1953
|
-
});
|
|
1954
|
-
|
|
1955
1873
|
var aiInstrumentHooks = "_aiHooks";
|
|
1956
1874
|
var cbNames = [
|
|
1957
1875
|
"req", "rsp", "hkErr", "fnErr"
|
|
@@ -2043,7 +1961,7 @@
|
|
|
2043
1961
|
owner = target;
|
|
2044
1962
|
}
|
|
2045
1963
|
else if (checkPrototype) {
|
|
2046
|
-
owner = _getOwner(_getObjProto(target), name, false);
|
|
1964
|
+
owner = _getOwner(_getObjProto$1(target), name, false);
|
|
2047
1965
|
}
|
|
2048
1966
|
}
|
|
2049
1967
|
return owner;
|
|
@@ -2095,17 +2013,17 @@
|
|
|
2095
2013
|
return null;
|
|
2096
2014
|
}
|
|
2097
2015
|
|
|
2098
|
-
var RequestHeaders = {
|
|
2099
|
-
requestContextHeader: "Request-Context",
|
|
2100
|
-
requestContextTargetKey: "appId",
|
|
2101
|
-
requestContextAppIdFormat: "appId=cid-v1:",
|
|
2102
|
-
requestIdHeader: "Request-Id",
|
|
2103
|
-
traceParentHeader: "traceparent",
|
|
2104
|
-
traceStateHeader: "tracestate",
|
|
2105
|
-
sdkContextHeader: "Sdk-Context",
|
|
2106
|
-
sdkContextHeaderAppIdRequest: "appId",
|
|
2107
|
-
requestContextHeaderLowerCase: "request-context"
|
|
2108
|
-
};
|
|
2016
|
+
var RequestHeaders = createValueMap({
|
|
2017
|
+
requestContextHeader: [0 , "Request-Context"],
|
|
2018
|
+
requestContextTargetKey: [1 , "appId"],
|
|
2019
|
+
requestContextAppIdFormat: [2 , "appId=cid-v1:"],
|
|
2020
|
+
requestIdHeader: [3 , "Request-Id"],
|
|
2021
|
+
traceParentHeader: [4 , "traceparent"],
|
|
2022
|
+
traceStateHeader: [5 , "tracestate"],
|
|
2023
|
+
sdkContextHeader: [6 , "Sdk-Context"],
|
|
2024
|
+
sdkContextHeaderAppIdRequest: [7 , "appId"],
|
|
2025
|
+
requestContextHeaderLowerCase: [8 , "request-context"]
|
|
2026
|
+
});
|
|
2109
2027
|
|
|
2110
2028
|
function dataSanitizeKeyAndAddUniqueness(logger, key, map) {
|
|
2111
2029
|
var origLength = key.length;
|
|
@@ -2127,7 +2045,7 @@
|
|
|
2127
2045
|
name = strTrim(name.toString());
|
|
2128
2046
|
if (name.length > 150 ) {
|
|
2129
2047
|
nameTrunc = name.substring(0, 150 );
|
|
2130
|
-
_throwInternal(logger, 2 ,
|
|
2048
|
+
_throwInternal(logger, 2 , 57 , "name is too long. It has been truncated to " + 150 + " characters.", { name: name }, true);
|
|
2131
2049
|
}
|
|
2132
2050
|
}
|
|
2133
2051
|
return nameTrunc || name;
|
|
@@ -2140,13 +2058,13 @@
|
|
|
2140
2058
|
value = strTrim(value);
|
|
2141
2059
|
if (value.toString().length > maxLength) {
|
|
2142
2060
|
valueTrunc = value.toString().substring(0, maxLength);
|
|
2143
|
-
_throwInternal(logger, 2 ,
|
|
2061
|
+
_throwInternal(logger, 2 , 61 , "string value is too long. It has been truncated to " + maxLength + " characters.", { value: value }, true);
|
|
2144
2062
|
}
|
|
2145
2063
|
}
|
|
2146
2064
|
return valueTrunc || value;
|
|
2147
2065
|
}
|
|
2148
2066
|
function dataSanitizeUrl(logger, url) {
|
|
2149
|
-
return dataSanitizeInput(logger, url, 2048 ,
|
|
2067
|
+
return dataSanitizeInput(logger, url, 2048 , 66 );
|
|
2150
2068
|
}
|
|
2151
2069
|
function dataSanitizeProperties(logger, properties) {
|
|
2152
2070
|
if (properties) {
|
|
@@ -2157,7 +2075,7 @@
|
|
|
2157
2075
|
value = getJSON().stringify(value);
|
|
2158
2076
|
}
|
|
2159
2077
|
catch (e) {
|
|
2160
|
-
_throwInternal(logger, 2 ,
|
|
2078
|
+
_throwInternal(logger, 2 , 49 , "custom property is not valid", { exception: e }, true);
|
|
2161
2079
|
}
|
|
2162
2080
|
}
|
|
2163
2081
|
value = dataSanitizeString(logger, value, 8192 );
|
|
@@ -2337,7 +2255,7 @@
|
|
|
2337
2255
|
},
|
|
2338
2256
|
getCorrelationContext: function (responseHeader) {
|
|
2339
2257
|
if (responseHeader) {
|
|
2340
|
-
var correlationId = CorrelationIdHelper.getCorrelationContextValue(responseHeader, RequestHeaders
|
|
2258
|
+
var correlationId = CorrelationIdHelper.getCorrelationContextValue(responseHeader, RequestHeaders[1 ]);
|
|
2341
2259
|
if (correlationId && correlationId !== CorrelationIdHelper.correlationIdPrefix) {
|
|
2342
2260
|
return correlationId;
|
|
2343
2261
|
}
|
|
@@ -2450,40 +2368,90 @@
|
|
|
2450
2368
|
return RemoteDependencyData;
|
|
2451
2369
|
}());
|
|
2452
2370
|
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
data: {},
|
|
2475
|
-
baseType: baseType,
|
|
2476
|
-
baseData: item
|
|
2477
|
-
};
|
|
2478
|
-
if (!isNullOrUndefined(customProperties)) {
|
|
2479
|
-
objForEachKey(customProperties, function (prop, value) {
|
|
2480
|
-
telemetryItem.data[prop] = value;
|
|
2481
|
-
});
|
|
2482
|
-
}
|
|
2483
|
-
return telemetryItem;
|
|
2371
|
+
function createTelemetryItem(item, baseType, envelopeName, logger, customProperties, systemProperties) {
|
|
2372
|
+
envelopeName = dataSanitizeString(logger, envelopeName) || strNotSpecified;
|
|
2373
|
+
if (isNullOrUndefined(item) ||
|
|
2374
|
+
isNullOrUndefined(baseType) ||
|
|
2375
|
+
isNullOrUndefined(envelopeName)) {
|
|
2376
|
+
throwError("Input doesn't contain all required fields");
|
|
2377
|
+
}
|
|
2378
|
+
var iKey = "";
|
|
2379
|
+
if (item[strIkey]) {
|
|
2380
|
+
iKey = item[strIkey];
|
|
2381
|
+
delete item[strIkey];
|
|
2382
|
+
}
|
|
2383
|
+
var telemetryItem = {
|
|
2384
|
+
name: envelopeName,
|
|
2385
|
+
time: toISOString(new Date()),
|
|
2386
|
+
iKey: iKey,
|
|
2387
|
+
ext: systemProperties ? systemProperties : {},
|
|
2388
|
+
tags: [],
|
|
2389
|
+
data: {},
|
|
2390
|
+
baseType: baseType,
|
|
2391
|
+
baseData: item
|
|
2484
2392
|
};
|
|
2485
|
-
|
|
2486
|
-
|
|
2393
|
+
if (!isNullOrUndefined(customProperties)) {
|
|
2394
|
+
objForEachKey(customProperties, function (prop, value) {
|
|
2395
|
+
telemetryItem.data[prop] = value;
|
|
2396
|
+
});
|
|
2397
|
+
}
|
|
2398
|
+
return telemetryItem;
|
|
2399
|
+
}
|
|
2400
|
+
|
|
2401
|
+
var DEFAULT_VERSION = "00";
|
|
2402
|
+
var INVALID_VERSION = "ff";
|
|
2403
|
+
var INVALID_TRACE_ID = "00000000000000000000000000000000";
|
|
2404
|
+
var INVALID_SPAN_ID = "0000000000000000";
|
|
2405
|
+
function _isValid(value, len, invalidValue) {
|
|
2406
|
+
if (value && value.length === len && value !== invalidValue) {
|
|
2407
|
+
return !!value.match(/^[\da-f]*$/);
|
|
2408
|
+
}
|
|
2409
|
+
return false;
|
|
2410
|
+
}
|
|
2411
|
+
function _formatValue(value, len, defValue) {
|
|
2412
|
+
if (_isValid(value, len)) {
|
|
2413
|
+
return value;
|
|
2414
|
+
}
|
|
2415
|
+
return defValue;
|
|
2416
|
+
}
|
|
2417
|
+
function _formatFlags(value) {
|
|
2418
|
+
if (isNaN(value) || value < 0 || value > 255) {
|
|
2419
|
+
value = 0x01;
|
|
2420
|
+
}
|
|
2421
|
+
var result = value.toString(16);
|
|
2422
|
+
while (result.length < 2) {
|
|
2423
|
+
result = "0" + result;
|
|
2424
|
+
}
|
|
2425
|
+
return result;
|
|
2426
|
+
}
|
|
2427
|
+
function createTraceParent(traceId, spanId, flags, version) {
|
|
2428
|
+
return {
|
|
2429
|
+
version: _isValid(version, 2, INVALID_VERSION) ? version : DEFAULT_VERSION,
|
|
2430
|
+
traceId: isValidTraceId(traceId) ? traceId : generateW3CId(),
|
|
2431
|
+
spanId: isValidSpanId(spanId) ? spanId : generateW3CId().substr(0, 16),
|
|
2432
|
+
traceFlags: flags >= 0 && flags <= 0xFF ? flags : 1
|
|
2433
|
+
};
|
|
2434
|
+
}
|
|
2435
|
+
function isValidTraceId(value) {
|
|
2436
|
+
return _isValid(value, 32, INVALID_TRACE_ID);
|
|
2437
|
+
}
|
|
2438
|
+
function isValidSpanId(value) {
|
|
2439
|
+
return _isValid(value, 16, INVALID_SPAN_ID);
|
|
2440
|
+
}
|
|
2441
|
+
function formatTraceParent(value) {
|
|
2442
|
+
if (value) {
|
|
2443
|
+
var flags = _formatFlags(value.traceFlags);
|
|
2444
|
+
if (!_isValid(flags, 2)) {
|
|
2445
|
+
flags = "01";
|
|
2446
|
+
}
|
|
2447
|
+
var version = value.version || DEFAULT_VERSION;
|
|
2448
|
+
if (version !== "00" && version !== "ff") {
|
|
2449
|
+
version = DEFAULT_VERSION;
|
|
2450
|
+
}
|
|
2451
|
+
return "".concat(version, "-").concat(_formatValue(value.traceId, 32, INVALID_TRACE_ID), "-").concat(_formatValue(value.spanId, 16, INVALID_SPAN_ID), "-").concat(flags);
|
|
2452
|
+
}
|
|
2453
|
+
return "";
|
|
2454
|
+
}
|
|
2487
2455
|
|
|
2488
2456
|
var PropertiesPluginIdentifier = "AppInsightsPropertiesPlugin";
|
|
2489
2457
|
|
|
@@ -2697,43 +2665,9 @@
|
|
|
2697
2665
|
return ajaxRecord;
|
|
2698
2666
|
}());
|
|
2699
2667
|
|
|
2700
|
-
var Traceparent = /** @class */ (function () {
|
|
2701
|
-
function Traceparent(traceId, spanId) {
|
|
2702
|
-
var self = this;
|
|
2703
|
-
self.traceFlag = Traceparent.DEFAULT_TRACE_FLAG;
|
|
2704
|
-
self.version = Traceparent.DEFAULT_VERSION;
|
|
2705
|
-
if (traceId && Traceparent.isValidTraceId(traceId)) {
|
|
2706
|
-
self.traceId = traceId;
|
|
2707
|
-
}
|
|
2708
|
-
else {
|
|
2709
|
-
self.traceId = generateW3CId();
|
|
2710
|
-
}
|
|
2711
|
-
if (spanId && Traceparent.isValidSpanId(spanId)) {
|
|
2712
|
-
self.spanId = spanId;
|
|
2713
|
-
}
|
|
2714
|
-
else {
|
|
2715
|
-
self.spanId = generateW3CId().substr(0, 16);
|
|
2716
|
-
}
|
|
2717
|
-
}
|
|
2718
|
-
Traceparent.isValidTraceId = function (id) {
|
|
2719
|
-
return id.match(/^[0-9a-f]{32}$/) && id !== "00000000000000000000000000000000";
|
|
2720
|
-
};
|
|
2721
|
-
Traceparent.isValidSpanId = function (id) {
|
|
2722
|
-
return id.match(/^[0-9a-f]{16}$/) && id !== "0000000000000000";
|
|
2723
|
-
};
|
|
2724
|
-
Traceparent.prototype.toString = function () {
|
|
2725
|
-
var self = this;
|
|
2726
|
-
return "".concat(self.version, "-").concat(self.traceId, "-").concat(self.spanId, "-").concat(self.traceFlag);
|
|
2727
|
-
};
|
|
2728
|
-
Traceparent.DEFAULT_TRACE_FLAG = "01";
|
|
2729
|
-
Traceparent.DEFAULT_VERSION = "00";
|
|
2730
|
-
return Traceparent;
|
|
2731
|
-
}());
|
|
2732
|
-
|
|
2733
2668
|
var AJAX_MONITOR_PREFIX = "ai.ajxmn.";
|
|
2734
2669
|
var strDiagLog = "diagLog";
|
|
2735
2670
|
var strAjaxData = "ajaxData";
|
|
2736
|
-
var strThrowInternal = "throwInternal";
|
|
2737
2671
|
var strFetch = "fetch";
|
|
2738
2672
|
var strTrackDependencyDataInternal = "trackDependencyDataInternal";
|
|
2739
2673
|
var _markCount = 0;
|
|
@@ -2769,7 +2703,7 @@
|
|
|
2769
2703
|
}
|
|
2770
2704
|
catch (e) {
|
|
2771
2705
|
result = false;
|
|
2772
|
-
_throwInternalCritical(ajaxMonitorInstance,
|
|
2706
|
+
_throwInternalCritical(ajaxMonitorInstance, 15 , "Failed to enable XMLHttpRequest monitoring, extension is not supported", {
|
|
2773
2707
|
exception: dumpObj(e)
|
|
2774
2708
|
});
|
|
2775
2709
|
}
|
|
@@ -2790,10 +2724,10 @@
|
|
|
2790
2724
|
return result;
|
|
2791
2725
|
}
|
|
2792
2726
|
function _throwInternalCritical(ajaxMonitorInstance, msgId, message, properties, isUserAct) {
|
|
2793
|
-
ajaxMonitorInstance[strDiagLog]()
|
|
2727
|
+
_throwInternal(ajaxMonitorInstance[strDiagLog](), 1 , msgId, message, properties, isUserAct);
|
|
2794
2728
|
}
|
|
2795
2729
|
function _throwInternalWarning(ajaxMonitorInstance, msgId, message, properties, isUserAct) {
|
|
2796
|
-
ajaxMonitorInstance[strDiagLog]()
|
|
2730
|
+
_throwInternal(ajaxMonitorInstance[strDiagLog](), 2 , msgId, message, properties, isUserAct);
|
|
2797
2731
|
}
|
|
2798
2732
|
function _createErrorCallbackFunc(ajaxMonitorInstance, internalMessage, message) {
|
|
2799
2733
|
return function (args) {
|
|
@@ -2864,23 +2798,23 @@
|
|
|
2864
2798
|
init.headers = new Headers(init.headers || (input instanceof Request ? (input.headers || {}) : {}));
|
|
2865
2799
|
if (_isUsingAIHeaders) {
|
|
2866
2800
|
var id = "|" + ajaxData.traceID + "." + ajaxData.spanID;
|
|
2867
|
-
init.headers.set(RequestHeaders
|
|
2801
|
+
init.headers.set(RequestHeaders[3 ], id);
|
|
2868
2802
|
if (_enableRequestHeaderTracking) {
|
|
2869
|
-
ajaxData.requestHeaders[RequestHeaders
|
|
2803
|
+
ajaxData.requestHeaders[RequestHeaders[3 ]] = id;
|
|
2870
2804
|
}
|
|
2871
2805
|
}
|
|
2872
2806
|
var appId = _config.appId || (_context && _context.appId());
|
|
2873
2807
|
if (appId) {
|
|
2874
|
-
init.headers.set(RequestHeaders
|
|
2808
|
+
init.headers.set(RequestHeaders[0 ], RequestHeaders[2 ] + appId);
|
|
2875
2809
|
if (_enableRequestHeaderTracking) {
|
|
2876
|
-
ajaxData.requestHeaders[RequestHeaders
|
|
2810
|
+
ajaxData.requestHeaders[RequestHeaders[0 ]] = RequestHeaders[2 ] + appId;
|
|
2877
2811
|
}
|
|
2878
2812
|
}
|
|
2879
2813
|
if (_isUsingW3CHeaders) {
|
|
2880
|
-
var
|
|
2881
|
-
init.headers.set(RequestHeaders
|
|
2814
|
+
var traceParent = formatTraceParent(createTraceParent(ajaxData.traceID, ajaxData.spanID, 0x01));
|
|
2815
|
+
init.headers.set(RequestHeaders[4 ], traceParent);
|
|
2882
2816
|
if (_enableRequestHeaderTracking) {
|
|
2883
|
-
ajaxData.requestHeaders[RequestHeaders
|
|
2817
|
+
ajaxData.requestHeaders[RequestHeaders[4 ]] = traceParent;
|
|
2884
2818
|
}
|
|
2885
2819
|
}
|
|
2886
2820
|
}
|
|
@@ -2890,23 +2824,23 @@
|
|
|
2890
2824
|
if (CorrelationIdHelper.canIncludeCorrelationHeader(_config, ajaxData.getAbsoluteUrl(), currentWindowHost)) {
|
|
2891
2825
|
if (_isUsingAIHeaders) {
|
|
2892
2826
|
var id = "|" + ajaxData.traceID + "." + ajaxData.spanID;
|
|
2893
|
-
xhr.setRequestHeader(RequestHeaders
|
|
2827
|
+
xhr.setRequestHeader(RequestHeaders[3 ], id);
|
|
2894
2828
|
if (_enableRequestHeaderTracking) {
|
|
2895
|
-
ajaxData.requestHeaders[RequestHeaders
|
|
2829
|
+
ajaxData.requestHeaders[RequestHeaders[3 ]] = id;
|
|
2896
2830
|
}
|
|
2897
2831
|
}
|
|
2898
2832
|
var appId = _config.appId || (_context && _context.appId());
|
|
2899
2833
|
if (appId) {
|
|
2900
|
-
xhr.setRequestHeader(RequestHeaders
|
|
2834
|
+
xhr.setRequestHeader(RequestHeaders[0 ], RequestHeaders[2 ] + appId);
|
|
2901
2835
|
if (_enableRequestHeaderTracking) {
|
|
2902
|
-
ajaxData.requestHeaders[RequestHeaders
|
|
2836
|
+
ajaxData.requestHeaders[RequestHeaders[0 ]] = RequestHeaders[2 ] + appId;
|
|
2903
2837
|
}
|
|
2904
2838
|
}
|
|
2905
2839
|
if (_isUsingW3CHeaders) {
|
|
2906
|
-
var
|
|
2907
|
-
xhr.setRequestHeader(RequestHeaders
|
|
2840
|
+
var traceParent = formatTraceParent(createTraceParent(ajaxData.traceID, ajaxData.spanID, 0x01));
|
|
2841
|
+
xhr.setRequestHeader(RequestHeaders[4 ], traceParent);
|
|
2908
2842
|
if (_enableRequestHeaderTracking) {
|
|
2909
|
-
ajaxData.requestHeaders[RequestHeaders
|
|
2843
|
+
ajaxData.requestHeaders[RequestHeaders[4 ]] = traceParent;
|
|
2910
2844
|
}
|
|
2911
2845
|
}
|
|
2912
2846
|
}
|
|
@@ -2924,11 +2858,11 @@
|
|
|
2924
2858
|
if (isNullOrUndefined(dependency.startTime)) {
|
|
2925
2859
|
dependency.startTime = new Date();
|
|
2926
2860
|
}
|
|
2927
|
-
var item =
|
|
2861
|
+
var item = createTelemetryItem(dependency, RemoteDependencyData.dataType, RemoteDependencyData.envelopeType, _self[strDiagLog](), properties, systemProperties);
|
|
2928
2862
|
_self.core.track(item);
|
|
2929
2863
|
}
|
|
2930
2864
|
else if (_trackAjaxAttempts === _maxAjaxCallsPerView) {
|
|
2931
|
-
_throwInternalCritical(_self,
|
|
2865
|
+
_throwInternalCritical(_self, 55 , "Maximum ajax per page view limit reached, ajax monitoring is paused until the next trackPageView(). In order to increase the limit set the maxAjaxCallsPerView configuration parameter.", true);
|
|
2932
2866
|
}
|
|
2933
2867
|
++_trackAjaxAttempts;
|
|
2934
2868
|
};
|
|
@@ -3056,7 +2990,7 @@
|
|
|
3056
2990
|
}
|
|
3057
2991
|
}
|
|
3058
2992
|
},
|
|
3059
|
-
hkErr: _createErrorCallbackFunc(_self,
|
|
2993
|
+
hkErr: _createErrorCallbackFunc(_self, 15 , "Failed to monitor Window.fetch, monitoring data for this fetch call may be incorrect.")
|
|
3060
2994
|
}));
|
|
3061
2995
|
_fetchInitialized = true;
|
|
3062
2996
|
}
|
|
@@ -3091,7 +3025,7 @@
|
|
|
3091
3025
|
}
|
|
3092
3026
|
}
|
|
3093
3027
|
},
|
|
3094
|
-
hkErr: _createErrorCallbackFunc(_self,
|
|
3028
|
+
hkErr: _createErrorCallbackFunc(_self, 15 , "Failed to monitor XMLHttpRequest.open, monitoring data for this ajax call may be incorrect.")
|
|
3095
3029
|
});
|
|
3096
3030
|
_hookProto(XMLHttpRequest, "send", {
|
|
3097
3031
|
ns: _evtNamespace,
|
|
@@ -3107,7 +3041,7 @@
|
|
|
3107
3041
|
}
|
|
3108
3042
|
}
|
|
3109
3043
|
},
|
|
3110
|
-
hkErr: _createErrorCallbackFunc(_self,
|
|
3044
|
+
hkErr: _createErrorCallbackFunc(_self, 17 , "Failed to monitor XMLHttpRequest, monitoring data for this ajax call may be incorrect.")
|
|
3111
3045
|
});
|
|
3112
3046
|
_hookProto(XMLHttpRequest, "abort", {
|
|
3113
3047
|
ns: _evtNamespace,
|
|
@@ -3121,7 +3055,7 @@
|
|
|
3121
3055
|
}
|
|
3122
3056
|
}
|
|
3123
3057
|
},
|
|
3124
|
-
hkErr: _createErrorCallbackFunc(_self,
|
|
3058
|
+
hkErr: _createErrorCallbackFunc(_self, 13 , "Failed to monitor XMLHttpRequest.abort, monitoring data for this ajax call may be incorrect.")
|
|
3125
3059
|
});
|
|
3126
3060
|
_hookProto(XMLHttpRequest, "setRequestHeader", {
|
|
3127
3061
|
ns: _evtNamespace,
|
|
@@ -3133,7 +3067,7 @@
|
|
|
3133
3067
|
}
|
|
3134
3068
|
}
|
|
3135
3069
|
},
|
|
3136
|
-
hkErr: _createErrorCallbackFunc(_self,
|
|
3070
|
+
hkErr: _createErrorCallbackFunc(_self, 71 , "Failed to monitor XMLHttpRequest.setRequestHeader, monitoring data for this ajax call may be incorrect.")
|
|
3137
3071
|
});
|
|
3138
3072
|
_xhrInitialized = true;
|
|
3139
3073
|
}
|
|
@@ -3214,7 +3148,7 @@
|
|
|
3214
3148
|
catch (e) {
|
|
3215
3149
|
var exceptionText = dumpObj(e);
|
|
3216
3150
|
if (!exceptionText || _indexOf(exceptionText.toLowerCase(), "c00c023f") === -1) {
|
|
3217
|
-
_throwInternalCritical(_self,
|
|
3151
|
+
_throwInternalCritical(_self, 16 , "Failed to monitor XMLHttpRequest 'readystatechange' event handler, monitoring data for this ajax call may be incorrect.", {
|
|
3218
3152
|
ajaxDiagnosticsMessage: _getFailedAjaxDiagnosticsMessage(xhr),
|
|
3219
3153
|
exception: exceptionText
|
|
3220
3154
|
});
|
|
@@ -3243,7 +3177,7 @@
|
|
|
3243
3177
|
if (e) {
|
|
3244
3178
|
errorProps["exception"] = dumpObj(e);
|
|
3245
3179
|
}
|
|
3246
|
-
_throwInternalWarning(_self,
|
|
3180
|
+
_throwInternalWarning(_self, 14 , "Failed to calculate the duration of the ajax call, monitoring data for this ajax call won't be sent.", errorProps);
|
|
3247
3181
|
}
|
|
3248
3182
|
_findPerfResourceEntry("xmlhttprequest", ajaxData, function () {
|
|
3249
3183
|
try {
|
|
@@ -3281,7 +3215,7 @@
|
|
|
3281
3215
|
}
|
|
3282
3216
|
}
|
|
3283
3217
|
catch (e) {
|
|
3284
|
-
_throwInternalWarning(_self,
|
|
3218
|
+
_throwInternalWarning(_self, 104 , "Failed to add custom defined request context as configured call back may missing a null check.");
|
|
3285
3219
|
}
|
|
3286
3220
|
if (dependency) {
|
|
3287
3221
|
if (properties !== undefined) {
|
|
@@ -3311,15 +3245,15 @@
|
|
|
3311
3245
|
try {
|
|
3312
3246
|
var responseHeadersString = xhr.getAllResponseHeaders();
|
|
3313
3247
|
if (responseHeadersString !== null) {
|
|
3314
|
-
var index = _indexOf(responseHeadersString.toLowerCase(), RequestHeaders
|
|
3248
|
+
var index = _indexOf(responseHeadersString.toLowerCase(), RequestHeaders[8 ]);
|
|
3315
3249
|
if (index !== -1) {
|
|
3316
|
-
var responseHeader = xhr.getResponseHeader(RequestHeaders
|
|
3250
|
+
var responseHeader = xhr.getResponseHeader(RequestHeaders[0 ]);
|
|
3317
3251
|
return CorrelationIdHelper.getCorrelationContext(responseHeader);
|
|
3318
3252
|
}
|
|
3319
3253
|
}
|
|
3320
3254
|
}
|
|
3321
3255
|
catch (e) {
|
|
3322
|
-
_throwInternalWarning(_self,
|
|
3256
|
+
_throwInternalWarning(_self, 18 , "Failed to get Request-Context correlation header as it may be not included in the response or not accessible.", {
|
|
3323
3257
|
ajaxDiagnosticsMessage: _getFailedAjaxDiagnosticsMessage(xhr),
|
|
3324
3258
|
exception: dumpObj(e)
|
|
3325
3259
|
});
|
|
@@ -3436,7 +3370,7 @@
|
|
|
3436
3370
|
}
|
|
3437
3371
|
}
|
|
3438
3372
|
catch (e) {
|
|
3439
|
-
_throwInternalCritical(_self,
|
|
3373
|
+
_throwInternalCritical(_self, 15 , "Failed to grab failed fetch diagnostics message", { exception: dumpObj(e) });
|
|
3440
3374
|
}
|
|
3441
3375
|
return result;
|
|
3442
3376
|
}
|
|
@@ -3463,7 +3397,7 @@
|
|
|
3463
3397
|
}
|
|
3464
3398
|
}
|
|
3465
3399
|
catch (e) {
|
|
3466
|
-
_throwInternalWarning(_self,
|
|
3400
|
+
_throwInternalWarning(_self, 104 , "Failed to add custom defined request context as configured call back may missing a null check.");
|
|
3467
3401
|
}
|
|
3468
3402
|
if (dependency) {
|
|
3469
3403
|
if (properties !== undefined) {
|
|
@@ -3472,23 +3406,23 @@
|
|
|
3472
3406
|
_self[strTrackDependencyDataInternal](dependency);
|
|
3473
3407
|
}
|
|
3474
3408
|
else {
|
|
3475
|
-
_reportFetchError(
|
|
3409
|
+
_reportFetchError(14 , null, {
|
|
3476
3410
|
requestSentTime: ajaxData.requestSentTime,
|
|
3477
3411
|
responseFinishedTime: ajaxData.responseFinishedTime
|
|
3478
3412
|
});
|
|
3479
3413
|
}
|
|
3480
3414
|
}, function (e) {
|
|
3481
|
-
_reportFetchError(
|
|
3415
|
+
_reportFetchError(18 , e, null);
|
|
3482
3416
|
});
|
|
3483
3417
|
}
|
|
3484
3418
|
function _getFetchCorrelationContext(response) {
|
|
3485
3419
|
if (response && response.headers) {
|
|
3486
3420
|
try {
|
|
3487
|
-
var responseHeader = response.headers.get(RequestHeaders
|
|
3421
|
+
var responseHeader = response.headers.get(RequestHeaders[0 ]);
|
|
3488
3422
|
return CorrelationIdHelper.getCorrelationContext(responseHeader);
|
|
3489
3423
|
}
|
|
3490
3424
|
catch (e) {
|
|
3491
|
-
_throwInternalWarning(_self,
|
|
3425
|
+
_throwInternalWarning(_self, 18 , "Failed to get Request-Context correlation header as it may be not included in the response or not accessible.", {
|
|
3492
3426
|
fetchDiagnosticsMessage: _getFailedFetchDiagnosticsMessage(response),
|
|
3493
3427
|
exception: dumpObj(e)
|
|
3494
3428
|
});
|