[Bug 25081] Make read operation really async

https://www.w3.org/Bugs/Public/show_bug.cgi?id=25081

--- Comment #11 from Arun <arun@mozilla.com> ---
(In reply to Jonas Sicking from comment #10)
> I don't think we need keepalives and the like. It's easier to simply define
> that a lot of these APIs clones (by calling blob.slice()) the Blob that is
> passed to them.
> 
> So calling `myFormData.append("foo", myblob)` would make the myFormData
> object call myblob.slice() before returning from .append. When myFormData is
> submitted it wouldn't matter if myblob has been closed or not.
> 
> Same thing when xhr.send(myblob) is called. Before .send() returns it would
> call myblob.slice() and hold a reference to the returned object.
> 
> This should generally avoid racy behavior. Though it does have the downside
> that it's somewhat harder to make sure that the data backing the blob goes
> away *right now* since there are more clones floating around.
> 
> However it has the upside that if you want to use a blob and free the
> resources backing the blob as soon as you're done using it, you can do
> 
> `useBlob(myblob); myblob.close();`
> 
> rather than
> 
> `x = useBlob(myblob); x.registerDoneHandler(() => myblob.close());`
> 
> I think the latter is more error prone given that it puts more distance
> between when the blob is used and when its closed in application code. So
> it's more likely that bugs, error conditions or other edge cases will make
> the application not close the blob.
> 
> 
> So, in short, I think we can get rid of the keepalive counter and instead
> simply use Blob.slice() which gives us the semantics that we want.


Do you explicitly mean for it to be a slice or a structured clone?

-- 
You are receiving this mail because:
You are the QA Contact for the bug.

Received on Tuesday, 15 April 2014 03:36:01 UTC