Open Bug 832557 Opened 11 years ago Updated 2 years ago

[systemXHR] cannot set User Agent / cookies

Categories

(Firefox :: General, defect)

defect

Tracking

()

UNCONFIRMED

People

(Reporter: mathieu, Unassigned)

Details

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
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.
Product: Firefox OS → Firefox
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.