2011-02-13 Jeremy Moskovich <jeremy@chromium.org>
authorjeremy@chromium.org <jeremy@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 13 Feb 2011 20:28:39 +0000 (20:28 +0000)
committerjeremy@chromium.org <jeremy@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 13 Feb 2011 20:28:39 +0000 (20:28 +0000)
        Reviewed by Adam Barth.

        Add a compile-time option to completely disable WebArchive support.
        https://bugs.webkit.org/show_bug.cgi?id=52712

        Add an ENABLE(WEB_ARCHIVE) compile-time setting and use it for all WebArchive code.
        Ports Affected:
            WebArchive support is currently enabled for all ports that define PLATFORM(CF) apart from Qt.
            This patch preserves this behavior except that it also disables support in the Chromium port.

        * wtf/Platform.h: Add ENABLE_WEB_ARCHIVE definition and turn it off explicitly for Qt & Chromium ports.
2011-02-13  Jeremy Moskovich  <jeremy@chromium.org>

        Reviewed by Adam Barth.

        Add a compile-time option to completely disable WebArchive support.
        https://bugs.webkit.org/show_bug.cgi?id=52712

        Add an ENABLE(WEB_ARCHIVE) compile-time setting and use it for all WebArchive code.

        ArchiveResource and ArchiveResourceCollection are notably still compiled in. They are used
        in Safari for functionality such as "Save Image As" and Image copy & paste independent of
        WebArchive support.

        Ports Affected:
            WebArchive support is currently enabled for all ports that define PLATFORM(CF) apart from Qt.
            This patch preserves this behavior except that it also disables support in the Chromium port.

        No behavior changes so no new tests.

        * WebCore.gyp/WebCore.gyp: Don't compile LegacyWebArchive.cpp and friends.
        * WebCore.pro: Don't compile ArchiveFactory.cpp in Qt port.
        * loader/DocumentLoader.cpp: Surround WebArchive code with #ifdef.
        (WebCore::DocumentLoader::commitLoad):
        (WebCore::DocumentLoader::setupForReplaceByMIMEType):
        (WebCore::DocumentLoader::archiveResourceForURL):
        * loader/DocumentLoader.h:
        * loader/FrameLoader.cpp:
        (WebCore::FrameLoader::loadURLIntoChildFrame):
        (WebCore::FrameLoader::stopAllLoaders):
        (WebCore::FrameLoader::finishedLoadingDocument):
        * loader/FrameLoader.h:
        * loader/ResourceLoader.cpp:
        (WebCore::ResourceLoader::start):
        * loader/archive/ArchiveFactory.cpp: Remove #ifdef since feature is now enabled/disabled wholesale.
        (WebCore::archiveMIMETypes):
        * page/Settings.cpp:
        * page/Settings.h:
        * platform/MIMETypeRegistry.cpp:
        (WebCore::initializeSupportedNonImageMimeTypes):
2011-02-13  Jeremy Moskovich  <jeremy@chromium.org>

        Reviewed by Adam Barth.

        Add a compile-time option to completely disable WebArchive support.
        https://bugs.webkit.org/show_bug.cgi?id=52712

        Add an ENABLE(WEB_ARCHIVE) compile-time setting and use it for all WebArchive code.

        * WebProcess/WebPage/WebPage.cpp:
        (WebKit::WebPage::updatePreferences):

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

16 files changed:
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/wtf/Platform.h
Source/WebCore/ChangeLog
Source/WebCore/WebCore.gyp/WebCore.gyp
Source/WebCore/WebCore.pro
Source/WebCore/loader/DocumentLoader.cpp
Source/WebCore/loader/DocumentLoader.h
Source/WebCore/loader/FrameLoader.cpp
Source/WebCore/loader/FrameLoader.h
Source/WebCore/loader/ResourceLoader.cpp
Source/WebCore/loader/archive/ArchiveFactory.cpp
Source/WebCore/page/Settings.cpp
Source/WebCore/page/Settings.h
Source/WebCore/platform/MIMETypeRegistry.cpp
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/WebPage/WebPage.cpp

index 98358ef..12e0cfd 100644 (file)
@@ -1,3 +1,17 @@
+2011-02-13  Jeremy Moskovich  <jeremy@chromium.org>
+
+        Reviewed by Adam Barth.
+
+        Add a compile-time option to completely disable WebArchive support.
+        https://bugs.webkit.org/show_bug.cgi?id=52712
+
+        Add an ENABLE(WEB_ARCHIVE) compile-time setting and use it for all WebArchive code.
+        Ports Affected:
+            WebArchive support is currently enabled for all ports that define PLATFORM(CF) apart from Qt.
+            This patch preserves this behavior except that it also disables support in the Chromium port.
+
+        * wtf/Platform.h: Add ENABLE_WEB_ARCHIVE definition and turn it off explicitly for Qt & Chromium ports.
+
 2011-02-13  Cameron Zwarich  <zwarich@apple.com>
 
         Reviewed by Dan Bernstein.
index d036596..193b76d 100644 (file)
 #define HAVE_RUNLOOP_TIMER 1
 #define ENABLE_FULLSCREEN_API 1
 #define ENABLE_SMOOTH_SCROLLING 1
+#define ENABLE_WEB_ARCHIVE 1
 #endif /* PLATFORM(MAC) && !PLATFORM(IOS) */
 
 #if PLATFORM(MAC)
 #define WTF_PLATFORM_CF 1
 #define WTF_USE_PTHREADS 1
 #define HAVE_PTHREAD_RWLOCK 1
+#define ENABLE_WEB_ARCHIVE 1
 #endif
 
 #if PLATFORM(ANDROID)
 #define WTF_USE_PTHREADS 0
 #endif
 
+#if PLATFORM(WIN) && !OS(WINCE) && !PLATFORM(CHROMIUM) && !PLATFORM(QT)
+#define ENABLE_WEB_ARCHIVE 1
+#endif
+
 #if PLATFORM(WX)
 #define ENABLE_ASSEMBLER 1
 #define ENABLE_GLOBAL_FASTMALLOC_NEW 0
 #define WTF_PLATFORM_CF 1
 #ifndef BUILDING_ON_TIGER
 #define WTF_USE_CORE_TEXT 1
+#define ENABLE_WEB_ARCHIVE 1
 #else
 #define WTF_USE_ATSUI 1
 #endif
 #define ENABLE_SMOOTH_SCROLLING 0
 #endif
 
+#if !defined(ENABLE_WEB_ARCHIVE)
+#define ENABLE_WEB_ARCHIVE 0
+#endif
+
 /* Use the QXmlStreamReader implementation for XMLDocumentParser */
 /* Use the QXmlQuery implementation for XSLTProcessor */
 #if PLATFORM(QT)
index fd28521..fed30b5 100644 (file)
@@ -1,3 +1,43 @@
+2011-02-13  Jeremy Moskovich  <jeremy@chromium.org>
+
+        Reviewed by Adam Barth.
+
+        Add a compile-time option to completely disable WebArchive support.
+        https://bugs.webkit.org/show_bug.cgi?id=52712
+
+        Add an ENABLE(WEB_ARCHIVE) compile-time setting and use it for all WebArchive code.
+
+        ArchiveResource and ArchiveResourceCollection are notably still compiled in. They are used
+        in Safari for functionality such as "Save Image As" and Image copy & paste independent of
+        WebArchive support.
+
+        Ports Affected:
+            WebArchive support is currently enabled for all ports that define PLATFORM(CF) apart from Qt.
+            This patch preserves this behavior except that it also disables support in the Chromium port.
+
+        No behavior changes so no new tests.
+
+        * WebCore.gyp/WebCore.gyp: Don't compile LegacyWebArchive.cpp and friends.
+        * WebCore.pro: Don't compile ArchiveFactory.cpp in Qt port.
+        * loader/DocumentLoader.cpp: Surround WebArchive code with #ifdef.
+        (WebCore::DocumentLoader::commitLoad):
+        (WebCore::DocumentLoader::setupForReplaceByMIMEType):
+        (WebCore::DocumentLoader::archiveResourceForURL):
+        * loader/DocumentLoader.h:
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::loadURLIntoChildFrame):
+        (WebCore::FrameLoader::stopAllLoaders):
+        (WebCore::FrameLoader::finishedLoadingDocument):
+        * loader/FrameLoader.h:
+        * loader/ResourceLoader.cpp:
+        (WebCore::ResourceLoader::start):
+        * loader/archive/ArchiveFactory.cpp: Remove #ifdef since feature is now enabled/disabled wholesale.
+        (WebCore::archiveMIMETypes):
+        * page/Settings.cpp:
+        * page/Settings.h:
+        * platform/MIMETypeRegistry.cpp:
+        (WebCore::initializeSupportedNonImageMimeTypes):
+
 2011-02-13  Aparna Nandyal  <aparna.nand@wipro.com>
 
         Reviewed by Andreas Kling.
index 0d8d06b..b155b50 100644 (file)
           # FIXME: Eliminate dependency on platform/graphics/mac and
           # related directories.
           # platform/graphics/cg may need to stick around, though.
-          '../loader/archive/cf',
           '../platform/audio/mac',
           '../platform/graphics/mac',
           '../platform/mac',
             # Some of these are used instead of Chromium platform files, see
             # the specific exclusions in the "sources!" list below.
             ['include', 'rendering/RenderThemeMac\\.mm$'],
-            ['include', 'loader/archive/cf/LegacyWebArchive\\.cpp$'],
             ['include', 'platform/graphics/mac/ColorMac\\.mm$'],
             ['include', 'platform/graphics/mac/FloatPointMac\\.mm$'],
             ['include', 'platform/graphics/mac/FloatRectMac\\.mm$'],
         # Don't build IDBKeyPathBackendImpl.  We have our own implementation.
         ['exclude', 'storage/IDBKeyPathBackendImpl\\.cpp$'],
 
+        # Don't build files needed for WebArchive support, since we disable
+        # this feature.
+        ['exclude', 'loader/archive/cf/LegacyWebArchive\\.cpp$'],
+        ['exclude', 'loader/archive/cf/LegacyWebArchiveMac\\.mm$'],
+        ['exclude', 'loader/archive/ArchiveFactory\\.cpp$'],
+
         # Use loader/icon/IconDatabaseNone.cpp instead.
         ['exclude', 'loader/icon/IconDatabase\\.cpp$'],
 
index 8f757cf..748c032 100644 (file)
@@ -1091,7 +1091,6 @@ SOURCES += \
     inspector/ScriptCallFrame.cpp \
     inspector/ScriptCallStack.cpp \
     inspector/TimelineRecordFactory.cpp \
-    loader/archive/ArchiveFactory.cpp \
     loader/archive/ArchiveResource.cpp \
     loader/archive/ArchiveResourceCollection.cpp \
     loader/cache/MemoryCache.cpp \
@@ -2010,7 +2009,6 @@ HEADERS += \
     loader/appcache/ApplicationCacheStorage.h \
     loader/appcache/DOMApplicationCache.h \
     loader/appcache/ManifestParser.h \
-    loader/archive/ArchiveFactory.h \
     loader/archive/ArchiveResourceCollection.h \
     loader/archive/ArchiveResource.h \
     loader/cache/CachedCSSStyleSheet.h \
index 207c2b0..e8a7c41 100644 (file)
@@ -30,7 +30,6 @@
 #include "DocumentLoader.h"
 
 #include "ApplicationCacheHost.h"
-#include "ArchiveFactory.h"
 #include "ArchiveResourceCollection.h"
 #include "CachedPage.h"
 #include "CachedResourceLoader.h"
 #include <wtf/text/CString.h>
 #include <wtf/unicode/Unicode.h>
 
+#if ENABLE(WEB_ARCHIVE)
+#include "ArchiveFactory.h"
+#endif
+
 namespace WebCore {
 
 static void cancelAll(const ResourceLoaderSet& loaders)
@@ -292,8 +295,10 @@ void DocumentLoader::commitLoad(const char* data, int length)
     FrameLoader* frameLoader = DocumentLoader::frameLoader();
     if (!frameLoader)
         return;
+#if ENABLE(WEB_ARCHIVE)
     if (ArchiveFactory::isArchiveMimeType(response().mimeType()))
         return;
+#endif
     frameLoader->client()->committedLoad(this, data, length);
 }
 
@@ -350,7 +355,9 @@ void DocumentLoader::setupForReplaceByMIMEType(const String& newMIMEType)
     
     stopLoadingSubresources();
     stopLoadingPlugIns();
+#if ENABLE(WEB_ARCHIVE)
     clearArchiveResources();
+#endif
 }
 
 void DocumentLoader::updateLoading()
@@ -438,6 +445,7 @@ bool DocumentLoader::isLoadingInAPISense() const
     return frameLoader()->subframeIsLoading();
 }
 
+#if ENABLE(WEB_ARCHIVE)
 void DocumentLoader::addAllArchiveResources(Archive* archive)
 {
     if (!m_archiveResourceCollection)
@@ -464,16 +472,6 @@ void DocumentLoader::addArchiveResource(PassRefPtr<ArchiveResource> resource)
     m_archiveResourceCollection->addResource(resource);
 }
 
-ArchiveResource* DocumentLoader::archiveResourceForURL(const KURL& url) const
-{
-    if (!m_archiveResourceCollection)
-        return 0;
-        
-    ArchiveResource* resource = m_archiveResourceCollection->archiveResourceForURL(url);
-
-    return resource && !resource->shouldIgnoreWhenUnarchiving() ? resource : 0;
-}
-
 PassRefPtr<Archive> DocumentLoader::popArchiveForSubframe(const String& frameName)
 {
     return m_archiveResourceCollection ? m_archiveResourceCollection->popSubframeArchive(frameName) : 0;
@@ -494,6 +492,17 @@ SharedBuffer* DocumentLoader::parsedArchiveData() const
 {
     return m_parsedArchiveData.get();
 }
+#endif // ENABLE(WEB_ARCHIVE)
+
+ArchiveResource* DocumentLoader::archiveResourceForURL(const KURL& url) const
+{
+    if (!m_archiveResourceCollection)
+        return 0;
+        
+    ArchiveResource* resource = m_archiveResourceCollection->archiveResourceForURL(url);
+
+    return resource && !resource->shouldIgnoreWhenUnarchiving() ? resource : 0;
+}
 
 PassRefPtr<ArchiveResource> DocumentLoader::mainResource() const
 {
@@ -601,6 +610,7 @@ void DocumentLoader::cancelPendingSubstituteLoad(ResourceLoader* loader)
         m_substituteResourceDeliveryTimer.stop();
 }
 
+#if ENABLE(WEB_ARCHIVE)
 bool DocumentLoader::scheduleArchiveLoad(ResourceLoader* loader, const ResourceRequest& request, const KURL& originalURL)
 {
     ArchiveResource* resource = 0;
@@ -621,6 +631,7 @@ bool DocumentLoader::scheduleArchiveLoad(ResourceLoader* loader, const ResourceR
     
     return true;
 }
+#endif // ENABLE(WEB_ARCHIVE)
 
 void DocumentLoader::addResponse(const ResourceResponse& r)
 {
index cdd5d93..b92b384 100644 (file)
@@ -44,7 +44,9 @@
 namespace WebCore {
 
     class ApplicationCacheHost;
+#if ENABLE(WEB_ARCHIVE)
     class Archive;
+#endif
     class ArchiveResource;
     class ArchiveResourceCollection;
     class Frame;
@@ -127,24 +129,29 @@ namespace WebCore {
         void unschedule(SchedulePair*);
 #endif
 
+#if ENABLE(WEB_ARCHIVE)
         void addAllArchiveResources(Archive*);
         void addArchiveResource(PassRefPtr<ArchiveResource>);
         
-        // Return an ArchiveResource for the URL, either creating from live data or
-        // pulling from the ArchiveResourceCollection
-        PassRefPtr<ArchiveResource> subresource(const KURL&) const;
-        // Return the ArchiveResource for the URL only when loading an Archive
-        ArchiveResource* archiveResourceForURL(const KURL&) const;
-        
         PassRefPtr<Archive> popArchiveForSubframe(const String& frameName);
         void clearArchiveResources();
         void setParsedArchiveData(PassRefPtr<SharedBuffer>);
         SharedBuffer* parsedArchiveData() const;
         
+        bool scheduleArchiveLoad(ResourceLoader*, const ResourceRequest&, const KURL&);
+#endif // ENABLE(WEB_ARCHIVE)
+
+        // Return the ArchiveResource for the URL only when loading an Archive
+        ArchiveResource* archiveResourceForURL(const KURL&) const;
+
         PassRefPtr<ArchiveResource> mainResource() const;
+
+        // Return an ArchiveResource for the URL, either creating from live data or
+        // pulling from the ArchiveResourceCollection
+        PassRefPtr<ArchiveResource> subresource(const KURL&) const;
         void getSubresources(Vector<PassRefPtr<ArchiveResource> >&) const;
-        
-        bool scheduleArchiveLoad(ResourceLoader*, const ResourceRequest&, const KURL&);
+
+
 #ifndef NDEBUG
         bool isSubstituteLoadPending(ResourceLoader*) const;
 #endif
@@ -306,9 +313,11 @@ namespace WebCore {
         typedef HashMap<RefPtr<ResourceLoader>, RefPtr<SubstituteResource> > SubstituteResourceMap;
         SubstituteResourceMap m_pendingSubstituteResources;
         Timer<DocumentLoader> m_substituteResourceDeliveryTimer;
-                
+
         OwnPtr<ArchiveResourceCollection> m_archiveResourceCollection;
+#if ENABLE(WEB_ARCHIVE)
         RefPtr<SharedBuffer> m_parsedArchiveData;
+#endif
 
         HashSet<String> m_resourcesClientKnowsAbout;
         Vector<String> m_resourcesLoadedFromMemoryCacheForClientNotification;
index 9597f72..f3aceb9 100644 (file)
@@ -34,8 +34,6 @@
 #include "FrameLoader.h"
 
 #include "ApplicationCacheHost.h"
-#include "Archive.h"
-#include "ArchiveFactory.h"
 #include "BackForwardController.h"
 #include "BeforeUnloadEvent.h"
 #include "MemoryCache.h"
 #include "SVGViewSpec.h"
 #endif
 
+#if ENABLE(WEB_ARCHIVE)
+#include "Archive.h"
+#include "ArchiveFactory.h"
+#endif
+
 namespace WebCore {
 
 using namespace HTMLNames;
@@ -911,11 +914,13 @@ void FrameLoader::loadURLIntoChildFrame(const KURL& url, const String& referer,
 {
     ASSERT(childFrame);
 
+#if ENABLE(WEB_ARCHIVE)
     RefPtr<Archive> subframeArchive = activeDocumentLoader()->popArchiveForSubframe(childFrame->tree()->uniqueName());    
     if (subframeArchive) {
         childFrame->loader()->loadArchive(subframeArchive.release());
         return;
     }
+#endif // ENABLE(WEB_ARCHIVE)
 
     HistoryItem* parentItem = history()->currentItem();
     // If we're moving in the back/forward list, we might want to replace the content
@@ -931,6 +936,7 @@ void FrameLoader::loadURLIntoChildFrame(const KURL& url, const String& referer,
     childFrame->loader()->loadURL(url, referer, String(), false, FrameLoadTypeRedirectWithLockedBackForwardList, 0, 0);
 }
 
+#if ENABLE(WEB_ARCHIVE)
 void FrameLoader::loadArchive(PassRefPtr<Archive> prpArchive)
 {
     RefPtr<Archive> archive = prpArchive;
@@ -951,6 +957,7 @@ void FrameLoader::loadArchive(PassRefPtr<Archive> prpArchive)
     documentLoader->addAllArchiveResources(archive.get());
     load(documentLoader.get());
 }
+#endif // ENABLE(WEB_ARCHIVE)
 
 ObjectContentType FrameLoader::defaultObjectContentType(const KURL& url, const String& mimeTypeIn)
 {
@@ -1711,8 +1718,10 @@ void FrameLoader::stopAllLoaders(DatabasePolicy databasePolicy, ClearProvisional
 
     setProvisionalDocumentLoader(0);
     
+#if ENABLE(WEB_ARCHIVE)
     if (m_documentLoader)
         m_documentLoader->clearArchiveResources();
+#endif
 
     m_checkTimer.stop();
 
@@ -2228,6 +2237,9 @@ void FrameLoader::finishedLoadingDocument(DocumentLoader* loader)
         return;
 #endif
 
+#if !ENABLE(WEB_ARCHIVE)
+    m_client->finishedLoading(loader);
+#else
     // Give archive machinery a crack at this document. If the MIME type is not an archive type, it will return 0.
     RefPtr<Archive> archive = ArchiveFactory::create(loader->mainResourceData().get(), loader->responseMIMEType());
     if (!archive) {
@@ -2252,6 +2264,7 @@ void FrameLoader::finishedLoadingDocument(DocumentLoader* loader)
     bool encodingIsUserChosen = !userChosenEncoding.isNull();
     loader->writer()->setEncoding(encodingIsUserChosen ? userChosenEncoding : mainResource->textEncoding(), encodingIsUserChosen);
     loader->writer()->addData(mainResource->data()->data(), mainResource->data()->size());
+#endif // ENABLE(WEB_ARCHIVE)
 }
 
 bool FrameLoader::isReplacing() const
index 44a54f5..bb605e7 100644 (file)
@@ -116,8 +116,10 @@ public:
     void load(const ResourceRequest&, bool lockHistory);                                        // Called by WebFrame, calls load(ResourceRequest, SubstituteData).
     void load(const ResourceRequest&, const SubstituteData&, bool lockHistory);                 // Called both by WebFrame and internally, calls load(DocumentLoader*).
     void load(const ResourceRequest&, const String& frameName, bool lockHistory);               // Called by WebPluginController.
-    
+
+#if ENABLE(WEB_ARCHIVE)
     void loadArchive(PassRefPtr<Archive>);
+#endif
 
     static void reportLocalLoadFailed(Frame*, const String& url);
 
index 42ce016..e08e190 100644 (file)
@@ -145,8 +145,10 @@ void ResourceLoader::start()
     ASSERT(!m_request.isNull());
     ASSERT(m_deferredRequest.isNull());
 
+#if ENABLE(WEB_ARCHIVE)
     if (m_documentLoader->scheduleArchiveLoad(this, m_request, m_request.url()))
         return;
+#endif
     
 #if ENABLE(OFFLINE_WEB_APPLICATIONS)
     if (m_documentLoader->applicationCacheHost()->maybeLoadResource(this, m_request, m_request.url()))
index 2e108c5..b02b831 100644 (file)
@@ -60,7 +60,7 @@ static ArchiveMIMETypesMap& archiveMIMETypes()
     if (initialized)
         return mimeTypes;
 
-#if PLATFORM(CF) && !PLATFORM(QT)
+#if PLATFORM(CF)
     mimeTypes.set("application/x-webarchive", archiveFactoryCreate<LegacyWebArchive>);
 #endif
 
index b38611e..8d60812 100644 (file)
@@ -511,10 +511,12 @@ void Settings::setFrameFlatteningEnabled(bool frameFlatteningEnabled)
     m_frameFlatteningEnabled = frameFlatteningEnabled;
 }
 
+#if ENABLE(WEB_ARCHIVE)
 void Settings::setWebArchiveDebugModeEnabled(bool enabled)
 {
     m_webArchiveDebugModeEnabled = enabled;
 }
+#endif
 
 void Settings::setLocalFileContentSniffingEnabled(bool enabled)
 {
index b1a7317..3fc5bbc 100644 (file)
@@ -234,9 +234,11 @@ namespace WebCore {
 
         void setNeedsSiteSpecificQuirks(bool);
         bool needsSiteSpecificQuirks() const { return m_needsSiteSpecificQuirks; }
-        
+
+#if ENABLE(WEB_ARCHIVE)
         void setWebArchiveDebugModeEnabled(bool);
         bool webArchiveDebugModeEnabled() const { return m_webArchiveDebugModeEnabled; }
+#endif
 
         void setLocalFileContentSniffingEnabled(bool);
         bool localFileContentSniffingEnabled() const { return m_localFileContentSniffingEnabled; }
index 713395b..3d769de 100644 (file)
@@ -27,7 +27,6 @@
 #include "config.h"
 #include "MIMETypeRegistry.h"
 
-#include "ArchiveFactory.h"
 #include "MediaPlayer.h"
 #include <wtf/HashMap.h>
 #include <wtf/HashSet.h>
 #include <qimagewriter.h>
 #endif
 
+#if ENABLE(WEB_ARCHIVE)
+#include "ArchiveFactory.h"
+#endif
+
 namespace WebCore {
 
 static HashSet<String>* supportedImageResourceMIMETypes;
@@ -225,7 +228,9 @@ static void initializeSupportedNonImageMimeTypes()
     for (size_t i = 0; i < WTF_ARRAY_LENGTH(types); ++i)
         supportedNonImageMIMETypes->add(types[i]);
 
+#if ENABLE(WEB_ARCHIVE)
     ArchiveFactory::registerKnownArchiveMIMETypes();
+#endif
 }
 
 static MediaMIMETypeMap& mediaMIMETypeMap()
index b57a077..507eec0 100644 (file)
@@ -1,3 +1,15 @@
+2011-02-13  Jeremy Moskovich  <jeremy@chromium.org>
+
+        Reviewed by Adam Barth.
+
+        Add a compile-time option to completely disable WebArchive support.
+        https://bugs.webkit.org/show_bug.cgi?id=52712
+
+        Add an ENABLE(WEB_ARCHIVE) compile-time setting and use it for all WebArchive code.
+
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::updatePreferences):
+
 2011-02-13  Alexey Proskuryakov  <ap@apple.com>
 
         Reviewed by Dan Bernstein.
index cb34132..462d352 100644 (file)
@@ -1344,7 +1344,9 @@ void WebPage::updatePreferences(const WebPreferencesStore& store)
     settings->setJavaScriptCanOpenWindowsAutomatically(store.getBoolValueForKey(WebPreferencesKey::javaScriptCanOpenWindowsAutomaticallyKey()));
     settings->setForceFTPDirectoryListings(store.getBoolValueForKey(WebPreferencesKey::forceFTPDirectoryListingsKey()));
     settings->setDNSPrefetchingEnabled(store.getBoolValueForKey(WebPreferencesKey::dnsPrefetchingEnabledKey()));
+#if ENABLE(WEB_ARCHIVE)
     settings->setWebArchiveDebugModeEnabled(store.getBoolValueForKey(WebPreferencesKey::webArchiveDebugModeEnabledKey()));
+#endif
     settings->setLocalFileContentSniffingEnabled(store.getBoolValueForKey(WebPreferencesKey::localFileContentSniffingEnabledKey()));
     settings->setUsesPageCache(store.getBoolValueForKey(WebPreferencesKey::usesPageCacheKey()));
     settings->setAuthorAndUserStylesEnabled(store.getBoolValueForKey(WebPreferencesKey::authorAndUserStylesEnabledKey()));