[systemXHR] cannot set User Agent / cookies

UNCONFIRMED
Unassigned

Status

()

Firefox
General
UNCONFIRMED
5 years ago
3 years ago

People

(Reporter: mathieu, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

5 years ago
User Agent: spotify-websocket-api (Chrome/13.37 compatible-ish)
Build ID: 20130116031003

Steps to reproduce:

I'm trying to make request with custom user agent

xhr = new XMLHttpRequest({mozSystem: true}); // also tried with mozAnon: true
xhr.open('http://another.domain.com/');
xhr.setRequestHeader('User-Agent', 'My user agent');
xhr.setRequestHeader('Cookie', ''); // clear cookie to ignore user cookies
// ...
xhr.send();


Actual results:

the request is send with Firefox default own User-Agent header and without clearing the cookies.


Expected results:

override User-Agent header and do not send existing cookies. 
I know this is the normal behavior for a classic XHR, but with the systemXHR permission and mozSystem/mozAnon I think it should be possible to set User-Agent header and custom cookies
(Reporter)

Comment 1

5 years ago
note: it could do be done with mozTCPSocket but it seems to me that asking network-tcp permission for "just" that is overkill
Yeah, we should probably allow setting more headers here. We still shouldn't allow setting ones that would affect our HTTP stack like:

Host
Keep-Alive
Connection
Content-Length 
etc.

Transfer-Encoding has also been proposed as something that *should* be allowed to be set, but I don't know all the ins and outs of that header so the necko team would have to check that too.
Component: General → General
Product: Firefox OS → Firefox
You need to log in before you can comment on or make changes to this bug.