(#3885) - Service worker & fetch() fixes#3885
Conversation
|
Looks good to me; kinda surprised that @KlausTrainer didn't run into this too though? |
|
@nolanlawson Probably because these changes are only necessary to make PouchDB talk to a remote (http) database using |
lib/deps/request-browser.js
Outdated
There was a problem hiding this comment.
The comment is misleading, and contradicts itself with regard to the code below. Also, it changes the behaviour so that the fetch fallback is used if XMLHttpRequest is present, but of type 'object' instead of type 'function', which is probably not what we want.
There was a problem hiding this comment.
If XMLHttpRequest is an 'object', you can't do new XMLHttpRequest() (that's a TypeError: object is not a function). That happened in Chromium 41 inside a service worker, so I decided to check for 'function' instead.
The comment was written with the 'old' situation in mind, not the new one. I agree it's confusing. It's probably best to just remove the comment completely. Does that work for you, @KlausTrainer?
There was a problem hiding this comment.
Ah, ok. Well, I agree then that it would be best to just remove the comment :)
|
@KlausTrainer That's indeed one issue that's fixed, but it's not the only one. Returning an object with a |
|
Ah, thanks. Just saw the equivalent part in the |
|
@marten-de-vries Looks good to me. Also I like the |
|
Failures seem genuine, particularly in PhantomJS and Safari. Might be some old Webkit bug here that we're not accounting for. |
|
Suggestion: can we use |
|
UGH if we do that, though, then our |
|
OK how about this: #3890. |
Changes I needed while writing https://gist.github.com/marten-de-vries/3bfaf635f9efdbcf5102
8bed141 to
241709e
Compare
|
@nolanlawson Looks good, I just merged that into this PR & squashed. |
Changes I needed while writing https://gist.github.com/marten-de-vries/3bfaf635f9efdbcf5102
|
👍, 2914285 |

Changes I needed while writing
https://gist.github.com/marten-de-vries/3bfaf635f9efdbcf5102