Commit Graph

21 Commits

Author SHA1 Message Date
JiaLiPassion 27358eb60f feat(zone.js): monkey patches queueMicrotask() (#38904)
Close #38863

Monkey patches `queueMicrotask()` API, so the callback runs in the zone
when scheduled, and also the task is run as `microTask`.

```
Zone.current.fork({
  name: 'queueMicrotask',
  onScheduleTask: (delegate: ZoneDelegate, curr: Zone, target: Zone, task: Task) => {
    logs.push(task.type);
    logs.push(task.source);
    return delegate.scheduleTask(target, task);
  }
}).run(() => {
    queueMicrotask(() => {
      expect(logs).toEqual(['microTask', 'queueMicrotask']);
      expect(Zone.current.name).toEqual('queueMicrotask');
      done();
  });
});

```

PR Close #38904
2020-11-05 11:23:33 -08:00
Andrew Kushnir 118f37b174 test(zone.js): do not run tests on IE 9 and IE 10 (#39189)
Since IE 9 and IE 10 were deprecated and support is removed in v11, this commit updates ZoneJs
configs to avoid running tests in these browsers.

PR Close #39189
2020-10-12 08:27:25 -07:00
Joey Perrott 75610505c6 refactor(zone.js): remove usages of blacklist related to UNPATCHED_EVENTS (#38930)
Remove usages of blacklist around UNPATCHED_EVENTS configuration

PR Close #38930
2020-09-22 15:05:01 -07:00
JiaLiPassion d92a0dd72f fix(zone.js): should invoke xhr send task when no response error occurs (#38836)
Close #38795

in the XMLHttpRequest patch, when get `readystatechange` event, zone.js try to
invoke `load` event listener first, then call `invokeTask` to finish the
`XMLHttpRequest::send` macroTask, but if the request failed because the
server can not be reached, the `load` event listener will not be invoked,
so the `invokeTask` of the `XMLHttpRequest::send` will not be triggered either,
so we will have a non finished macroTask there which will make the Zone
not stable, also memory leak.

So in this PR, if the `XMLHttpRequest.status = 0` when we get the `readystatechange`
event, that means something wents wrong before we reached the server, we need to
invoke the task to finish the macroTask.

PR Close #38836
2020-09-18 11:19:37 -07:00
Joey Perrott d1ea1f4c7f build: update license headers to reference Google LLC (#37205)
Update the license headers throughout the repository to reference Google LLC
rather than Google Inc, for the required license headers.

PR Close #37205
2020-05-26 14:26:58 -04:00
Joey Perrott 698b0288be build: reformat repo to new clang@1.4.0 (#36613)
PR Close #36613
2020-04-14 12:08:36 -07:00
JiaLiPassion 54634628ac fix(zone.js): Make `EventTarget` methods optional in `zone.js` extension API (#35954)
`zone.js` added `removeAllListeners` and `eventListeners` methods in `EventTarget.prototype`, but those methods only exists when user import `zone.js` and also enables `EventTarget` monkey patching.

If user:
1. Does not import `zone.js` and uses `noop` zone when bootstrapping Angular app. OR
2. Disable monkey patching of `EventTarget` patch by defining `__Zone_disable_EventTarget = true`.

Then `removeAllListeners` and `eventListeners`  methods will not be present.

PR Close #35954
2020-03-16 09:00:44 -07:00
JiaLiPassion 0f8e710c7c feat(zone.js): Monkey patch MessagePort.prototype onproperties (#34610)
Monkey patch `MessagePort.prototype.onmessage` and `MessagePort.prototype.onmessageerror` to make
these properties's value(callback function) run in the zone when these value are set.

PR Close #34610
2020-03-16 08:59:38 -07:00
Andrew Kushnir 71309d223d Revert "feat: Monkey patches MessagePort onproperties (onmessage/onmessageerror) (#34610)" (#35973)
This reverts commit 1882451ec0.

Reason: breaks some g3 targets.

PR Close #35973
2020-03-09 17:31:28 -04:00
JiaLiPassion 1882451ec0 feat: Monkey patches MessagePort onproperties (onmessage/onmessageerror) (#34610)
Close #34581

PR Close #34610
2020-03-09 12:20:46 -04:00
JiaLiPassion 8ef29b65ff fix: fix flaky test cases of passive events (#35679)
PR Close #35679
2020-03-05 15:56:53 -05:00
JiaLiPassion 4acb676f2e feat: add interface definitions which zone extends EventTarget (#35304)
Close #35173

PR Close #35304
2020-02-26 12:52:08 -08:00
JiaLiPassion f9d483e76e feat: add a temp solution to support passive event listeners. (#34503)
Now Angular doesn't support add event listeners as passive very easily.
User needs to use `elem.addEventListener('scroll', listener, {passive: true});`
or implements their own EventManagerPlugin to do that.
Angular may finally support new template syntax to support passive event, for now,
this commit introduces a temp solution to allow user to define the passive event names
in zone.js configurations.

User can define a global varibale like this.

```
(window as any)['__zone_symbol__PASSIVE_EVENTS'] = ['scroll'];
```

to let all `scroll` event listeners passive.

PR Close #34503
2020-02-24 17:30:04 -08:00
Miško Hevery e084835fb1 Revert "feat: support passive event options by defining global variables in zone.js config file (#34503)"
This reverts commit d7d359e3ee.
2020-02-21 22:16:34 +00:00
JiaLiPassion d7d359e3ee feat: support passive event options by defining global variables in zone.js config file (#34503)
PR Close #34503
2020-02-21 09:06:26 -08:00
JiaLiPassion 2c402d5c99 fix(zone.js): handle MSPointer event correctly (#31722)
Close #31699

PR Close #31722
2019-07-24 14:42:49 -07:00
JiaLiPassion 35a025fbca fix(zone.js): patch shadydom (#31717)
Close #31686

PR Close #31717
2019-07-24 14:42:14 -07:00
JiaLiPassion 716af1059c fix(zone.js): move property patch to legacy (#31660)
Close #31659

PR Close #31660
2019-07-24 14:36:43 -07:00
JiaLiPassion a182714703 fix(zone.js): should remove on symbol property after removeAllListeners (#31644)
Close #31643

PR Close #31644
2019-07-24 14:35:37 -07:00
George Kalpakas 3851544674 style: fix code style in several files (#31295)
These files have not been formatted properly, due to issues in the
`gulp format*` tasks. See previous commits (or #31295) for more details.

PR Close #31295
2019-06-26 13:29:29 -07:00
JiaLiPassion 5eb7426216 build: move zone.js to angular repo (#30962)
PR Close #30962
2019-06-20 11:27:39 -07:00