Diff
Modified: trunk/Source/WebKit2/ChangeLog (168624 => 168625)
--- trunk/Source/WebKit2/ChangeLog 2014-05-12 17:56:17 UTC (rev 168624)
+++ trunk/Source/WebKit2/ChangeLog 2014-05-12 17:56:42 UTC (rev 168625)
@@ -1,3 +1,61 @@
+2014-05-11 Anders Carlsson <ander...@apple.com>
+
+ Replace WKContextSetLocalStorageDirectory with a context configuration getter/setter
+ https://bugs.webkit.org/show_bug.cgi?id=132809
+
+ Reviewed by Dan Bernstein.
+
+ * UIProcess/API/C/WKContext.cpp:
+ (WKContextSetLocalStorageDirectory): Deleted.
+
+ * UIProcess/API/C/WKContextConfigurationRef.cpp:
+ (WKContextConfigurationCopyLocalStorageDirectory):
+ (WKContextConfigurationSetLocalStorageDirectory):
+ * UIProcess/API/C/WKContextConfigurationRef.h:
+ Add getters and setters for the local storage directory.
+
+ * UIProcess/API/C/WKContextPrivate.h:
+ Remove WKContextSetLocalStorageDirectory.
+
+ * UIProcess/API/Cocoa/WKProcessGroup.mm:
+ (-[WKProcessGroup initWithInjectedBundleURL:]):
+ Call WebContext::applyPlatformSpecificConfigurationDefaults.
+
+ * UIProcess/API/Cocoa/WKProcessPool.mm:
+ (-[WKProcessPool _initWithConfiguration:]):
+ Call WebContext::applyPlatformSpecificConfigurationDefaults (for now).
+
+ * UIProcess/APIContextConfiguration.cpp:
+ (API::ContextConfiguration::webContextConfiguration):
+ Set the local storage. Also, call WebContext::applyPlatformSpecificConfigurationDefaults.
+
+ * UIProcess/APIContextConfiguration.h:
+ (API::ContextConfiguration::injectedBundlePath):
+ This should be const.
+
+ (API::ContextConfiguration::localStorageDirectory):
+ (API::ContextConfiguration::setLocalStorageDirectory):
+ Add getter and setter.
+
+ * UIProcess/Storage/StorageManager.cpp:
+ (WebKit::StorageManager::setLocalStorageDirectory):
+ ASSERT that the path isn't null.
+
+ * UIProcess/WebContext.cpp:
+ (WebKit::WebContext::applyPlatformSpecificConfigurationDefaults):
+ New helper function that will fill in platform specific defaults for empty parameters.
+
+ (WebKit::WebContext::WebContext):
+ Get the local storage directory from the configuration.
+
+ (WebKit::WebContext::setLocalStorageDirectory): Deleted.
+ (WebKit::WebContext::localStorageDirectory): Deleted.
+ These are no longer needed.
+
+ * UIProcess/mac/WebContextMac.mm:
+ (WebKit::WebContext::platformDefaultLocalStorageDirectory):
+ This should be a static member function.
+
2014-05-12 Martin Hodovan <mhodovan.u-sze...@partner.samsung.com>
Typo fix in generate-forwarding-headers
Modified: trunk/Source/WebKit2/UIProcess/API/C/WKContext.cpp (168624 => 168625)
--- trunk/Source/WebKit2/UIProcess/API/C/WKContext.cpp 2014-05-12 17:56:17 UTC (rev 168624)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKContext.cpp 2014-05-12 17:56:42 UTC (rev 168625)
@@ -492,11 +492,6 @@
toImpl(contextRef)->setDatabaseDirectory(toImpl(databaseDirectory)->string());
}
-void WKContextSetLocalStorageDirectory(WKContextRef contextRef, WKStringRef localStorageDirectory)
-{
- toImpl(contextRef)->setLocalStorageDirectory(toImpl(localStorageDirectory)->string());
-}
-
WK_EXPORT void WKContextSetDiskCacheDirectory(WKContextRef contextRef, WKStringRef diskCacheDirectory)
{
toImpl(contextRef)->setDiskCacheDirectory(toImpl(diskCacheDirectory)->string());
Modified: trunk/Source/WebKit2/UIProcess/API/C/WKContextConfigurationRef.cpp (168624 => 168625)
--- trunk/Source/WebKit2/UIProcess/API/C/WKContextConfigurationRef.cpp 2014-05-12 17:56:17 UTC (rev 168624)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKContextConfigurationRef.cpp 2014-05-12 17:56:42 UTC (rev 168625)
@@ -45,3 +45,13 @@
{
toImpl(configuration)->setInjectedBundlePath(toImpl(injectedBundlePath)->string());
}
+
+WKStringRef WKContextConfigurationCopyLocalStorageDirectory(WKContextConfigurationRef configuration)
+{
+ return toCopiedAPI(toImpl(configuration)->localStorageDirectory());
+}
+
+void WKContextConfigurationSetLocalStorageDirectory(WKContextConfigurationRef configuration, WKStringRef localStorageDirectory)
+{
+ toImpl(configuration)->setLocalStorageDirectory(toImpl(localStorageDirectory)->string());
+}
Modified: trunk/Source/WebKit2/UIProcess/API/C/WKContextConfigurationRef.h (168624 => 168625)
--- trunk/Source/WebKit2/UIProcess/API/C/WKContextConfigurationRef.h 2014-05-12 17:56:17 UTC (rev 168624)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKContextConfigurationRef.h 2014-05-12 17:56:42 UTC (rev 168625)
@@ -37,6 +37,9 @@
WK_EXPORT WKStringRef WKContextConfigurationCopyInjectedBundlePath(WKContextConfigurationRef configuration);
WK_EXPORT void WKContextConfigurationSetInjectedBundlePath(WKContextConfigurationRef configuration, WKStringRef injectedBundlePath);
+WK_EXPORT WKStringRef WKContextConfigurationCopyLocalStorageDirectory(WKContextConfigurationRef configuration);
+WK_EXPORT void WKContextConfigurationSetLocalStorageDirectory(WKContextConfigurationRef configuration, WKStringRef localStorageDirectory);
+
#ifdef __cplusplus
}
#endif
Modified: trunk/Source/WebKit2/UIProcess/API/C/WKContextPrivate.h (168624 => 168625)
--- trunk/Source/WebKit2/UIProcess/API/C/WKContextPrivate.h 2014-05-12 17:56:17 UTC (rev 168624)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKContextPrivate.h 2014-05-12 17:56:42 UTC (rev 168625)
@@ -64,7 +64,6 @@
// we should really change these settings to be on WebPreferences and changeable at runtime.
WK_EXPORT void WKContextSetApplicationCacheDirectory(WKContextRef context, WKStringRef applicationCacheDirectory);
WK_EXPORT void WKContextSetDatabaseDirectory(WKContextRef context, WKStringRef databaseDirectory);
-WK_EXPORT void WKContextSetLocalStorageDirectory(WKContextRef context, WKStringRef localStorageDirectory);
WK_EXPORT void WKContextSetDiskCacheDirectory(WKContextRef context, WKStringRef diskCacheDirectory);
WK_EXPORT void WKContextSetCookieStorageDirectory(WKContextRef context, WKStringRef cookieStorageDirectory);
Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKProcessGroup.mm (168624 => 168625)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKProcessGroup.mm 2014-05-12 17:56:17 UTC (rev 168624)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKProcessGroup.mm 2014-05-12 17:56:42 UTC (rev 168625)
@@ -192,6 +192,8 @@
WebContextConfiguration webContextConfiguration;
webContextConfiguration.injectedBundlePath = bundleURL ? String(bundleURL.path) : String();
+ WebContext::applyPlatformSpecificConfigurationDefaults(webContextConfiguration);
+
_context = WebContext::create(std::move(webContextConfiguration));
setUpConnectionClient(self, toAPI(_context.get()));
Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKProcessPool.mm (168624 => 168625)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKProcessPool.mm 2014-05-12 17:56:17 UTC (rev 168624)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKProcessPool.mm 2014-05-12 17:56:42 UTC (rev 168625)
@@ -125,6 +125,9 @@
webContextConfiguration.injectedBundlePath = bundleURL.path;
}
+ // FIXME: These are legacy configuration defaults and should not be applied when creating a WKProcessPool.
+ WebKit::WebContext::applyPlatformSpecificConfigurationDefaults(webContextConfiguration);
+
API::Object::constructInWrapper<WebKit::WebContext>(self, std::move(webContextConfiguration));
_context->setHistoryClient(std::make_unique<WebKit::HistoryClient>());
_context->setUsesNetworkProcess(true);
Modified: trunk/Source/WebKit2/UIProcess/APIContextConfiguration.cpp (168624 => 168625)
--- trunk/Source/WebKit2/UIProcess/APIContextConfiguration.cpp 2014-05-12 17:56:17 UTC (rev 168624)
+++ trunk/Source/WebKit2/UIProcess/APIContextConfiguration.cpp 2014-05-12 17:56:42 UTC (rev 168625)
@@ -27,6 +27,7 @@
#include "APIContextConfiguration.h"
#include "WebContext.h"
+
namespace API {
ContextConfiguration::ContextConfiguration()
@@ -42,7 +43,10 @@
WebKit::WebContextConfiguration configuration;
configuration.injectedBundlePath = m_injectedBundlePath;
+ configuration.localStorageDirectory = m_localStorageDirectory;
+ WebKit::WebContext::applyPlatformSpecificConfigurationDefaults(configuration);
+
return configuration;
}
Modified: trunk/Source/WebKit2/UIProcess/APIContextConfiguration.h (168624 => 168625)
--- trunk/Source/WebKit2/UIProcess/APIContextConfiguration.h 2014-05-12 17:56:17 UTC (rev 168624)
+++ trunk/Source/WebKit2/UIProcess/APIContextConfiguration.h 2014-05-12 17:56:42 UTC (rev 168625)
@@ -43,15 +43,19 @@
}
virtual ~ContextConfiguration();
- String injectedBundlePath() { return m_injectedBundlePath; }
+ String injectedBundlePath() const { return m_injectedBundlePath; }
void setInjectedBundlePath(const String& injectedBundlePath) { m_injectedBundlePath = injectedBundlePath; }
+ String localStorageDirectory() const { return m_localStorageDirectory; }
+ void setLocalStorageDirectory(const String& localStorageDirectory) { m_localStorageDirectory = localStorageDirectory; }
+
WebKit::WebContextConfiguration webContextConfiguration() const;
private:
ContextConfiguration();
String m_injectedBundlePath;
+ String m_localStorageDirectory;
};
} // namespace API
Modified: trunk/Source/WebKit2/UIProcess/Storage/StorageManager.cpp (168624 => 168625)
--- trunk/Source/WebKit2/UIProcess/Storage/StorageManager.cpp 2014-05-12 17:56:17 UTC (rev 168624)
+++ trunk/Source/WebKit2/UIProcess/Storage/StorageManager.cpp 2014-05-12 17:56:42 UTC (rev 168625)
@@ -387,6 +387,8 @@
void StorageManager::setLocalStorageDirectory(const String& localStorageDirectory)
{
+ ASSERT(!localStorageDirectory.isNull());
+
m_localStorageDatabaseTracker->setLocalStorageDirectory(localStorageDirectory);
}
Modified: trunk/Source/WebKit2/UIProcess/WebContext.cpp (168624 => 168625)
--- trunk/Source/WebKit2/UIProcess/WebContext.cpp 2014-05-12 17:56:17 UTC (rev 168624)
+++ trunk/Source/WebKit2/UIProcess/WebContext.cpp 2014-05-12 17:56:42 UTC (rev 168625)
@@ -117,6 +117,15 @@
DEFINE_DEBUG_ONLY_GLOBAL(WTF::RefCountedLeakCounter, webContextCounter, ("WebContext"));
+void WebContext::applyPlatformSpecificConfigurationDefaults(WebContextConfiguration& configuration)
+{
+ // FIXME: This function should not be needed; all ports should make sure that the configuration has the right
+ // values, and then we should get rid of the platform specific defaults inside WebContext.
+
+ if (!configuration.localStorageDirectory)
+ configuration.localStorageDirectory = platformDefaultLocalStorageDirectory();
+}
+
PassRefPtr<WebContext> WebContext::create(WebContextConfiguration configuration)
{
InitializeWebKit2();
@@ -214,7 +223,7 @@
webContextCounter.increment();
#endif
- m_storageManager->setLocalStorageDirectory(localStorageDirectory());
+ m_storageManager->setLocalStorageDirectory(configuration.localStorageDirectory);
}
#if !PLATFORM(COCOA)
@@ -1139,20 +1148,6 @@
return platformDefaultIconDatabasePath();
}
-void WebContext::setLocalStorageDirectory(const String& directory)
-{
- m_overrideLocalStorageDirectory = directory;
- m_storageManager->setLocalStorageDirectory(localStorageDirectory());
-}
-
-String WebContext::localStorageDirectory() const
-{
- if (!m_overrideLocalStorageDirectory.isEmpty())
- return m_overrideLocalStorageDirectory;
-
- return platformDefaultLocalStorageDirectory();
-}
-
String WebContext::diskCacheDirectory() const
{
if (!m_overrideDiskCacheDirectory.isEmpty())
Modified: trunk/Source/WebKit2/UIProcess/WebContext.h (168624 => 168625)
--- trunk/Source/WebKit2/UIProcess/WebContext.h 2014-05-12 17:56:17 UTC (rev 168624)
+++ trunk/Source/WebKit2/UIProcess/WebContext.h 2014-05-12 17:56:42 UTC (rev 168625)
@@ -97,6 +97,7 @@
struct WebContextConfiguration {
String injectedBundlePath;
+ String localStorageDirectory;
};
class WebContext : public API::ObjectImpl<API::Object::Type::Context>, private IPC::MessageReceiver
@@ -105,6 +106,8 @@
#endif
{
public:
+ static void applyPlatformSpecificConfigurationDefaults(WebContextConfiguration&);
+
WebContext(WebContextConfiguration);
static PassRefPtr<WebContext> create(WebContextConfiguration);
@@ -243,7 +246,6 @@
void setDatabaseDirectory(const String& dir) { m_overrideDatabaseDirectory = dir; }
void setIconDatabasePath(const String&);
String iconDatabasePath() const;
- void setLocalStorageDirectory(const String&);
void setDiskCacheDirectory(const String& dir) { m_overrideDiskCacheDirectory = dir; }
void setCookieStorageDirectory(const String& dir) { m_overrideCookieStorageDirectory = dir; }
@@ -412,8 +414,7 @@
String platformDefaultIconDatabasePath() const;
- String localStorageDirectory() const;
- String platformDefaultLocalStorageDirectory() const;
+ static String platformDefaultLocalStorageDirectory();
String diskCacheDirectory() const;
String platformDefaultDiskCacheDirectory() const;
@@ -515,7 +516,6 @@
String m_overrideApplicationCacheDirectory;
String m_overrideDatabaseDirectory;
String m_overrideIconDatabasePath;
- String m_overrideLocalStorageDirectory;
String m_overrideDiskCacheDirectory;
String m_overrideCookieStorageDirectory;
Modified: trunk/Source/WebKit2/UIProcess/mac/WebContextMac.mm (168624 => 168625)
--- trunk/Source/WebKit2/UIProcess/mac/WebContextMac.mm 2014-05-12 17:56:17 UTC (rev 168624)
+++ trunk/Source/WebKit2/UIProcess/mac/WebContextMac.mm 2014-05-12 17:56:42 UTC (rev 168625)
@@ -276,7 +276,7 @@
return [databasesDirectory stringByStandardizingPath];
}
-String WebContext::platformDefaultLocalStorageDirectory() const
+String WebContext::platformDefaultLocalStorageDirectory()
{
NSString *localStorageDirectory = [[NSUserDefaults standardUserDefaults] objectForKey:WebStorageDirectoryDefaultsKey];
if (!localStorageDirectory || ![localStorageDirectory isKindOfClass:[NSString class]])
Modified: trunk/Tools/ChangeLog (168624 => 168625)
--- trunk/Tools/ChangeLog 2014-05-12 17:56:17 UTC (rev 168624)
+++ trunk/Tools/ChangeLog 2014-05-12 17:56:42 UTC (rev 168625)
@@ -1,3 +1,14 @@
+2014-05-11 Anders Carlsson <ander...@apple.com>
+
+ Replace WKContextSetLocalStorageDirectory with a context configuration getter/setter
+ https://bugs.webkit.org/show_bug.cgi?id=132809
+
+ Reviewed by Dan Bernstein.
+
+ * WebKitTestRunner/TestController.cpp:
+ (WTR::TestController::initialize):
+ Set the local storage directory using WKContextConfigurationSetLocalStorageDirectory.
+
2014-05-12 Carlos Garcia Campos <cgar...@igalia.com>
REGRESSION(CMAKE): [GTK] _javascript_Core API tests are not built anymore
Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (168624 => 168625)
--- trunk/Tools/WebKitTestRunner/TestController.cpp 2014-05-12 17:56:17 UTC (rev 168624)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp 2014-05-12 17:56:42 UTC (rev 168625)
@@ -330,6 +330,14 @@
auto configuration = adoptWK(WKContextConfigurationCreate());
WKContextConfigurationSetInjectedBundlePath(configuration.get(), injectedBundlePath());
+ if (const char* dumpRenderTreeTemp = libraryPathForTesting()) {
+ String temporaryFolder = String::fromUTF8(dumpRenderTreeTemp);
+
+ const char separator = '/';
+
+ WKContextConfigurationSetLocalStorageDirectory(configuration.get(), toWK(temporaryFolder + separator + "LocalStorage").get());
+ }
+
m_context = adoptWK(WKContextCreateWithConfiguration(configuration.get()));
m_geolocationProvider = adoptPtr(new GeolocationProviderMock(m_context.get()));
@@ -341,13 +349,11 @@
if (const char* dumpRenderTreeTemp = libraryPathForTesting()) {
String temporaryFolder = String::fromUTF8(dumpRenderTreeTemp);
- // WebCore::pathByAppendingComponent is not used here because of the namespace,
- // which leads us to this ugly #ifdef and file path concatenation.
const char separator = '/';
+ // FIXME: These should be migrated to WKContextConfigurationRef.
WKContextSetApplicationCacheDirectory(m_context.get(), toWK(temporaryFolder + separator + "ApplicationCache").get());
WKContextSetDatabaseDirectory(m_context.get(), toWK(temporaryFolder + separator + "Databases").get());
- WKContextSetLocalStorageDirectory(m_context.get(), toWK(temporaryFolder + separator + "LocalStorage").get());
WKContextSetDiskCacheDirectory(m_context.get(), toWK(temporaryFolder + separator + "Cache").get());
WKContextSetCookieStorageDirectory(m_context.get(), toWK(temporaryFolder + separator + "Cookies").get());
WKContextSetIconDatabasePath(m_context.get(), toWK(temporaryFolder + separator + "IconDatabase" + separator + "WebpageIcons.db").get());