angular-docs-cn/packages/zone.js/test/rxjs
JiaLiPassion 96aa14df01 fix(zone.js): zone patch rxjs should return null _unsubscribe correctly. (#37091)
Close #31684.

In some rxjs operator, such as `retryWhen`, rxjs internally will set
`Subscription._unsubscribe` method to null, and the current zone.js monkey patch
didn't handle this case correctly, even rxjs set _unsubscribe to null, zone.js
still return a function by finding the prototype chain.

This PR fix this issue and the following test will pass.

```
const errorGenerator = () => {
  return throwError(new Error('error emit'));
};

const genericRetryStrategy = (finalizer: () => void) => (attempts: Observable<any>) =>
    attempts.pipe(
      mergeMap((error, i) => {
        const retryAttempt = i + 1;
        if (retryAttempt > 3) {
          return throwError(error);
        }
        return timer(retryAttempt * 1);
      }),
      finalize(() => finalizer()));

errorGenerator()
  .pipe(
    retryWhen(genericRetryStrategy(() => {
      expect(log.length).toBe(3);
      done();
    })),
    catchError(error => of(error)))
  .subscribe()
```

PR Close #37091
2020-07-27 12:10:27 -07:00
..
rxjs.Observable.audit.spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
rxjs.Observable.buffer.spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
rxjs.Observable.catch.spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
rxjs.Observable.collection.spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
rxjs.Observable.combine.spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
rxjs.Observable.concat.spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
rxjs.Observable.count.spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
rxjs.Observable.debounce.spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
rxjs.Observable.default.spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
rxjs.Observable.delay.spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
rxjs.Observable.distinct.spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
rxjs.Observable.do.spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
rxjs.Observable.map.spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
rxjs.Observable.merge.spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
rxjs.Observable.multicast.spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
rxjs.Observable.notification.spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
rxjs.Observable.race.spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
rxjs.Observable.retry.spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
rxjs.Observable.sample.spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
rxjs.Observable.take.spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
rxjs.Observable.timeout.spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
rxjs.Observable.window.spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
rxjs.asap.spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
rxjs.bindCallback.spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
rxjs.bindNodeCallback.spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
rxjs.combineLatest.spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
rxjs.common.spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
rxjs.concat.spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
rxjs.defer.spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
rxjs.empty.spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
rxjs.forkjoin.spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
rxjs.from.spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
rxjs.fromEvent.spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
rxjs.fromPromise.spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
rxjs.interval.spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
rxjs.merge.spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
rxjs.never.spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
rxjs.of.spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
rxjs.range.spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
rxjs.retry.spec.ts fix(zone.js): zone patch rxjs should return null _unsubscribe correctly. (#37091) 2020-07-27 12:10:27 -07:00
rxjs.spec.ts fix(zone.js): zone patch rxjs should return null _unsubscribe correctly. (#37091) 2020-07-27 12:10:27 -07:00
rxjs.throw.spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
rxjs.timer.spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
rxjs.util.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
rxjs.zip.spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00