whatwg/xhr

Wrong algorithm + missing realm argument when creating ArrayBuffer

bathos opened this issue · 0 comments

bathos commented

In the getter steps for the response attribute of the XMLHTTPRequest interface —

  1. If this’s response type is "arraybuffer", then set this’s response object to a new ArrayBuffer object representing this’s received bytes. If this throws an exception, then set this’s response object to failure and return null.

— the word “new” links to “create a new object implementing the interface” in Web IDL. However ArrayBuffer isn’t an interface and that algorithm doesn’t make sense with it. It looks like it should be calling “create an ArrayBuffer” instead.

Note that both of those algorithms also expect a realm argument, which is missing. Presumably it should be passing the relevant realm of this.

(Issue discovered by @twiss when correcting ArrayBuffer usage in WebCrypto algorithms.)