Advertisement
Guest User

Untitled

a guest
Oct 20th, 2020
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 206.34 KB | None | 0 0
  1. diff --git a/node_modules/@nativescript/zone-js/nativescript-zone-js-1.0.1.tgz b/node_modules/@nativescript/zone-js/nativescript-zone-js-1.0.1.tgz
  2. deleted file mode 100644
  3. index 94660b4..0000000
  4. Binary files a/node_modules/@nativescript/zone-js/nativescript-zone-js-1.0.1.tgz and /dev/null differ
  5. diff --git a/node_modules/@nativescript/zone-js/package/testing.jasmine.d.ts b/node_modules/@nativescript/zone-js/package/testing.jasmine.d.ts
  6. deleted file mode 100644
  7. index 8984f2b..0000000
  8. --- a/node_modules/@nativescript/zone-js/package/testing.jasmine.d.ts
  9. +++ /dev/null
  10. @@ -1 +0,0 @@
  11. -import './zone-nativescript.jasmine.js';
  12. diff --git a/node_modules/@nativescript/zone-js/package/testing.jasmine.js b/node_modules/@nativescript/zone-js/package/testing.jasmine.js
  13. deleted file mode 100644
  14. index 3fcf9da..0000000
  15. --- a/node_modules/@nativescript/zone-js/package/testing.jasmine.js
  16. +++ /dev/null
  17. @@ -1,2 +0,0 @@
  18. -import './zone-nativescript.jasmine.js';
  19. -//# sourceMappingURL=testing.jasmine.js.map
  20. \ No newline at end of file
  21. diff --git a/node_modules/@nativescript/zone-js/package/testing.jasmine.js.map b/node_modules/@nativescript/zone-js/package/testing.jasmine.js.map
  22. deleted file mode 100644
  23. index 212da0b..0000000
  24. --- a/node_modules/@nativescript/zone-js/package/testing.jasmine.js.map
  25. +++ /dev/null
  26. @@ -1 +0,0 @@
  27. -{"version":3,"file":"testing.jasmine.js","sourceRoot":"","sources":["testing.jasmine.ts"],"names":[],"mappings":"AACA,OAAO,aAAa,CAAC;AACrB,OAAO,qCAAqC,CAAC"}
  28. \ No newline at end of file
  29. diff --git a/node_modules/@nativescript/zone-js/package/testing.mocha.d.ts b/node_modules/@nativescript/zone-js/package/testing.mocha.d.ts
  30. deleted file mode 100644
  31. index 7538179..0000000
  32. --- a/node_modules/@nativescript/zone-js/package/testing.mocha.d.ts
  33. +++ /dev/null
  34. @@ -1,2 +0,0 @@
  35. -import '../platform';
  36. -import './zone-nativescript.mocha.js';
  37. diff --git a/node_modules/@nativescript/zone-js/package/testing.mocha.js b/node_modules/@nativescript/zone-js/package/testing.mocha.js
  38. deleted file mode 100644
  39. index e883697..0000000
  40. --- a/node_modules/@nativescript/zone-js/package/testing.mocha.js
  41. +++ /dev/null
  42. @@ -1,2 +0,0 @@
  43. -import './zone-nativescript.mocha.js';
  44. -//# sourceMappingURL=testing.mocha.js.map
  45. \ No newline at end of file
  46. diff --git a/node_modules/@nativescript/zone-js/package/testing.mocha.js.map b/node_modules/@nativescript/zone-js/package/testing.mocha.js.map
  47. deleted file mode 100644
  48. index 19ef784..0000000
  49. --- a/node_modules/@nativescript/zone-js/package/testing.mocha.js.map
  50. +++ /dev/null
  51. @@ -1 +0,0 @@
  52. -{"version":3,"file":"testing.mocha.js","sourceRoot":"","sources":["testing.mocha.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAC;AACrB,OAAO,mCAAmC,CAAC"}
  53. \ No newline at end of file
  54. diff --git a/node_modules/@nativescript/zone-js/package/zone-nativescript.d.ts b/node_modules/@nativescript/zone-js/package/zone-nativescript.d.ts
  55. deleted file mode 100644
  56. index e43b810..0000000
  57. --- a/node_modules/@nativescript/zone-js/package/zone-nativescript.d.ts
  58. +++ /dev/null
  59. @@ -1 +0,0 @@
  60. -export declare const NativeScriptZone: any;
  61. \ No newline at end of file
  62. diff --git a/node_modules/@nativescript/zone-js/package/zone-nativescript.jasmine.js b/node_modules/@nativescript/zone-js/package/zone-nativescript.jasmine.js
  63. deleted file mode 100644
  64. index 98bac8f..0000000
  65. --- a/node_modules/@nativescript/zone-js/package/zone-nativescript.jasmine.js
  66. +++ /dev/null
  67. @@ -1,1452 +0,0 @@
  68. -/**
  69. -* @license
  70. -* Copyright Google Inc. All Rights Reserved.
  71. -*
  72. -* Use of this source code is governed by an MIT-style license that can be
  73. -* found in the LICENSE file at https://angular.io/license
  74. -*/
  75. -(function (global, factory) {
  76. - typeof exports === 'object' && typeof module !== 'undefined' ? factory() :
  77. - typeof define === 'function' && define.amd ? define(factory) :
  78. - (factory());
  79. -}(this, (function () { 'use strict';
  80. -
  81. -/**
  82. - * @license
  83. - * Copyright Google Inc. All Rights Reserved.
  84. - *
  85. - * Use of this source code is governed by an MIT-style license that can be
  86. - * found in the LICENSE file at https://angular.io/license
  87. - */
  88. -/**
  89. - * @fileoverview
  90. - * @suppress {globalThis}
  91. - */
  92. -var NEWLINE = '\n';
  93. -var IGNORE_FRAMES = {};
  94. -var creationTrace = '__creationTrace__';
  95. -var ERROR_TAG = 'STACKTRACE TRACKING';
  96. -var SEP_TAG = '__SEP_TAG__';
  97. -var sepTemplate = SEP_TAG + '@[native]';
  98. -var LongStackTrace = /** @class */ (function () {
  99. - function LongStackTrace() {
  100. - this.error = getStacktrace();
  101. - this.timestamp = new Date();
  102. - }
  103. - return LongStackTrace;
  104. -}());
  105. -function getStacktraceWithUncaughtError() {
  106. - return new Error(ERROR_TAG);
  107. -}
  108. -function getStacktraceWithCaughtError() {
  109. - try {
  110. - throw getStacktraceWithUncaughtError();
  111. - }
  112. - catch (err) {
  113. - return err;
  114. - }
  115. -}
  116. -// Some implementations of exception handling don't create a stack trace if the exception
  117. -// isn't thrown, however it's faster not to actually throw the exception.
  118. -var error = getStacktraceWithUncaughtError();
  119. -var caughtError = getStacktraceWithCaughtError();
  120. -var getStacktrace = error.stack ?
  121. - getStacktraceWithUncaughtError :
  122. - (caughtError.stack ? getStacktraceWithCaughtError : getStacktraceWithUncaughtError);
  123. -function getFrames(error) {
  124. - return error.stack ? error.stack.split(NEWLINE) : [];
  125. -}
  126. -function addErrorStack(lines, error) {
  127. - var trace = getFrames(error);
  128. - for (var i = 0; i < trace.length; i++) {
  129. - var frame = trace[i];
  130. - // Filter out the Frames which are part of stack capturing.
  131. - if (!IGNORE_FRAMES.hasOwnProperty(frame)) {
  132. - lines.push(trace[i]);
  133. - }
  134. - }
  135. -}
  136. -function renderLongStackTrace(frames, stack) {
  137. - var longTrace = [stack ? stack.trim() : ''];
  138. - if (frames) {
  139. - var timestamp = new Date().getTime();
  140. - for (var i = 0; i < frames.length; i++) {
  141. - var traceFrames = frames[i];
  142. - var lastTime = traceFrames.timestamp;
  143. - var separator = "____________________Elapsed " + (timestamp - lastTime.getTime()) + " ms; At: " + lastTime;
  144. - separator = separator.replace(/[^\w\d]/g, '_');
  145. - longTrace.push(sepTemplate.replace(SEP_TAG, separator));
  146. - addErrorStack(longTrace, traceFrames.error);
  147. - timestamp = lastTime.getTime();
  148. - }
  149. - }
  150. - return longTrace.join(NEWLINE);
  151. -}
  152. -Zone['longStackTraceZoneSpec'] = {
  153. - name: 'long-stack-trace',
  154. - longStackTraceLimit: 10,
  155. - // add a getLongStackTrace method in spec to
  156. - // handle handled reject promise error.
  157. - getLongStackTrace: function (error) {
  158. - if (!error) {
  159. - return undefined;
  160. - }
  161. - var trace = error[Zone.__symbol__('currentTaskTrace')];
  162. - if (!trace) {
  163. - return error.stack;
  164. - }
  165. - return renderLongStackTrace(trace, error.stack);
  166. - },
  167. - onScheduleTask: function (parentZoneDelegate, currentZone, targetZone, task) {
  168. - if (Error.stackTraceLimit > 0) {
  169. - // if Error.stackTraceLimit is 0, means stack trace
  170. - // is disabled, so we don't need to generate long stack trace
  171. - // this will improve performance in some test(some test will
  172. - // set stackTraceLimit to 0, https://github.com/angular/zone.js/issues/698
  173. - var currentTask = Zone.currentTask;
  174. - var trace = currentTask && currentTask.data && currentTask.data[creationTrace] || [];
  175. - trace = [new LongStackTrace()].concat(trace);
  176. - if (trace.length > this.longStackTraceLimit) {
  177. - trace.length = this.longStackTraceLimit;
  178. - }
  179. - if (!task.data)
  180. - task.data = {};
  181. - task.data[creationTrace] = trace;
  182. - }
  183. - return parentZoneDelegate.scheduleTask(targetZone, task);
  184. - },
  185. - onHandleError: function (parentZoneDelegate, currentZone, targetZone, error) {
  186. - if (Error.stackTraceLimit > 0) {
  187. - // if Error.stackTraceLimit is 0, means stack trace
  188. - // is disabled, so we don't need to generate long stack trace
  189. - // this will improve performance in some test(some test will
  190. - // set stackTraceLimit to 0, https://github.com/angular/zone.js/issues/698
  191. - var parentTask = Zone.currentTask || error.task;
  192. - if (error instanceof Error && parentTask) {
  193. - var longStack = renderLongStackTrace(parentTask.data && parentTask.data[creationTrace], error.stack);
  194. - try {
  195. - error.stack = error.longStack = longStack;
  196. - }
  197. - catch (err) {
  198. - }
  199. - }
  200. - }
  201. - return parentZoneDelegate.handleError(targetZone, error);
  202. - }
  203. -};
  204. -function captureStackTraces(stackTraces, count) {
  205. - if (count > 0) {
  206. - stackTraces.push(getFrames((new LongStackTrace()).error));
  207. - captureStackTraces(stackTraces, count - 1);
  208. - }
  209. -}
  210. -function computeIgnoreFrames() {
  211. - if (Error.stackTraceLimit <= 0) {
  212. - return;
  213. - }
  214. - var frames = [];
  215. - captureStackTraces(frames, 2);
  216. - var frames1 = frames[0];
  217. - var frames2 = frames[1];
  218. - for (var i = 0; i < frames1.length; i++) {
  219. - var frame1 = frames1[i];
  220. - if (frame1.indexOf(ERROR_TAG) == -1) {
  221. - var match = frame1.match(/^\s*at\s+/);
  222. - if (match) {
  223. - sepTemplate = match[0] + SEP_TAG + ' (http://localhost)';
  224. - break;
  225. - }
  226. - }
  227. - }
  228. - for (var i = 0; i < frames1.length; i++) {
  229. - var frame1 = frames1[i];
  230. - var frame2 = frames2[i];
  231. - if (frame1 === frame2) {
  232. - IGNORE_FRAMES[frame1] = true;
  233. - }
  234. - else {
  235. - break;
  236. - }
  237. - }
  238. -}
  239. -computeIgnoreFrames();
  240. -
  241. -/**
  242. - * @license
  243. - * Copyright Google Inc. All Rights Reserved.
  244. - *
  245. - * Use of this source code is governed by an MIT-style license that can be
  246. - * found in the LICENSE file at https://angular.io/license
  247. - */
  248. -var ProxyZoneSpec = /** @class */ (function () {
  249. - function ProxyZoneSpec(defaultSpecDelegate) {
  250. - if (defaultSpecDelegate === void 0) { defaultSpecDelegate = null; }
  251. - this.defaultSpecDelegate = defaultSpecDelegate;
  252. - this.name = 'ProxyZone';
  253. - this.properties = { 'ProxyZoneSpec': this };
  254. - this.propertyKeys = null;
  255. - this.lastTaskState = null;
  256. - this.isNeedToTriggerHasTask = false;
  257. - this.tasks = [];
  258. - this.setDelegate(defaultSpecDelegate);
  259. - }
  260. - ProxyZoneSpec.get = function () {
  261. - return Zone.current.get('ProxyZoneSpec');
  262. - };
  263. - ProxyZoneSpec.isLoaded = function () {
  264. - return ProxyZoneSpec.get() instanceof ProxyZoneSpec;
  265. - };
  266. - ProxyZoneSpec.assertPresent = function () {
  267. - if (!ProxyZoneSpec.isLoaded()) {
  268. - throw new Error("Expected to be running in 'ProxyZone', but it was not found.");
  269. - }
  270. - return ProxyZoneSpec.get();
  271. - };
  272. - ProxyZoneSpec.prototype.setDelegate = function (delegateSpec) {
  273. - var _this = this;
  274. - var isNewDelegate = this._delegateSpec !== delegateSpec;
  275. - this._delegateSpec = delegateSpec;
  276. - this.propertyKeys && this.propertyKeys.forEach(function (key) { return delete _this.properties[key]; });
  277. - this.propertyKeys = null;
  278. - if (delegateSpec && delegateSpec.properties) {
  279. - this.propertyKeys = Object.keys(delegateSpec.properties);
  280. - this.propertyKeys.forEach(function (k) { return _this.properties[k] = delegateSpec.properties[k]; });
  281. - }
  282. - // if set a new delegateSpec, shoulde check whether need to
  283. - // trigger hasTask or not
  284. - if (isNewDelegate && this.lastTaskState &&
  285. - (this.lastTaskState.macroTask || this.lastTaskState.microTask)) {
  286. - this.isNeedToTriggerHasTask = true;
  287. - }
  288. - };
  289. - ProxyZoneSpec.prototype.getDelegate = function () {
  290. - return this._delegateSpec;
  291. - };
  292. - ProxyZoneSpec.prototype.resetDelegate = function () {
  293. - var delegateSpec = this.getDelegate();
  294. - this.setDelegate(this.defaultSpecDelegate);
  295. - };
  296. - ProxyZoneSpec.prototype.tryTriggerHasTask = function (parentZoneDelegate, currentZone, targetZone) {
  297. - if (this.isNeedToTriggerHasTask && this.lastTaskState) {
  298. - // last delegateSpec has microTask or macroTask
  299. - // should call onHasTask in current delegateSpec
  300. - this.isNeedToTriggerHasTask = false;
  301. - this.onHasTask(parentZoneDelegate, currentZone, targetZone, this.lastTaskState);
  302. - }
  303. - };
  304. - ProxyZoneSpec.prototype.removeFromTasks = function (task) {
  305. - if (!this.tasks) {
  306. - return;
  307. - }
  308. - for (var i = 0; i < this.tasks.length; i++) {
  309. - if (this.tasks[i] === task) {
  310. - this.tasks.splice(i, 1);
  311. - return;
  312. - }
  313. - }
  314. - };
  315. - ProxyZoneSpec.prototype.getAndClearPendingTasksInfo = function () {
  316. - if (this.tasks.length === 0) {
  317. - return '';
  318. - }
  319. - var taskInfo = this.tasks.map(function (task) {
  320. - var dataInfo = task.data &&
  321. - Object.keys(task.data)
  322. - .map(function (key) {
  323. - return key + ':' + task.data[key];
  324. - })
  325. - .join(',');
  326. - return "type: " + task.type + ", source: " + task.source + ", args: {" + dataInfo + "}";
  327. - });
  328. - var pendingTasksInfo = '--Pendng async tasks are: [' + taskInfo + ']';
  329. - // clear tasks
  330. - this.tasks = [];
  331. - return pendingTasksInfo;
  332. - };
  333. - ProxyZoneSpec.prototype.onFork = function (parentZoneDelegate, currentZone, targetZone, zoneSpec) {
  334. - if (this._delegateSpec && this._delegateSpec.onFork) {
  335. - return this._delegateSpec.onFork(parentZoneDelegate, currentZone, targetZone, zoneSpec);
  336. - }
  337. - else {
  338. - return parentZoneDelegate.fork(targetZone, zoneSpec);
  339. - }
  340. - };
  341. - ProxyZoneSpec.prototype.onIntercept = function (parentZoneDelegate, currentZone, targetZone, delegate, source) {
  342. - if (this._delegateSpec && this._delegateSpec.onIntercept) {
  343. - return this._delegateSpec.onIntercept(parentZoneDelegate, currentZone, targetZone, delegate, source);
  344. - }
  345. - else {
  346. - return parentZoneDelegate.intercept(targetZone, delegate, source);
  347. - }
  348. - };
  349. - ProxyZoneSpec.prototype.onInvoke = function (parentZoneDelegate, currentZone, targetZone, delegate, applyThis, applyArgs, source) {
  350. - this.tryTriggerHasTask(parentZoneDelegate, currentZone, targetZone);
  351. - if (this._delegateSpec && this._delegateSpec.onInvoke) {
  352. - return this._delegateSpec.onInvoke(parentZoneDelegate, currentZone, targetZone, delegate, applyThis, applyArgs, source);
  353. - }
  354. - else {
  355. - return parentZoneDelegate.invoke(targetZone, delegate, applyThis, applyArgs, source);
  356. - }
  357. - };
  358. - ProxyZoneSpec.prototype.onHandleError = function (parentZoneDelegate, currentZone, targetZone, error) {
  359. - if (this._delegateSpec && this._delegateSpec.onHandleError) {
  360. - return this._delegateSpec.onHandleError(parentZoneDelegate, currentZone, targetZone, error);
  361. - }
  362. - else {
  363. - return parentZoneDelegate.handleError(targetZone, error);
  364. - }
  365. - };
  366. - ProxyZoneSpec.prototype.onScheduleTask = function (parentZoneDelegate, currentZone, targetZone, task) {
  367. - if (task.type !== 'eventTask') {
  368. - this.tasks.push(task);
  369. - }
  370. - if (this._delegateSpec && this._delegateSpec.onScheduleTask) {
  371. - return this._delegateSpec.onScheduleTask(parentZoneDelegate, currentZone, targetZone, task);
  372. - }
  373. - else {
  374. - return parentZoneDelegate.scheduleTask(targetZone, task);
  375. - }
  376. - };
  377. - ProxyZoneSpec.prototype.onInvokeTask = function (parentZoneDelegate, currentZone, targetZone, task, applyThis, applyArgs) {
  378. - if (task.type !== 'eventTask') {
  379. - this.removeFromTasks(task);
  380. - }
  381. - this.tryTriggerHasTask(parentZoneDelegate, currentZone, targetZone);
  382. - if (this._delegateSpec && this._delegateSpec.onInvokeTask) {
  383. - return this._delegateSpec.onInvokeTask(parentZoneDelegate, currentZone, targetZone, task, applyThis, applyArgs);
  384. - }
  385. - else {
  386. - return parentZoneDelegate.invokeTask(targetZone, task, applyThis, applyArgs);
  387. - }
  388. - };
  389. - ProxyZoneSpec.prototype.onCancelTask = function (parentZoneDelegate, currentZone, targetZone, task) {
  390. - if (task.type !== 'eventTask') {
  391. - this.removeFromTasks(task);
  392. - }
  393. - this.tryTriggerHasTask(parentZoneDelegate, currentZone, targetZone);
  394. - if (this._delegateSpec && this._delegateSpec.onCancelTask) {
  395. - return this._delegateSpec.onCancelTask(parentZoneDelegate, currentZone, targetZone, task);
  396. - }
  397. - else {
  398. - return parentZoneDelegate.cancelTask(targetZone, task);
  399. - }
  400. - };
  401. - ProxyZoneSpec.prototype.onHasTask = function (delegate, current, target, hasTaskState) {
  402. - this.lastTaskState = hasTaskState;
  403. - if (this._delegateSpec && this._delegateSpec.onHasTask) {
  404. - this._delegateSpec.onHasTask(delegate, current, target, hasTaskState);
  405. - }
  406. - else {
  407. - delegate.hasTask(target, hasTaskState);
  408. - }
  409. - };
  410. - return ProxyZoneSpec;
  411. -}());
  412. -// Export the class so that new instances can be created with proper
  413. -// constructor params.
  414. -Zone['ProxyZoneSpec'] = ProxyZoneSpec;
  415. -
  416. -/**
  417. - * @license
  418. - * Copyright Google Inc. All Rights Reserved.
  419. - *
  420. - * Use of this source code is governed by an MIT-style license that can be
  421. - * found in the LICENSE file at https://angular.io/license
  422. - */
  423. -var SyncTestZoneSpec = /** @class */ (function () {
  424. - function SyncTestZoneSpec(namePrefix) {
  425. - this.runZone = Zone.current;
  426. - this.name = 'syncTestZone for ' + namePrefix;
  427. - }
  428. - SyncTestZoneSpec.prototype.onScheduleTask = function (delegate, current, target, task) {
  429. - switch (task.type) {
  430. - case 'microTask':
  431. - case 'macroTask':
  432. - throw new Error("Cannot call " + task.source + " from within a sync test.");
  433. - case 'eventTask':
  434. - task = delegate.scheduleTask(target, task);
  435. - break;
  436. - }
  437. - return task;
  438. - };
  439. - return SyncTestZoneSpec;
  440. -}());
  441. -// Export the class so that new instances can be created with proper
  442. -// constructor params.
  443. -Zone['SyncTestZoneSpec'] = SyncTestZoneSpec;
  444. -
  445. -/**
  446. - * @license
  447. - * Copyright Google Inc. All Rights Reserved.
  448. - *
  449. - * Use of this source code is governed by an MIT-style license that can be
  450. - * found in the LICENSE file at https://angular.io/license
  451. - */
  452. -var _global = typeof window !== 'undefined' && window || typeof self !== 'undefined' && self || global;
  453. -var AsyncTestZoneSpec = /** @class */ (function () {
  454. - function AsyncTestZoneSpec(finishCallback, failCallback, namePrefix) {
  455. - this.finishCallback = finishCallback;
  456. - this.failCallback = failCallback;
  457. - this._pendingMicroTasks = false;
  458. - this._pendingMacroTasks = false;
  459. - this._alreadyErrored = false;
  460. - this._isSync = false;
  461. - this.runZone = Zone.current;
  462. - this.unresolvedChainedPromiseCount = 0;
  463. - this.supportWaitUnresolvedChainedPromise = false;
  464. - this.name = 'asyncTestZone for ' + namePrefix;
  465. - this.properties = { 'AsyncTestZoneSpec': this };
  466. - this.supportWaitUnresolvedChainedPromise =
  467. - _global[Zone.__symbol__('supportWaitUnResolvedChainedPromise')] === true;
  468. - }
  469. - AsyncTestZoneSpec.prototype.isUnresolvedChainedPromisePending = function () {
  470. - return this.unresolvedChainedPromiseCount > 0;
  471. - };
  472. - AsyncTestZoneSpec.prototype._finishCallbackIfDone = function () {
  473. - var _this = this;
  474. - if (!(this._pendingMicroTasks || this._pendingMacroTasks ||
  475. - (this.supportWaitUnresolvedChainedPromise && this.isUnresolvedChainedPromisePending()))) {
  476. - // We do this because we would like to catch unhandled rejected promises.
  477. - this.runZone.run(function () {
  478. - setTimeout(function () {
  479. - if (!_this._alreadyErrored && !(_this._pendingMicroTasks || _this._pendingMacroTasks)) {
  480. - _this.finishCallback();
  481. - }
  482. - }, 0);
  483. - });
  484. - }
  485. - };
  486. - AsyncTestZoneSpec.prototype.patchPromiseForTest = function () {
  487. - if (!this.supportWaitUnresolvedChainedPromise) {
  488. - return;
  489. - }
  490. - var patchPromiseForTest = Promise[Zone.__symbol__('patchPromiseForTest')];
  491. - if (patchPromiseForTest) {
  492. - patchPromiseForTest();
  493. - }
  494. - };
  495. - AsyncTestZoneSpec.prototype.unPatchPromiseForTest = function () {
  496. - if (!this.supportWaitUnresolvedChainedPromise) {
  497. - return;
  498. - }
  499. - var unPatchPromiseForTest = Promise[Zone.__symbol__('unPatchPromiseForTest')];
  500. - if (unPatchPromiseForTest) {
  501. - unPatchPromiseForTest();
  502. - }
  503. - };
  504. - AsyncTestZoneSpec.prototype.onScheduleTask = function (delegate, current, target, task) {
  505. - if (task.type !== 'eventTask') {
  506. - this._isSync = false;
  507. - }
  508. - if (task.type === 'microTask' && task.data && task.data instanceof Promise) {
  509. - // check whether the promise is a chained promise
  510. - if (task.data[AsyncTestZoneSpec.symbolParentUnresolved] === true) {
  511. - // chained promise is being scheduled
  512. - this.unresolvedChainedPromiseCount--;
  513. - }
  514. - }
  515. - return delegate.scheduleTask(target, task);
  516. - };
  517. - AsyncTestZoneSpec.prototype.onInvokeTask = function (delegate, current, target, task, applyThis, applyArgs) {
  518. - if (task.type !== 'eventTask') {
  519. - this._isSync = false;
  520. - }
  521. - return delegate.invokeTask(target, task, applyThis, applyArgs);
  522. - };
  523. - AsyncTestZoneSpec.prototype.onCancelTask = function (delegate, current, target, task) {
  524. - if (task.type !== 'eventTask') {
  525. - this._isSync = false;
  526. - }
  527. - return delegate.cancelTask(target, task);
  528. - };
  529. - // Note - we need to use onInvoke at the moment to call finish when a test is
  530. - // fully synchronous. TODO(juliemr): remove this when the logic for
  531. - // onHasTask changes and it calls whenever the task queues are dirty.
  532. - // updated by(JiaLiPassion), only call finish callback when no task
  533. - // was scheduled/invoked/canceled.
  534. - AsyncTestZoneSpec.prototype.onInvoke = function (parentZoneDelegate, currentZone, targetZone, delegate, applyThis, applyArgs, source) {
  535. - try {
  536. - this._isSync = true;
  537. - return parentZoneDelegate.invoke(targetZone, delegate, applyThis, applyArgs, source);
  538. - }
  539. - finally {
  540. - var afterTaskCounts = parentZoneDelegate._taskCounts;
  541. - if (this._isSync) {
  542. - this._finishCallbackIfDone();
  543. - }
  544. - }
  545. - };
  546. - AsyncTestZoneSpec.prototype.onHandleError = function (parentZoneDelegate, currentZone, targetZone, error) {
  547. - // Let the parent try to handle the error.
  548. - var result = parentZoneDelegate.handleError(targetZone, error);
  549. - if (result) {
  550. - this.failCallback(error);
  551. - this._alreadyErrored = true;
  552. - }
  553. - return false;
  554. - };
  555. - AsyncTestZoneSpec.prototype.onHasTask = function (delegate, current, target, hasTaskState) {
  556. - delegate.hasTask(target, hasTaskState);
  557. - if (hasTaskState.change == 'microTask') {
  558. - this._pendingMicroTasks = hasTaskState.microTask;
  559. - this._finishCallbackIfDone();
  560. - }
  561. - else if (hasTaskState.change == 'macroTask') {
  562. - this._pendingMacroTasks = hasTaskState.macroTask;
  563. - this._finishCallbackIfDone();
  564. - }
  565. - };
  566. - AsyncTestZoneSpec.symbolParentUnresolved = Zone.__symbol__('parentUnresolved');
  567. - return AsyncTestZoneSpec;
  568. -}());
  569. -// Export the class so that new instances can be created with proper
  570. -// constructor params.
  571. -Zone['AsyncTestZoneSpec'] = AsyncTestZoneSpec;
  572. -
  573. -/**
  574. - * @license
  575. - * Copyright Google Inc. All Rights Reserved.
  576. - *
  577. - * Use of this source code is governed by an MIT-style license that can be
  578. - * found in the LICENSE file at https://angular.io/license
  579. - */
  580. -var __read = (undefined && undefined.__read) || function (o, n) {
  581. - var m = typeof Symbol === "function" && o[Symbol.iterator];
  582. - if (!m) return o;
  583. - var i = m.call(o), r, ar = [], e;
  584. - try {
  585. - while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
  586. - }
  587. - catch (error) { e = { error: error }; }
  588. - finally {
  589. - try {
  590. - if (r && !r.done && (m = i["return"])) m.call(i);
  591. - }
  592. - finally { if (e) throw e.error; }
  593. - }
  594. - return ar;
  595. -};
  596. -var __spread = (undefined && undefined.__spread) || function () {
  597. - for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
  598. - return ar;
  599. -};
  600. -(function (global) {
  601. - var OriginalDate = global.Date;
  602. - var FakeDate = /** @class */ (function () {
  603. - function FakeDate() {
  604. - if (arguments.length === 0) {
  605. - var d = new OriginalDate();
  606. - d.setTime(FakeDate.now());
  607. - return d;
  608. - }
  609. - else {
  610. - var args = Array.prototype.slice.call(arguments);
  611. - return new (OriginalDate.bind.apply(OriginalDate, __spread([void 0], args)))();
  612. - }
  613. - }
  614. - FakeDate.now = function () {
  615. - var fakeAsyncTestZoneSpec = Zone.current.get('FakeAsyncTestZoneSpec');
  616. - if (fakeAsyncTestZoneSpec) {
  617. - return fakeAsyncTestZoneSpec.getCurrentRealTime() + fakeAsyncTestZoneSpec.getCurrentTime();
  618. - }
  619. - return OriginalDate.now.apply(this, arguments);
  620. - };
  621. - return FakeDate;
  622. - }());
  623. - FakeDate.UTC = OriginalDate.UTC;
  624. - FakeDate.parse = OriginalDate.parse;
  625. - // keep a reference for zone patched timer function
  626. - var timers = {
  627. - setTimeout: global.setTimeout,
  628. - setInterval: global.setInterval,
  629. - clearTimeout: global.clearTimeout,
  630. - clearInterval: global.clearInterval
  631. - };
  632. - var Scheduler = /** @class */ (function () {
  633. - function Scheduler() {
  634. - // Next scheduler id.
  635. - this.nextId = 1;
  636. - // Scheduler queue with the tuple of end time and callback function - sorted by end time.
  637. - this._schedulerQueue = [];
  638. - // Current simulated time in millis.
  639. - this._currentTime = 0;
  640. - // Current real time in millis.
  641. - this._currentRealTime = OriginalDate.now();
  642. - }
  643. - Scheduler.prototype.getCurrentTime = function () {
  644. - return this._currentTime;
  645. - };
  646. - Scheduler.prototype.getCurrentRealTime = function () {
  647. - return this._currentRealTime;
  648. - };
  649. - Scheduler.prototype.setCurrentRealTime = function (realTime) {
  650. - this._currentRealTime = realTime;
  651. - };
  652. - Scheduler.prototype.scheduleFunction = function (cb, delay, args, isPeriodic, isRequestAnimationFrame, id) {
  653. - if (args === void 0) { args = []; }
  654. - if (isPeriodic === void 0) { isPeriodic = false; }
  655. - if (isRequestAnimationFrame === void 0) { isRequestAnimationFrame = false; }
  656. - if (id === void 0) { id = -1; }
  657. - var currentId = id < 0 ? this.nextId++ : id;
  658. - var endTime = this._currentTime + delay;
  659. - // Insert so that scheduler queue remains sorted by end time.
  660. - var newEntry = {
  661. - endTime: endTime,
  662. - id: currentId,
  663. - func: cb,
  664. - args: args,
  665. - delay: delay,
  666. - isPeriodic: isPeriodic,
  667. - isRequestAnimationFrame: isRequestAnimationFrame
  668. - };
  669. - var i = 0;
  670. - for (; i < this._schedulerQueue.length; i++) {
  671. - var currentEntry = this._schedulerQueue[i];
  672. - if (newEntry.endTime < currentEntry.endTime) {
  673. - break;
  674. - }
  675. - }
  676. - this._schedulerQueue.splice(i, 0, newEntry);
  677. - return currentId;
  678. - };
  679. - Scheduler.prototype.removeScheduledFunctionWithId = function (id) {
  680. - for (var i = 0; i < this._schedulerQueue.length; i++) {
  681. - if (this._schedulerQueue[i].id == id) {
  682. - this._schedulerQueue.splice(i, 1);
  683. - break;
  684. - }
  685. - }
  686. - };
  687. - Scheduler.prototype.tick = function (millis, doTick) {
  688. - if (millis === void 0) { millis = 0; }
  689. - var finalTime = this._currentTime + millis;
  690. - var lastCurrentTime = 0;
  691. - if (this._schedulerQueue.length === 0 && doTick) {
  692. - doTick(millis);
  693. - return;
  694. - }
  695. - while (this._schedulerQueue.length > 0) {
  696. - var current = this._schedulerQueue[0];
  697. - if (finalTime < current.endTime) {
  698. - // Done processing the queue since it's sorted by endTime.
  699. - break;
  700. - }
  701. - else {
  702. - // Time to run scheduled function. Remove it from the head of queue.
  703. - var current_1 = this._schedulerQueue.shift();
  704. - lastCurrentTime = this._currentTime;
  705. - this._currentTime = current_1.endTime;
  706. - if (doTick) {
  707. - doTick(this._currentTime - lastCurrentTime);
  708. - }
  709. - var retval = current_1.func.apply(global, current_1.args);
  710. - if (!retval) {
  711. - // Uncaught exception in the current scheduled function. Stop processing the queue.
  712. - break;
  713. - }
  714. - }
  715. - }
  716. - this._currentTime = finalTime;
  717. - };
  718. - Scheduler.prototype.flush = function (limit, flushPeriodic, doTick) {
  719. - if (limit === void 0) { limit = 20; }
  720. - if (flushPeriodic === void 0) { flushPeriodic = false; }
  721. - if (flushPeriodic) {
  722. - return this.flushPeriodic(doTick);
  723. - }
  724. - else {
  725. - return this.flushNonPeriodic(limit, doTick);
  726. - }
  727. - };
  728. - Scheduler.prototype.flushPeriodic = function (doTick) {
  729. - if (this._schedulerQueue.length === 0) {
  730. - return 0;
  731. - }
  732. - // Find the last task currently queued in the scheduler queue and tick
  733. - // till that time.
  734. - var startTime = this._currentTime;
  735. - var lastTask = this._schedulerQueue[this._schedulerQueue.length - 1];
  736. - this.tick(lastTask.endTime - startTime, doTick);
  737. - return this._currentTime - startTime;
  738. - };
  739. - Scheduler.prototype.flushNonPeriodic = function (limit, doTick) {
  740. - var startTime = this._currentTime;
  741. - var lastCurrentTime = 0;
  742. - var count = 0;
  743. - while (this._schedulerQueue.length > 0) {
  744. - count++;
  745. - if (count > limit) {
  746. - throw new Error('flush failed after reaching the limit of ' + limit +
  747. - ' tasks. Does your code use a polling timeout?');
  748. - }
  749. - // flush only non-periodic timers.
  750. - // If the only remaining tasks are periodic(or requestAnimationFrame), finish flushing.
  751. - if (this._schedulerQueue.filter(function (task) { return !task.isPeriodic && !task.isRequestAnimationFrame; })
  752. - .length === 0) {
  753. - break;
  754. - }
  755. - var current = this._schedulerQueue.shift();
  756. - lastCurrentTime = this._currentTime;
  757. - this._currentTime = current.endTime;
  758. - if (doTick) {
  759. - // Update any secondary schedulers like Jasmine mock Date.
  760. - doTick(this._currentTime - lastCurrentTime);
  761. - }
  762. - var retval = current.func.apply(global, current.args);
  763. - if (!retval) {
  764. - // Uncaught exception in the current scheduled function. Stop processing the queue.
  765. - break;
  766. - }
  767. - }
  768. - return this._currentTime - startTime;
  769. - };
  770. - return Scheduler;
  771. - }());
  772. - var FakeAsyncTestZoneSpec = /** @class */ (function () {
  773. - function FakeAsyncTestZoneSpec(namePrefix, trackPendingRequestAnimationFrame, macroTaskOptions) {
  774. - if (trackPendingRequestAnimationFrame === void 0) { trackPendingRequestAnimationFrame = false; }
  775. - this.trackPendingRequestAnimationFrame = trackPendingRequestAnimationFrame;
  776. - this.macroTaskOptions = macroTaskOptions;
  777. - this._scheduler = new Scheduler();
  778. - this._microtasks = [];
  779. - this._lastError = null;
  780. - this._uncaughtPromiseErrors = Promise[Zone.__symbol__('uncaughtPromiseErrors')];
  781. - this.pendingPeriodicTimers = [];
  782. - this.pendingTimers = [];
  783. - this.patchDateLocked = false;
  784. - this.properties = { 'FakeAsyncTestZoneSpec': this };
  785. - this.name = 'fakeAsyncTestZone for ' + namePrefix;
  786. - // in case user can't access the construction of FakeAsyncTestSpec
  787. - // user can also define macroTaskOptions by define a global variable.
  788. - if (!this.macroTaskOptions) {
  789. - this.macroTaskOptions = global[Zone.__symbol__('FakeAsyncTestMacroTask')];
  790. - }
  791. - }
  792. - FakeAsyncTestZoneSpec.assertInZone = function () {
  793. - if (Zone.current.get('FakeAsyncTestZoneSpec') == null) {
  794. - throw new Error('The code should be running in the fakeAsync zone to call this function');
  795. - }
  796. - };
  797. - FakeAsyncTestZoneSpec.prototype._fnAndFlush = function (fn, completers) {
  798. - var _this = this;
  799. - return function () {
  800. - var args = [];
  801. - for (var _i = 0; _i < arguments.length; _i++) {
  802. - args[_i] = arguments[_i];
  803. - }
  804. - fn.apply(global, args);
  805. - if (_this._lastError === null) {
  806. - if (completers.onSuccess != null) {
  807. - completers.onSuccess.apply(global);
  808. - }
  809. - // Flush microtasks only on success.
  810. - _this.flushMicrotasks();
  811. - }
  812. - else {
  813. - if (completers.onError != null) {
  814. - completers.onError.apply(global);
  815. - }
  816. - }
  817. - // Return true if there were no errors, false otherwise.
  818. - return _this._lastError === null;
  819. - };
  820. - };
  821. - FakeAsyncTestZoneSpec._removeTimer = function (timers, id) {
  822. - var index = timers.indexOf(id);
  823. - if (index > -1) {
  824. - timers.splice(index, 1);
  825. - }
  826. - };
  827. - FakeAsyncTestZoneSpec.prototype._dequeueTimer = function (id) {
  828. - var _this = this;
  829. - return function () {
  830. - FakeAsyncTestZoneSpec._removeTimer(_this.pendingTimers, id);
  831. - };
  832. - };
  833. - FakeAsyncTestZoneSpec.prototype._requeuePeriodicTimer = function (fn, interval, args, id) {
  834. - var _this = this;
  835. - return function () {
  836. - // Requeue the timer callback if it's not been canceled.
  837. - if (_this.pendingPeriodicTimers.indexOf(id) !== -1) {
  838. - _this._scheduler.scheduleFunction(fn, interval, args, true, false, id);
  839. - }
  840. - };
  841. - };
  842. - FakeAsyncTestZoneSpec.prototype._dequeuePeriodicTimer = function (id) {
  843. - var _this = this;
  844. - return function () {
  845. - FakeAsyncTestZoneSpec._removeTimer(_this.pendingPeriodicTimers, id);
  846. - };
  847. - };
  848. - FakeAsyncTestZoneSpec.prototype._setTimeout = function (fn, delay, args, isTimer) {
  849. - if (isTimer === void 0) { isTimer = true; }
  850. - var removeTimerFn = this._dequeueTimer(this._scheduler.nextId);
  851. - // Queue the callback and dequeue the timer on success and error.
  852. - var cb = this._fnAndFlush(fn, { onSuccess: removeTimerFn, onError: removeTimerFn });
  853. - var id = this._scheduler.scheduleFunction(cb, delay, args, false, !isTimer);
  854. - if (isTimer) {
  855. - this.pendingTimers.push(id);
  856. - }
  857. - return id;
  858. - };
  859. - FakeAsyncTestZoneSpec.prototype._clearTimeout = function (id) {
  860. - FakeAsyncTestZoneSpec._removeTimer(this.pendingTimers, id);
  861. - this._scheduler.removeScheduledFunctionWithId(id);
  862. - };
  863. - FakeAsyncTestZoneSpec.prototype._setInterval = function (fn, interval, args) {
  864. - var id = this._scheduler.nextId;
  865. - var completers = { onSuccess: null, onError: this._dequeuePeriodicTimer(id) };
  866. - var cb = this._fnAndFlush(fn, completers);
  867. - // Use the callback created above to requeue on success.
  868. - completers.onSuccess = this._requeuePeriodicTimer(cb, interval, args, id);
  869. - // Queue the callback and dequeue the periodic timer only on error.
  870. - this._scheduler.scheduleFunction(cb, interval, args, true);
  871. - this.pendingPeriodicTimers.push(id);
  872. - return id;
  873. - };
  874. - FakeAsyncTestZoneSpec.prototype._clearInterval = function (id) {
  875. - FakeAsyncTestZoneSpec._removeTimer(this.pendingPeriodicTimers, id);
  876. - this._scheduler.removeScheduledFunctionWithId(id);
  877. - };
  878. - FakeAsyncTestZoneSpec.prototype._resetLastErrorAndThrow = function () {
  879. - var error = this._lastError || this._uncaughtPromiseErrors[0];
  880. - this._uncaughtPromiseErrors.length = 0;
  881. - this._lastError = null;
  882. - throw error;
  883. - };
  884. - FakeAsyncTestZoneSpec.prototype.getCurrentTime = function () {
  885. - return this._scheduler.getCurrentTime();
  886. - };
  887. - FakeAsyncTestZoneSpec.prototype.getCurrentRealTime = function () {
  888. - return this._scheduler.getCurrentRealTime();
  889. - };
  890. - FakeAsyncTestZoneSpec.prototype.setCurrentRealTime = function (realTime) {
  891. - this._scheduler.setCurrentRealTime(realTime);
  892. - };
  893. - FakeAsyncTestZoneSpec.patchDate = function () {
  894. - if (global['Date'] === FakeDate) {
  895. - // already patched
  896. - return;
  897. - }
  898. - global['Date'] = FakeDate;
  899. - FakeDate.prototype = OriginalDate.prototype;
  900. - // try check and reset timers
  901. - // because jasmine.clock().install() may
  902. - // have replaced the global timer
  903. - FakeAsyncTestZoneSpec.checkTimerPatch();
  904. - };
  905. - FakeAsyncTestZoneSpec.resetDate = function () {
  906. - if (global['Date'] === FakeDate) {
  907. - global['Date'] = OriginalDate;
  908. - }
  909. - };
  910. - FakeAsyncTestZoneSpec.checkTimerPatch = function () {
  911. - if (global.setTimeout !== timers.setTimeout) {
  912. - global.setTimeout = timers.setTimeout;
  913. - global.clearTimeout = timers.clearTimeout;
  914. - }
  915. - if (global.setInterval !== timers.setInterval) {
  916. - global.setInterval = timers.setInterval;
  917. - global.clearInterval = timers.clearInterval;
  918. - }
  919. - };
  920. - FakeAsyncTestZoneSpec.prototype.lockDatePatch = function () {
  921. - this.patchDateLocked = true;
  922. - FakeAsyncTestZoneSpec.patchDate();
  923. - };
  924. - FakeAsyncTestZoneSpec.prototype.unlockDatePatch = function () {
  925. - this.patchDateLocked = false;
  926. - FakeAsyncTestZoneSpec.resetDate();
  927. - };
  928. - FakeAsyncTestZoneSpec.prototype.tick = function (millis, doTick) {
  929. - if (millis === void 0) { millis = 0; }
  930. - FakeAsyncTestZoneSpec.assertInZone();
  931. - this.flushMicrotasks();
  932. - this._scheduler.tick(millis, doTick);
  933. - if (this._lastError !== null) {
  934. - this._resetLastErrorAndThrow();
  935. - }
  936. - };
  937. - FakeAsyncTestZoneSpec.prototype.flushMicrotasks = function () {
  938. - var _this = this;
  939. - FakeAsyncTestZoneSpec.assertInZone();
  940. - var flushErrors = function () {
  941. - if (_this._lastError !== null || _this._uncaughtPromiseErrors.length) {
  942. - // If there is an error stop processing the microtask queue and rethrow the error.
  943. - _this._resetLastErrorAndThrow();
  944. - }
  945. - };
  946. - while (this._microtasks.length > 0) {
  947. - var microtask = this._microtasks.shift();
  948. - microtask.func.apply(microtask.target, microtask.args);
  949. - }
  950. - flushErrors();
  951. - };
  952. - FakeAsyncTestZoneSpec.prototype.flush = function (limit, flushPeriodic, doTick) {
  953. - FakeAsyncTestZoneSpec.assertInZone();
  954. - this.flushMicrotasks();
  955. - var elapsed = this._scheduler.flush(limit, flushPeriodic, doTick);
  956. - if (this._lastError !== null) {
  957. - this._resetLastErrorAndThrow();
  958. - }
  959. - return elapsed;
  960. - };
  961. - FakeAsyncTestZoneSpec.prototype.onScheduleTask = function (delegate, current, target, task) {
  962. - switch (task.type) {
  963. - case 'microTask':
  964. - var args = task.data && task.data.args;
  965. - // should pass additional arguments to callback if have any
  966. - // currently we know process.nextTick will have such additional
  967. - // arguments
  968. - var additionalArgs = void 0;
  969. - if (args) {
  970. - var callbackIndex = task.data.cbIdx;
  971. - if (typeof args.length === 'number' && args.length > callbackIndex + 1) {
  972. - additionalArgs = Array.prototype.slice.call(args, callbackIndex + 1);
  973. - }
  974. - }
  975. - this._microtasks.push({
  976. - func: task.invoke,
  977. - args: additionalArgs,
  978. - target: task.data && task.data.target
  979. - });
  980. - break;
  981. - case 'macroTask':
  982. - switch (task.source) {
  983. - case 'setTimeout':
  984. - task.data['handleId'] = this._setTimeout(task.invoke, task.data['delay'], Array.prototype.slice.call(task.data['args'], 2));
  985. - break;
  986. - case 'setImmediate':
  987. - task.data['handleId'] = this._setTimeout(task.invoke, 0, Array.prototype.slice.call(task.data['args'], 1));
  988. - break;
  989. - case 'setInterval':
  990. - task.data['handleId'] = this._setInterval(task.invoke, task.data['delay'], Array.prototype.slice.call(task.data['args'], 2));
  991. - break;
  992. - case 'XMLHttpRequest.send':
  993. - throw new Error('Cannot make XHRs from within a fake async test. Request URL: ' +
  994. - task.data['url']);
  995. - case 'requestAnimationFrame':
  996. - case 'webkitRequestAnimationFrame':
  997. - case 'mozRequestAnimationFrame':
  998. - // Simulate a requestAnimationFrame by using a setTimeout with 16 ms.
  999. - // (60 frames per second)
  1000. - task.data['handleId'] = this._setTimeout(task.invoke, 16, task.data['args'], this.trackPendingRequestAnimationFrame);
  1001. - break;
  1002. - default:
  1003. - // user can define which macroTask they want to support by passing
  1004. - // macroTaskOptions
  1005. - var macroTaskOption = this.findMacroTaskOption(task);
  1006. - if (macroTaskOption) {
  1007. - var args_1 = task.data && task.data['args'];
  1008. - var delay = args_1 && args_1.length > 1 ? args_1[1] : 0;
  1009. - var callbackArgs = macroTaskOption.callbackArgs ? macroTaskOption.callbackArgs : args_1;
  1010. - if (!!macroTaskOption.isPeriodic) {
  1011. - // periodic macroTask, use setInterval to simulate
  1012. - task.data['handleId'] = this._setInterval(task.invoke, delay, callbackArgs);
  1013. - task.data.isPeriodic = true;
  1014. - }
  1015. - else {
  1016. - // not periodic, use setTimeout to simulate
  1017. - task.data['handleId'] = this._setTimeout(task.invoke, delay, callbackArgs);
  1018. - }
  1019. - break;
  1020. - }
  1021. - throw new Error('Unknown macroTask scheduled in fake async test: ' + task.source);
  1022. - }
  1023. - break;
  1024. - case 'eventTask':
  1025. - task = delegate.scheduleTask(target, task);
  1026. - break;
  1027. - }
  1028. - return task;
  1029. - };
  1030. - FakeAsyncTestZoneSpec.prototype.onCancelTask = function (delegate, current, target, task) {
  1031. - switch (task.source) {
  1032. - case 'setTimeout':
  1033. - case 'requestAnimationFrame':
  1034. - case 'webkitRequestAnimationFrame':
  1035. - case 'mozRequestAnimationFrame':
  1036. - return this._clearTimeout(task.data['handleId']);
  1037. - case 'setInterval':
  1038. - return this._clearInterval(task.data['handleId']);
  1039. - default:
  1040. - // user can define which macroTask they want to support by passing
  1041. - // macroTaskOptions
  1042. - var macroTaskOption = this.findMacroTaskOption(task);
  1043. - if (macroTaskOption) {
  1044. - var handleId = task.data['handleId'];
  1045. - return macroTaskOption.isPeriodic ? this._clearInterval(handleId) :
  1046. - this._clearTimeout(handleId);
  1047. - }
  1048. - return delegate.cancelTask(target, task);
  1049. - }
  1050. - };
  1051. - FakeAsyncTestZoneSpec.prototype.onInvoke = function (delegate, current, target, callback, applyThis, applyArgs, source) {
  1052. - try {
  1053. - FakeAsyncTestZoneSpec.patchDate();
  1054. - return delegate.invoke(target, callback, applyThis, applyArgs, source);
  1055. - }
  1056. - finally {
  1057. - if (!this.patchDateLocked) {
  1058. - FakeAsyncTestZoneSpec.resetDate();
  1059. - }
  1060. - }
  1061. - };
  1062. - FakeAsyncTestZoneSpec.prototype.findMacroTaskOption = function (task) {
  1063. - if (!this.macroTaskOptions) {
  1064. - return null;
  1065. - }
  1066. - for (var i = 0; i < this.macroTaskOptions.length; i++) {
  1067. - var macroTaskOption = this.macroTaskOptions[i];
  1068. - if (macroTaskOption.source === task.source) {
  1069. - return macroTaskOption;
  1070. - }
  1071. - }
  1072. - return null;
  1073. - };
  1074. - FakeAsyncTestZoneSpec.prototype.onHandleError = function (parentZoneDelegate, currentZone, targetZone, error) {
  1075. - this._lastError = error;
  1076. - return false; // Don't propagate error to parent zone.
  1077. - };
  1078. - return FakeAsyncTestZoneSpec;
  1079. - }());
  1080. - // Export the class so that new instances can be created with proper
  1081. - // constructor params.
  1082. - Zone['FakeAsyncTestZoneSpec'] = FakeAsyncTestZoneSpec;
  1083. -})(typeof window === 'object' && window || typeof self === 'object' && self || global);
  1084. -
  1085. -/**
  1086. - * @license
  1087. - * Copyright Google Inc. All Rights Reserved.
  1088. - *
  1089. - * Use of this source code is governed by an MIT-style license that can be
  1090. - * found in the LICENSE file at https://angular.io/license
  1091. - */
  1092. -/**
  1093. - * A `TaskTrackingZoneSpec` allows one to track all outstanding Tasks.
  1094. - *
  1095. - * This is useful in tests. For example to see which tasks are preventing a test from completing
  1096. - * or an automated way of releasing all of the event listeners at the end of the test.
  1097. - */
  1098. -var TaskTrackingZoneSpec = /** @class */ (function () {
  1099. - function TaskTrackingZoneSpec() {
  1100. - this.name = 'TaskTrackingZone';
  1101. - this.microTasks = [];
  1102. - this.macroTasks = [];
  1103. - this.eventTasks = [];
  1104. - this.properties = { 'TaskTrackingZone': this };
  1105. - }
  1106. - TaskTrackingZoneSpec.get = function () {
  1107. - return Zone.current.get('TaskTrackingZone');
  1108. - };
  1109. - TaskTrackingZoneSpec.prototype.getTasksFor = function (type) {
  1110. - switch (type) {
  1111. - case 'microTask':
  1112. - return this.microTasks;
  1113. - case 'macroTask':
  1114. - return this.macroTasks;
  1115. - case 'eventTask':
  1116. - return this.eventTasks;
  1117. - }
  1118. - throw new Error('Unknown task format: ' + type);
  1119. - };
  1120. - TaskTrackingZoneSpec.prototype.onScheduleTask = function (parentZoneDelegate, currentZone, targetZone, task) {
  1121. - task['creationLocation'] = new Error("Task '" + task.type + "' from '" + task.source + "'.");
  1122. - var tasks = this.getTasksFor(task.type);
  1123. - tasks.push(task);
  1124. - return parentZoneDelegate.scheduleTask(targetZone, task);
  1125. - };
  1126. - TaskTrackingZoneSpec.prototype.onCancelTask = function (parentZoneDelegate, currentZone, targetZone, task) {
  1127. - var tasks = this.getTasksFor(task.type);
  1128. - for (var i = 0; i < tasks.length; i++) {
  1129. - if (tasks[i] == task) {
  1130. - tasks.splice(i, 1);
  1131. - break;
  1132. - }
  1133. - }
  1134. - return parentZoneDelegate.cancelTask(targetZone, task);
  1135. - };
  1136. - TaskTrackingZoneSpec.prototype.onInvokeTask = function (parentZoneDelegate, currentZone, targetZone, task, applyThis, applyArgs) {
  1137. - if (task.type === 'eventTask')
  1138. - return parentZoneDelegate.invokeTask(targetZone, task, applyThis, applyArgs);
  1139. - var tasks = this.getTasksFor(task.type);
  1140. - for (var i = 0; i < tasks.length; i++) {
  1141. - if (tasks[i] == task) {
  1142. - tasks.splice(i, 1);
  1143. - break;
  1144. - }
  1145. - }
  1146. - return parentZoneDelegate.invokeTask(targetZone, task, applyThis, applyArgs);
  1147. - };
  1148. - TaskTrackingZoneSpec.prototype.clearEvents = function () {
  1149. - while (this.eventTasks.length) {
  1150. - Zone.current.cancelTask(this.eventTasks[0]);
  1151. - }
  1152. - };
  1153. - return TaskTrackingZoneSpec;
  1154. -}());
  1155. -// Export the class so that new instances can be created with proper
  1156. -// constructor params.
  1157. -Zone['TaskTrackingZoneSpec'] = TaskTrackingZoneSpec;
  1158. -
  1159. -/**
  1160. - * @license
  1161. - * Copyright Google Inc. All Rights Reserved.
  1162. - *
  1163. - * Use of this source code is governed by an MIT-style license that can be
  1164. - * found in the LICENSE file at https://angular.io/license
  1165. - */
  1166. -/**
  1167. - * @fileoverview
  1168. - * @suppress {missingRequire}
  1169. - */
  1170. -(function (global) {
  1171. - // Detect and setup WTF.
  1172. - var wtfTrace = null;
  1173. - var wtfEvents = null;
  1174. - var wtfEnabled = (function () {
  1175. - var wtf = global['wtf'];
  1176. - if (wtf) {
  1177. - wtfTrace = wtf.trace;
  1178. - if (wtfTrace) {
  1179. - wtfEvents = wtfTrace.events;
  1180. - return true;
  1181. - }
  1182. - }
  1183. - return false;
  1184. - })();
  1185. - var WtfZoneSpec = /** @class */ (function () {
  1186. - function WtfZoneSpec() {
  1187. - this.name = 'WTF';
  1188. - }
  1189. - WtfZoneSpec.prototype.onFork = function (parentZoneDelegate, currentZone, targetZone, zoneSpec) {
  1190. - var retValue = parentZoneDelegate.fork(targetZone, zoneSpec);
  1191. - WtfZoneSpec.forkInstance(zonePathName(targetZone), retValue.name);
  1192. - return retValue;
  1193. - };
  1194. - WtfZoneSpec.prototype.onInvoke = function (parentZoneDelegate, currentZone, targetZone, delegate, applyThis, applyArgs, source) {
  1195. - var scope = WtfZoneSpec.invokeScope[source];
  1196. - if (!scope) {
  1197. - scope = WtfZoneSpec.invokeScope[source] =
  1198. - wtfEvents.createScope("Zone:invoke:" + source + "(ascii zone)");
  1199. - }
  1200. - return wtfTrace.leaveScope(scope(zonePathName(targetZone)), parentZoneDelegate.invoke(targetZone, delegate, applyThis, applyArgs, source));
  1201. - };
  1202. - WtfZoneSpec.prototype.onHandleError = function (parentZoneDelegate, currentZone, targetZone, error) {
  1203. - return parentZoneDelegate.handleError(targetZone, error);
  1204. - };
  1205. - WtfZoneSpec.prototype.onScheduleTask = function (parentZoneDelegate, currentZone, targetZone, task) {
  1206. - var key = task.type + ':' + task.source;
  1207. - var instance = WtfZoneSpec.scheduleInstance[key];
  1208. - if (!instance) {
  1209. - instance = WtfZoneSpec.scheduleInstance[key] =
  1210. - wtfEvents.createInstance("Zone:schedule:" + key + "(ascii zone, any data)");
  1211. - }
  1212. - var retValue = parentZoneDelegate.scheduleTask(targetZone, task);
  1213. - instance(zonePathName(targetZone), shallowObj(task.data, 2));
  1214. - return retValue;
  1215. - };
  1216. - WtfZoneSpec.prototype.onInvokeTask = function (parentZoneDelegate, currentZone, targetZone, task, applyThis, applyArgs) {
  1217. - var source = task.source;
  1218. - var scope = WtfZoneSpec.invokeTaskScope[source];
  1219. - if (!scope) {
  1220. - scope = WtfZoneSpec.invokeTaskScope[source] =
  1221. - wtfEvents.createScope("Zone:invokeTask:" + source + "(ascii zone)");
  1222. - }
  1223. - return wtfTrace.leaveScope(scope(zonePathName(targetZone)), parentZoneDelegate.invokeTask(targetZone, task, applyThis, applyArgs));
  1224. - };
  1225. - WtfZoneSpec.prototype.onCancelTask = function (parentZoneDelegate, currentZone, targetZone, task) {
  1226. - var key = task.source;
  1227. - var instance = WtfZoneSpec.cancelInstance[key];
  1228. - if (!instance) {
  1229. - instance = WtfZoneSpec.cancelInstance[key] =
  1230. - wtfEvents.createInstance("Zone:cancel:" + key + "(ascii zone, any options)");
  1231. - }
  1232. - var retValue = parentZoneDelegate.cancelTask(targetZone, task);
  1233. - instance(zonePathName(targetZone), shallowObj(task.data, 2));
  1234. - return retValue;
  1235. - };
  1236. - WtfZoneSpec.forkInstance = wtfEnabled && wtfEvents.createInstance('Zone:fork(ascii zone, ascii newZone)');
  1237. - WtfZoneSpec.scheduleInstance = {};
  1238. - WtfZoneSpec.cancelInstance = {};
  1239. - WtfZoneSpec.invokeScope = {};
  1240. - WtfZoneSpec.invokeTaskScope = {};
  1241. - return WtfZoneSpec;
  1242. - }());
  1243. - function shallowObj(obj, depth) {
  1244. - if (!depth)
  1245. - return null;
  1246. - var out = {};
  1247. - for (var key in obj) {
  1248. - if (obj.hasOwnProperty(key)) {
  1249. - var value = obj[key];
  1250. - switch (typeof value) {
  1251. - case 'object':
  1252. - var name_1 = value && value.constructor && value.constructor.name;
  1253. - value = name_1 == Object.name ? shallowObj(value, depth - 1) : name_1;
  1254. - break;
  1255. - case 'function':
  1256. - value = value.name || undefined;
  1257. - break;
  1258. - }
  1259. - out[key] = value;
  1260. - }
  1261. - }
  1262. - return out;
  1263. - }
  1264. - function zonePathName(zone) {
  1265. - var name = zone.name;
  1266. - zone = zone.parent;
  1267. - while (zone != null) {
  1268. - name = zone.name + '::' + name;
  1269. - zone = zone.parent;
  1270. - }
  1271. - return name;
  1272. - }
  1273. - Zone['wtfZoneSpec'] = !wtfEnabled ? null : new WtfZoneSpec();
  1274. -})(typeof window === 'object' && window || typeof self === 'object' && self || global);
  1275. -
  1276. -/**
  1277. - * @license
  1278. - * Copyright Google Inc. All Rights Reserved.
  1279. - *
  1280. - * Use of this source code is governed by an MIT-style license that can be
  1281. - * found in the LICENSE file at https://angular.io/license
  1282. - */
  1283. -(function () {
  1284. - var __extends = function (d, b) {
  1285. - for (var p in b)
  1286. - if (b.hasOwnProperty(p))
  1287. - d[p] = b[p];
  1288. - function __() {
  1289. - this.constructor = d;
  1290. - }
  1291. - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  1292. - };
  1293. - var _global = typeof window !== 'undefined' && window || typeof self !== 'undefined' && self || global;
  1294. - // Patch jasmine's describe/it/beforeEach/afterEach functions so test code always runs
  1295. - // in a testZone (ProxyZone). (See: angular/zone.js#91 & angular/angular#10503)
  1296. - if (!Zone)
  1297. - throw new Error('Missing: zone.js');
  1298. - if (typeof jasmine == 'undefined')
  1299. - throw new Error('Missing: jasmine.js');
  1300. - if (jasmine['__zone_patch__'])
  1301. - throw new Error("'jasmine' has already been patched with 'Zone'.");
  1302. - jasmine['__zone_patch__'] = true;
  1303. - var SyncTestZoneSpec = Zone['SyncTestZoneSpec'];
  1304. - var ProxyZoneSpec = Zone['ProxyZoneSpec'];
  1305. - if (!SyncTestZoneSpec)
  1306. - throw new Error('Missing: SyncTestZoneSpec');
  1307. - if (!ProxyZoneSpec)
  1308. - throw new Error('Missing: ProxyZoneSpec');
  1309. - var ambientZone = Zone.current;
  1310. - // Create a synchronous-only zone in which to run `describe` blocks in order to raise an
  1311. - // error if any asynchronous operations are attempted inside of a `describe` but outside of
  1312. - // a `beforeEach` or `it`.
  1313. - var syncZone = ambientZone.fork(new SyncTestZoneSpec('jasmine.describe'));
  1314. - var symbol = Zone.__symbol__;
  1315. - // whether patch jasmine clock when in fakeAsync
  1316. - var enableClockPatch = _global[symbol('fakeAsyncPatchLock')] === true;
  1317. - // Monkey patch all of the jasmine DSL so that each function runs in appropriate zone.
  1318. - var jasmineEnv = jasmine.getEnv();
  1319. - ['describe', 'xdescribe', 'fdescribe'].forEach(function (methodName) {
  1320. - var originalJasmineFn = jasmineEnv[methodName];
  1321. - jasmineEnv[methodName] = function (description, specDefinitions) {
  1322. - return originalJasmineFn.call(this, description, wrapDescribeInZone(specDefinitions));
  1323. - };
  1324. - });
  1325. - ['it', 'xit', 'fit'].forEach(function (methodName) {
  1326. - var originalJasmineFn = jasmineEnv[methodName];
  1327. - jasmineEnv[symbol(methodName)] = originalJasmineFn;
  1328. - jasmineEnv[methodName] = function (description, specDefinitions, timeout) {
  1329. - arguments[1] = wrapTestInZone(specDefinitions);
  1330. - return originalJasmineFn.apply(this, arguments);
  1331. - };
  1332. - });
  1333. - ['beforeEach', 'afterEach'].forEach(function (methodName) {
  1334. - var originalJasmineFn = jasmineEnv[methodName];
  1335. - jasmineEnv[symbol(methodName)] = originalJasmineFn;
  1336. - jasmineEnv[methodName] = function (specDefinitions, timeout) {
  1337. - arguments[0] = wrapTestInZone(specDefinitions);
  1338. - return originalJasmineFn.apply(this, arguments);
  1339. - };
  1340. - });
  1341. - // need to patch jasmine.clock().mockDate and jasmine.clock().tick() so
  1342. - // they can work properly in FakeAsyncTest
  1343. - var originalClockFn = (jasmine[symbol('clock')] = jasmine['clock']);
  1344. - jasmine['clock'] = function () {
  1345. - var clock = originalClockFn.apply(this, arguments);
  1346. - if (!clock[symbol('patched')]) {
  1347. - clock[symbol('patched')] = symbol('patched');
  1348. - var originalTick_1 = (clock[symbol('tick')] = clock.tick);
  1349. - clock.tick = function () {
  1350. - var fakeAsyncZoneSpec = Zone.current.get('FakeAsyncTestZoneSpec');
  1351. - if (fakeAsyncZoneSpec) {
  1352. - return fakeAsyncZoneSpec.tick.apply(fakeAsyncZoneSpec, arguments);
  1353. - }
  1354. - return originalTick_1.apply(this, arguments);
  1355. - };
  1356. - var originalMockDate_1 = (clock[symbol('mockDate')] = clock.mockDate);
  1357. - clock.mockDate = function () {
  1358. - var fakeAsyncZoneSpec = Zone.current.get('FakeAsyncTestZoneSpec');
  1359. - if (fakeAsyncZoneSpec) {
  1360. - var dateTime = arguments.length > 0 ? arguments[0] : new Date();
  1361. - return fakeAsyncZoneSpec.setCurrentRealTime.apply(fakeAsyncZoneSpec, dateTime && typeof dateTime.getTime === 'function' ? [dateTime.getTime()] :
  1362. - arguments);
  1363. - }
  1364. - return originalMockDate_1.apply(this, arguments);
  1365. - };
  1366. - // for auto go into fakeAsync feature, we need the flag to enable it
  1367. - if (enableClockPatch) {
  1368. - ['install', 'uninstall'].forEach(function (methodName) {
  1369. - var originalClockFn = (clock[symbol(methodName)] = clock[methodName]);
  1370. - clock[methodName] = function () {
  1371. - var FakeAsyncTestZoneSpec = Zone['FakeAsyncTestZoneSpec'];
  1372. - if (FakeAsyncTestZoneSpec) {
  1373. - jasmine[symbol('clockInstalled')] = 'install' === methodName;
  1374. - return;
  1375. - }
  1376. - return originalClockFn.apply(this, arguments);
  1377. - };
  1378. - });
  1379. - }
  1380. - }
  1381. - return clock;
  1382. - };
  1383. - /**
  1384. - * Gets a function wrapping the body of a Jasmine `describe` block to execute in a
  1385. - * synchronous-only zone.
  1386. - */
  1387. - function wrapDescribeInZone(describeBody) {
  1388. - return function () {
  1389. - return syncZone.run(describeBody, this, arguments);
  1390. - };
  1391. - }
  1392. - function runInTestZone(testBody, applyThis, queueRunner, done) {
  1393. - var isClockInstalled = !!jasmine[symbol('clockInstalled')];
  1394. - var testProxyZoneSpec = queueRunner.testProxyZoneSpec;
  1395. - var testProxyZone = queueRunner.testProxyZone;
  1396. - if (isClockInstalled && enableClockPatch) {
  1397. - // auto run a fakeAsync
  1398. - var fakeAsyncModule = Zone[Zone.__symbol__('fakeAsyncTest')];
  1399. - if (fakeAsyncModule && typeof fakeAsyncModule.fakeAsync === 'function') {
  1400. - testBody = fakeAsyncModule.fakeAsync(testBody);
  1401. - }
  1402. - }
  1403. - if (done) {
  1404. - return testProxyZone.run(testBody, applyThis, [done]);
  1405. - }
  1406. - else {
  1407. - return testProxyZone.run(testBody, applyThis);
  1408. - }
  1409. - }
  1410. - /**
  1411. - * Gets a function wrapping the body of a Jasmine `it/beforeEach/afterEach` block to
  1412. - * execute in a ProxyZone zone.
  1413. - * This will run in `testProxyZone`. The `testProxyZone` will be reset by the `ZoneQueueRunner`
  1414. - */
  1415. - function wrapTestInZone(testBody) {
  1416. - // The `done` callback is only passed through if the function expects at least one argument.
  1417. - // Note we have to make a function with correct number of arguments, otherwise jasmine will
  1418. - // think that all functions are sync or async.
  1419. - return (testBody && (testBody.length ? function (done) {
  1420. - return runInTestZone(testBody, this, this.queueRunner, done);
  1421. - } : function () {
  1422. - return runInTestZone(testBody, this, this.queueRunner);
  1423. - }));
  1424. - }
  1425. - var QueueRunner = jasmine.QueueRunner;
  1426. - jasmine.QueueRunner = (function (_super) {
  1427. - __extends(ZoneQueueRunner, _super);
  1428. - function ZoneQueueRunner(attrs) {
  1429. - var _this = this;
  1430. - attrs.onComplete = (function (fn) { return function () {
  1431. - // All functions are done, clear the test zone.
  1432. - _this.testProxyZone = null;
  1433. - _this.testProxyZoneSpec = null;
  1434. - ambientZone.scheduleMicroTask('jasmine.onComplete', fn);
  1435. - }; })(attrs.onComplete);
  1436. - var nativeSetTimeout = _global['__zone_symbol__setTimeout'];
  1437. - var nativeClearTimeout = _global['__zone_symbol__clearTimeout'];
  1438. - if (nativeSetTimeout) {
  1439. - // should run setTimeout inside jasmine outside of zone
  1440. - attrs.timeout = {
  1441. - setTimeout: nativeSetTimeout ? nativeSetTimeout : _global.setTimeout,
  1442. - clearTimeout: nativeClearTimeout ? nativeClearTimeout : _global.clearTimeout
  1443. - };
  1444. - }
  1445. - // create a userContext to hold the queueRunner itself
  1446. - // so we can access the testProxy in it/xit/beforeEach ...
  1447. - if (jasmine.UserContext) {
  1448. - if (!attrs.userContext) {
  1449. - attrs.userContext = new jasmine.UserContext();
  1450. - }
  1451. - attrs.userContext.queueRunner = this;
  1452. - }
  1453. - else {
  1454. - if (!attrs.userContext) {
  1455. - attrs.userContext = {};
  1456. - }
  1457. - attrs.userContext.queueRunner = this;
  1458. - }
  1459. - // patch attrs.onException
  1460. - var onException = attrs.onException;
  1461. - attrs.onException = function (error) {
  1462. - if (error &&
  1463. - error.message ===
  1464. - 'Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.') {
  1465. - // jasmine timeout, we can make the error message more
  1466. - // reasonable to tell what tasks are pending
  1467. - var proxyZoneSpec = this && this.testProxyZoneSpec;
  1468. - if (proxyZoneSpec) {
  1469. - var pendingTasksInfo = proxyZoneSpec.getAndClearPendingTasksInfo();
  1470. - error.message += pendingTasksInfo;
  1471. - }
  1472. - }
  1473. - if (onException) {
  1474. - onException.call(this, error);
  1475. - }
  1476. - };
  1477. - _super.call(this, attrs);
  1478. - }
  1479. - ZoneQueueRunner.prototype.execute = function () {
  1480. - var _this = this;
  1481. - var zone = Zone.current;
  1482. - var isChildOfAmbientZone = false;
  1483. - while (zone) {
  1484. - if (zone === ambientZone) {
  1485. - isChildOfAmbientZone = true;
  1486. - break;
  1487. - }
  1488. - zone = zone.parent;
  1489. - }
  1490. - if (!isChildOfAmbientZone)
  1491. - throw new Error('Unexpected Zone: ' + Zone.current.name);
  1492. - // This is the zone which will be used for running individual tests.
  1493. - // It will be a proxy zone, so that the tests function can retroactively install
  1494. - // different zones.
  1495. - // Example:
  1496. - // - In beforeEach() do childZone = Zone.current.fork(...);
  1497. - // - In it() try to do fakeAsync(). The issue is that because the beforeEach forked the
  1498. - // zone outside of fakeAsync it will be able to escape the fakeAsync rules.
  1499. - // - Because ProxyZone is parent fo `childZone` fakeAsync can retroactively add
  1500. - // fakeAsync behavior to the childZone.
  1501. - this.testProxyZoneSpec = new ProxyZoneSpec();
  1502. - this.testProxyZone = ambientZone.fork(this.testProxyZoneSpec);
  1503. - if (!Zone.currentTask) {
  1504. - // if we are not running in a task then if someone would register a
  1505. - // element.addEventListener and then calling element.click() the
  1506. - // addEventListener callback would think that it is the top most task and would
  1507. - // drain the microtask queue on element.click() which would be incorrect.
  1508. - // For this reason we always force a task when running jasmine tests.
  1509. - Zone.current.scheduleMicroTask('jasmine.execute().forceTask', function () { return QueueRunner.prototype.execute.call(_this); });
  1510. - }
  1511. - else {
  1512. - _super.prototype.execute.call(this);
  1513. - }
  1514. - };
  1515. - return ZoneQueueRunner;
  1516. - })(QueueRunner);
  1517. -})();
  1518. -
  1519. -})));
  1520. diff --git a/node_modules/@nativescript/zone-js/package/zone-nativescript.js b/node_modules/@nativescript/zone-js/package/zone-nativescript.js
  1521. deleted file mode 100644
  1522. index 39a5b55..0000000
  1523. --- a/node_modules/@nativescript/zone-js/package/zone-nativescript.js
  1524. +++ /dev/null
  1525. @@ -1,1681 +0,0 @@
  1526. -/**
  1527. -* @license
  1528. -* Copyright Google Inc. All Rights Reserved.
  1529. -*
  1530. -* Use of this source code is governed by an MIT-style license that can be
  1531. -* found in the LICENSE file at https://angular.io/license
  1532. -*/
  1533. -(function (global, factory) {
  1534. - typeof exports === 'object' && typeof module !== 'undefined' ? factory() :
  1535. - typeof define === 'function' && define.amd ? define(factory) :
  1536. - (factory());
  1537. -}(this, (function () { 'use strict';
  1538. -
  1539. -/**
  1540. - * @license
  1541. - * Copyright Google Inc. All Rights Reserved.
  1542. - *
  1543. - * Use of this source code is governed by an MIT-style license that can be
  1544. - * found in the LICENSE file at https://angular.io/license
  1545. - */
  1546. -var Zone$1 = (function (global) {
  1547. - var FUNCTION = 'function';
  1548. - var performance = global['performance'];
  1549. - function mark(name) {
  1550. - performance && performance['mark'] && performance['mark'](name);
  1551. - }
  1552. - function performanceMeasure(name, label) {
  1553. - performance && performance['measure'] && performance['measure'](name, label);
  1554. - }
  1555. - mark('Zone');
  1556. - if (global['Zone']) {
  1557. - throw new Error('Zone already loaded.');
  1558. - }
  1559. - var Zone = /** @class */ (function () {
  1560. - function Zone(parent, zoneSpec) {
  1561. - this._properties = null;
  1562. - this._parent = parent;
  1563. - this._name = zoneSpec ? zoneSpec.name || 'unnamed' : '<root>';
  1564. - this._properties = zoneSpec && zoneSpec.properties || {};
  1565. - this._zoneDelegate =
  1566. - new ZoneDelegate(this, this._parent && this._parent._zoneDelegate, zoneSpec);
  1567. - }
  1568. - Zone.assertZonePatched = function () {
  1569. - if (global['Promise'] !== patches['ZoneAwarePromise']) {
  1570. - throw new Error('Zone.js has detected that ZoneAwarePromise `(window|global).Promise` ' +
  1571. - 'has been overwritten.\n' +
  1572. - 'Most likely cause is that a Promise polyfill has been loaded ' +
  1573. - 'after Zone.js (Polyfilling Promise api is not necessary when zone.js is loaded. ' +
  1574. - 'If you must load one, do so before loading zone.js.)');
  1575. - }
  1576. - };
  1577. - Object.defineProperty(Zone, "root", {
  1578. - get: function () {
  1579. - var zone = Zone.current;
  1580. - while (zone.parent) {
  1581. - zone = zone.parent;
  1582. - }
  1583. - return zone;
  1584. - },
  1585. - enumerable: true,
  1586. - configurable: true
  1587. - });
  1588. - Object.defineProperty(Zone, "current", {
  1589. - get: function () {
  1590. - return _currentZoneFrame.zone;
  1591. - },
  1592. - enumerable: true,
  1593. - configurable: true
  1594. - });
  1595. - Object.defineProperty(Zone, "currentTask", {
  1596. - get: function () {
  1597. - return _currentTask;
  1598. - },
  1599. - enumerable: true,
  1600. - configurable: true
  1601. - });
  1602. - Zone.__load_patch = function (name, fn) {
  1603. - if (patches.hasOwnProperty(name)) {
  1604. - throw Error('Already loaded patch: ' + name);
  1605. - }
  1606. - else if (!global['__Zone_disable_' + name]) {
  1607. - var perfName = 'Zone:' + name;
  1608. - mark(perfName);
  1609. - patches[name] = fn(global, Zone, _api);
  1610. - performanceMeasure(perfName, perfName);
  1611. - }
  1612. - };
  1613. - Object.defineProperty(Zone.prototype, "parent", {
  1614. - get: function () {
  1615. - return this._parent;
  1616. - },
  1617. - enumerable: true,
  1618. - configurable: true
  1619. - });
  1620. - Object.defineProperty(Zone.prototype, "name", {
  1621. - get: function () {
  1622. - return this._name;
  1623. - },
  1624. - enumerable: true,
  1625. - configurable: true
  1626. - });
  1627. - Zone.prototype.get = function (key) {
  1628. - var zone = this.getZoneWith(key);
  1629. - if (zone)
  1630. - return zone._properties[key];
  1631. - };
  1632. - Zone.prototype.getZoneWith = function (key) {
  1633. - var current = this;
  1634. - while (current) {
  1635. - if (current._properties.hasOwnProperty(key)) {
  1636. - return current;
  1637. - }
  1638. - current = current._parent;
  1639. - }
  1640. - return null;
  1641. - };
  1642. - Zone.prototype.fork = function (zoneSpec) {
  1643. - if (!zoneSpec)
  1644. - throw new Error('ZoneSpec required!');
  1645. - return this._zoneDelegate.fork(this, zoneSpec);
  1646. - };
  1647. - Zone.prototype.wrap = function (callback, source) {
  1648. - if (typeof callback !== FUNCTION) {
  1649. - throw new Error('Expecting function got: ' + callback);
  1650. - }
  1651. - var _callback = this._zoneDelegate.intercept(this, callback, source);
  1652. - var zone = this;
  1653. - return function () {
  1654. - return zone.runGuarded(_callback, this, arguments, source);
  1655. - };
  1656. - };
  1657. - Zone.prototype.run = function (callback, applyThis, applyArgs, source) {
  1658. - if (applyThis === void 0) { applyThis = undefined; }
  1659. - if (applyArgs === void 0) { applyArgs = null; }
  1660. - if (source === void 0) { source = null; }
  1661. - _currentZoneFrame = { parent: _currentZoneFrame, zone: this };
  1662. - try {
  1663. - return this._zoneDelegate.invoke(this, callback, applyThis, applyArgs, source);
  1664. - }
  1665. - finally {
  1666. - _currentZoneFrame = _currentZoneFrame.parent;
  1667. - }
  1668. - };
  1669. - Zone.prototype.runGuarded = function (callback, applyThis, applyArgs, source) {
  1670. - if (applyThis === void 0) { applyThis = null; }
  1671. - if (applyArgs === void 0) { applyArgs = null; }
  1672. - if (source === void 0) { source = null; }
  1673. - _currentZoneFrame = { parent: _currentZoneFrame, zone: this };
  1674. - try {
  1675. - try {
  1676. - return this._zoneDelegate.invoke(this, callback, applyThis, applyArgs, source);
  1677. - }
  1678. - catch (error) {
  1679. - if (this._zoneDelegate.handleError(this, error)) {
  1680. - throw error;
  1681. - }
  1682. - }
  1683. - }
  1684. - finally {
  1685. - _currentZoneFrame = _currentZoneFrame.parent;
  1686. - }
  1687. - };
  1688. - Zone.prototype.runTask = function (task, applyThis, applyArgs) {
  1689. - if (task.zone != this) {
  1690. - throw new Error('A task can only be run in the zone of creation! (Creation: ' +
  1691. - (task.zone || NO_ZONE).name + '; Execution: ' + this.name + ')');
  1692. - }
  1693. - // https://github.com/angular/zone.js/issues/778, sometimes eventTask
  1694. - // will run in notScheduled(canceled) state, we should not try to
  1695. - // run such kind of task but just return
  1696. - // we have to define an variable here, if not
  1697. - // typescript compiler will complain below
  1698. - var isNotScheduled = task.state === notScheduled;
  1699. - if (isNotScheduled && task.type === eventTask) {
  1700. - return;
  1701. - }
  1702. - var reEntryGuard = task.state != running;
  1703. - reEntryGuard && task._transitionTo(running, scheduled);
  1704. - task.runCount++;
  1705. - var previousTask = _currentTask;
  1706. - _currentTask = task;
  1707. - _currentZoneFrame = { parent: _currentZoneFrame, zone: this };
  1708. - try {
  1709. - if (task.type == macroTask && task.data && !task.data.isPeriodic) {
  1710. - task.cancelFn = null;
  1711. - }
  1712. - try {
  1713. - return this._zoneDelegate.invokeTask(this, task, applyThis, applyArgs);
  1714. - }
  1715. - catch (error) {
  1716. - if (this._zoneDelegate.handleError(this, error)) {
  1717. - throw error;
  1718. - }
  1719. - }
  1720. - }
  1721. - finally {
  1722. - // if the task's state is notScheduled or unknown, then it has already been cancelled
  1723. - // we should not reset the state to scheduled
  1724. - if (task.state !== notScheduled && task.state !== unknown) {
  1725. - if (task.type == eventTask || (task.data && task.data.isPeriodic)) {
  1726. - reEntryGuard && task._transitionTo(scheduled, running);
  1727. - }
  1728. - else {
  1729. - task.runCount = 0;
  1730. - this._updateTaskCount(task, -1);
  1731. - reEntryGuard &&
  1732. - task._transitionTo(notScheduled, running, notScheduled);
  1733. - }
  1734. - }
  1735. - _currentZoneFrame = _currentZoneFrame.parent;
  1736. - _currentTask = previousTask;
  1737. - }
  1738. - };
  1739. - Zone.prototype.scheduleTask = function (task) {
  1740. - if (task.zone && task.zone !== this) {
  1741. - // check if the task was rescheduled, the newZone
  1742. - // should not be the children of the original zone
  1743. - var newZone = this;
  1744. - while (newZone) {
  1745. - if (newZone === task.zone) {
  1746. - throw Error("can not reschedule task to " + this
  1747. - .name + " which is descendants of the original zone " + task.zone.name);
  1748. - }
  1749. - newZone = newZone.parent;
  1750. - }
  1751. - }
  1752. - task._transitionTo(scheduling, notScheduled);
  1753. - var zoneDelegates = [];
  1754. - task._zoneDelegates = zoneDelegates;
  1755. - task._zone = this;
  1756. - try {
  1757. - task = this._zoneDelegate.scheduleTask(this, task);
  1758. - }
  1759. - catch (err) {
  1760. - // should set task's state to unknown when scheduleTask throw error
  1761. - // because the err may from reschedule, so the fromState maybe notScheduled
  1762. - task._transitionTo(unknown, scheduling, notScheduled);
  1763. - // TODO: @JiaLiPassion, should we check the result from handleError?
  1764. - this._zoneDelegate.handleError(this, err);
  1765. - throw err;
  1766. - }
  1767. - if (task._zoneDelegates === zoneDelegates) {
  1768. - // we have to check because internally the delegate can reschedule the task.
  1769. - this._updateTaskCount(task, 1);
  1770. - }
  1771. - if (task.state == scheduling) {
  1772. - task._transitionTo(scheduled, scheduling);
  1773. - }
  1774. - return task;
  1775. - };
  1776. - Zone.prototype.scheduleMicroTask = function (source, callback, data, customSchedule) {
  1777. - return this.scheduleTask(new ZoneTask(microTask, source, callback, data, customSchedule, null));
  1778. - };
  1779. - Zone.prototype.scheduleMacroTask = function (source, callback, data, customSchedule, customCancel) {
  1780. - return this.scheduleTask(new ZoneTask(macroTask, source, callback, data, customSchedule, customCancel));
  1781. - };
  1782. - Zone.prototype.scheduleEventTask = function (source, callback, data, customSchedule, customCancel) {
  1783. - return this.scheduleTask(new ZoneTask(eventTask, source, callback, data, customSchedule, customCancel));
  1784. - };
  1785. - Zone.prototype.cancelTask = function (task) {
  1786. - if (task.zone != this)
  1787. - throw new Error('A task can only be cancelled in the zone of creation! (Creation: ' +
  1788. - (task.zone || NO_ZONE).name + '; Execution: ' + this.name + ')');
  1789. - task._transitionTo(canceling, scheduled, running);
  1790. - try {
  1791. - this._zoneDelegate.cancelTask(this, task);
  1792. - }
  1793. - catch (err) {
  1794. - // if error occurs when cancelTask, transit the state to unknown
  1795. - task._transitionTo(unknown, canceling);
  1796. - this._zoneDelegate.handleError(this, err);
  1797. - throw err;
  1798. - }
  1799. - this._updateTaskCount(task, -1);
  1800. - task._transitionTo(notScheduled, canceling);
  1801. - task.runCount = 0;
  1802. - return task;
  1803. - };
  1804. - Zone.prototype._updateTaskCount = function (task, count) {
  1805. - var zoneDelegates = task._zoneDelegates;
  1806. - if (count == -1) {
  1807. - task._zoneDelegates = null;
  1808. - }
  1809. - for (var i = 0; i < zoneDelegates.length; i++) {
  1810. - zoneDelegates[i]._updateTaskCount(task.type, count);
  1811. - }
  1812. - };
  1813. - Zone.__symbol__ = __symbol__;
  1814. - return Zone;
  1815. - }());
  1816. - var DELEGATE_ZS = {
  1817. - name: '',
  1818. - onHasTask: function (delegate, _, target, hasTaskState) {
  1819. - return delegate.hasTask(target, hasTaskState);
  1820. - },
  1821. - onScheduleTask: function (delegate, _, target, task) {
  1822. - return delegate.scheduleTask(target, task);
  1823. - },
  1824. - onInvokeTask: function (delegate, _, target, task, applyThis, applyArgs) { return delegate.invokeTask(target, task, applyThis, applyArgs); },
  1825. - onCancelTask: function (delegate, _, target, task) {
  1826. - return delegate.cancelTask(target, task);
  1827. - }
  1828. - };
  1829. - var ZoneDelegate = /** @class */ (function () {
  1830. - function ZoneDelegate(zone, parentDelegate, zoneSpec) {
  1831. - this._taskCounts = { 'microTask': 0, 'macroTask': 0, 'eventTask': 0 };
  1832. - this.zone = zone;
  1833. - this._parentDelegate = parentDelegate;
  1834. - this._forkZS = zoneSpec && (zoneSpec && zoneSpec.onFork ? zoneSpec : parentDelegate._forkZS);
  1835. - this._forkDlgt = zoneSpec && (zoneSpec.onFork ? parentDelegate : parentDelegate._forkDlgt);
  1836. - this._forkCurrZone = zoneSpec && (zoneSpec.onFork ? this.zone : parentDelegate.zone);
  1837. - this._interceptZS =
  1838. - zoneSpec && (zoneSpec.onIntercept ? zoneSpec : parentDelegate._interceptZS);
  1839. - this._interceptDlgt =
  1840. - zoneSpec && (zoneSpec.onIntercept ? parentDelegate : parentDelegate._interceptDlgt);
  1841. - this._interceptCurrZone =
  1842. - zoneSpec && (zoneSpec.onIntercept ? this.zone : parentDelegate.zone);
  1843. - this._invokeZS = zoneSpec && (zoneSpec.onInvoke ? zoneSpec : parentDelegate._invokeZS);
  1844. - this._invokeDlgt =
  1845. - zoneSpec && (zoneSpec.onInvoke ? parentDelegate : parentDelegate._invokeDlgt);
  1846. - this._invokeCurrZone = zoneSpec && (zoneSpec.onInvoke ? this.zone : parentDelegate.zone);
  1847. - this._handleErrorZS =
  1848. - zoneSpec && (zoneSpec.onHandleError ? zoneSpec : parentDelegate._handleErrorZS);
  1849. - this._handleErrorDlgt =
  1850. - zoneSpec && (zoneSpec.onHandleError ? parentDelegate : parentDelegate._handleErrorDlgt);
  1851. - this._handleErrorCurrZone =
  1852. - zoneSpec && (zoneSpec.onHandleError ? this.zone : parentDelegate.zone);
  1853. - this._scheduleTaskZS =
  1854. - zoneSpec && (zoneSpec.onScheduleTask ? zoneSpec : parentDelegate._scheduleTaskZS);
  1855. - this._scheduleTaskDlgt =
  1856. - zoneSpec && (zoneSpec.onScheduleTask ? parentDelegate : parentDelegate._scheduleTaskDlgt);
  1857. - this._scheduleTaskCurrZone =
  1858. - zoneSpec && (zoneSpec.onScheduleTask ? this.zone : parentDelegate.zone);
  1859. - this._invokeTaskZS =
  1860. - zoneSpec && (zoneSpec.onInvokeTask ? zoneSpec : parentDelegate._invokeTaskZS);
  1861. - this._invokeTaskDlgt =
  1862. - zoneSpec && (zoneSpec.onInvokeTask ? parentDelegate : parentDelegate._invokeTaskDlgt);
  1863. - this._invokeTaskCurrZone =
  1864. - zoneSpec && (zoneSpec.onInvokeTask ? this.zone : parentDelegate.zone);
  1865. - this._cancelTaskZS =
  1866. - zoneSpec && (zoneSpec.onCancelTask ? zoneSpec : parentDelegate._cancelTaskZS);
  1867. - this._cancelTaskDlgt =
  1868. - zoneSpec && (zoneSpec.onCancelTask ? parentDelegate : parentDelegate._cancelTaskDlgt);
  1869. - this._cancelTaskCurrZone =
  1870. - zoneSpec && (zoneSpec.onCancelTask ? this.zone : parentDelegate.zone);
  1871. - this._hasTaskZS = null;
  1872. - this._hasTaskDlgt = null;
  1873. - this._hasTaskDlgtOwner = null;
  1874. - this._hasTaskCurrZone = null;
  1875. - var zoneSpecHasTask = zoneSpec && zoneSpec.onHasTask;
  1876. - var parentHasTask = parentDelegate && parentDelegate._hasTaskZS;
  1877. - if (zoneSpecHasTask || parentHasTask) {
  1878. - // If we need to report hasTask, than this ZS needs to do ref counting on tasks. In such
  1879. - // a case all task related interceptors must go through this ZD. We can't short circuit it.
  1880. - this._hasTaskZS = zoneSpecHasTask ? zoneSpec : DELEGATE_ZS;
  1881. - this._hasTaskDlgt = parentDelegate;
  1882. - this._hasTaskDlgtOwner = this;
  1883. - this._hasTaskCurrZone = zone;
  1884. - if (!zoneSpec.onScheduleTask) {
  1885. - this._scheduleTaskZS = DELEGATE_ZS;
  1886. - this._scheduleTaskDlgt = parentDelegate;
  1887. - this._scheduleTaskCurrZone = this.zone;
  1888. - }
  1889. - if (!zoneSpec.onInvokeTask) {
  1890. - this._invokeTaskZS = DELEGATE_ZS;
  1891. - this._invokeTaskDlgt = parentDelegate;
  1892. - this._invokeTaskCurrZone = this.zone;
  1893. - }
  1894. - if (!zoneSpec.onCancelTask) {
  1895. - this._cancelTaskZS = DELEGATE_ZS;
  1896. - this._cancelTaskDlgt = parentDelegate;
  1897. - this._cancelTaskCurrZone = this.zone;
  1898. - }
  1899. - }
  1900. - }
  1901. - ZoneDelegate.prototype.fork = function (targetZone, zoneSpec) {
  1902. - return this._forkZS ? this._forkZS.onFork(this._forkDlgt, this.zone, targetZone, zoneSpec) :
  1903. - new Zone(targetZone, zoneSpec);
  1904. - };
  1905. - ZoneDelegate.prototype.intercept = function (targetZone, callback, source) {
  1906. - return this._interceptZS ?
  1907. - this._interceptZS.onIntercept(this._interceptDlgt, this._interceptCurrZone, targetZone, callback, source) :
  1908. - callback;
  1909. - };
  1910. - ZoneDelegate.prototype.invoke = function (targetZone, callback, applyThis, applyArgs, source) {
  1911. - return this._invokeZS ?
  1912. - this._invokeZS.onInvoke(this._invokeDlgt, this._invokeCurrZone, targetZone, callback, applyThis, applyArgs, source) :
  1913. - callback.apply(applyThis, applyArgs);
  1914. - };
  1915. - ZoneDelegate.prototype.handleError = function (targetZone, error) {
  1916. - return this._handleErrorZS ?
  1917. - this._handleErrorZS.onHandleError(this._handleErrorDlgt, this._handleErrorCurrZone, targetZone, error) :
  1918. - true;
  1919. - };
  1920. - ZoneDelegate.prototype.scheduleTask = function (targetZone, task) {
  1921. - var returnTask = task;
  1922. - if (this._scheduleTaskZS) {
  1923. - if (this._hasTaskZS) {
  1924. - returnTask._zoneDelegates.push(this._hasTaskDlgtOwner);
  1925. - }
  1926. - returnTask = this._scheduleTaskZS.onScheduleTask(this._scheduleTaskDlgt, this._scheduleTaskCurrZone, targetZone, task);
  1927. - if (!returnTask)
  1928. - returnTask = task;
  1929. - }
  1930. - else {
  1931. - if (task.scheduleFn) {
  1932. - task.scheduleFn(task);
  1933. - }
  1934. - else if (task.type == microTask) {
  1935. - scheduleMicroTask(task);
  1936. - }
  1937. - else {
  1938. - throw new Error('Task is missing scheduleFn.');
  1939. - }
  1940. - }
  1941. - return returnTask;
  1942. - };
  1943. - ZoneDelegate.prototype.invokeTask = function (targetZone, task, applyThis, applyArgs) {
  1944. - return this._invokeTaskZS ?
  1945. - this._invokeTaskZS.onInvokeTask(this._invokeTaskDlgt, this._invokeTaskCurrZone, targetZone, task, applyThis, applyArgs) :
  1946. - task.callback.apply(applyThis, applyArgs);
  1947. - };
  1948. - ZoneDelegate.prototype.cancelTask = function (targetZone, task) {
  1949. - var value;
  1950. - if (this._cancelTaskZS) {
  1951. - value = this._cancelTaskZS.onCancelTask(this._cancelTaskDlgt, this._cancelTaskCurrZone, targetZone, task);
  1952. - }
  1953. - else {
  1954. - if (!task.cancelFn) {
  1955. - throw Error('Task is not cancelable');
  1956. - }
  1957. - value = task.cancelFn(task);
  1958. - }
  1959. - return value;
  1960. - };
  1961. - ZoneDelegate.prototype.hasTask = function (targetZone, isEmpty) {
  1962. - // hasTask should not throw error so other ZoneDelegate
  1963. - // can still trigger hasTask callback
  1964. - try {
  1965. - return this._hasTaskZS &&
  1966. - this._hasTaskZS.onHasTask(this._hasTaskDlgt, this._hasTaskCurrZone, targetZone, isEmpty);
  1967. - }
  1968. - catch (err) {
  1969. - this.handleError(targetZone, err);
  1970. - }
  1971. - };
  1972. - ZoneDelegate.prototype._updateTaskCount = function (type, count) {
  1973. - var counts = this._taskCounts;
  1974. - var prev = counts[type];
  1975. - var next = counts[type] = prev + count;
  1976. - if (next < 0) {
  1977. - throw new Error('More tasks executed then were scheduled.');
  1978. - }
  1979. - if (prev == 0 || next == 0) {
  1980. - var isEmpty = {
  1981. - microTask: counts['microTask'] > 0,
  1982. - macroTask: counts['macroTask'] > 0,
  1983. - eventTask: counts['eventTask'] > 0,
  1984. - change: type
  1985. - };
  1986. - this.hasTask(this.zone, isEmpty);
  1987. - }
  1988. - };
  1989. - return ZoneDelegate;
  1990. - }());
  1991. - var ZoneTask = /** @class */ (function () {
  1992. - function ZoneTask(type, source, callback, options, scheduleFn, cancelFn) {
  1993. - this._zone = null;
  1994. - this.runCount = 0;
  1995. - this._zoneDelegates = null;
  1996. - this._state = 'notScheduled';
  1997. - this.type = type;
  1998. - this.source = source;
  1999. - this.data = options;
  2000. - this.scheduleFn = scheduleFn;
  2001. - this.cancelFn = cancelFn;
  2002. - this.callback = callback;
  2003. - var self = this;
  2004. - // TODO: @JiaLiPassion options should have interface
  2005. - if (type === eventTask && options && options.useG) {
  2006. - this.invoke = ZoneTask.invokeTask;
  2007. - }
  2008. - else {
  2009. - this.invoke = function () {
  2010. - return ZoneTask.invokeTask.call(global, self, this, arguments);
  2011. - };
  2012. - }
  2013. - }
  2014. - ZoneTask.invokeTask = function (task, target, args) {
  2015. - if (!task) {
  2016. - task = this;
  2017. - }
  2018. - _numberOfNestedTaskFrames++;
  2019. - try {
  2020. - task.runCount++;
  2021. - return task.zone.runTask(task, target, args);
  2022. - }
  2023. - finally {
  2024. - if (_numberOfNestedTaskFrames == 1) {
  2025. - drainMicroTaskQueue();
  2026. - }
  2027. - _numberOfNestedTaskFrames--;
  2028. - }
  2029. - };
  2030. - Object.defineProperty(ZoneTask.prototype, "zone", {
  2031. - get: function () {
  2032. - return this._zone;
  2033. - },
  2034. - enumerable: true,
  2035. - configurable: true
  2036. - });
  2037. - Object.defineProperty(ZoneTask.prototype, "state", {
  2038. - get: function () {
  2039. - return this._state;
  2040. - },
  2041. - enumerable: true,
  2042. - configurable: true
  2043. - });
  2044. - ZoneTask.prototype.cancelScheduleRequest = function () {
  2045. - this._transitionTo(notScheduled, scheduling);
  2046. - };
  2047. - ZoneTask.prototype._transitionTo = function (toState, fromState1, fromState2) {
  2048. - if (this._state === fromState1 || this._state === fromState2) {
  2049. - this._state = toState;
  2050. - if (toState == notScheduled) {
  2051. - this._zoneDelegates = null;
  2052. - }
  2053. - }
  2054. - else {
  2055. - throw new Error(this.type + " '" + this.source + "': can not transition to '" + toState + "', expecting state '" + fromState1 + "'" + (fromState2 ?
  2056. - ' or \'' + fromState2 + '\'' :
  2057. - '') + ", was '" + this._state + "'.");
  2058. - }
  2059. - };
  2060. - ZoneTask.prototype.toString = function () {
  2061. - if (this.data && typeof this.data.handleId !== 'undefined') {
  2062. - return this.data.handleId;
  2063. - }
  2064. - else {
  2065. - return Object.prototype.toString.call(this);
  2066. - }
  2067. - };
  2068. - // add toJSON method to prevent cyclic error when
  2069. - // call JSON.stringify(zoneTask)
  2070. - ZoneTask.prototype.toJSON = function () {
  2071. - return {
  2072. - type: this.type,
  2073. - state: this.state,
  2074. - source: this.source,
  2075. - zone: this.zone.name,
  2076. - runCount: this.runCount
  2077. - };
  2078. - };
  2079. - return ZoneTask;
  2080. - }());
  2081. - //////////////////////////////////////////////////////
  2082. - //////////////////////////////////////////////////////
  2083. - /// MICROTASK QUEUE
  2084. - //////////////////////////////////////////////////////
  2085. - //////////////////////////////////////////////////////
  2086. - var symbolSetTimeout = __symbol__('setTimeout');
  2087. - var symbolPromise = __symbol__('Promise');
  2088. - var symbolThen = __symbol__('then');
  2089. - var _microTaskQueue = [];
  2090. - var _isDrainingMicrotaskQueue = false;
  2091. - var nativeMicroTaskQueuePromise;
  2092. - function scheduleMicroTask(task) {
  2093. - // if we are not running in any task, and there has not been anything scheduled
  2094. - // we must bootstrap the initial task creation by manually scheduling the drain
  2095. - if (_numberOfNestedTaskFrames === 0 && _microTaskQueue.length === 0) {
  2096. - // We are not running in Task, so we need to kickstart the microtask queue.
  2097. - if (!nativeMicroTaskQueuePromise) {
  2098. - if (global[symbolPromise]) {
  2099. - nativeMicroTaskQueuePromise = global[symbolPromise].resolve(0);
  2100. - }
  2101. - }
  2102. - if (nativeMicroTaskQueuePromise) {
  2103. - nativeMicroTaskQueuePromise[symbolThen](drainMicroTaskQueue);
  2104. - }
  2105. - else {
  2106. - global[symbolSetTimeout](drainMicroTaskQueue, 0);
  2107. - }
  2108. - }
  2109. - task && _microTaskQueue.push(task);
  2110. - }
  2111. - function drainMicroTaskQueue() {
  2112. - if (!_isDrainingMicrotaskQueue) {
  2113. - _isDrainingMicrotaskQueue = true;
  2114. - while (_microTaskQueue.length) {
  2115. - var queue = _microTaskQueue;
  2116. - _microTaskQueue = [];
  2117. - for (var i = 0; i < queue.length; i++) {
  2118. - var task = queue[i];
  2119. - try {
  2120. - task.zone.runTask(task, null, null);
  2121. - }
  2122. - catch (error) {
  2123. - _api.onUnhandledError(error);
  2124. - }
  2125. - }
  2126. - }
  2127. - _api.microtaskDrainDone();
  2128. - _isDrainingMicrotaskQueue = false;
  2129. - }
  2130. - }
  2131. - Zone.drainMicroTaskQueue = drainMicroTaskQueue;
  2132. - //////////////////////////////////////////////////////
  2133. - //////////////////////////////////////////////////////
  2134. - /// BOOTSTRAP
  2135. - //////////////////////////////////////////////////////
  2136. - //////////////////////////////////////////////////////
  2137. - var NO_ZONE = { name: 'NO ZONE' };
  2138. - var notScheduled = 'notScheduled', scheduling = 'scheduling', scheduled = 'scheduled', running = 'running', canceling = 'canceling', unknown = 'unknown';
  2139. - var microTask = 'microTask', macroTask = 'macroTask', eventTask = 'eventTask';
  2140. - var patches = {};
  2141. - var _api = {
  2142. - symbol: __symbol__,
  2143. - currentZoneFrame: function () { return _currentZoneFrame; },
  2144. - onUnhandledError: noop,
  2145. - microtaskDrainDone: noop,
  2146. - scheduleMicroTask: scheduleMicroTask,
  2147. - showUncaughtError: function () { return !Zone[__symbol__('ignoreConsoleErrorUncaughtError')]; },
  2148. - patchEventTarget: function () { return []; },
  2149. - patchOnProperties: noop,
  2150. - patchMethod: function () { return noop; },
  2151. - bindArguments: function () { return null; },
  2152. - setNativePromise: function (NativePromise) {
  2153. - // sometimes NativePromise.resolve static function
  2154. - // is not ready yet, (such as core-js/es6.promise)
  2155. - // so we need to check here.
  2156. - if (NativePromise && typeof NativePromise.resolve === FUNCTION) {
  2157. - nativeMicroTaskQueuePromise = NativePromise.resolve(0);
  2158. - }
  2159. - },
  2160. - };
  2161. - var _currentZoneFrame = { parent: null, zone: new Zone(null, null) };
  2162. - var _currentTask = null;
  2163. - var _numberOfNestedTaskFrames = 0;
  2164. - function noop() { }
  2165. - function __symbol__(name) {
  2166. - return '__zone_symbol__' + name;
  2167. - }
  2168. - performanceMeasure('Zone', 'Zone');
  2169. - return global['Zone'] = Zone;
  2170. -})(typeof window !== 'undefined' && window || typeof self !== 'undefined' && self || global);
  2171. -
  2172. -var __values = (undefined && undefined.__values) || function (o) {
  2173. - var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
  2174. - if (m) return m.call(o);
  2175. - return {
  2176. - next: function () {
  2177. - if (o && i >= o.length) o = void 0;
  2178. - return { value: o && o[i++], done: !o };
  2179. - }
  2180. - };
  2181. -};
  2182. -Zone.__load_patch('ZoneAwarePromise', function (global, Zone, api) {
  2183. - var ObjectGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
  2184. - var ObjectDefineProperty = Object.defineProperty;
  2185. - function readableObjectToString(obj) {
  2186. - if (obj && obj.toString === Object.prototype.toString) {
  2187. - var className = obj.constructor && obj.constructor.name;
  2188. - return (className ? className : '') + ': ' + JSON.stringify(obj);
  2189. - }
  2190. - return obj ? obj.toString() : Object.prototype.toString.call(obj);
  2191. - }
  2192. - var __symbol__ = api.symbol;
  2193. - var _uncaughtPromiseErrors = [];
  2194. - var symbolPromise = __symbol__('Promise');
  2195. - var symbolThen = __symbol__('then');
  2196. - var creationTrace = '__creationTrace__';
  2197. - api.onUnhandledError = function (e) {
  2198. - if (api.showUncaughtError()) {
  2199. - var rejection = e && e.rejection;
  2200. - if (rejection) {
  2201. - console.error('Unhandled Promise rejection:', rejection instanceof Error ? rejection.message : rejection, '; Zone:', e.zone.name, '; Task:', e.task && e.task.source, '; Value:', rejection, rejection instanceof Error ? rejection.stack : undefined);
  2202. - }
  2203. - else {
  2204. - console.error(e);
  2205. - }
  2206. - }
  2207. - };
  2208. - api.microtaskDrainDone = function () {
  2209. - while (_uncaughtPromiseErrors.length) {
  2210. - var _loop_1 = function () {
  2211. - var uncaughtPromiseError = _uncaughtPromiseErrors.shift();
  2212. - try {
  2213. - uncaughtPromiseError.zone.runGuarded(function () {
  2214. - throw uncaughtPromiseError;
  2215. - });
  2216. - }
  2217. - catch (error) {
  2218. - handleUnhandledRejection(error);
  2219. - }
  2220. - };
  2221. - while (_uncaughtPromiseErrors.length) {
  2222. - _loop_1();
  2223. - }
  2224. - }
  2225. - };
  2226. - var UNHANDLED_PROMISE_REJECTION_HANDLER_SYMBOL = __symbol__('unhandledPromiseRejectionHandler');
  2227. - function handleUnhandledRejection(e) {
  2228. - api.onUnhandledError(e);
  2229. - try {
  2230. - var handler = Zone[UNHANDLED_PROMISE_REJECTION_HANDLER_SYMBOL];
  2231. - if (handler && typeof handler === 'function') {
  2232. - handler.call(this, e);
  2233. - }
  2234. - }
  2235. - catch (err) {
  2236. - }
  2237. - }
  2238. - function isThenable(value) {
  2239. - return value && value.then;
  2240. - }
  2241. - function forwardResolution(value) {
  2242. - return value;
  2243. - }
  2244. - function forwardRejection(rejection) {
  2245. - return ZoneAwarePromise.reject(rejection);
  2246. - }
  2247. - var symbolState = __symbol__('state');
  2248. - var symbolValue = __symbol__('value');
  2249. - var symbolFinally = __symbol__('finally');
  2250. - var symbolParentPromiseValue = __symbol__('parentPromiseValue');
  2251. - var symbolParentPromiseState = __symbol__('parentPromiseState');
  2252. - var source = 'Promise.then';
  2253. - var UNRESOLVED = null;
  2254. - var RESOLVED = true;
  2255. - var REJECTED = false;
  2256. - var REJECTED_NO_CATCH = 0;
  2257. - function makeResolver(promise, state) {
  2258. - return function (v) {
  2259. - try {
  2260. - resolvePromise(promise, state, v);
  2261. - }
  2262. - catch (err) {
  2263. - resolvePromise(promise, false, err);
  2264. - }
  2265. - // Do not return value or you will break the Promise spec.
  2266. - };
  2267. - }
  2268. - var once = function () {
  2269. - var wasCalled = false;
  2270. - return function wrapper(wrappedFunction) {
  2271. - return function () {
  2272. - if (wasCalled) {
  2273. - return;
  2274. - }
  2275. - wasCalled = true;
  2276. - wrappedFunction.apply(null, arguments);
  2277. - };
  2278. - };
  2279. - };
  2280. - var TYPE_ERROR = 'Promise resolved with itself';
  2281. - var CURRENT_TASK_TRACE_SYMBOL = __symbol__('currentTaskTrace');
  2282. - // Promise Resolution
  2283. - function resolvePromise(promise, state, value) {
  2284. - var onceWrapper = once();
  2285. - if (promise === value) {
  2286. - throw new TypeError(TYPE_ERROR);
  2287. - }
  2288. - if (promise[symbolState] === UNRESOLVED) {
  2289. - // should only get value.then once based on promise spec.
  2290. - var then = null;
  2291. - try {
  2292. - if (typeof value === 'object' || typeof value === 'function') {
  2293. - then = value && value.then;
  2294. - }
  2295. - }
  2296. - catch (err) {
  2297. - onceWrapper(function () {
  2298. - resolvePromise(promise, false, err);
  2299. - })();
  2300. - return promise;
  2301. - }
  2302. - // if (value instanceof ZoneAwarePromise) {
  2303. - if (state !== REJECTED && value instanceof ZoneAwarePromise &&
  2304. - value.hasOwnProperty(symbolState) && value.hasOwnProperty(symbolValue) &&
  2305. - value[symbolState] !== UNRESOLVED) {
  2306. - clearRejectedNoCatch(value);
  2307. - resolvePromise(promise, value[symbolState], value[symbolValue]);
  2308. - }
  2309. - else if (state !== REJECTED && typeof then === 'function') {
  2310. - try {
  2311. - then.call(value, onceWrapper(makeResolver(promise, state)), onceWrapper(makeResolver(promise, false)));
  2312. - }
  2313. - catch (err) {
  2314. - onceWrapper(function () {
  2315. - resolvePromise(promise, false, err);
  2316. - })();
  2317. - }
  2318. - }
  2319. - else {
  2320. - promise[symbolState] = state;
  2321. - var queue = promise[symbolValue];
  2322. - promise[symbolValue] = value;
  2323. - if (promise[symbolFinally] === symbolFinally) {
  2324. - // the promise is generated by Promise.prototype.finally
  2325. - if (state === RESOLVED) {
  2326. - // the state is resolved, should ignore the value
  2327. - // and use parent promise value
  2328. - promise[symbolState] = promise[symbolParentPromiseState];
  2329. - promise[symbolValue] = promise[symbolParentPromiseValue];
  2330. - }
  2331. - }
  2332. - // record task information in value when error occurs, so we can
  2333. - // do some additional work such as render longStackTrace
  2334. - if (state === REJECTED && value instanceof Error) {
  2335. - // check if longStackTraceZone is here
  2336. - var trace = Zone.currentTask && Zone.currentTask.data &&
  2337. - Zone.currentTask.data[creationTrace];
  2338. - if (trace) {
  2339. - // only keep the long stack trace into error when in longStackTraceZone
  2340. - ObjectDefineProperty(value, CURRENT_TASK_TRACE_SYMBOL, { configurable: true, enumerable: false, writable: true, value: trace });
  2341. - }
  2342. - }
  2343. - for (var i = 0; i < queue.length;) {
  2344. - scheduleResolveOrReject(promise, queue[i++], queue[i++], queue[i++], queue[i++]);
  2345. - }
  2346. - if (queue.length == 0 && state == REJECTED) {
  2347. - promise[symbolState] = REJECTED_NO_CATCH;
  2348. - try {
  2349. - // try to print more readable error log
  2350. - throw new Error('Uncaught (in promise): ' + readableObjectToString(value) +
  2351. - (value && value.stack ? '\n' + value.stack : ''));
  2352. - }
  2353. - catch (err) {
  2354. - var error_1 = err;
  2355. - error_1.rejection = value;
  2356. - error_1.promise = promise;
  2357. - error_1.zone = Zone.current;
  2358. - error_1.task = Zone.currentTask;
  2359. - _uncaughtPromiseErrors.push(error_1);
  2360. - api.scheduleMicroTask(); // to make sure that it is running
  2361. - }
  2362. - }
  2363. - }
  2364. - }
  2365. - // Resolving an already resolved promise is a noop.
  2366. - return promise;
  2367. - }
  2368. - var REJECTION_HANDLED_HANDLER = __symbol__('rejectionHandledHandler');
  2369. - function clearRejectedNoCatch(promise) {
  2370. - if (promise[symbolState] === REJECTED_NO_CATCH) {
  2371. - // if the promise is rejected no catch status
  2372. - // and queue.length > 0, means there is a error handler
  2373. - // here to handle the rejected promise, we should trigger
  2374. - // windows.rejectionhandled eventHandler or nodejs rejectionHandled
  2375. - // eventHandler
  2376. - try {
  2377. - var handler = Zone[REJECTION_HANDLED_HANDLER];
  2378. - if (handler && typeof handler === 'function') {
  2379. - handler.call(this, { rejection: promise[symbolValue], promise: promise });
  2380. - }
  2381. - }
  2382. - catch (err) {
  2383. - }
  2384. - promise[symbolState] = REJECTED;
  2385. - for (var i = 0; i < _uncaughtPromiseErrors.length; i++) {
  2386. - if (promise === _uncaughtPromiseErrors[i].promise) {
  2387. - _uncaughtPromiseErrors.splice(i, 1);
  2388. - }
  2389. - }
  2390. - }
  2391. - }
  2392. - function scheduleResolveOrReject(promise, zone, chainPromise, onFulfilled, onRejected) {
  2393. - clearRejectedNoCatch(promise);
  2394. - var promiseState = promise[symbolState];
  2395. - var delegate = promiseState ?
  2396. - (typeof onFulfilled === 'function') ? onFulfilled : forwardResolution :
  2397. - (typeof onRejected === 'function') ? onRejected : forwardRejection;
  2398. - zone.scheduleMicroTask(source, function () {
  2399. - try {
  2400. - var parentPromiseValue = promise[symbolValue];
  2401. - var isFinallyPromise = chainPromise && symbolFinally === chainPromise[symbolFinally];
  2402. - if (isFinallyPromise) {
  2403. - // if the promise is generated from finally call, keep parent promise's state and value
  2404. - chainPromise[symbolParentPromiseValue] = parentPromiseValue;
  2405. - chainPromise[symbolParentPromiseState] = promiseState;
  2406. - }
  2407. - // should not pass value to finally callback
  2408. - var value = zone.run(delegate, undefined, isFinallyPromise && delegate !== forwardRejection && delegate !== forwardResolution ? [] : [parentPromiseValue]);
  2409. - resolvePromise(chainPromise, true, value);
  2410. - }
  2411. - catch (error) {
  2412. - // if error occurs, should always return this error
  2413. - resolvePromise(chainPromise, false, error);
  2414. - }
  2415. - }, chainPromise);
  2416. - }
  2417. - var ZONE_AWARE_PROMISE_TO_STRING = 'function ZoneAwarePromise() { [native code] }';
  2418. - var ZoneAwarePromise = /** @class */ (function () {
  2419. - function ZoneAwarePromise(executor) {
  2420. - var promise = this;
  2421. - if (!(promise instanceof ZoneAwarePromise)) {
  2422. - throw new Error('Must be an instanceof Promise.');
  2423. - }
  2424. - promise[symbolState] = UNRESOLVED;
  2425. - promise[symbolValue] = []; // queue;
  2426. - try {
  2427. - executor && executor(makeResolver(promise, RESOLVED), makeResolver(promise, REJECTED));
  2428. - }
  2429. - catch (error) {
  2430. - resolvePromise(promise, false, error);
  2431. - }
  2432. - }
  2433. - ZoneAwarePromise.toString = function () {
  2434. - return ZONE_AWARE_PROMISE_TO_STRING;
  2435. - };
  2436. - ZoneAwarePromise.resolve = function (value) {
  2437. - return resolvePromise(new this(null), RESOLVED, value);
  2438. - };
  2439. - ZoneAwarePromise.reject = function (error) {
  2440. - return resolvePromise(new this(null), REJECTED, error);
  2441. - };
  2442. - ZoneAwarePromise.race = function (values) {
  2443. - var resolve;
  2444. - var reject;
  2445. - var promise = new this(function (res, rej) {
  2446. - resolve = res;
  2447. - reject = rej;
  2448. - });
  2449. - function onResolve(value) {
  2450. - promise && (promise = null || resolve(value));
  2451. - }
  2452. - function onReject(error) {
  2453. - promise && (promise = null || reject(error));
  2454. - }
  2455. - try {
  2456. - for (var values_1 = __values(values), values_1_1 = values_1.next(); !values_1_1.done; values_1_1 = values_1.next()) {
  2457. - var value = values_1_1.value;
  2458. - if (!isThenable(value)) {
  2459. - value = this.resolve(value);
  2460. - }
  2461. - value.then(onResolve, onReject);
  2462. - }
  2463. - }
  2464. - catch (e_1_1) { e_1 = { error: e_1_1 }; }
  2465. - finally {
  2466. - try {
  2467. - if (values_1_1 && !values_1_1.done && (_a = values_1.return)) _a.call(values_1);
  2468. - }
  2469. - finally { if (e_1) throw e_1.error; }
  2470. - }
  2471. - return promise;
  2472. - var e_1, _a;
  2473. - };
  2474. - ZoneAwarePromise.all = function (values) {
  2475. - var resolve;
  2476. - var reject;
  2477. - var promise = new this(function (res, rej) {
  2478. - resolve = res;
  2479. - reject = rej;
  2480. - });
  2481. - var count = 0;
  2482. - var resolvedValues = [];
  2483. - try {
  2484. - for (var values_2 = __values(values), values_2_1 = values_2.next(); !values_2_1.done; values_2_1 = values_2.next()) {
  2485. - var value = values_2_1.value;
  2486. - if (!isThenable(value)) {
  2487. - value = this.resolve(value);
  2488. - }
  2489. - value.then((function (index) { return function (value) {
  2490. - resolvedValues[index] = value;
  2491. - count--;
  2492. - if (!count) {
  2493. - resolve(resolvedValues);
  2494. - }
  2495. - }; })(count), reject);
  2496. - count++;
  2497. - }
  2498. - }
  2499. - catch (e_2_1) { e_2 = { error: e_2_1 }; }
  2500. - finally {
  2501. - try {
  2502. - if (values_2_1 && !values_2_1.done && (_a = values_2.return)) _a.call(values_2);
  2503. - }
  2504. - finally { if (e_2) throw e_2.error; }
  2505. - }
  2506. - if (!count)
  2507. - resolve(resolvedValues);
  2508. - return promise;
  2509. - var e_2, _a;
  2510. - };
  2511. - ZoneAwarePromise.prototype.then = function (onFulfilled, onRejected) {
  2512. - var chainPromise = new this.constructor(null);
  2513. - var zone = Zone.current;
  2514. - if (this[symbolState] == UNRESOLVED) {
  2515. - this[symbolValue].push(zone, chainPromise, onFulfilled, onRejected);
  2516. - }
  2517. - else {
  2518. - scheduleResolveOrReject(this, zone, chainPromise, onFulfilled, onRejected);
  2519. - }
  2520. - return chainPromise;
  2521. - };
  2522. - ZoneAwarePromise.prototype.catch = function (onRejected) {
  2523. - return this.then(null, onRejected);
  2524. - };
  2525. - ZoneAwarePromise.prototype.finally = function (onFinally) {
  2526. - var chainPromise = new this.constructor(null);
  2527. - chainPromise[symbolFinally] = symbolFinally;
  2528. - var zone = Zone.current;
  2529. - if (this[symbolState] == UNRESOLVED) {
  2530. - this[symbolValue].push(zone, chainPromise, onFinally, onFinally);
  2531. - }
  2532. - else {
  2533. - scheduleResolveOrReject(this, zone, chainPromise, onFinally, onFinally);
  2534. - }
  2535. - return chainPromise;
  2536. - };
  2537. - return ZoneAwarePromise;
  2538. - }());
  2539. - // Protect against aggressive optimizers dropping seemingly unused properties.
  2540. - // E.g. Closure Compiler in advanced mode.
  2541. - ZoneAwarePromise['resolve'] = ZoneAwarePromise.resolve;
  2542. - ZoneAwarePromise['reject'] = ZoneAwarePromise.reject;
  2543. - ZoneAwarePromise['race'] = ZoneAwarePromise.race;
  2544. - ZoneAwarePromise['all'] = ZoneAwarePromise.all;
  2545. - var NativePromise = global[symbolPromise] = global['Promise'];
  2546. - var ZONE_AWARE_PROMISE = Zone.__symbol__('ZoneAwarePromise');
  2547. - // NOTE(NativeScript): Defining the Promise property descriptor this way causes
  2548. - // problems with V8 snapshot for Android. Just skip it.
  2549. - // let desc = ObjectGetOwnPropertyDescriptor(global, 'Promise');
  2550. - // if (!desc || desc.configurable) {
  2551. - // desc && delete desc.writable;
  2552. - // desc && delete desc.value;
  2553. - // if (!desc) {
  2554. - // desc = {configurable: true, enumerable: true};
  2555. - // }
  2556. - // desc.get = function() {
  2557. - // // if we already set ZoneAwarePromise, use patched one
  2558. - // // otherwise return native one.
  2559. - // return global[ZONE_AWARE_PROMISE] ? global[ZONE_AWARE_PROMISE] : global[symbolPromise];
  2560. - // };
  2561. - // desc.set = function(NewNativePromise) {
  2562. - // if (NewNativePromise === ZoneAwarePromise) {
  2563. - // // if the NewNativePromise is ZoneAwarePromise
  2564. - // // save to global
  2565. - // global[ZONE_AWARE_PROMISE] = NewNativePromise;
  2566. - // } else {
  2567. - // // if the NewNativePromise is not ZoneAwarePromise
  2568. - // // for example: after load zone.js, some library just
  2569. - // // set es6-promise to global, if we set it to global
  2570. - // // directly, assertZonePatched will fail and angular
  2571. - // // will not loaded, so we just set the NewNativePromise
  2572. - // // to global[symbolPromise], so the result is just like
  2573. - // // we load ES6 Promise before zone.js
  2574. - // global[symbolPromise] = NewNativePromise;
  2575. - // if (!NewNativePromise.prototype[symbolThen]) {
  2576. - // patchThen(NewNativePromise);
  2577. - // }
  2578. - // api.setNativePromise(NewNativePromise);
  2579. - // }
  2580. - // };
  2581. - // ObjectDefineProperty(global, 'Promise', desc);
  2582. - // }
  2583. - global['Promise'] = ZoneAwarePromise;
  2584. - var symbolThenPatched = __symbol__('thenPatched');
  2585. - function patchThen(Ctor) {
  2586. - var proto = Ctor.prototype;
  2587. - var prop = ObjectGetOwnPropertyDescriptor(proto, 'then');
  2588. - if (prop && (prop.writable === false || !prop.configurable)) {
  2589. - // check Ctor.prototype.then propertyDescriptor is writable or not
  2590. - // in meteor env, writable is false, we should ignore such case
  2591. - return;
  2592. - }
  2593. - var originalThen = proto.then;
  2594. - // Keep a reference to the original method.
  2595. - proto[symbolThen] = originalThen;
  2596. - Ctor.prototype.then = function (onResolve, onReject) {
  2597. - var _this = this;
  2598. - var wrapped = new ZoneAwarePromise(function (resolve, reject) {
  2599. - originalThen.call(_this, resolve, reject);
  2600. - });
  2601. - return wrapped.then(onResolve, onReject);
  2602. - };
  2603. - Ctor[symbolThenPatched] = true;
  2604. - }
  2605. - function zoneify(fn) {
  2606. - return function () {
  2607. - var resultPromise = fn.apply(this, arguments);
  2608. - if (resultPromise instanceof ZoneAwarePromise) {
  2609. - return resultPromise;
  2610. - }
  2611. - var ctor = resultPromise.constructor;
  2612. - if (!ctor[symbolThenPatched]) {
  2613. - patchThen(ctor);
  2614. - }
  2615. - return resultPromise;
  2616. - };
  2617. - }
  2618. - if (NativePromise) {
  2619. - patchThen(NativePromise);
  2620. - var fetch_1 = global['fetch'];
  2621. - if (typeof fetch_1 == 'function') {
  2622. - global['fetch'] = zoneify(fetch_1);
  2623. - }
  2624. - }
  2625. - // This is not part of public API, but it is useful for tests, so we expose it.
  2626. - Promise[Zone.__symbol__('uncaughtPromiseErrors')] = _uncaughtPromiseErrors;
  2627. - return ZoneAwarePromise;
  2628. -});
  2629. -
  2630. -/**
  2631. - * @license
  2632. - * Copyright Google Inc. All Rights Reserved.
  2633. - *
  2634. - * Use of this source code is governed by an MIT-style license that can be
  2635. - * found in the LICENSE file at https://angular.io/license
  2636. - */
  2637. -/**
  2638. - * Suppress closure compiler errors about unknown 'Zone' variable
  2639. - * @fileoverview
  2640. - * @suppress {undefinedVars,globalThis,missingRequire}
  2641. - */
  2642. -// issue #989, to reduce bundle size, use short name
  2643. -/** Object.getOwnPropertyDescriptor */
  2644. -var ObjectGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
  2645. -/** Object.defineProperty */
  2646. -
  2647. -/** Object.getPrototypeOf */
  2648. -var ObjectGetPrototypeOf = Object.getPrototypeOf;
  2649. -/** Object.create */
  2650. -
  2651. -/** Array.prototype.slice */
  2652. -
  2653. -/** addEventListener string const */
  2654. -var ADD_EVENT_LISTENER_STR = 'addEventListener';
  2655. -/** removeEventListener string const */
  2656. -var REMOVE_EVENT_LISTENER_STR = 'removeEventListener';
  2657. -/** zoneSymbol addEventListener */
  2658. -var ZONE_SYMBOL_ADD_EVENT_LISTENER = Zone.__symbol__(ADD_EVENT_LISTENER_STR);
  2659. -/** zoneSymbol removeEventListener */
  2660. -var ZONE_SYMBOL_REMOVE_EVENT_LISTENER = Zone.__symbol__(REMOVE_EVENT_LISTENER_STR);
  2661. -/** true string const */
  2662. -
  2663. -/** false string const */
  2664. -
  2665. -/** __zone_symbol__ string const */
  2666. -
  2667. -
  2668. -function scheduleMacroTaskWithCurrentZone(source, callback, data, customSchedule, customCancel) {
  2669. - return Zone.current.scheduleMacroTask(source, callback, data, customSchedule, customCancel);
  2670. -}
  2671. -var zoneSymbol = Zone.__symbol__;
  2672. -var isWindowExists = typeof window !== 'undefined';
  2673. -var internalWindow = isWindowExists ? window : undefined;
  2674. -var _global = isWindowExists && internalWindow || typeof self === 'object' && self || global;
  2675. -
  2676. -
  2677. -function isPropertyWritable(propertyDesc) {
  2678. - if (!propertyDesc) {
  2679. - return true;
  2680. - }
  2681. - if (propertyDesc.writable === false) {
  2682. - return false;
  2683. - }
  2684. - return !(typeof propertyDesc.get === 'function' && typeof propertyDesc.set === 'undefined');
  2685. -}
  2686. -var isWebWorker = (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope);
  2687. -// Make sure to access `process` through `_global` so that WebPack does not accidentally browserify
  2688. -// this code.
  2689. -var isNode = (!('nw' in _global) && typeof _global.process !== 'undefined' &&
  2690. - {}.toString.call(_global.process) === '[object process]');
  2691. -var isBrowser = !isNode && !isWebWorker && !!(isWindowExists && internalWindow['HTMLElement']);
  2692. -// we are in electron of nw, so we are both browser and nodejs
  2693. -// Make sure to access `process` through `_global` so that WebPack does not accidentally browserify
  2694. -// this code.
  2695. -var isMix = typeof _global.process !== 'undefined' &&
  2696. - {}.toString.call(_global.process) === '[object process]' && !isWebWorker &&
  2697. - !!(isWindowExists && internalWindow['HTMLElement']);
  2698. -
  2699. -
  2700. -var originalInstanceKey = zoneSymbol('originalInstance');
  2701. -// wrap some native API on `window`
  2702. -
  2703. -function patchMethod(target, name, patchFn) {
  2704. - var proto = target;
  2705. - while (proto && !proto.hasOwnProperty(name)) {
  2706. - proto = ObjectGetPrototypeOf(proto);
  2707. - }
  2708. - if (!proto && target[name]) {
  2709. - // somehow we did not find it, but we can see it. This happens on IE for Window properties.
  2710. - proto = target;
  2711. - }
  2712. - var delegateName = zoneSymbol(name);
  2713. - var delegate;
  2714. - if (proto && !(delegate = proto[delegateName])) {
  2715. - delegate = proto[delegateName] = proto[name];
  2716. - // check whether proto[name] is writable
  2717. - // some property is readonly in safari, such as HtmlCanvasElement.prototype.toBlob
  2718. - var desc = proto && ObjectGetOwnPropertyDescriptor(proto, name);
  2719. - if (isPropertyWritable(desc)) {
  2720. - var patchDelegate_1 = patchFn(delegate, delegateName, name);
  2721. - proto[name] = function () {
  2722. - return patchDelegate_1(this, arguments);
  2723. - };
  2724. - attachOriginToPatched(proto[name], delegate);
  2725. - }
  2726. - }
  2727. - return delegate;
  2728. -}
  2729. -// TODO: @JiaLiPassion, support cancel task later if necessary
  2730. -
  2731. -
  2732. -function attachOriginToPatched(patched, original) {
  2733. - patched[zoneSymbol('OriginalDelegate')] = original;
  2734. -}
  2735. -
  2736. -/**
  2737. - * @license
  2738. - * Copyright Google Inc. All Rights Reserved.
  2739. - *
  2740. - * Use of this source code is governed by an MIT-style license that can be
  2741. - * found in the LICENSE file at https://angular.io/license
  2742. - */
  2743. -// override Function.prototype.toString to make zone.js patched function
  2744. -// look like native function
  2745. -Zone.__load_patch('toString', function (global) {
  2746. - // patch Func.prototype.toString to let them look like native
  2747. - var originalFunctionToString = Function.prototype.toString;
  2748. - var ORIGINAL_DELEGATE_SYMBOL = zoneSymbol('OriginalDelegate');
  2749. - var PROMISE_SYMBOL = zoneSymbol('Promise');
  2750. - var ERROR_SYMBOL = zoneSymbol('Error');
  2751. - var newFunctionToString = function toString() {
  2752. - if (typeof this === 'function') {
  2753. - var originalDelegate = this[ORIGINAL_DELEGATE_SYMBOL];
  2754. - if (originalDelegate) {
  2755. - if (typeof originalDelegate === 'function') {
  2756. - return originalFunctionToString.apply(this[ORIGINAL_DELEGATE_SYMBOL], arguments);
  2757. - }
  2758. - else {
  2759. - return Object.prototype.toString.call(originalDelegate);
  2760. - }
  2761. - }
  2762. - if (this === Promise) {
  2763. - var nativePromise = global[PROMISE_SYMBOL];
  2764. - if (nativePromise) {
  2765. - return originalFunctionToString.apply(nativePromise, arguments);
  2766. - }
  2767. - }
  2768. - if (this === Error) {
  2769. - var nativeError = global[ERROR_SYMBOL];
  2770. - if (nativeError) {
  2771. - return originalFunctionToString.apply(nativeError, arguments);
  2772. - }
  2773. - }
  2774. - }
  2775. - return originalFunctionToString.apply(this, arguments);
  2776. - };
  2777. - newFunctionToString[ORIGINAL_DELEGATE_SYMBOL] = originalFunctionToString;
  2778. - Function.prototype.toString = newFunctionToString;
  2779. - // patch Object.prototype.toString to let them look like native
  2780. - var originalObjectToString = Object.prototype.toString;
  2781. - var PROMISE_OBJECT_TO_STRING = '[object Promise]';
  2782. - Object.prototype.toString = function () {
  2783. - if (this instanceof Promise) {
  2784. - return PROMISE_OBJECT_TO_STRING;
  2785. - }
  2786. - return originalObjectToString.apply(this, arguments);
  2787. - };
  2788. -});
  2789. -
  2790. -/**
  2791. - * @license
  2792. - * Copyright Google Inc. All Rights Reserved.
  2793. - *
  2794. - * Use of this source code is governed by an MIT-style license that can be
  2795. - * found in the LICENSE file at https://angular.io/license
  2796. - */
  2797. -/**
  2798. - * @fileoverview
  2799. - * @suppress {globalThis,undefinedVars}
  2800. - */
  2801. -Zone.__load_patch('Error', function (global, Zone, api) {
  2802. - /*
  2803. - * This code patches Error so that:
  2804. - * - It ignores un-needed stack frames.
  2805. - * - It Shows the associated Zone for reach frame.
  2806. - */
  2807. - var blacklistedStackFramesSymbol = api.symbol('blacklistedStackFrames');
  2808. - var NativeError = global[api.symbol('Error')] = global['Error'];
  2809. - // Store the frames which should be removed from the stack frames
  2810. - var blackListedStackFrames = {};
  2811. - // We must find the frame where Error was created, otherwise we assume we don't understand stack
  2812. - var zoneAwareFrame1;
  2813. - var zoneAwareFrame2;
  2814. - global['Error'] = ZoneAwareError;
  2815. - var stackRewrite = 'stackRewrite';
  2816. - /**
  2817. - * This is ZoneAwareError which processes the stack frame and cleans up extra frames as well as
  2818. - * adds zone information to it.
  2819. - */
  2820. - function ZoneAwareError() {
  2821. - var _this = this;
  2822. - // We always have to return native error otherwise the browser console will not work.
  2823. - var error = NativeError.apply(this, arguments);
  2824. - // Save original stack trace
  2825. - var originalStack = error['originalStack'] = error.stack;
  2826. - // Process the stack trace and rewrite the frames.
  2827. - if (ZoneAwareError[stackRewrite] && originalStack) {
  2828. - var frames_1 = originalStack.split('\n');
  2829. - var zoneFrame = api.currentZoneFrame();
  2830. - var i = 0;
  2831. - // Find the first frame
  2832. - while (!(frames_1[i] === zoneAwareFrame1 || frames_1[i] === zoneAwareFrame2) &&
  2833. - i < frames_1.length) {
  2834. - i++;
  2835. - }
  2836. - for (; i < frames_1.length && zoneFrame; i++) {
  2837. - var frame = frames_1[i];
  2838. - if (frame.trim()) {
  2839. - switch (blackListedStackFrames[frame]) {
  2840. - case 0 /* blackList */:
  2841. - frames_1.splice(i, 1);
  2842. - i--;
  2843. - break;
  2844. - case 1 /* transition */:
  2845. - if (zoneFrame.parent) {
  2846. - // This is the special frame where zone changed. Print and process it accordingly
  2847. - zoneFrame = zoneFrame.parent;
  2848. - }
  2849. - else {
  2850. - zoneFrame = null;
  2851. - }
  2852. - frames_1.splice(i, 1);
  2853. - i--;
  2854. - break;
  2855. - default:
  2856. - frames_1[i] += " [" + zoneFrame.zone.name + "]";
  2857. - }
  2858. - }
  2859. - }
  2860. - try {
  2861. - error.stack = error.zoneAwareStack = frames_1.join('\n');
  2862. - }
  2863. - catch (e) {
  2864. - // ignore as some browsers don't allow overriding of stack
  2865. - }
  2866. - }
  2867. - if (this instanceof NativeError && this.constructor != NativeError) {
  2868. - // We got called with a `new` operator AND we are subclass of ZoneAwareError
  2869. - // in that case we have to copy all of our properties to `this`.
  2870. - Object.keys(error).concat('stack', 'message').forEach(function (key) {
  2871. - var value = error[key];
  2872. - if (value !== undefined) {
  2873. - try {
  2874. - _this[key] = value;
  2875. - }
  2876. - catch (e) {
  2877. - // ignore the assignment in case it is a setter and it throws.
  2878. - }
  2879. - }
  2880. - });
  2881. - return this;
  2882. - }
  2883. - return error;
  2884. - }
  2885. - // Copy the prototype so that instanceof operator works as expected
  2886. - ZoneAwareError.prototype = NativeError.prototype;
  2887. - ZoneAwareError[blacklistedStackFramesSymbol] = blackListedStackFrames;
  2888. - ZoneAwareError[stackRewrite] = false;
  2889. - // those properties need special handling
  2890. - var specialPropertyNames = ['stackTraceLimit', 'captureStackTrace', 'prepareStackTrace'];
  2891. - // those properties of NativeError should be set to ZoneAwareError
  2892. - var nativeErrorProperties = Object.keys(NativeError);
  2893. - if (nativeErrorProperties) {
  2894. - nativeErrorProperties.forEach(function (prop) {
  2895. - if (specialPropertyNames.filter(function (sp) { return sp === prop; }).length === 0) {
  2896. - Object.defineProperty(ZoneAwareError, prop, {
  2897. - get: function () {
  2898. - return NativeError[prop];
  2899. - },
  2900. - set: function (value) {
  2901. - NativeError[prop] = value;
  2902. - }
  2903. - });
  2904. - }
  2905. - });
  2906. - }
  2907. - if (NativeError.hasOwnProperty('stackTraceLimit')) {
  2908. - // Extend default stack limit as we will be removing few frames.
  2909. - NativeError.stackTraceLimit = Math.max(NativeError.stackTraceLimit, 15);
  2910. - // make sure that ZoneAwareError has the same property which forwards to NativeError.
  2911. - Object.defineProperty(ZoneAwareError, 'stackTraceLimit', {
  2912. - get: function () {
  2913. - return NativeError.stackTraceLimit;
  2914. - },
  2915. - set: function (value) {
  2916. - return NativeError.stackTraceLimit = value;
  2917. - }
  2918. - });
  2919. - }
  2920. - if (NativeError.hasOwnProperty('captureStackTrace')) {
  2921. - Object.defineProperty(ZoneAwareError, 'captureStackTrace', {
  2922. - // add named function here because we need to remove this
  2923. - // stack frame when prepareStackTrace below
  2924. - value: function zoneCaptureStackTrace(targetObject, constructorOpt) {
  2925. - NativeError.captureStackTrace(targetObject, constructorOpt);
  2926. - }
  2927. - });
  2928. - }
  2929. - var ZONE_CAPTURESTACKTRACE = 'zoneCaptureStackTrace';
  2930. - Object.defineProperty(ZoneAwareError, 'prepareStackTrace', {
  2931. - get: function () {
  2932. - return NativeError.prepareStackTrace;
  2933. - },
  2934. - set: function (value) {
  2935. - if (!value || typeof value !== 'function') {
  2936. - return NativeError.prepareStackTrace = value;
  2937. - }
  2938. - return NativeError.prepareStackTrace = function (error, structuredStackTrace) {
  2939. - // remove additional stack information from ZoneAwareError.captureStackTrace
  2940. - if (structuredStackTrace) {
  2941. - for (var i = 0; i < structuredStackTrace.length; i++) {
  2942. - var st = structuredStackTrace[i];
  2943. - // remove the first function which name is zoneCaptureStackTrace
  2944. - if (st.getFunctionName() === ZONE_CAPTURESTACKTRACE) {
  2945. - structuredStackTrace.splice(i, 1);
  2946. - break;
  2947. - }
  2948. - }
  2949. - }
  2950. - return value.call(this, error, structuredStackTrace);
  2951. - };
  2952. - }
  2953. - });
  2954. - // Now we need to populate the `blacklistedStackFrames` as well as find the
  2955. - // run/runGuarded/runTask frames. This is done by creating a detect zone and then threading
  2956. - // the execution through all of the above methods so that we can look at the stack trace and
  2957. - // find the frames of interest.
  2958. - var ZONE_AWARE_ERROR = 'ZoneAwareError';
  2959. - var ERROR_DOT = 'Error.';
  2960. - var EMPTY = '';
  2961. - var RUN_GUARDED = 'runGuarded';
  2962. - var RUN_TASK = 'runTask';
  2963. - var RUN = 'run';
  2964. - var BRACKETS = '(';
  2965. - var AT = '@';
  2966. - var detectZone = Zone.current.fork({
  2967. - name: 'detect',
  2968. - onHandleError: function (parentZD, current, target, error) {
  2969. - if (error.originalStack && Error === ZoneAwareError) {
  2970. - var frames_2 = error.originalStack.split(/\n/);
  2971. - var runFrame = false, runGuardedFrame = false, runTaskFrame = false;
  2972. - while (frames_2.length) {
  2973. - var frame = frames_2.shift();
  2974. - // On safari it is possible to have stack frame with no line number.
  2975. - // This check makes sure that we don't filter frames on name only (must have
  2976. - // line number)
  2977. - if (/:\d+:\d+/.test(frame)) {
  2978. - // Get rid of the path so that we don't accidentally find function name in path.
  2979. - // In chrome the separator is `(` and `@` in FF and safari
  2980. - // Chrome: at Zone.run (zone.js:100)
  2981. - // Chrome: at Zone.run (http://localhost:9876/base/build/lib/zone.js:100:24)
  2982. - // FireFox: Zone.prototype.run@http://localhost:9876/base/build/lib/zone.js:101:24
  2983. - // Safari: run@http://localhost:9876/base/build/lib/zone.js:101:24
  2984. - var fnName = frame.split(BRACKETS)[0].split(AT)[0];
  2985. - var frameType = 1;
  2986. - if (fnName.indexOf(ZONE_AWARE_ERROR) !== -1) {
  2987. - zoneAwareFrame1 = frame;
  2988. - zoneAwareFrame2 = frame.replace(ERROR_DOT, EMPTY);
  2989. - blackListedStackFrames[zoneAwareFrame2] = 0 /* blackList */;
  2990. - }
  2991. - if (fnName.indexOf(RUN_GUARDED) !== -1) {
  2992. - runGuardedFrame = true;
  2993. - }
  2994. - else if (fnName.indexOf(RUN_TASK) !== -1) {
  2995. - runTaskFrame = true;
  2996. - }
  2997. - else if (fnName.indexOf(RUN) !== -1) {
  2998. - runFrame = true;
  2999. - }
  3000. - else {
  3001. - frameType = 0 /* blackList */;
  3002. - }
  3003. - blackListedStackFrames[frame] = frameType;
  3004. - // Once we find all of the frames we can stop looking.
  3005. - if (runFrame && runGuardedFrame && runTaskFrame) {
  3006. - ZoneAwareError[stackRewrite] = true;
  3007. - break;
  3008. - }
  3009. - }
  3010. - }
  3011. - }
  3012. - return false;
  3013. - }
  3014. - });
  3015. - // carefully constructor a stack frame which contains all of the frames of interest which
  3016. - // need to be detected and blacklisted.
  3017. - var childDetectZone = detectZone.fork({
  3018. - name: 'child',
  3019. - onScheduleTask: function (delegate, curr, target, task) {
  3020. - return delegate.scheduleTask(target, task);
  3021. - },
  3022. - onInvokeTask: function (delegate, curr, target, task, applyThis, applyArgs) {
  3023. - return delegate.invokeTask(target, task, applyThis, applyArgs);
  3024. - },
  3025. - onCancelTask: function (delegate, curr, target, task) {
  3026. - return delegate.cancelTask(target, task);
  3027. - },
  3028. - onInvoke: function (delegate, curr, target, callback, applyThis, applyArgs, source) {
  3029. - return delegate.invoke(target, callback, applyThis, applyArgs, source);
  3030. - }
  3031. - });
  3032. - // we need to detect all zone related frames, it will
  3033. - // exceed default stackTraceLimit, so we set it to
  3034. - // larger number here, and restore it after detect finish.
  3035. - var originalStackTraceLimit = Error.stackTraceLimit;
  3036. - Error.stackTraceLimit = 100;
  3037. - // we schedule event/micro/macro task, and invoke them
  3038. - // when onSchedule, so we can get all stack traces for
  3039. - // all kinds of tasks with one error thrown.
  3040. - childDetectZone.run(function () {
  3041. - childDetectZone.runGuarded(function () {
  3042. - var fakeTransitionTo = function () { };
  3043. - childDetectZone.scheduleEventTask(blacklistedStackFramesSymbol, function () {
  3044. - childDetectZone.scheduleMacroTask(blacklistedStackFramesSymbol, function () {
  3045. - childDetectZone.scheduleMicroTask(blacklistedStackFramesSymbol, function () {
  3046. - throw new ZoneAwareError(ZoneAwareError, NativeError);
  3047. - }, null, function (t) {
  3048. - t._transitionTo = fakeTransitionTo;
  3049. - t.invoke();
  3050. - });
  3051. - }, null, function (t) {
  3052. - t._transitionTo = fakeTransitionTo;
  3053. - t.invoke();
  3054. - }, function () { });
  3055. - }, null, function (t) {
  3056. - t._transitionTo = fakeTransitionTo;
  3057. - t.invoke();
  3058. - }, function () { });
  3059. - });
  3060. - });
  3061. - Error.stackTraceLimit = originalStackTraceLimit;
  3062. -});
  3063. -
  3064. -/**
  3065. - * @license
  3066. - * Copyright Google Inc. All Rights Reserved.
  3067. - *
  3068. - * Use of this source code is governed by an MIT-style license that can be
  3069. - * found in the LICENSE file at https://angular.io/license
  3070. - */
  3071. -/**
  3072. - * @fileoverview
  3073. - * @suppress {missingRequire}
  3074. - */
  3075. -var taskSymbol = zoneSymbol('zoneTask');
  3076. -function patchTimer(window, setName, cancelName, nameSuffix) {
  3077. - var setNative = null;
  3078. - var clearNative = null;
  3079. - setName += nameSuffix;
  3080. - cancelName += nameSuffix;
  3081. - var tasksByHandleId = {};
  3082. - function scheduleTask(task) {
  3083. - var data = task.data;
  3084. - function timer() {
  3085. - try {
  3086. - task.invoke.apply(this, arguments);
  3087. - }
  3088. - finally {
  3089. - // issue-934, task will be cancelled
  3090. - // even it is a periodic task such as
  3091. - // setInterval
  3092. - if (!(task.data && task.data.isPeriodic)) {
  3093. - if (typeof data.handleId === 'number') {
  3094. - // in non-nodejs env, we remove timerId
  3095. - // from local cache
  3096. - delete tasksByHandleId[data.handleId];
  3097. - }
  3098. - else if (data.handleId) {
  3099. - // Node returns complex objects as handleIds
  3100. - // we remove task reference from timer object
  3101. - data.handleId[taskSymbol] = null;
  3102. - }
  3103. - }
  3104. - }
  3105. - }
  3106. - data.args[0] = timer;
  3107. - data.handleId = setNative.apply(window, data.args);
  3108. - return task;
  3109. - }
  3110. - function clearTask(task) {
  3111. - return clearNative(task.data.handleId);
  3112. - }
  3113. - setNative =
  3114. - patchMethod(window, setName, function (delegate) { return function (self, args) {
  3115. - if (typeof args[0] === 'function') {
  3116. - var options = {
  3117. - handleId: null,
  3118. - isPeriodic: nameSuffix === 'Interval',
  3119. - delay: (nameSuffix === 'Timeout' || nameSuffix === 'Interval') ? args[1] || 0 : null,
  3120. - args: args
  3121. - };
  3122. - var task = scheduleMacroTaskWithCurrentZone(setName, args[0], options, scheduleTask, clearTask);
  3123. - if (!task) {
  3124. - return task;
  3125. - }
  3126. - // Node.js must additionally support the ref and unref functions.
  3127. - var handle = task.data.handleId;
  3128. - if (typeof handle === 'number') {
  3129. - // for non nodejs env, we save handleId: task
  3130. - // mapping in local cache for clearTimeout
  3131. - tasksByHandleId[handle] = task;
  3132. - }
  3133. - else if (handle) {
  3134. - // for nodejs env, we save task
  3135. - // reference in timerId Object for clearTimeout
  3136. - handle[taskSymbol] = task;
  3137. - }
  3138. - // check whether handle is null, because some polyfill or browser
  3139. - // may return undefined from setTimeout/setInterval/setImmediate/requestAnimationFrame
  3140. - if (handle && handle.ref && handle.unref && typeof handle.ref === 'function' &&
  3141. - typeof handle.unref === 'function') {
  3142. - task.ref = handle.ref.bind(handle);
  3143. - task.unref = handle.unref.bind(handle);
  3144. - }
  3145. - if (typeof handle === 'number' || handle) {
  3146. - return handle;
  3147. - }
  3148. - return task;
  3149. - }
  3150. - else {
  3151. - // cause an error by calling it directly.
  3152. - return delegate.apply(window, args);
  3153. - }
  3154. - }; });
  3155. - clearNative =
  3156. - patchMethod(window, cancelName, function (delegate) { return function (self, args) {
  3157. - var id = args[0];
  3158. - var task;
  3159. - if (typeof id === 'number') {
  3160. - // non nodejs env.
  3161. - task = tasksByHandleId[id];
  3162. - }
  3163. - else {
  3164. - // nodejs env.
  3165. - task = id && id[taskSymbol];
  3166. - // other environments.
  3167. - if (!task) {
  3168. - task = id;
  3169. - }
  3170. - }
  3171. - if (task && typeof task.type === 'string') {
  3172. - if (task.state !== 'notScheduled' &&
  3173. - (task.cancelFn && task.data.isPeriodic || task.runCount === 0)) {
  3174. - if (typeof id === 'number') {
  3175. - delete tasksByHandleId[id];
  3176. - }
  3177. - else if (id) {
  3178. - id[taskSymbol] = null;
  3179. - }
  3180. - // Do not cancel already canceled functions
  3181. - task.zone.cancelTask(task);
  3182. - }
  3183. - }
  3184. - else {
  3185. - // cause an error by calling it directly.
  3186. - delegate.apply(window, args);
  3187. - }
  3188. - }; });
  3189. -}
  3190. -
  3191. -/**
  3192. - * @license
  3193. - * Copyright Google Inc. All Rights Reserved.
  3194. - *
  3195. - * Use of this source code is governed by an MIT-style license that can be
  3196. - * found in the LICENSE file at https://angular.io/license
  3197. - */
  3198. -var set = 'set';
  3199. -var clear = 'clear';
  3200. -// Timers
  3201. -patchTimer(global, set, clear, 'Timeout');
  3202. -patchTimer(global, set, clear, 'Interval');
  3203. -patchTimer(global, set, clear, 'Immediate');
  3204. -
  3205. -})));
  3206. -export const NativeScriptZone = null;
  3207. diff --git a/node_modules/@nativescript/zone-js/package/zone-nativescript.mocha.js b/node_modules/@nativescript/zone-js/package/zone-nativescript.mocha.js
  3208. deleted file mode 100644
  3209. index 0bd1cf2..0000000
  3210. --- a/node_modules/@nativescript/zone-js/package/zone-nativescript.mocha.js
  3211. +++ /dev/null
  3212. @@ -1,1353 +0,0 @@
  3213. -/**
  3214. -* @license
  3215. -* Copyright Google Inc. All Rights Reserved.
  3216. -*
  3217. -* Use of this source code is governed by an MIT-style license that can be
  3218. -* found in the LICENSE file at https://angular.io/license
  3219. -*/
  3220. -(function (global, factory) {
  3221. - typeof exports === 'object' && typeof module !== 'undefined' ? factory() :
  3222. - typeof define === 'function' && define.amd ? define(factory) :
  3223. - (factory());
  3224. -}(this, (function () { 'use strict';
  3225. -
  3226. -/**
  3227. - * @license
  3228. - * Copyright Google Inc. All Rights Reserved.
  3229. - *
  3230. - * Use of this source code is governed by an MIT-style license that can be
  3231. - * found in the LICENSE file at https://angular.io/license
  3232. - */
  3233. -/**
  3234. - * @fileoverview
  3235. - * @suppress {globalThis}
  3236. - */
  3237. -var NEWLINE = '\n';
  3238. -var IGNORE_FRAMES = {};
  3239. -var creationTrace = '__creationTrace__';
  3240. -var ERROR_TAG = 'STACKTRACE TRACKING';
  3241. -var SEP_TAG = '__SEP_TAG__';
  3242. -var sepTemplate = SEP_TAG + '@[native]';
  3243. -var LongStackTrace = /** @class */ (function () {
  3244. - function LongStackTrace() {
  3245. - this.error = getStacktrace();
  3246. - this.timestamp = new Date();
  3247. - }
  3248. - return LongStackTrace;
  3249. -}());
  3250. -function getStacktraceWithUncaughtError() {
  3251. - return new Error(ERROR_TAG);
  3252. -}
  3253. -function getStacktraceWithCaughtError() {
  3254. - try {
  3255. - throw getStacktraceWithUncaughtError();
  3256. - }
  3257. - catch (err) {
  3258. - return err;
  3259. - }
  3260. -}
  3261. -// Some implementations of exception handling don't create a stack trace if the exception
  3262. -// isn't thrown, however it's faster not to actually throw the exception.
  3263. -var error = getStacktraceWithUncaughtError();
  3264. -var caughtError = getStacktraceWithCaughtError();
  3265. -var getStacktrace = error.stack ?
  3266. - getStacktraceWithUncaughtError :
  3267. - (caughtError.stack ? getStacktraceWithCaughtError : getStacktraceWithUncaughtError);
  3268. -function getFrames(error) {
  3269. - return error.stack ? error.stack.split(NEWLINE) : [];
  3270. -}
  3271. -function addErrorStack(lines, error) {
  3272. - var trace = getFrames(error);
  3273. - for (var i = 0; i < trace.length; i++) {
  3274. - var frame = trace[i];
  3275. - // Filter out the Frames which are part of stack capturing.
  3276. - if (!IGNORE_FRAMES.hasOwnProperty(frame)) {
  3277. - lines.push(trace[i]);
  3278. - }
  3279. - }
  3280. -}
  3281. -function renderLongStackTrace(frames, stack) {
  3282. - var longTrace = [stack ? stack.trim() : ''];
  3283. - if (frames) {
  3284. - var timestamp = new Date().getTime();
  3285. - for (var i = 0; i < frames.length; i++) {
  3286. - var traceFrames = frames[i];
  3287. - var lastTime = traceFrames.timestamp;
  3288. - var separator = "____________________Elapsed " + (timestamp - lastTime.getTime()) + " ms; At: " + lastTime;
  3289. - separator = separator.replace(/[^\w\d]/g, '_');
  3290. - longTrace.push(sepTemplate.replace(SEP_TAG, separator));
  3291. - addErrorStack(longTrace, traceFrames.error);
  3292. - timestamp = lastTime.getTime();
  3293. - }
  3294. - }
  3295. - return longTrace.join(NEWLINE);
  3296. -}
  3297. -Zone['longStackTraceZoneSpec'] = {
  3298. - name: 'long-stack-trace',
  3299. - longStackTraceLimit: 10,
  3300. - // add a getLongStackTrace method in spec to
  3301. - // handle handled reject promise error.
  3302. - getLongStackTrace: function (error) {
  3303. - if (!error) {
  3304. - return undefined;
  3305. - }
  3306. - var trace = error[Zone.__symbol__('currentTaskTrace')];
  3307. - if (!trace) {
  3308. - return error.stack;
  3309. - }
  3310. - return renderLongStackTrace(trace, error.stack);
  3311. - },
  3312. - onScheduleTask: function (parentZoneDelegate, currentZone, targetZone, task) {
  3313. - if (Error.stackTraceLimit > 0) {
  3314. - // if Error.stackTraceLimit is 0, means stack trace
  3315. - // is disabled, so we don't need to generate long stack trace
  3316. - // this will improve performance in some test(some test will
  3317. - // set stackTraceLimit to 0, https://github.com/angular/zone.js/issues/698
  3318. - var currentTask = Zone.currentTask;
  3319. - var trace = currentTask && currentTask.data && currentTask.data[creationTrace] || [];
  3320. - trace = [new LongStackTrace()].concat(trace);
  3321. - if (trace.length > this.longStackTraceLimit) {
  3322. - trace.length = this.longStackTraceLimit;
  3323. - }
  3324. - if (!task.data)
  3325. - task.data = {};
  3326. - task.data[creationTrace] = trace;
  3327. - }
  3328. - return parentZoneDelegate.scheduleTask(targetZone, task);
  3329. - },
  3330. - onHandleError: function (parentZoneDelegate, currentZone, targetZone, error) {
  3331. - if (Error.stackTraceLimit > 0) {
  3332. - // if Error.stackTraceLimit is 0, means stack trace
  3333. - // is disabled, so we don't need to generate long stack trace
  3334. - // this will improve performance in some test(some test will
  3335. - // set stackTraceLimit to 0, https://github.com/angular/zone.js/issues/698
  3336. - var parentTask = Zone.currentTask || error.task;
  3337. - if (error instanceof Error && parentTask) {
  3338. - var longStack = renderLongStackTrace(parentTask.data && parentTask.data[creationTrace], error.stack);
  3339. - try {
  3340. - error.stack = error.longStack = longStack;
  3341. - }
  3342. - catch (err) {
  3343. - }
  3344. - }
  3345. - }
  3346. - return parentZoneDelegate.handleError(targetZone, error);
  3347. - }
  3348. -};
  3349. -function captureStackTraces(stackTraces, count) {
  3350. - if (count > 0) {
  3351. - stackTraces.push(getFrames((new LongStackTrace()).error));
  3352. - captureStackTraces(stackTraces, count - 1);
  3353. - }
  3354. -}
  3355. -function computeIgnoreFrames() {
  3356. - if (Error.stackTraceLimit <= 0) {
  3357. - return;
  3358. - }
  3359. - var frames = [];
  3360. - captureStackTraces(frames, 2);
  3361. - var frames1 = frames[0];
  3362. - var frames2 = frames[1];
  3363. - for (var i = 0; i < frames1.length; i++) {
  3364. - var frame1 = frames1[i];
  3365. - if (frame1.indexOf(ERROR_TAG) == -1) {
  3366. - var match = frame1.match(/^\s*at\s+/);
  3367. - if (match) {
  3368. - sepTemplate = match[0] + SEP_TAG + ' (http://localhost)';
  3369. - break;
  3370. - }
  3371. - }
  3372. - }
  3373. - for (var i = 0; i < frames1.length; i++) {
  3374. - var frame1 = frames1[i];
  3375. - var frame2 = frames2[i];
  3376. - if (frame1 === frame2) {
  3377. - IGNORE_FRAMES[frame1] = true;
  3378. - }
  3379. - else {
  3380. - break;
  3381. - }
  3382. - }
  3383. -}
  3384. -computeIgnoreFrames();
  3385. -
  3386. -/**
  3387. - * @license
  3388. - * Copyright Google Inc. All Rights Reserved.
  3389. - *
  3390. - * Use of this source code is governed by an MIT-style license that can be
  3391. - * found in the LICENSE file at https://angular.io/license
  3392. - */
  3393. -var ProxyZoneSpec = /** @class */ (function () {
  3394. - function ProxyZoneSpec(defaultSpecDelegate) {
  3395. - if (defaultSpecDelegate === void 0) { defaultSpecDelegate = null; }
  3396. - this.defaultSpecDelegate = defaultSpecDelegate;
  3397. - this.name = 'ProxyZone';
  3398. - this.properties = { 'ProxyZoneSpec': this };
  3399. - this.propertyKeys = null;
  3400. - this.lastTaskState = null;
  3401. - this.isNeedToTriggerHasTask = false;
  3402. - this.tasks = [];
  3403. - this.setDelegate(defaultSpecDelegate);
  3404. - }
  3405. - ProxyZoneSpec.get = function () {
  3406. - return Zone.current.get('ProxyZoneSpec');
  3407. - };
  3408. - ProxyZoneSpec.isLoaded = function () {
  3409. - return ProxyZoneSpec.get() instanceof ProxyZoneSpec;
  3410. - };
  3411. - ProxyZoneSpec.assertPresent = function () {
  3412. - if (!ProxyZoneSpec.isLoaded()) {
  3413. - throw new Error("Expected to be running in 'ProxyZone', but it was not found.");
  3414. - }
  3415. - return ProxyZoneSpec.get();
  3416. - };
  3417. - ProxyZoneSpec.prototype.setDelegate = function (delegateSpec) {
  3418. - var _this = this;
  3419. - var isNewDelegate = this._delegateSpec !== delegateSpec;
  3420. - this._delegateSpec = delegateSpec;
  3421. - this.propertyKeys && this.propertyKeys.forEach(function (key) { return delete _this.properties[key]; });
  3422. - this.propertyKeys = null;
  3423. - if (delegateSpec && delegateSpec.properties) {
  3424. - this.propertyKeys = Object.keys(delegateSpec.properties);
  3425. - this.propertyKeys.forEach(function (k) { return _this.properties[k] = delegateSpec.properties[k]; });
  3426. - }
  3427. - // if set a new delegateSpec, shoulde check whether need to
  3428. - // trigger hasTask or not
  3429. - if (isNewDelegate && this.lastTaskState &&
  3430. - (this.lastTaskState.macroTask || this.lastTaskState.microTask)) {
  3431. - this.isNeedToTriggerHasTask = true;
  3432. - }
  3433. - };
  3434. - ProxyZoneSpec.prototype.getDelegate = function () {
  3435. - return this._delegateSpec;
  3436. - };
  3437. - ProxyZoneSpec.prototype.resetDelegate = function () {
  3438. - var delegateSpec = this.getDelegate();
  3439. - this.setDelegate(this.defaultSpecDelegate);
  3440. - };
  3441. - ProxyZoneSpec.prototype.tryTriggerHasTask = function (parentZoneDelegate, currentZone, targetZone) {
  3442. - if (this.isNeedToTriggerHasTask && this.lastTaskState) {
  3443. - // last delegateSpec has microTask or macroTask
  3444. - // should call onHasTask in current delegateSpec
  3445. - this.isNeedToTriggerHasTask = false;
  3446. - this.onHasTask(parentZoneDelegate, currentZone, targetZone, this.lastTaskState);
  3447. - }
  3448. - };
  3449. - ProxyZoneSpec.prototype.removeFromTasks = function (task) {
  3450. - if (!this.tasks) {
  3451. - return;
  3452. - }
  3453. - for (var i = 0; i < this.tasks.length; i++) {
  3454. - if (this.tasks[i] === task) {
  3455. - this.tasks.splice(i, 1);
  3456. - return;
  3457. - }
  3458. - }
  3459. - };
  3460. - ProxyZoneSpec.prototype.getAndClearPendingTasksInfo = function () {
  3461. - if (this.tasks.length === 0) {
  3462. - return '';
  3463. - }
  3464. - var taskInfo = this.tasks.map(function (task) {
  3465. - var dataInfo = task.data &&
  3466. - Object.keys(task.data)
  3467. - .map(function (key) {
  3468. - return key + ':' + task.data[key];
  3469. - })
  3470. - .join(',');
  3471. - return "type: " + task.type + ", source: " + task.source + ", args: {" + dataInfo + "}";
  3472. - });
  3473. - var pendingTasksInfo = '--Pendng async tasks are: [' + taskInfo + ']';
  3474. - // clear tasks
  3475. - this.tasks = [];
  3476. - return pendingTasksInfo;
  3477. - };
  3478. - ProxyZoneSpec.prototype.onFork = function (parentZoneDelegate, currentZone, targetZone, zoneSpec) {
  3479. - if (this._delegateSpec && this._delegateSpec.onFork) {
  3480. - return this._delegateSpec.onFork(parentZoneDelegate, currentZone, targetZone, zoneSpec);
  3481. - }
  3482. - else {
  3483. - return parentZoneDelegate.fork(targetZone, zoneSpec);
  3484. - }
  3485. - };
  3486. - ProxyZoneSpec.prototype.onIntercept = function (parentZoneDelegate, currentZone, targetZone, delegate, source) {
  3487. - if (this._delegateSpec && this._delegateSpec.onIntercept) {
  3488. - return this._delegateSpec.onIntercept(parentZoneDelegate, currentZone, targetZone, delegate, source);
  3489. - }
  3490. - else {
  3491. - return parentZoneDelegate.intercept(targetZone, delegate, source);
  3492. - }
  3493. - };
  3494. - ProxyZoneSpec.prototype.onInvoke = function (parentZoneDelegate, currentZone, targetZone, delegate, applyThis, applyArgs, source) {
  3495. - this.tryTriggerHasTask(parentZoneDelegate, currentZone, targetZone);
  3496. - if (this._delegateSpec && this._delegateSpec.onInvoke) {
  3497. - return this._delegateSpec.onInvoke(parentZoneDelegate, currentZone, targetZone, delegate, applyThis, applyArgs, source);
  3498. - }
  3499. - else {
  3500. - return parentZoneDelegate.invoke(targetZone, delegate, applyThis, applyArgs, source);
  3501. - }
  3502. - };
  3503. - ProxyZoneSpec.prototype.onHandleError = function (parentZoneDelegate, currentZone, targetZone, error) {
  3504. - if (this._delegateSpec && this._delegateSpec.onHandleError) {
  3505. - return this._delegateSpec.onHandleError(parentZoneDelegate, currentZone, targetZone, error);
  3506. - }
  3507. - else {
  3508. - return parentZoneDelegate.handleError(targetZone, error);
  3509. - }
  3510. - };
  3511. - ProxyZoneSpec.prototype.onScheduleTask = function (parentZoneDelegate, currentZone, targetZone, task) {
  3512. - if (task.type !== 'eventTask') {
  3513. - this.tasks.push(task);
  3514. - }
  3515. - if (this._delegateSpec && this._delegateSpec.onScheduleTask) {
  3516. - return this._delegateSpec.onScheduleTask(parentZoneDelegate, currentZone, targetZone, task);
  3517. - }
  3518. - else {
  3519. - return parentZoneDelegate.scheduleTask(targetZone, task);
  3520. - }
  3521. - };
  3522. - ProxyZoneSpec.prototype.onInvokeTask = function (parentZoneDelegate, currentZone, targetZone, task, applyThis, applyArgs) {
  3523. - if (task.type !== 'eventTask') {
  3524. - this.removeFromTasks(task);
  3525. - }
  3526. - this.tryTriggerHasTask(parentZoneDelegate, currentZone, targetZone);
  3527. - if (this._delegateSpec && this._delegateSpec.onInvokeTask) {
  3528. - return this._delegateSpec.onInvokeTask(parentZoneDelegate, currentZone, targetZone, task, applyThis, applyArgs);
  3529. - }
  3530. - else {
  3531. - return parentZoneDelegate.invokeTask(targetZone, task, applyThis, applyArgs);
  3532. - }
  3533. - };
  3534. - ProxyZoneSpec.prototype.onCancelTask = function (parentZoneDelegate, currentZone, targetZone, task) {
  3535. - if (task.type !== 'eventTask') {
  3536. - this.removeFromTasks(task);
  3537. - }
  3538. - this.tryTriggerHasTask(parentZoneDelegate, currentZone, targetZone);
  3539. - if (this._delegateSpec && this._delegateSpec.onCancelTask) {
  3540. - return this._delegateSpec.onCancelTask(parentZoneDelegate, currentZone, targetZone, task);
  3541. - }
  3542. - else {
  3543. - return parentZoneDelegate.cancelTask(targetZone, task);
  3544. - }
  3545. - };
  3546. - ProxyZoneSpec.prototype.onHasTask = function (delegate, current, target, hasTaskState) {
  3547. - this.lastTaskState = hasTaskState;
  3548. - if (this._delegateSpec && this._delegateSpec.onHasTask) {
  3549. - this._delegateSpec.onHasTask(delegate, current, target, hasTaskState);
  3550. - }
  3551. - else {
  3552. - delegate.hasTask(target, hasTaskState);
  3553. - }
  3554. - };
  3555. - return ProxyZoneSpec;
  3556. -}());
  3557. -// Export the class so that new instances can be created with proper
  3558. -// constructor params.
  3559. -Zone['ProxyZoneSpec'] = ProxyZoneSpec;
  3560. -
  3561. -/**
  3562. - * @license
  3563. - * Copyright Google Inc. All Rights Reserved.
  3564. - *
  3565. - * Use of this source code is governed by an MIT-style license that can be
  3566. - * found in the LICENSE file at https://angular.io/license
  3567. - */
  3568. -var SyncTestZoneSpec = /** @class */ (function () {
  3569. - function SyncTestZoneSpec(namePrefix) {
  3570. - this.runZone = Zone.current;
  3571. - this.name = 'syncTestZone for ' + namePrefix;
  3572. - }
  3573. - SyncTestZoneSpec.prototype.onScheduleTask = function (delegate, current, target, task) {
  3574. - switch (task.type) {
  3575. - case 'microTask':
  3576. - case 'macroTask':
  3577. - throw new Error("Cannot call " + task.source + " from within a sync test.");
  3578. - case 'eventTask':
  3579. - task = delegate.scheduleTask(target, task);
  3580. - break;
  3581. - }
  3582. - return task;
  3583. - };
  3584. - return SyncTestZoneSpec;
  3585. -}());
  3586. -// Export the class so that new instances can be created with proper
  3587. -// constructor params.
  3588. -Zone['SyncTestZoneSpec'] = SyncTestZoneSpec;
  3589. -
  3590. -/**
  3591. - * @license
  3592. - * Copyright Google Inc. All Rights Reserved.
  3593. - *
  3594. - * Use of this source code is governed by an MIT-style license that can be
  3595. - * found in the LICENSE file at https://angular.io/license
  3596. - */
  3597. -var _global = typeof window !== 'undefined' && window || typeof self !== 'undefined' && self || global;
  3598. -var AsyncTestZoneSpec = /** @class */ (function () {
  3599. - function AsyncTestZoneSpec(finishCallback, failCallback, namePrefix) {
  3600. - this.finishCallback = finishCallback;
  3601. - this.failCallback = failCallback;
  3602. - this._pendingMicroTasks = false;
  3603. - this._pendingMacroTasks = false;
  3604. - this._alreadyErrored = false;
  3605. - this._isSync = false;
  3606. - this.runZone = Zone.current;
  3607. - this.unresolvedChainedPromiseCount = 0;
  3608. - this.supportWaitUnresolvedChainedPromise = false;
  3609. - this.name = 'asyncTestZone for ' + namePrefix;
  3610. - this.properties = { 'AsyncTestZoneSpec': this };
  3611. - this.supportWaitUnresolvedChainedPromise =
  3612. - _global[Zone.__symbol__('supportWaitUnResolvedChainedPromise')] === true;
  3613. - }
  3614. - AsyncTestZoneSpec.prototype.isUnresolvedChainedPromisePending = function () {
  3615. - return this.unresolvedChainedPromiseCount > 0;
  3616. - };
  3617. - AsyncTestZoneSpec.prototype._finishCallbackIfDone = function () {
  3618. - var _this = this;
  3619. - if (!(this._pendingMicroTasks || this._pendingMacroTasks ||
  3620. - (this.supportWaitUnresolvedChainedPromise && this.isUnresolvedChainedPromisePending()))) {
  3621. - // We do this because we would like to catch unhandled rejected promises.
  3622. - this.runZone.run(function () {
  3623. - setTimeout(function () {
  3624. - if (!_this._alreadyErrored && !(_this._pendingMicroTasks || _this._pendingMacroTasks)) {
  3625. - _this.finishCallback();
  3626. - }
  3627. - }, 0);
  3628. - });
  3629. - }
  3630. - };
  3631. - AsyncTestZoneSpec.prototype.patchPromiseForTest = function () {
  3632. - if (!this.supportWaitUnresolvedChainedPromise) {
  3633. - return;
  3634. - }
  3635. - var patchPromiseForTest = Promise[Zone.__symbol__('patchPromiseForTest')];
  3636. - if (patchPromiseForTest) {
  3637. - patchPromiseForTest();
  3638. - }
  3639. - };
  3640. - AsyncTestZoneSpec.prototype.unPatchPromiseForTest = function () {
  3641. - if (!this.supportWaitUnresolvedChainedPromise) {
  3642. - return;
  3643. - }
  3644. - var unPatchPromiseForTest = Promise[Zone.__symbol__('unPatchPromiseForTest')];
  3645. - if (unPatchPromiseForTest) {
  3646. - unPatchPromiseForTest();
  3647. - }
  3648. - };
  3649. - AsyncTestZoneSpec.prototype.onScheduleTask = function (delegate, current, target, task) {
  3650. - if (task.type !== 'eventTask') {
  3651. - this._isSync = false;
  3652. - }
  3653. - if (task.type === 'microTask' && task.data && task.data instanceof Promise) {
  3654. - // check whether the promise is a chained promise
  3655. - if (task.data[AsyncTestZoneSpec.symbolParentUnresolved] === true) {
  3656. - // chained promise is being scheduled
  3657. - this.unresolvedChainedPromiseCount--;
  3658. - }
  3659. - }
  3660. - return delegate.scheduleTask(target, task);
  3661. - };
  3662. - AsyncTestZoneSpec.prototype.onInvokeTask = function (delegate, current, target, task, applyThis, applyArgs) {
  3663. - if (task.type !== 'eventTask') {
  3664. - this._isSync = false;
  3665. - }
  3666. - return delegate.invokeTask(target, task, applyThis, applyArgs);
  3667. - };
  3668. - AsyncTestZoneSpec.prototype.onCancelTask = function (delegate, current, target, task) {
  3669. - if (task.type !== 'eventTask') {
  3670. - this._isSync = false;
  3671. - }
  3672. - return delegate.cancelTask(target, task);
  3673. - };
  3674. - // Note - we need to use onInvoke at the moment to call finish when a test is
  3675. - // fully synchronous. TODO(juliemr): remove this when the logic for
  3676. - // onHasTask changes and it calls whenever the task queues are dirty.
  3677. - // updated by(JiaLiPassion), only call finish callback when no task
  3678. - // was scheduled/invoked/canceled.
  3679. - AsyncTestZoneSpec.prototype.onInvoke = function (parentZoneDelegate, currentZone, targetZone, delegate, applyThis, applyArgs, source) {
  3680. - try {
  3681. - this._isSync = true;
  3682. - return parentZoneDelegate.invoke(targetZone, delegate, applyThis, applyArgs, source);
  3683. - }
  3684. - finally {
  3685. - var afterTaskCounts = parentZoneDelegate._taskCounts;
  3686. - if (this._isSync) {
  3687. - this._finishCallbackIfDone();
  3688. - }
  3689. - }
  3690. - };
  3691. - AsyncTestZoneSpec.prototype.onHandleError = function (parentZoneDelegate, currentZone, targetZone, error) {
  3692. - // Let the parent try to handle the error.
  3693. - var result = parentZoneDelegate.handleError(targetZone, error);
  3694. - if (result) {
  3695. - this.failCallback(error);
  3696. - this._alreadyErrored = true;
  3697. - }
  3698. - return false;
  3699. - };
  3700. - AsyncTestZoneSpec.prototype.onHasTask = function (delegate, current, target, hasTaskState) {
  3701. - delegate.hasTask(target, hasTaskState);
  3702. - if (hasTaskState.change == 'microTask') {
  3703. - this._pendingMicroTasks = hasTaskState.microTask;
  3704. - this._finishCallbackIfDone();
  3705. - }
  3706. - else if (hasTaskState.change == 'macroTask') {
  3707. - this._pendingMacroTasks = hasTaskState.macroTask;
  3708. - this._finishCallbackIfDone();
  3709. - }
  3710. - };
  3711. - AsyncTestZoneSpec.symbolParentUnresolved = Zone.__symbol__('parentUnresolved');
  3712. - return AsyncTestZoneSpec;
  3713. -}());
  3714. -// Export the class so that new instances can be created with proper
  3715. -// constructor params.
  3716. -Zone['AsyncTestZoneSpec'] = AsyncTestZoneSpec;
  3717. -
  3718. -/**
  3719. - * @license
  3720. - * Copyright Google Inc. All Rights Reserved.
  3721. - *
  3722. - * Use of this source code is governed by an MIT-style license that can be
  3723. - * found in the LICENSE file at https://angular.io/license
  3724. - */
  3725. -var __read = (undefined && undefined.__read) || function (o, n) {
  3726. - var m = typeof Symbol === "function" && o[Symbol.iterator];
  3727. - if (!m) return o;
  3728. - var i = m.call(o), r, ar = [], e;
  3729. - try {
  3730. - while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
  3731. - }
  3732. - catch (error) { e = { error: error }; }
  3733. - finally {
  3734. - try {
  3735. - if (r && !r.done && (m = i["return"])) m.call(i);
  3736. - }
  3737. - finally { if (e) throw e.error; }
  3738. - }
  3739. - return ar;
  3740. -};
  3741. -var __spread = (undefined && undefined.__spread) || function () {
  3742. - for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
  3743. - return ar;
  3744. -};
  3745. -(function (global) {
  3746. - var OriginalDate = global.Date;
  3747. - var FakeDate = /** @class */ (function () {
  3748. - function FakeDate() {
  3749. - if (arguments.length === 0) {
  3750. - var d = new OriginalDate();
  3751. - d.setTime(FakeDate.now());
  3752. - return d;
  3753. - }
  3754. - else {
  3755. - var args = Array.prototype.slice.call(arguments);
  3756. - return new (OriginalDate.bind.apply(OriginalDate, __spread([void 0], args)))();
  3757. - }
  3758. - }
  3759. - FakeDate.now = function () {
  3760. - var fakeAsyncTestZoneSpec = Zone.current.get('FakeAsyncTestZoneSpec');
  3761. - if (fakeAsyncTestZoneSpec) {
  3762. - return fakeAsyncTestZoneSpec.getCurrentRealTime() + fakeAsyncTestZoneSpec.getCurrentTime();
  3763. - }
  3764. - return OriginalDate.now.apply(this, arguments);
  3765. - };
  3766. - return FakeDate;
  3767. - }());
  3768. - FakeDate.UTC = OriginalDate.UTC;
  3769. - FakeDate.parse = OriginalDate.parse;
  3770. - // keep a reference for zone patched timer function
  3771. - var timers = {
  3772. - setTimeout: global.setTimeout,
  3773. - setInterval: global.setInterval,
  3774. - clearTimeout: global.clearTimeout,
  3775. - clearInterval: global.clearInterval
  3776. - };
  3777. - var Scheduler = /** @class */ (function () {
  3778. - function Scheduler() {
  3779. - // Next scheduler id.
  3780. - this.nextId = 1;
  3781. - // Scheduler queue with the tuple of end time and callback function - sorted by end time.
  3782. - this._schedulerQueue = [];
  3783. - // Current simulated time in millis.
  3784. - this._currentTime = 0;
  3785. - // Current real time in millis.
  3786. - this._currentRealTime = OriginalDate.now();
  3787. - }
  3788. - Scheduler.prototype.getCurrentTime = function () {
  3789. - return this._currentTime;
  3790. - };
  3791. - Scheduler.prototype.getCurrentRealTime = function () {
  3792. - return this._currentRealTime;
  3793. - };
  3794. - Scheduler.prototype.setCurrentRealTime = function (realTime) {
  3795. - this._currentRealTime = realTime;
  3796. - };
  3797. - Scheduler.prototype.scheduleFunction = function (cb, delay, args, isPeriodic, isRequestAnimationFrame, id) {
  3798. - if (args === void 0) { args = []; }
  3799. - if (isPeriodic === void 0) { isPeriodic = false; }
  3800. - if (isRequestAnimationFrame === void 0) { isRequestAnimationFrame = false; }
  3801. - if (id === void 0) { id = -1; }
  3802. - var currentId = id < 0 ? this.nextId++ : id;
  3803. - var endTime = this._currentTime + delay;
  3804. - // Insert so that scheduler queue remains sorted by end time.
  3805. - var newEntry = {
  3806. - endTime: endTime,
  3807. - id: currentId,
  3808. - func: cb,
  3809. - args: args,
  3810. - delay: delay,
  3811. - isPeriodic: isPeriodic,
  3812. - isRequestAnimationFrame: isRequestAnimationFrame
  3813. - };
  3814. - var i = 0;
  3815. - for (; i < this._schedulerQueue.length; i++) {
  3816. - var currentEntry = this._schedulerQueue[i];
  3817. - if (newEntry.endTime < currentEntry.endTime) {
  3818. - break;
  3819. - }
  3820. - }
  3821. - this._schedulerQueue.splice(i, 0, newEntry);
  3822. - return currentId;
  3823. - };
  3824. - Scheduler.prototype.removeScheduledFunctionWithId = function (id) {
  3825. - for (var i = 0; i < this._schedulerQueue.length; i++) {
  3826. - if (this._schedulerQueue[i].id == id) {
  3827. - this._schedulerQueue.splice(i, 1);
  3828. - break;
  3829. - }
  3830. - }
  3831. - };
  3832. - Scheduler.prototype.tick = function (millis, doTick) {
  3833. - if (millis === void 0) { millis = 0; }
  3834. - var finalTime = this._currentTime + millis;
  3835. - var lastCurrentTime = 0;
  3836. - if (this._schedulerQueue.length === 0 && doTick) {
  3837. - doTick(millis);
  3838. - return;
  3839. - }
  3840. - while (this._schedulerQueue.length > 0) {
  3841. - var current = this._schedulerQueue[0];
  3842. - if (finalTime < current.endTime) {
  3843. - // Done processing the queue since it's sorted by endTime.
  3844. - break;
  3845. - }
  3846. - else {
  3847. - // Time to run scheduled function. Remove it from the head of queue.
  3848. - var current_1 = this._schedulerQueue.shift();
  3849. - lastCurrentTime = this._currentTime;
  3850. - this._currentTime = current_1.endTime;
  3851. - if (doTick) {
  3852. - doTick(this._currentTime - lastCurrentTime);
  3853. - }
  3854. - var retval = current_1.func.apply(global, current_1.args);
  3855. - if (!retval) {
  3856. - // Uncaught exception in the current scheduled function. Stop processing the queue.
  3857. - break;
  3858. - }
  3859. - }
  3860. - }
  3861. - this._currentTime = finalTime;
  3862. - };
  3863. - Scheduler.prototype.flush = function (limit, flushPeriodic, doTick) {
  3864. - if (limit === void 0) { limit = 20; }
  3865. - if (flushPeriodic === void 0) { flushPeriodic = false; }
  3866. - if (flushPeriodic) {
  3867. - return this.flushPeriodic(doTick);
  3868. - }
  3869. - else {
  3870. - return this.flushNonPeriodic(limit, doTick);
  3871. - }
  3872. - };
  3873. - Scheduler.prototype.flushPeriodic = function (doTick) {
  3874. - if (this._schedulerQueue.length === 0) {
  3875. - return 0;
  3876. - }
  3877. - // Find the last task currently queued in the scheduler queue and tick
  3878. - // till that time.
  3879. - var startTime = this._currentTime;
  3880. - var lastTask = this._schedulerQueue[this._schedulerQueue.length - 1];
  3881. - this.tick(lastTask.endTime - startTime, doTick);
  3882. - return this._currentTime - startTime;
  3883. - };
  3884. - Scheduler.prototype.flushNonPeriodic = function (limit, doTick) {
  3885. - var startTime = this._currentTime;
  3886. - var lastCurrentTime = 0;
  3887. - var count = 0;
  3888. - while (this._schedulerQueue.length > 0) {
  3889. - count++;
  3890. - if (count > limit) {
  3891. - throw new Error('flush failed after reaching the limit of ' + limit +
  3892. - ' tasks. Does your code use a polling timeout?');
  3893. - }
  3894. - // flush only non-periodic timers.
  3895. - // If the only remaining tasks are periodic(or requestAnimationFrame), finish flushing.
  3896. - if (this._schedulerQueue.filter(function (task) { return !task.isPeriodic && !task.isRequestAnimationFrame; })
  3897. - .length === 0) {
  3898. - break;
  3899. - }
  3900. - var current = this._schedulerQueue.shift();
  3901. - lastCurrentTime = this._currentTime;
  3902. - this._currentTime = current.endTime;
  3903. - if (doTick) {
  3904. - // Update any secondary schedulers like Jasmine mock Date.
  3905. - doTick(this._currentTime - lastCurrentTime);
  3906. - }
  3907. - var retval = current.func.apply(global, current.args);
  3908. - if (!retval) {
  3909. - // Uncaught exception in the current scheduled function. Stop processing the queue.
  3910. - break;
  3911. - }
  3912. - }
  3913. - return this._currentTime - startTime;
  3914. - };
  3915. - return Scheduler;
  3916. - }());
  3917. - var FakeAsyncTestZoneSpec = /** @class */ (function () {
  3918. - function FakeAsyncTestZoneSpec(namePrefix, trackPendingRequestAnimationFrame, macroTaskOptions) {
  3919. - if (trackPendingRequestAnimationFrame === void 0) { trackPendingRequestAnimationFrame = false; }
  3920. - this.trackPendingRequestAnimationFrame = trackPendingRequestAnimationFrame;
  3921. - this.macroTaskOptions = macroTaskOptions;
  3922. - this._scheduler = new Scheduler();
  3923. - this._microtasks = [];
  3924. - this._lastError = null;
  3925. - this._uncaughtPromiseErrors = Promise[Zone.__symbol__('uncaughtPromiseErrors')];
  3926. - this.pendingPeriodicTimers = [];
  3927. - this.pendingTimers = [];
  3928. - this.patchDateLocked = false;
  3929. - this.properties = { 'FakeAsyncTestZoneSpec': this };
  3930. - this.name = 'fakeAsyncTestZone for ' + namePrefix;
  3931. - // in case user can't access the construction of FakeAsyncTestSpec
  3932. - // user can also define macroTaskOptions by define a global variable.
  3933. - if (!this.macroTaskOptions) {
  3934. - this.macroTaskOptions = global[Zone.__symbol__('FakeAsyncTestMacroTask')];
  3935. - }
  3936. - }
  3937. - FakeAsyncTestZoneSpec.assertInZone = function () {
  3938. - if (Zone.current.get('FakeAsyncTestZoneSpec') == null) {
  3939. - throw new Error('The code should be running in the fakeAsync zone to call this function');
  3940. - }
  3941. - };
  3942. - FakeAsyncTestZoneSpec.prototype._fnAndFlush = function (fn, completers) {
  3943. - var _this = this;
  3944. - return function () {
  3945. - var args = [];
  3946. - for (var _i = 0; _i < arguments.length; _i++) {
  3947. - args[_i] = arguments[_i];
  3948. - }
  3949. - fn.apply(global, args);
  3950. - if (_this._lastError === null) {
  3951. - if (completers.onSuccess != null) {
  3952. - completers.onSuccess.apply(global);
  3953. - }
  3954. - // Flush microtasks only on success.
  3955. - _this.flushMicrotasks();
  3956. - }
  3957. - else {
  3958. - if (completers.onError != null) {
  3959. - completers.onError.apply(global);
  3960. - }
  3961. - }
  3962. - // Return true if there were no errors, false otherwise.
  3963. - return _this._lastError === null;
  3964. - };
  3965. - };
  3966. - FakeAsyncTestZoneSpec._removeTimer = function (timers, id) {
  3967. - var index = timers.indexOf(id);
  3968. - if (index > -1) {
  3969. - timers.splice(index, 1);
  3970. - }
  3971. - };
  3972. - FakeAsyncTestZoneSpec.prototype._dequeueTimer = function (id) {
  3973. - var _this = this;
  3974. - return function () {
  3975. - FakeAsyncTestZoneSpec._removeTimer(_this.pendingTimers, id);
  3976. - };
  3977. - };
  3978. - FakeAsyncTestZoneSpec.prototype._requeuePeriodicTimer = function (fn, interval, args, id) {
  3979. - var _this = this;
  3980. - return function () {
  3981. - // Requeue the timer callback if it's not been canceled.
  3982. - if (_this.pendingPeriodicTimers.indexOf(id) !== -1) {
  3983. - _this._scheduler.scheduleFunction(fn, interval, args, true, false, id);
  3984. - }
  3985. - };
  3986. - };
  3987. - FakeAsyncTestZoneSpec.prototype._dequeuePeriodicTimer = function (id) {
  3988. - var _this = this;
  3989. - return function () {
  3990. - FakeAsyncTestZoneSpec._removeTimer(_this.pendingPeriodicTimers, id);
  3991. - };
  3992. - };
  3993. - FakeAsyncTestZoneSpec.prototype._setTimeout = function (fn, delay, args, isTimer) {
  3994. - if (isTimer === void 0) { isTimer = true; }
  3995. - var removeTimerFn = this._dequeueTimer(this._scheduler.nextId);
  3996. - // Queue the callback and dequeue the timer on success and error.
  3997. - var cb = this._fnAndFlush(fn, { onSuccess: removeTimerFn, onError: removeTimerFn });
  3998. - var id = this._scheduler.scheduleFunction(cb, delay, args, false, !isTimer);
  3999. - if (isTimer) {
  4000. - this.pendingTimers.push(id);
  4001. - }
  4002. - return id;
  4003. - };
  4004. - FakeAsyncTestZoneSpec.prototype._clearTimeout = function (id) {
  4005. - FakeAsyncTestZoneSpec._removeTimer(this.pendingTimers, id);
  4006. - this._scheduler.removeScheduledFunctionWithId(id);
  4007. - };
  4008. - FakeAsyncTestZoneSpec.prototype._setInterval = function (fn, interval, args) {
  4009. - var id = this._scheduler.nextId;
  4010. - var completers = { onSuccess: null, onError: this._dequeuePeriodicTimer(id) };
  4011. - var cb = this._fnAndFlush(fn, completers);
  4012. - // Use the callback created above to requeue on success.
  4013. - completers.onSuccess = this._requeuePeriodicTimer(cb, interval, args, id);
  4014. - // Queue the callback and dequeue the periodic timer only on error.
  4015. - this._scheduler.scheduleFunction(cb, interval, args, true);
  4016. - this.pendingPeriodicTimers.push(id);
  4017. - return id;
  4018. - };
  4019. - FakeAsyncTestZoneSpec.prototype._clearInterval = function (id) {
  4020. - FakeAsyncTestZoneSpec._removeTimer(this.pendingPeriodicTimers, id);
  4021. - this._scheduler.removeScheduledFunctionWithId(id);
  4022. - };
  4023. - FakeAsyncTestZoneSpec.prototype._resetLastErrorAndThrow = function () {
  4024. - var error = this._lastError || this._uncaughtPromiseErrors[0];
  4025. - this._uncaughtPromiseErrors.length = 0;
  4026. - this._lastError = null;
  4027. - throw error;
  4028. - };
  4029. - FakeAsyncTestZoneSpec.prototype.getCurrentTime = function () {
  4030. - return this._scheduler.getCurrentTime();
  4031. - };
  4032. - FakeAsyncTestZoneSpec.prototype.getCurrentRealTime = function () {
  4033. - return this._scheduler.getCurrentRealTime();
  4034. - };
  4035. - FakeAsyncTestZoneSpec.prototype.setCurrentRealTime = function (realTime) {
  4036. - this._scheduler.setCurrentRealTime(realTime);
  4037. - };
  4038. - FakeAsyncTestZoneSpec.patchDate = function () {
  4039. - if (global['Date'] === FakeDate) {
  4040. - // already patched
  4041. - return;
  4042. - }
  4043. - global['Date'] = FakeDate;
  4044. - FakeDate.prototype = OriginalDate.prototype;
  4045. - // try check and reset timers
  4046. - // because jasmine.clock().install() may
  4047. - // have replaced the global timer
  4048. - FakeAsyncTestZoneSpec.checkTimerPatch();
  4049. - };
  4050. - FakeAsyncTestZoneSpec.resetDate = function () {
  4051. - if (global['Date'] === FakeDate) {
  4052. - global['Date'] = OriginalDate;
  4053. - }
  4054. - };
  4055. - FakeAsyncTestZoneSpec.checkTimerPatch = function () {
  4056. - if (global.setTimeout !== timers.setTimeout) {
  4057. - global.setTimeout = timers.setTimeout;
  4058. - global.clearTimeout = timers.clearTimeout;
  4059. - }
  4060. - if (global.setInterval !== timers.setInterval) {
  4061. - global.setInterval = timers.setInterval;
  4062. - global.clearInterval = timers.clearInterval;
  4063. - }
  4064. - };
  4065. - FakeAsyncTestZoneSpec.prototype.lockDatePatch = function () {
  4066. - this.patchDateLocked = true;
  4067. - FakeAsyncTestZoneSpec.patchDate();
  4068. - };
  4069. - FakeAsyncTestZoneSpec.prototype.unlockDatePatch = function () {
  4070. - this.patchDateLocked = false;
  4071. - FakeAsyncTestZoneSpec.resetDate();
  4072. - };
  4073. - FakeAsyncTestZoneSpec.prototype.tick = function (millis, doTick) {
  4074. - if (millis === void 0) { millis = 0; }
  4075. - FakeAsyncTestZoneSpec.assertInZone();
  4076. - this.flushMicrotasks();
  4077. - this._scheduler.tick(millis, doTick);
  4078. - if (this._lastError !== null) {
  4079. - this._resetLastErrorAndThrow();
  4080. - }
  4081. - };
  4082. - FakeAsyncTestZoneSpec.prototype.flushMicrotasks = function () {
  4083. - var _this = this;
  4084. - FakeAsyncTestZoneSpec.assertInZone();
  4085. - var flushErrors = function () {
  4086. - if (_this._lastError !== null || _this._uncaughtPromiseErrors.length) {
  4087. - // If there is an error stop processing the microtask queue and rethrow the error.
  4088. - _this._resetLastErrorAndThrow();
  4089. - }
  4090. - };
  4091. - while (this._microtasks.length > 0) {
  4092. - var microtask = this._microtasks.shift();
  4093. - microtask.func.apply(microtask.target, microtask.args);
  4094. - }
  4095. - flushErrors();
  4096. - };
  4097. - FakeAsyncTestZoneSpec.prototype.flush = function (limit, flushPeriodic, doTick) {
  4098. - FakeAsyncTestZoneSpec.assertInZone();
  4099. - this.flushMicrotasks();
  4100. - var elapsed = this._scheduler.flush(limit, flushPeriodic, doTick);
  4101. - if (this._lastError !== null) {
  4102. - this._resetLastErrorAndThrow();
  4103. - }
  4104. - return elapsed;
  4105. - };
  4106. - FakeAsyncTestZoneSpec.prototype.onScheduleTask = function (delegate, current, target, task) {
  4107. - switch (task.type) {
  4108. - case 'microTask':
  4109. - var args = task.data && task.data.args;
  4110. - // should pass additional arguments to callback if have any
  4111. - // currently we know process.nextTick will have such additional
  4112. - // arguments
  4113. - var additionalArgs = void 0;
  4114. - if (args) {
  4115. - var callbackIndex = task.data.cbIdx;
  4116. - if (typeof args.length === 'number' && args.length > callbackIndex + 1) {
  4117. - additionalArgs = Array.prototype.slice.call(args, callbackIndex + 1);
  4118. - }
  4119. - }
  4120. - this._microtasks.push({
  4121. - func: task.invoke,
  4122. - args: additionalArgs,
  4123. - target: task.data && task.data.target
  4124. - });
  4125. - break;
  4126. - case 'macroTask':
  4127. - switch (task.source) {
  4128. - case 'setTimeout':
  4129. - task.data['handleId'] = this._setTimeout(task.invoke, task.data['delay'], Array.prototype.slice.call(task.data['args'], 2));
  4130. - break;
  4131. - case 'setImmediate':
  4132. - task.data['handleId'] = this._setTimeout(task.invoke, 0, Array.prototype.slice.call(task.data['args'], 1));
  4133. - break;
  4134. - case 'setInterval':
  4135. - task.data['handleId'] = this._setInterval(task.invoke, task.data['delay'], Array.prototype.slice.call(task.data['args'], 2));
  4136. - break;
  4137. - case 'XMLHttpRequest.send':
  4138. - throw new Error('Cannot make XHRs from within a fake async test. Request URL: ' +
  4139. - task.data['url']);
  4140. - case 'requestAnimationFrame':
  4141. - case 'webkitRequestAnimationFrame':
  4142. - case 'mozRequestAnimationFrame':
  4143. - // Simulate a requestAnimationFrame by using a setTimeout with 16 ms.
  4144. - // (60 frames per second)
  4145. - task.data['handleId'] = this._setTimeout(task.invoke, 16, task.data['args'], this.trackPendingRequestAnimationFrame);
  4146. - break;
  4147. - default:
  4148. - // user can define which macroTask they want to support by passing
  4149. - // macroTaskOptions
  4150. - var macroTaskOption = this.findMacroTaskOption(task);
  4151. - if (macroTaskOption) {
  4152. - var args_1 = task.data && task.data['args'];
  4153. - var delay = args_1 && args_1.length > 1 ? args_1[1] : 0;
  4154. - var callbackArgs = macroTaskOption.callbackArgs ? macroTaskOption.callbackArgs : args_1;
  4155. - if (!!macroTaskOption.isPeriodic) {
  4156. - // periodic macroTask, use setInterval to simulate
  4157. - task.data['handleId'] = this._setInterval(task.invoke, delay, callbackArgs);
  4158. - task.data.isPeriodic = true;
  4159. - }
  4160. - else {
  4161. - // not periodic, use setTimeout to simulate
  4162. - task.data['handleId'] = this._setTimeout(task.invoke, delay, callbackArgs);
  4163. - }
  4164. - break;
  4165. - }
  4166. - throw new Error('Unknown macroTask scheduled in fake async test: ' + task.source);
  4167. - }
  4168. - break;
  4169. - case 'eventTask':
  4170. - task = delegate.scheduleTask(target, task);
  4171. - break;
  4172. - }
  4173. - return task;
  4174. - };
  4175. - FakeAsyncTestZoneSpec.prototype.onCancelTask = function (delegate, current, target, task) {
  4176. - switch (task.source) {
  4177. - case 'setTimeout':
  4178. - case 'requestAnimationFrame':
  4179. - case 'webkitRequestAnimationFrame':
  4180. - case 'mozRequestAnimationFrame':
  4181. - return this._clearTimeout(task.data['handleId']);
  4182. - case 'setInterval':
  4183. - return this._clearInterval(task.data['handleId']);
  4184. - default:
  4185. - // user can define which macroTask they want to support by passing
  4186. - // macroTaskOptions
  4187. - var macroTaskOption = this.findMacroTaskOption(task);
  4188. - if (macroTaskOption) {
  4189. - var handleId = task.data['handleId'];
  4190. - return macroTaskOption.isPeriodic ? this._clearInterval(handleId) :
  4191. - this._clearTimeout(handleId);
  4192. - }
  4193. - return delegate.cancelTask(target, task);
  4194. - }
  4195. - };
  4196. - FakeAsyncTestZoneSpec.prototype.onInvoke = function (delegate, current, target, callback, applyThis, applyArgs, source) {
  4197. - try {
  4198. - FakeAsyncTestZoneSpec.patchDate();
  4199. - return delegate.invoke(target, callback, applyThis, applyArgs, source);
  4200. - }
  4201. - finally {
  4202. - if (!this.patchDateLocked) {
  4203. - FakeAsyncTestZoneSpec.resetDate();
  4204. - }
  4205. - }
  4206. - };
  4207. - FakeAsyncTestZoneSpec.prototype.findMacroTaskOption = function (task) {
  4208. - if (!this.macroTaskOptions) {
  4209. - return null;
  4210. - }
  4211. - for (var i = 0; i < this.macroTaskOptions.length; i++) {
  4212. - var macroTaskOption = this.macroTaskOptions[i];
  4213. - if (macroTaskOption.source === task.source) {
  4214. - return macroTaskOption;
  4215. - }
  4216. - }
  4217. - return null;
  4218. - };
  4219. - FakeAsyncTestZoneSpec.prototype.onHandleError = function (parentZoneDelegate, currentZone, targetZone, error) {
  4220. - this._lastError = error;
  4221. - return false; // Don't propagate error to parent zone.
  4222. - };
  4223. - return FakeAsyncTestZoneSpec;
  4224. - }());
  4225. - // Export the class so that new instances can be created with proper
  4226. - // constructor params.
  4227. - Zone['FakeAsyncTestZoneSpec'] = FakeAsyncTestZoneSpec;
  4228. -})(typeof window === 'object' && window || typeof self === 'object' && self || global);
  4229. -
  4230. -/**
  4231. - * @license
  4232. - * Copyright Google Inc. All Rights Reserved.
  4233. - *
  4234. - * Use of this source code is governed by an MIT-style license that can be
  4235. - * found in the LICENSE file at https://angular.io/license
  4236. - */
  4237. -/**
  4238. - * A `TaskTrackingZoneSpec` allows one to track all outstanding Tasks.
  4239. - *
  4240. - * This is useful in tests. For example to see which tasks are preventing a test from completing
  4241. - * or an automated way of releasing all of the event listeners at the end of the test.
  4242. - */
  4243. -var TaskTrackingZoneSpec = /** @class */ (function () {
  4244. - function TaskTrackingZoneSpec() {
  4245. - this.name = 'TaskTrackingZone';
  4246. - this.microTasks = [];
  4247. - this.macroTasks = [];
  4248. - this.eventTasks = [];
  4249. - this.properties = { 'TaskTrackingZone': this };
  4250. - }
  4251. - TaskTrackingZoneSpec.get = function () {
  4252. - return Zone.current.get('TaskTrackingZone');
  4253. - };
  4254. - TaskTrackingZoneSpec.prototype.getTasksFor = function (type) {
  4255. - switch (type) {
  4256. - case 'microTask':
  4257. - return this.microTasks;
  4258. - case 'macroTask':
  4259. - return this.macroTasks;
  4260. - case 'eventTask':
  4261. - return this.eventTasks;
  4262. - }
  4263. - throw new Error('Unknown task format: ' + type);
  4264. - };
  4265. - TaskTrackingZoneSpec.prototype.onScheduleTask = function (parentZoneDelegate, currentZone, targetZone, task) {
  4266. - task['creationLocation'] = new Error("Task '" + task.type + "' from '" + task.source + "'.");
  4267. - var tasks = this.getTasksFor(task.type);
  4268. - tasks.push(task);
  4269. - return parentZoneDelegate.scheduleTask(targetZone, task);
  4270. - };
  4271. - TaskTrackingZoneSpec.prototype.onCancelTask = function (parentZoneDelegate, currentZone, targetZone, task) {
  4272. - var tasks = this.getTasksFor(task.type);
  4273. - for (var i = 0; i < tasks.length; i++) {
  4274. - if (tasks[i] == task) {
  4275. - tasks.splice(i, 1);
  4276. - break;
  4277. - }
  4278. - }
  4279. - return parentZoneDelegate.cancelTask(targetZone, task);
  4280. - };
  4281. - TaskTrackingZoneSpec.prototype.onInvokeTask = function (parentZoneDelegate, currentZone, targetZone, task, applyThis, applyArgs) {
  4282. - if (task.type === 'eventTask')
  4283. - return parentZoneDelegate.invokeTask(targetZone, task, applyThis, applyArgs);
  4284. - var tasks = this.getTasksFor(task.type);
  4285. - for (var i = 0; i < tasks.length; i++) {
  4286. - if (tasks[i] == task) {
  4287. - tasks.splice(i, 1);
  4288. - break;
  4289. - }
  4290. - }
  4291. - return parentZoneDelegate.invokeTask(targetZone, task, applyThis, applyArgs);
  4292. - };
  4293. - TaskTrackingZoneSpec.prototype.clearEvents = function () {
  4294. - while (this.eventTasks.length) {
  4295. - Zone.current.cancelTask(this.eventTasks[0]);
  4296. - }
  4297. - };
  4298. - return TaskTrackingZoneSpec;
  4299. -}());
  4300. -// Export the class so that new instances can be created with proper
  4301. -// constructor params.
  4302. -Zone['TaskTrackingZoneSpec'] = TaskTrackingZoneSpec;
  4303. -
  4304. -/**
  4305. - * @license
  4306. - * Copyright Google Inc. All Rights Reserved.
  4307. - *
  4308. - * Use of this source code is governed by an MIT-style license that can be
  4309. - * found in the LICENSE file at https://angular.io/license
  4310. - */
  4311. -/**
  4312. - * @fileoverview
  4313. - * @suppress {missingRequire}
  4314. - */
  4315. -(function (global) {
  4316. - // Detect and setup WTF.
  4317. - var wtfTrace = null;
  4318. - var wtfEvents = null;
  4319. - var wtfEnabled = (function () {
  4320. - var wtf = global['wtf'];
  4321. - if (wtf) {
  4322. - wtfTrace = wtf.trace;
  4323. - if (wtfTrace) {
  4324. - wtfEvents = wtfTrace.events;
  4325. - return true;
  4326. - }
  4327. - }
  4328. - return false;
  4329. - })();
  4330. - var WtfZoneSpec = /** @class */ (function () {
  4331. - function WtfZoneSpec() {
  4332. - this.name = 'WTF';
  4333. - }
  4334. - WtfZoneSpec.prototype.onFork = function (parentZoneDelegate, currentZone, targetZone, zoneSpec) {
  4335. - var retValue = parentZoneDelegate.fork(targetZone, zoneSpec);
  4336. - WtfZoneSpec.forkInstance(zonePathName(targetZone), retValue.name);
  4337. - return retValue;
  4338. - };
  4339. - WtfZoneSpec.prototype.onInvoke = function (parentZoneDelegate, currentZone, targetZone, delegate, applyThis, applyArgs, source) {
  4340. - var scope = WtfZoneSpec.invokeScope[source];
  4341. - if (!scope) {
  4342. - scope = WtfZoneSpec.invokeScope[source] =
  4343. - wtfEvents.createScope("Zone:invoke:" + source + "(ascii zone)");
  4344. - }
  4345. - return wtfTrace.leaveScope(scope(zonePathName(targetZone)), parentZoneDelegate.invoke(targetZone, delegate, applyThis, applyArgs, source));
  4346. - };
  4347. - WtfZoneSpec.prototype.onHandleError = function (parentZoneDelegate, currentZone, targetZone, error) {
  4348. - return parentZoneDelegate.handleError(targetZone, error);
  4349. - };
  4350. - WtfZoneSpec.prototype.onScheduleTask = function (parentZoneDelegate, currentZone, targetZone, task) {
  4351. - var key = task.type + ':' + task.source;
  4352. - var instance = WtfZoneSpec.scheduleInstance[key];
  4353. - if (!instance) {
  4354. - instance = WtfZoneSpec.scheduleInstance[key] =
  4355. - wtfEvents.createInstance("Zone:schedule:" + key + "(ascii zone, any data)");
  4356. - }
  4357. - var retValue = parentZoneDelegate.scheduleTask(targetZone, task);
  4358. - instance(zonePathName(targetZone), shallowObj(task.data, 2));
  4359. - return retValue;
  4360. - };
  4361. - WtfZoneSpec.prototype.onInvokeTask = function (parentZoneDelegate, currentZone, targetZone, task, applyThis, applyArgs) {
  4362. - var source = task.source;
  4363. - var scope = WtfZoneSpec.invokeTaskScope[source];
  4364. - if (!scope) {
  4365. - scope = WtfZoneSpec.invokeTaskScope[source] =
  4366. - wtfEvents.createScope("Zone:invokeTask:" + source + "(ascii zone)");
  4367. - }
  4368. - return wtfTrace.leaveScope(scope(zonePathName(targetZone)), parentZoneDelegate.invokeTask(targetZone, task, applyThis, applyArgs));
  4369. - };
  4370. - WtfZoneSpec.prototype.onCancelTask = function (parentZoneDelegate, currentZone, targetZone, task) {
  4371. - var key = task.source;
  4372. - var instance = WtfZoneSpec.cancelInstance[key];
  4373. - if (!instance) {
  4374. - instance = WtfZoneSpec.cancelInstance[key] =
  4375. - wtfEvents.createInstance("Zone:cancel:" + key + "(ascii zone, any options)");
  4376. - }
  4377. - var retValue = parentZoneDelegate.cancelTask(targetZone, task);
  4378. - instance(zonePathName(targetZone), shallowObj(task.data, 2));
  4379. - return retValue;
  4380. - };
  4381. - WtfZoneSpec.forkInstance = wtfEnabled && wtfEvents.createInstance('Zone:fork(ascii zone, ascii newZone)');
  4382. - WtfZoneSpec.scheduleInstance = {};
  4383. - WtfZoneSpec.cancelInstance = {};
  4384. - WtfZoneSpec.invokeScope = {};
  4385. - WtfZoneSpec.invokeTaskScope = {};
  4386. - return WtfZoneSpec;
  4387. - }());
  4388. - function shallowObj(obj, depth) {
  4389. - if (!depth)
  4390. - return null;
  4391. - var out = {};
  4392. - for (var key in obj) {
  4393. - if (obj.hasOwnProperty(key)) {
  4394. - var value = obj[key];
  4395. - switch (typeof value) {
  4396. - case 'object':
  4397. - var name_1 = value && value.constructor && value.constructor.name;
  4398. - value = name_1 == Object.name ? shallowObj(value, depth - 1) : name_1;
  4399. - break;
  4400. - case 'function':
  4401. - value = value.name || undefined;
  4402. - break;
  4403. - }
  4404. - out[key] = value;
  4405. - }
  4406. - }
  4407. - return out;
  4408. - }
  4409. - function zonePathName(zone) {
  4410. - var name = zone.name;
  4411. - zone = zone.parent;
  4412. - while (zone != null) {
  4413. - name = zone.name + '::' + name;
  4414. - zone = zone.parent;
  4415. - }
  4416. - return name;
  4417. - }
  4418. - Zone['wtfZoneSpec'] = !wtfEnabled ? null : new WtfZoneSpec();
  4419. -})(typeof window === 'object' && window || typeof self === 'object' && self || global);
  4420. -
  4421. -/**
  4422. - * @license
  4423. - * Copyright Google Inc. All Rights Reserved.
  4424. - *
  4425. - * Use of this source code is governed by an MIT-style license that can be
  4426. - * found in the LICENSE file at https://angular.io/license
  4427. - */
  4428. -(function (context) {
  4429. - var Mocha = context.Mocha;
  4430. - if (typeof Mocha === 'undefined') {
  4431. - throw new Error('Missing Mocha.js');
  4432. - }
  4433. - if (typeof Zone === 'undefined') {
  4434. - throw new Error('Missing Zone.js');
  4435. - }
  4436. - var ProxyZoneSpec = Zone['ProxyZoneSpec'];
  4437. - var SyncTestZoneSpec = Zone['SyncTestZoneSpec'];
  4438. - if (!ProxyZoneSpec) {
  4439. - throw new Error('Missing ProxyZoneSpec');
  4440. - }
  4441. - if (Mocha['__zone_patch__']) {
  4442. - throw new Error('"Mocha" has already been patched with "Zone".');
  4443. - }
  4444. - Mocha['__zone_patch__'] = true;
  4445. - var rootZone = Zone.current;
  4446. - var syncZone = rootZone.fork(new SyncTestZoneSpec('Mocha.describe'));
  4447. - var testZone = null;
  4448. - var suiteZone = rootZone.fork(new ProxyZoneSpec());
  4449. - var mochaOriginal = {
  4450. - after: Mocha.after,
  4451. - afterEach: Mocha.afterEach,
  4452. - before: Mocha.before,
  4453. - beforeEach: Mocha.beforeEach,
  4454. - describe: Mocha.describe,
  4455. - it: Mocha.it
  4456. - };
  4457. - function modifyArguments(args, syncTest, asyncTest) {
  4458. - var _loop_1 = function (i) {
  4459. - var arg = args[i];
  4460. - if (typeof arg === 'function') {
  4461. - // The `done` callback is only passed through if the function expects at
  4462. - // least one argument.
  4463. - // Note we have to make a function with correct number of arguments,
  4464. - // otherwise mocha will
  4465. - // think that all functions are sync or async.
  4466. - args[i] = (arg.length === 0) ? syncTest(arg) : asyncTest(arg);
  4467. - // Mocha uses toString to view the test body in the result list, make sure we return the
  4468. - // correct function body
  4469. - args[i].toString = function () {
  4470. - return arg.toString();
  4471. - };
  4472. - }
  4473. - };
  4474. - for (var i = 0; i < args.length; i++) {
  4475. - _loop_1(i);
  4476. - }
  4477. - return args;
  4478. - }
  4479. - function wrapDescribeInZone(args) {
  4480. - var syncTest = function (fn) {
  4481. - return function () {
  4482. - return syncZone.run(fn, this, arguments);
  4483. - };
  4484. - };
  4485. - return modifyArguments(args, syncTest);
  4486. - }
  4487. - function wrapTestInZone(args) {
  4488. - var asyncTest = function (fn) {
  4489. - return function (done) {
  4490. - return testZone.run(fn, this, [done]);
  4491. - };
  4492. - };
  4493. - var syncTest = function (fn) {
  4494. - return function () {
  4495. - return testZone.run(fn, this);
  4496. - };
  4497. - };
  4498. - return modifyArguments(args, syncTest, asyncTest);
  4499. - }
  4500. - function wrapSuiteInZone(args) {
  4501. - var asyncTest = function (fn) {
  4502. - return function (done) {
  4503. - return suiteZone.run(fn, this, [done]);
  4504. - };
  4505. - };
  4506. - var syncTest = function (fn) {
  4507. - return function () {
  4508. - return suiteZone.run(fn, this);
  4509. - };
  4510. - };
  4511. - return modifyArguments(args, syncTest, asyncTest);
  4512. - }
  4513. - context.describe = context.suite = Mocha.describe = function () {
  4514. - return mochaOriginal.describe.apply(this, wrapDescribeInZone(arguments));
  4515. - };
  4516. - context.xdescribe = context.suite.skip = Mocha.describe.skip = function () {
  4517. - return mochaOriginal.describe.skip.apply(this, wrapDescribeInZone(arguments));
  4518. - };
  4519. - context.describe.only = context.suite.only = Mocha.describe.only = function () {
  4520. - return mochaOriginal.describe.only.apply(this, wrapDescribeInZone(arguments));
  4521. - };
  4522. - context.it = context.specify = context.test = Mocha.it = function () {
  4523. - return mochaOriginal.it.apply(this, wrapTestInZone(arguments));
  4524. - };
  4525. - context.xit = context.xspecify = Mocha.it.skip = function () {
  4526. - return mochaOriginal.it.skip.apply(this, wrapTestInZone(arguments));
  4527. - };
  4528. - context.it.only = context.test.only = Mocha.it.only = function () {
  4529. - return mochaOriginal.it.only.apply(this, wrapTestInZone(arguments));
  4530. - };
  4531. - context.after = context.suiteTeardown = Mocha.after = function () {
  4532. - return mochaOriginal.after.apply(this, wrapSuiteInZone(arguments));
  4533. - };
  4534. - context.afterEach = context.teardown = Mocha.afterEach = function () {
  4535. - return mochaOriginal.afterEach.apply(this, wrapTestInZone(arguments));
  4536. - };
  4537. - context.before = context.suiteSetup = Mocha.before = function () {
  4538. - return mochaOriginal.before.apply(this, wrapSuiteInZone(arguments));
  4539. - };
  4540. - context.beforeEach = context.setup = Mocha.beforeEach = function () {
  4541. - return mochaOriginal.beforeEach.apply(this, wrapTestInZone(arguments));
  4542. - };
  4543. - (function (originalRunTest, originalRun) {
  4544. - Mocha.Runner.prototype.runTest = function (fn) {
  4545. - var _this = this;
  4546. - Zone.current.scheduleMicroTask('mocha.forceTask', function () {
  4547. - originalRunTest.call(_this, fn);
  4548. - });
  4549. - };
  4550. - Mocha.Runner.prototype.run = function (fn) {
  4551. - this.on('test', function (e) {
  4552. - testZone = rootZone.fork(new ProxyZoneSpec());
  4553. - });
  4554. - this.on('fail', function (test, err) {
  4555. - var proxyZoneSpec = testZone && testZone.get('ProxyZoneSpec');
  4556. - if (proxyZoneSpec && err) {
  4557. - err.message += proxyZoneSpec.getAndClearPendingTasksInfo();
  4558. - }
  4559. - });
  4560. - return originalRun.call(this, fn);
  4561. - };
  4562. - })(Mocha.Runner.prototype.runTest, Mocha.Runner.prototype.run);
  4563. -})(typeof window !== 'undefined' && window || typeof self !== 'undefined' && self || global);
  4564. -
  4565. -})));
  4566. diff --git a/node_modules/@nativescript/zone-js/zone-nativescript.js b/node_modules/@nativescript/zone-js/zone-nativescript.js
  4567. index 39a5b55..8178344 100644
  4568. --- a/node_modules/@nativescript/zone-js/zone-nativescript.js
  4569. +++ b/node_modules/@nativescript/zone-js/zone-nativescript.js
  4570. @@ -5,6 +5,8 @@
  4571. * Use of this source code is governed by an MIT-style license that can be
  4572. * found in the LICENSE file at https://angular.io/license
  4573. */
  4574. +import * as trace from '@nativescript/core/trace';
  4575. +
  4576. (function (global, factory) {
  4577. typeof exports === 'object' && typeof module !== 'undefined' ? factory() :
  4578. typeof define === 'function' && define.amd ? define(factory) :
  4579. @@ -673,9 +675,11 @@ Zone.__load_patch('ZoneAwarePromise', function (global, Zone, api) {
  4580. if (api.showUncaughtError()) {
  4581. var rejection = e && e.rejection;
  4582. if (rejection) {
  4583. + trace.Trace.error(rejection);
  4584. console.error('Unhandled Promise rejection:', rejection instanceof Error ? rejection.message : rejection, '; Zone:', e.zone.name, '; Task:', e.task && e.task.source, '; Value:', rejection, rejection instanceof Error ? rejection.stack : undefined);
  4585. }
  4586. else {
  4587. + trace.Trace.error(e);
  4588. console.error(e);
  4589. }
  4590. }
  4591. @@ -706,8 +710,10 @@ Zone.__load_patch('ZoneAwarePromise', function (global, Zone, api) {
  4592. if (handler && typeof handler === 'function') {
  4593. handler.call(this, e);
  4594. }
  4595. + trace.Trace.error(e);
  4596. }
  4597. catch (err) {
  4598. + trace.Trace.error(err);
  4599. }
  4600. }
  4601. function isThenable(value) {
  4602. @@ -855,6 +861,7 @@ Zone.__load_patch('ZoneAwarePromise', function (global, Zone, api) {
  4603. }
  4604. }
  4605. catch (err) {
  4606. + trace.Trace.error(err);
  4607. }
  4608. promise[symbolState] = REJECTED;
  4609. for (var i = 0; i < _uncaughtPromiseErrors.length; i++) {
  4610. @@ -1337,6 +1344,7 @@ Zone.__load_patch('Error', function (global, Zone, api) {
  4611. }
  4612. catch (e) {
  4613. // ignore as some browsers don't allow overriding of stack
  4614. + trace.Trace.error(e);
  4615. }
  4616. }
  4617. if (this instanceof NativeError && this.constructor != NativeError) {
  4618. @@ -1350,6 +1358,7 @@ Zone.__load_patch('Error', function (global, Zone, api) {
  4619. }
  4620. catch (e) {
  4621. // ignore the assignment in case it is a setter and it throws.
  4622. + trace.Trace.error(e);
  4623. }
  4624. }
  4625. });
  4626.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement