WebCore:

2008-04-25  Anders Carlsson  <andersca@apple.com>

        Reviewed by Sam.

        Add and honor offlineWebApplicationCacheEnabled setting.
        
        * WebCore.base.exp:
        * loader/DocumentLoader.cpp:
        (WebCore::DocumentLoader::scheduleApplicationCacheLoad):
        * loader/MainResourceLoader.cpp:
        (WebCore::MainResourceLoader::load):
        * loader/appcache/ApplicationCacheGroup.cpp:
        (WebCore::ApplicationCacheGroup::selectCache):
        (WebCore::ApplicationCacheGroup::selectCacheWithoutManifestURL):
        * page/Settings.cpp:
        (WebCore::Settings::Settings):
        (WebCore::Settings::setOfflineWebApplicationCacheEnabled):
        * page/Settings.h:
        (WebCore::Settings::offlineWebApplicationCacheEnabled):

WebKit/mac:

2008-04-25  Anders Carlsson  <andersca@apple.com>

        Reviewed by Sam.

        Add offlineWebApplicationCacheEnabled preference.
        
        * WebView/WebPreferenceKeysPrivate.h:
        * WebView/WebPreferences.m:
        (+[WebPreferences initialize]):
        (-[WebPreferences offlineWebApplicationCacheEnabled]):
        (-[WebPreferences setOfflineWebApplicationCacheEnabled:]):
        * WebView/WebPreferencesPrivate.h:
        * WebView/WebView.mm:
        (-[WebView _updateSettingsFromPreferences:]):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@32581 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/loader/MainResourceLoader.cpp b/WebCore/loader/MainResourceLoader.cpp
index 75871bd..0c5fed1 100644
--- a/WebCore/loader/MainResourceLoader.cpp
+++ b/WebCore/loader/MainResourceLoader.cpp
@@ -41,6 +41,7 @@
 #include "HTMLFormElement.h"
 #include "ResourceError.h"
 #include "ResourceHandle.h"
+#include "Settings.h"
 
 // FIXME: More that is in common with SubresourceLoader should move up into ResourceLoader.
 
@@ -408,7 +409,7 @@
 
 #if ENABLE(OFFLINE_WEB_APPLICATIONS)
     // Check if this request should be loaded from the application cache
-    if (!m_substituteData.isValid()) {
+    if (!m_substituteData.isValid() && frameLoader()->frame()->settings() && frameLoader()->frame()->settings()->offlineWebApplicationCacheEnabled()) {
         ASSERT(!m_applicationCache);
         
         m_applicationCache = frameLoader()->documentLoader()->topLevelApplicationCache();