Closed Bug 585244 Opened 14 years ago Closed 14 years ago

IPC DNS prefetching shouldn't bother sending zero-length hostnames

Categories

(Core :: Networking, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
Tracking Status
blocking2.0 --- betaN+

People

(Reporter: jdm, Assigned: jdm)

Details

Attachments

(1 file, 1 obsolete file)

I end up seeing lots of these errors when browsing around in fennec:

WARNING: NS_ENSURE_TRUE(host && *host) failed: file /home/t_mattjo/src/firefox/mobilebase/netwerk/dns/nsHostResolver.cpp, line 501

They come from attempting to prefetch zero-length hostnames, such as javascript: links.  We know they're going to fail, so we might as well not bother sending zer-length hostnames over the wire.
Attached patch Patch (obsolete) — Splinter Review
Assignee: nobody → josh
Attachment #463746 - Flags: review?(doug.turner)
Comment on attachment 463746 [details] [diff] [review]
Patch

How about using net_IsValidHostName?
Attachment #463746 - Flags: review?(doug.turner) → review-
net_IsValidHostName() considers the empty string to be a valid hostname, so we still need to filter that.  However, net_IsValidHostName() is a good additional check to make.
Attachment #463746 - Attachment is obsolete: true
Attachment #464725 - Flags: review?(doug.turner)
Comment on attachment 464725 [details] [diff] [review]
Don't attempt to prefetch invalid hostnames from content processes

I think we are all unhappy with the string conversions, and we are also unhappy with net_IsValidHostName(null|"") returning true.  But this patch improves what we have.

ooc, why the #ifdefs around:

+using namespace mozilla::net;

Does it hurt anything to not wrap it?
Attachment #464725 - Flags: review?(doug.turner) → review+
(In reply to comment #4)
> Comment on attachment 464725 [details] [diff] [review]
> Don't attempt to prefetch invalid hostnames from content processes
>
> ooc, why the #ifdefs around:
> 
> +using namespace mozilla::net;
> 
> Does it hurt anything to not wrap it?

I thought mozilla::net was all conditionally-declared necko IPC stuff (and if so, |using mozilla::net| would be a compile error), but I see that we forward-declare some necko things in mozilla::net outside of |ifdef MOZ_IPC|.  Good call, will fix.
Comment on attachment 464725 [details] [diff] [review]
Don't attempt to prefetch invalid hostnames from content processes

This is a safe patch that can eliminate a lot of wasted IPC traffic: ~70 messages while loading news.google.com, e.g.  (We might want to do something smarter for valid hostnames later, too, but that's a bug for another day.)
Attachment #464725 - Flags: approval2.0?
blocking2.0: --- → betaN+
Attachment #464725 - Flags: approval2.0?
http://hg.mozilla.org/projects/cedar/rev/70094380fcbb
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: