Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xdomain breaking prototype chain of XMLHttpRequest #207

Open
instantaphex opened this issue Dec 6, 2017 · 2 comments
Open

xdomain breaking prototype chain of XMLHttpRequest #207

instantaphex opened this issue Dec 6, 2017 · 2 comments

Comments

@instantaphex
Copy link

I'm not sure if this project is still alive but, it seems to be breaking the latest zone.js which is a dependency of Angular. Zone.js has a few checks that happen when patching XMLHttpRequest that check for property descriptors on XMLHttpRequest.prototype. These are failing. Zone.js patches most of the async host api's which include XMLHttpRequestEventTarget. The problem is that xdomain creates a prototype chain that looks like this:

XMLHttpRequest -> f() -> Function

When not using xdomain the prototype chain looks like this

XMLHttpRequest -> XMLHttpRequestEventTarget -> EventTarget -> Function -> Object

Zone.js is checking the XMLHttpRequestObject like this

Object.getOwnPropertyDescriptor(XMLHttpRequest.prototype, 'onreadystatechange');

and that returns some anonymous function (probably xdomains monkey patched function which delegates to some xdomain code first). The end result is that zone.js doesn't patch what it needs to patch and my app breaks.

Now I know that this library isn't responsible for the way in which zone.js decides to hack up browser apis, but if xdomain isn't compatible with Angular, that is a pretty big issue.

It looks like it might be the way you are attaching properties that normally belong to XMLHttpRequestEventTarget directly onto the patched xhr object. Any thoughts?

@zzJinux
Copy link

zzJinux commented Jul 3, 2018

It's been 7 months, still in no response...
I'm trying to test the Angular frontend on local machine, with the backend on remote. I really need the compatibility with zone.js, since the test must be run on IE9, which is CORS-unfriendly (unlike iE10+).
Without the support of xdomain, the only way is to deploy a duplicate backend on local, and it's not desirable...

@mkontula
Copy link

Also seeing this issue with Angular 7. Should we consider xdomain a dead project? @jpillora?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants