Changeset 211138 in webkit
- Timestamp:
- Jan 25, 2017, 12:01:08 AM (10 years ago)
- Location:
- trunk
- Files:
-
- 18 edited
-
Source/WebKit2/ChangeLog (modified) (1 diff)
-
Source/WebKit2/UIProcess/API/gtk/WebKitSettings.cpp (modified) (5 diffs)
-
Source/WebKit2/UIProcess/API/gtk/WebKitSettings.h (modified) (1 diff)
-
Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp (modified) (4 diffs)
-
Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.h (modified) (1 diff)
-
Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp (modified) (11 diffs)
-
Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h (modified) (1 diff)
-
Source/WebKit2/UIProcess/API/gtk/WebKitWebViewPrivate.h (modified) (1 diff)
-
Source/WebKit2/UIProcess/API/gtk/WebKitWebsiteDataManager.cpp (modified) (20 diffs)
-
Source/WebKit2/UIProcess/API/gtk/WebKitWebsiteDataManager.h (modified) (1 diff)
-
Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt (modified) (3 diffs)
-
Tools/ChangeLog (modified) (1 diff)
-
Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestAuthentication.cpp (modified) (2 diffs)
-
Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestCookieManager.cpp (modified) (2 diffs)
-
Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitSettings.cpp (modified) (1 diff)
-
Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitWebContext.cpp (modified) (4 diffs)
-
Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitWebView.cpp (modified) (2 diffs)
-
Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestWebsiteData.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r211135 r211138 1 2017-01-24 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 [GTK] Add API to create ephemeral web views and deprecate the private browsing setting 4 https://bugs.webkit.org/show_bug.cgi?id=167370 5 6 Reviewed by Michael Catanzaro. 7 8 Add API to create ephemeral WebKitWebView, WebKitWebsiteDataManager and WebKitWebContext. 9 10 * UIProcess/API/gtk/WebKitSettings.cpp: 11 (webKitSettingsSetProperty): Ignore deprecation warnings. 12 (webKitSettingsGetProperty): Ditto. 13 (webkit_settings_class_init): Mark WebKitSettings:enable-private-browsing as deprecated. 14 * UIProcess/API/gtk/WebKitSettings.h: 15 * UIProcess/API/gtk/WebKitWebContext.cpp: 16 (webkit_web_context_new_ephemeral): Create an ephemeral WebKitWebContext. This is just a convenient method to 17 create a WebKitWebContext with an ephemeral WebKitWebsiteDataManager without having to deal with the manager. 18 (webkit_web_context_is_ephemeral): Return whether the context is ephemeral. 19 (webkitWebContextCreatePageForWebView): Configure page with the web view WebKitWebsiteDataManager if it has one. 20 * UIProcess/API/gtk/WebKitWebContext.h: 21 * UIProcess/API/gtk/WebKitWebView.cpp: 22 (webkitWebViewConstructed): Check if the WebView is or should be ephemeral and create a non persistent website 23 data manager if it's an ephemeral web view in a non ephemeral web context. 24 (webkitWebViewSetProperty): Add setter for is-ephemeral property. 25 (webkitWebViewGetProperty): Add getter for is-ephemeral property. 26 (webkit_web_view_class_init): Add is-ephemeral property. 27 (webkitWebViewHandleAuthenticationChallenge): Check also whether web view is ephemeral. 28 (webkitWebViewGetWebsiteDataManager): Helper private to return the web view data manager. 29 (webkit_web_view_new_with_context): Also set is-ephemeral property depending on the context. 30 (webkit_web_view_is_ephemeral): Return whether the view is ephemeral. 31 * UIProcess/API/gtk/WebKitWebView.h: 32 * UIProcess/API/gtk/WebKitWebViewPrivate.h: 33 * UIProcess/API/gtk/WebKitWebsiteDataManager.cpp: 34 (webkitWebsiteDataManagerGetProperty): Add setter for is-ephemeral property. 35 (webkitWebsiteDataManagerSetProperty): Add getter for is-ephemeral property. 36 (webkit_website_data_manager_class_init): Add is-ephemeral property. 37 (webkit_website_data_manager_new_ephemeral): Create a new ephemeral WebKitWebsiteDataManager. 38 (webkit_website_data_manager_is_ephemeral): Return whether the website data manager is ephemeral. 39 (webkit_website_data_manager_get_base_data_directory): Return nullptr if manager is ephemeral. 40 (webkit_website_data_manager_get_base_cache_directory): Ditto. 41 (webkit_website_data_manager_get_local_storage_directory): Ditto. 42 (webkit_website_data_manager_get_disk_cache_directory): Ditto. 43 (webkit_website_data_manager_get_offline_application_cache_directory): Ditto. 44 (webkit_website_data_manager_get_indexeddb_directory): Ditto. 45 (webkit_website_data_manager_get_websql_directory): Ditto. 46 * UIProcess/API/gtk/WebKitWebsiteDataManager.h: 47 * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt: Add new symbols. 48 1 49 2017-01-24 Zalan Bujtas <zalan@apple.com> 2 50 -
trunk/Source/WebKit2/UIProcess/API/gtk/WebKitSettings.cpp
r210500 r211138 236 236 break; 237 237 case PROP_ENABLE_PRIVATE_BROWSING: 238 G_GNUC_BEGIN_IGNORE_DEPRECATIONS; 238 239 webkit_settings_set_enable_private_browsing(settings, g_value_get_boolean(value)); 240 G_GNUC_END_IGNORE_DEPRECATIONS; 239 241 break; 240 242 case PROP_ENABLE_DEVELOPER_EXTRAS: … … 403 405 break; 404 406 case PROP_ENABLE_PRIVATE_BROWSING: 407 G_GNUC_BEGIN_IGNORE_DEPRECATIONS; 405 408 g_value_set_boolean(value, webkit_settings_get_enable_private_browsing(settings)); 409 G_GNUC_END_IGNORE_DEPRECATIONS; 406 410 break; 407 411 case PROP_ENABLE_DEVELOPER_EXTRAS: … … 832 836 * Determines whether or not private browsing is enabled. Private browsing 833 837 * will disable history, cache and form auto-fill for any pages visited. 838 * 839 * Deprecated: 2.16. Use #WebKitWebView:is-ephemeral or #WebKitWebContext:is-ephemeral instead. 834 840 */ 835 841 g_object_class_install_property(gObjectClass, … … 2144 2150 * 2145 2151 * Returns: %TRUE If private browsing is enabled or %FALSE otherwise. 2152 * 2153 * Deprecated: 2.16. Use #WebKitWebView:is-ephemeral or #WebKitWebContext:is-ephemeral instead. 2146 2154 */ 2147 2155 gboolean webkit_settings_get_enable_private_browsing(WebKitSettings* settings) … … 2153 2161 2154 2162 /** 2155 * webkit_settings_set_ private_caret_browsing:2163 * webkit_settings_set_enable_private_browsing: 2156 2164 * @settings: a #WebKitSettings 2157 2165 * @enabled: Value to be set 2158 2166 * 2159 2167 * Set the #WebKitSettings:enable-private-browsing property. 2168 * 2169 * Deprecated: 2.16. Use #WebKitWebView:is-ephemeral or #WebKitWebContext:is-ephemeral instead. 2160 2170 */ 2161 2171 void webkit_settings_set_enable_private_browsing(WebKitSettings* settings, gboolean enabled) -
trunk/Source/WebKit2/UIProcess/API/gtk/WebKitSettings.h
r199795 r211138 237 237 const gchar *default_charset); 238 238 239 WEBKIT_ APIgboolean239 WEBKIT_DEPRECATED gboolean 240 240 webkit_settings_get_enable_private_browsing (WebKitSettings *settings); 241 241 242 WEBKIT_ APIvoid242 WEBKIT_DEPRECATED void 243 243 webkit_settings_set_enable_private_browsing (WebKitSettings *settings, 244 244 gboolean enabled); -
trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp
r210921 r211138 259 259 WebKitWebContext* webContext = WEBKIT_WEB_CONTEXT(object); 260 260 WebKitWebContextPrivate* priv = webContext->priv; 261 if (priv->websiteDataManager ) {261 if (priv->websiteDataManager && !webkit_website_data_manager_is_ephemeral(priv->websiteDataManager.get())) { 262 262 configuration.setLocalStorageDirectory(WebCore::stringFromFileSystemRepresentation(webkit_website_data_manager_get_local_storage_directory(priv->websiteDataManager.get()))); 263 263 configuration.setDiskCacheDirectory(WebCore::pathByAppendingComponent(WebCore::stringFromFileSystemRepresentation(webkit_website_data_manager_get_disk_cache_directory(priv->websiteDataManager.get())), networkCacheSubdirectory)); … … 450 450 451 451 /** 452 * webkit_web_context_new_ephemeral: 453 * 454 * Create a new ephemeral #WebKitWebContext. An ephemeral #WebKitWebContext is a context 455 * created with an ephemeral #WebKitWebsiteDataManager. This is just a convenient method 456 * to create ephemeral contexts without having to create your own #WebKitWebsiteDataManager. 457 * All #WebKitWebView<!-- ->s associated with this context will also be ephemeral. Websites will 458 * not store any data in the client storage. 459 * This is normally used to implement private instances. 460 * 461 * Returns: (transfer full): a new ephemeral #WebKitWebContext. 462 * 463 * Since: 2.16 464 */ 465 WebKitWebContext* webkit_web_context_new_ephemeral() 466 { 467 GRefPtr<WebKitWebsiteDataManager> manager = adoptGRef(webkit_website_data_manager_new_ephemeral()); 468 return WEBKIT_WEB_CONTEXT(g_object_new(WEBKIT_TYPE_WEB_CONTEXT, "website-data-manager", manager.get(), nullptr)); 469 } 470 471 /** 452 472 * webkit_web_context_new_with_website_data_manager: 453 473 * @manager: a #WebKitWebsiteDataManager … … 481 501 482 502 return context->priv->websiteDataManager.get(); 503 } 504 505 /** 506 * webkit_web_context_is_ephemeral: 507 * @context: the #WebKitWebContext 508 * 509 * Get whether a #WebKitWebContext is ephemeral. 510 * 511 * Returns: %TRUE if @context is ephemeral or %FALSE otherwise. 512 * 513 * Since: 2.16 514 */ 515 gboolean webkit_web_context_is_ephemeral(WebKitWebContext* context) 516 { 517 g_return_val_if_fail(WEBKIT_IS_WEB_CONTEXT(context), FALSE); 518 519 return webkit_website_data_manager_is_ephemeral(context->priv->websiteDataManager.get()); 483 520 } 484 521 … … 1427 1464 pageConfiguration->setRelatedPage(relatedView ? webkitWebViewBaseGetPage(WEBKIT_WEB_VIEW_BASE(relatedView)) : nullptr); 1428 1465 pageConfiguration->setUserContentController(userContentManager ? webkitUserContentManagerGetUserContentControllerProxy(userContentManager) : nullptr); 1429 pageConfiguration->setWebsiteDataStore(&webkitWebsiteDataManagerGetDataStore(context->priv->websiteDataManager.get())); 1466 1467 WebKitWebsiteDataManager* manager = webkitWebViewGetWebsiteDataManager(webView); 1468 if (!manager) 1469 manager = context->priv->websiteDataManager.get(); 1470 pageConfiguration->setWebsiteDataStore(&webkitWebsiteDataManagerGetDataStore(manager)); 1430 1471 pageConfiguration->setSessionID(pageConfiguration->websiteDataStore()->websiteDataStore().sessionID()); 1431 1472 webkitWebViewBaseCreateWebPage(webViewBase, WTFMove(pageConfiguration)); -
trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.h
r210921 r211138 168 168 169 169 WEBKIT_API WebKitWebContext * 170 webkit_web_context_new_ephemeral (void); 171 172 WEBKIT_API WebKitWebContext * 170 173 webkit_web_context_new_with_website_data_manager (WebKitWebsiteDataManager *manager); 171 174 172 175 WEBKIT_API WebKitWebsiteDataManager * 173 176 webkit_web_context_get_website_data_manager (WebKitWebContext *context); 177 178 WEBKIT_API gboolean 179 webkit_web_context_is_ephemeral (WebKitWebContext *context); 174 180 175 181 WEBKIT_API void -
trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp
r210500 r211138 154 154 PROP_IS_LOADING, 155 155 PROP_IS_PLAYING_AUDIO, 156 PROP_IS_EPHEMERAL, 156 157 PROP_EDITABLE 157 158 }; … … 178 179 CString activeURI; 179 180 bool isLoading; 181 bool isEphemeral; 180 182 181 183 std::unique_ptr<PageLoadStateObserver> loadObserver; … … 209 211 GRefPtr<WebKitAuthenticationRequest> authenticationRequest; 210 212 213 GRefPtr<WebKitWebsiteDataManager> websiteDataManager; 211 214 }; 212 215 … … 642 645 WebKitWebView* webView = WEBKIT_WEB_VIEW(object); 643 646 WebKitWebViewPrivate* priv = webView->priv; 644 if (priv->relatedView) 647 if (priv->relatedView) { 645 648 priv->context = webkit_web_view_get_context(priv->relatedView); 646 else if (!priv->context) 649 priv->isEphemeral = webkit_web_view_is_ephemeral(priv->relatedView); 650 } else if (!priv->context) 647 651 priv->context = webkit_web_context_get_default(); 652 else if (!priv->isEphemeral) 653 priv->isEphemeral = webkit_web_context_is_ephemeral(priv->context.get()); 654 648 655 if (!priv->settings) 649 656 priv->settings = adoptGRef(webkit_settings_new()); 657 658 if (priv->isEphemeral && !webkit_web_context_is_ephemeral(priv->context.get())) 659 priv->websiteDataManager = adoptGRef(webkit_website_data_manager_new_ephemeral()); 650 660 651 661 webkitWebContextCreatePageForWebView(priv->context.get(), webView, priv->userContentManager.get(), priv->relatedView); … … 701 711 case PROP_ZOOM_LEVEL: 702 712 webkit_web_view_set_zoom_level(webView, g_value_get_double(value)); 713 break; 714 case PROP_IS_EPHEMERAL: 715 webView->priv->isEphemeral = g_value_get_boolean(value); 703 716 break; 704 717 case PROP_EDITABLE: … … 745 758 g_value_set_boolean(value, webkit_web_view_is_playing_audio(webView)); 746 759 break; 760 case PROP_IS_EPHEMERAL: 761 g_value_set_boolean(value, webkit_web_view_is_ephemeral(webView)); 762 break; 747 763 case PROP_EDITABLE: 748 764 g_value_set_boolean(value, webkit_web_view_is_editable(webView)); … … 975 991 FALSE, 976 992 WEBKIT_PARAM_READABLE)); 993 994 /** 995 * WebKitWebView:is-ephemeral: 996 * 997 * Whether the #WebKitWebView is ephemeral. An ephemeral web view never writes 998 * website data to the client storage, no matter what #WebKitWebsiteDataManager 999 * its context is using. This is normally used to implement private browsing mode. 1000 * This is a %G_PARAM_CONSTRUCT_ONLY property, so you have to create a ephemeral 1001 * #WebKitWebView and it can't be changed. Note that all #WebKitWebView<!-- -->s 1002 * created with an ephemeral #WebKitWebContext will be ephemeral automatically. 1003 * See also webkit_web_context_new_ephemeral(). 1004 * 1005 * Since: 2.16 1006 */ 1007 g_object_class_install_property( 1008 gObjectClass, 1009 PROP_IS_EPHEMERAL, 1010 g_param_spec_boolean( 1011 "is-ephemeral", 1012 "Is Ephemeral", 1013 _("Whether the web view is ephemeral"), 1014 FALSE, 1015 static_cast<GParamFlags>(WEBKIT_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY))); 977 1016 978 1017 /** … … 2022 2061 void webkitWebViewHandleAuthenticationChallenge(WebKitWebView* webView, AuthenticationChallengeProxy* authenticationChallenge) 2023 2062 { 2024 gboolean privateBrowsingEnabled = webkit_settings_get_enable_private_browsing(webView->priv->settings.get()); 2063 G_GNUC_BEGIN_IGNORE_DEPRECATIONS; 2064 gboolean privateBrowsingEnabled = webView->priv->isEphemeral || webkit_settings_get_enable_private_browsing(webView->priv->settings.get()); 2065 G_GNUC_END_IGNORE_DEPRECATIONS; 2025 2066 webView->priv->authenticationRequest = adoptGRef(webkitAuthenticationRequestCreate(authenticationChallenge, privateBrowsingEnabled)); 2026 2067 gboolean returnValue; … … 2065 2106 } 2066 2107 2108 WebKitWebsiteDataManager* webkitWebViewGetWebsiteDataManager(WebKitWebView* webView) 2109 { 2110 return webView->priv->websiteDataManager.get(); 2111 } 2112 2067 2113 /** 2068 2114 * webkit_web_view_new: … … 2096 2142 g_return_val_if_fail(WEBKIT_IS_WEB_CONTEXT(context), 0); 2097 2143 2098 return GTK_WIDGET(g_object_new(WEBKIT_TYPE_WEB_VIEW, "web-context", context, NULL)); 2144 return GTK_WIDGET(g_object_new(WEBKIT_TYPE_WEB_VIEW, 2145 "is-ephemeral", webkit_web_context_is_ephemeral(context), 2146 "web-context", context, 2147 nullptr)); 2099 2148 } 2100 2149 … … 2197 2246 2198 2247 return webView->priv->userContentManager.get(); 2248 } 2249 2250 /** 2251 * webkit_web_view_is_ephemeral: 2252 * @web_view: a #WebKitWebView 2253 * 2254 * Get whether a #WebKitWebView is ephemeral. To create an ephemeral #WebKitWebView you need to 2255 * use g_object_new() and pass is-ephemeral propery with %TRUE value. See 2256 * #WebKitWebView:is-ephemeral for more details. 2257 * If @web_view was created with a ephemeral #WebKitWebView:related-view or an 2258 * ephemeral #WebKitWebView:web-context it will also be ephemeral. 2259 * 2260 * Returns: %TRUE if @web_view is ephemeral or %FALSE otherwise. 2261 * 2262 * Since: 2.16 2263 */ 2264 gboolean webkit_web_view_is_ephemeral(WebKitWebView* webView) 2265 { 2266 g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), FALSE); 2267 2268 return webView->priv->isEphemeral; 2199 2269 } 2200 2270 -
trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h
r194579 r211138 275 275 webkit_web_view_new_with_user_content_manager (WebKitUserContentManager *user_content_manager); 276 276 277 WEBKIT_API gboolean 278 webkit_web_view_is_ephemeral (WebKitWebView *web_view); 279 277 280 WEBKIT_API WebKitWebContext * 278 281 webkit_web_view_get_context (WebKitWebView *web_view); -
trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewPrivate.h
r193826 r211138 67 67 void webkitWebViewSelectionDidChange(WebKitWebView*); 68 68 void webkitWebViewRequestInstallMissingMediaPlugins(WebKitWebView*, WebKit::InstallMissingMediaPluginsPermissionRequest&); 69 WebKitWebsiteDataManager* webkitWebViewGetWebsiteDataManager(WebKitWebView*); 69 70 70 71 #endif // WebKitWebViewPrivate_h -
trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebsiteDataManager.cpp
r211079 r211138 57 57 * you can use webkit_web_context_get_website_data_manager(). 58 58 * 59 * A WebKitWebsiteDataManager can also be ephemeral and then all the directories configuration 60 * is not needed because website data will never persist. You can create an ephemeral WebKitWebsiteDataManager 61 * with webkit_website_data_manager_new_ephemeral(). Then you can pass an ephemeral WebKitWebsiteDataManager to 62 * a #WebKitWebContext to make it ephemeral or use webkit_web_context_new_ephemeral() and the WebKitWebsiteDataManager 63 * will be automatically created by the #WebKitWebContext. 64 * 59 65 * WebKitWebsiteDataManager can also be used to fetch websites data, remove data 60 66 * stored by particular websites, or clear data for all websites modified since a given … … 73 79 PROP_APPLICATION_CACHE_DIRECTORY, 74 80 PROP_INDEXEDDB_DIRECTORY, 75 PROP_WEBSQL_DIRECTORY 81 PROP_WEBSQL_DIRECTORY, 82 PROP_IS_EPHEMERAL 76 83 }; 77 84 … … 115 122 g_value_set_string(value, webkit_website_data_manager_get_websql_directory(manager)); 116 123 break; 124 case PROP_IS_EPHEMERAL: 125 g_value_set_boolean(value, webkit_website_data_manager_is_ephemeral(manager)); 126 break; 117 127 default: 118 128 G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propID, paramSpec); … … 145 155 case PROP_WEBSQL_DIRECTORY: 146 156 manager->priv->webSQLDirectory.reset(g_value_dup_string(value)); 157 break; 158 case PROP_IS_EPHEMERAL: 159 if (g_value_get_boolean(value)) 160 manager->priv->websiteDataStore = API::WebsiteDataStore::createNonPersistentDataStore(); 147 161 break; 148 162 default: … … 300 314 _("The directory where WebSQL databases will be stored"), 301 315 nullptr, 316 static_cast<GParamFlags>(WEBKIT_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY))); 317 318 /** 319 * WebKitWebsiteDataManager:is-ephemeral: 320 * 321 * Whether the #WebKitWebsiteDataManager is ephemeral. An ephemeral #WebKitWebsiteDataManager 322 * handles all websites data as non-persistent, and nothing will be written to the client 323 * storage. Note that if you create an ephemeral #WebKitWebsiteDataManager all other construction 324 * parameters to configure data directories will be ignored. 325 * 326 * Since: 2.16 327 */ 328 g_object_class_install_property( 329 gObjectClass, 330 PROP_IS_EPHEMERAL, 331 g_param_spec_boolean( 332 "is-ephemeral", 333 "Is Ephemeral", 334 _("Whether the WebKitWebsiteDataManager is ephemeral"), 335 FALSE, 302 336 static_cast<GParamFlags>(WEBKIT_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY))); 303 337 } … … 354 388 355 389 /** 390 * webkit_website_data_manager_new_ephemeral: 391 * 392 * Creates an ephemeral #WebKitWebsiteDataManager. See #WebKitWebsiteDataManager:is-ephemeral for more details. 393 * 394 * Returns: (transfer full): a new ephemeral #WebKitWebsiteDataManager. 395 * 396 * Since: 2.16 397 */ 398 WebKitWebsiteDataManager* webkit_website_data_manager_new_ephemeral() 399 { 400 return WEBKIT_WEBSITE_DATA_MANAGER(g_object_new(WEBKIT_TYPE_WEBSITE_DATA_MANAGER, "is-ephemeral", TRUE, nullptr)); 401 } 402 403 /** 404 * webkit_website_data_manager_is_ephemeral: 405 * @manager: a #WebKitWebsiteDataManager 406 * 407 * Get whether a #WebKitWebsiteDataManager is ephemeral. See #WebKitWebsiteDataManager::is-ephemerla for more details. 408 * 409 * Returns: %TRUE if @manager is epheral or %FALSE otherwise. 410 * 411 * Since: 2.16 412 */ 413 gboolean webkit_website_data_manager_is_ephemeral(WebKitWebsiteDataManager* manager) 414 { 415 g_return_val_if_fail(WEBKIT_IS_WEBSITE_DATA_MANAGER(manager), FALSE); 416 417 return manager->priv->websiteDataStore && !manager->priv->websiteDataStore->isPersistent(); 418 } 419 420 /** 356 421 * webkit_website_data_manager_get_base_data_directory: 357 422 * @manager: a #WebKitWebsiteDataManager … … 359 424 * Get the #WebKitWebsiteDataManager:base-data-directory property. 360 425 * 361 * Returns: the base directory for Website data, or %NULL if362 * #WebKitWebsiteDataManager:base-data-directory was not provided .426 * Returns: (allow-none): the base directory for Website data, or %NULL if 427 * #WebKitWebsiteDataManager:base-data-directory was not provided or @manager is ephemeral. 363 428 * 364 429 * Since: 2.10 … … 368 433 g_return_val_if_fail(WEBKIT_IS_WEBSITE_DATA_MANAGER(manager), nullptr); 369 434 435 if (manager->priv->websiteDataStore && !manager->priv->websiteDataStore->isPersistent()) 436 return nullptr; 437 370 438 return manager->priv->baseDataDirectory.get(); 371 439 } … … 377 445 * Get the #WebKitWebsiteDataManager:base-cache-directory property. 378 446 * 379 * Returns: the base directory for Website cache, or %NULL if380 * #WebKitWebsiteDataManager:base-cache-directory was not provided .447 * Returns: (allow-none): the base directory for Website cache, or %NULL if 448 * #WebKitWebsiteDataManager:base-cache-directory was not provided or @manager is ephemeral. 381 449 * 382 450 * Since: 2.10 … … 386 454 g_return_val_if_fail(WEBKIT_IS_WEBSITE_DATA_MANAGER(manager), nullptr); 387 455 456 if (manager->priv->websiteDataStore && !manager->priv->websiteDataStore->isPersistent()) 457 return nullptr; 458 388 459 return manager->priv->baseCacheDirectory.get(); 389 460 } … … 395 466 * Get the #WebKitWebsiteDataManager:local-storage-directory property. 396 467 * 397 * Returns: the directory where local storage data is stored.468 * Returns: (allow-none): the directory where local storage data is stored or %NULL if @manager is ephemeral. 398 469 * 399 470 * Since: 2.10 … … 404 475 405 476 WebKitWebsiteDataManagerPrivate* priv = manager->priv; 477 if (priv->websiteDataStore && !priv->websiteDataStore->isPersistent()) 478 return nullptr; 479 406 480 if (!priv->localStorageDirectory) 407 481 priv->localStorageDirectory.reset(g_strdup(API::WebsiteDataStore::defaultLocalStorageDirectory().utf8().data())); … … 415 489 * Get the #WebKitWebsiteDataManager:disk-cache-directory property. 416 490 * 417 * Returns: the directory where HTTP disk cache is stored.491 * Returns: (allow-none): the directory where HTTP disk cache is stored or %NULL if @manager is ephemeral. 418 492 * 419 493 * Since: 2.10 … … 424 498 425 499 WebKitWebsiteDataManagerPrivate* priv = manager->priv; 500 if (priv->websiteDataStore && !priv->websiteDataStore->isPersistent()) 501 return nullptr; 502 426 503 if (!priv->diskCacheDirectory) { 427 504 // The default directory already has the subdirectory. … … 437 514 * Get the #WebKitWebsiteDataManager:offline-application-cache-directory property. 438 515 * 439 * Returns: the directory where offline web application cache is stored.516 * Returns: (allow-none): the directory where offline web application cache is stored or %NULL if @manager is ephemeral. 440 517 * 441 518 * Since: 2.10 … … 446 523 447 524 WebKitWebsiteDataManagerPrivate* priv = manager->priv; 525 if (priv->websiteDataStore && !priv->websiteDataStore->isPersistent()) 526 return nullptr; 527 448 528 if (!priv->applicationCacheDirectory) 449 529 priv->applicationCacheDirectory.reset(g_strdup(API::WebsiteDataStore::defaultApplicationCacheDirectory().utf8().data())); … … 457 537 * Get the #WebKitWebsiteDataManager:indexeddb-directory property. 458 538 * 459 * Returns: the directory where IndexedDB databases are stored.539 * Returns: (allow-none): the directory where IndexedDB databases are stored or %NULL if @manager is ephemeral. 460 540 * 461 541 * Since: 2.10 … … 466 546 467 547 WebKitWebsiteDataManagerPrivate* priv = manager->priv; 548 if (priv->websiteDataStore && !priv->websiteDataStore->isPersistent()) 549 return nullptr; 550 468 551 if (!priv->indexedDBDirectory) 469 552 priv->indexedDBDirectory.reset(g_strdup(API::WebsiteDataStore::defaultIndexedDBDatabaseDirectory().utf8().data())); … … 477 560 * Get the #WebKitWebsiteDataManager:websql-directory property. 478 561 * 479 * Returns: the directory where WebSQL databases are stored.562 * Returns: (allow-none): the directory where WebSQL databases are stored or %NULL if @manager is ephemeral. 480 563 * 481 564 * Since: 2.10 … … 486 569 487 570 WebKitWebsiteDataManagerPrivate* priv = manager->priv; 571 if (priv->websiteDataStore && !priv->websiteDataStore->isPersistent()) 572 return nullptr; 573 488 574 if (!priv->webSQLDirectory) 489 575 priv->webSQLDirectory.reset(g_strdup(API::WebsiteDataStore::defaultWebSQLDatabaseDirectory().utf8().data())); -
trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebsiteDataManager.h
r211079 r211138 63 63 webkit_website_data_manager_new (const gchar *first_option_name, 64 64 ...); 65 WEBKIT_API WebKitWebsiteDataManager * 66 webkit_website_data_manager_new_ephemeral (void); 67 68 WEBKIT_API gboolean 69 webkit_website_data_manager_is_ephemeral (WebKitWebsiteDataManager* manager); 70 65 71 WEBKIT_API const gchar * 66 72 webkit_website_data_manager_get_base_data_directory (WebKitWebsiteDataManager *manager); -
trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt
r211079 r211138 31 31 webkit_web_context_get_default 32 32 webkit_web_context_new 33 webkit_web_context_new_ephemeral 33 34 webkit_web_context_new_with_website_data_manager 35 webkit_web_context_is_ephemeral 34 36 webkit_web_context_get_website_data_manager 35 37 webkit_web_context_get_cache_model … … 159 161 webkit_web_view_new_with_settings 160 162 webkit_web_view_new_with_user_content_manager 163 webkit_web_view_is_ephemeral 161 164 webkit_web_view_get_context 162 165 webkit_web_view_get_user_content_manager … … 1238 1241 WebKitWebsiteDataManager 1239 1242 webkit_website_data_manager_new 1243 webkit_website_data_manager_new_ephemeral 1244 webkit_website_data_manager_is_ephemeral 1240 1245 webkit_website_data_manager_get_base_data_directory 1241 1246 webkit_website_data_manager_get_base_cache_directory -
trunk/Tools/ChangeLog
r211137 r211138 1 2017-01-24 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 [GTK] Add API to create ephemeral web views and deprecate the private browsing setting 4 https://bugs.webkit.org/show_bug.cgi?id=167370 5 6 Reviewed by Michael Catanzaro. 7 8 Add several test cases of ephemeral web views. 9 10 * TestWebKitAPI/Tests/WebKit2Gtk/TestAuthentication.cpp: 11 (testWebViewAuthenticationStorage): 12 * TestWebKitAPI/Tests/WebKit2Gtk/TestCookieManager.cpp: 13 (ephemeralViewloadChanged): 14 (testCookieManagerEphemeral): 15 (beforeAll): 16 * TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitSettings.cpp: 17 (testWebKitSettings): 18 * TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitWebContext.cpp: 19 (testWebContextEphemeral): 20 (ephemeralViewloadChanged): 21 (testWebContextProxySettings): 22 (beforeAll): 23 * TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitWebView.cpp: 24 (ephemeralViewloadChanged): 25 (testWebViewEphemeral): 26 (beforeAll): 27 * TestWebKitAPI/Tests/WebKit2Gtk/TestWebsiteData.cpp: 28 (ephemeralViewloadChanged): 29 (testWebsiteDataEphemeral): 30 (beforeAll): 31 1 32 2017-01-24 Alex Christensen <achristensen@webkit.org> 2 33 -
trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestAuthentication.cpp
r206731 r211138 188 188 { 189 189 // Enable private browsing before authentication request to test that credentials can't be saved. 190 G_GNUC_BEGIN_IGNORE_DEPRECATIONS; 190 191 webkit_settings_set_enable_private_browsing(webkit_web_view_get_settings(test->m_webView), TRUE); 192 G_GNUC_END_IGNORE_DEPRECATIONS; 191 193 test->loadURI(kServer->getURIForPath("/auth-test.html").data()); 192 194 WebKitAuthenticationRequest* request = test->waitForAuthenticationRequest(); … … 197 199 // then check that credentials can be saved. 198 200 #if USE(LIBSECRET) 201 G_GNUC_BEGIN_IGNORE_DEPRECATIONS; 199 202 webkit_settings_set_enable_private_browsing(webkit_web_view_get_settings(test->m_webView), FALSE); 203 G_GNUC_END_IGNORE_DEPRECATIONS; 200 204 test->loadURI(kServer->getURIForPath("/auth-test.html").data()); 201 205 request = test->waitForAuthenticationRequest(); -
trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestCookieManager.cpp
r176256 r211138 291 291 } 292 292 293 static void ephemeralViewloadChanged(WebKitWebView* webView, WebKitLoadEvent loadEvent, WebViewTest* test) 294 { 295 if (loadEvent != WEBKIT_LOAD_FINISHED) 296 return; 297 g_signal_handlers_disconnect_by_func(webView, reinterpret_cast<void*>(ephemeralViewloadChanged), test); 298 test->quitMainLoop(); 299 } 300 301 static void testCookieManagerEphemeral(CookieManagerTest* test, gconstpointer) 302 { 303 test->setAcceptPolicy(WEBKIT_COOKIE_POLICY_ACCEPT_ALWAYS); 304 test->setPersistentStorage(WEBKIT_COOKIE_PERSISTENT_STORAGE_TEXT); 305 char** domains = test->getDomains(); 306 g_assert(domains); 307 g_assert_cmpint(g_strv_length(domains), ==, 0); 308 309 GRefPtr<WebKitWebView> webView = WEBKIT_WEB_VIEW(g_object_new(WEBKIT_TYPE_WEB_VIEW, 310 "web-context", webkit_web_view_get_context(test->m_webView), 311 "is-ephemeral", TRUE, 312 nullptr)); 313 g_assert(webkit_web_view_is_ephemeral(webView.get())); 314 g_assert(!webkit_web_context_is_ephemeral(webkit_web_view_get_context(webView.get()))); 315 316 g_signal_connect(webView.get(), "load-changed", G_CALLBACK(ephemeralViewloadChanged), test); 317 webkit_web_view_load_uri(webView.get(), kServer->getURIForPath("/index.html").data()); 318 g_main_loop_run(test->m_mainLoop); 319 320 domains = test->getDomains(); 321 g_assert(domains); 322 g_assert_cmpint(g_strv_length(domains), ==, 0); 323 } 324 293 325 static void serverCallback(SoupServer* server, SoupMessage* message, const char* path, GHashTable*, SoupClientContext*, gpointer) 294 326 { … … 319 351 CookieManagerTest::add("WebKitCookieManager", "cookies-changed", testCookieManagerCookiesChanged); 320 352 CookieManagerTest::add("WebKitCookieManager", "persistent-storage", testCookieManagerPersistentStorage); 353 CookieManagerTest::add("WebKitCookieManager", "ephemeral", testCookieManagerEphemeral); 321 354 } 322 355 -
trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitSettings.cpp
r199795 r211138 159 159 g_assert_cmpstr(webkit_settings_get_default_charset(settings), ==, "utf8"); 160 160 161 G_GNUC_BEGIN_IGNORE_DEPRECATIONS; 161 162 g_assert(!webkit_settings_get_enable_private_browsing(settings)); 162 163 webkit_settings_set_enable_private_browsing(settings, TRUE); 163 164 g_assert(webkit_settings_get_enable_private_browsing(settings)); 165 G_GNUC_END_IGNORE_DEPRECATIONS; 164 166 165 167 g_assert(!webkit_settings_get_enable_developer_extras(settings)); -
trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitWebContext.cpp
r211079 r211138 39 39 g_assert(webkit_web_context_get_default() == webkit_web_context_get_default()); 40 40 g_assert(webkit_web_context_get_default() != test->m_webContext.get()); 41 } 42 43 static void testWebContextEphemeral(Test* test, gconstpointer) 44 { 45 // By default web contexts are not ephemeral. 46 g_assert(!webkit_web_context_is_ephemeral(webkit_web_context_get_default())); 47 g_assert(!webkit_web_context_is_ephemeral(test->m_webContext.get())); 48 49 WebKitWebsiteDataManager* manager = webkit_web_context_get_website_data_manager(webkit_web_context_get_default()); 50 g_assert(WEBKIT_IS_WEBSITE_DATA_MANAGER(manager)); 51 g_assert(!webkit_website_data_manager_is_ephemeral(manager)); 52 manager = webkit_web_context_get_website_data_manager(test->m_webContext.get()); 53 g_assert(WEBKIT_IS_WEBSITE_DATA_MANAGER(manager)); 54 g_assert(!webkit_website_data_manager_is_ephemeral(manager)); 55 56 GRefPtr<WebKitWebView> webView = WEBKIT_WEB_VIEW(webkit_web_view_new()); 57 g_assert(!webkit_web_view_is_ephemeral(webView.get())); 58 59 webView = WEBKIT_WEB_VIEW(webkit_web_view_new_with_context(test->m_webContext.get())); 60 g_assert(!webkit_web_view_is_ephemeral(webView.get())); 61 62 GRefPtr<WebKitWebContext> context = adoptGRef(webkit_web_context_new_ephemeral()); 63 g_assert(webkit_web_context_is_ephemeral(context.get())); 64 manager = webkit_web_context_get_website_data_manager(context.get()); 65 g_assert(WEBKIT_IS_WEBSITE_DATA_MANAGER(manager)); 66 g_assert(webkit_website_data_manager_is_ephemeral(manager)); 67 68 webView = WEBKIT_WEB_VIEW(webkit_web_view_new_with_context(context.get())); 69 g_assert(webkit_web_view_is_ephemeral(webView.get())); 70 71 GRefPtr<WebKitWebsiteDataManager> ephemeralManager = adoptGRef(webkit_website_data_manager_new_ephemeral()); 72 g_assert(webkit_website_data_manager_is_ephemeral(ephemeralManager.get())); 73 context = adoptGRef(webkit_web_context_new_with_website_data_manager(ephemeralManager.get())); 74 g_assert(webkit_web_context_is_ephemeral(context.get())); 41 75 } 42 76 … … 643 677 }; 644 678 679 static void ephemeralViewloadChanged(WebKitWebView* webView, WebKitLoadEvent loadEvent, WebViewTest* test) 680 { 681 if (loadEvent != WEBKIT_LOAD_FINISHED) 682 return; 683 g_signal_handlers_disconnect_by_func(webView, reinterpret_cast<void*>(ephemeralViewloadChanged), test); 684 test->quitMainLoop(); 685 } 686 645 687 static void testWebContextProxySettings(ProxyTest* test, gconstpointer) 646 688 { … … 658 700 ASSERT_CMP_CSTRING(mainResourceData, ==, proxyServerPortAsString.get()); 659 701 webkit_network_proxy_settings_free(settings); 702 703 // Proxy settings also affect ephemeral web views. 704 GRefPtr<WebKitWebView> webView = WEBKIT_WEB_VIEW(g_object_new(WEBKIT_TYPE_WEB_VIEW, 705 "web-context", test->m_webContext.get(), 706 "is-ephemeral", TRUE, 707 nullptr)); 708 g_assert(webkit_web_view_is_ephemeral(webView.get())); 709 g_assert(!webkit_web_context_is_ephemeral(webkit_web_view_get_context(webView.get()))); 710 711 g_signal_connect(webView.get(), "load-changed", G_CALLBACK(ephemeralViewloadChanged), test); 712 webkit_web_view_load_uri(webView.get(), kServer->getURIForPath("/echoPort").data()); 713 g_main_loop_run(test->m_mainLoop); 714 WebKitWebResource* resource = webkit_web_view_get_main_resource(webView.get()); 715 g_assert(WEBKIT_IS_WEB_RESOURCE(resource)); 716 webkit_web_resource_get_data(resource, nullptr, [](GObject* object, GAsyncResult* result, gpointer userData) { 717 size_t dataSize; 718 GUniquePtr<char> data(reinterpret_cast<char*>(webkit_web_resource_get_data_finish(WEBKIT_WEB_RESOURCE(object), result, &dataSize, nullptr))); 719 g_assert(data); 720 auto* test = static_cast<ProxyTest*>(userData); 721 GUniquePtr<char> proxyServerPortAsString = test->proxyServerPortAsString(); 722 ASSERT_CMP_CSTRING(CString(data.get(), dataSize), ==, proxyServerPortAsString.get()); 723 test->quitMainLoop(); 724 }, test); 725 g_main_loop_run(test->m_mainLoop); 660 726 661 727 // Remove the proxy. Requests to kServer should be received by kServer again. … … 700 766 701 767 Test::add("WebKitWebContext", "default-context", testWebContextDefault); 768 Test::add("WebKitWebContext", "ephemeral", testWebContextEphemeral); 702 769 PluginsTest::add("WebKitWebContext", "get-plugins", testWebContextGetPlugins); 703 770 URISchemeTest::add("WebKitWebContext", "uri-scheme", testWebContextURIScheme); -
trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitWebView.cpp
r210833 r211138 95 95 } 96 96 97 static void ephemeralViewloadChanged(WebKitWebView* webView, WebKitLoadEvent loadEvent, WebViewTest* test) 98 { 99 if (loadEvent != WEBKIT_LOAD_FINISHED) 100 return; 101 g_signal_handlers_disconnect_by_func(webView, reinterpret_cast<void*>(ephemeralViewloadChanged), test); 102 test->quitMainLoop(); 103 } 104 105 static void testWebViewEphemeral(WebViewTest* test, gconstpointer) 106 { 107 g_assert(!webkit_web_view_is_ephemeral(test->m_webView)); 108 g_assert(!webkit_web_context_is_ephemeral(webkit_web_view_get_context(test->m_webView))); 109 auto* manager = webkit_web_context_get_website_data_manager(test->m_webContext.get()); 110 g_assert(!webkit_website_data_manager_is_ephemeral(manager)); 111 webkit_website_data_manager_clear(manager, WEBKIT_WEBSITE_DATA_DISK_CACHE, 0, nullptr, [](GObject* manager, GAsyncResult* result, gpointer userData) { 112 webkit_website_data_manager_clear_finish(WEBKIT_WEBSITE_DATA_MANAGER(manager), result, nullptr); 113 static_cast<WebViewTest*>(userData)->quitMainLoop(); 114 }, test); 115 g_main_loop_run(test->m_mainLoop); 116 117 // A WebView on a non ephemeral context can be ephemeral. 118 GRefPtr<WebKitWebView> webView = WEBKIT_WEB_VIEW(g_object_new(WEBKIT_TYPE_WEB_VIEW, 119 "web-context", webkit_web_view_get_context(test->m_webView), 120 "is-ephemeral", TRUE, 121 nullptr)); 122 g_assert(webkit_web_view_is_ephemeral(webView.get())); 123 g_assert(!webkit_web_context_is_ephemeral(webkit_web_view_get_context(webView.get()))); 124 125 g_signal_connect(webView.get(), "load-changed", G_CALLBACK(ephemeralViewloadChanged), test); 126 webkit_web_view_load_uri(webView.get(), gServer->getURIForPath("/").data()); 127 g_main_loop_run(test->m_mainLoop); 128 129 // Disk cache delays the storing of initial resources for 1 second to avoid 130 // affecting early page load. So, wait 1 second here to make sure resources 131 // have already been stored. 132 test->wait(1); 133 134 webkit_website_data_manager_fetch(manager, WEBKIT_WEBSITE_DATA_DISK_CACHE, nullptr, [](GObject* manager, GAsyncResult* result, gpointer userData) { 135 auto* test = static_cast<WebViewTest*>(userData); 136 g_assert(!webkit_website_data_manager_fetch_finish(WEBKIT_WEBSITE_DATA_MANAGER(manager), result, nullptr)); 137 test->quitMainLoop(); 138 }, test); 139 g_main_loop_run(test->m_mainLoop); 140 } 141 97 142 static void testWebViewCustomCharset(WebViewTest* test, gconstpointer) 98 143 { … … 1015 1060 WebViewTest::add("WebKitWebView", "web-context", testWebViewWebContext); 1016 1061 WebViewTest::add("WebKitWebView", "web-context-lifetime", testWebViewWebContextLifetime); 1062 WebViewTest::add("WebKitWebView", "ephemeral", testWebViewEphemeral); 1017 1063 WebViewTest::add("WebKitWebView", "custom-charset", testWebViewCustomCharset); 1018 1064 WebViewTest::add("WebKitWebView", "settings", testWebViewSettings); -
trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestWebsiteData.cpp
r211079 r211138 208 208 } 209 209 210 static void ephemeralViewloadChanged(WebKitWebView* webView, WebKitLoadEvent loadEvent, WebViewTest* test) 211 { 212 if (loadEvent != WEBKIT_LOAD_FINISHED) 213 return; 214 g_signal_handlers_disconnect_by_func(webView, reinterpret_cast<void*>(ephemeralViewloadChanged), test); 215 test->quitMainLoop(); 216 } 217 218 static void testWebsiteDataEphemeral(WebViewTest* test, gconstpointer) 219 { 220 GRefPtr<WebKitWebsiteDataManager> manager = adoptGRef(webkit_website_data_manager_new_ephemeral()); 221 g_assert(webkit_website_data_manager_is_ephemeral(manager.get())); 222 g_assert(!webkit_website_data_manager_get_base_data_directory(manager.get())); 223 g_assert(!webkit_website_data_manager_get_base_cache_directory(manager.get())); 224 g_assert(!webkit_website_data_manager_get_local_storage_directory(manager.get())); 225 g_assert(!webkit_website_data_manager_get_disk_cache_directory(manager.get())); 226 g_assert(!webkit_website_data_manager_get_offline_application_cache_directory(manager.get())); 227 g_assert(!webkit_website_data_manager_get_indexeddb_directory(manager.get())); 228 g_assert(!webkit_website_data_manager_get_websql_directory(manager.get())); 229 230 // Configuration is ignored when is-ephemeral is used. 231 manager = adoptGRef(WEBKIT_WEBSITE_DATA_MANAGER(g_object_new(WEBKIT_TYPE_WEBSITE_DATA_MANAGER, "base-data-directory", Test::dataDirectory(), "is-ephemeral", TRUE, nullptr))); 232 g_assert(webkit_website_data_manager_is_ephemeral(manager.get())); 233 g_assert(!webkit_website_data_manager_get_base_data_directory(manager.get())); 234 235 // Non persistent data can be queried in an ephemeral manager. 236 GRefPtr<WebKitWebContext> webContext = adoptGRef(webkit_web_context_new_with_website_data_manager(manager.get())); 237 g_assert(webkit_web_context_is_ephemeral(webContext.get())); 238 GRefPtr<WebKitWebView> webView = WEBKIT_WEB_VIEW(webkit_web_view_new_with_context(webContext.get())); 239 g_assert(webkit_web_view_is_ephemeral(webView.get())); 240 241 g_signal_connect(webView.get(), "load-changed", G_CALLBACK(ephemeralViewloadChanged), test); 242 webkit_web_view_load_uri(webView.get(), kServer->getURIForPath("/empty").data()); 243 g_main_loop_run(test->m_mainLoop); 244 245 webkit_website_data_manager_fetch(manager.get(), WEBKIT_WEBSITE_DATA_MEMORY_CACHE, nullptr, [](GObject* manager, GAsyncResult* result, gpointer userData) { 246 auto* test = static_cast<WebViewTest*>(userData); 247 GList* dataList = webkit_website_data_manager_fetch_finish(WEBKIT_WEBSITE_DATA_MANAGER(manager), result, nullptr); 248 g_assert(dataList); 249 g_assert_cmpuint(g_list_length(dataList), ==, 1); 250 WebKitWebsiteData* data = static_cast<WebKitWebsiteData*>(dataList->data); 251 g_assert(data); 252 WebKitSecurityOrigin* origin = webkit_security_origin_new_for_uri(kServer->getURIForPath("/").data()); 253 g_assert_cmpstr(webkit_website_data_get_name(data), ==, webkit_security_origin_get_host(origin)); 254 webkit_security_origin_unref(origin); 255 g_list_free_full(dataList, reinterpret_cast<GDestroyNotify>(webkit_website_data_unref)); 256 test->quitMainLoop(); 257 }, test); 258 g_main_loop_run(test->m_mainLoop); 259 } 260 210 261 static void testWebsiteDataCache(WebsiteDataTest* test, gconstpointer) 211 262 { … … 441 492 442 493 WebsiteDataTest::add("WebKitWebsiteData", "configuration", testWebsiteDataConfiguration); 494 WebViewTest::add("WebKitWebsiteData", "ephemeral", testWebsiteDataEphemeral); 443 495 WebsiteDataTest::add("WebKitWebsiteData", "cache", testWebsiteDataCache); 444 496 WebsiteDataTest::add("WebKitWebsiteData", "storage", testWebsiteDataStorage);
Note:
See TracChangeset
for help on using the changeset viewer.