Last Comment Bug 634527 - getBaseDomainFromHost doesn't work for domains with a . at the front (nsIEffectiveTLDService)
: getBaseDomainFromHost doesn't work for domains with a . at the front (nsIEffe...
Status: RESOLVED INVALID
: dev-doc-complete, regression
Product: Core
Classification: Components
Component: Networking (show other bugs)
: Trunk
: All All
: -- normal (vote)
: ---
Assigned To: Nobody; OK to take it and work on it
:
:
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-02-15 22:08 PST by Mike Kaply [:mkaply]
Modified: 2011-03-15 12:02 PDT (History)
3 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments

Description Mike Kaply [:mkaply] 2011-02-15 22:08:25 PST
This is a regression.

I've been using getBaseDomainFromHost on domains like .foo.com

This worked in Firefox 3.6

In Firefox 4 it returns an error

Error: uncaught exception: [Exception... "Component returned failure code: 0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsIEffectiveTLDService.getBaseDomainFromHost]"  nsresult: "0x80070057 (NS_ERROR_ILLEGAL_VALUE)"  location: "JS frame :: chrome://optouttester2/content/optouttester.js :: <TOP_LEVEL> :: line 35"  data: no]
Comment 1 Mike Kaply [:mkaply] 2011-02-15 22:08:46 PST
This is with the latest nightly.
Comment 2 Boris Zbarsky [:bz] (still a bit busy) 2011-02-15 22:13:21 PST
Michael, would you be willing to narrow down a regression range?
Comment 3 Mike Kaply [:mkaply] 2011-02-15 22:18:49 PST
I just tested beta 1 and it failed there. So it happened early.
Comment 4 Mike Kaply [:mkaply] 2011-02-15 22:22:05 PST
Fails in 3.7 alpha 1.

I've double and triple checked and it definitely works in FF 3.6.
Comment 5 Mike Kaply [:mkaply] 2011-02-15 22:33:02 PST
In comparing FF 3.6 to FF4, Code was added to do this:

203     // sanity check the string we're about to look up: it should not begin with
204     // a '.'; this would mean the hostname began with a '.' or had an
205     // embedded '..' sequence.
206     if (*currDomain == '.')
207       return NS_ERROR_INVALID_ARG;

Unfortunately there is no blame on that file.

http://mxr.mozilla.org/mozilla-central/source/netwerk/dns/nsEffectiveTLDService.cpp
Comment 6 Mike Kaply [:mkaply] 2011-02-15 22:35:41 PST
It was done here:

https://bugzilla.mozilla.org/show_bug.cgi?id=536650
Comment 7 Boris Zbarsky [:bz] (still a bit busy) 2011-02-16 11:19:12 PST
Hmm.  That change looks quite purposeful.  Dan?
Comment 8 dwitte@gmail.com 2011-02-16 11:46:42 PST
Why would you expect it to succeed? It's not a valid host. You have to strip leading dots off before you pass it into the service, see http://mxr.mozilla.org/mozilla-central/source/netwerk/cookie/nsCookieService.cpp#3018.
Comment 9 Mike Kaply [:mkaply] 2011-02-16 11:48:50 PST
I'd expect it to succeed.

It's common to get hosts with leading . from cookies.

The other thing is that Firefox 3.6 set an expectation that it would succeed.

It was changed for FF 4.

At the bare minimum, the docs should be updated to note the change in behavior from FF3.6 to FF 4.
Comment 10 dwitte@gmail.com 2011-02-16 11:50:25 PST
Past performance is no guarantee of future results. :)

Good point though, we can doc it.
Comment 11 Eric Shepherd [:sheppy] 2011-03-15 12:02:23 PDT
Updated documentation:

https://developer.mozilla.org/en/XPCOM_Interface_Reference/nsIEffectiveTLDService#getBaseDomainFromHost()

Also noted on Firefox 4 for developers.

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