Closed Bug 714589 Opened 12 years ago Closed 12 years ago

Transparent conversion from ArrayBufferView to array

Categories

(Core :: XPConnect, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: asaf, Unassigned)

References

Details

STR:
1. Read a file using FileReader's readAsArrayBuffer
2. Figure out what you really want to do is to parse the buffer as an XML tree.
3. Find parseFromBuffer in nsIDOMParser
4. Apply it on you Uin8Array view.
----  Exception: Error: uncaught exception: [Exception... "Cannot convert JavaScript object into an array arg 0 [nsIDOMParser.parseFromBuffer]"  nsresult: "0x80570023 (NS_ERROR_XPC_CANT_CONVERT_OBJECT_TO_ARRAY)" (...)
5. Use a magic for now, namely: let bytes = [b for each (b in bytesView)];
6. File this bug and note it in you XXX comment.

Of course, we could fix DOM Parser to take an ArrayBuffer rather than an Array, or add yet another parsing method, but it seems we can provide a general-purpose solution.
Depends on: 699156
OS: Mac OS X → All
Hardware: x86 → All
Version: unspecified → Trunk
+1. There's a bunch of other places in Gecko/Necko (e.g. input and output streams) where an array is expected and I might just as well want to pass an ArrayBuffer.
Bug 699156 should have made this work for the situation described in comment 0, no?  Mano, what build are you testing in?
Sorry!
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.