diff --git a/src/helpers/promise.js b/src/helpers/promise.js index b0f98f0ae..c1cb2d470 100644 --- a/src/helpers/promise.js +++ b/src/helpers/promise.js @@ -653,16 +653,8 @@ export function newScope (fn, props, a1, a2) { psd.global = false; psd.id = ++zone_id_counter; // Prepare for promise patching (done in usePSD): - var globalEnv = globalPSD.env; psd.env = patchGlobalPromise ? { - Promise: DexiePromise, // Changing window.Promise could be omitted for Chrome and Edge, where IDB+Promise plays well! PromiseProp: {value: DexiePromise, configurable: true, writable: true}, - all: DexiePromise.all, - race: DexiePromise.race, - allSettled: DexiePromise.allSettled, - any: DexiePromise.any, - resolve: DexiePromise.resolve, - reject: DexiePromise.reject, } : {}; if (props) extend(psd, props); @@ -752,8 +744,6 @@ function switchToZone (targetZone, bEnteringZone) { if (currentZone === globalPSD) globalPSD.env = snapShot(); if (patchGlobalPromise) { - // Let's patch the global and native Promises (may be same or may be different) - var GlobalPromise = globalPSD.env.Promise; // Swich environments (may be PSD-zone or the global zone. Both apply.) var targetEnv = targetZone.env; @@ -762,30 +752,13 @@ function switchToZone (targetZone, bEnteringZone) { // Set this Promise to window.Promise so that transiled async functions will work on Firefox, Safari and IE, as well as with Zonejs and angular. Object.defineProperty(_global, 'Promise', targetEnv.PromiseProp); - - // Support Promise.all() etc to work indexedDB-safe also when people are including es6-promise as a module (they might - // not be accessing global.Promise but a local reference to it) - GlobalPromise.all = targetEnv.all; - GlobalPromise.race = targetEnv.race; - GlobalPromise.resolve = targetEnv.resolve; - GlobalPromise.reject = targetEnv.reject; - if (targetEnv.allSettled) GlobalPromise.allSettled = targetEnv.allSettled; - if (targetEnv.any) GlobalPromise.any = targetEnv.any; } } } function snapShot () { - var GlobalPromise = _global.Promise; return patchGlobalPromise ? { - Promise: GlobalPromise, PromiseProp: Object.getOwnPropertyDescriptor(_global, "Promise"), - all: GlobalPromise.all, - race: GlobalPromise.race, - allSettled: GlobalPromise.allSettled, - any: GlobalPromise.any, - resolve: GlobalPromise.resolve, - reject: GlobalPromise.reject, } : {}; }