[XHR] Error type when setting request headers.

Hi,
In XHR [1], setRequestHeader is defined by this:
[[
void setRequestHeader(ByteString name, ByteString value);
]]
It has a note:
[[ Throws a SyntaxError exception if name is not a header name or if value is not a header value. ]]

In WebIDL [2], ByteString is defined by the algorithm
[[
 • Let x be ToString(V).
 • If the value of any element of x is greater than 255, then throw a TypeError.
 • Return an IDL ByteString value whose length is the length of x, and where the value of each element is the value of the corresponding element of x.
]]
So what should be thrown when one does

var client = new XMLHttpRequest();
client.open('GET', '/glop');
client.setRequestHeader('X-Test', '小');

TypeError per WebIDL or SyntaxError per XHR?
I think it should be TypeError, and SyntaxError for code <256 that are not allowed, but implementations currently use SyntaxError only.

[1] https://xhr.spec.whatwg.org/
[2] https://heycam.github.io/webidl/#es-ByteString
-- 
Baroula que barouleras, au tiéu toujou t'entourneras.

        ~~Yves

Received on Tuesday, 29 September 2015 13:25:59 UTC