lexandera / Aardwolf

A remote JavaScript debugger for Android/iOS/WindowsPhone7/BlackBerry6. Written in JavaScript.
http://lexandera.com/aardwolf/
MIT License
320 stars 39 forks source link

Breakpoint request timeout exception #19

Open jkrehm opened 10 years ago

jkrehm commented 10 years ago

On OSX 10.9 with both Chrome and Firefox I received an error when attempt to set XMLHttpRequest's timeout was made. The specific code is in aardwolf.js around line 71:

if (path === '/breakpoint') {
    req.timeout = 0;
}

When I comment out the req.timeout = 0; is works correctly. I haven't tried other OS's or browsers.

chyingp commented 10 years ago

@jkrehm I encountered the same problem too. On Macx10.9.3, chrome 37.0.2062.94

hzxiaosheng commented 9 years ago

yes , I also take @jkrehm 's way to solve the same problem.

            var req = new XMLHttpRequest();
            req.open('POST', serverUrl + '/mobile' + path, false);
            req.setRequestHeader('Content-Type', 'application/json');
            if (path === '/breakpoint') {
                /* comment out the following line of code will avoid this error: 
                    Failed to set the 'timeout' property on 'XMLHttpRequest':
                    Timeouts cannot be set for synchronous requests made from a document.

                    @note from [MDN](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest):
                     The number of milliseconds a request can take before automatically being terminated.
                     A value of 0 (which is the default) means there is no timeout.
                    Note: You may not use a timeout for synchronous requests with an owning window.
                */
                // req.timeout = 0;
            }