Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

fix bug add event listener to xhrhttprequest multiple times #527

Closed
wants to merge 29 commits into from

Conversation

JiaLiPassion
Copy link
Collaborator

in issue #287, the xhrhttprequest add documentreadychange eventlistener multipletimes (https://github.com/angular/zone.js/blob/master/lib/browser/browser.ts#L66), so when task finished, updateTaskCount will cause "More tasks executed then were scheduled" error. The issue
can be simplified as the following test case.

 Zone.current.fork({name:'test'}).run(function() {
      var req = new XMLHttpRequest();
      req.open('get', '/', true);
      req.send();
      req.onloadend = function() {
        req.open('get', '/', true);
        req.send();
      }

So we should removeEventlistener before add new one.

# Conflicts:
#	dist/long-stack-trace-zone.js
#	dist/long-stack-trace-zone.min.js
#	lib/zone-spec/long-stack-trace.ts
#	test/zone-spec/long-stack-trace-zone.spec.ts
…array.

add test cases for prepend listener and once.
JiaLiPassion added a commit to JiaLiPassion/zone.js that referenced this pull request Dec 6, 2016
JiaLiPassion added a commit to JiaLiPassion/zone.js that referenced this pull request Dec 6, 2016
JiaLiPassion added a commit to JiaLiPassion/zone.js that referenced this pull request Dec 6, 2016
mhevery pushed a commit that referenced this pull request Dec 18, 2016
* fix bug add event listener to xhrhttprequest multiple times and invalid request call (#529)
* fix bug add event listener to xhrhttprequest multiple times #527
* fix #287 with a better solution to prevent memory leak
* fix #530 for xhr request to an invalid url cause Schedule task count failed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants