Title: [237370] branches/safari-606-branch
Revision
237370
Author
[email protected]
Date
2018-10-23 16:52:04 -0700 (Tue, 23 Oct 2018)

Log Message

Cherry-pick r236578. rdar://problem/45285613

    Resource Load Statistics: Non-redirected top frame navigation should not get captured in statistics
    https://bugs.webkit.org/show_bug.cgi?id=190055
    <rdar://problem/44843460>

    Reviewed by Chris Dumez.

    Source/WebCore:

    Test: http/tests/resourceLoadStatistics/do-not-capture-statistics-for-simple-top-navigations.html

    * loader/ResourceLoadStatistics.cpp:
    (WebCore::ResourceLoadStatistics::decode):
        Corrects legacy statistics for frames and triggers a re-classification.

    Source/WebKit:

    * UIProcess/ResourceLoadStatisticsMemoryStore.cpp:
        Bumped the statisticsModelVersion to 14 to be able to
        correct legacy statistics.
    (WebKit::ResourceLoadStatisticsMemoryStore::logFrameNavigation):
        Now skips capture if it's the main frame.

    LayoutTests:

    * http/tests/resourceLoadStatistics/do-not-capture-statistics-for-simple-top-navigations-expected.txt: Added.
    * http/tests/resourceLoadStatistics/do-not-capture-statistics-for-simple-top-navigations.html: Added.

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236578 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Added Paths

Diff

Modified: branches/safari-606-branch/LayoutTests/ChangeLog (237369 => 237370)


--- branches/safari-606-branch/LayoutTests/ChangeLog	2018-10-23 23:51:57 UTC (rev 237369)
+++ branches/safari-606-branch/LayoutTests/ChangeLog	2018-10-23 23:52:04 UTC (rev 237370)
@@ -1,3 +1,47 @@
+2018-10-23  Kocsen Chung  <[email protected]>
+
+        Cherry-pick r236578. rdar://problem/45285613
+
+    Resource Load Statistics: Non-redirected top frame navigation should not get captured in statistics
+    https://bugs.webkit.org/show_bug.cgi?id=190055
+    <rdar://problem/44843460>
+    
+    Reviewed by Chris Dumez.
+    
+    Source/WebCore:
+    
+    Test: http/tests/resourceLoadStatistics/do-not-capture-statistics-for-simple-top-navigations.html
+    
+    * loader/ResourceLoadStatistics.cpp:
+    (WebCore::ResourceLoadStatistics::decode):
+        Corrects legacy statistics for frames and triggers a re-classification.
+    
+    Source/WebKit:
+    
+    * UIProcess/ResourceLoadStatisticsMemoryStore.cpp:
+        Bumped the statisticsModelVersion to 14 to be able to
+        correct legacy statistics.
+    (WebKit::ResourceLoadStatisticsMemoryStore::logFrameNavigation):
+        Now skips capture if it's the main frame.
+    
+    LayoutTests:
+    
+    * http/tests/resourceLoadStatistics/do-not-capture-statistics-for-simple-top-navigations-expected.txt: Added.
+    * http/tests/resourceLoadStatistics/do-not-capture-statistics-for-simple-top-navigations.html: Added.
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236578 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2018-09-27  John Wilander  <[email protected]>
+
+            Resource Load Statistics: Non-redirected top frame navigation should not get captured in statistics
+            https://bugs.webkit.org/show_bug.cgi?id=190055
+            <rdar://problem/44843460>
+
+            Reviewed by Chris Dumez.
+
+            * http/tests/resourceLoadStatistics/do-not-capture-statistics-for-simple-top-navigations-expected.txt: Added.
+            * http/tests/resourceLoadStatistics/do-not-capture-statistics-for-simple-top-navigations.html: Added.
+
 2018-10-21  Babak Shafiei  <[email protected]>
 
         Cherry-pick r234127. rdar://problem/45285391

Added: branches/safari-606-branch/LayoutTests/http/tests/resourceLoadStatistics/do-not-capture-statistics-for-simple-top-navigations-expected.txt (0 => 237370)


--- branches/safari-606-branch/LayoutTests/http/tests/resourceLoadStatistics/do-not-capture-statistics-for-simple-top-navigations-expected.txt	                        (rev 0)
+++ branches/safari-606-branch/LayoutTests/http/tests/resourceLoadStatistics/do-not-capture-statistics-for-simple-top-navigations-expected.txt	2018-10-23 23:52:04 UTC (rev 237370)
@@ -0,0 +1,11 @@
+Test that a non-redirected top frame navigation doesn't get captured in statistics.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS testRunner.isStatisticsRegisteredAsSubFrameUnder("http://localhost", "http://127.0.0.1") is false
+PASS testRunner.isStatisticsRegisteredAsSubFrameUnder("http://127.0.0.1", "http://localhost") is false
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: branches/safari-606-branch/LayoutTests/http/tests/resourceLoadStatistics/do-not-capture-statistics-for-simple-top-navigations.html (0 => 237370)


--- branches/safari-606-branch/LayoutTests/http/tests/resourceLoadStatistics/do-not-capture-statistics-for-simple-top-navigations.html	                        (rev 0)
+++ branches/safari-606-branch/LayoutTests/http/tests/resourceLoadStatistics/do-not-capture-statistics-for-simple-top-navigations.html	2018-10-23 23:52:04 UTC (rev 237370)
@@ -0,0 +1,43 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <script src=""
+    <script src=""
+</head>
+<body>
+<script>
+    description("Test that a non-redirected top frame navigation doesn't get captured in statistics.");
+    jsTestIsAsync = true;
+
+    function finishTest() {
+        shouldBeFalse('testRunner.isStatisticsRegisteredAsSubFrameUnder("http://localhost", "http://127.0.0.1")');
+        shouldBeFalse('testRunner.isStatisticsRegisteredAsSubFrameUnder("http://127.0.0.1", "http://localhost")');
+        setEnableFeature(false, finishJSTest);
+    }
+
+    function runTest() {
+        switch (document.location.host) {
+            case "127.0.0.1:8000":
+                setEnableFeature(true, function() {
+                    if (testRunner.isStatisticsPrevalentResource("http://localhost:8000"))
+                        testFailed("Localhost was classified as prevalent resource before the test starts.");
+                    document.location.href = ""
+                });
+                break;
+            case "localhost:8000":
+                testRunner.setStatisticsNotifyPagesWhenDataRecordsWereScanned(true);
+                testRunner.installStatisticsDidScanDataRecordsCallback(finishTest);
+                testRunner.statisticsNotifyObserver();
+                break;
+            default:
+                testFailed("Unknown host: " + document.location.host);
+                finishTest();
+        }
+    }
+
+    if (window.testRunner && window.internals)
+        runTest();
+</script>
+</body>
+</html>

Modified: branches/safari-606-branch/Source/WebCore/ChangeLog (237369 => 237370)


--- branches/safari-606-branch/Source/WebCore/ChangeLog	2018-10-23 23:51:57 UTC (rev 237369)
+++ branches/safari-606-branch/Source/WebCore/ChangeLog	2018-10-23 23:52:04 UTC (rev 237370)
@@ -1,3 +1,50 @@
+2018-10-23  Kocsen Chung  <[email protected]>
+
+        Cherry-pick r236578. rdar://problem/45285613
+
+    Resource Load Statistics: Non-redirected top frame navigation should not get captured in statistics
+    https://bugs.webkit.org/show_bug.cgi?id=190055
+    <rdar://problem/44843460>
+    
+    Reviewed by Chris Dumez.
+    
+    Source/WebCore:
+    
+    Test: http/tests/resourceLoadStatistics/do-not-capture-statistics-for-simple-top-navigations.html
+    
+    * loader/ResourceLoadStatistics.cpp:
+    (WebCore::ResourceLoadStatistics::decode):
+        Corrects legacy statistics for frames and triggers a re-classification.
+    
+    Source/WebKit:
+    
+    * UIProcess/ResourceLoadStatisticsMemoryStore.cpp:
+        Bumped the statisticsModelVersion to 14 to be able to
+        correct legacy statistics.
+    (WebKit::ResourceLoadStatisticsMemoryStore::logFrameNavigation):
+        Now skips capture if it's the main frame.
+    
+    LayoutTests:
+    
+    * http/tests/resourceLoadStatistics/do-not-capture-statistics-for-simple-top-navigations-expected.txt: Added.
+    * http/tests/resourceLoadStatistics/do-not-capture-statistics-for-simple-top-navigations.html: Added.
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236578 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2018-09-27  John Wilander  <[email protected]>
+
+            Resource Load Statistics: Non-redirected top frame navigation should not get captured in statistics
+            https://bugs.webkit.org/show_bug.cgi?id=190055
+            <rdar://problem/44843460>
+
+            Reviewed by Chris Dumez.
+
+            Test: http/tests/resourceLoadStatistics/do-not-capture-statistics-for-simple-top-navigations.html
+
+            * loader/ResourceLoadStatistics.cpp:
+            (WebCore::ResourceLoadStatistics::decode):
+                Corrects legacy statistics for frames and triggers a re-classification.
+
 2018-10-18  Babak Shafiei  <[email protected]>
 
         Cherry-pick r237081. rdar://problem/45285441

Modified: branches/safari-606-branch/Source/WebCore/loader/ResourceLoadStatistics.cpp (237369 => 237370)


--- branches/safari-606-branch/Source/WebCore/loader/ResourceLoadStatistics.cpp	2018-10-23 23:51:57 UTC (rev 237369)
+++ branches/safari-606-branch/Source/WebCore/loader/ResourceLoadStatistics.cpp	2018-10-23 23:52:04 UTC (rev 237370)
@@ -141,8 +141,9 @@
     }
 
     // Subframe stats
-    decodeHashCountedSet(decoder, "subframeUnderTopFrameOrigins", subframeUnderTopFrameOrigins);
-    
+    if (modelVersion >= 14)
+        decodeHashCountedSet(decoder, "subframeUnderTopFrameOrigins", subframeUnderTopFrameOrigins);
+
     // Subresource stats
     decodeHashCountedSet(decoder, "subresourceUnderTopFrameOrigins", subresourceUnderTopFrameOrigins);
     decodeHashCountedSet(decoder, "subresourceUniqueRedirectsTo", subresourceUniqueRedirectsTo);
@@ -158,6 +159,12 @@
             return false;
     }
 
+    // Trigger re-classification based on model 14.
+    if (modelVersion < 14) {
+        isPrevalentResource = false;
+        isVeryPrevalentResource = false;
+    }
+
     if (!decoder.decodeUInt32("dataRecordsRemoved", dataRecordsRemoved))
         return false;
 

Modified: branches/safari-606-branch/Source/WebKit/ChangeLog (237369 => 237370)


--- branches/safari-606-branch/Source/WebKit/ChangeLog	2018-10-23 23:51:57 UTC (rev 237369)
+++ branches/safari-606-branch/Source/WebKit/ChangeLog	2018-10-23 23:52:04 UTC (rev 237370)
@@ -1,5 +1,52 @@
 2018-10-23  Kocsen Chung  <[email protected]>
 
+        Cherry-pick r236578. rdar://problem/45285613
+
+    Resource Load Statistics: Non-redirected top frame navigation should not get captured in statistics
+    https://bugs.webkit.org/show_bug.cgi?id=190055
+    <rdar://problem/44843460>
+    
+    Reviewed by Chris Dumez.
+    
+    Source/WebCore:
+    
+    Test: http/tests/resourceLoadStatistics/do-not-capture-statistics-for-simple-top-navigations.html
+    
+    * loader/ResourceLoadStatistics.cpp:
+    (WebCore::ResourceLoadStatistics::decode):
+        Corrects legacy statistics for frames and triggers a re-classification.
+    
+    Source/WebKit:
+    
+    * UIProcess/ResourceLoadStatisticsMemoryStore.cpp:
+        Bumped the statisticsModelVersion to 14 to be able to
+        correct legacy statistics.
+    (WebKit::ResourceLoadStatisticsMemoryStore::logFrameNavigation):
+        Now skips capture if it's the main frame.
+    
+    LayoutTests:
+    
+    * http/tests/resourceLoadStatistics/do-not-capture-statistics-for-simple-top-navigations-expected.txt: Added.
+    * http/tests/resourceLoadStatistics/do-not-capture-statistics-for-simple-top-navigations.html: Added.
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236578 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2018-09-27  John Wilander  <[email protected]>
+
+            Resource Load Statistics: Non-redirected top frame navigation should not get captured in statistics
+            https://bugs.webkit.org/show_bug.cgi?id=190055
+            <rdar://problem/44843460>
+
+            Reviewed by Chris Dumez.
+
+            * UIProcess/ResourceLoadStatisticsMemoryStore.cpp:
+                Bumped the statisticsModelVersion to 14 to be able to
+                correct legacy statistics.
+            (WebKit::ResourceLoadStatisticsMemoryStore::logFrameNavigation):
+                Now skips capture if it's the main frame.
+
+2018-10-23  Kocsen Chung  <[email protected]>
+
         Cherry-pick r235674. rdar://problem/45285711
 
     Cancelled fullscreen exit gesture leaves bad state for next exit request.

Modified: branches/safari-606-branch/Source/WebKit/UIProcess/ResourceLoadStatisticsMemoryStore.cpp (237369 => 237370)


--- branches/safari-606-branch/Source/WebKit/UIProcess/ResourceLoadStatisticsMemoryStore.cpp	2018-10-23 23:51:57 UTC (rev 237369)
+++ branches/safari-606-branch/Source/WebKit/UIProcess/ResourceLoadStatisticsMemoryStore.cpp	2018-10-23 23:52:04 UTC (rev 237370)
@@ -46,7 +46,7 @@
 
 using namespace WebCore;
 
-constexpr unsigned statisticsModelVersion { 12 };
+constexpr unsigned statisticsModelVersion { 14 };
 constexpr unsigned maxNumberOfRecursiveCallsInRedirectTraceBack { 50 };
 constexpr Seconds minimumStatisticsProcessingInterval { 5_s };
 constexpr unsigned operatingDatesWindow { 30 };
@@ -548,7 +548,7 @@
     ASSERT(!RunLoop::isMain());
 
     bool statisticsWereUpdated = false;
-    if (targetHost != mainFrameHost && !(areTargetAndMainFrameDomainsAssociated || areTargetAndSourceDomainsAssociated)) {
+    if (!isMainFrame && targetHost != mainFrameHost && !(areTargetAndMainFrameDomainsAssociated || areTargetAndSourceDomainsAssociated)) {
         auto& targetStatistics = ensureResourceStatisticsForPrimaryDomain(targetPrimaryDomain);
         targetStatistics.lastSeen = ResourceLoadStatistics::reduceTimeResolution(WallTime::now());
         if (targetStatistics.subframeUnderTopFrameOrigins.add(mainFramePrimaryDomain).isNewEntry)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to