@microsoft/applicationinsights-core-js 2.8.0-beta.2202-06 → 2.8.0-beta.2203-02
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/applicationinsights-core-js.integrity.json +9 -9
- package/browser/applicationinsights-core-js.js +945 -479
- package/browser/applicationinsights-core-js.js.map +1 -1
- package/browser/applicationinsights-core-js.min.js +2 -2
- package/browser/applicationinsights-core-js.min.js.map +1 -1
- package/dist/applicationinsights-core-js.api.json +3904 -877
- package/dist/applicationinsights-core-js.api.md +264 -30
- package/dist/applicationinsights-core-js.d.ts +410 -89
- package/dist/applicationinsights-core-js.js +945 -479
- package/dist/applicationinsights-core-js.js.map +1 -1
- package/dist/applicationinsights-core-js.min.js +2 -2
- package/dist/applicationinsights-core-js.min.js.map +1 -1
- package/dist/applicationinsights-core-js.rollup.d.ts +410 -89
- package/dist-esm/JavaScriptSDK/AppInsightsCore.js +1 -1
- package/dist-esm/JavaScriptSDK/BaseCore.js +66 -23
- package/dist-esm/JavaScriptSDK/BaseCore.js.map +1 -1
- package/dist-esm/JavaScriptSDK/BaseTelemetryPlugin.js +44 -5
- package/dist-esm/JavaScriptSDK/BaseTelemetryPlugin.js.map +1 -1
- package/dist-esm/JavaScriptSDK/ChannelController.js +105 -73
- package/dist-esm/JavaScriptSDK/ChannelController.js.map +1 -1
- package/dist-esm/JavaScriptSDK/Constants.js +1 -1
- package/dist-esm/JavaScriptSDK/CookieMgr.js +3 -4
- package/dist-esm/JavaScriptSDK/CookieMgr.js.map +1 -1
- package/dist-esm/JavaScriptSDK/CoreUtils.js +6 -122
- package/dist-esm/JavaScriptSDK/CoreUtils.js.map +1 -1
- package/dist-esm/JavaScriptSDK/DataCacheHelper.js +93 -0
- package/dist-esm/JavaScriptSDK/DataCacheHelper.js.map +1 -0
- package/dist-esm/JavaScriptSDK/DbgExtensionUtils.js +1 -1
- package/dist-esm/JavaScriptSDK/DiagnosticLogger.js +12 -12
- package/dist-esm/JavaScriptSDK/DiagnosticLogger.js.map +1 -1
- package/dist-esm/JavaScriptSDK/EnvUtils.js +8 -7
- package/dist-esm/JavaScriptSDK/EnvUtils.js.map +1 -1
- package/dist-esm/JavaScriptSDK/EventHelpers.js +472 -0
- package/dist-esm/JavaScriptSDK/EventHelpers.js.map +1 -0
- package/dist-esm/JavaScriptSDK/HelperFuncs.js +32 -59
- package/dist-esm/JavaScriptSDK/HelperFuncs.js.map +1 -1
- package/dist-esm/JavaScriptSDK/InstrumentHooks.js +1 -1
- package/dist-esm/JavaScriptSDK/InternalConstants.js +28 -0
- package/dist-esm/JavaScriptSDK/InternalConstants.js.map +1 -0
- package/dist-esm/JavaScriptSDK/NotificationManager.js +8 -11
- package/dist-esm/JavaScriptSDK/NotificationManager.js.map +1 -1
- package/dist-esm/JavaScriptSDK/PerfManager.js +1 -1
- package/dist-esm/JavaScriptSDK/ProcessTelemetryContext.js +184 -110
- package/dist-esm/JavaScriptSDK/ProcessTelemetryContext.js.map +1 -1
- package/dist-esm/JavaScriptSDK/RandomHelper.js +3 -2
- package/dist-esm/JavaScriptSDK/RandomHelper.js.map +1 -1
- package/dist-esm/JavaScriptSDK/TelemetryHelpers.js +32 -13
- package/dist-esm/JavaScriptSDK/TelemetryHelpers.js.map +1 -1
- package/dist-esm/JavaScriptSDK/TelemetryInitializerPlugin.js +4 -6
- package/dist-esm/JavaScriptSDK/TelemetryInitializerPlugin.js.map +1 -1
- package/dist-esm/JavaScriptSDK.Enums/EventsDiscardedReason.js +1 -1
- package/dist-esm/JavaScriptSDK.Enums/LoggingEnums.js +90 -96
- package/dist-esm/JavaScriptSDK.Enums/LoggingEnums.js.map +1 -1
- package/dist-esm/JavaScriptSDK.Enums/SendRequestReason.js +1 -1
- package/dist-esm/JavaScriptSDK.Enums/TelemetryUnloadReason.js +8 -0
- package/dist-esm/JavaScriptSDK.Enums/TelemetryUnloadReason.js.map +1 -0
- package/dist-esm/JavaScriptSDK.Interfaces/IAppInsightsCore.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IChannelControls.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IConfiguration.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ICookieMgr.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IDbgExtension.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IDiagnosticLogger.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IInstrumentHooks.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/INotificationListener.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/INotificationManager.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IPerfEvent.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IPerfManager.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IProcessTelemetryContext.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryInitializers.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryItem.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryPlugin.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryPluginChain.js +1 -2
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryPluginChain.js.map +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryUnloadState.js +8 -0
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryUnloadState.js.map +1 -0
- package/dist-esm/applicationinsights-core-js.js +8 -4
- package/dist-esm/applicationinsights-core-js.js.map +1 -1
- package/package.json +1 -1
- package/src/JavaScriptSDK/BaseCore.ts +80 -24
- package/src/JavaScriptSDK/BaseTelemetryPlugin.ts +76 -5
- package/src/JavaScriptSDK/ChannelController.ts +107 -61
- package/src/JavaScriptSDK/CookieMgr.ts +4 -4
- package/src/JavaScriptSDK/CoreUtils.ts +6 -143
- package/src/JavaScriptSDK/DataCacheHelper.ts +106 -0
- package/src/JavaScriptSDK/DiagnosticLogger.ts +12 -11
- package/src/JavaScriptSDK/EnvUtils.ts +7 -6
- package/src/JavaScriptSDK/EventHelpers.ts +542 -0
- package/src/JavaScriptSDK/HelperFuncs.ts +35 -54
- package/src/JavaScriptSDK/InternalConstants.ts +26 -0
- package/src/JavaScriptSDK/NotificationManager.ts +7 -11
- package/src/JavaScriptSDK/ProcessTelemetryContext.ts +237 -124
- package/src/JavaScriptSDK/RandomHelper.ts +2 -1
- package/src/JavaScriptSDK/TelemetryHelpers.ts +47 -15
- package/src/JavaScriptSDK/TelemetryInitializerPlugin.ts +5 -15
- package/src/JavaScriptSDK.Enums/LoggingEnums.ts +184 -87
- package/src/JavaScriptSDK.Enums/TelemetryUnloadReason.ts +27 -0
- package/src/JavaScriptSDK.Interfaces/IAppInsightsCore.ts +20 -0
- package/src/JavaScriptSDK.Interfaces/IChannelControls.ts +9 -2
- package/src/JavaScriptSDK.Interfaces/IProcessTelemetryContext.ts +55 -16
- package/src/JavaScriptSDK.Interfaces/ITelemetryPlugin.ts +16 -9
- package/src/JavaScriptSDK.Interfaces/ITelemetryPluginChain.ts +9 -11
- package/src/JavaScriptSDK.Interfaces/ITelemetryUnloadState.ts +10 -0
- package/types/JavaScriptSDK/BaseCore.d.ts +4 -0
- package/types/JavaScriptSDK/BaseTelemetryPlugin.d.ts +20 -1
- package/types/JavaScriptSDK/ChannelController.d.ts +4 -0
- package/types/JavaScriptSDK/CoreUtils.d.ts +1 -42
- package/types/JavaScriptSDK/DataCacheHelper.d.ts +13 -0
- package/types/JavaScriptSDK/EventHelpers.d.ts +152 -0
- package/types/JavaScriptSDK/HelperFuncs.d.ts +8 -17
- package/types/JavaScriptSDK/InternalConstants.d.ts +20 -0
- package/types/JavaScriptSDK/ProcessTelemetryContext.d.ts +10 -3
- package/types/JavaScriptSDK/TelemetryHelpers.d.ts +8 -0
- package/types/JavaScriptSDK/TelemetryInitializerPlugin.d.ts +0 -7
- package/types/JavaScriptSDK.Enums/LoggingEnums.d.ts +91 -2
- package/types/JavaScriptSDK.Enums/TelemetryUnloadReason.d.ts +9 -0
- package/types/JavaScriptSDK.Interfaces/IAppInsightsCore.d.ts +17 -0
- package/types/JavaScriptSDK.Interfaces/IChannelControls.d.ts +9 -2
- package/types/JavaScriptSDK.Interfaces/IProcessTelemetryContext.d.ts +49 -14
- package/types/JavaScriptSDK.Interfaces/ITelemetryPlugin.d.ts +15 -8
- package/types/JavaScriptSDK.Interfaces/ITelemetryPluginChain.d.ts +9 -10
- package/types/JavaScriptSDK.Interfaces/ITelemetryUnloadState.d.ts +6 -0
- package/types/applicationinsights-core-js.d.ts +6 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Application Insights JavaScript SDK - Core, 2.8.0-beta.
|
|
2
|
+
* Application Insights JavaScript SDK - Core, 2.8.0-beta.2203-02
|
|
3
3
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
4
|
*/
|
|
5
5
|
(function (global, factory) {
|
|
@@ -340,101 +340,26 @@
|
|
|
340
340
|
};
|
|
341
341
|
dynamicProto[DynProtoDefaultOptions] = perfDefaults;
|
|
342
342
|
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
var
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
FailedMonitorAjaxAbort: 13,
|
|
363
|
-
FailedMonitorAjaxDur: 14,
|
|
364
|
-
FailedMonitorAjaxOpen: 15,
|
|
365
|
-
FailedMonitorAjaxRSC: 16,
|
|
366
|
-
FailedMonitorAjaxSend: 17,
|
|
367
|
-
FailedMonitorAjaxGetCorrelationHeader: 18,
|
|
368
|
-
FailedToAddHandlerForOnBeforeUnload: 19,
|
|
369
|
-
FailedToSendQueuedTelemetry: 20,
|
|
370
|
-
FailedToReportDataLoss: 21,
|
|
371
|
-
FlushFailed: 22,
|
|
372
|
-
MessageLimitPerPVExceeded: 23,
|
|
373
|
-
MissingRequiredFieldSpecification: 24,
|
|
374
|
-
NavigationTimingNotSupported: 25,
|
|
375
|
-
OnError: 26,
|
|
376
|
-
SessionRenewalDateIsZero: 27,
|
|
377
|
-
SenderNotInitialized: 28,
|
|
378
|
-
StartTrackEventFailed: 29,
|
|
379
|
-
StopTrackEventFailed: 30,
|
|
380
|
-
StartTrackFailed: 31,
|
|
381
|
-
StopTrackFailed: 32,
|
|
382
|
-
TelemetrySampledAndNotSent: 33,
|
|
383
|
-
TrackEventFailed: 34,
|
|
384
|
-
TrackExceptionFailed: 35,
|
|
385
|
-
TrackMetricFailed: 36,
|
|
386
|
-
TrackPVFailed: 37,
|
|
387
|
-
TrackPVFailedCalc: 38,
|
|
388
|
-
TrackTraceFailed: 39,
|
|
389
|
-
TransmissionFailed: 40,
|
|
390
|
-
FailedToSetStorageBuffer: 41,
|
|
391
|
-
FailedToRestoreStorageBuffer: 42,
|
|
392
|
-
InvalidBackendResponse: 43,
|
|
393
|
-
FailedToFixDepricatedValues: 44,
|
|
394
|
-
InvalidDurationValue: 45,
|
|
395
|
-
TelemetryEnvelopeInvalid: 46,
|
|
396
|
-
CreateEnvelopeError: 47,
|
|
397
|
-
CannotSerializeObject: 48,
|
|
398
|
-
CannotSerializeObjectNonSerializable: 49,
|
|
399
|
-
CircularReferenceDetected: 50,
|
|
400
|
-
ClearAuthContextFailed: 51,
|
|
401
|
-
ExceptionTruncated: 52,
|
|
402
|
-
IllegalCharsInName: 53,
|
|
403
|
-
ItemNotInArray: 54,
|
|
404
|
-
MaxAjaxPerPVExceeded: 55,
|
|
405
|
-
MessageTruncated: 56,
|
|
406
|
-
NameTooLong: 57,
|
|
407
|
-
SampleRateOutOfRange: 58,
|
|
408
|
-
SetAuthContextFailed: 59,
|
|
409
|
-
SetAuthContextFailedAccountName: 60,
|
|
410
|
-
StringValueTooLong: 61,
|
|
411
|
-
StartCalledMoreThanOnce: 62,
|
|
412
|
-
StopCalledWithoutStart: 63,
|
|
413
|
-
TelemetryInitializerFailed: 64,
|
|
414
|
-
TrackArgumentsNotSpecified: 65,
|
|
415
|
-
UrlTooLong: 66,
|
|
416
|
-
SessionStorageBufferFull: 67,
|
|
417
|
-
CannotAccessCookie: 68,
|
|
418
|
-
IdTooLong: 69,
|
|
419
|
-
InvalidEvent: 70,
|
|
420
|
-
FailedMonitorAjaxSetRequestHeader: 71,
|
|
421
|
-
SendBrowserInfoOnUserInit: 72,
|
|
422
|
-
PluginException: 73,
|
|
423
|
-
NotificationException: 74,
|
|
424
|
-
SnippetScriptLoadFailure: 99,
|
|
425
|
-
InvalidInstrumentationKey: 100,
|
|
426
|
-
CannotParseAiBlobValue: 101,
|
|
427
|
-
InvalidContentBlob: 102,
|
|
428
|
-
TrackPageActionEventFailed: 103,
|
|
429
|
-
FailedAddingCustomDefinedRequestContext: 104,
|
|
430
|
-
InMemoryStorageBufferFull: 105
|
|
431
|
-
};
|
|
343
|
+
var strEmpty = "";
|
|
344
|
+
var strProcessTelemetry = "processTelemetry";
|
|
345
|
+
var strPriority = "priority";
|
|
346
|
+
var strSetNextPlugin = "setNextPlugin";
|
|
347
|
+
var strIsInitialized = "isInitialized";
|
|
348
|
+
var strTeardown = "teardown";
|
|
349
|
+
var strCore = "core";
|
|
350
|
+
var strDisabled = "disabled";
|
|
351
|
+
var strDoTeardown = "_doTeardown";
|
|
352
|
+
var strProcessNext = "processNext";
|
|
353
|
+
var strResume = "resume";
|
|
354
|
+
var strPause = "pause";
|
|
355
|
+
var strNotificationListener = "NotificationListener";
|
|
356
|
+
var strAddNotificationListener = "add" + strNotificationListener;
|
|
357
|
+
var strRemoveNotificationListener = "remove" + strNotificationListener;
|
|
358
|
+
var strEventsSent = "eventsSent";
|
|
359
|
+
var strEventsDiscarded = "eventsDiscarded";
|
|
360
|
+
var strEventsSendRequest = "eventsSendRequest";
|
|
361
|
+
var strPerfEvent = "perfEvent";
|
|
432
362
|
|
|
433
|
-
var strOnPrefix = "on";
|
|
434
|
-
var strAttachEvent = "attachEvent";
|
|
435
|
-
var strAddEventHelper = "addEventListener";
|
|
436
|
-
var strDetachEvent = "detachEvent";
|
|
437
|
-
var strRemoveEventListener = "removeEventListener";
|
|
438
363
|
var strToISOString = "toISOString";
|
|
439
364
|
var cStrEndsWith = "endsWith";
|
|
440
365
|
var cStrStartsWith = "startsWith";
|
|
@@ -445,7 +370,7 @@
|
|
|
445
370
|
var strToString = "toString";
|
|
446
371
|
var str__Proto = "__proto__";
|
|
447
372
|
var strConstructor = "constructor";
|
|
448
|
-
var _objDefineProperty = ObjDefineProperty;
|
|
373
|
+
var _objDefineProperty$1 = ObjDefineProperty;
|
|
449
374
|
var _objFreeze = ObjClass.freeze;
|
|
450
375
|
var _objSeal = ObjClass.seal;
|
|
451
376
|
var _objKeys = ObjClass.keys;
|
|
@@ -499,40 +424,6 @@
|
|
|
499
424
|
function isFunction(value) {
|
|
500
425
|
return !!(value && typeof value === strShimFunction);
|
|
501
426
|
}
|
|
502
|
-
function attachEvent(obj, eventNameWithoutOn, handlerRef, useCapture) {
|
|
503
|
-
if (useCapture === void 0) { useCapture = false; }
|
|
504
|
-
var result = false;
|
|
505
|
-
if (!isNullOrUndefined(obj)) {
|
|
506
|
-
try {
|
|
507
|
-
if (!isNullOrUndefined(obj[strAddEventHelper])) {
|
|
508
|
-
obj[strAddEventHelper](eventNameWithoutOn, handlerRef, useCapture);
|
|
509
|
-
result = true;
|
|
510
|
-
}
|
|
511
|
-
else if (!isNullOrUndefined(obj[strAttachEvent])) {
|
|
512
|
-
obj[strAttachEvent](strOnPrefix + eventNameWithoutOn, handlerRef);
|
|
513
|
-
result = true;
|
|
514
|
-
}
|
|
515
|
-
}
|
|
516
|
-
catch (e) {
|
|
517
|
-
}
|
|
518
|
-
}
|
|
519
|
-
return result;
|
|
520
|
-
}
|
|
521
|
-
function detachEvent(obj, eventNameWithoutOn, handlerRef, useCapture) {
|
|
522
|
-
if (useCapture === void 0) { useCapture = false; }
|
|
523
|
-
if (!isNullOrUndefined(obj)) {
|
|
524
|
-
try {
|
|
525
|
-
if (!isNullOrUndefined(obj[strRemoveEventListener])) {
|
|
526
|
-
obj[strRemoveEventListener](eventNameWithoutOn, handlerRef, useCapture);
|
|
527
|
-
}
|
|
528
|
-
else if (!isNullOrUndefined(obj[strDetachEvent])) {
|
|
529
|
-
obj[strDetachEvent](strOnPrefix + eventNameWithoutOn, handlerRef);
|
|
530
|
-
}
|
|
531
|
-
}
|
|
532
|
-
catch (e) {
|
|
533
|
-
}
|
|
534
|
-
}
|
|
535
|
-
}
|
|
536
427
|
function normalizeJsName(name) {
|
|
537
428
|
var value = name;
|
|
538
429
|
if (value && isString(value)) {
|
|
@@ -787,7 +678,7 @@
|
|
|
787
678
|
return result;
|
|
788
679
|
}
|
|
789
680
|
function objDefineAccessors(target, prop, getProp, setProp) {
|
|
790
|
-
if (_objDefineProperty) {
|
|
681
|
+
if (_objDefineProperty$1) {
|
|
791
682
|
try {
|
|
792
683
|
var descriptor = {
|
|
793
684
|
enumerable: true,
|
|
@@ -799,7 +690,7 @@
|
|
|
799
690
|
if (setProp) {
|
|
800
691
|
descriptor.set = setProp;
|
|
801
692
|
}
|
|
802
|
-
_objDefineProperty(target, prop, descriptor);
|
|
693
|
+
_objDefineProperty$1(target, prop, descriptor);
|
|
803
694
|
return true;
|
|
804
695
|
}
|
|
805
696
|
catch (e) {
|
|
@@ -820,7 +711,7 @@
|
|
|
820
711
|
if (isError(object)) {
|
|
821
712
|
return object.name;
|
|
822
713
|
}
|
|
823
|
-
return
|
|
714
|
+
return strEmpty;
|
|
824
715
|
}
|
|
825
716
|
function setValue(target, field, value, valChk, srcChk) {
|
|
826
717
|
var theValue = value;
|
|
@@ -937,6 +828,17 @@
|
|
|
937
828
|
return class_1;
|
|
938
829
|
}());
|
|
939
830
|
}
|
|
831
|
+
function createEnumStyle(values) {
|
|
832
|
+
var enumClass = {};
|
|
833
|
+
objForEachKey(values, function (field, value) {
|
|
834
|
+
enumClass[field] = value;
|
|
835
|
+
if (!isUndefined(enumClass[value])) {
|
|
836
|
+
throwError("Value: [" + value + "] already exists for " + field);
|
|
837
|
+
}
|
|
838
|
+
enumClass[value] = field;
|
|
839
|
+
});
|
|
840
|
+
return objFreeze(enumClass);
|
|
841
|
+
}
|
|
940
842
|
function optimizeObject(theObject) {
|
|
941
843
|
if (theObject && ObjAssign) {
|
|
942
844
|
theObject = ObjClass(ObjAssign({}, theObject));
|
|
@@ -1129,7 +1031,7 @@
|
|
|
1129
1031
|
var nav = getNavigator();
|
|
1130
1032
|
if (nav && (nav.userAgent !== _navUserAgentCheck || _isTrident === null)) {
|
|
1131
1033
|
_navUserAgentCheck = nav.userAgent;
|
|
1132
|
-
var userAgent = (_navUserAgentCheck ||
|
|
1034
|
+
var userAgent = (_navUserAgentCheck || strEmpty).toLowerCase();
|
|
1133
1035
|
_isTrident = (strContains(userAgent, strMsie) || strContains(userAgent, strTrident));
|
|
1134
1036
|
}
|
|
1135
1037
|
return _isTrident;
|
|
@@ -1138,9 +1040,9 @@
|
|
|
1138
1040
|
if (userAgentStr === void 0) { userAgentStr = null; }
|
|
1139
1041
|
if (!userAgentStr) {
|
|
1140
1042
|
var navigator_1 = getNavigator() || {};
|
|
1141
|
-
userAgentStr = navigator_1 ? (navigator_1.userAgent ||
|
|
1043
|
+
userAgentStr = navigator_1 ? (navigator_1.userAgent || strEmpty).toLowerCase() : strEmpty;
|
|
1142
1044
|
}
|
|
1143
|
-
var ua = (userAgentStr ||
|
|
1045
|
+
var ua = (userAgentStr || strEmpty).toLowerCase();
|
|
1144
1046
|
if (strContains(ua, strMsie)) {
|
|
1145
1047
|
var doc = getDocument() || {};
|
|
1146
1048
|
return Math.max(parseInt(ua.split(strMsie)[1]), (doc[strDocumentMode] || 0));
|
|
@@ -1155,7 +1057,7 @@
|
|
|
1155
1057
|
}
|
|
1156
1058
|
function dumpObj(object) {
|
|
1157
1059
|
var objectTypeDump = Object[strShimPrototype].toString.call(object);
|
|
1158
|
-
var propertyValueDump =
|
|
1060
|
+
var propertyValueDump = strEmpty;
|
|
1159
1061
|
if (objectTypeDump === "[object Error]") {
|
|
1160
1062
|
propertyValueDump = "{ stack: '" + object.stack + "', message: '" + object.message + "', name: '" + object.name + "'";
|
|
1161
1063
|
}
|
|
@@ -1167,9 +1069,9 @@
|
|
|
1167
1069
|
function isSafari(userAgentStr) {
|
|
1168
1070
|
if (!userAgentStr || !isString(userAgentStr)) {
|
|
1169
1071
|
var navigator_2 = getNavigator() || {};
|
|
1170
|
-
userAgentStr = navigator_2 ? (navigator_2.userAgent ||
|
|
1072
|
+
userAgentStr = navigator_2 ? (navigator_2.userAgent || strEmpty).toLowerCase() : strEmpty;
|
|
1171
1073
|
}
|
|
1172
|
-
var ua = (userAgentStr ||
|
|
1074
|
+
var ua = (userAgentStr || strEmpty).toLowerCase();
|
|
1173
1075
|
return (ua.indexOf("safari") >= 0);
|
|
1174
1076
|
}
|
|
1175
1077
|
function isBeaconsSupported() {
|
|
@@ -1257,9 +1159,9 @@
|
|
|
1257
1159
|
var strWarnToConsole = "warnToConsole";
|
|
1258
1160
|
function _sanitizeDiagnosticText(text) {
|
|
1259
1161
|
if (text) {
|
|
1260
|
-
return "\"" + text.replace(/\"/g,
|
|
1162
|
+
return "\"" + text.replace(/\"/g, strEmpty) + "\"";
|
|
1261
1163
|
}
|
|
1262
|
-
return
|
|
1164
|
+
return strEmpty;
|
|
1263
1165
|
}
|
|
1264
1166
|
function _logToConsole(func, message) {
|
|
1265
1167
|
var theConsole = getConsole();
|
|
@@ -1281,12 +1183,12 @@
|
|
|
1281
1183
|
_self.message =
|
|
1282
1184
|
(isUserAct ? AiUserActionablePrefix : AiNonUserActionablePrefix) +
|
|
1283
1185
|
msgId;
|
|
1284
|
-
var strProps =
|
|
1186
|
+
var strProps = strEmpty;
|
|
1285
1187
|
if (hasJSON()) {
|
|
1286
1188
|
strProps = getJSON().stringify(properties);
|
|
1287
1189
|
}
|
|
1288
|
-
var diagnosticText = (msg ? " message:" + _sanitizeDiagnosticText(msg) :
|
|
1289
|
-
(properties ? " props:" + _sanitizeDiagnosticText(strProps) :
|
|
1190
|
+
var diagnosticText = (msg ? " message:" + _sanitizeDiagnosticText(msg) : strEmpty) +
|
|
1191
|
+
(properties ? " props:" + _sanitizeDiagnosticText(strProps) : strEmpty);
|
|
1290
1192
|
_self.message += diagnosticText;
|
|
1291
1193
|
}
|
|
1292
1194
|
_InternalLogMessage.dataType = "MessageData";
|
|
@@ -1316,7 +1218,7 @@
|
|
|
1316
1218
|
throw message;
|
|
1317
1219
|
}
|
|
1318
1220
|
else {
|
|
1319
|
-
var logFunc = severity ===
|
|
1221
|
+
var logFunc = severity === 1 ? strErrorToConsole : strWarnToConsole;
|
|
1320
1222
|
if (!isUndefined(message.message)) {
|
|
1321
1223
|
var logLevel = _self.consoleLoggingLevel();
|
|
1322
1224
|
if (isUserAct) {
|
|
@@ -1334,7 +1236,7 @@
|
|
|
1334
1236
|
_self.logInternalMessage(severity, message);
|
|
1335
1237
|
}
|
|
1336
1238
|
else {
|
|
1337
|
-
_debugExtMsg("throw" + (severity ===
|
|
1239
|
+
_debugExtMsg("throw" + (severity === 1 ? "Critical" : "Warning"), message);
|
|
1338
1240
|
}
|
|
1339
1241
|
}
|
|
1340
1242
|
};
|
|
@@ -1366,13 +1268,13 @@
|
|
|
1366
1268
|
if (severity <= _self.telemetryLoggingLevel()) {
|
|
1367
1269
|
_self.queue.push(message);
|
|
1368
1270
|
_messageCount++;
|
|
1369
|
-
_debugExtMsg((severity ===
|
|
1271
|
+
_debugExtMsg((severity === 1 ? "error" : "warn"), message);
|
|
1370
1272
|
}
|
|
1371
1273
|
if (_messageCount === _self.maxInternalMessageLimit()) {
|
|
1372
1274
|
var throttleLimitMessage = "Internal events throttle limit per PageView reached for this app.";
|
|
1373
|
-
var throttleMessage = new _InternalLogMessage(
|
|
1275
|
+
var throttleMessage = new _InternalLogMessage(23 , throttleLimitMessage, false);
|
|
1374
1276
|
_self.queue.push(throttleMessage);
|
|
1375
|
-
if (severity ===
|
|
1277
|
+
if (severity === 1 ) {
|
|
1376
1278
|
_self.errorToConsole(throttleLimitMessage);
|
|
1377
1279
|
}
|
|
1378
1280
|
else {
|
|
@@ -1549,6 +1451,217 @@
|
|
|
1549
1451
|
return _defaultPerfManager;
|
|
1550
1452
|
}
|
|
1551
1453
|
|
|
1454
|
+
var UInt32Mask = 0x100000000;
|
|
1455
|
+
var MaxUInt32 = 0xffffffff;
|
|
1456
|
+
var _mwcSeeded = false;
|
|
1457
|
+
var _mwcW = 123456789;
|
|
1458
|
+
var _mwcZ = 987654321;
|
|
1459
|
+
function _mwcSeed(seedValue) {
|
|
1460
|
+
if (seedValue < 0) {
|
|
1461
|
+
seedValue >>>= 0;
|
|
1462
|
+
}
|
|
1463
|
+
_mwcW = (123456789 + seedValue) & MaxUInt32;
|
|
1464
|
+
_mwcZ = (987654321 - seedValue) & MaxUInt32;
|
|
1465
|
+
_mwcSeeded = true;
|
|
1466
|
+
}
|
|
1467
|
+
function _autoSeedMwc() {
|
|
1468
|
+
try {
|
|
1469
|
+
var now = dateNow() & 0x7fffffff;
|
|
1470
|
+
_mwcSeed(((Math.random() * UInt32Mask) ^ now) + now);
|
|
1471
|
+
}
|
|
1472
|
+
catch (e) {
|
|
1473
|
+
}
|
|
1474
|
+
}
|
|
1475
|
+
function randomValue(maxValue) {
|
|
1476
|
+
if (maxValue > 0) {
|
|
1477
|
+
return Math.floor((random32() / MaxUInt32) * (maxValue + 1)) >>> 0;
|
|
1478
|
+
}
|
|
1479
|
+
return 0;
|
|
1480
|
+
}
|
|
1481
|
+
function random32(signed) {
|
|
1482
|
+
var value = 0;
|
|
1483
|
+
var c = getCrypto() || getMsCrypto();
|
|
1484
|
+
if (c && c.getRandomValues) {
|
|
1485
|
+
value = c.getRandomValues(new Uint32Array(1))[0] & MaxUInt32;
|
|
1486
|
+
}
|
|
1487
|
+
if (value === 0 && isIE()) {
|
|
1488
|
+
if (!_mwcSeeded) {
|
|
1489
|
+
_autoSeedMwc();
|
|
1490
|
+
}
|
|
1491
|
+
value = mwcRandom32() & MaxUInt32;
|
|
1492
|
+
}
|
|
1493
|
+
if (value === 0) {
|
|
1494
|
+
value = Math.floor((UInt32Mask * Math.random()) | 0);
|
|
1495
|
+
}
|
|
1496
|
+
if (!signed) {
|
|
1497
|
+
value >>>= 0;
|
|
1498
|
+
}
|
|
1499
|
+
return value;
|
|
1500
|
+
}
|
|
1501
|
+
function mwcRandomSeed(value) {
|
|
1502
|
+
if (!value) {
|
|
1503
|
+
_autoSeedMwc();
|
|
1504
|
+
}
|
|
1505
|
+
else {
|
|
1506
|
+
_mwcSeed(value);
|
|
1507
|
+
}
|
|
1508
|
+
}
|
|
1509
|
+
function mwcRandom32(signed) {
|
|
1510
|
+
_mwcZ = (36969 * (_mwcZ & 0xFFFF) + (_mwcZ >> 16)) & MaxUInt32;
|
|
1511
|
+
_mwcW = (18000 * (_mwcW & 0xFFFF) + (_mwcW >> 16)) & MaxUInt32;
|
|
1512
|
+
var value = (((_mwcZ << 16) + (_mwcW & 0xFFFF)) >>> 0) & MaxUInt32 | 0;
|
|
1513
|
+
if (!signed) {
|
|
1514
|
+
value >>>= 0;
|
|
1515
|
+
}
|
|
1516
|
+
return value;
|
|
1517
|
+
}
|
|
1518
|
+
function newId(maxLength) {
|
|
1519
|
+
if (maxLength === void 0) { maxLength = 22; }
|
|
1520
|
+
var base64chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
1521
|
+
var number = random32() >>> 0;
|
|
1522
|
+
var chars = 0;
|
|
1523
|
+
var result = strEmpty;
|
|
1524
|
+
while (result.length < maxLength) {
|
|
1525
|
+
chars++;
|
|
1526
|
+
result += base64chars.charAt(number & 0x3F);
|
|
1527
|
+
number >>>= 6;
|
|
1528
|
+
if (chars === 5) {
|
|
1529
|
+
number = (((random32() << 2) & 0xFFFFFFFF) | (number & 0x03)) >>> 0;
|
|
1530
|
+
chars = 0;
|
|
1531
|
+
}
|
|
1532
|
+
}
|
|
1533
|
+
return result;
|
|
1534
|
+
}
|
|
1535
|
+
|
|
1536
|
+
var _objDefineProperty = ObjDefineProperty;
|
|
1537
|
+
var version = "2.7.3";
|
|
1538
|
+
var instanceName = "." + newId(6);
|
|
1539
|
+
var _dataUid = 0;
|
|
1540
|
+
function _createAccessor(target, prop, value) {
|
|
1541
|
+
if (_objDefineProperty) {
|
|
1542
|
+
try {
|
|
1543
|
+
_objDefineProperty(target, prop, {
|
|
1544
|
+
value: value,
|
|
1545
|
+
enumerable: false,
|
|
1546
|
+
configurable: true
|
|
1547
|
+
});
|
|
1548
|
+
return true;
|
|
1549
|
+
}
|
|
1550
|
+
catch (e) {
|
|
1551
|
+
}
|
|
1552
|
+
}
|
|
1553
|
+
return false;
|
|
1554
|
+
}
|
|
1555
|
+
function _canAcceptData(target) {
|
|
1556
|
+
return target.nodeType === 1 || target.nodeType === 9 || !(+target.nodeType);
|
|
1557
|
+
}
|
|
1558
|
+
function _getCache(data, target) {
|
|
1559
|
+
var theCache = target[data.id];
|
|
1560
|
+
if (!theCache) {
|
|
1561
|
+
theCache = {};
|
|
1562
|
+
try {
|
|
1563
|
+
if (_canAcceptData(target)) {
|
|
1564
|
+
if (!_createAccessor(target, data.id, theCache)) {
|
|
1565
|
+
target[data.id] = theCache;
|
|
1566
|
+
}
|
|
1567
|
+
}
|
|
1568
|
+
}
|
|
1569
|
+
catch (e) {
|
|
1570
|
+
}
|
|
1571
|
+
}
|
|
1572
|
+
return theCache;
|
|
1573
|
+
}
|
|
1574
|
+
function createUniqueNamespace(name, includeVersion) {
|
|
1575
|
+
if (includeVersion === void 0) { includeVersion = false; }
|
|
1576
|
+
return normalizeJsName(name + (_dataUid++) + (includeVersion ? "." + version : "") + instanceName);
|
|
1577
|
+
}
|
|
1578
|
+
function createElmNodeData(name) {
|
|
1579
|
+
var data = {
|
|
1580
|
+
id: createUniqueNamespace("_aiData-" + (name || "") + "." + version),
|
|
1581
|
+
accept: function (target) {
|
|
1582
|
+
return _canAcceptData(target);
|
|
1583
|
+
},
|
|
1584
|
+
get: function (target, name, defValue, addDefault) {
|
|
1585
|
+
var theCache = target[data.id];
|
|
1586
|
+
if (!theCache) {
|
|
1587
|
+
if (addDefault) {
|
|
1588
|
+
theCache = _getCache(data, target);
|
|
1589
|
+
theCache[normalizeJsName(name)] = defValue;
|
|
1590
|
+
}
|
|
1591
|
+
return defValue;
|
|
1592
|
+
}
|
|
1593
|
+
return theCache[normalizeJsName(name)];
|
|
1594
|
+
},
|
|
1595
|
+
kill: function (target, name) {
|
|
1596
|
+
if (target && target[name]) {
|
|
1597
|
+
try {
|
|
1598
|
+
delete target[name];
|
|
1599
|
+
}
|
|
1600
|
+
catch (e) {
|
|
1601
|
+
}
|
|
1602
|
+
}
|
|
1603
|
+
}
|
|
1604
|
+
};
|
|
1605
|
+
return data;
|
|
1606
|
+
}
|
|
1607
|
+
|
|
1608
|
+
var pluginStateData = createElmNodeData("plugin");
|
|
1609
|
+
function _getPluginState(plugin) {
|
|
1610
|
+
return pluginStateData.get(plugin, "state", {}, true);
|
|
1611
|
+
}
|
|
1612
|
+
function initializePlugins(processContext, extensions) {
|
|
1613
|
+
var initPlugins = [];
|
|
1614
|
+
var lastPlugin = null;
|
|
1615
|
+
var proxy = processContext.getNext();
|
|
1616
|
+
var pluginState;
|
|
1617
|
+
while (proxy) {
|
|
1618
|
+
var thePlugin = proxy.getPlugin();
|
|
1619
|
+
if (thePlugin) {
|
|
1620
|
+
if (lastPlugin &&
|
|
1621
|
+
isFunction(lastPlugin[strSetNextPlugin]) &&
|
|
1622
|
+
isFunction(thePlugin[strProcessTelemetry])) {
|
|
1623
|
+
lastPlugin[strSetNextPlugin](thePlugin);
|
|
1624
|
+
}
|
|
1625
|
+
var isInitialized = false;
|
|
1626
|
+
if (isFunction(thePlugin[strIsInitialized])) {
|
|
1627
|
+
isInitialized = thePlugin[strIsInitialized]();
|
|
1628
|
+
}
|
|
1629
|
+
else {
|
|
1630
|
+
pluginState = _getPluginState(thePlugin);
|
|
1631
|
+
isInitialized = pluginState[strIsInitialized];
|
|
1632
|
+
}
|
|
1633
|
+
if (!isInitialized) {
|
|
1634
|
+
initPlugins.push(thePlugin);
|
|
1635
|
+
}
|
|
1636
|
+
lastPlugin = thePlugin;
|
|
1637
|
+
proxy = proxy.getNext();
|
|
1638
|
+
}
|
|
1639
|
+
}
|
|
1640
|
+
arrForEach(initPlugins, function (thePlugin) {
|
|
1641
|
+
var core = processContext.core();
|
|
1642
|
+
thePlugin.initialize(processContext.getCfg(), core, extensions, processContext.getNext());
|
|
1643
|
+
pluginState = _getPluginState(thePlugin);
|
|
1644
|
+
if (!thePlugin[strCore] && !pluginState[strCore]) {
|
|
1645
|
+
pluginState[strCore] = core;
|
|
1646
|
+
}
|
|
1647
|
+
pluginState[strIsInitialized] = true;
|
|
1648
|
+
delete pluginState[strTeardown];
|
|
1649
|
+
});
|
|
1650
|
+
}
|
|
1651
|
+
function sortPlugins(plugins) {
|
|
1652
|
+
return plugins.sort(function (extA, extB) {
|
|
1653
|
+
var result = 0;
|
|
1654
|
+
var bHasProcess = isFunction(extB[strProcessTelemetry]);
|
|
1655
|
+
if (isFunction(extA[strProcessTelemetry])) {
|
|
1656
|
+
result = bHasProcess ? extA[strPriority] - extB[strPriority] : 1;
|
|
1657
|
+
}
|
|
1658
|
+
else if (bHasProcess) {
|
|
1659
|
+
result = -1;
|
|
1660
|
+
}
|
|
1661
|
+
return result;
|
|
1662
|
+
});
|
|
1663
|
+
}
|
|
1664
|
+
|
|
1552
1665
|
var strTelemetryPluginChain = "TelemetryPluginChain";
|
|
1553
1666
|
var strHasRunFlags = "_hasRun";
|
|
1554
1667
|
var strGetTelCtx = "_getTelCtx";
|
|
@@ -1562,53 +1675,66 @@
|
|
|
1562
1675
|
}
|
|
1563
1676
|
return createTelemetryProxyChain([startAt], config, core);
|
|
1564
1677
|
}
|
|
1565
|
-
function
|
|
1566
|
-
var _nextProxy =
|
|
1567
|
-
var _onComplete =
|
|
1568
|
-
if (startAt) {
|
|
1569
|
-
_nextProxy = _getNextProxyStart(telemetryChain, config, core, startAt);
|
|
1570
|
-
}
|
|
1571
|
-
else {
|
|
1572
|
-
_nextProxy = telemetryChain;
|
|
1573
|
-
}
|
|
1678
|
+
function _createInternalContext(telemetryChain, config, core, startAt) {
|
|
1679
|
+
var _nextProxy = startAt ? _getNextProxyStart(telemetryChain, config, core, startAt) : telemetryChain;
|
|
1680
|
+
var _onComplete = [];
|
|
1574
1681
|
var context = {
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1682
|
+
_next: _moveNext,
|
|
1683
|
+
ctx: {
|
|
1684
|
+
core: function () { return core; },
|
|
1685
|
+
diagLog: function () {
|
|
1686
|
+
return safeGetLogger(core, config);
|
|
1687
|
+
},
|
|
1688
|
+
getCfg: function () {
|
|
1689
|
+
return config;
|
|
1690
|
+
},
|
|
1691
|
+
getExtCfg: _getExtCfg,
|
|
1692
|
+
getConfig: _getConfig,
|
|
1693
|
+
hasNext: function () {
|
|
1694
|
+
return !!_nextProxy;
|
|
1695
|
+
},
|
|
1696
|
+
getNext: function () {
|
|
1697
|
+
return _nextProxy;
|
|
1698
|
+
},
|
|
1699
|
+
setNext: function (nextPlugin) {
|
|
1700
|
+
_nextProxy = nextPlugin;
|
|
1701
|
+
},
|
|
1702
|
+
iterate: _iterateChain,
|
|
1703
|
+
onComplete: _addOnComplete
|
|
1704
|
+
}
|
|
1705
|
+
};
|
|
1706
|
+
function _addOnComplete(onComplete, that) {
|
|
1707
|
+
var args = [];
|
|
1708
|
+
for (var _i = 2; _i < arguments.length; _i++) {
|
|
1709
|
+
args[_i - 2] = arguments[_i];
|
|
1710
|
+
}
|
|
1711
|
+
if (onComplete) {
|
|
1712
|
+
_onComplete.push({
|
|
1713
|
+
func: onComplete,
|
|
1714
|
+
self: !isUndefined(that) ? that : context.ctx,
|
|
1715
|
+
args: args
|
|
1598
1716
|
});
|
|
1599
|
-
}
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1717
|
+
}
|
|
1718
|
+
}
|
|
1719
|
+
function _moveNext() {
|
|
1720
|
+
var nextProxy = _nextProxy;
|
|
1721
|
+
_nextProxy = nextProxy ? nextProxy.getNext() : null;
|
|
1722
|
+
if (!nextProxy) {
|
|
1723
|
+
var onComplete = _onComplete;
|
|
1724
|
+
if (onComplete && onComplete.length > 0) {
|
|
1725
|
+
arrForEach(onComplete, function (completeDetails) {
|
|
1726
|
+
try {
|
|
1727
|
+
completeDetails.func.call(completeDetails.self, completeDetails.args);
|
|
1728
|
+
}
|
|
1729
|
+
catch (e) {
|
|
1730
|
+
core.logger.throwInternal(2 , 73 , "Unexpected Exception during onComplete - " + dumpObj(e));
|
|
1731
|
+
}
|
|
1732
|
+
});
|
|
1733
|
+
_onComplete = [];
|
|
1605
1734
|
}
|
|
1606
|
-
return createProcessTelemetryContext(plugins || _nextProxy, config, core, startAt);
|
|
1607
|
-
},
|
|
1608
|
-
onComplete: function (onComplete) {
|
|
1609
|
-
_onComplete = onComplete;
|
|
1610
1735
|
}
|
|
1611
|
-
|
|
1736
|
+
return nextProxy;
|
|
1737
|
+
}
|
|
1612
1738
|
function _getExtCfg(identifier, defaultValue, mergeDefault) {
|
|
1613
1739
|
if (defaultValue === void 0) { defaultValue = {}; }
|
|
1614
1740
|
if (mergeDefault === void 0) { mergeDefault = 0 ; }
|
|
@@ -1651,29 +1777,53 @@
|
|
|
1651
1777
|
}
|
|
1652
1778
|
return !isNullOrUndefined(theValue) ? theValue : defaultValue;
|
|
1653
1779
|
}
|
|
1654
|
-
function
|
|
1655
|
-
var nextPlugin
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
else {
|
|
1661
|
-
if (_onComplete) {
|
|
1662
|
-
_onComplete();
|
|
1663
|
-
_onComplete = null;
|
|
1780
|
+
function _iterateChain(cb) {
|
|
1781
|
+
var nextPlugin;
|
|
1782
|
+
while (!!(nextPlugin = context._next())) {
|
|
1783
|
+
var plugin = nextPlugin.getPlugin();
|
|
1784
|
+
if (plugin) {
|
|
1785
|
+
cb(plugin);
|
|
1664
1786
|
}
|
|
1665
1787
|
}
|
|
1666
1788
|
}
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1789
|
+
return context;
|
|
1790
|
+
}
|
|
1791
|
+
function createProcessTelemetryContext(telemetryChain, config, core, startAt) {
|
|
1792
|
+
var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
|
|
1793
|
+
var context = internalContext.ctx;
|
|
1794
|
+
function _processNext(env) {
|
|
1795
|
+
var nextPlugin = internalContext._next();
|
|
1796
|
+
nextPlugin && nextPlugin.processTelemetry(env, context);
|
|
1797
|
+
return !nextPlugin;
|
|
1798
|
+
}
|
|
1799
|
+
function _createNew(plugins, startAt) {
|
|
1800
|
+
if (plugins === void 0) { plugins = null; }
|
|
1801
|
+
if (isArray(plugins)) {
|
|
1802
|
+
plugins = createTelemetryProxyChain(plugins, config, core, startAt);
|
|
1803
|
+
}
|
|
1804
|
+
return createProcessTelemetryContext(plugins || context.getNext(), config, core, startAt);
|
|
1805
|
+
}
|
|
1806
|
+
context.processNext = _processNext;
|
|
1807
|
+
context.createNew = _createNew;
|
|
1808
|
+
return context;
|
|
1809
|
+
}
|
|
1810
|
+
function createProcessTelemetryUnloadContext(telemetryChain, config, core, startAt) {
|
|
1811
|
+
var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
|
|
1812
|
+
var context = internalContext.ctx;
|
|
1813
|
+
function _processNext(unloadState) {
|
|
1814
|
+
var nextPlugin = internalContext._next();
|
|
1815
|
+
nextPlugin && nextPlugin.unload(context, unloadState);
|
|
1816
|
+
return !nextPlugin;
|
|
1817
|
+
}
|
|
1818
|
+
function _createNew(plugins, startAt) {
|
|
1819
|
+
if (plugins === void 0) { plugins = null; }
|
|
1820
|
+
if (isArray(plugins)) {
|
|
1821
|
+
plugins = createTelemetryProxyChain(plugins, config, core, startAt);
|
|
1675
1822
|
}
|
|
1823
|
+
return createProcessTelemetryUnloadContext(plugins || context.getNext(), config, core, startAt);
|
|
1676
1824
|
}
|
|
1825
|
+
context.processNext = _processNext;
|
|
1826
|
+
context.createNew = _createNew;
|
|
1677
1827
|
return context;
|
|
1678
1828
|
}
|
|
1679
1829
|
function createTelemetryProxyChain(plugins, config, core, startAt) {
|
|
@@ -1721,32 +1871,35 @@
|
|
|
1721
1871
|
return nextProxy;
|
|
1722
1872
|
},
|
|
1723
1873
|
processTelemetry: _processTelemetry,
|
|
1874
|
+
unload: _unloadPlugin,
|
|
1724
1875
|
_id: chainId,
|
|
1725
1876
|
_setNext: function (nextPlugin) {
|
|
1726
1877
|
nextProxy = nextPlugin;
|
|
1727
1878
|
}
|
|
1728
1879
|
};
|
|
1729
|
-
function
|
|
1880
|
+
function _getTelCtx() {
|
|
1881
|
+
var itemCtx;
|
|
1882
|
+
if (plugin && isFunction(plugin[strGetTelCtx])) {
|
|
1883
|
+
itemCtx = plugin[strGetTelCtx]();
|
|
1884
|
+
}
|
|
1730
1885
|
if (!itemCtx) {
|
|
1731
|
-
|
|
1732
|
-
itemCtx = plugin[strGetTelCtx]();
|
|
1733
|
-
}
|
|
1734
|
-
if (!itemCtx) {
|
|
1735
|
-
itemCtx = createProcessTelemetryContext(proxyChain, config, core);
|
|
1736
|
-
}
|
|
1886
|
+
itemCtx = createProcessTelemetryContext(proxyChain, config, core);
|
|
1737
1887
|
}
|
|
1888
|
+
return itemCtx;
|
|
1889
|
+
}
|
|
1890
|
+
function _processChain(itemCtx, processPluginFn, name, details, isAsync) {
|
|
1891
|
+
var hasRun = false;
|
|
1738
1892
|
var identifier = plugin ? plugin.identifier : strTelemetryPluginChain;
|
|
1739
1893
|
var hasRunContext = itemCtx[strHasRunFlags];
|
|
1740
1894
|
if (!hasRunContext) {
|
|
1741
1895
|
hasRunContext = itemCtx[strHasRunFlags] = {};
|
|
1742
1896
|
}
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
if (plugin) {
|
|
1897
|
+
itemCtx.setNext(nextProxy);
|
|
1898
|
+
if (plugin) {
|
|
1899
|
+
doPerf(itemCtx[strCore](), function () { return identifier + ":" + name; }, function () {
|
|
1900
|
+
hasRunContext[chainId] = true;
|
|
1748
1901
|
try {
|
|
1749
|
-
var nextId = nextProxy ? nextProxy._id :
|
|
1902
|
+
var nextId = nextProxy ? nextProxy._id : strEmpty;
|
|
1750
1903
|
if (nextId) {
|
|
1751
1904
|
hasRunContext[nextId] = false;
|
|
1752
1905
|
}
|
|
@@ -1758,18 +1911,21 @@
|
|
|
1758
1911
|
hasRun = true;
|
|
1759
1912
|
}
|
|
1760
1913
|
if (!nextProxy || !hasNextRun) {
|
|
1761
|
-
itemCtx.diagLog().throwInternal(
|
|
1914
|
+
itemCtx.diagLog().throwInternal(1 , 73 , "Plugin [" + plugin.identifier + "] failed during " + name + " - " + dumpObj(error) + ", run flags: " + dumpObj(hasRunContext));
|
|
1762
1915
|
}
|
|
1763
1916
|
}
|
|
1764
|
-
}
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
}
|
|
1768
|
-
}, details, isAsync);
|
|
1917
|
+
}, details, isAsync);
|
|
1918
|
+
}
|
|
1919
|
+
return hasRun;
|
|
1769
1920
|
}
|
|
1770
1921
|
function _processTelemetry(env, itemCtx) {
|
|
1771
|
-
|
|
1772
|
-
|
|
1922
|
+
itemCtx = itemCtx || _getTelCtx();
|
|
1923
|
+
function _callProcessTelemetry(itemCtx) {
|
|
1924
|
+
if (!plugin || !hasProcessTelemetry) {
|
|
1925
|
+
return false;
|
|
1926
|
+
}
|
|
1927
|
+
var pluginState = _getPluginState(plugin);
|
|
1928
|
+
if (pluginState[strTeardown] || pluginState[strDisabled]) {
|
|
1773
1929
|
return false;
|
|
1774
1930
|
}
|
|
1775
1931
|
if (hasSetNext) {
|
|
@@ -1777,9 +1933,31 @@
|
|
|
1777
1933
|
}
|
|
1778
1934
|
plugin.processTelemetry(env, itemCtx);
|
|
1779
1935
|
return true;
|
|
1780
|
-
}
|
|
1781
|
-
|
|
1782
|
-
|
|
1936
|
+
}
|
|
1937
|
+
if (!_processChain(itemCtx, _callProcessTelemetry, "processTelemetry", function () { return ({ item: env }); }, !(env.sync))) {
|
|
1938
|
+
itemCtx.processNext(env);
|
|
1939
|
+
}
|
|
1940
|
+
}
|
|
1941
|
+
function _unloadPlugin(unloadCtx, unloadState) {
|
|
1942
|
+
function _callTeardown() {
|
|
1943
|
+
var hasRun = false;
|
|
1944
|
+
if (plugin) {
|
|
1945
|
+
var pluginState = _getPluginState(plugin);
|
|
1946
|
+
var pluginCore = plugin[strCore] || pluginState.core;
|
|
1947
|
+
if (plugin && (!pluginCore || pluginCore === unloadCtx[strCore]()) && !pluginState[strTeardown]) {
|
|
1948
|
+
pluginState[strCore] = null;
|
|
1949
|
+
pluginState[strTeardown] = true;
|
|
1950
|
+
pluginState[strIsInitialized] = false;
|
|
1951
|
+
if (plugin[strTeardown] && plugin[strTeardown](unloadCtx, unloadState) === true) {
|
|
1952
|
+
hasRun = true;
|
|
1953
|
+
}
|
|
1954
|
+
}
|
|
1955
|
+
}
|
|
1956
|
+
return hasRun;
|
|
1957
|
+
}
|
|
1958
|
+
if (!_processChain(unloadCtx, _callTeardown, "unload", function () { }, unloadState.isAsync)) {
|
|
1959
|
+
unloadCtx.processNext(unloadState);
|
|
1960
|
+
}
|
|
1783
1961
|
}
|
|
1784
1962
|
return objFreeze(proxyChain);
|
|
1785
1963
|
}
|
|
@@ -1792,47 +1970,6 @@
|
|
|
1792
1970
|
return ProcessTelemetryContext;
|
|
1793
1971
|
}());
|
|
1794
1972
|
|
|
1795
|
-
var processTelemetry = "processTelemetry";
|
|
1796
|
-
var priority = "priority";
|
|
1797
|
-
var setNextPlugin = "setNextPlugin";
|
|
1798
|
-
var isInitialized = "isInitialized";
|
|
1799
|
-
function initializePlugins(processContext, extensions) {
|
|
1800
|
-
var initPlugins = [];
|
|
1801
|
-
var lastPlugin = null;
|
|
1802
|
-
var proxy = processContext.getNext();
|
|
1803
|
-
while (proxy) {
|
|
1804
|
-
var thePlugin = proxy.getPlugin();
|
|
1805
|
-
if (thePlugin) {
|
|
1806
|
-
if (lastPlugin &&
|
|
1807
|
-
isFunction(lastPlugin[setNextPlugin]) &&
|
|
1808
|
-
isFunction(thePlugin[processTelemetry])) {
|
|
1809
|
-
lastPlugin[setNextPlugin](thePlugin);
|
|
1810
|
-
}
|
|
1811
|
-
if (!isFunction(thePlugin[isInitialized]) || !thePlugin[isInitialized]()) {
|
|
1812
|
-
initPlugins.push(thePlugin);
|
|
1813
|
-
}
|
|
1814
|
-
lastPlugin = thePlugin;
|
|
1815
|
-
proxy = proxy.getNext();
|
|
1816
|
-
}
|
|
1817
|
-
}
|
|
1818
|
-
arrForEach(initPlugins, function (thePlugin) {
|
|
1819
|
-
thePlugin.initialize(processContext.getCfg(), processContext.core(), extensions, processContext.getNext());
|
|
1820
|
-
});
|
|
1821
|
-
}
|
|
1822
|
-
function sortPlugins(plugins) {
|
|
1823
|
-
return plugins.sort(function (extA, extB) {
|
|
1824
|
-
var result = 0;
|
|
1825
|
-
var bHasProcess = isFunction(extB[processTelemetry]);
|
|
1826
|
-
if (isFunction(extA[processTelemetry])) {
|
|
1827
|
-
result = bHasProcess ? extA[priority] - extB[priority] : 1;
|
|
1828
|
-
}
|
|
1829
|
-
else if (bHasProcess) {
|
|
1830
|
-
result = -1;
|
|
1831
|
-
}
|
|
1832
|
-
return result;
|
|
1833
|
-
});
|
|
1834
|
-
}
|
|
1835
|
-
|
|
1836
1973
|
var strToGMTString = "toGMTString";
|
|
1837
1974
|
var strToUTCString = "toUTCString";
|
|
1838
1975
|
var strCookie = "cookie";
|
|
@@ -1841,7 +1978,6 @@
|
|
|
1841
1978
|
var strIsCookieUseDisabled = "isCookieUseDisabled";
|
|
1842
1979
|
var strDisableCookiesUsage = "disableCookiesUsage";
|
|
1843
1980
|
var strConfigCookieMgr = "_ckMgr";
|
|
1844
|
-
var strEmpty = "";
|
|
1845
1981
|
var _supportsCookies = null;
|
|
1846
1982
|
var _allowUaSameSite = null;
|
|
1847
1983
|
var _parsedCookieValue = null;
|
|
@@ -2000,7 +2136,7 @@
|
|
|
2000
2136
|
_supportsCookies = doc[strCookie] !== undefined;
|
|
2001
2137
|
}
|
|
2002
2138
|
catch (e) {
|
|
2003
|
-
logger && logger.throwInternal(
|
|
2139
|
+
logger && logger.throwInternal(2 , 68 , "Cannot access document.cookie - " + getExceptionName(e), { exception: dumpObj(e) });
|
|
2004
2140
|
}
|
|
2005
2141
|
}
|
|
2006
2142
|
return _supportsCookies;
|
|
@@ -2101,87 +2237,110 @@
|
|
|
2101
2237
|
}
|
|
2102
2238
|
}
|
|
2103
2239
|
function createChannelControllerPlugin(channelQueue, core) {
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2240
|
+
var _a;
|
|
2241
|
+
function _getTelCtx() {
|
|
2242
|
+
return createProcessTelemetryContext(null, core.config, core, null);
|
|
2243
|
+
}
|
|
2244
|
+
function _processChannelQueue(theChannels, itemCtx, processFn, onComplete) {
|
|
2245
|
+
var waiting = theChannels ? (theChannels.length + 1) : 1;
|
|
2246
|
+
function _runChainOnComplete() {
|
|
2247
|
+
waiting--;
|
|
2248
|
+
if (waiting === 0) {
|
|
2249
|
+
onComplete && onComplete();
|
|
2250
|
+
onComplete = null;
|
|
2251
|
+
}
|
|
2107
2252
|
}
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
function _processChannelQueue(itemCtx, processFn, onComplete) {
|
|
2111
|
-
if (channelQueue && channelQueue.length > 0) {
|
|
2112
|
-
var waiting_1 = channelQueue.length;
|
|
2113
|
-
arrForEach(channelQueue, function (channels) {
|
|
2253
|
+
if (waiting > 0) {
|
|
2254
|
+
arrForEach(theChannels, function (channels) {
|
|
2114
2255
|
if (channels && channels.queue.length > 0) {
|
|
2115
2256
|
var channelChain = channels.chain;
|
|
2116
|
-
var chainCtx =
|
|
2117
|
-
chainCtx.onComplete(
|
|
2118
|
-
waiting_1--;
|
|
2119
|
-
if (waiting_1 === 0) {
|
|
2120
|
-
onComplete && onComplete();
|
|
2121
|
-
onComplete = null;
|
|
2122
|
-
}
|
|
2123
|
-
});
|
|
2257
|
+
var chainCtx = itemCtx.createNew(channelChain);
|
|
2258
|
+
chainCtx.onComplete(_runChainOnComplete);
|
|
2124
2259
|
processFn(chainCtx);
|
|
2125
2260
|
}
|
|
2126
2261
|
else {
|
|
2127
|
-
|
|
2262
|
+
waiting--;
|
|
2128
2263
|
}
|
|
2129
2264
|
});
|
|
2130
|
-
if (waiting_1 === 0) {
|
|
2131
|
-
onComplete && onComplete();
|
|
2132
|
-
}
|
|
2133
|
-
}
|
|
2134
|
-
else {
|
|
2135
|
-
onComplete && onComplete();
|
|
2136
2265
|
}
|
|
2266
|
+
_runChainOnComplete();
|
|
2137
2267
|
}
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2268
|
+
function _doTeardown(unloadCtx, unloadState) {
|
|
2269
|
+
var theUnloadState = unloadState || {
|
|
2270
|
+
reason: 0 ,
|
|
2271
|
+
isAsync: false
|
|
2272
|
+
};
|
|
2273
|
+
_processChannelQueue(channelQueue, unloadCtx, function (chainCtx) {
|
|
2274
|
+
chainCtx[strProcessNext](theUnloadState);
|
|
2275
|
+
}, function () {
|
|
2276
|
+
unloadCtx[strProcessNext](theUnloadState);
|
|
2277
|
+
isInitialized = false;
|
|
2278
|
+
});
|
|
2279
|
+
return true;
|
|
2280
|
+
}
|
|
2281
|
+
function _getChannel(pluginIdentifier) {
|
|
2282
|
+
var thePlugin = null;
|
|
2283
|
+
if (channelQueue && channelQueue.length > 0) {
|
|
2144
2284
|
arrForEach(channelQueue, function (channels) {
|
|
2145
2285
|
if (channels && channels.queue.length > 0) {
|
|
2146
|
-
|
|
2286
|
+
arrForEach(channels.queue, function (ext) {
|
|
2287
|
+
if (ext.identifier === pluginIdentifier) {
|
|
2288
|
+
thePlugin = ext;
|
|
2289
|
+
return -1;
|
|
2290
|
+
}
|
|
2291
|
+
});
|
|
2292
|
+
if (thePlugin) {
|
|
2293
|
+
return -1;
|
|
2294
|
+
}
|
|
2147
2295
|
}
|
|
2148
2296
|
});
|
|
2149
|
-
}
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2297
|
+
}
|
|
2298
|
+
return thePlugin;
|
|
2299
|
+
}
|
|
2300
|
+
var isInitialized = false;
|
|
2301
|
+
var channelController = (_a = {
|
|
2302
|
+
identifier: "ChannelControllerPlugin",
|
|
2303
|
+
priority: ChannelControllerPriority,
|
|
2304
|
+
initialize: function (config, core, extensions, pluginChain) {
|
|
2305
|
+
isInitialized = true;
|
|
2306
|
+
arrForEach(channelQueue, function (channels) {
|
|
2307
|
+
if (channels && channels.queue.length > 0) {
|
|
2308
|
+
initializePlugins(createProcessTelemetryContext(channels.chain, config, core), extensions);
|
|
2309
|
+
}
|
|
2162
2310
|
});
|
|
2163
|
-
}
|
|
2311
|
+
},
|
|
2312
|
+
isInitialized: function () { return isInitialized; },
|
|
2313
|
+
processTelemetry: function (item, itemCtx) {
|
|
2314
|
+
_processChannelQueue(channelQueue, itemCtx || _getTelCtx(), function (chainCtx) {
|
|
2315
|
+
chainCtx[strProcessNext](item);
|
|
2316
|
+
}, function () {
|
|
2317
|
+
itemCtx[strProcessNext](item);
|
|
2318
|
+
});
|
|
2319
|
+
}
|
|
2164
2320
|
},
|
|
2165
|
-
|
|
2166
|
-
_processChannelQueue(
|
|
2321
|
+
_a[strPause] = function () {
|
|
2322
|
+
_processChannelQueue(channelQueue, _getTelCtx(), function (chainCtx) {
|
|
2167
2323
|
chainCtx.iterate(function (plugin) {
|
|
2168
|
-
plugin
|
|
2324
|
+
plugin[strPause] && plugin[strPause]();
|
|
2169
2325
|
});
|
|
2170
|
-
});
|
|
2326
|
+
}, null);
|
|
2171
2327
|
},
|
|
2172
|
-
|
|
2173
|
-
_processChannelQueue(
|
|
2328
|
+
_a[strResume] = function () {
|
|
2329
|
+
_processChannelQueue(channelQueue, _getTelCtx(), function (chainCtx) {
|
|
2174
2330
|
chainCtx.iterate(function (plugin) {
|
|
2175
|
-
plugin
|
|
2331
|
+
plugin[strResume] && plugin[strResume]();
|
|
2176
2332
|
});
|
|
2177
|
-
});
|
|
2333
|
+
}, null);
|
|
2178
2334
|
},
|
|
2179
|
-
|
|
2335
|
+
_a[strTeardown] = _doTeardown,
|
|
2336
|
+
_a.getChannel = _getChannel,
|
|
2337
|
+
_a.flush = function (isAsync, callBack, sendReason, cbTimeout) {
|
|
2338
|
+
var waiting = 1;
|
|
2180
2339
|
var doneIterating = false;
|
|
2181
|
-
var waiting = 0;
|
|
2182
2340
|
var cbTimer = null;
|
|
2183
2341
|
cbTimeout = cbTimeout || 5000;
|
|
2184
2342
|
function doCallback() {
|
|
2343
|
+
waiting--;
|
|
2185
2344
|
if (doneIterating && waiting === 0) {
|
|
2186
2345
|
if (cbTimer) {
|
|
2187
2346
|
clearTimeout(cbTimer);
|
|
@@ -2191,32 +2350,38 @@
|
|
|
2191
2350
|
callBack = null;
|
|
2192
2351
|
}
|
|
2193
2352
|
}
|
|
2194
|
-
|
|
2195
|
-
_processChannelQueue(null, function (chainCtx) {
|
|
2353
|
+
_processChannelQueue(channelQueue, _getTelCtx(), function (chainCtx) {
|
|
2196
2354
|
chainCtx.iterate(function (plugin) {
|
|
2197
2355
|
if (plugin.flush) {
|
|
2198
2356
|
waiting++;
|
|
2357
|
+
var handled_1 = false;
|
|
2199
2358
|
if (!plugin.flush(isAsync, function () {
|
|
2200
|
-
|
|
2359
|
+
handled_1 = true;
|
|
2201
2360
|
doCallback();
|
|
2202
2361
|
}, sendReason)) {
|
|
2203
|
-
if (
|
|
2204
|
-
cbTimer
|
|
2205
|
-
cbTimer =
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2362
|
+
if (!handled_1) {
|
|
2363
|
+
if (isAsync && cbTimer == null) {
|
|
2364
|
+
cbTimer = setTimeout(function () {
|
|
2365
|
+
cbTimer = null;
|
|
2366
|
+
doCallback();
|
|
2367
|
+
}, cbTimeout);
|
|
2368
|
+
}
|
|
2369
|
+
else {
|
|
2370
|
+
doCallback();
|
|
2371
|
+
}
|
|
2209
2372
|
}
|
|
2210
2373
|
}
|
|
2211
2374
|
}
|
|
2212
2375
|
});
|
|
2213
2376
|
}, function () {
|
|
2214
|
-
waiting--;
|
|
2215
2377
|
doneIterating = true;
|
|
2216
2378
|
doCallback();
|
|
2217
2379
|
});
|
|
2218
|
-
}
|
|
2219
|
-
|
|
2380
|
+
},
|
|
2381
|
+
_a._setQueue = function (queue) {
|
|
2382
|
+
channelQueue = queue;
|
|
2383
|
+
},
|
|
2384
|
+
_a);
|
|
2220
2385
|
return channelController;
|
|
2221
2386
|
}
|
|
2222
2387
|
function createChannelQueues(channels, extensions, config, core) {
|
|
@@ -2250,6 +2415,38 @@
|
|
|
2250
2415
|
_setDefaults(config, core, pluginChain);
|
|
2251
2416
|
_isinitialized = true;
|
|
2252
2417
|
};
|
|
2418
|
+
_self.teardown = function (unloadCtx, unloadState) {
|
|
2419
|
+
if (!_self.core || (unloadCtx && _self.core !== unloadCtx.core())) {
|
|
2420
|
+
return;
|
|
2421
|
+
}
|
|
2422
|
+
var result;
|
|
2423
|
+
var unloadDone = false;
|
|
2424
|
+
var theUnloadCtx = unloadCtx || createProcessTelemetryUnloadContext(null, {}, _self.core, _nextPlugin && _nextPlugin[strGetPlugin] ? _nextPlugin[strGetPlugin]() : _nextPlugin);
|
|
2425
|
+
var theUnloadState = unloadState || {
|
|
2426
|
+
reason: 0 ,
|
|
2427
|
+
isAsync: false
|
|
2428
|
+
};
|
|
2429
|
+
function _unloadCallback() {
|
|
2430
|
+
if (!unloadDone) {
|
|
2431
|
+
unloadDone = true;
|
|
2432
|
+
arrForEach(_hooks, function (fn) {
|
|
2433
|
+
fn.rm();
|
|
2434
|
+
});
|
|
2435
|
+
_hooks = [];
|
|
2436
|
+
if (result === true) {
|
|
2437
|
+
theUnloadCtx.processNext(theUnloadState);
|
|
2438
|
+
}
|
|
2439
|
+
_initDefaults();
|
|
2440
|
+
}
|
|
2441
|
+
}
|
|
2442
|
+
if (!_self[strDoTeardown] || _self[strDoTeardown](theUnloadCtx, theUnloadState, _unloadCallback) !== true) {
|
|
2443
|
+
_unloadCallback();
|
|
2444
|
+
}
|
|
2445
|
+
else {
|
|
2446
|
+
result = true;
|
|
2447
|
+
}
|
|
2448
|
+
return result;
|
|
2449
|
+
};
|
|
2253
2450
|
_self._addHook = function (hooks) {
|
|
2254
2451
|
if (hooks) {
|
|
2255
2452
|
if (isArray(hooks)) {
|
|
@@ -2264,13 +2461,13 @@
|
|
|
2264
2461
|
_self.diagLog = function (itemCtx) {
|
|
2265
2462
|
return _getTelCtx(itemCtx).diagLog();
|
|
2266
2463
|
};
|
|
2267
|
-
_self
|
|
2464
|
+
_self[strIsInitialized] = function () {
|
|
2268
2465
|
return _isinitialized;
|
|
2269
2466
|
};
|
|
2270
2467
|
_self.setInitialized = function (isInitialized) {
|
|
2271
2468
|
_isinitialized = isInitialized;
|
|
2272
2469
|
};
|
|
2273
|
-
_self
|
|
2470
|
+
_self[strSetNextPlugin] = function (next) {
|
|
2274
2471
|
_nextPlugin = next;
|
|
2275
2472
|
};
|
|
2276
2473
|
_self.processNext = function (env, itemCtx) {
|
|
@@ -2362,7 +2559,7 @@
|
|
|
2362
2559
|
}
|
|
2363
2560
|
}
|
|
2364
2561
|
catch (e) {
|
|
2365
|
-
itemCtx.diagLog().throwInternal(
|
|
2562
|
+
itemCtx.diagLog().throwInternal(1 , 64 , "One of telemetry initializers failed, telemetry item will not be sent: " + getExceptionName(e), { exception: dumpObj(e) }, true);
|
|
2366
2563
|
}
|
|
2367
2564
|
}
|
|
2368
2565
|
}
|
|
@@ -2370,8 +2567,7 @@
|
|
|
2370
2567
|
_self.processNext(item, itemCtx);
|
|
2371
2568
|
}
|
|
2372
2569
|
};
|
|
2373
|
-
_self
|
|
2374
|
-
_base.unload(itemCtx, isAsync);
|
|
2570
|
+
_self[strDoTeardown] = function () {
|
|
2375
2571
|
_initDefaults();
|
|
2376
2572
|
};
|
|
2377
2573
|
});
|
|
@@ -2415,6 +2611,16 @@
|
|
|
2415
2611
|
core: coreExtensions
|
|
2416
2612
|
};
|
|
2417
2613
|
}
|
|
2614
|
+
function _createDummyNotificationManager() {
|
|
2615
|
+
var _a;
|
|
2616
|
+
return objCreateFn((_a = {},
|
|
2617
|
+
_a[strAddNotificationListener] = function (listener) { },
|
|
2618
|
+
_a[strRemoveNotificationListener] = function (listener) { },
|
|
2619
|
+
_a[strEventsSent] = function (events) { },
|
|
2620
|
+
_a[strEventsDiscarded] = function (events, reason) { },
|
|
2621
|
+
_a[strEventsSendRequest] = function (sendReason, isAsync) { },
|
|
2622
|
+
_a));
|
|
2623
|
+
}
|
|
2418
2624
|
var BaseCore = /** @class */ (function () {
|
|
2419
2625
|
function BaseCore() {
|
|
2420
2626
|
var _isInitialized;
|
|
@@ -2431,6 +2637,7 @@
|
|
|
2431
2637
|
var _channelQueue;
|
|
2432
2638
|
var _telemetryInitializerPlugin;
|
|
2433
2639
|
var _internalLogsEventName;
|
|
2640
|
+
var _evtNamespace;
|
|
2434
2641
|
var _debugListener;
|
|
2435
2642
|
var _internalLogPoller = 0;
|
|
2436
2643
|
dynamicProto(BaseCore, this, function (_self) {
|
|
@@ -2476,24 +2683,16 @@
|
|
|
2476
2683
|
setValue(telemetryItem, "time", toISOString(new Date()), null, isNotTruthy);
|
|
2477
2684
|
setValue(telemetryItem, "ver", "4.0", null, isNullOrUndefined);
|
|
2478
2685
|
if (_self.isInitialized()) {
|
|
2479
|
-
|
|
2686
|
+
_createTelCtx().processNext(telemetryItem);
|
|
2480
2687
|
}
|
|
2481
2688
|
else {
|
|
2482
2689
|
_eventQueue.push(telemetryItem);
|
|
2483
2690
|
}
|
|
2484
2691
|
};
|
|
2485
|
-
_self.getProcessTelContext =
|
|
2486
|
-
return createProcessTelemetryContext(_getPluginChain(), _self.config, _self);
|
|
2487
|
-
};
|
|
2692
|
+
_self.getProcessTelContext = _createTelCtx;
|
|
2488
2693
|
_self.getNotifyMgr = function () {
|
|
2489
2694
|
if (!_notificationManager) {
|
|
2490
|
-
_notificationManager =
|
|
2491
|
-
addNotificationListener: function (listener) { },
|
|
2492
|
-
removeNotificationListener: function (listener) { },
|
|
2493
|
-
eventsSent: function (events) { },
|
|
2494
|
-
eventsDiscarded: function (events, reason) { },
|
|
2495
|
-
eventsSendRequest: function (sendReason, isAsync) { }
|
|
2496
|
-
});
|
|
2695
|
+
_notificationManager = _createDummyNotificationManager();
|
|
2497
2696
|
_self[strNotificationManager] = _notificationManager;
|
|
2498
2697
|
}
|
|
2499
2698
|
return _notificationManager;
|
|
@@ -2536,7 +2735,7 @@
|
|
|
2536
2735
|
var eventQueue = _eventQueue;
|
|
2537
2736
|
_eventQueue = [];
|
|
2538
2737
|
arrForEach(eventQueue, function (event) {
|
|
2539
|
-
|
|
2738
|
+
_createTelCtx().processNext(event);
|
|
2540
2739
|
});
|
|
2541
2740
|
}
|
|
2542
2741
|
};
|
|
@@ -2563,9 +2762,12 @@
|
|
|
2563
2762
|
};
|
|
2564
2763
|
proxyFunctions(_self, function () { return _telemetryInitializerPlugin; }, ["addTelemetryInitializer"]);
|
|
2565
2764
|
_self.getPlugin = _getPlugin;
|
|
2765
|
+
_self.evtNamespace = function () {
|
|
2766
|
+
return _evtNamespace;
|
|
2767
|
+
};
|
|
2566
2768
|
function _initDefaults() {
|
|
2567
2769
|
_isInitialized = false;
|
|
2568
|
-
_self.logger = new DiagnosticLogger({ loggingLevelConsole:
|
|
2770
|
+
_self.logger = new DiagnosticLogger({ loggingLevelConsole: 1 });
|
|
2569
2771
|
_self.config = null;
|
|
2570
2772
|
_self._extensions = [];
|
|
2571
2773
|
_telemetryInitializerPlugin = new TelemetryInitializerPlugin();
|
|
@@ -2581,6 +2783,10 @@
|
|
|
2581
2783
|
_channelConfig = null;
|
|
2582
2784
|
_channelQueue = null;
|
|
2583
2785
|
_internalLogsEventName = null;
|
|
2786
|
+
_evtNamespace = createUniqueNamespace("AIBaseCore", true);
|
|
2787
|
+
}
|
|
2788
|
+
function _createTelCtx() {
|
|
2789
|
+
return createProcessTelemetryContext(_getPluginChain(), _self.config, _self);
|
|
2584
2790
|
}
|
|
2585
2791
|
function _initPluginChain(config) {
|
|
2586
2792
|
var theExtensions = _validateExtensions(_self.logger, ChannelControllerPriority, _configExtensions);
|
|
@@ -2588,26 +2794,49 @@
|
|
|
2588
2794
|
_pluginChain = null;
|
|
2589
2795
|
var allExtensions = theExtensions.all;
|
|
2590
2796
|
_channelQueue = objFreeze(createChannelQueues(_channelConfig, allExtensions, config, _self));
|
|
2591
|
-
|
|
2797
|
+
if (_channelControl) {
|
|
2798
|
+
var idx = allExtensions.indexOf(_channelControl);
|
|
2799
|
+
if (idx !== -1) {
|
|
2800
|
+
allExtensions.splice(idx, 1);
|
|
2801
|
+
}
|
|
2802
|
+
idx = _coreExtensions.indexOf(_channelControl);
|
|
2803
|
+
if (idx !== -1) {
|
|
2804
|
+
_coreExtensions.splice(idx, 1);
|
|
2805
|
+
}
|
|
2806
|
+
_channelControl._setQueue(_channelQueue);
|
|
2807
|
+
}
|
|
2808
|
+
else {
|
|
2809
|
+
_channelControl = createChannelControllerPlugin(_channelQueue, _self);
|
|
2810
|
+
}
|
|
2592
2811
|
allExtensions.push(_channelControl);
|
|
2593
2812
|
_coreExtensions.push(_channelControl);
|
|
2594
2813
|
_self._extensions = sortPlugins(allExtensions);
|
|
2595
2814
|
_channelControl.initialize(config, _self, allExtensions);
|
|
2596
|
-
initializePlugins(
|
|
2815
|
+
initializePlugins(_createTelCtx(), allExtensions);
|
|
2597
2816
|
_self._extensions = objFreeze(sortPlugins(_coreExtensions || [])).slice();
|
|
2598
2817
|
}
|
|
2599
2818
|
function _getPlugin(pluginIdentifier) {
|
|
2600
2819
|
var theExt = null;
|
|
2601
2820
|
var thePlugin = null;
|
|
2602
2821
|
arrForEach(_self._extensions, function (ext) {
|
|
2603
|
-
if (ext.identifier === pluginIdentifier) {
|
|
2822
|
+
if (ext.identifier === pluginIdentifier && ext !== _channelControl && ext !== _telemetryInitializerPlugin) {
|
|
2604
2823
|
thePlugin = ext;
|
|
2605
2824
|
return -1;
|
|
2606
2825
|
}
|
|
2607
2826
|
});
|
|
2827
|
+
if (!thePlugin && _channelControl) {
|
|
2828
|
+
thePlugin = _channelControl.getChannel(pluginIdentifier);
|
|
2829
|
+
}
|
|
2608
2830
|
if (thePlugin) {
|
|
2609
2831
|
theExt = {
|
|
2610
|
-
plugin: thePlugin
|
|
2832
|
+
plugin: thePlugin,
|
|
2833
|
+
setEnabled: function (enabled) {
|
|
2834
|
+
_getPluginState(thePlugin)[strDisabled] = !enabled;
|
|
2835
|
+
},
|
|
2836
|
+
isEnabled: function () {
|
|
2837
|
+
var pluginState = _getPluginState(thePlugin);
|
|
2838
|
+
return !pluginState[strTeardown] && !pluginState[strDisabled];
|
|
2839
|
+
}
|
|
2611
2840
|
};
|
|
2612
2841
|
}
|
|
2613
2842
|
return theExt;
|
|
@@ -2615,7 +2844,9 @@
|
|
|
2615
2844
|
function _getPluginChain() {
|
|
2616
2845
|
if (!_pluginChain) {
|
|
2617
2846
|
var extensions = (_coreExtensions || []).slice();
|
|
2618
|
-
extensions.
|
|
2847
|
+
if (extensions.indexOf(_telemetryInitializerPlugin) === -1) {
|
|
2848
|
+
extensions.push(_telemetryInitializerPlugin);
|
|
2849
|
+
}
|
|
2619
2850
|
_pluginChain = createTelemetryProxyChain(sortPlugins(extensions), _self.config, _self);
|
|
2620
2851
|
}
|
|
2621
2852
|
return _pluginChain;
|
|
@@ -2638,12 +2869,12 @@
|
|
|
2638
2869
|
}
|
|
2639
2870
|
function _initDebugListener(config) {
|
|
2640
2871
|
if (config.disableDbgExt === true && _debugListener) {
|
|
2641
|
-
_notificationManager
|
|
2872
|
+
_notificationManager[strRemoveNotificationListener](_debugListener);
|
|
2642
2873
|
_debugListener = null;
|
|
2643
2874
|
}
|
|
2644
2875
|
if (_notificationManager && !_debugListener && config.disableDbgExt !== true) {
|
|
2645
2876
|
_debugListener = getDebugListener(config);
|
|
2646
|
-
_notificationManager
|
|
2877
|
+
_notificationManager[strAddNotificationListener](_debugListener);
|
|
2647
2878
|
}
|
|
2648
2879
|
}
|
|
2649
2880
|
function _initPerfManager(config) {
|
|
@@ -2659,10 +2890,6 @@
|
|
|
2659
2890
|
return BaseCore;
|
|
2660
2891
|
}());
|
|
2661
2892
|
|
|
2662
|
-
var strEventsSent = "eventsSent";
|
|
2663
|
-
var strEventsDiscarded = "eventsDiscarded";
|
|
2664
|
-
var strEventsSendRequest = "eventsSendRequest";
|
|
2665
|
-
var strPerfEvent = "perfEvent";
|
|
2666
2893
|
function _runListeners(listeners, name, isAsync, callback) {
|
|
2667
2894
|
arrForEach(listeners, function (listener) {
|
|
2668
2895
|
if (listener && listener[name]) {
|
|
@@ -2684,32 +2911,32 @@
|
|
|
2684
2911
|
this.listeners = [];
|
|
2685
2912
|
var perfEvtsSendAll = !!(config || {}).perfEvtsSendAll;
|
|
2686
2913
|
dynamicProto(NotificationManager, this, function (_self) {
|
|
2687
|
-
_self
|
|
2914
|
+
_self[strAddNotificationListener] = function (listener) {
|
|
2688
2915
|
_self.listeners.push(listener);
|
|
2689
2916
|
};
|
|
2690
|
-
_self
|
|
2917
|
+
_self[strRemoveNotificationListener] = function (listener) {
|
|
2691
2918
|
var index = arrIndexOf(_self.listeners, listener);
|
|
2692
2919
|
while (index > -1) {
|
|
2693
2920
|
_self.listeners.splice(index, 1);
|
|
2694
2921
|
index = arrIndexOf(_self.listeners, listener);
|
|
2695
2922
|
}
|
|
2696
2923
|
};
|
|
2697
|
-
_self
|
|
2924
|
+
_self[strEventsSent] = function (events) {
|
|
2698
2925
|
_runListeners(_self.listeners, strEventsSent, true, function (listener) {
|
|
2699
2926
|
listener[strEventsSent](events);
|
|
2700
2927
|
});
|
|
2701
2928
|
};
|
|
2702
|
-
_self
|
|
2929
|
+
_self[strEventsDiscarded] = function (events, reason) {
|
|
2703
2930
|
_runListeners(_self.listeners, strEventsDiscarded, true, function (listener) {
|
|
2704
2931
|
listener[strEventsDiscarded](events, reason);
|
|
2705
2932
|
});
|
|
2706
2933
|
};
|
|
2707
|
-
_self
|
|
2934
|
+
_self[strEventsSendRequest] = function (sendReason, isAsync) {
|
|
2708
2935
|
_runListeners(_self.listeners, strEventsSendRequest, isAsync, function (listener) {
|
|
2709
2936
|
listener[strEventsSendRequest](sendReason, isAsync);
|
|
2710
2937
|
});
|
|
2711
2938
|
};
|
|
2712
|
-
_self
|
|
2939
|
+
_self[strPerfEvent] = function (perfEvent) {
|
|
2713
2940
|
if (perfEvent) {
|
|
2714
2941
|
if (perfEvtsSendAll || !perfEvent.isChildEvt()) {
|
|
2715
2942
|
_runListeners(_self.listeners, strPerfEvent, false, function (listener) {
|
|
@@ -2764,168 +2991,304 @@
|
|
|
2764
2991
|
return AppInsightsCore;
|
|
2765
2992
|
}(BaseCore));
|
|
2766
2993
|
|
|
2767
|
-
var
|
|
2768
|
-
var
|
|
2769
|
-
var
|
|
2770
|
-
var
|
|
2771
|
-
var
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2994
|
+
var strOnPrefix = "on";
|
|
2995
|
+
var strAttachEvent = "attachEvent";
|
|
2996
|
+
var strAddEventHelper = "addEventListener";
|
|
2997
|
+
var strDetachEvent = "detachEvent";
|
|
2998
|
+
var strRemoveEventListener = "removeEventListener";
|
|
2999
|
+
var strEvents = "events";
|
|
3000
|
+
var strVisibilityChangeEvt = "visibilitychange";
|
|
3001
|
+
var strPageHide = "pagehide";
|
|
3002
|
+
var strPageShow = "pageshow";
|
|
3003
|
+
var strUnload = "unload";
|
|
3004
|
+
var strBeforeUnload = "beforeunload";
|
|
3005
|
+
var strPageHideNamespace = createUniqueNamespace("aiEvtPageHide");
|
|
3006
|
+
var strPageShowNamespace = createUniqueNamespace("aiEvtPageShow");
|
|
3007
|
+
var _guid = 1;
|
|
3008
|
+
var elmNodeData = createElmNodeData("events");
|
|
3009
|
+
var eventNamespace = /^([^.]*)(?:\.(.+)|)/;
|
|
3010
|
+
function _normalizeNamespace(name) {
|
|
3011
|
+
if (name && name.replace) {
|
|
3012
|
+
return name.replace(/^\s*\.*|\.*\s*$/g, "");
|
|
3013
|
+
}
|
|
3014
|
+
return name;
|
|
3015
|
+
}
|
|
3016
|
+
function _getEvtNamespace(eventName, namespaces) {
|
|
3017
|
+
if (namespaces) {
|
|
3018
|
+
var theNamespace_1 = "";
|
|
3019
|
+
if (isArray(namespaces)) {
|
|
3020
|
+
theNamespace_1 = "";
|
|
3021
|
+
arrForEach(namespaces, function (name) {
|
|
3022
|
+
name = _normalizeNamespace(name);
|
|
3023
|
+
if (name) {
|
|
3024
|
+
if (name[0] !== ".") {
|
|
3025
|
+
name = "." + name;
|
|
3026
|
+
}
|
|
3027
|
+
theNamespace_1 += name;
|
|
3028
|
+
}
|
|
3029
|
+
});
|
|
3030
|
+
}
|
|
3031
|
+
else {
|
|
3032
|
+
theNamespace_1 = _normalizeNamespace(namespaces);
|
|
3033
|
+
}
|
|
3034
|
+
if (theNamespace_1) {
|
|
3035
|
+
if (theNamespace_1[0] !== ".") {
|
|
3036
|
+
theNamespace_1 = "." + theNamespace_1;
|
|
3037
|
+
}
|
|
3038
|
+
eventName = (eventName || "") + theNamespace_1;
|
|
3039
|
+
}
|
|
2775
3040
|
}
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
3041
|
+
var parsedEvent = (eventNamespace.exec(eventName) || []);
|
|
3042
|
+
return {
|
|
3043
|
+
type: parsedEvent[1],
|
|
3044
|
+
ns: ((parsedEvent[2] || "").split(".").sort()).join(".")
|
|
3045
|
+
};
|
|
2779
3046
|
}
|
|
2780
|
-
function
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
3047
|
+
function __getRegisteredEvents(target, evtName) {
|
|
3048
|
+
var theEvents = [];
|
|
3049
|
+
var eventCache = elmNodeData.get(target, strEvents, {}, false);
|
|
3050
|
+
objForEachKey(eventCache, function (evtType, registeredEvents) {
|
|
3051
|
+
arrForEach(registeredEvents, function (value) {
|
|
3052
|
+
if (!evtName || evtName === value.evtName.type) {
|
|
3053
|
+
theEvents.push({
|
|
3054
|
+
name: value.evtName.type + (value.evtName.ns ? "." + value.evtName.ns : ""),
|
|
3055
|
+
handler: value.handler
|
|
3056
|
+
});
|
|
3057
|
+
}
|
|
3058
|
+
});
|
|
3059
|
+
});
|
|
3060
|
+
return theEvents;
|
|
3061
|
+
}
|
|
3062
|
+
function _getRegisteredEvents(target, evtName, addDefault) {
|
|
3063
|
+
if (addDefault === void 0) { addDefault = true; }
|
|
3064
|
+
var aiEvts = elmNodeData.get(target, strEvents, {}, addDefault);
|
|
3065
|
+
var registeredEvents = aiEvts[evtName];
|
|
3066
|
+
if (!registeredEvents) {
|
|
3067
|
+
registeredEvents = aiEvts[evtName] = [];
|
|
2786
3068
|
}
|
|
3069
|
+
return registeredEvents;
|
|
2787
3070
|
}
|
|
2788
|
-
function
|
|
2789
|
-
if (
|
|
2790
|
-
|
|
3071
|
+
function _doDetach(obj, evtName, handlerRef, useCapture) {
|
|
3072
|
+
if (obj && evtName && evtName.type) {
|
|
3073
|
+
if (obj[strRemoveEventListener]) {
|
|
3074
|
+
obj[strRemoveEventListener](evtName.type, handlerRef, useCapture);
|
|
3075
|
+
}
|
|
3076
|
+
else if (obj[strDetachEvent]) {
|
|
3077
|
+
obj[strDetachEvent](strOnPrefix + evtName.type, handlerRef);
|
|
3078
|
+
}
|
|
2791
3079
|
}
|
|
2792
|
-
return 0;
|
|
2793
3080
|
}
|
|
2794
|
-
function
|
|
2795
|
-
var
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
3081
|
+
function _doAttach(obj, evtName, handlerRef, useCapture) {
|
|
3082
|
+
var result = false;
|
|
3083
|
+
if (obj && evtName && evtName.type && handlerRef) {
|
|
3084
|
+
if (obj[strAddEventHelper]) {
|
|
3085
|
+
obj[strAddEventHelper](evtName.type, handlerRef, useCapture);
|
|
3086
|
+
result = true;
|
|
3087
|
+
}
|
|
3088
|
+
else if (obj[strAttachEvent]) {
|
|
3089
|
+
obj[strAttachEvent](strOnPrefix + evtName.type, handlerRef);
|
|
3090
|
+
result = true;
|
|
3091
|
+
}
|
|
2799
3092
|
}
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
3093
|
+
return result;
|
|
3094
|
+
}
|
|
3095
|
+
function _doUnregister(target, events, evtName, unRegFn) {
|
|
3096
|
+
var idx = events.length;
|
|
3097
|
+
while (idx--) {
|
|
3098
|
+
var theEvent = events[idx];
|
|
3099
|
+
if (theEvent) {
|
|
3100
|
+
if (!evtName.ns || evtName.ns === theEvent.evtName.ns) {
|
|
3101
|
+
if (!unRegFn || unRegFn(theEvent)) {
|
|
3102
|
+
_doDetach(target, theEvent.evtName, theEvent.handler, theEvent.capture);
|
|
3103
|
+
events.splice(idx, 1);
|
|
3104
|
+
}
|
|
3105
|
+
}
|
|
2803
3106
|
}
|
|
2804
|
-
value = mwcRandom32() & MaxUInt32;
|
|
2805
3107
|
}
|
|
2806
|
-
|
|
2807
|
-
|
|
3108
|
+
}
|
|
3109
|
+
function _unregisterEvents(target, evtName, unRegFn) {
|
|
3110
|
+
if (evtName.type) {
|
|
3111
|
+
_doUnregister(target, _getRegisteredEvents(target, evtName.type), evtName, unRegFn);
|
|
2808
3112
|
}
|
|
2809
|
-
|
|
2810
|
-
|
|
3113
|
+
else {
|
|
3114
|
+
var eventCache = elmNodeData.get(target, strEvents, {});
|
|
3115
|
+
objForEachKey(eventCache, function (evtType, events) {
|
|
3116
|
+
_doUnregister(target, events, evtName, unRegFn);
|
|
3117
|
+
});
|
|
3118
|
+
if (objKeys(eventCache).length === 0) {
|
|
3119
|
+
elmNodeData.kill(target, strEvents);
|
|
3120
|
+
}
|
|
2811
3121
|
}
|
|
2812
|
-
return value;
|
|
2813
3122
|
}
|
|
2814
|
-
function
|
|
2815
|
-
|
|
2816
|
-
|
|
3123
|
+
function mergeEvtNamespace(theNamespace, namespaces) {
|
|
3124
|
+
var newNamespaces;
|
|
3125
|
+
if (namespaces) {
|
|
3126
|
+
if (isArray(namespaces)) {
|
|
3127
|
+
newNamespaces = [theNamespace].concat(namespaces);
|
|
3128
|
+
}
|
|
3129
|
+
else {
|
|
3130
|
+
newNamespaces = [theNamespace, namespaces];
|
|
3131
|
+
}
|
|
2817
3132
|
}
|
|
2818
3133
|
else {
|
|
2819
|
-
|
|
3134
|
+
newNamespaces = theNamespace;
|
|
2820
3135
|
}
|
|
3136
|
+
return newNamespaces;
|
|
2821
3137
|
}
|
|
2822
|
-
function
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
3138
|
+
function eventOn(target, eventName, handlerRef, evtNamespace, useCapture) {
|
|
3139
|
+
if (useCapture === void 0) { useCapture = false; }
|
|
3140
|
+
var result = false;
|
|
3141
|
+
if (target) {
|
|
3142
|
+
try {
|
|
3143
|
+
var evtName = _getEvtNamespace(eventName, evtNamespace);
|
|
3144
|
+
result = _doAttach(target, evtName, handlerRef, useCapture);
|
|
3145
|
+
if (result && elmNodeData.accept(target)) {
|
|
3146
|
+
var registeredEvent = {
|
|
3147
|
+
guid: _guid++,
|
|
3148
|
+
evtName: evtName,
|
|
3149
|
+
handler: handlerRef,
|
|
3150
|
+
capture: useCapture
|
|
3151
|
+
};
|
|
3152
|
+
_getRegisteredEvents(target, evtName.type).push(registeredEvent);
|
|
3153
|
+
}
|
|
3154
|
+
}
|
|
3155
|
+
catch (e) {
|
|
3156
|
+
}
|
|
2828
3157
|
}
|
|
2829
|
-
return
|
|
3158
|
+
return result;
|
|
2830
3159
|
}
|
|
2831
|
-
function
|
|
2832
|
-
if (
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
3160
|
+
function eventOff(target, eventName, handlerRef, evtNamespace, useCapture) {
|
|
3161
|
+
if (useCapture === void 0) { useCapture = false; }
|
|
3162
|
+
if (target) {
|
|
3163
|
+
try {
|
|
3164
|
+
var evtName_1 = _getEvtNamespace(eventName, evtNamespace);
|
|
3165
|
+
var found_1 = false;
|
|
3166
|
+
_unregisterEvents(target, evtName_1, function (regEvent) {
|
|
3167
|
+
if ((evtName_1.ns && !handlerRef) || regEvent.handler === handlerRef) {
|
|
3168
|
+
found_1 = true;
|
|
3169
|
+
return true;
|
|
3170
|
+
}
|
|
3171
|
+
return false;
|
|
3172
|
+
});
|
|
3173
|
+
if (!found_1) {
|
|
3174
|
+
_doDetach(target, evtName_1, handlerRef, useCapture);
|
|
3175
|
+
}
|
|
3176
|
+
}
|
|
3177
|
+
catch (e) {
|
|
2844
3178
|
}
|
|
2845
3179
|
}
|
|
2846
|
-
return result;
|
|
2847
3180
|
}
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
3181
|
+
function attachEvent(obj, eventNameWithoutOn, handlerRef, useCapture) {
|
|
3182
|
+
if (useCapture === void 0) { useCapture = false; }
|
|
3183
|
+
return eventOn(obj, eventNameWithoutOn, handlerRef, null, useCapture);
|
|
3184
|
+
}
|
|
3185
|
+
function detachEvent(obj, eventNameWithoutOn, handlerRef, useCapture) {
|
|
3186
|
+
if (useCapture === void 0) { useCapture = false; }
|
|
3187
|
+
eventOff(obj, eventNameWithoutOn, handlerRef, null, useCapture);
|
|
3188
|
+
}
|
|
3189
|
+
function addEventHandler(eventName, callback, evtNamespace) {
|
|
2856
3190
|
var result = false;
|
|
2857
3191
|
var w = getWindow();
|
|
2858
3192
|
if (w) {
|
|
2859
|
-
result =
|
|
2860
|
-
result =
|
|
3193
|
+
result = eventOn(w, eventName, callback, evtNamespace);
|
|
3194
|
+
result = eventOn(w["body"], eventName, callback, evtNamespace) || result;
|
|
2861
3195
|
}
|
|
2862
3196
|
var doc = getDocument();
|
|
2863
3197
|
if (doc) {
|
|
2864
|
-
result =
|
|
3198
|
+
result = eventOn(doc, eventName, callback, evtNamespace) || result;
|
|
2865
3199
|
}
|
|
2866
3200
|
return result;
|
|
2867
3201
|
}
|
|
2868
|
-
function
|
|
3202
|
+
function removeEventHandler(eventName, callback, evtNamespace) {
|
|
3203
|
+
var w = getWindow();
|
|
3204
|
+
if (w) {
|
|
3205
|
+
eventOff(w, eventName, callback, evtNamespace);
|
|
3206
|
+
eventOff(w["body"], eventName, callback, evtNamespace);
|
|
3207
|
+
}
|
|
3208
|
+
var doc = getDocument();
|
|
3209
|
+
if (doc) {
|
|
3210
|
+
eventOff(doc, eventName, callback, evtNamespace);
|
|
3211
|
+
}
|
|
3212
|
+
}
|
|
3213
|
+
function _addEventListeners(events, listener, excludeEvents, evtNamespace) {
|
|
2869
3214
|
var added = false;
|
|
2870
|
-
if (listener && events &&
|
|
2871
|
-
var excluded_1 = [];
|
|
3215
|
+
if (listener && events && events.length > 0) {
|
|
2872
3216
|
arrForEach(events, function (name) {
|
|
2873
|
-
if (
|
|
3217
|
+
if (name) {
|
|
2874
3218
|
if (!excludeEvents || arrIndexOf(excludeEvents, name) === -1) {
|
|
2875
|
-
added = addEventHandler(name, listener) || added;
|
|
2876
|
-
}
|
|
2877
|
-
else {
|
|
2878
|
-
excluded_1.push(name);
|
|
3219
|
+
added = addEventHandler(name, listener, evtNamespace) || added;
|
|
2879
3220
|
}
|
|
2880
3221
|
}
|
|
2881
3222
|
});
|
|
2882
|
-
|
|
2883
|
-
|
|
3223
|
+
}
|
|
3224
|
+
return added;
|
|
3225
|
+
}
|
|
3226
|
+
function addEventListeners(events, listener, excludeEvents, evtNamespace) {
|
|
3227
|
+
var added = false;
|
|
3228
|
+
if (listener && events && isArray(events)) {
|
|
3229
|
+
added = _addEventListeners(events, listener, excludeEvents, evtNamespace);
|
|
3230
|
+
if (!added && excludeEvents && excludeEvents.length > 0) {
|
|
3231
|
+
added = _addEventListeners(events, listener, null, evtNamespace);
|
|
2884
3232
|
}
|
|
2885
3233
|
}
|
|
2886
3234
|
return added;
|
|
2887
3235
|
}
|
|
2888
|
-
function
|
|
2889
|
-
|
|
3236
|
+
function removeEventListeners(events, listener, evtNamespace) {
|
|
3237
|
+
if (events && isArray(events)) {
|
|
3238
|
+
arrForEach(events, function (name) {
|
|
3239
|
+
if (name) {
|
|
3240
|
+
removeEventHandler(name, listener, evtNamespace);
|
|
3241
|
+
}
|
|
3242
|
+
});
|
|
3243
|
+
}
|
|
3244
|
+
}
|
|
3245
|
+
function addPageUnloadEventListener(listener, excludeEvents, evtNamespace) {
|
|
3246
|
+
return addEventListeners([strBeforeUnload, strUnload, strPageHide], listener, excludeEvents, evtNamespace);
|
|
2890
3247
|
}
|
|
2891
|
-
function
|
|
3248
|
+
function removePageUnloadEventListener(listener, evtNamespace) {
|
|
3249
|
+
removeEventListeners([strBeforeUnload, strUnload, strPageHide], listener, evtNamespace);
|
|
3250
|
+
}
|
|
3251
|
+
function addPageHideEventListener(listener, excludeEvents, evtNamespace) {
|
|
2892
3252
|
function _handlePageVisibility(evt) {
|
|
2893
3253
|
var doc = getDocument();
|
|
2894
3254
|
if (listener && doc && doc.visibilityState === "hidden") {
|
|
2895
3255
|
listener(evt);
|
|
2896
3256
|
}
|
|
2897
3257
|
}
|
|
2898
|
-
var
|
|
2899
|
-
|
|
2900
|
-
pageUnloadAdded = addEventHandler(strPageHide, listener);
|
|
2901
|
-
}
|
|
3258
|
+
var newNamespaces = mergeEvtNamespace(strPageHideNamespace, evtNamespace);
|
|
3259
|
+
var pageUnloadAdded = _addEventListeners([strPageHide], listener, excludeEvents, newNamespaces);
|
|
2902
3260
|
if (!excludeEvents || arrIndexOf(excludeEvents, strVisibilityChangeEvt) === -1) {
|
|
2903
|
-
pageUnloadAdded =
|
|
3261
|
+
pageUnloadAdded = _addEventListeners([strVisibilityChangeEvt], _handlePageVisibility, excludeEvents, newNamespaces) || pageUnloadAdded;
|
|
2904
3262
|
}
|
|
2905
3263
|
if (!pageUnloadAdded && excludeEvents) {
|
|
2906
|
-
pageUnloadAdded = addPageHideEventListener(listener);
|
|
3264
|
+
pageUnloadAdded = addPageHideEventListener(listener, null, evtNamespace);
|
|
2907
3265
|
}
|
|
2908
3266
|
return pageUnloadAdded;
|
|
2909
3267
|
}
|
|
2910
|
-
function
|
|
3268
|
+
function removePageHideEventListener(listener, evtNamespace) {
|
|
3269
|
+
var newNamespaces = mergeEvtNamespace(strPageHideNamespace, evtNamespace);
|
|
3270
|
+
removeEventListeners([strPageHide], listener, newNamespaces);
|
|
3271
|
+
removeEventListeners([strVisibilityChangeEvt], null, newNamespaces);
|
|
3272
|
+
}
|
|
3273
|
+
function addPageShowEventListener(listener, excludeEvents, evtNamespace) {
|
|
2911
3274
|
function _handlePageVisibility(evt) {
|
|
2912
3275
|
var doc = getDocument();
|
|
2913
3276
|
if (listener && doc && doc.visibilityState === "visible") {
|
|
2914
3277
|
listener(evt);
|
|
2915
3278
|
}
|
|
2916
3279
|
}
|
|
2917
|
-
var
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
}
|
|
2921
|
-
if (!excludeEvents || arrIndexOf(excludeEvents, strVisibilityChangeEvt) === -1) {
|
|
2922
|
-
pageShowAdded = addEventHandler(strVisibilityChangeEvt, _handlePageVisibility) || pageShowAdded;
|
|
2923
|
-
}
|
|
3280
|
+
var newNamespaces = mergeEvtNamespace(strPageShowNamespace, evtNamespace);
|
|
3281
|
+
var pageShowAdded = _addEventListeners([strPageShow], listener, excludeEvents, newNamespaces);
|
|
3282
|
+
pageShowAdded = _addEventListeners([strVisibilityChangeEvt], _handlePageVisibility, excludeEvents, newNamespaces) || pageShowAdded;
|
|
2924
3283
|
if (!pageShowAdded && excludeEvents) {
|
|
2925
|
-
pageShowAdded = addPageShowEventListener(listener);
|
|
3284
|
+
pageShowAdded = addPageShowEventListener(listener, null, evtNamespace);
|
|
2926
3285
|
}
|
|
2927
3286
|
return pageShowAdded;
|
|
2928
3287
|
}
|
|
3288
|
+
|
|
3289
|
+
var _cookieMgrs = null;
|
|
3290
|
+
var _canUseCookies;
|
|
3291
|
+
var Undefined = strShimUndefined;
|
|
2929
3292
|
function newGuid() {
|
|
2930
3293
|
function randomHexDigit() {
|
|
2931
3294
|
return randomValue(15);
|
|
@@ -2944,7 +3307,7 @@
|
|
|
2944
3307
|
}
|
|
2945
3308
|
function generateW3CId() {
|
|
2946
3309
|
var hexValues = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"];
|
|
2947
|
-
var oct =
|
|
3310
|
+
var oct = strEmpty, tmp;
|
|
2948
3311
|
for (var a = 0; a < 4; a++) {
|
|
2949
3312
|
tmp = random32();
|
|
2950
3313
|
oct +=
|
|
@@ -3045,6 +3408,95 @@
|
|
|
3045
3408
|
return _legacyCookieMgr(null, logger).del(name);
|
|
3046
3409
|
}
|
|
3047
3410
|
|
|
3411
|
+
var LoggingSeverity = createEnumStyle({
|
|
3412
|
+
CRITICAL: 1 ,
|
|
3413
|
+
WARNING: 2
|
|
3414
|
+
});
|
|
3415
|
+
var _InternalMessageId = createEnumStyle({
|
|
3416
|
+
BrowserDoesNotSupportLocalStorage: 0 ,
|
|
3417
|
+
BrowserCannotReadLocalStorage: 1 ,
|
|
3418
|
+
BrowserCannotReadSessionStorage: 2 ,
|
|
3419
|
+
BrowserCannotWriteLocalStorage: 3 ,
|
|
3420
|
+
BrowserCannotWriteSessionStorage: 4 ,
|
|
3421
|
+
BrowserFailedRemovalFromLocalStorage: 5 ,
|
|
3422
|
+
BrowserFailedRemovalFromSessionStorage: 6 ,
|
|
3423
|
+
CannotSendEmptyTelemetry: 7 ,
|
|
3424
|
+
ClientPerformanceMathError: 8 ,
|
|
3425
|
+
ErrorParsingAISessionCookie: 9 ,
|
|
3426
|
+
ErrorPVCalc: 10 ,
|
|
3427
|
+
ExceptionWhileLoggingError: 11 ,
|
|
3428
|
+
FailedAddingTelemetryToBuffer: 12 ,
|
|
3429
|
+
FailedMonitorAjaxAbort: 13 ,
|
|
3430
|
+
FailedMonitorAjaxDur: 14 ,
|
|
3431
|
+
FailedMonitorAjaxOpen: 15 ,
|
|
3432
|
+
FailedMonitorAjaxRSC: 16 ,
|
|
3433
|
+
FailedMonitorAjaxSend: 17 ,
|
|
3434
|
+
FailedMonitorAjaxGetCorrelationHeader: 18 ,
|
|
3435
|
+
FailedToAddHandlerForOnBeforeUnload: 19 ,
|
|
3436
|
+
FailedToSendQueuedTelemetry: 20 ,
|
|
3437
|
+
FailedToReportDataLoss: 21 ,
|
|
3438
|
+
FlushFailed: 22 ,
|
|
3439
|
+
MessageLimitPerPVExceeded: 23 ,
|
|
3440
|
+
MissingRequiredFieldSpecification: 24 ,
|
|
3441
|
+
NavigationTimingNotSupported: 25 ,
|
|
3442
|
+
OnError: 26 ,
|
|
3443
|
+
SessionRenewalDateIsZero: 27 ,
|
|
3444
|
+
SenderNotInitialized: 28 ,
|
|
3445
|
+
StartTrackEventFailed: 29 ,
|
|
3446
|
+
StopTrackEventFailed: 30 ,
|
|
3447
|
+
StartTrackFailed: 31 ,
|
|
3448
|
+
StopTrackFailed: 32 ,
|
|
3449
|
+
TelemetrySampledAndNotSent: 33 ,
|
|
3450
|
+
TrackEventFailed: 34 ,
|
|
3451
|
+
TrackExceptionFailed: 35 ,
|
|
3452
|
+
TrackMetricFailed: 36 ,
|
|
3453
|
+
TrackPVFailed: 37 ,
|
|
3454
|
+
TrackPVFailedCalc: 38 ,
|
|
3455
|
+
TrackTraceFailed: 39 ,
|
|
3456
|
+
TransmissionFailed: 40 ,
|
|
3457
|
+
FailedToSetStorageBuffer: 41 ,
|
|
3458
|
+
FailedToRestoreStorageBuffer: 42 ,
|
|
3459
|
+
InvalidBackendResponse: 43 ,
|
|
3460
|
+
FailedToFixDepricatedValues: 44 ,
|
|
3461
|
+
InvalidDurationValue: 45 ,
|
|
3462
|
+
TelemetryEnvelopeInvalid: 46 ,
|
|
3463
|
+
CreateEnvelopeError: 47 ,
|
|
3464
|
+
CannotSerializeObject: 48 ,
|
|
3465
|
+
CannotSerializeObjectNonSerializable: 49 ,
|
|
3466
|
+
CircularReferenceDetected: 50 ,
|
|
3467
|
+
ClearAuthContextFailed: 51 ,
|
|
3468
|
+
ExceptionTruncated: 52 ,
|
|
3469
|
+
IllegalCharsInName: 53 ,
|
|
3470
|
+
ItemNotInArray: 54 ,
|
|
3471
|
+
MaxAjaxPerPVExceeded: 55 ,
|
|
3472
|
+
MessageTruncated: 56 ,
|
|
3473
|
+
NameTooLong: 57 ,
|
|
3474
|
+
SampleRateOutOfRange: 58 ,
|
|
3475
|
+
SetAuthContextFailed: 59 ,
|
|
3476
|
+
SetAuthContextFailedAccountName: 60 ,
|
|
3477
|
+
StringValueTooLong: 61 ,
|
|
3478
|
+
StartCalledMoreThanOnce: 62 ,
|
|
3479
|
+
StopCalledWithoutStart: 63 ,
|
|
3480
|
+
TelemetryInitializerFailed: 64 ,
|
|
3481
|
+
TrackArgumentsNotSpecified: 65 ,
|
|
3482
|
+
UrlTooLong: 66 ,
|
|
3483
|
+
SessionStorageBufferFull: 67 ,
|
|
3484
|
+
CannotAccessCookie: 68 ,
|
|
3485
|
+
IdTooLong: 69 ,
|
|
3486
|
+
InvalidEvent: 70 ,
|
|
3487
|
+
FailedMonitorAjaxSetRequestHeader: 71 ,
|
|
3488
|
+
SendBrowserInfoOnUserInit: 72 ,
|
|
3489
|
+
PluginException: 73 ,
|
|
3490
|
+
NotificationException: 74 ,
|
|
3491
|
+
SnippetScriptLoadFailure: 99 ,
|
|
3492
|
+
InvalidInstrumentationKey: 100 ,
|
|
3493
|
+
CannotParseAiBlobValue: 101 ,
|
|
3494
|
+
InvalidContentBlob: 102 ,
|
|
3495
|
+
TrackPageActionEventFailed: 103 ,
|
|
3496
|
+
FailedAddingCustomDefinedRequestContext: 104 ,
|
|
3497
|
+
InMemoryStorageBufferFull: 105
|
|
3498
|
+
});
|
|
3499
|
+
|
|
3048
3500
|
var aiInstrumentHooks = "_aiHooks";
|
|
3049
3501
|
var cbNames = [
|
|
3050
3502
|
"req", "rsp", "hkErr", "fnErr"
|
|
@@ -3219,6 +3671,7 @@
|
|
|
3219
3671
|
exports.InstrumentFuncs = InstrumentFuncs;
|
|
3220
3672
|
exports.InstrumentProto = InstrumentProto;
|
|
3221
3673
|
exports.InstrumentProtos = InstrumentProtos;
|
|
3674
|
+
exports.LoggingSeverity = LoggingSeverity;
|
|
3222
3675
|
exports.MinChannelPriorty = MinChannelPriorty;
|
|
3223
3676
|
exports.NotificationManager = NotificationManager;
|
|
3224
3677
|
exports.PerfEvent = PerfEvent;
|
|
@@ -3227,6 +3680,7 @@
|
|
|
3227
3680
|
exports.Undefined = Undefined;
|
|
3228
3681
|
exports._InternalLogMessage = _InternalLogMessage;
|
|
3229
3682
|
exports._InternalMessageId = _InternalMessageId;
|
|
3683
|
+
exports.__getRegisteredEvents = __getRegisteredEvents;
|
|
3230
3684
|
exports._legacyCookieMgr = _legacyCookieMgr;
|
|
3231
3685
|
exports.addEventHandler = addEventHandler;
|
|
3232
3686
|
exports.addEventListeners = addEventListeners;
|
|
@@ -3242,13 +3696,17 @@
|
|
|
3242
3696
|
exports.canUseCookies = canUseCookies;
|
|
3243
3697
|
exports.createClassFromInterface = createClassFromInterface;
|
|
3244
3698
|
exports.createCookieMgr = createCookieMgr;
|
|
3699
|
+
exports.createEnumStyle = createEnumStyle;
|
|
3245
3700
|
exports.createProcessTelemetryContext = createProcessTelemetryContext;
|
|
3701
|
+
exports.createUniqueNamespace = createUniqueNamespace;
|
|
3246
3702
|
exports.dateNow = dateNow;
|
|
3247
3703
|
exports.deleteCookie = deleteCookie;
|
|
3248
3704
|
exports.detachEvent = detachEvent;
|
|
3249
3705
|
exports.disableCookies = disableCookies;
|
|
3250
3706
|
exports.doPerf = doPerf;
|
|
3251
3707
|
exports.dumpObj = dumpObj;
|
|
3708
|
+
exports.eventOff = eventOff;
|
|
3709
|
+
exports.eventOn = eventOn;
|
|
3252
3710
|
exports.generateW3CId = generateW3CId;
|
|
3253
3711
|
exports.getConsole = getConsole;
|
|
3254
3712
|
exports.getCookie = getCookie;
|
|
@@ -3298,6 +3756,7 @@
|
|
|
3298
3756
|
exports.isTypeof = isTypeof;
|
|
3299
3757
|
exports.isUndefined = isUndefined;
|
|
3300
3758
|
exports.isXhrSupported = isXhrSupported;
|
|
3759
|
+
exports.mergeEvtNamespace = mergeEvtNamespace;
|
|
3301
3760
|
exports.mwcRandom32 = mwcRandom32;
|
|
3302
3761
|
exports.mwcRandomSeed = mwcRandomSeed;
|
|
3303
3762
|
exports.newGuid = newGuid;
|
|
@@ -3305,6 +3764,7 @@
|
|
|
3305
3764
|
exports.normalizeJsName = normalizeJsName;
|
|
3306
3765
|
exports.objCreate = objCreateFn;
|
|
3307
3766
|
exports.objDefineAccessors = objDefineAccessors;
|
|
3767
|
+
exports.objExtend = objExtend;
|
|
3308
3768
|
exports.objForEachKey = objForEachKey;
|
|
3309
3769
|
exports.objFreeze = objFreeze;
|
|
3310
3770
|
exports.objKeys = objKeys;
|
|
@@ -3312,8 +3772,14 @@
|
|
|
3312
3772
|
exports.optimizeObject = optimizeObject;
|
|
3313
3773
|
exports.perfNow = perfNow;
|
|
3314
3774
|
exports.proxyAssign = proxyAssign;
|
|
3775
|
+
exports.proxyFunctionAs = proxyFunctionAs;
|
|
3776
|
+
exports.proxyFunctions = proxyFunctions;
|
|
3315
3777
|
exports.random32 = random32;
|
|
3316
3778
|
exports.randomValue = randomValue;
|
|
3779
|
+
exports.removeEventHandler = removeEventHandler;
|
|
3780
|
+
exports.removeEventListeners = removeEventListeners;
|
|
3781
|
+
exports.removePageHideEventListener = removePageHideEventListener;
|
|
3782
|
+
exports.removePageUnloadEventListener = removePageUnloadEventListener;
|
|
3317
3783
|
exports.safeGetCookieMgr = safeGetCookieMgr;
|
|
3318
3784
|
exports.safeGetLogger = safeGetLogger;
|
|
3319
3785
|
exports.setCookie = setCookie;
|