WebKit Bugzilla
Attachment 342749 Details for
Bug 186627
: Resource Load Statistics: Shortcut classification for redirect to prevalent resource
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-186627-20180614113828.patch (text/plain), 13.74 KB, created by
John Wilander
on 2018-06-14 11:38:29 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
John Wilander
Created:
2018-06-14 11:38:29 PDT
Size:
13.74 KB
patch
obsolete
>Subversion Revision: 232840 >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index ed44a723ee625011cdd69ce07b77208b4ffce201..40031043ad0c3974d370bb3d771ac18d67f8654b 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,24 @@ >+2018-06-14 John Wilander <wilander@apple.com> >+ >+ Resource Load Statistics: Shortcut classification for redirect to prevalent resource >+ https://bugs.webkit.org/show_bug.cgi?id=186627 >+ <rdar://problem/41132308> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ This patch shortcuts classification of redirect collusion so that we more seldom >+ have to rely on the recursive backtrace of the redirect graph. The initial >+ implementation of Resource Load Statistics actually had this classification method. >+ >+ * UIProcess/WebResourceLoadStatisticsStore.cpp: >+ (WebKit::WebResourceLoadStatisticsStore::markAsPrevalentIfHasRedirectedToPrevalent): >+ Iterates through a non-classified resource's data for where it has redirected >+ and classifies it as prevalent if has redirected to >+ (WebKit::WebResourceLoadStatisticsStore::processStatisticsAndDataRecords): >+ Now calls WebResourceLoadStatisticsStore::markAsPrevalentIfHasRedirectedToPrevalent() >+ before regular classification steps. >+ * UIProcess/WebResourceLoadStatisticsStore.h: >+ > 2018-06-14 Carlos Garcia Campos <cgarcia@igalia.com> > > [GTK][WPE] WebDriver: handle acceptInsecureCertificates capability >diff --git a/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp b/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp >index 06ef9ff04bd1eff3c474a65ed66915330f4e2cab..6dab2637b9a8857c8db23714453167d8ef6dbc09 100644 >--- a/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp >+++ b/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp >@@ -296,6 +296,30 @@ unsigned WebResourceLoadStatisticsStore::recursivelyGetAllDomainsThatHaveRedirec > return numberOfRecursiveCalls; > } > >+void WebResourceLoadStatisticsStore::markAsPrevalentIfHasRedirectedToPrevalent(WebCore::ResourceLoadStatistics& resourceStatistic) >+{ >+ ASSERT(!RunLoop::isMain()); >+ >+ if (resourceStatistic.isPrevalentResource) >+ return; >+ >+ for (auto& subresourceDomainRedirectedTo : resourceStatistic.subresourceUniqueRedirectsTo.values()) { >+ auto mapEntry = m_resourceStatisticsMap.find(subresourceDomainRedirectedTo); >+ if (mapEntry != m_resourceStatisticsMap.end() && mapEntry->value.isPrevalentResource) { >+ setPrevalentResource(resourceStatistic, ResourceLoadPrevalence::High); >+ return; >+ } >+ } >+ >+ for (auto& topFrameDomainRedirectedTo : resourceStatistic.topFrameUniqueRedirectsTo.values()) { >+ auto mapEntry = m_resourceStatisticsMap.find(topFrameDomainRedirectedTo); >+ if (mapEntry != m_resourceStatisticsMap.end() && mapEntry->value.isPrevalentResource) { >+ setPrevalentResource(resourceStatistic, ResourceLoadPrevalence::High); >+ return; >+ } >+ } >+} >+ > void WebResourceLoadStatisticsStore::processStatisticsAndDataRecords() > { > ASSERT(!RunLoop::isMain()); >@@ -303,6 +327,7 @@ void WebResourceLoadStatisticsStore::processStatisticsAndDataRecords() > if (m_parameters.shouldClassifyResourcesBeforeDataRecordsRemoval) { > for (auto& resourceStatistic : m_resourceStatisticsMap.values()) { > if (!resourceStatistic.isVeryPrevalentResource) { >+ markAsPrevalentIfHasRedirectedToPrevalent(resourceStatistic); > auto currentPrevalence = resourceStatistic.isPrevalentResource ? ResourceLoadPrevalence::High : ResourceLoadPrevalence::Low; > auto newPrevalence = m_resourceLoadStatisticsClassifier.calculateResourcePrevalence(resourceStatistic, currentPrevalence); > if (newPrevalence != currentPrevalence) >diff --git a/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.h b/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.h >index 1fa86463ee447c211194e7c56322b367a39c28b3..4f116244ba1e4c0dcf404648aecebb3931f54450 100644 >--- a/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.h >+++ b/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.h >@@ -185,6 +185,7 @@ private: > void mergeStatistics(Vector<WebCore::ResourceLoadStatistics>&&); > WebCore::ResourceLoadStatistics& ensureResourceStatisticsForPrimaryDomain(const String&); > unsigned recursivelyGetAllDomainsThatHaveRedirectedToThisDomain(const WebCore::ResourceLoadStatistics&, HashSet<String>& domainsThatHaveRedirectedTo, unsigned numberOfRecursiveCalls); >+ void markAsPrevalentIfHasRedirectedToPrevalent(WebCore::ResourceLoadStatistics&); > void setPrevalentResource(WebCore::ResourceLoadStatistics&, ResourceLoadPrevalence); > void processStatisticsAndDataRecords(); > >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index a7c30cd7c1d4afbcdc5564f86bab7ca84ccd3649..a17f61eed13d284a679385bd936d3aca6a999e30 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,18 @@ >+2018-06-14 John Wilander <wilander@apple.com> >+ >+ Resource Load Statistics: Shortcut classification for redirect to prevalent resource >+ https://bugs.webkit.org/show_bug.cgi?id=186627 >+ <rdar://problem/41132308> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * http/tests/resourceLoadStatistics/classify-as-prevalent-based-on-subresource-redirect-to-prevalent-expected.txt: Added. >+ * http/tests/resourceLoadStatistics/classify-as-prevalent-based-on-subresource-redirect-to-prevalent.html: Added. >+ * http/tests/resourceLoadStatistics/classify-as-prevalent-based-on-top-frame-redirect-to-prevalent-expected.txt: Added. >+ * http/tests/resourceLoadStatistics/classify-as-prevalent-based-on-top-frame-redirect-to-prevalent.html: Added. >+ * platform/wk2/TestExpectations: >+ New tests marked as [ Pass ]. >+ > 2018-06-14 Miguel Gomez <magomez@igalia.com> > > Unreviewed GTK+ gardening after r232834. >diff --git a/LayoutTests/http/tests/resourceLoadStatistics/classify-as-prevalent-based-on-subresource-redirect-to-prevalent-expected.txt b/LayoutTests/http/tests/resourceLoadStatistics/classify-as-prevalent-based-on-subresource-redirect-to-prevalent-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..b8fcbd8d8f6d05fc494d4eeddcd9cb5ebdde0c39 >--- /dev/null >+++ b/LayoutTests/http/tests/resourceLoadStatistics/classify-as-prevalent-based-on-subresource-redirect-to-prevalent-expected.txt >@@ -0,0 +1,10 @@ >+Tests for classification based on subresource redirect to other prevalent. >+ >+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >+ >+ >+PASS Host classified as prevalent resource. >+PASS successfullyParsed is true >+ >+TEST COMPLETE >+ >diff --git a/LayoutTests/http/tests/resourceLoadStatistics/classify-as-prevalent-based-on-subresource-redirect-to-prevalent.html b/LayoutTests/http/tests/resourceLoadStatistics/classify-as-prevalent-based-on-subresource-redirect-to-prevalent.html >new file mode 100644 >index 0000000000000000000000000000000000000000..bdd47314d8be929640349e8b046634f0f09bd21d >--- /dev/null >+++ b/LayoutTests/http/tests/resourceLoadStatistics/classify-as-prevalent-based-on-subresource-redirect-to-prevalent.html >@@ -0,0 +1,54 @@ >+<!DOCTYPE html> >+<html lang="en"> >+<head> >+ <meta charset="UTF-8"> >+ <script src="/js-test-resources/js-test.js"></script> >+</head> >+<body> >+<script> >+ description("Tests for classification based on subresource redirect to other prevalent."); >+ jsTestIsAsync = true; >+ >+ const hostUnderTest = "127.0.0.1:8000"; >+ const statisticsUrl = "http://" + hostUnderTest + "/temp"; >+ const topFrameOrigin1 = "http://127.0.0.2:8000/temp"; >+ >+ function setEnableFeature(enable) { >+ if (!enable) >+ testRunner.statisticsResetToConsistentState(); >+ internals.setResourceLoadStatisticsEnabled(enable); >+ testRunner.setCookieStoragePartitioningEnabled(enable); >+ } >+ >+ function completeTest() { >+ if (!testRunner.isStatisticsPrevalentResource(statisticsUrl)) >+ testFailed("Host did not get classified as prevalent resource."); >+ else if (testRunner.isStatisticsVeryPrevalentResource(statisticsUrl)) >+ testFailed("Host got classified as very prevalent resource."); >+ else >+ testPassed("Host classified as prevalent resource."); >+ >+ setEnableFeature(false); >+ finishJSTest(); >+ } >+ >+ function runTest() { >+ testRunner.setStatisticsPrevalentResource(topFrameOrigin1, true); >+ testRunner.setStatisticsSubresourceUniqueRedirectTo(statisticsUrl, topFrameOrigin1); >+ >+ testRunner.installStatisticsDidScanDataRecordsCallback(completeTest); >+ testRunner.statisticsProcessStatisticsAndDataRecords(); >+ } >+ >+ if (document.location.host === hostUnderTest && window.testRunner && window.internals) { >+ setEnableFeature(true); >+ testRunner.setStatisticsNotifyPagesWhenDataRecordsWereScanned(true); >+ >+ testRunner.setStatisticsPrevalentResource(statisticsUrl, false); >+ if (testRunner.isStatisticsPrevalentResource(statisticsUrl)) >+ testFailed("Host did not get set as non-prevalent resource."); >+ runTest(); >+ } >+</script> >+</body> >+</html> >diff --git a/LayoutTests/http/tests/resourceLoadStatistics/classify-as-prevalent-based-on-top-frame-redirect-to-prevalent-expected.txt b/LayoutTests/http/tests/resourceLoadStatistics/classify-as-prevalent-based-on-top-frame-redirect-to-prevalent-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..59f995338280f315b22003f0082d0814847e9ab3 >--- /dev/null >+++ b/LayoutTests/http/tests/resourceLoadStatistics/classify-as-prevalent-based-on-top-frame-redirect-to-prevalent-expected.txt >@@ -0,0 +1,10 @@ >+Tests for classification based on top frame redirect to other prevalent. >+ >+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >+ >+ >+PASS Host classified as prevalent resource. >+PASS successfullyParsed is true >+ >+TEST COMPLETE >+ >diff --git a/LayoutTests/http/tests/resourceLoadStatistics/classify-as-prevalent-based-on-top-frame-redirect-to-prevalent.html b/LayoutTests/http/tests/resourceLoadStatistics/classify-as-prevalent-based-on-top-frame-redirect-to-prevalent.html >new file mode 100644 >index 0000000000000000000000000000000000000000..986608714c9eca835868ed031f17e46d2a5d5919 >--- /dev/null >+++ b/LayoutTests/http/tests/resourceLoadStatistics/classify-as-prevalent-based-on-top-frame-redirect-to-prevalent.html >@@ -0,0 +1,54 @@ >+<!DOCTYPE html> >+<html lang="en"> >+<head> >+ <meta charset="UTF-8"> >+ <script src="/js-test-resources/js-test.js"></script> >+</head> >+<body> >+<script> >+ description("Tests for classification based on top frame redirect to other prevalent."); >+ jsTestIsAsync = true; >+ >+ const hostUnderTest = "127.0.0.1:8000"; >+ const statisticsUrl = "http://" + hostUnderTest + "/temp"; >+ const topFrameOrigin1 = "http://127.0.0.2:8000/temp"; >+ >+ function setEnableFeature(enable) { >+ if (!enable) >+ testRunner.statisticsResetToConsistentState(); >+ internals.setResourceLoadStatisticsEnabled(enable); >+ testRunner.setCookieStoragePartitioningEnabled(enable); >+ } >+ >+ function completeTest() { >+ if (!testRunner.isStatisticsPrevalentResource(statisticsUrl)) >+ testFailed("Host did not get classified as prevalent resource."); >+ else if (testRunner.isStatisticsVeryPrevalentResource(statisticsUrl)) >+ testFailed("Host got classified as very prevalent resource."); >+ else >+ testPassed("Host classified as prevalent resource."); >+ >+ setEnableFeature(false); >+ finishJSTest(); >+ } >+ >+ function runTest() { >+ testRunner.setStatisticsPrevalentResource(topFrameOrigin1, true); >+ testRunner.setStatisticsTopFrameUniqueRedirectTo(statisticsUrl, topFrameOrigin1); >+ >+ testRunner.installStatisticsDidScanDataRecordsCallback(completeTest); >+ testRunner.statisticsProcessStatisticsAndDataRecords(); >+ } >+ >+ if (document.location.host === hostUnderTest && window.testRunner && window.internals) { >+ setEnableFeature(true); >+ testRunner.setStatisticsNotifyPagesWhenDataRecordsWereScanned(true); >+ >+ testRunner.setStatisticsPrevalentResource(statisticsUrl, false); >+ if (testRunner.isStatisticsPrevalentResource(statisticsUrl)) >+ testFailed("Host did not get set as non-prevalent resource."); >+ runTest(); >+ } >+</script> >+</body> >+</html> >diff --git a/LayoutTests/platform/wk2/TestExpectations b/LayoutTests/platform/wk2/TestExpectations >index 48a78767f03774113df52c2cbd37011673f3bac8..b87ddb0ae5c41b72f81667401ebca91aaf283ae4 100644 >--- a/LayoutTests/platform/wk2/TestExpectations >+++ b/LayoutTests/platform/wk2/TestExpectations >@@ -705,7 +705,9 @@ http/tests/resourceLoadStatistics/classify-as-prevalent-based-on-sub-frame-under > http/tests/resourceLoadStatistics/classify-as-prevalent-based-on-subresource-under-top-frame-origins.html [ Pass ] > http/tests/resourceLoadStatistics/classify-as-prevalent-based-on-subresource-unique-redirects-to.html [ Pass ] > http/tests/resourceLoadStatistics/classify-as-prevalent-based-on-subresource-redirect-collusion.html [ Pass ] >+http/tests/resourceLoadStatistics/classify-as-prevalent-based-on-subresource-redirect-to-prevalent.html [ Pass ] > http/tests/resourceLoadStatistics/classify-as-prevalent-based-on-top-frame-redirect-collusion.html [ Pass ] >+http/tests/resourceLoadStatistics/classify-as-prevalent-based-on-top-frame-redirect-to-prevalent.html [ Pass ] > http/tests/resourceLoadStatistics/classify-as-prevalent-based-on-top-frame-unique-redirects-to.html [ Pass ] > http/tests/resourceLoadStatistics/clear-in-memory-and-persistent-store.html [ Pass ] > http/tests/resourceLoadStatistics/grandfathering.html [ Pass ]
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 186627
: 342749