Changeset 211147 in webkit
- Timestamp:
- Jan 25, 2017 9:02:58 AM (7 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r211145 r211147 1 2017-01-25 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 [GTK] Icon Database should be in private browsing mode for ephemeral web views 4 https://bugs.webkit.org/show_bug.cgi?id=167414 5 6 Reviewed by Michael Catanzaro. 7 8 This is already done by WebProcessPool for the legacy private session setting, but only checking the setting and not 9 whether there are ephemeral web pages or not. 10 11 * UIProcess/API/gtk/WebKitWebContext.cpp: 12 (webkitWebContextEnableIconDatabasePrivateBrowsingIfNeeded): Enable icon database private browsing if there's 13 any ephemeral web view. 14 (webkitWebContextDisableIconDatabasePrivateBrowsingIfNeeded): Disable icon database private browsing if there 15 aren't ephemeral web views anymore. 16 (webkit_web_context_set_favicon_database_directory): Enable icon database private browsing if the web context is ephemeral. 17 (webkitWebContextCreatePageForWebView): Call webkitWebContextEnableIconDatabasePrivateBrowsingIfNeeded(). 18 (webkitWebContextWebViewDestroyed): Call webkitWebContextDisableIconDatabasePrivateBrowsingIfNeeded(). 19 * UIProcess/API/gtk/WebKitWebView.cpp: 20 (webkitWebViewDispose): Ensure webkitWebContextWebViewDestroyed is called only once. 21 1 22 2017-01-25 Carlos Garcia Campos <cgarcia@igalia.com> 2 23 -
trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp
r211138 r211147 177 177 178 178 HashMap<uint64_t, WebKitWebView*> webViews; 179 unsigned ephemeralPageCount; 179 180 180 181 CString webExtensionsDirectory; … … 713 714 } 714 715 716 static void webkitWebContextEnableIconDatabasePrivateBrowsingIfNeeded(WebKitWebContext* context, WebKitWebView* webView) 717 { 718 if (webkit_web_context_is_ephemeral(context)) 719 return; 720 if (!webkit_web_view_is_ephemeral(webView)) 721 return; 722 723 if (!context->priv->ephemeralPageCount) 724 context->priv->processPool->iconDatabase()->setPrivateBrowsingEnabled(true); 725 context->priv->ephemeralPageCount++; 726 } 727 728 static void webkitWebContextDisableIconDatabasePrivateBrowsingIfNeeded(WebKitWebContext* context, WebKitWebView* webView) 729 { 730 if (webkit_web_context_is_ephemeral(context)) 731 return; 732 if (!webkit_web_view_is_ephemeral(webView)) 733 return; 734 735 ASSERT(context->priv->ephemeralPageCount); 736 context->priv->ephemeralPageCount--; 737 if (!context->priv->ephemeralPageCount) 738 context->priv->processPool->iconDatabase()->setPrivateBrowsingEnabled(false); 739 } 740 715 741 /** 716 742 * webkit_web_context_set_favicon_database_directory: … … 751 777 // Setting the path will cause the icon database to be opened. 752 778 priv->processPool->setIconDatabasePath(WebCore::stringFromFileSystemRepresentation(faviconDatabasePath.get())); 779 780 if (webkit_web_context_is_ephemeral(context)) 781 priv->processPool->iconDatabase()->setPrivateBrowsingEnabled(true); 753 782 } 754 783 … … 1459 1488 WebKitWebViewBase* webViewBase = WEBKIT_WEB_VIEW_BASE(webView); 1460 1489 1490 // FIXME: icon database private mode is global, not per page, so while there are 1491 // pages in private mode we need to enable the private mode in the icon database. 1492 webkitWebContextEnableIconDatabasePrivateBrowsingIfNeeded(context, webView); 1493 1461 1494 auto pageConfiguration = API::PageConfiguration::create(); 1462 1495 pageConfiguration->setProcessPool(context->priv->processPool.get()); … … 1478 1511 void webkitWebContextWebViewDestroyed(WebKitWebContext* context, WebKitWebView* webView) 1479 1512 { 1513 webkitWebContextDisableIconDatabasePrivateBrowsingIfNeeded(context, webView); 1480 1514 WebPageProxy* page = webkitWebViewBaseGetPage(WEBKIT_WEB_VIEW_BASE(webView)); 1481 1515 context->priv->webViews.remove(page->pageID()); -
trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp
r211138 r211147 779 779 getPage(webView)->pageLoadState().removeObserver(*webView->priv->loadObserver); 780 780 webView->priv->loadObserver.reset(); 781 782 // We notify the context here to ensure it's called only once. Ideally we should 783 // call this in finalize, not dispose, but finalize is used internally and we don't 784 // have access to the instance pointer from the private struct destructor. 785 webkitWebContextWebViewDestroyed(webView->priv->context.get(), webView); 781 786 } 782 783 webkitWebContextWebViewDestroyed(webView->priv->context.get(), webView);784 787 785 788 G_OBJECT_CLASS(webkit_web_view_parent_class)->dispose(object); -
trunk/Tools/ChangeLog
r211146 r211147 1 2017-01-25 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 [GTK] Icon Database should be in private browsing mode for ephemeral web views 4 https://bugs.webkit.org/show_bug.cgi?id=167414 5 6 Reviewed by Michael Catanzaro. 7 8 Add a test case to check ephemeral web views don't write favicons to the database. 9 10 * TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitFaviconDatabase.cpp: 11 (ephemeralViewLoadChanged): 12 (testPrivateBrowsing): 13 (testFaviconDatabase): 14 1 15 2017-01-25 Carlos Garcia Campos <cgarcia@igalia.com> 2 16 -
trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitFaviconDatabase.cpp
r185502 r211147 153 153 } 154 154 155 static void ephemeralViewLoadChanged(WebKitWebView* webView, WebKitLoadEvent loadEvent, WebViewTest* test) 156 { 157 if (loadEvent != WEBKIT_LOAD_FINISHED) 158 return; 159 g_signal_handlers_disconnect_by_func(webView, reinterpret_cast<void*>(ephemeralViewLoadChanged), test); 160 test->quitMainLoop(); 161 } 162 163 static void testPrivateBrowsing(FaviconDatabaseTest* test) 164 { 165 GRefPtr<WebKitWebView> webView = WEBKIT_WEB_VIEW(g_object_new(WEBKIT_TYPE_WEB_VIEW, 166 "web-context", test->m_webContext.get(), 167 "is-ephemeral", TRUE, 168 nullptr)); 169 g_signal_connect(webView.get(), "load-changed", G_CALLBACK(ephemeralViewLoadChanged), test); 170 webkit_web_view_load_uri(webView.get(), kServer->getURIForPath("/foo").data()); 171 g_main_loop_run(test->m_mainLoop); 172 173 // An ephemeral web view should not write to the database. 174 test->getFaviconForPageURIAndWaitUntilReady(kServer->getURIForPath("/foo").data()); 175 g_assert(!test->m_favicon); 176 g_assert(test->m_error); 177 } 178 155 179 static void testGetFavicon(FaviconDatabaseTest* test) 156 180 { … … 229 253 testNotInitialized(test); 230 254 testSetDirectory(test); 255 testPrivateBrowsing(test); 231 256 testGetFavicon(test); 232 257 testGetFaviconURI(test);
Note: See TracChangeset
for help on using the changeset viewer.