Changeset 260356 in webkit
- Timestamp:
- Apr 20, 2020 1:33:58 AM (4 years ago)
- Location:
- trunk
- Files:
-
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ChangeLog
r260277 r260356 1 2020-04-20 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 [GTK][WPE] Enable resource load statistics 4 https://bugs.webkit.org/show_bug.cgi?id=210184 5 6 Reviewed by Žan Doberšek. 7 8 Enable resource load statistics. 9 10 * Source/cmake/OptionsGTK.cmake: 11 * Source/cmake/OptionsWPE.cmake: 12 1 13 2020-04-17 Don Olmstead <don.olmstead@sony.com> 2 14 -
trunk/LayoutTests/ChangeLog
r260352 r260356 1 2020-04-20 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 [GTK][WPE] Enable resource load statistics 4 https://bugs.webkit.org/show_bug.cgi?id=210184 5 6 Reviewed by Žan Doberšek. 7 8 Unskip tests that are now passing and add expectations for the two reminaing failures. 9 10 * http/tests/resourceLoadStatistics/loaded-registrable-domains-get-reported.html: Use setTimeout in onload 11 handler to avoid a deadlock due to sync injected bundle messages. 12 * platform/gtk/TestExpectations: 13 * platform/wpe/TestExpectations: 14 1 15 2020-04-19 Yusuke Suzuki <ysuzuki@apple.com> 2 16 -
trunk/LayoutTests/http/tests/resourceLoadStatistics/loaded-registrable-domains-get-reported.html
r258421 r260356 25 25 </head> 26 26 <body> 27 <iframe onload= 'askForLoadedThirdPartyDomains()'src="http://localhost:8000/resourceLoadStatistics/resources/basic-iframe.html">27 <iframe onload="setTimeout('askForLoadedThirdPartyDomains()', 0)" src="http://localhost:8000/resourceLoadStatistics/resources/basic-iframe.html"> 28 28 </iframe> 29 29 </body> -
trunk/LayoutTests/platform/gtk/TestExpectations
r260183 r260356 1181 1181 webkit.org/b/191005 inspector/canvas/updateShader-webgpu-sharedVertexFragment.html [ Skip ] 1182 1182 1183 # No support for resource load statistics yet1184 http/tests/resourceLoadStatistics/ [ Skip ]1185 http/tests/websocket/web-socket-loads-captured-in-per-page-domains.html [ Skip ]1186 1187 1183 # No support for screen capture 1188 1184 fast/mediastream/screencapture-user-gesture.html [ Skip ] … … 1445 1441 webkit.org/b/210601 imported/w3c/web-platform-tests/web-animations/interfaces/KeyframeEffect/style-change-events.html [ Failure ] 1446 1442 webkit.org/b/210601 imported/w3c/web-platform-tests/web-animations/interfaces/KeyframeEffect/target.html [ Failure ] 1443 1444 webkit.org/b/210487 http/tests/resourceLoadStatistics/switch-session-on-navigation-to-prevalent-with-interaction-database.php [ Failure ] 1445 webkit.org/b/210487 http/tests/resourceLoadStatistics/switch-session-on-navigation-to-prevalent-with-interaction.php [ Failure ] 1447 1446 1448 1447 #//////////////////////////////////////////////////////////////////////////////////////// -
trunk/LayoutTests/platform/wpe/TestExpectations
r260182 r260356 738 738 # Currently enabled on Mac only 739 739 media/media-usage-state.html [ Skip ] 740 741 webkit.org/b/210487 http/tests/resourceLoadStatistics/switch-session-on-navigation-to-prevalent-with-interaction-database.php [ Failure ] 742 webkit.org/b/210487 http/tests/resourceLoadStatistics/switch-session-on-navigation-to-prevalent-with-interaction.php [ Failure ] 740 743 741 744 #//////////////////////////////////////////////////////////////////////////////////////// -
trunk/Source/WebCore/ChangeLog
r260353 r260356 1 2020-04-20 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 [GTK][WPE] Enable resource load statistics 4 https://bugs.webkit.org/show_bug.cgi?id=210184 5 6 Reviewed by Žan Doberšek. 7 8 * platform/network/soup/NetworkStorageSessionSoup.cpp: 9 (WebCore::NetworkStorageSession::setCookiesFromDOM const): Return early if cookies are blocked and update the 10 persistent cookies expiration if needed. 11 (WebCore::NetworkStorageSession::deleteCookiesForHostnames): Implement this when receiving 12 IncludeHttpOnlyCookies parameter. 13 (WebCore::NetworkStorageSession::hasCookies const): Implement this. 14 (WebCore::NetworkStorageSession::getRawCookies const): Honor shouldAskITP parameter. 15 (WebCore::cookiesForSession): Ditto. 16 (WebCore::NetworkStorageSession::cookiesForDOM const): Ditto. 17 (WebCore::NetworkStorageSession::cookieRequestHeaderFieldValue const): Ditto. 18 1 19 2020-04-19 Simon Fraser <simon.fraser@apple.com> 2 20 -
trunk/Source/WebCore/platform/network/soup/NetworkStorageSessionSoup.cpp
r258698 r260356 269 269 } 270 270 271 void NetworkStorageSession::setCookiesFromDOM(const URL& firstParty, const SameSiteInfo&, const URL& url, Optional<FrameIdentifier> frameID, Optional<PageIdentifier> pageID, ShouldAskITP, const String& value) const 272 { 271 void NetworkStorageSession::setCookiesFromDOM(const URL& firstParty, const SameSiteInfo&, const URL& url, Optional<FrameIdentifier> frameID, Optional<PageIdentifier> pageID, ShouldAskITP shouldAskITP, const String& value) const 272 { 273 #if ENABLE(RESOURCE_LOAD_STATISTICS) 274 if (shouldAskITP == ShouldAskITP::Yes && shouldBlockCookies(firstParty, url, frameID, pageID)) 275 return; 276 #else 273 277 UNUSED_PARAM(frameID); 274 278 UNUSED_PARAM(pageID); 279 UNUSED_PARAM(shouldAskITP); 280 #endif 275 281 GUniquePtr<SoupURI> origin = urlToSoupURI(url); 276 282 if (!origin) … … 280 286 if (!firstPartyURI) 281 287 return; 288 289 #if ENABLE(RESOURCE_LOAD_STATISTICS) 290 auto cappedLifetime = clientSideCookieCap(RegistrableDomain { firstParty }, pageID); 291 #endif 282 292 283 293 // Get existing cookies for this origin. … … 298 308 if (httpOnlyCookieExists(existingCookies, soup_cookie_get_name(cookie.get()), soup_cookie_get_path(cookie.get()))) 299 309 continue; 310 311 #if ENABLE(RESOURCE_LOAD_STATISTICS) 312 // Cap lifetime of persistent, client-side cookies to a week. 313 if (cappedLifetime) { 314 if (auto* expiresDate = soup_cookie_get_expires(cookie.get())) { 315 auto timeIntervalSinceNow = Seconds(static_cast<double>(soup_date_to_time_t(expiresDate))) - WallTime::now().secondsSinceEpoch(); 316 if (timeIntervalSinceNow > cappedLifetime.value()) 317 soup_cookie_set_max_age(cookie.get(), cappedLifetime->secondsAs<int>()); 318 } 319 } 320 #endif 300 321 301 322 #if SOUP_CHECK_VERSION(2, 67, 1) … … 381 402 void NetworkStorageSession::deleteCookiesForHostnames(const Vector<String>& hostnames, IncludeHttpOnlyCookies includeHttpOnlyCookies) 382 403 { 383 // FIXME: Not yet implemented.384 UNUSED_PARAM(includeHttpOnlyCookies);385 deleteCookiesForHostnames(hostnames);386 }387 388 void NetworkStorageSession::deleteCookiesForHostnames(const Vector<String>& hostnames)389 {390 404 SoupCookieJar* cookieJar = cookieStorage(); 391 392 405 for (const auto& hostname : hostnames) { 393 406 CString hostNameString = hostname.utf8(); 394 407 395 408 GUniquePtr<GSList> cookies(soup_cookie_jar_all_cookies(cookieJar)); 396 for (GSList* item = cookies.get(); item; item = g_slist_next(item)) { 397 SoupCookie* cookie = static_cast<SoupCookie*>(item->data); 398 if (soup_cookie_domain_matches(cookie, hostNameString.data())) 399 soup_cookie_jar_delete_cookie(cookieJar, cookie); 400 soup_cookie_free(cookie); 409 for (auto* item = cookies.get(); item; item = g_slist_next(item)) { 410 GUniquePtr<SoupCookie> cookie(static_cast<SoupCookie*>(item->data)); 411 if (includeHttpOnlyCookies == IncludeHttpOnlyCookies::No && soup_cookie_get_http_only(cookie.get())) 412 continue; 413 414 if (soup_cookie_domain_matches(cookie.get(), hostNameString.data())) 415 soup_cookie_jar_delete_cookie(cookieJar, cookie.get()); 401 416 } 402 417 } 418 } 419 420 void NetworkStorageSession::deleteCookiesForHostnames(const Vector<String>& hostnames) 421 { 422 deleteCookiesForHostnames(hostnames, IncludeHttpOnlyCookies::Yes); 403 423 } 404 424 … … 441 461 } 442 462 443 void NetworkStorageSession::hasCookies(const RegistrableDomain&, CompletionHandler<void(bool)>&& completionHandler) const 444 { 445 // FIXME: Implement. 463 void NetworkStorageSession::hasCookies(const RegistrableDomain& domain, CompletionHandler<void(bool)>&& completionHandler) const 464 { 465 GUniquePtr<GSList> cookies(soup_cookie_jar_all_cookies(cookieStorage())); 466 for (auto* item = cookies.get(); item; item = g_slist_next(item)) { 467 GUniquePtr<SoupCookie> cookie(static_cast<SoupCookie*>(item->data)); 468 if (RegistrableDomain::uncheckedCreateFromHost(cookie->domain) == domain) { 469 completionHandler(true); 470 return; 471 } 472 } 446 473 completionHandler(false); 447 474 } 448 475 449 bool NetworkStorageSession::getRawCookies(const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, Optional<FrameIdentifier> frameID, Optional<PageIdentifier> pageID, ShouldAskITP , Vector<Cookie>& rawCookies) const476 bool NetworkStorageSession::getRawCookies(const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, Optional<FrameIdentifier> frameID, Optional<PageIdentifier> pageID, ShouldAskITP shouldAskITP, Vector<Cookie>& rawCookies) const 450 477 { 451 478 rawCookies.clear(); 452 479 453 480 #if ENABLE(RESOURCE_LOAD_STATISTICS) 454 if (should BlockCookies(firstParty, url, frameID, pageID))481 if (shouldAskITP == ShouldAskITP::Yes && shouldBlockCookies(firstParty, url, frameID, pageID)) 455 482 return true; 456 483 #else 457 484 UNUSED_PARAM(frameID); 458 485 UNUSED_PARAM(pageID); 486 UNUSED_PARAM(shouldAskITP); 459 487 #endif 460 488 … … 488 516 } 489 517 490 static std::pair<String, bool> cookiesForSession(const NetworkStorageSession& session, const URL& firstParty, const URL& url, const SameSiteInfo& sameSiteInfo, Optional<FrameIdentifier> frameID, Optional<PageIdentifier> pageID, bool forHTTPHeader, IncludeSecureCookies includeSecureCookies )518 static std::pair<String, bool> cookiesForSession(const NetworkStorageSession& session, const URL& firstParty, const URL& url, const SameSiteInfo& sameSiteInfo, Optional<FrameIdentifier> frameID, Optional<PageIdentifier> pageID, bool forHTTPHeader, IncludeSecureCookies includeSecureCookies, ShouldAskITP shouldAskITP) 491 519 { 492 520 #if ENABLE(RESOURCE_LOAD_STATISTICS) 493 if (s ession.shouldBlockCookies(firstParty, url, frameID, pageID))521 if (shouldAskITP == ShouldAskITP::Yes && session.shouldBlockCookies(firstParty, url, frameID, pageID)) 494 522 return { { }, false }; 495 523 #else 496 524 UNUSED_PARAM(frameID); 497 525 UNUSED_PARAM(pageID); 526 UNUSED_PARAM(shouldAskITP); 498 527 #endif 499 528 … … 544 573 } 545 574 546 std::pair<String, bool> NetworkStorageSession::cookiesForDOM(const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, Optional<FrameIdentifier> frameID, Optional<PageIdentifier> pageID, IncludeSecureCookies includeSecureCookies, ShouldAskITP ) const547 { 548 return cookiesForSession(*this, firstParty, url, sameSiteInfo, frameID, pageID, false, includeSecureCookies );549 } 550 551 std::pair<String, bool> NetworkStorageSession::cookieRequestHeaderFieldValue(const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, Optional<FrameIdentifier> frameID, Optional<PageIdentifier> pageID, IncludeSecureCookies includeSecureCookies, ShouldAskITP ) const575 std::pair<String, bool> NetworkStorageSession::cookiesForDOM(const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, Optional<FrameIdentifier> frameID, Optional<PageIdentifier> pageID, IncludeSecureCookies includeSecureCookies, ShouldAskITP shouldAskITP) const 576 { 577 return cookiesForSession(*this, firstParty, url, sameSiteInfo, frameID, pageID, false, includeSecureCookies, shouldAskITP); 578 } 579 580 std::pair<String, bool> NetworkStorageSession::cookieRequestHeaderFieldValue(const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, Optional<FrameIdentifier> frameID, Optional<PageIdentifier> pageID, IncludeSecureCookies includeSecureCookies, ShouldAskITP shouldAskITP) const 552 581 { 553 582 // Secure cookies will still only be included if url's protocol is https. 554 return cookiesForSession(*this, firstParty, url, sameSiteInfo, frameID, pageID, true, includeSecureCookies );583 return cookiesForSession(*this, firstParty, url, sameSiteInfo, frameID, pageID, true, includeSecureCookies, shouldAskITP); 555 584 } 556 585 -
trunk/Source/WebKit/ChangeLog
r260354 r260356 1 2020-04-20 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 [GTK][WPE] Enable resource load statistics 4 https://bugs.webkit.org/show_bug.cgi?id=210184 5 6 Reviewed by Žan Doberšek. 7 8 * NetworkProcess/NetworkDataTask.cpp: 9 (WebKit::NetworkDataTask::create): Pass page and frame identifiers to the constructor. 10 (WebKit::NetworkDataTask::isThirdPartyRequest const): Moved from NetworkDataTaskCocoa.mm. 11 (WebKit::NetworkDataTask::restrictRequestReferrerToOriginIfNeeded): Ditto. 12 * NetworkProcess/NetworkDataTask.h: 13 * NetworkProcess/cocoa/NetworkDataTaskCocoa.h: 14 * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm: 15 * NetworkProcess/soup/NetworkDataTaskSoup.cpp: 16 (WebKit::NetworkDataTaskSoup::NetworkDataTaskSoup): Initialize m_frameID and m_pageID. 17 (WebKit::NetworkDataTaskSoup::createRequest): Add WasBlockingCookies parameter. Call 18 restrictRequestReferrerToOriginIfNeeded() and disable cookies in the soup message if cookies should be blocked. 19 (WebKit::NetworkDataTaskSoup::clearRequest): Reset m_isBlockingCookies. 20 (WebKit::NetworkDataTaskSoup::continueHTTPRedirection): Pass WasBlockingCookies to createRequest(). 21 * NetworkProcess/soup/NetworkDataTaskSoup.h: 22 * UIProcess/API/C/WKPage.cpp: 23 (WKPageLoadedThirdPartyDomains): Added for tests. 24 (WKPageClearLoadedThirdPartyDomains): Ditto. 25 * UIProcess/API/C/WKPagePrivate.h: 26 * UIProcess/glib/WebsiteDataStoreGLib.cpp: 27 (WebKit::WebsiteDataStore::defaultResourceLoadStatisticsDirectory): Use lowercase for consistency with other 28 default directories. 29 1 30 2020-04-20 David Kilzer <ddkilzer@apple.com> 2 31 -
trunk/Source/WebKit/NetworkProcess/NetworkDataTask.cpp
r259241 r260356 31 31 #include "NetworkLoadParameters.h" 32 32 #include "NetworkSession.h" 33 #include <WebCore/RegistrableDomain.h> 33 34 #include <WebCore/ResourceError.h> 35 #include <WebCore/ResourceRequest.h> 34 36 #include <WebCore/ResourceResponse.h> 35 37 #include <wtf/RunLoop.h> … … 55 57 #endif 56 58 #if USE(SOUP) 57 return NetworkDataTaskSoup::create(session, client, parameters.request, parameters. storedCredentialsPolicy, parameters.contentSniffingPolicy, parameters.contentEncodingSniffingPolicy, parameters.shouldClearReferrerOnHTTPSToHTTPRedirect, parameters.isMainFrameNavigation);59 return NetworkDataTaskSoup::create(session, client, parameters.request, parameters.webFrameID, parameters.webPageID, parameters.storedCredentialsPolicy, parameters.contentSniffingPolicy, parameters.contentEncodingSniffingPolicy, parameters.shouldClearReferrerOnHTTPSToHTTPRedirect, parameters.isMainFrameNavigation); 58 60 #endif 59 61 #if USE(CURL) … … 170 172 } 171 173 174 bool NetworkDataTask::isThirdPartyRequest(const WebCore::ResourceRequest& request) const 175 { 176 return !WebCore::areRegistrableDomainsEqual(request.url(), request.firstPartyForCookies()); 177 } 178 179 void NetworkDataTask::restrictRequestReferrerToOriginIfNeeded(WebCore::ResourceRequest& request) 180 { 181 if ((m_session->sessionID().isEphemeral() || m_session->isResourceLoadStatisticsEnabled()) && m_session->shouldDowngradeReferrer() && isThirdPartyRequest(request)) 182 request.setExistingHTTPReferrerToOriginString(); 183 } 184 172 185 } // namespace WebKit -
trunk/Source/WebKit/NetworkProcess/NetworkDataTask.h
r255846 r260356 149 149 void scheduleFailure(FailureType); 150 150 151 bool isThirdPartyRequest(const WebCore::ResourceRequest&) const; 152 void restrictRequestReferrerToOriginIfNeeded(WebCore::ResourceRequest&); 153 151 154 FailureType m_scheduledFailureType { NoFailure }; 152 155 WebCore::Timer m_failureTimer; -
trunk/Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.h
r260031 r260356 82 82 void applySniffingPoliciesAndBindRequestToInferfaceIfNeeded(__strong NSURLRequest*&, bool shouldContentSniff, bool shouldContentEncodingSniff); 83 83 84 void restrictRequestReferrerToOriginIfNeeded(WebCore::ResourceRequest&);85 86 84 #if ENABLE(RESOURCE_LOAD_STATISTICS) 87 85 static NSHTTPCookieStorage *statelessCookieStorage(); … … 90 88 bool needsFirstPartyCookieBlockingLatchModeQuirk(const URL& firstPartyURL, const URL& requestURL, const URL& redirectingURL) const; 91 89 #endif 92 bool isThirdPartyRequest(const WebCore::ResourceRequest&) const;93 90 bool isAlwaysOnLoggingAllowed() const; 94 91 -
trunk/Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm
r260031 r260356 39 39 #import <WebCore/NetworkStorageSession.h> 40 40 #import <WebCore/NotImplemented.h> 41 #import <WebCore/RegistrableDomain.h>42 41 #import <WebCore/ResourceRequest.h> 43 42 #import <pal/spi/cf/CFNetworkSPI.h> … … 178 177 } 179 178 #endif 180 181 bool NetworkDataTaskCocoa::isThirdPartyRequest(const WebCore::ResourceRequest& request) const182 {183 return !WebCore::areRegistrableDomainsEqual(request.url(), request.firstPartyForCookies());184 }185 179 186 180 static void updateTaskWithFirstPartyForSameSiteCookies(NSURLSessionDataTask* task, const WebCore::ResourceRequest& request) … … 300 294 RELEASE_ASSERT(m_sessionWrapper->dataTaskMap.get([m_task taskIdentifier]) == this); 301 295 m_sessionWrapper->dataTaskMap.remove([m_task taskIdentifier]); 302 }303 304 void NetworkDataTaskCocoa::restrictRequestReferrerToOriginIfNeeded(WebCore::ResourceRequest& request)305 {306 if ((m_session->sessionID().isEphemeral() || m_session->isResourceLoadStatisticsEnabled()) && m_session->shouldDowngradeReferrer() && isThirdPartyRequest(request))307 request.setExistingHTTPReferrerToOriginString();308 296 } 309 297 -
trunk/Source/WebKit/NetworkProcess/soup/NetworkDataTaskSoup.cpp
r258685 r260356 51 51 static const size_t gDefaultReadBufferSize = 8192; 52 52 53 NetworkDataTaskSoup::NetworkDataTaskSoup(NetworkSession& session, NetworkDataTaskClient& client, const ResourceRequest& requestWithCredentials, StoredCredentialsPolicy storedCredentialsPolicy, ContentSniffingPolicy shouldContentSniff, WebCore::ContentEncodingSniffingPolicy, bool shouldClearReferrerOnHTTPSToHTTPRedirect, bool dataTaskIsForMainFrameNavigation)53 NetworkDataTaskSoup::NetworkDataTaskSoup(NetworkSession& session, NetworkDataTaskClient& client, const ResourceRequest& requestWithCredentials, FrameIdentifier frameID, PageIdentifier pageID, StoredCredentialsPolicy storedCredentialsPolicy, ContentSniffingPolicy shouldContentSniff, WebCore::ContentEncodingSniffingPolicy, bool shouldClearReferrerOnHTTPSToHTTPRedirect, bool dataTaskIsForMainFrameNavigation) 54 54 : NetworkDataTask(session, client, requestWithCredentials, storedCredentialsPolicy, shouldClearReferrerOnHTTPSToHTTPRedirect, dataTaskIsForMainFrameNavigation) 55 , m_frameID(frameID) 56 , m_pageID(pageID) 55 57 , m_shouldContentSniff(shouldContentSniff) 56 58 , m_timeoutSource(RunLoop::main(), this, &NetworkDataTaskSoup::timeoutFired) … … 76 78 applyAuthenticationToRequest(request); 77 79 } 78 createRequest(WTFMove(request) );80 createRequest(WTFMove(request), WasBlockingCookies::No); 79 81 } 80 82 … … 104 106 } 105 107 106 void NetworkDataTaskSoup::createRequest(ResourceRequest&& request )108 void NetworkDataTaskSoup::createRequest(ResourceRequest&& request, WasBlockingCookies wasBlockingCookies) 107 109 { 108 110 m_currentRequest = WTFMove(request); … … 133 135 return; 134 136 } 137 138 restrictRequestReferrerToOriginIfNeeded(m_currentRequest); 135 139 136 140 unsigned messageFlags = SOUP_MESSAGE_NO_REDIRECT; … … 149 153 } 150 154 155 #if ENABLE(RESOURCE_LOAD_STATISTICS) 156 bool shouldBlockCookies = wasBlockingCookies == WasBlockingCookies::Yes ? true : m_storedCredentialsPolicy == StoredCredentialsPolicy::EphemeralStateless; 157 if (!shouldBlockCookies) { 158 if (auto* networkStorageSession = m_session->networkStorageSession()) 159 shouldBlockCookies = networkStorageSession->shouldBlockCookies(m_currentRequest, m_frameID, m_pageID); 160 } 161 if (shouldBlockCookies) 162 soup_message_disable_feature(soupMessage.get(), SOUP_TYPE_COOKIE_JAR); 163 m_isBlockingCookies = shouldBlockCookies; 164 #endif 165 151 166 #if SOUP_CHECK_VERSION(2, 67, 1) 152 167 if ((m_currentRequest.url().protocolIs("https") && !shouldAllowHSTSPolicySetting()) || (m_currentRequest.url().protocolIs("http") && !shouldAllowHSTSProtocolUpgrade())) … … 195 210 g_cancellable_cancel(m_cancellable.get()); 196 211 m_cancellable = nullptr; 212 m_isBlockingCookies = false; 197 213 if (m_soupMessage) { 198 214 g_signal_handlers_disconnect_matched(m_soupMessage.get(), G_SIGNAL_MATCH_DATA, 0, 0, nullptr, nullptr, this); … … 704 720 } 705 721 722 auto wasBlockingCookies = m_isBlockingCookies ? WasBlockingCookies::Yes : WasBlockingCookies::No; 723 706 724 clearRequest(); 707 725 708 726 auto response = ResourceResponse(m_response); 709 m_client->willPerformHTTPRedirection(WTFMove(response), WTFMove(request), [this, protectedThis = makeRef(*this), isCrossOrigin ](const ResourceRequest& newRequest) {727 m_client->willPerformHTTPRedirection(WTFMove(response), WTFMove(request), [this, protectedThis = makeRef(*this), isCrossOrigin, wasBlockingCookies](const ResourceRequest& newRequest) { 710 728 if (newRequest.isNull() || m_state == State::Canceling) 711 729 return; … … 720 738 applyAuthenticationToRequest(request); 721 739 } 722 createRequest(WTFMove(request) );740 createRequest(WTFMove(request), wasBlockingCookies); 723 741 if (m_soupRequest && m_state != State::Suspended) { 724 742 m_state = State::Suspended; -
trunk/Source/WebKit/NetworkProcess/soup/NetworkDataTaskSoup.h
r249192 r260356 27 27 28 28 #include "NetworkDataTask.h" 29 #include <WebCore/FrameIdentifier.h> 29 30 #include <WebCore/NetworkLoadMetrics.h> 31 #include <WebCore/PageIdentifier.h> 30 32 #include <WebCore/ProtectionSpace.h> 31 33 #include <WebCore/ResourceResponse.h> … … 37 39 class NetworkDataTaskSoup final : public NetworkDataTask { 38 40 public: 39 static Ref<NetworkDataTask> create(NetworkSession& session, NetworkDataTaskClient& client, const WebCore::ResourceRequest& request, WebCore:: StoredCredentialsPolicy storedCredentialsPolicy, WebCore::ContentSniffingPolicy shouldContentSniff, WebCore::ContentEncodingSniffingPolicy shouldContentEncodingSniff, bool shouldClearReferrerOnHTTPSToHTTPRedirect, bool dataTaskIsForMainFrameNavigation)41 static Ref<NetworkDataTask> create(NetworkSession& session, NetworkDataTaskClient& client, const WebCore::ResourceRequest& request, WebCore::FrameIdentifier frameID, WebCore::PageIdentifier pageID, WebCore::StoredCredentialsPolicy storedCredentialsPolicy, WebCore::ContentSniffingPolicy shouldContentSniff, WebCore::ContentEncodingSniffingPolicy shouldContentEncodingSniff, bool shouldClearReferrerOnHTTPSToHTTPRedirect, bool dataTaskIsForMainFrameNavigation) 40 42 { 41 return adoptRef(*new NetworkDataTaskSoup(session, client, request, storedCredentialsPolicy, shouldContentSniff, shouldContentEncodingSniff, shouldClearReferrerOnHTTPSToHTTPRedirect, dataTaskIsForMainFrameNavigation));43 return adoptRef(*new NetworkDataTaskSoup(session, client, request, frameID, pageID, storedCredentialsPolicy, shouldContentSniff, shouldContentEncodingSniff, shouldClearReferrerOnHTTPSToHTTPRedirect, dataTaskIsForMainFrameNavigation)); 42 44 } 43 45 … … 45 47 46 48 private: 47 NetworkDataTaskSoup(NetworkSession&, NetworkDataTaskClient&, const WebCore::ResourceRequest&, WebCore:: StoredCredentialsPolicy, WebCore::ContentSniffingPolicy, WebCore::ContentEncodingSniffingPolicy, bool shouldClearReferrerOnHTTPSToHTTPRedirect, bool dataTaskIsForMainFrameNavigation);49 NetworkDataTaskSoup(NetworkSession&, NetworkDataTaskClient&, const WebCore::ResourceRequest&, WebCore::FrameIdentifier, WebCore::PageIdentifier, WebCore::StoredCredentialsPolicy, WebCore::ContentSniffingPolicy, WebCore::ContentEncodingSniffingPolicy, bool shouldClearReferrerOnHTTPSToHTTPRedirect, bool dataTaskIsForMainFrameNavigation); 48 50 49 51 void cancel() override; … … 59 61 void stopTimeout(); 60 62 61 void createRequest(WebCore::ResourceRequest&&); 63 enum class WasBlockingCookies { No, Yes }; 64 void createRequest(WebCore::ResourceRequest&&, WasBlockingCookies); 62 65 void clearRequest(); 63 66 static void sendRequestCallback(SoupRequest*, GAsyncResult*, NetworkDataTaskSoup*); … … 123 126 void didRestart(); 124 127 128 WebCore::FrameIdentifier m_frameID; 129 WebCore::PageIdentifier m_pageID; 125 130 State m_state { State::Suspended }; 126 131 WebCore::ContentSniffingPolicy m_shouldContentSniff; … … 144 149 WebCore::NetworkLoadMetrics m_networkLoadMetrics; 145 150 MonotonicTime m_startTime; 151 bool m_isBlockingCookies { false }; 146 152 RunLoop::Timer<NetworkDataTaskSoup> m_timeoutSource; 147 153 }; -
trunk/Source/WebKit/UIProcess/API/C/WKPage.cpp
r259307 r260356 2971 2971 #endif 2972 2972 } 2973 2974 void WKPageLoadedThirdPartyDomains(WKPageRef page, WKPageLoadedThirdPartyDomainsFunction callback, void* callbackContext) 2975 { 2976 #if ENABLE(RESOURCE_LOAD_STATISTICS) 2977 toImpl(page)->loadedThirdPartyDomains([callbackContext, callback](Vector<RegistrableDomain>&& domains) { 2978 Vector<RefPtr<API::Object>> apiDomains = WTF::map(domains, [](auto& domain) { 2979 return RefPtr<API::Object>(API::String::create(WTFMove(domain.string()))); 2980 }); 2981 callback(toAPI(API::Array::create(WTFMove(apiDomains)).ptr()), callbackContext); 2982 }); 2983 #else 2984 UNUSED_PARAM(page); 2985 callback(nullptr, callbackContext); 2986 #endif 2987 } 2988 2989 void WKPageClearLoadedThirdPartyDomains(WKPageRef page) 2990 { 2991 #if ENABLE(RESOURCE_LOAD_STATISTICS) 2992 toImpl(page)->clearLoadedThirdPartyDomains(); 2993 #else 2994 UNUSED_PARAM(page); 2995 #endif 2996 } -
trunk/Source/WebKit/UIProcess/API/C/WKPagePrivate.h
r253149 r260356 195 195 WK_EXPORT bool WKPageIsMockRealtimeMediaSourceCenterEnabled(WKPageRef page); 196 196 197 typedef void (*WKPageLoadedThirdPartyDomainsFunction)(WKArrayRef domains, void* functionContext); 198 WK_EXPORT void WKPageLoadedThirdPartyDomains(WKPageRef page, WKPageLoadedThirdPartyDomainsFunction callback, void* callbackContext); 199 WK_EXPORT void WKPageClearLoadedThirdPartyDomains(WKPageRef page); 200 197 201 #ifdef __cplusplus 198 202 } -
trunk/Source/WebKit/UIProcess/glib/WebsiteDataStoreGLib.cpp
r250169 r260356 92 92 WTF::String WebsiteDataStore::defaultResourceLoadStatisticsDirectory() 93 93 { 94 return websiteDataDirectoryFileSystemRepresentation(BASE_DIRECTORY G_DIR_SEPARATOR_S " ResourceLoadStatistics");94 return websiteDataDirectoryFileSystemRepresentation(BASE_DIRECTORY G_DIR_SEPARATOR_S "resourceloadstatistics"); 95 95 } 96 96 -
trunk/Source/cmake/OptionsGTK.cmake
r260175 r260356 186 186 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CSS_TYPED_OM PRIVATE ${ENABLE_EXPERIMENTAL_FEATURES}) 187 187 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CSS_CONIC_GRADIENTS PRIVATE ON) 188 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_RESOURCE_LOAD_STATISTICS PRIVATE ON) 188 189 189 190 if (USE_GTK4) -
trunk/Source/cmake/OptionsWPE.cmake
r259707 r260356 65 65 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_NOTIFICATIONS PRIVATE OFF) 66 66 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_OFFSCREEN_CANVAS PRIVATE ${ENABLE_EXPERIMENTAL_FEATURES}) 67 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_RESOURCE_LOAD_STATISTICS PRIVATE ON) 67 68 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_SERVICE_WORKER PRIVATE ON) 68 69 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_SHAREABLE_RESOURCE PUBLIC ON) -
trunk/Tools/ChangeLog
r260355 r260356 1 2020-04-20 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 [GTK][WPE] Enable resource load statistics 4 https://bugs.webkit.org/show_bug.cgi?id=210184 5 6 Reviewed by Žan Doberšek. 7 8 Implement TestController::loadedThirdPartyDomains() and TestController::clearLoadedThirdPartyDomains() for 9 non-cocoa ports. 10 11 * WebKitTestRunner/TestController.cpp: 12 (WTR::LoadedThirdPartyDomainsCallbackContext::LoadedThirdPartyDomainsCallbackContext): 13 (WTR::loadedThirdPartyDomainsCallback): 14 (WTR::TestController::loadedThirdPartyDomains): 15 (WTR::TestController::clearLoadedThirdPartyDomains): 16 1 17 2020-04-20 David Kilzer <ddkilzer@apple.com> 2 18 -
trunk/Tools/WebKitTestRunner/TestController.cpp
r260169 r260356 3153 3153 } 3154 3154 3155 struct LoadedThirdPartyDomainsCallbackContext { 3156 explicit LoadedThirdPartyDomainsCallbackContext(TestController& controller) 3157 : testController(controller) 3158 { 3159 } 3160 3161 TestController& testController; 3162 bool done { false }; 3163 Vector<String> result; 3164 }; 3165 3166 static void loadedThirdPartyDomainsCallback(WKArrayRef domains, void* userData) 3167 { 3168 auto* context = static_cast<LoadedThirdPartyDomainsCallbackContext*>(userData); 3169 context->done = true; 3170 3171 if (domains) { 3172 auto size = WKArrayGetSize(domains); 3173 context->result.reserveInitialCapacity(size); 3174 for (size_t index = 0; index < size; ++index) 3175 context->result.uncheckedAppend(toWTFString(static_cast<WKStringRef>(WKArrayGetItemAtIndex(domains, index)))); 3176 } 3177 3178 context->testController.notifyDone(); 3179 } 3180 3155 3181 void TestController::loadedThirdPartyDomains() 3156 3182 { 3183 LoadedThirdPartyDomainsCallbackContext context(*this); 3184 WKPageLoadedThirdPartyDomains(m_mainWebView->page(), loadedThirdPartyDomainsCallback, &context); 3185 runUntil(context.done, noTimeout); 3186 m_currentInvocation->didReceiveLoadedThirdPartyDomains(WTFMove(context.result)); 3157 3187 } 3158 3188 3159 3189 void TestController::clearLoadedThirdPartyDomains() 3160 3190 { 3191 WKPageClearLoadedThirdPartyDomains(m_mainWebView->page()); 3161 3192 } 3162 3193
Note: See TracChangeset
for help on using the changeset viewer.