Open Bug 1395020 Opened 8 years ago Updated 1 year ago

webRequest.onBeforeRequest doesn't include IP address for cached requests

Categories

(WebExtensions :: Request Handling, defect, P3)

56 Branch
defect

Tracking

(Not tracked)

UNCONFIRMED

People

(Reporter: paul, Unassigned)

References

Details

(Whiteboard: [webRequest])

User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.13 Safari/537.36 Steps to reproduce: When running my Chrome extension (IPvFoo) on Firefox, it often fails to display IP addresses: 1. Install https://addons.mozilla.org/en-US/firefox/addon/ipvfoo-pmarks/ 2. Go to https://www.kernel.org/ 3. Observe that IPvFoo's icon is "?" rather than "4" or "6". When clicking the icon, it reports "(no address)". I can make the address appear by pressing the Reload button, and disappear by pressing Enter in the URL bar. The problem is, when webRequest.onBeforeRequest reports a cached response (fromCache: true), the "ip" field is missing. This works fine in Chrome. If I console.log(details.ip) from the webRequest.onBeforeRequest handler, and press Enter on kernel.org, *none* of the requests report an IP address, even though tcpdump shows packets flowing (to check whether the cache is fresh, perhaps?). So even if it's too much trouble to cache IP addresses, that TCP connection should provide some information.
Component: Untriaged → WebExtensions: Request Handling
Product: Firefox → Toolkit
Priority: -- → P3
Whiteboard: [webRequest]
Product: Toolkit → WebExtensions
See Also: → 1602005
Severity: normal → S3

I decided to build an in-RAM LRU cache from domain->ip, so IPvFoo on Firefox can now show IP addresses for recently cached requests:

https://github.com/pmarks-net/ipvfoo/commit/a2efe08653d5dbf913675112e7f6f1402d1414c6

Would be nice to have feature parity with Chrome so I can delete the workaround.

You need to log in before you can comment on or make changes to this bug.