Access the Public Suffix list?

94 views
Skip to first unread message

brinchj

unread,
May 29, 2010, 2:21:51 PM5/29/10
to Chromium-extensions
Hi,

I'm looking for an API to access the public suffix list in Chrome.

Mozilla has the nsIEffectiveTLDService that provides:
getBaseDomainFromHost("www.google.com") => "google.com"

https://developer.mozilla.org/en/nsIEffectiveTLDService

I'm looking for something similar in Chrome. Basicly, a function that
strips sub-domains out of the domain.

--
Johan Brinch

Mohamed Mansour

unread,
Jun 2, 2010, 11:46:55 PM6/2/10
to brinchj, Chromium-extensions
As far as I know, Chrome doesn't have such thing, so you would have to strip the subdomain manually, basically use string manipulation to remove all subdomains from "document.location.hostname". JavaScript has nice functions such as lastIndexOf, substring.


-
Mohamed Mansour
m...@chromium.org



--
You received this message because you are subscribed to the Google Groups "Chromium-extensions" group.
To post to this group, send email to chromium-...@chromium.org.
To unsubscribe from this group, send email to chromium-extens...@chromium.org.
For more options, visit this group at http://groups.google.com/a/chromium.org/group/chromium-extensions/?hl=en.


Johan Brinch

unread,
Jun 3, 2010, 6:23:28 AM6/3/10
to Mohamed Mansour, Chromium-extensions
On Thu, Jun 3, 2010 at 04:46, Mohamed Mansour <m0.inte...@gmail.com> wrote:
> As far as I know, Chrome doesn't have such thing, so you would have to strip
> the subdomain manually, basically use string manipulation to remove all
> subdomains from "document.location.hostname". JavaScript has nice functions
> such as lastIndexOf, substring.

The problem here is, that there is no way to distinguish the domain
from the sub domain without the suffix list. It's a rather complicated
procedure:
http://mxr.mozilla.org/mozilla-central/source/netwerk/dns/src/effective_tld_names.dat?raw=1

--
Johan Brinch

Mohamed Mansour

unread,
Jun 3, 2010, 9:02:16 AM6/3/10
to Johan Brinch, Chromium-extensions
Yea, we have the same tld names as mozilla, http://src.chromium.org/viewvc/chrome/trunk/src/net/base/effective_tld_names.dat?view=log

Perhaps we can do what mozilla has done "getBaseDomainFromHost", somewhere in our net project, the implementation seems straight forward:

Maybe we can include that in our source (or v8)


-
Mohamed Mansour
m...@chromium.org

Johan Brinch

unread,
Jun 3, 2010, 1:21:36 PM6/3/10
to Mohamed Mansour, Chromium-extensions
On Thu, Jun 3, 2010 at 14:02, Mohamed Mansour <m0.inte...@gmail.com> wrote:
> Perhaps we can do what mozilla has done "getBaseDomainFromHost", somewhere
> in our net project, the implementation seems straight forward:
> http://mxr.mozilla.org/mozilla-central/source/netwerk/dns/src/nsEffectiveTLDService.cpp#171

That would be great. As for now, my addon includes the full list in
javascript which contributes 80% of it's mass. It would be nice to
strip those 80% out.

--
Johan Brinch

Reply all
Reply to author
Forward
0 new messages