Changeset 225043 in webkit
- Timestamp:
- Nov 20, 2017 12:11:29 AM (6 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r225042 r225043 1 2017-11-20 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 [GTK][WPE] webkit_cookie_manager_delete_all_cookies doesn't delete the cookies if called before a web process is running 4 https://bugs.webkit.org/show_bug.cgi?id=175265 5 6 Reviewed by Michael Catanzaro. 7 8 This is what happens: 9 10 1- We create our WebKitWebContext that creates its WebProcessPool. 11 2- We set a persistent cookies storage. 12 3- We ask the website data store to delete all cookies, but since website data store is a web process observer 13 and we haven't spawned any web process yet, it creates a new WebProcessPool with the default configuration 14 (no persistent cookies) and sends the message to delete the cookies there. 15 4- The network process of the second process pool does nothing because it doesn't have cookies at all. 16 17 We need to set the primary data store of the WebProcessPool when WebKitWebContext is constructed to ensure that 18 one is used before the web process is launched. 19 20 * UIProcess/API/glib/WebKitWebContext.cpp: 21 (webkitWebContextConstructed): 22 1 23 2017-11-19 Tim Horton <timothy_horton@apple.com> 2 24 -
trunk/Source/WebKit/UIProcess/API/glib/WebKitWebContext.cpp
r224371 r225043 342 342 if (!priv->websiteDataManager) 343 343 priv->websiteDataManager = adoptGRef(webkitWebsiteDataManagerCreate(websiteDataStoreConfigurationForWebProcessPoolConfiguration(configuration))); 344 priv->processPool->setPrimaryDataStore(webkitWebsiteDataManagerGetDataStore(priv->websiteDataManager.get())); 344 345 345 346 webkitWebsiteDataManagerAddProcessPool(priv->websiteDataManager.get(), *priv->processPool); -
trunk/Tools/ChangeLog
r225042 r225043 1 2017-11-20 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 [GTK][WPE] webkit_cookie_manager_delete_all_cookies doesn't delete the cookies if called before a web process is running 4 https://bugs.webkit.org/show_bug.cgi?id=175265 5 6 Reviewed by Michael Catanzaro. 7 8 Add test case. 9 10 * TestWebKitAPI/Tests/WebKitGLib/TestCookieManager.cpp: 11 (testCookieManagerPersistentStorageDeleteAll): 12 (serverCallback): 13 (beforeAll): 14 1 15 2017-11-19 Tim Horton <timothy_horton@apple.com> 2 16 -
trunk/Tools/TestWebKitAPI/Tests/WebKitGLib/TestCookieManager.cpp
r218686 r225043 41 41 { 42 42 test->m_cookiesChanged = true; 43 if (test->m_finishLoopWhenCookiesChange )43 if (test->m_finishLoopWhenCookiesChange && !(--test->m_cookiesExpectedToChangeCount)) 44 44 g_main_loop_quit(test->m_mainLoop); 45 45 } … … 48 48 : WebViewTest() 49 49 , m_cookieManager(webkit_web_context_get_cookie_manager(webkit_web_view_get_context(m_webView))) 50 , m_acceptPolicy(WEBKIT_COOKIE_POLICY_ACCEPT_NO_THIRD_PARTY)51 , m_domains(0)52 , m_cookiesChanged(false)53 , m_finishLoopWhenCookiesChange(false)54 50 { 55 51 g_assert(webkit_website_data_manager_get_cookie_manager(webkit_web_context_get_website_data_manager(webkit_web_view_get_context(m_webView))) == m_cookieManager); … … 163 159 } 164 160 165 void waitUntilCookiesChanged( )161 void waitUntilCookiesChanged(int cookiesExpectedToChangeCount = 1) 166 162 { 167 163 m_cookiesChanged = false; 164 m_cookiesExpectedToChangeCount = cookiesExpectedToChangeCount; 168 165 m_finishLoopWhenCookiesChange = true; 169 166 g_main_loop_run(m_mainLoop); … … 171 168 } 172 169 173 WebKitCookieManager* m_cookieManager; 174 WebKitCookieAcceptPolicy m_acceptPolicy; 175 char** m_domains; 176 bool m_cookiesChanged; 177 bool m_finishLoopWhenCookiesChange; 170 WebKitCookieManager* m_cookieManager { nullptr }; 171 WebKitCookieAcceptPolicy m_acceptPolicy { WEBKIT_COOKIE_POLICY_ACCEPT_NO_THIRD_PARTY }; 172 char** m_domains { nullptr }; 173 bool m_cookiesChanged { false }; 174 int m_cookiesExpectedToChangeCount { 0 }; 175 bool m_finishLoopWhenCookiesChange { false }; 178 176 GUniquePtr<char> m_cookiesTextFile; 179 177 GUniquePtr<char> m_cookiesSQLiteFile; … … 299 297 test->deleteAllCookies(); 300 298 g_assert_cmpint(g_strv_length(test->getDomains()), ==, 0); 299 } 300 301 static void testCookieManagerPersistentStorageDeleteAll(CookieManagerTest* test, gconstpointer) 302 { 303 // This checks that we can remove all the cookies of an existing file before a web process is created. 304 // See bug https://bugs.webkit.org/show_bug.cgi?id=175265. 305 static const char cookiesFileFormat[] = "127.0.0.1\tFALSE\t/\tFALSE\t%ld\tfoo\tbar\nlocalhost\tFALSE\t/\tFALSE\t%ld\tbaz\tqux\n"; 306 time_t expires = time(nullptr) + 60; 307 GUniquePtr<char> cookiesFileContents(g_strdup_printf(cookiesFileFormat, expires, expires)); 308 GUniquePtr<char> cookiesFile(g_build_filename(Test::dataDirectory(), "cookies.txt", nullptr)); 309 g_assert(g_file_set_contents(cookiesFile.get(), cookiesFileContents.get(), -1, nullptr)); 310 311 test->setPersistentStorage(WEBKIT_COOKIE_PERSISTENT_STORAGE_TEXT); 312 test->deleteAllCookies(); 313 // Changed signal is emitted for every deleted cookie, twice in this case. 314 test->waitUntilCookiesChanged(2); 315 316 // Ensure the web process is created and load something without cookies. 317 test->m_cookiesChanged = false; 318 test->loadURI(kServer->getURIForPath("/no-cookies.html").data()); 319 test->waitUntilLoadFinished(); 320 g_assert(!test->m_cookiesChanged); 321 char** domains = test->getDomains(); 322 g_assert(domains); 323 g_assert_cmpint(g_strv_length(domains), ==, 0); 301 324 } 302 325 … … 367 390 } else if (g_str_equal(path, "/image.png")) 368 391 soup_message_headers_replace(message->response_headers, "Set-Cookie", "baz=qux; Max-Age=60"); 369 else 392 else if (g_str_equal(path, "/no-cookies.html")) { 393 static const char* indexHtml = "<html><body><p>No cookies</p></body></html>"; 394 soup_message_body_append(message->response_body, SOUP_MEMORY_STATIC, indexHtml, strlen(indexHtml)); 395 } else 370 396 soup_message_set_status(message, SOUP_STATUS_NOT_FOUND); 371 397 soup_message_body_complete(message->response_body); … … 381 407 CookieManagerTest::add("WebKitCookieManager", "cookies-changed", testCookieManagerCookiesChanged); 382 408 CookieManagerTest::add("WebKitCookieManager", "persistent-storage", testCookieManagerPersistentStorage); 409 CookieManagerTest::add("WebKitCookieManager", "persistent-storage-delete-all", testCookieManagerPersistentStorageDeleteAll); 383 410 CookieManagerTest::add("WebKitCookieManager", "ephemeral", testCookieManagerEphemeral); 384 411 }
Note: See TracChangeset
for help on using the changeset viewer.