[Bug 28496] New: Allow Blob constructor to take ownership of ArrayBuffer(View) / invoke DetachArrayBuffer

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

            Bug ID: 28496
           Summary: Allow Blob constructor to take ownership of
                    ArrayBuffer(View) / invoke DetachArrayBuffer
           Product: WebAppsWG
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: File API
          Assignee: arun@mozilla.com
          Reporter: bugmail@asutherland.org
        QA Contact: public-webapps-bugzilla@w3.org
                CC: public-webapps@w3.org

Motivation: For the Firefox OS email app when we download attachments we end up
with a lot of TypedArray instaces piling up that exist only to be wrapped into
a Blob and then forgotten.  Lacking any way to neuter ArrayBuffers directly, it
would be nice if the Blob could takeownership of them as we pass them in.

Arguably it could be considered a common data-flow to create some data with a
TypedArray and then stuff it in a Blob to store it somewhere

Risks:
- I guess the 2-step process of "new Blob(takingOwnership).close()" could end
up as a disturbingly hacky general purpose means of disposing of the contents
of TypedArrays.

Mitigation strategies:
- In our specific case we are using the proprietary-mozTCPSocket that just
throws typed arrays at us, but I understand the Streams API provides a
mechanism to allow reads into existing buffers.  APIs that allow use of
existing buffers won't suffer from the "oh no, so many ArrayBuffers!" problem.
- GC will catch the stuff eventually.  Just crank up the GC.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Received on Wednesday, 15 April 2015 22:43:54 UTC