Changeset 176512 in webkit
- Timestamp:
- Nov 23, 2014, 11:24:01 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
-
Source/WebKit2/ChangeLog (modified) (1 diff)
-
Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp (modified) (6 diffs)
-
Tools/ChangeLog (modified) (1 diff)
-
Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitWebContext.cpp (modified) (2 diffs)
-
Tools/TestWebKitAPI/gtk/WebKit2Gtk/TestMain.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r176511 r176512 1 2014-11-23 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 [GTK] Add API to override the default local storage directory 4 https://bugs.webkit.org/show_bug.cgi?id=138828 5 6 Reviewed by Gustavo Noronha Silva. 7 8 Add WebKitWebContext:local-storage-directory construct-only 9 property. If not provided the default will be used. 10 11 * UIProcess/API/gtk/WebKitWebContext.cpp: 12 (webkitWebContextGetProperty): 13 (webkitWebContextSetProperty): 14 (webkitWebContextConstructed): 15 (webkit_web_context_class_init): 16 1 17 2014-11-23 Conrad Shultz <conrad_shultz@apple.com> 2 18 -
trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp
r176256 r176512 49 49 #include <WebCore/IconDatabase.h> 50 50 #include <WebCore/Language.h> 51 #include <glib/gi18n-lib.h> 51 52 #include <libintl.h> 52 53 #include <memory> … … 94 95 * 95 96 */ 97 98 enum { 99 PROP_0, 100 101 PROP_LOCAL_STORAGE_DIRECTORY 102 }; 96 103 97 104 enum { … … 170 177 CString webExtensionsDirectory; 171 178 GRefPtr<GVariant> webExtensionsInitializationUserData; 179 180 CString localStorageDirectory; 172 181 }; 173 182 … … 213 222 } 214 223 224 static void webkitWebContextGetProperty(GObject* object, guint propID, GValue* value, GParamSpec* paramSpec) 225 { 226 WebKitWebContext* context = WEBKIT_WEB_CONTEXT(object); 227 228 switch (propID) { 229 case PROP_LOCAL_STORAGE_DIRECTORY: 230 g_value_set_string(value, context->priv->localStorageDirectory.data()); 231 break; 232 default: 233 G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propID, paramSpec); 234 } 235 } 236 237 static void webkitWebContextSetProperty(GObject* object, guint propID, const GValue* value, GParamSpec* paramSpec) 238 { 239 WebKitWebContext* context = WEBKIT_WEB_CONTEXT(object); 240 241 switch (propID) { 242 case PROP_LOCAL_STORAGE_DIRECTORY: 243 context->priv->localStorageDirectory = g_value_get_string(value); 244 break; 245 default: 246 G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propID, paramSpec); 247 } 248 } 249 215 250 static void webkitWebContextConstructed(GObject* object) 216 251 { … … 221 256 webContextConfiguration.injectedBundlePath = WebCore::filenameToString(bundleFilename.get()); 222 257 WebContext::applyPlatformSpecificConfigurationDefaults(webContextConfiguration); 223 224 258 WebKitWebContext* webContext = WEBKIT_WEB_CONTEXT(object); 225 259 WebKitWebContextPrivate* priv = webContext->priv; 260 if (!priv->localStorageDirectory.isNull()) 261 webContextConfiguration.localStorageDirectory = WebCore::filenameToString(priv->localStorageDirectory.data()); 262 226 263 priv->context = WebContext::create(WTF::move(webContextConfiguration)); 227 264 … … 266 303 bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8"); 267 304 305 gObjectClass->get_property = webkitWebContextGetProperty; 306 gObjectClass->set_property = webkitWebContextSetProperty; 268 307 gObjectClass->constructed = webkitWebContextConstructed; 269 308 gObjectClass->dispose = webkitWebContextDispose; 309 310 /** 311 * WebKitWebContext:local-storage-directory: 312 * 313 * The directory where local storage data will be saved. 314 * 315 * Since: 2.8 316 */ 317 g_object_class_install_property( 318 gObjectClass, 319 PROP_LOCAL_STORAGE_DIRECTORY, 320 g_param_spec_string( 321 "local-storage-directory", 322 _("Local Storage Directory"), 323 _("The directory where local storage data will be saved"), 324 nullptr, 325 static_cast<GParamFlags>(WEBKIT_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY))); 270 326 271 327 /** -
trunk/Tools/ChangeLog
r176488 r176512 1 2014-11-23 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 [GTK] Add API to override the default local storage directory 4 https://bugs.webkit.org/show_bug.cgi?id=138828 5 6 Reviewed by Gustavo Noronha Silva. 7 8 Add test to check that the local storage directory is created at 9 the path given on construction. 10 11 * TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitWebContext.cpp: 12 (testWebContextConfiguration): 13 (beforeAll): 14 * TestWebKitAPI/gtk/WebKit2Gtk/TestMain.h: 15 (Test::Test): 16 (Test::~Test): Deleted. 17 1 18 2014-11-21 Zalan Bujtas <zalan@apple.com> 2 19 -
trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitWebContext.cpp
r176256 r176512 38 38 } 39 39 40 static void testWebContextConfiguration(WebViewTest* test, gconstpointer) 41 { 42 GUniquePtr<char> localStorageDirectory(g_build_filename(Test::dataDirectory(), "local-storage", nullptr)); 43 g_assert(g_file_test(localStorageDirectory.get(), G_FILE_TEST_IS_DIR)); 44 } 45 40 46 class PluginsTest: public Test { 41 47 public: … … 412 418 413 419 Test::add("WebKitWebContext", "default-context", testWebContextDefault); 420 WebViewTest::add("WebKitWebContext", "configuration", testWebContextConfiguration); 414 421 PluginsTest::add("WebKitWebContext", "get-plugins", testWebContextGetPlugins); 415 422 URISchemeTest::add("WebKitWebContext", "uri-scheme", testWebContextURIScheme); -
trunk/Tools/TestWebKitAPI/gtk/WebKit2Gtk/TestMain.h
r176256 r176512 67 67 68 68 Test() 69 : m_webContext(adoptGRef(webkit_web_context_new()))70 69 { 70 GUniquePtr<char> localStorageDirectory(g_build_filename(dataDirectory(), "local-storage", nullptr)); 71 m_webContext = adoptGRef(WEBKIT_WEB_CONTEXT(g_object_new(WEBKIT_TYPE_WEB_CONTEXT, "local-storage-directory", localStorageDirectory.get(), nullptr))); 72 71 73 g_signal_connect(m_webContext.get(), "initialize-web-extensions", G_CALLBACK(initializeWebExtensionsCallback), this); 72 74 GUniquePtr<char> diskCacheDirectory(g_build_filename(dataDirectory(), "disk-cache", nullptr));
Note:
See TracChangeset
for help on using the changeset viewer.