Re: [whatwg/xhr] Allow developers to opt-out of sync XHR with feature policy (#178)

Other modern platforms [like Android](https://developer.android.com/reference/android/os/NetworkOnMainThreadException.html) prohibit all synchronous network operations on the UI thread.  Timeouts are hard to reason about (could mean your site works fine in testing, but not in deployment in countries with slower internet).  The right solution is definitely to follow platforms like Android and just phase in a plan to require the use of either [async APIs](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/Synchronous_and_Asynchronous_Requests) or workers for all network APIs.  Recent improvements to JavaScript (like [async/await](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function)) make asynchronous programming NEARLY as easy to do as synchronous programming, so IMHO the "synchronous is easier" really isn't a compelling argument.

BTW, you can better experience the potential user impact of relying on sync XHR by using [DevTools network throttling](https://developers.google.com/web/tools/chrome-devtools/network-performance/network-conditions) with a very high latency - say 2000ms (not entirely unrealistic in many environments where Chrome is popular).

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/xhr/issues/178#issuecomment-358026409

Received on Tuesday, 16 January 2018 16:49:15 UTC