Comments (9)
Thanks, Blink's behavior now follows suit.
from xhr.
So return null and then keep returning null thereafter? As in, once you fail to get the data, you're never going to get it, even if you free up some memory?
It does have the benefit of consistency....
from xhr.
Oh, and I guess the spec actually defines the lazy allocation behavior inside the response
getter that Gecko has, so at least that part will be consistent...
from xhr.
Yeah, once you fail to get the data you won't get it unless you fetch it again and get lucky.
from xhr.
That's what happens for fetch()
too since it effectively tries to consume the stream and then create the ArrayBuffer
with the result. If you cannot create the ArrayBuffer
, you cannot really unconsume the stream either (not that that even makes sense).
from xhr.
Currently, Chrome crashes when it fails to allocate an ArrayBuffer as it wasn't specified to throw an exception in the spec at the time we decided how to handle the case.
Unless there'll be any confusion, returning null should be fine. What's the reliable way to distinguish alloc failure and other errors (network error)? Saw "load" being dispatched, but seeing null on response?
+1 to Boris regarding consistency.
from xhr.
@tyoshino, yeah, I guess that would be the way they get distinguished indeed.
from xhr.
If allocation of the underlying buffer fails, https://xhr.spec.whatwg.org/#arraybuffer-response tells us to return a null
response object, along with resetting 'received bytes' to empty. Doesn't that imply that the next property access of response
will return an empty array buffer, and not null
- is that intentional?
(This came up via https://codereview.chromium.org/2730943002/ )
from xhr.
Yeah that is broken. Proposal: response object can be an object, failure, or null and we update all the places that use it accordingly. I don't think we can get away with not using some extra state somehow.
from xhr.
Related Issues (20)
- Expose ProgressEvent to ServiceWorker HOT 14
- Handle error while reading response body in synchronous XHR HOT 1
- Reference primitive for "If one or more event listeners are registered"
- Spec requires firing at least two "progress" events; browsers do not. HOT 1
- features request:add SynXMLHttpRequest for Avoid Callback Hell Programming HOT 1
- Why do we need to remove synchronous XHR? HOT 2
- link error breaking deploys HOT 2
- Allow to send body within GET http requests HOT 1
- Aborted flag check in "handle errors" HOT 2
- interop: blob with empty content type is not converted to text/xml HOT 3
- Wrong upload progress when network interrupts HOT 3
- xmlhttprequest.responseText occasionally appears Chinese garbled characters HOT 1
- XHR: how can I read request headers? HOT 1
- Need Discussion of 'why' Behind Deprecation of sync xhr HOT 2
- Wrong algorithm + missing realm argument when creating ArrayBuffer
- Ambiguous definition/initial values of network error HOT 3
- Use HTML's parse a URL HOT 2
- FormData & submitter[formaction] HOT 6
- `FormData`: Accept `object` form in constructor HOT 1
- Clarify if `ProgressEvent.loaded` should indicate the size of compress, or uncompressed, data HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xhr.