angular-docs-cn/packages/zone.js/test/browser
JiaLiPassion c3614662cb test(zone.js): should invoke XHR task even onload handler throw error. (#41562)
Close #41520.

This case related to the issue #41522.

```
Zone.root
  .fork({
    name: 'xhr',
    onHasTask(delegate, currentZone, zone, taskState) {
      console.log('hasMacrotask', taskState.macroTask);
      return delegate.hasTask(zone, taskState);
    },
  })
  .run(() => {
    const xhr = new XMLHttpRequest();
    xhr.open('GET', 'https://cdnjs.cloudflare.com/ajax/libs/zone.js/0.11.4/zone.min.js');
    xhr.addEventListener('load', () => {
      throw new Error();
    });
    xhr.send();
  });
```

zone.js invoke all `onload` event handlers before change the XHR task's state from
`scheduled` to `notscheduled`, so if any `onload` listener throw error, the XHR task
wlll be hang to `scheduled`, and leave the macroTask status in the zone wrongly.

This has been fixed in the previous commit, this commit add test to verify the case.

PR Close #41562
2021-04-21 15:54:08 -07:00
..
FileReader.spec.ts feat(core): support TypeScript 4.2 (#41158) 2021-03-17 09:10:25 -07:00
HTMLImports.spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
MediaQuery.spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
MutationObserver.spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
Notification.spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
WebSocket.spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
Worker.spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
XMLHttpRequest.spec.ts test(zone.js): should invoke XHR task even onload handler throw error. (#41562) 2021-04-21 15:54:08 -07:00
browser.spec.ts test(zone.js): should invoke XHR task even onload handler throw error. (#41562) 2021-04-21 15:54:08 -07:00
custom-element.spec.js build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
define-property.spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
element.spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
geolocation.spec.manual.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
messageport.spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
queue-microtask.spec.ts feat(zone.js): monkey patches queueMicrotask() (#38904) 2020-11-05 11:23:33 -08:00
registerElement.spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
requestAnimationFrame.spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
shadydom.spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00