Skip to content

Add new getResponseBuffer method in nsIXMLHttpRequest.

Gabriel Ivăncescu requested to merge insn/wine-gecko:expose-for-arraybuf into master

Add a new method to nsIXMLHttpRequest that transfers the buffer contents of gecko's ArrayBuffer response into an arbitrary buffer for wine. If buffer is NULL, it only returns the size without transferring anything, which allows wine to allocate the buffer. This will allow wine to implement the response prop.

Calling it frees gecko's buffer, but of course it has to be cached on wine side anyway because it must return reference to the same object on subsequent calls.

I wasn't sure how to deal with all the GC and JSObject lifetimes, so I just opted to copy the raw buffer and then free the source buffer, before any ArrayBuffer is even created. It is also much simpler this way. Just need to be careful on wine side to not call the normal getResponse for such cases.

I decided to not modify the original getResponse, because it's used in other places in gecko's source, and it seems too fragile for my understanding of it.

Edited by Gabriel Ivăncescu

Merge request reports

Loading