Closed Bug 1269311 Opened 8 years ago Closed 8 years ago

bug with chrome.webRequest.onHeadersReceived API

Categories

(WebExtensions :: Untriaged, defect)

x86_64
Windows 10
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1232849

People

(Reporter: khalid.rfk, Unassigned, NeedInfo)

Details

(Whiteboard: [webrequest])

What did you do?
================
1. implement addListener
2. remove a header
3. return the list of new headers

What happened?
==============
NS_ERROR_ILLEGAL_VALUE: Component returned failure code: 0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsIHttpChannel.setResponseHeader]
 WebRequest.jsm:386:0
------------
the error is in the line
channel.setResponseHeader(name, "", false);

this line clear all headers before set the new ones in the next lines.

here, may be the function channel.setResponseHeader do not accept an empty text as the seconde argument or a header do not accept to be set with an empty text

What should have happened?
==========================
the new header list should be takin, the old one is!

Is there anything else we should know?
======================================
this is the list of headers:
-----------------------------------
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Connection: keep-alive
Content-Encoding: gzip
Content-Language: fr
Content-Type: text/html;charset=UTF-8
Date: Mon, 02 May 2016 10:24:43 GMT
Expires: 0
Pragma: no-cache
Server: nginx/1.4.6 (Ubuntu)
Transfer-Encoding: chunked
X-Content-Type-Options: nosniff
X-Frame-Options: DENY
X-XSS-Protection: 1; mode=block
Severity: normal → critical
Component: API → Activity Streams: General
OS: Other → Windows 10
Priority: -- → P3
Product: Mozilla Developer Network → Firefox
Hardware: All → x86_64
Whiteboard: [specification][type:bug] → 0x80070057 (NS_ERROR_ILLEGAL_VALUE)
I'm moving your issue to Toolkit - WebExtensions component. Activity Streams is an add-on and has nothing to do with your issue.
Component: Activity Streams: General → WebExtensions
Product: Firefox → Toolkit
Severity: critical → normal
Priority: P3 → --
Whiteboard: 0x80070057 (NS_ERROR_ILLEGAL_VALUE)
giorgio - is this expected or unexpected?
Flags: needinfo?(g.maone)
Whiteboard: [webrequest]
As far as I can tell I should have fixed it in Firefox 47 (bug 1232849): we report failures but don't break the loop, so the new list should replace the old anyway, skipping just the invalid headers.
khalid, which Firefox version are you testing?
Flags: needinfo?(g.maone) → needinfo?(khalid.rfk)
hi Giorgio,

I tested it in 45 and 46.0.1,,,

the problem is not due to invalid headers, let me show you the code:(WebRequest.jsm:386:0)
---------------------------------------------------------------------------------
if (opts.responseHeaders && result.responseHeaders) {
   // Start by clearing everything.
   for (let {name} of responseHeaders) {
     channel.setResponseHeader(name, "", false); //the problem is in this line
   }

   for (let {name, value} of result.responseHeaders) {
      channel.setResponseHeader(name, value, false);
   }
}
---------------------------------------------------------------------------------

a similar situation is when would to clear request header:
channel.setRequestHeader(name, "", false);
and it works, but channel.setResponseHeader(name, "", false); causes error

Best regards.
if can reproduce in 47 - reopen
Status: UNCONFIRMED → RESOLVED
Closed: 8 years ago
Resolution: --- → DUPLICATE
Product: Toolkit → WebExtensions
You need to log in before you can comment on or make changes to this bug.