Reviewed by Adam Barth.
authorap@apple.com <ap@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 14 Dec 2010 18:35:50 +0000 (18:35 +0000)
committerap@apple.com <ap@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 14 Dec 2010 18:35:50 +0000 (18:35 +0000)
        https://bugs.webkit.org/show_bug.cgi?id=50953
        DNS Prefetch should be an opt-in feature

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@74041 268f45cc-cd09-0410-ab3c-d52691b4dbfc

14 files changed:
WebCore/ChangeLog
WebCore/dom/Document.h
WebCore/page/Page.cpp
WebCore/page/Page.h
WebCore/page/Settings.cpp
WebKit/mac/ChangeLog
WebKit/mac/WebView/WebPreferences.mm
WebKit/win/ChangeLog
WebKit/win/WebPreferences.cpp
WebKit2/ChangeLog
WebKit2/Shared/WebPreferencesStore.h
WebKit2/UIProcess/API/C/WKPreferences.cpp
WebKit2/UIProcess/API/C/WKPreferences.h
WebKit2/WebProcess/WebPage/WebPage.cpp

index bcdab61..0c4c347 100644 (file)
@@ -1,3 +1,23 @@
+2010-12-13  Alexey Proskuryakov  <ap@apple.com>
+
+        Reviewed by Adam Barth.
+
+        https://bugs.webkit.org/show_bug.cgi?id=50953
+        DNS Prefetch should be an opt-in feature
+
+        No new tests, can't test DNS.
+
+        * dom/Document.h: Made initDNSPrefetch public, since Page now calls it.
+
+        * page/Page.cpp: (WebCore::Page::dnsPrefetchingStateChanged):
+        * page/Page.h:
+        Documents cache the value of this setting, so they need to be notified of changes. In particular,
+        the first document in a page is created before settings are applied.
+
+        * page/Settings.cpp:
+        (WebCore::Settings::Settings): Changed default to false.
+        (WebCore::Settings::setDNSPrefetchingEnabled): Notify the page about the change.
+
 2010-12-14  Helder Correia  <helder@sencha.com>
 
         Reviewed by Ariya Hidayat.
index f1fe44c..7a8ea78 100644 (file)
@@ -1064,6 +1064,8 @@ public:
 
     bool mayCauseFlashOfUnstyledContent() const;
 
+    void initDNSPrefetch();
+
 protected:
     Document(Frame*, const KURL& url, bool isXHTML, bool isHTML, const KURL& baseURL = KURL());
 
@@ -1116,8 +1118,6 @@ private:
     virtual const KURL& virtualURL() const; // Same as url(), but needed for ScriptExecutionContext to implement it without a performance loss for direct calls.
     virtual KURL virtualCompleteURL(const String&) const; // Same as completeURL() for the same reason as above.
 
-    void initDNSPrefetch();
-
     String encoding() const;
 
     void updateTitle();
index e22762e..552a109 100644 (file)
@@ -865,6 +865,12 @@ SpeechInput* Page::speechInput()
 }
 #endif
 
+void Page::dnsPrefetchingStateChanged()
+{
+    for (Frame* frame = mainFrame(); frame; frame = frame->tree()->traverseNext())
+        frame->document()->initDNSPrefetch();
+}
+
 void Page::privateBrowsingStateChanged()
 {
     bool privateBrowsingEnabled = m_settings->privateBrowsingEnabled();
index a938932..7413bb6 100644 (file)
@@ -238,6 +238,7 @@ namespace WebCore {
         void userStyleSheetLocationChanged();
         const String& userStyleSheet() const;
 
+        void dnsPrefetchingStateChanged();
         void privateBrowsingStateChanged();
 
         void didStartPlugin(HaltablePlugin*);
index fc18224..1005338 100644 (file)
@@ -160,7 +160,7 @@ Settings::Settings(Page* page)
     , m_loadDeferringEnabled(true)
     , m_tiledBackingStoreEnabled(false)
     , m_paginateDuringLayoutEnabled(false)
-    , m_dnsPrefetchingEnabled(true)
+    , m_dnsPrefetchingEnabled(false)
 #if ENABLE(FULLSCREEN_API)
     , m_fullScreenAPIEnabled(false)
 #endif
@@ -558,7 +558,11 @@ void Settings::setUsesEncodingDetector(bool usesEncodingDetector)
 
 void Settings::setDNSPrefetchingEnabled(bool dnsPrefetchingEnabled)
 {
+    if (m_dnsPrefetchingEnabled == dnsPrefetchingEnabled)
+        return;
+
     m_dnsPrefetchingEnabled = dnsPrefetchingEnabled;
+    m_page->dnsPrefetchingStateChanged();
 }
 
 void Settings::setAllowScriptsToCloseWindows(bool allowScriptsToCloseWindows)
index a8d1ff5..1aaeff8 100644 (file)
@@ -1,3 +1,12 @@
+2010-12-13  Alexey Proskuryakov  <ap@apple.com>
+
+        Reviewed by Adam Barth.
+
+        https://bugs.webkit.org/show_bug.cgi?id=50953
+        DNS Prefetch should be an opt-in feature
+
+        * WebView/WebPreferences.mm: (+[WebPreferences initialize]): Changed default to false.
+
 2010-12-13  Mike Thole  <mthole@apple.com>
 
         Rubber-stamped by John Sullivan.
index 3817d4a..7ce3bc4 100644 (file)
@@ -365,7 +365,7 @@ static WebCacheModel cacheModelForMainBundle(void)
         [NSNumber numberWithUnsignedInt:4], WebKitPluginAllowedRunTimePreferenceKey,
         [NSNumber numberWithBool:NO],   WebKitFrameFlatteningEnabledPreferenceKey,
         [NSNumber numberWithBool:NO],   WebKitSpatialNavigationEnabledPreferenceKey,
-        [NSNumber numberWithBool:YES],  WebKitDNSPrefetchingEnabledPreferenceKey,
+        [NSNumber numberWithBool:NO],  WebKitDNSPrefetchingEnabledPreferenceKey,
         [NSNumber numberWithBool:NO],   WebKitFullScreenEnabledPreferenceKey,
         [NSNumber numberWithBool:NO],   WebKitAsynchronousSpellCheckingEnabledPreferenceKey,
         [NSNumber numberWithBool:NO],   WebKitMemoryInfoEnabledPreferenceKey,
index d4ceb67..1cca717 100644 (file)
@@ -1,3 +1,12 @@
+2010-12-13  Alexey Proskuryakov  <ap@apple.com>
+
+        Reviewed by Adam Barth.
+
+        https://bugs.webkit.org/show_bug.cgi?id=50953
+        DNS Prefetch should be an opt-in feature
+
+        * WebPreferences.cpp: (WebPreferences::initializeDefaultSettings): Changed default to NO.
+
 2010-10-28  MORITA Hajime  <morrita@google.com>
 
         Reviewed by Ojan Vafai.
index f9d8370..5a2c19b 100644 (file)
@@ -261,7 +261,7 @@ void WebPreferences::initializeDefaultSettings()
     
     CFDictionaryAddValue(defaults, CFSTR(WebKitShowDebugBordersPreferenceKey), kCFBooleanFalse);
 
-    CFDictionaryAddValue(defaults, CFSTR(WebKitDNSPrefetchingEnabledPreferenceKey), kCFBooleanTrue);
+    CFDictionaryAddValue(defaults, CFSTR(WebKitDNSPrefetchingEnabledPreferenceKey), kCFBooleanFalse);
 
     CFDictionaryAddValue(defaults, CFSTR(WebKitMemoryInfoEnabledPreferenceKey), kCFBooleanFalse);
     CFDictionaryAddValue(defaults, CFSTR(WebKitHyperlinkAuditingEnabledPreferenceKey), kCFBooleanTrue);
index b3a490d..6779ec1 100644 (file)
@@ -1,3 +1,20 @@
+2010-12-13  Alexey Proskuryakov  <ap@apple.com>
+
+        Reviewed by Adam Barth.
+
+        https://bugs.webkit.org/show_bug.cgi?id=50953
+        DNS Prefetch should be an opt-in feature
+
+        Pass the preference through WebKit2.
+
+        * Shared/WebPreferencesStore.h:
+        * UIProcess/API/C/WKPreferences.cpp:
+        (WKPreferencesSetDNSPrefetchingEnabled):
+        (WKPreferencesGetDNSPrefetchingEnabled):
+        * UIProcess/API/C/WKPreferences.h:
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::updatePreferences):
+
 2010-12-13  Anders Carlsson  <andersca@apple.com>
 
         Reviewed by Kevin Decker.
index 6f4e8f2..05a77f8 100644 (file)
@@ -57,6 +57,7 @@ namespace WebKit {
     macro(CompositingRepaintCountersVisible, compositingRepaintCountersVisible, Bool, bool, false) \
     macro(ForceFTPDirectoryListings, forceFTPDirectoryListings, Bool, bool, false) \
     macro(TabsToLinks, tabsToLinks, Bool, bool, false) \
+    macro(DNSPrefetchingEnabled, dnsPrefetchingEnabled, Bool, bool, false) \
     \
 
 #define FOR_EACH_WEBKIT_UINT32_PREFERENCE(macro) \
index 0de3083..579595f 100644 (file)
@@ -369,3 +369,13 @@ bool WKPreferencesGetTabsToLinks(WKPreferencesRef preferencesRef)
 {
     return toImpl(preferencesRef)->tabsToLinks();
 }
+
+void WKPreferencesSetDNSPrefetchingEnabled(WKPreferencesRef preferencesRef, bool enabled)
+{
+    toImpl(preferencesRef)->setDNSPrefetchingEnabled(enabled);
+}
+
+bool WKPreferencesGetDNSPrefetchingEnabled(WKPreferencesRef preferencesRef)
+{
+    return toImpl(preferencesRef)->dnsPrefetchingEnabled();
+}
index ed455f8..9e014b7 100644 (file)
@@ -134,6 +134,10 @@ WK_EXPORT bool WKPreferencesGetTextAreasAreResizable(WKPreferencesRef preference
 WK_EXPORT void WKPreferencesSetTabsToLinks(WKPreferencesRef preferences, bool tabsToLinks);
 WK_EXPORT bool WKPreferencesGetTabsToLinks(WKPreferencesRef preferences);
 
+// Defaults to false.
+WK_EXPORT void WKPreferencesSetDNSPrefetchingEnabled(WKPreferencesRef preferences, bool enabled);
+WK_EXPORT bool WKPreferencesGetDNSPrefetchingEnabled(WKPreferencesRef preferences);
+
 #ifdef __cplusplus
 }
 #endif
index 0855e42..c3b92a7 100644 (file)
@@ -957,6 +957,7 @@ void WebPage::updatePreferences(const WebPreferencesStore& store)
     settings->setMinimumLogicalFontSize(store.getUInt32ValueForKey(WebPreferencesKey::minimumLogicalFontSizeKey()));
     settings->setDefaultFontSize(store.getUInt32ValueForKey(WebPreferencesKey::defaultFontSizeKey()));
     settings->setDefaultFixedFontSize(store.getUInt32ValueForKey(WebPreferencesKey::defaultFixedFontSizeKey()));
+    settings->setDNSPrefetchingEnabled(store.getBoolValueForKey(WebPreferencesKey::dnsPrefetchingEnabledKey()));
 
 #if PLATFORM(WIN)
     // Temporarily turn off accelerated compositing until we have a good solution for rendering it.