WebKit2 does not have application cache
authorandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 19 Jul 2010 15:29:25 +0000 (15:29 +0000)
committerandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 19 Jul 2010 15:29:25 +0000 (15:29 +0000)
https://bugs.webkit.org/show_bug.cgi?id=42552

Reviewed by Adam Roben.

WebKit2:

* Shared/CoreIPCSupport/WebProcessMessageKinds.h:
(WebProcessMessage::):
Add SetApplicationCacheDirectory.

* Shared/WebPreferencesStore.h:
(WebKit::WebPreferencesStore::encode):
(WebKit::WebPreferencesStore::decode):
add offlineWebApplicationCacheEnabled.

* UIProcess/API/C/WKPreferences.cpp:
(WKPreferencesSetOfflineWebApplicationCacheEnabled):
(WKPreferencesGetOfflineWebApplicationCacheEnabled):
* UIProcess/API/C/WKPreferences.h:
Add getters/setters for whether the application cache is enabled.

* UIProcess/WebContext.h:
* UIProcess/WebPreferences.cpp:
(WebKit::WebPreferences::setOfflineWebApplicationCacheEnabled):
Update the store and call update().

* UIProcess/WebPreferences.h:
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::WebProcessProxy):
Ask the web process to set the application cache directory.

* UIProcess/mac/WebContextMac.mm: Added.
(WebKit::WebContext::applicationCacheDirectory):
Return the application cache directory.

* UIProcess/win/WebContextWin.cpp: Added.
(WebKit::WebContext::applicationCacheDirectory):
Ditto.

* WebKit2.xcodeproj/project.pbxproj:
Add WebContextMac.mm

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

(WebKit::WebPage::didReceiveMessage):
Handle PreferencesDidChange. Get rid of the default: case statement so we'll
get warnings if we have unhandled message kinds.

* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::setApplicationCacheDirectory):
Set the application cache directory.

(WebKit::WebProcess::didReceiveMessage):
Handle SetApplicationCacheDirectory.

win/WebKit2.vcproj:
Add WebContextWin.cpp

WebKitTools:

* WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::resetPreferencesToConsistentValues):
Set up default preferences. Right now just enables the web application cache.

(WTR::TestInvocation::invoke):
Call resetPreferencesToConsistentValues.

* WebKitTestRunner/TestInvocation.h:

LayoutTests:

* platform/mac-wk2/Skipped:
Remove http/tests/appcache from skipped list.

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

21 files changed:
LayoutTests/ChangeLog
LayoutTests/platform/mac-wk2/Skipped
WebKit2/ChangeLog
WebKit2/Shared/CoreIPCSupport/WebProcessMessageKinds.h
WebKit2/Shared/WebPreferencesStore.h
WebKit2/UIProcess/API/C/WKPreferences.cpp
WebKit2/UIProcess/API/C/WKPreferences.h
WebKit2/UIProcess/WebContext.h
WebKit2/UIProcess/WebPreferences.cpp
WebKit2/UIProcess/WebPreferences.h
WebKit2/UIProcess/WebProcessProxy.cpp
WebKit2/UIProcess/mac/WebContextMac.mm [new file with mode: 0644]
WebKit2/UIProcess/win/WebContextWin.cpp [new file with mode: 0644]
WebKit2/WebKit2.xcodeproj/project.pbxproj
WebKit2/WebProcess/WebPage/WebPage.cpp
WebKit2/WebProcess/WebProcess.cpp
WebKit2/WebProcess/WebProcess.h
WebKit2/win/WebKit2.vcproj
WebKitTools/ChangeLog
WebKitTools/WebKitTestRunner/TestInvocation.cpp
WebKitTools/WebKitTestRunner/TestInvocation.h

index f557f0bc62cdf4c4cb5af067fb62b2c233f51c05..ee7bcd44de63a0b57cef75a65d4c01187c709b71 100644 (file)
@@ -1,3 +1,13 @@
+2010-07-19  Anders Carlsson  <andersca@apple.com>
+
+        Reviewed by Adam Roben.
+
+        WebKit2 does not have application cache
+        https://bugs.webkit.org/show_bug.cgi?id=42552
+
+        * platform/mac-wk2/Skipped:
+        Remove http/tests/appcache from skipped list.
+
 2010-07-19  Yury Semikhatsky  <yurys@chromium.org>
 
         Reviewed by Pavel Feldman.
index 8d8ab4e144f6c716589adf421b1d0d6168567870..e1e143c392af3cc67b1eb6ee708e8afa945ecc61 100644 (file)
@@ -2312,7 +2312,3 @@ transitions/transition-drt-api.html
 transitions/transition-hit-test.html
 transitions/transition-hit-test-transform.html
 transitions/transition-shorthand-delay.html
-
-# WebKit2 does not have application cache
-# <https://bugs.webkit.org/show_bug.cgi?id=42552>
-http/tests/appcache
index 94fb35c33376ec4f4846af9e405381069c10f017..0aca7d9dfd3c314e8eb1406cd8d1b936317c7738 100644 (file)
@@ -1,3 +1,63 @@
+2010-07-19  Anders carlsson  <andersca@apple.com>
+
+        Reviewed by Adam Roben.
+
+        WebKit2 does not have application cache
+        https://bugs.webkit.org/show_bug.cgi?id=42552
+
+        * Shared/CoreIPCSupport/WebProcessMessageKinds.h:
+        (WebProcessMessage::):
+        Add SetApplicationCacheDirectory.
+
+        * Shared/WebPreferencesStore.h:
+        (WebKit::WebPreferencesStore::encode):
+        (WebKit::WebPreferencesStore::decode):
+        add offlineWebApplicationCacheEnabled.
+
+        * UIProcess/API/C/WKPreferences.cpp:
+        (WKPreferencesSetOfflineWebApplicationCacheEnabled):
+        (WKPreferencesGetOfflineWebApplicationCacheEnabled):
+        * UIProcess/API/C/WKPreferences.h:
+        Add getters/setters for whether the application cache is enabled.
+
+        * UIProcess/WebContext.h:
+        * UIProcess/WebPreferences.cpp:
+        (WebKit::WebPreferences::setOfflineWebApplicationCacheEnabled):
+        Update the store and call update().
+        
+        * UIProcess/WebPreferences.h:
+        * UIProcess/WebProcessProxy.cpp:
+        (WebKit::WebProcessProxy::WebProcessProxy):
+        Ask the web process to set the application cache directory.
+
+        * UIProcess/mac/WebContextMac.mm: Added.
+        (WebKit::WebContext::applicationCacheDirectory):
+        Return the application cache directory.
+
+        * UIProcess/win/WebContextWin.cpp: Added.
+        (WebKit::WebContext::applicationCacheDirectory):
+        Ditto.
+
+        * WebKit2.xcodeproj/project.pbxproj:
+        Add WebContextMac.mm
+
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::preferencesDidChange):
+        
+        (WebKit::WebPage::didReceiveMessage):
+        Handle PreferencesDidChange. Get rid of the default: case statement so we'll
+        get warnings if we have unhandled message kinds.
+
+        * WebProcess/WebProcess.cpp:
+        (WebKit::WebProcess::setApplicationCacheDirectory):
+        Set the application cache directory.
+
+        (WebKit::WebProcess::didReceiveMessage):
+        Handle SetApplicationCacheDirectory.
+
+        win/WebKit2.vcproj:
+        Add WebContextWin.cpp
+
 2010-07-18  Anders Carlsson  <andersca@apple.com>
 
         Another attempt at fixing the Windows build.
index 0e4cf44fcf5cdf0e213957276cebef571d05a2cd..d09a043341d163e0f5c99390bf8deba3fc72318d 100644 (file)
@@ -34,6 +34,7 @@ namespace WebProcessMessage {
 
 enum Kind {
     LoadInjectedBundle,
+    SetApplicationCacheDirectory,
     Create,
     PostMessage,
 #if PLATFORM(MAC)
index 52d2536482032f2b1356c37c8dac99c5b5b3a249..0ef0f52b5b461f69cd89549f441779c0eab7301f 100644 (file)
@@ -44,6 +44,7 @@ struct WebPreferencesStore {
         encoder.encode(javaScriptEnabled);
         encoder.encode(loadsImagesAutomatically);
         encoder.encode(pluginsEnabled);
+        encoder.encode(offlineWebApplicationCacheEnabled);
         encoder.encode(minimumFontSize);
         encoder.encode(minimumLogicalFontSize);
         encoder.encode(defaultFontSize);
@@ -64,6 +65,8 @@ struct WebPreferencesStore {
             return false;
         if (!decoder.decode(s.pluginsEnabled))
             return false;
+        if (!decoder.decode(s.offlineWebApplicationCacheEnabled))
+            return false;
         if (!decoder.decode(s.minimumFontSize))
             return false;
         if (!decoder.decode(s.minimumLogicalFontSize))
@@ -90,7 +93,8 @@ struct WebPreferencesStore {
     bool javaScriptEnabled;
     bool loadsImagesAutomatically;
     bool pluginsEnabled;
-    
+    bool offlineWebApplicationCacheEnabled;
+
     uint32_t minimumFontSize;
     uint32_t minimumLogicalFontSize;
     uint32_t defaultFontSize;
index 6eeb4d513da95e975c2620759cd2a0539037bc46..2228ff89cdbfdc25d9b570de9f9d99a2df8b128b 100644 (file)
@@ -64,6 +64,16 @@ bool WKPreferencesGetLoadsImagesAutomatically(WKPreferencesRef preferencesRef)
     return toWK(preferencesRef)->loadsImagesAutomatically();
 }
 
+void WKPreferencesSetOfflineWebApplicationCacheEnabled(WKPreferencesRef preferencesRef, bool offlineWebApplicationCacheEnabled)
+{
+    toWK(preferencesRef)->setOfflineWebApplicationCacheEnabled(offlineWebApplicationCacheEnabled);
+}
+
+bool WKPreferencesGetOfflineWebApplicationCacheEnabled(WKPreferencesRef preferencesRef)
+{
+    return toWK(preferencesRef)->offlineWebApplicationCacheEnabled();
+}
+
 WKPreferencesRef WKPreferencesRetain(WKPreferencesRef preferencesRef)
 {
     toWK(preferencesRef)->ref();
index cdc4086b89f97425e48976ab54af796dd9dd4f17..f86154221276725fff82ce9618836b69f5403acc 100644 (file)
@@ -43,6 +43,8 @@ WK_EXPORT void WKPreferencesSetJavaScriptEnabled(WKPreferencesRef preferences, b
 WK_EXPORT bool WKPreferencesGetJavaScriptEnabled(WKPreferencesRef preferences);
 WK_EXPORT void WKPreferencesSetLoadsImagesAutomatically(WKPreferencesRef preferences, bool loadsImagesAutomatically);
 WK_EXPORT bool WKPreferencesGetLoadsImagesAutomatically(WKPreferencesRef preferences);
+WK_EXPORT void WKPreferencesSetOfflineWebApplicationCacheEnabled(WKPreferencesRef preferences, bool offlineWebApplicationCacheEnabled);
+WK_EXPORT bool WKPreferencesGetOfflineWebApplicationCacheEnabled(WKPreferencesRef preferences);
 
 WK_EXPORT WKPreferencesRef WKPreferencesRetain(WKPreferencesRef preferences);
 WK_EXPORT void WKPreferencesRelease(WKPreferencesRef preferences);
index 08b46f0be5407d4bf560300fa254d7a72127c95b..22d96c074a26e534781dda40c5c69939cdad8d9d 100644 (file)
@@ -84,6 +84,7 @@ public:
     void setAdditionalPluginPath(const WebCore::String&);
 
     PluginInfoStore* pluginInfoStore() { return &m_pluginInfoStore; }
+    WebCore::String applicationCacheDirectory();
 
 private:
     WebContext(ProcessModel, const WebCore::String& injectedBundlePath);
index 612849c564c60e05d86b6245b1da10b0a061c84c..5d7dc0f3587290d8b580bd4bc87bbb8d6a64de27 100644 (file)
@@ -86,4 +86,15 @@ bool WebPreferences::loadsImagesAutomatically() const
     return m_store.loadsImagesAutomatically;
 }
 
+void WebPreferences::setOfflineWebApplicationCacheEnabled(bool b)
+{
+    m_store.offlineWebApplicationCacheEnabled = b;
+    update();
+}
+    
+bool WebPreferences::offlineWebApplicationCacheEnabled() const
+{
+    return m_store.offlineWebApplicationCacheEnabled;
+}
+
 } // namespace WebKit
index f6d1163abf9fcdcb04ec8ebc9cb0942899aaca5a..89ed11b72f4beaa844483aba6ee2c5963ac3e578 100644 (file)
@@ -61,6 +61,9 @@ public:
     void setLoadsImagesAutomatically(bool);
     bool loadsImagesAutomatically() const;
 
+    void setOfflineWebApplicationCacheEnabled(bool);
+    bool offlineWebApplicationCacheEnabled() const;
+
 private:
     WebPreferences();
     WebPreferences(WebPreferences*);
index 9101f7bfe4b80de6442c797731fd81e1b46d7e74..61c9ccae65f6e5ea11c66c96900067f34b245aca 100644 (file)
@@ -58,6 +58,10 @@ WebProcessProxy::WebProcessProxy(WebContext* context)
 {
     connect();
 
+    // FIXME: Instead of sending three separate initialization related messages here, we should just send a
+    // single "Initialize" messages with a struct that has all the needed information.
+    send(WebProcessMessage::SetApplicationCacheDirectory, 0, CoreIPC::In(m_context->applicationCacheDirectory()));
+
     // FIXME: We could instead send the bundle path as part of the arguments to process creation?
     // Would that be better than sending a connection?
     if (!context->injectedBundlePath().isEmpty())
@@ -66,6 +70,7 @@ WebProcessProxy::WebProcessProxy(WebContext* context)
 #if USE(ACCELERATED_COMPOSITING)
     setUpAcceleratedCompositing();
 #endif
+
 }
 
 WebProcessProxy::~WebProcessProxy()
diff --git a/WebKit2/UIProcess/mac/WebContextMac.mm b/WebKit2/UIProcess/mac/WebContextMac.mm
new file mode 100644 (file)
index 0000000..3c5bdd6
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "WebContext.h"
+
+#include <sys/param.h>
+
+using namespace WebCore;
+
+NSString *WebKitLocalCacheDefaultsKey = @"WebKitLocalCache";
+
+namespace WebKit {
+
+String WebContext::applicationCacheDirectory()
+{
+    NSString *appName = [[NSBundle mainBundle] bundleIdentifier];
+    if (!appName)
+        appName = [[NSProcessInfo processInfo] processName];
+    
+    ASSERT(appName);
+    
+    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
+    NSString *cacheDir = [defaults objectForKey:WebKitLocalCacheDefaultsKey];
+
+    if (!cacheDir || ![cacheDir isKindOfClass:[NSString class]]) {
+#ifdef BUILDING_ON_TIGER
+        cacheDir = [NSHomeDirectory() stringByAppendingPathComponent:@"Library/Caches"];
+#else
+        char cacheDirectory[MAXPATHLEN];
+        size_t cacheDirectoryLen = confstr(_CS_DARWIN_USER_CACHE_DIR, cacheDirectory, MAXPATHLEN);
+    
+        if (cacheDirectoryLen)
+            cacheDir = [[NSFileManager defaultManager] stringWithFileSystemRepresentation:cacheDirectory length:cacheDirectoryLen - 1];
+#endif
+    }
+
+    return [cacheDir stringByAppendingPathComponent:appName];
+}
+
+} // namespace WebKit
+
diff --git a/WebKit2/UIProcess/win/WebContextWin.cpp b/WebKit2/UIProcess/win/WebContextWin.cpp
new file mode 100644 (file)
index 0000000..cb83fb0
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "WebContext.h"
+
+#include <WebCore/FileSystem.h>
+
+using namespace WebCore;
+
+namespace WebKit {
+
+String WebContext::applicationCacheDirectory()
+{
+    return localUserSpecificStorageDirectory();
+}
+
+} // namespace WebKit
+
index 341870edb9bb202e24088985eabfb70e7d6556c4..fe6344fa87995b8fb16908838ba93c55996bb51f 100644 (file)
@@ -32,6 +32,7 @@
                0F52667411DD4A490006D33C /* WebProcessProxyMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0F52667311DD4A490006D33C /* WebProcessProxyMac.mm */; };
                1A10475A110A5AD500A43ECD /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1AA1C7DE100E846E0078DEBC /* JavaScriptCore.framework */; };
                1A1C4EC810D06099005E67E7 /* WebCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1AA1C79A100E7FC50078DEBC /* WebCore.framework */; };
+               1A1C649B11F4174200553C19 /* WebContextMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A1C648611F415B700553C19 /* WebContextMac.mm */; };
                1A2161B011F37664008AD0F5 /* NPJSObjectMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A2161AE11F37664008AD0F5 /* NPJSObjectMap.h */; };
                1A2161B111F37664008AD0F5 /* NPJSObjectMap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A2161AF11F37664008AD0F5 /* NPJSObjectMap.cpp */; };
                1A2162B011F38971008AD0F5 /* NPRuntimeUtilities.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A2162AE11F38971008AD0F5 /* NPRuntimeUtilities.cpp */; };
                0F5265BB11DD37860006D33C /* LayerBackedDrawingAreaProxyMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = LayerBackedDrawingAreaProxyMac.mm; sourceTree = "<group>"; };
                0F52667311DD4A490006D33C /* WebProcessProxyMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebProcessProxyMac.mm; sourceTree = "<group>"; };
                1058C7B1FEA5585E11CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
+               1A1C648611F415B700553C19 /* WebContextMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebContextMac.mm; sourceTree = "<group>"; };
                1A2161AE11F37664008AD0F5 /* NPJSObjectMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NPJSObjectMap.h; sourceTree = "<group>"; };
                1A2161AF11F37664008AD0F5 /* NPJSObjectMap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NPJSObjectMap.cpp; sourceTree = "<group>"; };
                1A2162AE11F38971008AD0F5 /* NPRuntimeUtilities.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NPRuntimeUtilities.cpp; sourceTree = "<group>"; };
                                BC2651F511825EF800243E12 /* ChunkedUpdateDrawingAreaProxyMac.mm */,
                                0F5265BB11DD37860006D33C /* LayerBackedDrawingAreaProxyMac.mm */,
                                0F52667311DD4A490006D33C /* WebProcessProxyMac.mm */,
+                               1A1C648611F415B700553C19 /* WebContextMac.mm */,
                        );
                        path = mac;
                        sourceTree = "<group>";
                                BC0092F8115837A300E0AE2A /* WorkQueueMac.cpp in Sources */,
                                1A2161B111F37664008AD0F5 /* NPJSObjectMap.cpp in Sources */,
                                1A2162B011F38971008AD0F5 /* NPRuntimeUtilities.cpp in Sources */,
+                               1A1C649B11F4174200553C19 /* WebContextMac.mm in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
index 0ace2a23b09a80a2245ba7cc544dfdbc1c49c988..e260f5d77fc2e706a4b2a0c1f60013cf6eb9d14e 100644 (file)
@@ -327,6 +327,7 @@ void WebPage::preferencesDidChange(const WebPreferencesStore& store)
 {
     m_page->settings()->setJavaScriptEnabled(store.javaScriptEnabled);
     m_page->settings()->setLoadsImagesAutomatically(store.loadsImagesAutomatically);
+    m_page->settings()->setOfflineWebApplicationCacheEnabled(store.offlineWebApplicationCacheEnabled);
 }
 
 bool WebPage::handleEditingKeyboardEvent(KeyboardEvent* evt)
@@ -374,7 +375,7 @@ void WebPage::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::Messag
                 return;
          
             setActive(active);
-            break;
+            return;
         }
         case WebPageMessage::SetFocused: {
             bool focused;
@@ -382,7 +383,7 @@ void WebPage::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::Messag
                 return;
             
             setFocused(focused);
-            break;
+            return;
         }
         case WebPageMessage::SetIsInWindow: {
             bool isInWindow;
@@ -390,7 +391,7 @@ void WebPage::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::Messag
                 return;
             
             setIsInWindow(isInWindow);
-            break;
+            return;
         }
         case WebPageMessage::MouseEvent: {
             WebMouseEvent event;
@@ -399,7 +400,15 @@ void WebPage::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::Messag
             connection->send(WebPageProxyMessage::DidReceiveEvent, m_pageID, CoreIPC::In((uint32_t)event.type()));
             PlatformMouseEvent platformEvent = platform(event);
             mouseEvent(platformEvent);
-            break;
+            return;
+        }
+        case WebPageMessage::PreferencesDidChange: {
+            WebPreferencesStore store;
+            if (!arguments.decode(store))
+                return;
+            
+            preferencesDidChange(store);
+            return;
         }
         case WebPageMessage::WheelEvent: {
             WebWheelEvent event;
@@ -408,7 +417,7 @@ void WebPage::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::Messag
             connection->send(WebPageProxyMessage::DidReceiveEvent, m_pageID, CoreIPC::In((uint32_t)event.type()));
             PlatformWheelEvent platformEvent = platform(event);
             wheelEvent(platformEvent);
-            break;
+            return;
         }
         case WebPageMessage::KeyEvent: {
             WebKeyboardEvent event;
@@ -417,7 +426,7 @@ void WebPage::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::Messag
             connection->send(WebPageProxyMessage::DidReceiveEvent, m_pageID, CoreIPC::In((uint32_t)event.type()));
             PlatformKeyboardEvent platformEvent = platform(event);
             keyEvent(platformEvent);
-            break;
+            return;
         }
         case WebPageMessage::LoadURL: {
             String url;
@@ -425,7 +434,7 @@ void WebPage::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::Messag
                 return;
             
             loadURL(url);
-            break;
+            return;
         }
         case WebPageMessage::StopLoading:
             stopLoading();
@@ -436,28 +445,28 @@ void WebPage::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::Messag
                 return;
 
             reload(reloadFromOrigin);
-            break;
+            return;
         }
         case WebPageMessage::GoForward: {
             uint64_t backForwardItemID;
             if (!arguments.decode(CoreIPC::Out(backForwardItemID)))
                 return;
             goForward(backForwardItemID);
-            break;
+            return;
         }
         case WebPageMessage::GoBack: {
             uint64_t backForwardItemID;
             if (!arguments.decode(CoreIPC::Out(backForwardItemID)))
                 return;
             goBack(backForwardItemID);
-            break;
+            return;
         }
        case WebPageMessage::GoToBackForwardItem: {
             uint64_t backForwardItemID;
             if (!arguments.decode(CoreIPC::Out(backForwardItemID)))
                 return;
             goToBackForwardItem(backForwardItemID);
-            break;
+            return;
         }
         case WebPageMessage::DidReceivePolicyDecision: {
             uint64_t frameID;
@@ -466,7 +475,7 @@ void WebPage::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::Messag
             if (!arguments.decode(CoreIPC::Out(frameID, listenerID, policyAction)))
                 return;
             didReceivePolicyDecision(webFrame(frameID), listenerID, (WebCore::PolicyAction)policyAction);
-            break;
+            return;
         }
         case WebPageMessage::RunJavaScriptInMainFrame: {
             String script;
@@ -474,27 +483,26 @@ void WebPage::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::Messag
             if (!arguments.decode(CoreIPC::Out(script, callbackID)))
                 return;
             runJavaScriptInMainFrame(script, callbackID);
-            break;
+            return;
         }
         case WebPageMessage::GetRenderTreeExternalRepresentation: {
             uint64_t callbackID;
             if (!arguments.decode(callbackID))
                 return;
             getRenderTreeExternalRepresentation(callbackID);
-            break;
+            return;
         }
         case WebPageMessage::Close: {
             close();
-            break;
+            return;
         }
         case WebPageMessage::TryClose: {
             tryClose();
-            break;
+            return;
         }
-        default:
-            ASSERT_NOT_REACHED();
-            break;
     }
+
+    ASSERT_NOT_REACHED();
 }
 
 } // namespace WebKit
index 17a1094d9f7e952df83b20cd94da657b08deb8b2..142f20b61e2171a50a22d67b6e169e4ea7bcc29b 100644 (file)
@@ -36,6 +36,7 @@
 #include "WebPlatformStrategies.h"
 #include "WebPreferencesStore.h"
 #include "WebProcessMessageKinds.h"
+#include <WebCore/ApplicationCacheStorage.h>
 #include <wtf/PassRefPtr.h>
 
 #ifndef NDEBUG
@@ -87,6 +88,11 @@ void WebProcess::loadInjectedBundle(const String& path)
     }
 }
 
+void WebProcess::setApplicationCacheDirectory(const String& directory)
+{
+    cacheStorage().setCacheDirectory(directory);
+}
+
 void WebProcess::forwardMessageToInjectedBundle(const String& message)
 {
     if (!m_injectedBundle)
@@ -159,6 +165,14 @@ void WebProcess::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::Mes
                 loadInjectedBundle(path);
                 return;
             }
+            case WebProcessMessage::SetApplicationCacheDirectory: {
+                String directory;
+                if (!arguments->decode(CoreIPC::Out(directory)))
+                    return;
+                
+                setApplicationCacheDirectory(directory);
+                return;
+            }
             case WebProcessMessage::Create: {
                 uint64_t pageID = arguments->destinationID();
                 IntSize viewSize;
index 852d09a9194d4e0943c3abe72795fccb595179ee..cb54625dd112fe22fc1028444906975eed6835c8 100644 (file)
@@ -67,6 +67,7 @@ private:
     void shutdown();
 
     void loadInjectedBundle(const WebCore::String&);
+    void setApplicationCacheDirectory(const WebCore::String&);
     void forwardMessageToInjectedBundle(const WebCore::String&);
 
     // CoreIPC::Connection::Client
index a86c5f69a05096004c48a2fd5f93ff18e95713c0..44bfc79ded635e5430d264f58fcc91a6dfa335cb 100755 (executable)
                                        RelativePath="..\UIProcess\win\ChunkedUpdateDrawingAreaProxyWin.cpp"\r
                                        >\r
                                </File>\r
+                               <File\r
+                                       RelativePath="..\UIProcess\win\WebContextWin.cpp"\r
+                                       >\r
+                               </File>\r
                                <File\r
                                        RelativePath="..\UIProcess\win\WebView.cpp"\r
                                        >\r
index 269340f495483a4637abd75799b6201e4d49f878..92ca4330af31bda7ca62dd2b20ce77bafe2de738 100644 (file)
@@ -1,3 +1,19 @@
+2010-07-19  Anders carlsson  <andersca@apple.com>
+
+        Reviewed by Adam Roben.
+
+        WebKit2 does not have application cache
+        https://bugs.webkit.org/show_bug.cgi?id=42552
+
+        * WebKitTestRunner/TestInvocation.cpp:
+        (WTR::TestInvocation::resetPreferencesToConsistentValues):
+        Set up default preferences. Right now just enables the web application cache.
+
+        (WTR::TestInvocation::invoke):
+        Call resetPreferencesToConsistentValues.
+
+        * WebKitTestRunner/TestInvocation.h:
+
 2010-07-19  Kent Tamura  <tkent@chromium.org>
 
         Reviewed by Adam Roben.
index e4e4dc614d8eb29fcc82d879c8caaf2a9aeff6d0..1434d508161d54955159c7afb90483fa22a10bfc 100644 (file)
@@ -96,9 +96,18 @@ static void sizeWebViewForCurrentTest(char* pathOrURL)
         TestController::shared().mainWebView()->resizeTo(normalWidth, normalHeight);
 }
 
+void TestInvocation::resetPreferencesToConsistentValues()
+{
+    WKPreferencesRef preferences = WKContextGetPreferences(TestController::shared().context());
+    
+    WKPreferencesSetOfflineWebApplicationCacheEnabled(preferences, true);
+}
+
 void TestInvocation::invoke()
 {
     sizeWebViewForCurrentTest(m_pathOrURL);
+    resetPreferencesToConsistentValues();
+
     WKRetainPtr<WKStringRef> message(AdoptWK, WKStringCreateWithCFString(CFSTR("BeginTest")));
     WKContextPostMessageToInjectedBundle(TestController::shared().context(), message.get());
 
index ea1e8406269938456ace1f62615bd598974adda2..b5fc041a44b3ba7c340df86ce456e88d587017d5 100644 (file)
@@ -42,6 +42,8 @@ public:
 private:
     void dump(const char*);
 
+    void resetPreferencesToConsistentValues();
+
     // Helper
     static void runUntil(bool& done);