Closed Bug 1481947 Opened 2 years ago Closed 2 years ago
new Worker() fails with network
.http .referer .XOrigin Policy=1 on localhost-like domains and IPs
47 bytes, text/x-phabricator-request
|Details | Review|
User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0 Build ID: 20180621121604 Steps to reproduce: about:config network.http.referer.XOriginPolicy;1 go to local website at http://domain/ console > new SharedWorker('a.js') [Exception... "The requested number of domain levels exceeds those present in the host string" nsresult: "0x804b0050 (NS_ERROR_INSUFFICIENT_DOMAIN_LEVELS)" location: "JS frame :: debugger eval code :: <TOP_LEVEL> :: line 1" data: no] go to local website at http://192.168.1.1 console > new SharedWorker('a.js') [Exception... "The host string is an IP address" nsresult: "0x804b0051 (NS_ERROR_HOST_IS_IP_ADDRESS)" location: "JS frame :: debugger eval code :: <TOP_LEVEL> :: line 1" data: no] new Worker() gives same error codes (0x804b0050, 0x804b0051) but with fewer explanation: NetworkError: Failed to load worker script at (nsresult = 0x804b0050) tested on 62.0b9 and 60.1.0esr Actual results: no Workers was created Expected results: Workers were created
Build ID: 20180813100104 User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:63.0) Gecko/20100101 Firefox/63.0 The exception is only displayed when accessing "http://192.168.1.1" and creating a new SharedWorker, the exception isn't displayed when accessing "http://domain/". I trying to reproduce this issue on the Firefox Nightly 63.0a1, Firefox 62.0b16 and on Firefox 61.0.2 on Windows 10 x64, Ubuntu 17.04 x64 and on Mac OS X 10.12.
Status: UNCONFIRMED → NEW
Component: Untriaged → Networking
Ever confirmed: true
Product: Firefox → Core
I'm not sure how the referer pref affects workers. Olli, can you take a look? Or point me to the right direction? :)
I'm not familiar with that pref at all. asuth might know better about worker side.
Flags: needinfo?(bugs) → needinfo?(bugmail)
It seems likely this is due to: * ScriptLoader invoking HttpBaseChannel::SetReferrerWithPolicy https://searchfox.org/mozilla-central/rev/2466b82b729765fb0a3ab62f812c1a96a7362478/dom/script/ScriptLoader.cpp#1140 * which invokes HttpBaseChannel::SetReferrerWithPolicy https://searchfox.org/mozilla-central/rev/2466b82b729765fb0a3ab62f812c1a96a7362478/netwerk/protocol/http/HttpBaseChannel.cpp#1820 * which invokes nsEffectiveTLDService::GetBaseDomain https://searchfox.org/mozilla-central/rev/2466b82b729765fb0a3ab62f812c1a96a7362478/netwerk/dns/nsEffectiveTLDService.cpp#119 * which invokes nsEffectiveTLDService::GetBaseDomainInternal which can return: * NS_ERROR_INSUFFICIENT_DOMAIN_LEVELS * https://searchfox.org/mozilla-central/rev/2466b82b729765fb0a3ab62f812c1a96a7362478/netwerk/dns/nsEffectiveTLDService.cpp#307 * https://searchfox.org/mozilla-central/rev/2466b82b729765fb0a3ab62f812c1a96a7362478/netwerk/dns/nsEffectiveTLDService.cpp#197 * NS_ERROR_HOST_IS_IP_ADDRESS * https://searchfox.org/mozilla-central/rev/2466b82b729765fb0a3ab62f812c1a96a7362478/netwerk/dns/nsEffectiveTLDService.cpp#213 It seems like other callers like ThirdPartyUtil have special handling for these error codes like at https://searchfox.org/mozilla-central/rev/2466b82b729765fb0a3ab62f812c1a96a7362478/dom/base/ThirdPartyUtil.cpp#295
Assignee: nobody → dd.mozilla
Status: NEW → ASSIGNED
Priority: -- → P2
Pushed by email@example.com: https://hg.mozilla.org/integration/autoland/rev/a9127ac945bd When getting eTLD+1 fails, check if uri is an ip literal or localhost. r=asuth
You need to log in before you can comment on or make changes to this bug.