jpillora / xdomain

A pure JavaScript CORS alternative
https://jpillora.com/xdomain/
3.12k stars 270 forks source link

Problem with events #101

Closed vomchik closed 9 years ago

vomchik commented 10 years ago

Hi. Event property target always null. I expected link to instance of XMLHttpRequest.

I use weinre tool for remote debugging my mobile app.

And theirs js script contains next code:

        _xhrEventHandler = function(event) {
            var xhr;
            xhr = event.target;
            if (xhr.readyState !== 4) {
                return;
            }
            return xhr.httpSocketHandler.call(xhr.httpSocket, xhr);
        };
jpillora commented 10 years ago

XHook's clone event code should do this, though it seems there's a bug

jpillora commented 10 years ago

Looking into this, so there was a previous bug where people needed an instance of an Event instead of an object with all the properties copied. That was fixed, though this now means that target is readonly. Which now breaks this functionality.

Can weinre be hacked to not use event.target? Chromes mobile emulation is quite good, have you looked into that?

jpillora commented 9 years ago

closing as wont fix since it seems the only way is to revert to non-Event objects