RESOLVED FIXED 28825
Provide a WebView preference to disable DNS prefetching
https://bugs.webkit.org/show_bug.cgi?id=28825
Summary Provide a WebView preference to disable DNS prefetching
Jeff Johnson
Reported 2009-08-28 19:53:37 PDT
As far as I can tell, DNS prefetching is enabled by default in the WebKit trunk, and there is no way to disable it. I'm looking at the trunk as of git commit de240fc8d016a25d9f4b05f65195414375159b3c, corresponding to svn r47855. At WebCore/dom/Document.cpp:4370 there is the following code: m_isDNSPrefetchEnabled = securityOrigin()->protocol() == "http"; So DNS prefetch appears to be on for any http document. I've verified this in the debugger and via packet traces. There should be a WebView preference to disable DNS prefetching. This could be either part of WebPreferences or a direct accessor pair on WebView. I've listed some concerns about DNS prefetching at https://bugs.webkit.org/show_bug.cgi?id=20690#c4 and there are probably a number of other concerns that I'm not even qualified to imagine. I believe that item 2) is ok in the current implementation, but 1) and 3) still need to be addressed. It's not clear whether 4) has been handled adequately -- it appears that the DNS queue is limited to 64 requests, but I haven't tested how these requests impact the system, especially with other internet apps running simultanously, such as a syndicated feed reader. In any case, I think that people would have very legitimate reasons for wanting to disable DNS prefetching.
Attachments
Proposed patch (10.99 KB, patch)
2010-07-01 12:22 PDT, Timothy Hatcher
darin: review+
timothy: commit-queue-
Mark Rowe (bdash)
Comment 1 2009-08-29 11:40:50 PDT
Jeff Johnson
Comment 2 2010-04-19 08:51:28 PDT
Is anybody working on this? DNS prefetching has now been in the trunk for 19 months: http://trac.webkit.org/changeset/36650/trunk 19 months, yet there is still no way to turn it off, short of modifying the WebKit code yourself and recompiling. I don't understand how the original patch was even accepted without a way of turning off DNS prefetching. People using the WebKit nightly builds are probably unaware that DNS prefetching is on, because nobody has publicly mentioned this feature, e.g., on the WebKit blog. It was such a stealth update that the svn commit message itself was empty. (Probably an oversight, but a pretty bad one for an important change like this.) I hope at least that rdar://problem/7181249 is blocking the release of DNS prefetching in Mac OS X. I've been checking after each release if it's there and haven't seen it yet. I can guarantee that there will be a public stink if this goes into Mac OS X without any way of disabling it. I would submit a patch myself, but I don't feel qualified. I have only a passing familiarity with C++ and with the WebKit architecture.
Timothy Hatcher
Comment 3 2010-07-01 12:22:08 PDT
Created attachment 60270 [details] Proposed patch
Darin Adler
Comment 4 2010-07-01 12:24:12 PDT
Comment on attachment 60270 [details] Proposed patch > + [NSNumber numberWithBool:YES], WebKitDNSPrefetchingEnabledPreferenceKey, Why the strange formatting here? The lines are not lined up, but there are extra spaces.
Timothy Hatcher
Comment 5 2010-07-01 12:29:52 PDT
Fixed the spacing issue. Thanks!
Timothy Hatcher
Comment 6 2010-07-01 12:34:18 PDT
Landed in r62284.
Note You need to log in before you can comment on or make changes to this bug.