Skip to content

Commit

Permalink
Revert "fix(zone.js): enable monkey patching of the `queueMicrotask()…
Browse files Browse the repository at this point in the history
…` API in node.js (#50467)" (#50529)

This reverts commit 381cb98.

PR Close #50529
  • Loading branch information
thePunderWoman authored and dylhunn committed May 31, 2023
1 parent 069498c commit 7567348
Show file tree
Hide file tree
Showing 11 changed files with 12 additions and 27 deletions.
1 change: 0 additions & 1 deletion packages/zone.js/karma-build.conf.js
Expand Up @@ -13,6 +13,5 @@ module.exports = function(config) {
config.files.push('build/test/test_fake_polyfill.js');
config.files.push('build/lib/zone.js');
config.files.push('build/lib/common/promise.js');
config.files.push('build/lib/common/queue-microtask.js');
config.files.push('build/test/main.js');
};
9 changes: 9 additions & 0 deletions packages/zone.js/lib/browser/browser.ts
Expand Up @@ -25,6 +25,15 @@ Zone.__load_patch('legacy', (global: any) => {
}
});

Zone.__load_patch('queueMicrotask', (global: any, Zone: ZoneType, api: _ZonePrivate) => {
api.patchMethod(global, 'queueMicrotask', delegate => {
return function(self: any, args: any[]) {
Zone.current.scheduleMicroTask('queueMicrotask', args[0]);
}
});
});


Zone.__load_patch('timers', (global: any) => {
const set = 'set';
const clear = 'clear';
Expand Down
1 change: 0 additions & 1 deletion packages/zone.js/lib/browser/rollup-common.ts
Expand Up @@ -10,4 +10,3 @@ import '../zone';
import '../common/promise';
import '../common/to-string';
import './api-util';
import '../common/queue-microtask';
19 changes: 0 additions & 19 deletions packages/zone.js/lib/common/queue-microtask.ts

This file was deleted.

1 change: 0 additions & 1 deletion packages/zone.js/lib/node/node.ts
Expand Up @@ -9,7 +9,6 @@
import './node_util';
import './events';
import './fs';
import '../common/queue-microtask';

import {findEventTasks} from '../common/events';
import {patchTimer} from '../common/timers';
Expand Down
4 changes: 2 additions & 2 deletions packages/zone.js/lib/zone.configurations.api.ts
Expand Up @@ -296,9 +296,9 @@ interface ZoneGlobalConfigurations {

/**
*
* Disable the monkey patching of the `queueMicrotask()` API.
* Disable the monkey patching of the browser's `queueMicrotask()` API.
*
* By default, `zone.js` monkey patches the `queueMicrotask()` API
* By default, `zone.js` monkey patches the browser's `queueMicrotask()` API
* to ensure that `queueMicrotask()` callback is invoked in the same zone as zone used to invoke
* `queueMicrotask()`. And also the callback is running as `microTask` like
* `Promise.prototype.then()`.
Expand Down
1 change: 0 additions & 1 deletion packages/zone.js/test/browser-zone-setup.ts
Expand Up @@ -11,7 +11,6 @@ if (typeof window !== 'undefined') {
(window as any)[zoneSymbol('fakeAsyncAutoFakeAsyncWhenClockPatched')] = true;
}
import '../lib/common/to-string';
import '../lib/common/queue-microtask';
import '../lib/browser/api-util';
import '../lib/browser/browser-legacy';
import '../lib/browser/browser';
Expand Down
1 change: 1 addition & 0 deletions packages/zone.js/test/browser_entry_point.ts
Expand Up @@ -28,3 +28,4 @@ import './mocha-patch.spec';
import './jasmine-patch.spec';
import './browser/messageport.spec';
import './extra/cordova.spec';
import './browser/queue-microtask.spec';
1 change: 0 additions & 1 deletion packages/zone.js/test/common_tests.ts
Expand Up @@ -11,7 +11,6 @@ import './common/zone.spec';
import './common/task.spec';
import './common/util.spec';
import './common/Promise.spec';
import './common/queue-microtask.spec';
import './common/fetch.spec';
import './common/Error.spec';
import './common/setInterval.spec';
Expand Down
1 change: 0 additions & 1 deletion packages/zone.js/test/node_error_entry_point.init.ts
Expand Up @@ -11,7 +11,6 @@ import './test_fake_polyfill';
// Setup tests for Zone without microtask support
import '../lib/zone';
import '../lib/common/promise';
import '../lib/common/queue-microtask';
import '../lib/common/to-string';
import './test-env-setup-jasmine';
import './wtf_mock';
Expand Down

0 comments on commit 7567348

Please sign in to comment.