<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[242712] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/242712">242712</a></dd>
<dt>Author</dt> <dd>wilander@apple.com</dd>
<dt>Date</dt> <dd>2019-03-11 10:01:27 -0700 (Mon, 11 Mar 2019)</dd>
</dl>

<h3>Log Message</h3>
<pre>Resource Load Statistics: Make it possible exclude localhost from classification
https://bugs.webkit.org/show_bug.cgi?id=195474
<rdar://problem/47520577>

Reviewed by Brent Fulgham.

Source/WebKit:

This patch allows for localhost to be excluded from classification and
treatment as a prevalent resource.

* NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
(WebKit::ResourceLoadStatisticsDatabaseStore::ResourceLoadStatisticsDatabaseStore):
(WebKit::ResourceLoadStatisticsDatabaseStore::reclassifyResources):
    Makes use of the new ResourceLoadStatisticsMemoryStore::shouldSkip().
(WebKit::ResourceLoadStatisticsDatabaseStore::setPrevalentResource):
    Makes use of the new ResourceLoadStatisticsMemoryStore::shouldSkip().
(WebKit::ResourceLoadStatisticsDatabaseStore::isPrevalentResource const):
    Makes use of the new ResourceLoadStatisticsMemoryStore::shouldSkip().
(WebKit::ResourceLoadStatisticsDatabaseStore::isVeryPrevalentResource const):
    Makes use of the new ResourceLoadStatisticsMemoryStore::shouldSkip().
(WebKit::ResourceLoadStatisticsDatabaseStore::setVeryPrevalentResource):
    Makes use of the new ResourceLoadStatisticsMemoryStore::shouldSkip().
* NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
* NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
(WebKit::ResourceLoadStatisticsMemoryStore::ResourceLoadStatisticsMemoryStore):
(WebKit::ResourceLoadStatisticsMemoryStore::classifyPrevalentResources):
    Makes use of the new ResourceLoadStatisticsMemoryStore::shouldSkip().
(WebKit::ResourceLoadStatisticsMemoryStore::setPrevalentResource):
    Makes use of the new ResourceLoadStatisticsMemoryStore::shouldSkip().
(WebKit::ResourceLoadStatisticsMemoryStore::isPrevalentResource const):
    Makes use of the new ResourceLoadStatisticsMemoryStore::shouldSkip().
(WebKit::ResourceLoadStatisticsMemoryStore::isVeryPrevalentResource const):
    Makes use of the new ResourceLoadStatisticsMemoryStore::shouldSkip().
(WebKit::ResourceLoadStatisticsMemoryStore::setVeryPrevalentResource):
    Makes use of the new ResourceLoadStatisticsMemoryStore::shouldSkip().
* NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h:
* NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp:
(WebKit::ResourceLoadStatisticsStore::ResourceLoadStatisticsStore):
    Now takes a ShouldIncludeLocalhost parameter.
(WebKit::ResourceLoadStatisticsStore::shouldSkip const):
    Convenience function, currently supporting the localhost exclusion.
(WebKit::ResourceLoadStatisticsStore::setIsRunningTest):
    Test infrastructure.
* NetworkProcess/Classifier/ResourceLoadStatisticsStore.h:
* NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
(WebKit::WebResourceLoadStatisticsStore::setIsRunningTest):
    Test infrastructure.
(WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
    Now takes a ShouldIncludeLocalhost parameter.
* NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
    Defines the new ShouldIncludeLocalhost boolean enum.
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::setIsRunningResourceLoadStatisticsTest):
    Test infrastructure.
* NetworkProcess/NetworkProcess.h:
* NetworkProcess/NetworkProcess.messages.in:
* NetworkProcess/NetworkSession.cpp:
(WebKit::NetworkSession::setResourceLoadStatisticsEnabled):
    Forwards the localhost setting to the create function.
* NetworkProcess/NetworkSession.h:
* NetworkProcess/NetworkSessionCreationParameters.cpp:
(WebKit::NetworkSessionCreationParameters::encode const):
(WebKit::NetworkSessionCreationParameters::decode):
* NetworkProcess/NetworkSessionCreationParameters.h:
    New parameter called shouldIncludeLocalhostInResourceLoadStatistics.
* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
    Picks up the localhost setting from the parameters.
* UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
(WKWebsiteDataStoreSetStatisticsIsRunningTest):
    Test infrastructure.
* UIProcess/API/C/WKWebsiteDataStoreRef.h:
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::setIsRunningResourceLoadStatisticsTest):
    Test infrastructure.
* UIProcess/Network/NetworkProcessProxy.h:
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::ensureNetworkProcess):
    Picks up the localhost setting from the WebsiteDataStore parameters.
* UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
(WebKit::WebsiteDataStore::parameters):
    Makes sure Safari does not exclude localhost.
* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::setIsRunningResourceLoadStatisticsTest):
    Test infrastructure.
* UIProcess/WebsiteData/WebsiteDataStore.h:

Tools:

This patch allows for localhost to be excluded from classification and
treatment as a prevalent resource.

The WebKit Tools change adds a new function called
testRunner.setStatisticsIsRunningTest() which can be used to control this
behavior.

* WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
* WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::TestRunner::setStatisticsIsRunningTest):
* WebKitTestRunner/InjectedBundle/TestRunner.h:
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::setStatisticsIsRunningTest):
* WebKitTestRunner/TestController.h:
* WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle):

LayoutTests:

This patch makes sure that all test cases that need to, call the enableFeature()
function in http/tests/resourceLoadStatistics/resources/util.js.

The enableFeature() now calls the new function testRunner.setStatisticsIsRunningTest().

* http/tests/resourceLoadStatistics/do-not-block-top-level-navigation-redirect.html:
* http/tests/resourceLoadStatistics/non-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html:
* http/tests/resourceLoadStatistics/prevalent-resource-with-user-interaction.html:
* http/tests/resourceLoadStatistics/resources/set-cookie-on-redirect.php:
* http/tests/resourceLoadStatistics/resources/util.js:
(setEnableFeature):
* http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-user-interaction.html:
* http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-user-interaction.html:
* http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-without-user-interaction.html:
* http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe.html:
* http/tests/storageAccess/request-storage-access-cross-origin-sandboxed-iframe-with-unique-origin.html:
* http/tests/storageAccess/request-storage-access-same-origin-iframe.html:
* http/tests/storageAccess/request-storage-access-same-origin-sandboxed-iframe.html:
* http/tests/storageAccess/request-storage-access-top-frame.html:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestshttptestsresourceLoadStatisticsdonotblocktoplevelnavigationredirecthtml">trunk/LayoutTests/http/tests/resourceLoadStatistics/do-not-block-top-level-navigation-redirect.html</a></li>
<li><a href="#trunkLayoutTestshttptestsresourceLoadStatisticsnonsandboxediframeredirectiptolocalhosttoiphtml">trunk/LayoutTests/http/tests/resourceLoadStatistics/non-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html</a></li>
<li><a href="#trunkLayoutTestshttptestsresourceLoadStatisticsprevalentresourcewithuserinteractionhtml">trunk/LayoutTests/http/tests/resourceLoadStatistics/prevalent-resource-with-user-interaction.html</a></li>
<li><a href="#trunkLayoutTestshttptestsresourceLoadStatisticsresourcessetcookieonredirectphp">trunk/LayoutTests/http/tests/resourceLoadStatistics/resources/set-cookie-on-redirect.php</a></li>
<li><a href="#trunkLayoutTestshttptestsresourceLoadStatisticsresourcesutiljs">trunk/LayoutTests/http/tests/resourceLoadStatistics/resources/util.js</a></li>
<li><a href="#trunkLayoutTestshttptestsstorageAccesshasstorageaccessfromprevalentdomainwithuserinteractionhtml">trunk/LayoutTests/http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-user-interaction.html</a></li>
<li><a href="#trunkLayoutTestshttptestsstorageAccessrequestandgrantaccesscrossoriginsandboxediframefromprevalentdomainwithuserinteractionhtml">trunk/LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-user-interaction.html</a></li>
<li><a href="#trunkLayoutTestshttptestsstorageAccessrequestandgrantaccesscrossoriginsandboxediframefromprevalentdomainwithoutuserinteractionhtml">trunk/LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-without-user-interaction.html</a></li>
<li><a href="#trunkLayoutTestshttptestsstorageAccessrequestandgrantaccesscrossoriginsandboxediframehtml">trunk/LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe.html</a></li>
<li><a href="#trunkLayoutTestshttptestsstorageAccessrequeststorageaccesscrossoriginsandboxediframewithuniqueoriginhtml">trunk/LayoutTests/http/tests/storageAccess/request-storage-access-cross-origin-sandboxed-iframe-with-unique-origin.html</a></li>
<li><a href="#trunkLayoutTestshttptestsstorageAccessrequeststorageaccesssameoriginiframehtml">trunk/LayoutTests/http/tests/storageAccess/request-storage-access-same-origin-iframe.html</a></li>
<li><a href="#trunkLayoutTestshttptestsstorageAccessrequeststorageaccesssameoriginsandboxediframehtml">trunk/LayoutTests/http/tests/storageAccess/request-storage-access-same-origin-sandboxed-iframe.html</a></li>
<li><a href="#trunkLayoutTestshttptestsstorageAccessrequeststorageaccesstopframehtml">trunk/LayoutTests/http/tests/storageAccess/request-storage-access-top-frame.html</a></li>
<li><a href="#trunkSourceWebKitChangeLog">trunk/Source/WebKit/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitNetworkProcessClassifierResourceLoadStatisticsDatabaseStorecpp">trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp</a></li>
<li><a href="#trunkSourceWebKitNetworkProcessClassifierResourceLoadStatisticsDatabaseStoreh">trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h</a></li>
<li><a href="#trunkSourceWebKitNetworkProcessClassifierResourceLoadStatisticsMemoryStorecpp">trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp</a></li>
<li><a href="#trunkSourceWebKitNetworkProcessClassifierResourceLoadStatisticsMemoryStoreh">trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h</a></li>
<li><a href="#trunkSourceWebKitNetworkProcessClassifierResourceLoadStatisticsStorecpp">trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp</a></li>
<li><a href="#trunkSourceWebKitNetworkProcessClassifierResourceLoadStatisticsStoreh">trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsStore.h</a></li>
<li><a href="#trunkSourceWebKitNetworkProcessClassifierWebResourceLoadStatisticsStorecpp">trunk/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp</a></li>
<li><a href="#trunkSourceWebKitNetworkProcessClassifierWebResourceLoadStatisticsStoreh">trunk/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h</a></li>
<li><a href="#trunkSourceWebKitNetworkProcessNetworkProcesscpp">trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp</a></li>
<li><a href="#trunkSourceWebKitNetworkProcessNetworkProcessh">trunk/Source/WebKit/NetworkProcess/NetworkProcess.h</a></li>
<li><a href="#trunkSourceWebKitNetworkProcessNetworkProcessmessagesin">trunk/Source/WebKit/NetworkProcess/NetworkProcess.messages.in</a></li>
<li><a href="#trunkSourceWebKitNetworkProcessNetworkSessioncpp">trunk/Source/WebKit/NetworkProcess/NetworkSession.cpp</a></li>
<li><a href="#trunkSourceWebKitNetworkProcessNetworkSessionh">trunk/Source/WebKit/NetworkProcess/NetworkSession.h</a></li>
<li><a href="#trunkSourceWebKitNetworkProcessNetworkSessionCreationParameterscpp">trunk/Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.cpp</a></li>
<li><a href="#trunkSourceWebKitNetworkProcessNetworkSessionCreationParametersh">trunk/Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.h</a></li>
<li><a href="#trunkSourceWebKitNetworkProcesscocoaNetworkSessionCocoamm">trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm</a></li>
<li><a href="#trunkSourceWebKitUIProcessAPICWKWebsiteDataStoreRefcpp">trunk/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.cpp</a></li>
<li><a href="#trunkSourceWebKitUIProcessAPICWKWebsiteDataStoreRefh">trunk/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.h</a></li>
<li><a href="#trunkSourceWebKitUIProcessNetworkNetworkProcessProxycpp">trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp</a></li>
<li><a href="#trunkSourceWebKitUIProcessNetworkNetworkProcessProxyh">trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h</a></li>
<li><a href="#trunkSourceWebKitUIProcessWebProcessPoolcpp">trunk/Source/WebKit/UIProcess/WebProcessPool.cpp</a></li>
<li><a href="#trunkSourceWebKitUIProcessWebsiteDataCocoaWebsiteDataStoreCocoamm">trunk/Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm</a></li>
<li><a href="#trunkSourceWebKitUIProcessWebsiteDataWebsiteDataStorecpp">trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp</a></li>
<li><a href="#trunkSourceWebKitUIProcessWebsiteDataWebsiteDataStoreh">trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsWebKitTestRunnerInjectedBundleBindingsTestRunneridl">trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl</a></li>
<li><a href="#trunkToolsWebKitTestRunnerInjectedBundleTestRunnercpp">trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp</a></li>
<li><a href="#trunkToolsWebKitTestRunnerInjectedBundleTestRunnerh">trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h</a></li>
<li><a href="#trunkToolsWebKitTestRunnerTestControllercpp">trunk/Tools/WebKitTestRunner/TestController.cpp</a></li>
<li><a href="#trunkToolsWebKitTestRunnerTestControllerh">trunk/Tools/WebKitTestRunner/TestController.h</a></li>
<li><a href="#trunkToolsWebKitTestRunnerTestInvocationcpp">trunk/Tools/WebKitTestRunner/TestInvocation.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (242711 => 242712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog      2019-03-11 16:56:57 UTC (rev 242711)
+++ trunk/LayoutTests/ChangeLog 2019-03-11 17:01:27 UTC (rev 242712)
</span><span class="lines">@@ -1,3 +1,31 @@
</span><ins>+2019-03-11  John Wilander  <wilander@apple.com>
+
+        Resource Load Statistics: Make it possible exclude localhost from classification
+        https://bugs.webkit.org/show_bug.cgi?id=195474
+        <rdar://problem/47520577>
+
+        Reviewed by Brent Fulgham.
+
+        This patch makes sure that all test cases that need to, call the enableFeature()
+        function in http/tests/resourceLoadStatistics/resources/util.js.
+
+        The enableFeature() now calls the new function testRunner.setStatisticsIsRunningTest().
+
+        * http/tests/resourceLoadStatistics/do-not-block-top-level-navigation-redirect.html:
+        * http/tests/resourceLoadStatistics/non-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html:
+        * http/tests/resourceLoadStatistics/prevalent-resource-with-user-interaction.html:
+        * http/tests/resourceLoadStatistics/resources/set-cookie-on-redirect.php:
+        * http/tests/resourceLoadStatistics/resources/util.js:
+        (setEnableFeature):
+        * http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-user-interaction.html:
+        * http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-user-interaction.html:
+        * http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-without-user-interaction.html:
+        * http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe.html:
+        * http/tests/storageAccess/request-storage-access-cross-origin-sandboxed-iframe-with-unique-origin.html:
+        * http/tests/storageAccess/request-storage-access-same-origin-iframe.html:
+        * http/tests/storageAccess/request-storage-access-same-origin-sandboxed-iframe.html:
+        * http/tests/storageAccess/request-storage-access-top-frame.html:
+
</ins><span class="cx"> 2019-03-11  Javier Fernandez  <jfernandez@igalia.com>
</span><span class="cx"> 
</span><span class="cx">         Unreviewed GTK test gardening
</span></span></pre></div>
<a id="trunkLayoutTestshttptestsresourceLoadStatisticsdonotblocktoplevelnavigationredirecthtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/http/tests/resourceLoadStatistics/do-not-block-top-level-navigation-redirect.html (242711 => 242712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/resourceLoadStatistics/do-not-block-top-level-navigation-redirect.html      2019-03-11 16:56:57 UTC (rev 242711)
+++ trunk/LayoutTests/http/tests/resourceLoadStatistics/do-not-block-top-level-navigation-redirect.html 2019-03-11 17:01:27 UTC (rev 242712)
</span><span class="lines">@@ -3,6 +3,7 @@
</span><span class="cx"> <head>
</span><span class="cx">     <meta charset="UTF-8">
</span><span class="cx">     <script src="/js-test-resources/js-test.js"></script>
</span><ins>+    <script src="resources/util.js"></script>
</ins><span class="cx"> <script>
</span><span class="cx">     description("Tests that blocking is not applied to top-level navigation redirects.");
</span><span class="cx">     jsTestIsAsync = true;
</span><span class="lines">@@ -11,17 +12,18 @@
</span><span class="cx"> 
</span><span class="cx">     function doRedirect()
</span><span class="cx">     {
</span><del>-        testRunner.setStatisticsPrevalentResource("http://localhost", true, function() {
-            if (!testRunner.isStatisticsPrevalentResource("http://localhost")) {
-                testFailed("Host did not get set as prevalent resource.");
-                finishJSTest();
-            }
-            else
-                document.location.href = "http://localhost:8000/resourceLoadStatistics/resources/set-cookie-on-redirect.php?step=1";
</del><ins>+        setEnableFeature(true, function () {
+            testRunner.setStatisticsPrevalentResource("http://localhost", true, function () {
+                if (!testRunner.isStatisticsPrevalentResource("http://localhost")) {
+                    testFailed("Host did not get set as prevalent resource.");
+                    setEnableFeature(false, finishJSTest);
+                } else
+                    document.location.href = "http://localhost:8000/resourceLoadStatistics/resources/set-cookie-on-redirect.php?step=1";
+            });
</ins><span class="cx">         });
</span><span class="cx">     }
</span><span class="cx"> </script>
</span><span class="cx"> </head>
</span><del>-<body onload="doRedirect()">
</del><ins>+<body onload="setTimeout('doRedirect()', 0)">
</ins><span class="cx"> </body>
</span><span class="cx"> </html>
</span></span></pre></div>
<a id="trunkLayoutTestshttptestsresourceLoadStatisticsnonsandboxediframeredirectiptolocalhosttoiphtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/http/tests/resourceLoadStatistics/non-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html (242711 => 242712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/resourceLoadStatistics/non-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html     2019-03-11 16:56:57 UTC (rev 242711)
+++ trunk/LayoutTests/http/tests/resourceLoadStatistics/non-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html        2019-03-11 17:01:27 UTC (rev 242712)
</span><span class="lines">@@ -41,7 +41,6 @@
</span><span class="cx"> 
</span><span class="cx">         if (testRunner) {
</span><span class="cx">             setEnableFeature(true, function() {
</span><del>-                testRunner.setStatisticsNotifyPagesWhenDataRecordsWereScanned(true);
</del><span class="cx">                 testRunner.installStatisticsDidScanDataRecordsCallback(checkStats);
</span><span class="cx">             });
</span><span class="cx">         }
</span></span></pre></div>
<a id="trunkLayoutTestshttptestsresourceLoadStatisticsprevalentresourcewithuserinteractionhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/http/tests/resourceLoadStatistics/prevalent-resource-with-user-interaction.html (242711 => 242712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/resourceLoadStatistics/prevalent-resource-with-user-interaction.html        2019-03-11 16:56:57 UTC (rev 242711)
+++ trunk/LayoutTests/http/tests/resourceLoadStatistics/prevalent-resource-with-user-interaction.html   2019-03-11 17:01:27 UTC (rev 242712)
</span><span class="lines">@@ -4,9 +4,13 @@
</span><span class="cx">     <meta charset="UTF-8">
</span><span class="cx">     <title>Tests for Prevalent Resource With User Interaction</title>
</span><span class="cx">     <script src="/js-test-resources/js-test.js"></script>
</span><ins>+    <script src="resources/util.js"></script>
</ins><span class="cx"> </head>
</span><del>-<body>
</del><ins>+<body onload="setTimeout('setUpAndRun()', 0)">
</ins><span class="cx"> <script>
</span><ins>+    if (testRunner)
+        testRunner.waitUntilDone();
+
</ins><span class="cx">     const hostUnderTest = "127.0.0.1:8000";
</span><span class="cx">     const statisticsUrl = "http://" + hostUnderTest + "/temp";
</span><span class="cx">     const otherPrevalentUrl = "http://localhost:8000/temp";
</span><span class="lines">@@ -37,8 +41,7 @@
</span><span class="cx">                             testPassed("Cookie not deleted.");
</span><span class="cx">                         else
</span><span class="cx">                             testFailed("Cookie deleted or document.cookie contains other cookies: " + document.cookie);
</span><del>-                        internals.setResourceLoadStatisticsEnabled(false);
-                        testRunner.statisticsResetToConsistentState(function() {
</del><ins>+                        setEnableFeature(false, function() {
</ins><span class="cx">                             testRunner.notifyDone();
</span><span class="cx">                         });
</span><span class="cx">                     });
</span><span class="lines">@@ -50,11 +53,15 @@
</span><span class="cx">         });
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if (document.location.host === hostUnderTest && window.testRunner && window.internals) {
-        testRunner.waitUntilDone();
-        internals.setResourceLoadStatisticsEnabled(true);
-        testRunner.setStatisticsNotifyPagesWhenDataRecordsWereScanned(true);
-        runTestRunnerTest();
</del><ins>+    function setUpAndRun() {
+        if (document.location.host === hostUnderTest && window.testRunner && window.internals) {
+            setEnableFeature(true, function () {
+                runTestRunnerTest();
+            });
+        } else {
+            testFailed("Wrong host, no testRunner, or no internals.");
+            testRunner.notifyDone();
+        }
</ins><span class="cx">     }
</span><span class="cx"> </script>
</span><span class="cx"> </body>
</span></span></pre></div>
<a id="trunkLayoutTestshttptestsresourceLoadStatisticsresourcessetcookieonredirectphp"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/http/tests/resourceLoadStatistics/resources/set-cookie-on-redirect.php (242711 => 242712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/resourceLoadStatistics/resources/set-cookie-on-redirect.php 2019-03-11 16:56:57 UTC (rev 242711)
+++ trunk/LayoutTests/http/tests/resourceLoadStatistics/resources/set-cookie-on-redirect.php    2019-03-11 17:01:27 UTC (rev 242712)
</span><span class="lines">@@ -16,6 +16,7 @@
</span><span class="cx">   } else {
</span><span class="cx">     echo "FAILED: Cookie not set\n";
</span><span class="cx">   }
</span><del>-  echo "<script>if (window.testRunner && window.internals) testRunner.statisticsResetToConsistentState(function() { internals.setResourceLoadStatisticsEnabled(false); testRunner.notifyDone(); });</script>";
</del><ins>+  echo "<script src='util.js'></script>";
+  echo "<script>if (window.testRunner && window.internals) setEnableFeature(false, finishJSTest);</script>";
</ins><span class="cx"> }
</span><span class="cx"> ?>
</span></span></pre></div>
<a id="trunkLayoutTestshttptestsresourceLoadStatisticsresourcesutiljs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/http/tests/resourceLoadStatistics/resources/util.js (242711 => 242712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/resourceLoadStatistics/resources/util.js    2019-03-11 16:56:57 UTC (rev 242711)
+++ trunk/LayoutTests/http/tests/resourceLoadStatistics/resources/util.js       2019-03-11 17:01:27 UTC (rev 242712)
</span><span class="lines">@@ -4,9 +4,11 @@
</span><span class="cx">     testRunner.setStatisticsNotifyPagesWhenDataRecordsWereScanned(enable);
</span><span class="cx">     if (enable) {
</span><span class="cx">         internals.setResourceLoadStatisticsEnabled(true);
</span><ins>+        testRunner.setStatisticsIsRunningTest(true);
</ins><span class="cx">         completionHandler();
</span><span class="cx">     } else {
</span><span class="cx">         testRunner.statisticsResetToConsistentState(function() {
</span><ins>+            testRunner.setStatisticsIsRunningTest(false);
</ins><span class="cx">             internals.setResourceLoadStatisticsEnabled(false);
</span><span class="cx">             completionHandler();
</span><span class="cx">         });
</span></span></pre></div>
<a id="trunkLayoutTestshttptestsstorageAccesshasstorageaccessfromprevalentdomainwithuserinteractionhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-user-interaction.html (242711 => 242712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-user-interaction.html   2019-03-11 16:56:57 UTC (rev 242711)
+++ trunk/LayoutTests/http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-user-interaction.html      2019-03-11 17:01:27 UTC (rev 242712)
</span><span class="lines">@@ -3,6 +3,7 @@
</span><span class="cx"> <head>
</span><span class="cx">     <script src="/js-test-resources/js-test.js"></script>
</span><span class="cx">     <script src="/js-test-resources/ui-helper.js"></script>
</span><ins>+    <script src="/resourceLoadStatistics/resources/util.js"></script>
</ins><span class="cx">     <script>
</span><span class="cx">         description("Tests that a cross-origin iframe from a prevalent domain with user interaction does not have storage access.");
</span><span class="cx">         jsTestIsAsync = true;
</span><span class="lines">@@ -17,26 +18,31 @@
</span><span class="cx">                     testFailed(event.data);
</span><span class="cx">             } else
</span><span class="cx">                 testFailed("Received a message from an unexpected origin: " + event.origin);
</span><del>-            finishJSTest();
</del><ins>+            setEnableFeature(false, finishJSTest);
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         const hostUnderTest = "localhost:8000";
</span><span class="cx">         const statisticsUrl = "http://" + hostUnderTest + "/temp";
</span><del>-        testRunner.setStatisticsPrevalentResource(statisticsUrl, true, function() {
-            if (!testRunner.isStatisticsPrevalentResource(statisticsUrl))
-                testFailed("Host did not get set as prevalent resource.");
-            testRunner.setStatisticsHasHadUserInteraction(statisticsUrl, true, function() {
-                if (!testRunner.isStatisticsHasHadUserInteraction(statisticsUrl))
-                    testFailed("Host did not get logged for user interaction.");
-                let iframeElement = document.createElement("iframe");
-                iframeElement.setAttribute("sandbox", "allow-storage-access-by-user-activation allow-scripts allow-same-origin allow-modals");
-                iframeElement.id = "TheIframeThatRequestsStorageAccess";
-                iframeElement.src = "http://localhost:8000/storageAccess/resources/has-storage-access-iframe.html#policyShouldNotGrantAccess";
-                document.body.appendChild(iframeElement);
</del><ins>+        function runTest() {
+            setEnableFeature(true, function() {
+                testRunner.setStatisticsPrevalentResource(statisticsUrl, true, function() {
+                    if (!testRunner.isStatisticsPrevalentResource(statisticsUrl))
+                        testFailed("Host did not get set as prevalent resource.");
+                    testRunner.setStatisticsHasHadUserInteraction(statisticsUrl, true, function() {
+                        if (!testRunner.isStatisticsHasHadUserInteraction(statisticsUrl))
+                            testFailed("Host did not get logged for user interaction.");
+                        let iframeElement = document.createElement("iframe");
+                        iframeElement.setAttribute("sandbox", "allow-storage-access-by-user-activation allow-scripts allow-same-origin allow-modals");
+                        iframeElement.id = "TheIframeThatRequestsStorageAccess";
+                        iframeElement.src = "http://localhost:8000/storageAccess/resources/has-storage-access-iframe.html#policyShouldNotGrantAccess";
+                        document.body.appendChild(iframeElement);
+                    });
+                });
+
</ins><span class="cx">             });
</span><del>-        });
</del><ins>+        }
</ins><span class="cx">     </script>
</span><span class="cx"> </head>
</span><del>-<body>
</del><ins>+<body onload="runTest()">
</ins><span class="cx"> </body>
</span><span class="cx"> </html>
</span><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestshttptestsstorageAccessrequestandgrantaccesscrossoriginsandboxediframefromprevalentdomainwithuserinteractionhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-user-interaction.html (242711 => 242712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-user-interaction.html       2019-03-11 16:56:57 UTC (rev 242711)
+++ trunk/LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-user-interaction.html  2019-03-11 17:01:27 UTC (rev 242712)
</span><span class="lines">@@ -3,6 +3,7 @@
</span><span class="cx"> <head>
</span><span class="cx">     <script src="/js-test-resources/js-test.js"></script>
</span><span class="cx">     <script src="/js-test-resources/ui-helper.js"></script>
</span><ins>+    <script src="/resourceLoadStatistics/resources/util.js"></script>
</ins><span class="cx">     <script>
</span><span class="cx">         description("Tests that cross-origin iframe storage access is granted if the iframe is sandboxed, has the allow token, the iframe origin is a prevalent resource, the iframe origin has had recent user interaction, and the user opts in.");
</span><span class="cx">         jsTestIsAsync = true;
</span><span class="lines">@@ -17,7 +18,7 @@
</span><span class="cx">                     testFailed(event.data);
</span><span class="cx">             } else
</span><span class="cx">                 testFailed("Received a message from an unexpected origin: " + event.origin);
</span><del>-            finishJSTest();
</del><ins>+            setEnableFeature(false, finishJSTest);
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         function activateElement(elementId) {
</span><span class="lines">@@ -30,12 +31,12 @@
</span><span class="cx">                         eventSender.keyDown("escape");
</span><span class="cx">                     else {
</span><span class="cx">                         testFailed("No eventSender.");
</span><del>-                        finishJSTest();
</del><ins>+                        setEnableFeature(false, finishJSTest);
</ins><span class="cx">                     }
</span><span class="cx">                 },
</span><span class="cx">                 function () {
</span><span class="cx">                     testFailed("Promise rejected.");
</span><del>-                    finishJSTest();
</del><ins>+                    setEnableFeature(false, finishJSTest);
</ins><span class="cx">                 }
</span><span class="cx">             );
</span><span class="cx">         }
</span><span class="lines">@@ -46,18 +47,20 @@
</span><span class="cx"> 
</span><span class="cx">         const hostUnderTest = "localhost:8000";
</span><span class="cx">         const statisticsUrl = "http://" + hostUnderTest + "/temp";
</span><del>-        testRunner.setStatisticsPrevalentResource(statisticsUrl, true, function() {
-            if (!testRunner.isStatisticsPrevalentResource(statisticsUrl))
-                testFailed("Host did not get set as prevalent resource.");
-            testRunner.setStatisticsHasHadUserInteraction(statisticsUrl, true, function() {
-                if (!testRunner.isStatisticsHasHadUserInteraction(statisticsUrl))
-                    testFailed("Host did not get logged for user interaction.");
-                let iframeElement = document.createElement("iframe");
-                iframeElement.setAttribute("sandbox", "allow-storage-access-by-user-activation allow-scripts allow-same-origin allow-modals");
-                iframeElement.onload = runTest;
-                iframeElement.id = "TheIframeThatRequestsStorageAccess";
-                iframeElement.src = "http://localhost:8000/storageAccess/resources/request-storage-access-iframe.html#userShouldGrantAccess,userShouldBeConsulted,policyShouldGrantAccess,isNotSameOriginIframe";
-                document.body.appendChild(iframeElement);
</del><ins>+        setEnableFeature(true, function() {
+            testRunner.setStatisticsPrevalentResource(statisticsUrl, true, function() {
+                if (!testRunner.isStatisticsPrevalentResource(statisticsUrl))
+                    testFailed("Host did not get set as prevalent resource.");
+                testRunner.setStatisticsHasHadUserInteraction(statisticsUrl, true, function() {
+                    if (!testRunner.isStatisticsHasHadUserInteraction(statisticsUrl))
+                        testFailed("Host did not get logged for user interaction.");
+                    let iframeElement = document.createElement("iframe");
+                    iframeElement.setAttribute("sandbox", "allow-storage-access-by-user-activation allow-scripts allow-same-origin allow-modals");
+                    iframeElement.onload = runTest;
+                    iframeElement.id = "TheIframeThatRequestsStorageAccess";
+                    iframeElement.src = "http://localhost:8000/storageAccess/resources/request-storage-access-iframe.html#userShouldGrantAccess,userShouldBeConsulted,policyShouldGrantAccess,isNotSameOriginIframe";
+                    document.body.appendChild(iframeElement);
+                });
</ins><span class="cx">             });
</span><span class="cx">         });
</span><span class="cx">     </script>
</span></span></pre></div>
<a id="trunkLayoutTestshttptestsstorageAccessrequestandgrantaccesscrossoriginsandboxediframefromprevalentdomainwithoutuserinteractionhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-without-user-interaction.html (242711 => 242712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-without-user-interaction.html    2019-03-11 16:56:57 UTC (rev 242711)
+++ trunk/LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-without-user-interaction.html       2019-03-11 17:01:27 UTC (rev 242712)
</span><span class="lines">@@ -3,6 +3,7 @@
</span><span class="cx"> <head>
</span><span class="cx">     <script src="/js-test-resources/js-test.js"></script>
</span><span class="cx">     <script src="/js-test-resources/ui-helper.js"></script>
</span><ins>+    <script src="/resourceLoadStatistics/resources/util.js"></script>
</ins><span class="cx">     <script>
</span><span class="cx">         description("Tests that cross-origin iframe storage access is denied if the iframe is sandboxed, has the allow token, the iframe origin is a prevalent resource, the iframe origin has not had user interaction, and the user opts in.");
</span><span class="cx">         jsTestIsAsync = true;
</span><span class="lines">@@ -17,7 +18,7 @@
</span><span class="cx">                     testFailed(event.data);
</span><span class="cx">             } else
</span><span class="cx">                 testFailed("Received a message from an unexpected origin: " + event.origin);
</span><del>-            finishJSTest();
</del><ins>+            setEnableFeature(false, finishJSTest);
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         function activateElement(elementId) {
</span><span class="lines">@@ -30,12 +31,12 @@
</span><span class="cx">                         eventSender.keyDown("escape");
</span><span class="cx">                     else {
</span><span class="cx">                         testFailed("No eventSender.");
</span><del>-                        finishJSTest();
</del><ins>+                        setEnableFeature(false, finishJSTest);
</ins><span class="cx">                     }
</span><span class="cx">                 },
</span><span class="cx">                 function () {
</span><span class="cx">                     testFailed("Promise rejected.");
</span><del>-                    finishJSTest();
</del><ins>+                    setEnableFeature(false, finishJSTest);
</ins><span class="cx">                 }
</span><span class="cx">             );
</span><span class="cx">         }
</span><span class="lines">@@ -46,15 +47,18 @@
</span><span class="cx"> 
</span><span class="cx">         const hostUnderTest = "localhost:8000";
</span><span class="cx">         const statisticsUrl = "http://" + hostUnderTest + "/temp";
</span><del>-        testRunner.setStatisticsPrevalentResource(statisticsUrl, true, function() {
-            if (!testRunner.isStatisticsPrevalentResource(statisticsUrl))
-                testFailed("Host did not get set as prevalent resource.");
-            let iframeElement = document.createElement("iframe");
-            iframeElement.setAttribute("sandbox", "allow-storage-access-by-user-activation allow-scripts allow-same-origin allow-modals");
-            iframeElement.onload = runTest;
-            iframeElement.id = "TheIframeThatRequestsStorageAccess";
-            iframeElement.src = "http://localhost:8000/storageAccess/resources/request-storage-access-iframe.html#userShouldGrantAccess,userShouldBeConsulted,policyShouldNotGrantAccess,isNotSameOriginIframe";
-            document.body.appendChild(iframeElement);
</del><ins>+
+        setEnableFeature(true, function() {
+            testRunner.setStatisticsPrevalentResource(statisticsUrl, true, function() {
+                if (!testRunner.isStatisticsPrevalentResource(statisticsUrl))
+                    testFailed("Host did not get set as prevalent resource.");
+                let iframeElement = document.createElement("iframe");
+                iframeElement.setAttribute("sandbox", "allow-storage-access-by-user-activation allow-scripts allow-same-origin allow-modals");
+                iframeElement.onload = runTest;
+                iframeElement.id = "TheIframeThatRequestsStorageAccess";
+                iframeElement.src = "http://localhost:8000/storageAccess/resources/request-storage-access-iframe.html#userShouldGrantAccess,userShouldBeConsulted,policyShouldNotGrantAccess,isNotSameOriginIframe";
+                document.body.appendChild(iframeElement);
+            });
</ins><span class="cx">         });
</span><span class="cx">     </script>
</span><span class="cx"> </head>
</span></span></pre></div>
<a id="trunkLayoutTestshttptestsstorageAccessrequestandgrantaccesscrossoriginsandboxediframehtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe.html (242711 => 242712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe.html   2019-03-11 16:56:57 UTC (rev 242711)
+++ trunk/LayoutTests/http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe.html      2019-03-11 17:01:27 UTC (rev 242712)
</span><span class="lines">@@ -3,6 +3,7 @@
</span><span class="cx"> <head>
</span><span class="cx">     <script src="/js-test-resources/js-test.js"></script>
</span><span class="cx">     <script src="/js-test-resources/ui-helper.js"></script>
</span><ins>+    <script src="/resourceLoadStatistics/resources/util.js"></script>
</ins><span class="cx">     <script>
</span><span class="cx">         description("Tests that cross-origin iframe storage access is granted if the iframe is sandboxed, has the allow token, and the user opts in.");
</span><span class="cx">         jsTestIsAsync = true;
</span><span class="lines">@@ -17,7 +18,7 @@
</span><span class="cx">                     testFailed(event.data);
</span><span class="cx">             } else
</span><span class="cx">                 testFailed("Received a message from an unexpected origin: " + event.origin);
</span><del>-            finishJSTest();
</del><ins>+            setEnableFeature(false, finishJSTest);
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         function activateElement(elementId) {
</span><span class="lines">@@ -30,18 +31,20 @@
</span><span class="cx">                         eventSender.keyDown("escape");
</span><span class="cx">                     else {
</span><span class="cx">                         testFailed("No eventSender.");
</span><del>-                        finishJSTest();
</del><ins>+                        setEnableFeature(false, finishJSTest);
</ins><span class="cx">                     }
</span><span class="cx">                 },
</span><span class="cx">                 function () {
</span><span class="cx">                     testFailed("Promise rejected.");
</span><del>-                    finishJSTest();
</del><ins>+                    setEnableFeature(false, finishJSTest);
</ins><span class="cx">                 }
</span><span class="cx">             );
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         function runTest() {
</span><del>-            activateElement("TheIframeThatRequestsStorageAccess");
</del><ins>+            setEnableFeature(true, function() {
+                activateElement("TheIframeThatRequestsStorageAccess");
+            });
</ins><span class="cx">         }
</span><span class="cx">     </script>
</span><span class="cx"> </head>
</span></span></pre></div>
<a id="trunkLayoutTestshttptestsstorageAccessrequeststorageaccesscrossoriginsandboxediframewithuniqueoriginhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/http/tests/storageAccess/request-storage-access-cross-origin-sandboxed-iframe-with-unique-origin.html (242711 => 242712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/storageAccess/request-storage-access-cross-origin-sandboxed-iframe-with-unique-origin.html  2019-03-11 16:56:57 UTC (rev 242711)
+++ trunk/LayoutTests/http/tests/storageAccess/request-storage-access-cross-origin-sandboxed-iframe-with-unique-origin.html     2019-03-11 17:01:27 UTC (rev 242712)
</span><span class="lines">@@ -3,6 +3,7 @@
</span><span class="cx"> <head>
</span><span class="cx">     <script src="/js-test-resources/js-test.js"></script>
</span><span class="cx">     <script src="/js-test-resources/ui-helper.js"></script>
</span><ins>+    <script src="/resourceLoadStatistics/resources/util.js"></script>
</ins><span class="cx">     <script>
</span><span class="cx">         description("Tests that cross-origin iframe storage access is denied if the iframe is sandboxed and has the unique origin because it lacks the allow-same-origin token.");
</span><span class="cx">         jsTestIsAsync = true;
</span><span class="lines">@@ -17,7 +18,7 @@
</span><span class="cx">                     testFailed(event.data.replace("FAIL ", ""));
</span><span class="cx">             } else
</span><span class="cx">                 testFailed("Received a message from an unexpected origin: " + event.origin);
</span><del>-            finishJSTest();
</del><ins>+            setEnableFeature(false, finishJSTest);
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         function activateElement(elementId) {
</span><span class="lines">@@ -30,18 +31,20 @@
</span><span class="cx">                         eventSender.keyDown("escape");
</span><span class="cx">                     else {
</span><span class="cx">                         testFailed("No eventSender.");
</span><del>-                        finishJSTest();
</del><ins>+                        setEnableFeature(false, finishJSTest);
</ins><span class="cx">                     }
</span><span class="cx">                 },
</span><span class="cx">                 function () {
</span><span class="cx">                     testFailed("Promise rejected.");
</span><del>-                    finishJSTest();
</del><ins>+                    setEnableFeature(false, finishJSTest);
</ins><span class="cx">                 }
</span><span class="cx">             );
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         function runTest() {
</span><del>-            activateElement("TheIframeThatRequestsStorageAccess");
</del><ins>+            setEnableFeature(true, function() {
+                activateElement("TheIframeThatRequestsStorageAccess");
+            });
</ins><span class="cx">         }
</span><span class="cx">     </script>
</span><span class="cx"> </head>
</span></span></pre></div>
<a id="trunkLayoutTestshttptestsstorageAccessrequeststorageaccesssameoriginiframehtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/http/tests/storageAccess/request-storage-access-same-origin-iframe.html (242711 => 242712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/storageAccess/request-storage-access-same-origin-iframe.html        2019-03-11 16:56:57 UTC (rev 242711)
+++ trunk/LayoutTests/http/tests/storageAccess/request-storage-access-same-origin-iframe.html   2019-03-11 17:01:27 UTC (rev 242712)
</span><span class="lines">@@ -3,6 +3,7 @@
</span><span class="cx"> <head>
</span><span class="cx">     <script src="/js-test-resources/js-test.js"></script>
</span><span class="cx">     <script src="/js-test-resources/ui-helper.js"></script>
</span><ins>+    <script src="/resourceLoadStatistics/resources/util.js"></script>
</ins><span class="cx">     <script>
</span><span class="cx">         description("Tests that same-origin iframe storage access is granted if the iframe is not sandboxed.");
</span><span class="cx">         jsTestIsAsync = true;
</span><span class="lines">@@ -17,7 +18,7 @@
</span><span class="cx">                     testFailed(event.data.replace("FAIL ", ""));
</span><span class="cx">             } else
</span><span class="cx">                 testFailed("Received a message from an unexpected origin: " + event.origin);
</span><del>-            finishJSTest();
</del><ins>+            setEnableFeature(false, finishJSTest);
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         function activateElement(elementId) {
</span><span class="lines">@@ -30,18 +31,20 @@
</span><span class="cx">                         eventSender.keyDown("escape");
</span><span class="cx">                     else {
</span><span class="cx">                         testFailed("No eventSender.");
</span><del>-                        finishJSTest();
</del><ins>+                        setEnableFeature(false, finishJSTest);
</ins><span class="cx">                     }
</span><span class="cx">                 },
</span><span class="cx">                 function () {
</span><span class="cx">                     testFailed("Promise rejected.");
</span><del>-                    finishJSTest();
</del><ins>+                    setEnableFeature(false, finishJSTest);
</ins><span class="cx">                 }
</span><span class="cx">             );
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         function runTest() {
</span><del>-            activateElement("TheIframeThatRequestsStorageAccess");
</del><ins>+            setEnableFeature(true, function() {
+                activateElement("TheIframeThatRequestsStorageAccess");
+            });
</ins><span class="cx">         }
</span><span class="cx">     </script>
</span><span class="cx"> </head>
</span></span></pre></div>
<a id="trunkLayoutTestshttptestsstorageAccessrequeststorageaccesssameoriginsandboxediframehtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/http/tests/storageAccess/request-storage-access-same-origin-sandboxed-iframe.html (242711 => 242712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/storageAccess/request-storage-access-same-origin-sandboxed-iframe.html      2019-03-11 16:56:57 UTC (rev 242711)
+++ trunk/LayoutTests/http/tests/storageAccess/request-storage-access-same-origin-sandboxed-iframe.html 2019-03-11 17:01:27 UTC (rev 242712)
</span><span class="lines">@@ -3,6 +3,7 @@
</span><span class="cx"> <head>
</span><span class="cx">     <script src="/js-test-resources/js-test.js"></script>
</span><span class="cx">     <script src="/js-test-resources/ui-helper.js"></script>
</span><ins>+    <script src="/resourceLoadStatistics/resources/util.js"></script>
</ins><span class="cx">     <script>
</span><span class="cx">         description("Tests that same-origin iframe storage access is granted if the iframe is sandboxed and has the allow token.");
</span><span class="cx">         jsTestIsAsync = true;
</span><span class="lines">@@ -17,7 +18,7 @@
</span><span class="cx">                     testFailed(event.data.replace("FAIL ", ""));
</span><span class="cx">             } else
</span><span class="cx">                 testFailed("Received a message from an unexpected origin: " + event.origin);
</span><del>-            finishJSTest();
</del><ins>+            setEnableFeature(false, finishJSTest);
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         function activateElement(elementId) {
</span><span class="lines">@@ -30,18 +31,20 @@
</span><span class="cx">                         eventSender.keyDown("escape");
</span><span class="cx">                     else {
</span><span class="cx">                         testFailed("No eventSender.");
</span><del>-                        finishJSTest();
</del><ins>+                        setEnableFeature(false, finishJSTest);
</ins><span class="cx">                     }
</span><span class="cx">                 },
</span><span class="cx">                 function () {
</span><span class="cx">                     testFailed("Promise rejected.");
</span><del>-                    finishJSTest();
</del><ins>+                    setEnableFeature(false, finishJSTest);
</ins><span class="cx">                 }
</span><span class="cx">             );
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         function runTest() {
</span><del>-            activateElement("TheIframeThatRequestsStorageAccess");
</del><ins>+            setEnableFeature(true, function() {
+                activateElement("TheIframeThatRequestsStorageAccess");
+            });
</ins><span class="cx">         }
</span><span class="cx">     </script>
</span><span class="cx"> </head>
</span></span></pre></div>
<a id="trunkLayoutTestshttptestsstorageAccessrequeststorageaccesstopframehtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/http/tests/storageAccess/request-storage-access-top-frame.html (242711 => 242712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/storageAccess/request-storage-access-top-frame.html 2019-03-11 16:56:57 UTC (rev 242711)
+++ trunk/LayoutTests/http/tests/storageAccess/request-storage-access-top-frame.html    2019-03-11 17:01:27 UTC (rev 242712)
</span><span class="lines">@@ -26,17 +26,19 @@
</span><span class="cx">     var requestStorageAccessResolved;
</span><span class="cx"> 
</span><span class="cx">     function makeRequestWithUserGesture() {
</span><del>-        var promise = document.requestStorageAccess();
-        promise.then(
-            function () {
-                requestStorageAccessResolved = true;
-                continueAfterRequestWithUserGesture();
-            },
-            function () {
-                requestStorageAccessResolved = false;
-                continueAfterRequestWithUserGesture();
-            }
-        );
</del><ins>+        setEnableFeature(true, function() {
+            var promise = document.requestStorageAccess();
+            promise.then(
+                function () {
+                    requestStorageAccessResolved = true;
+                    continueAfterRequestWithUserGesture();
+                },
+                function () {
+                    requestStorageAccessResolved = false;
+                    continueAfterRequestWithUserGesture();
+                }
+            );
+        });
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     function continueAfterRequestWithUserGesture() {
</span></span></pre></div>
<a id="trunkSourceWebKitChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/ChangeLog (242711 => 242712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/ChangeLog    2019-03-11 16:56:57 UTC (rev 242711)
+++ trunk/Source/WebKit/ChangeLog       2019-03-11 17:01:27 UTC (rev 242712)
</span><span class="lines">@@ -1,3 +1,91 @@
</span><ins>+2019-03-11  John Wilander  <wilander@apple.com>
+
+        Resource Load Statistics: Make it possible exclude localhost from classification
+        https://bugs.webkit.org/show_bug.cgi?id=195474
+        <rdar://problem/47520577>
+
+        Reviewed by Brent Fulgham.
+
+        This patch allows for localhost to be excluded from classification and
+        treatment as a prevalent resource.
+
+        * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
+        (WebKit::ResourceLoadStatisticsDatabaseStore::ResourceLoadStatisticsDatabaseStore):
+        (WebKit::ResourceLoadStatisticsDatabaseStore::reclassifyResources):
+            Makes use of the new ResourceLoadStatisticsMemoryStore::shouldSkip().
+        (WebKit::ResourceLoadStatisticsDatabaseStore::setPrevalentResource):
+            Makes use of the new ResourceLoadStatisticsMemoryStore::shouldSkip().
+        (WebKit::ResourceLoadStatisticsDatabaseStore::isPrevalentResource const):
+            Makes use of the new ResourceLoadStatisticsMemoryStore::shouldSkip().
+        (WebKit::ResourceLoadStatisticsDatabaseStore::isVeryPrevalentResource const):
+            Makes use of the new ResourceLoadStatisticsMemoryStore::shouldSkip().
+        (WebKit::ResourceLoadStatisticsDatabaseStore::setVeryPrevalentResource):
+            Makes use of the new ResourceLoadStatisticsMemoryStore::shouldSkip().
+        * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
+        * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
+        (WebKit::ResourceLoadStatisticsMemoryStore::ResourceLoadStatisticsMemoryStore):
+        (WebKit::ResourceLoadStatisticsMemoryStore::classifyPrevalentResources):
+            Makes use of the new ResourceLoadStatisticsMemoryStore::shouldSkip().
+        (WebKit::ResourceLoadStatisticsMemoryStore::setPrevalentResource):
+            Makes use of the new ResourceLoadStatisticsMemoryStore::shouldSkip().
+        (WebKit::ResourceLoadStatisticsMemoryStore::isPrevalentResource const):
+            Makes use of the new ResourceLoadStatisticsMemoryStore::shouldSkip().
+        (WebKit::ResourceLoadStatisticsMemoryStore::isVeryPrevalentResource const):
+            Makes use of the new ResourceLoadStatisticsMemoryStore::shouldSkip().
+        (WebKit::ResourceLoadStatisticsMemoryStore::setVeryPrevalentResource):
+            Makes use of the new ResourceLoadStatisticsMemoryStore::shouldSkip().
+        * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h:
+        * NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp:
+        (WebKit::ResourceLoadStatisticsStore::ResourceLoadStatisticsStore):
+            Now takes a ShouldIncludeLocalhost parameter.
+        (WebKit::ResourceLoadStatisticsStore::shouldSkip const):
+            Convenience function, currently supporting the localhost exclusion.
+        (WebKit::ResourceLoadStatisticsStore::setIsRunningTest):
+            Test infrastructure.
+        * NetworkProcess/Classifier/ResourceLoadStatisticsStore.h:
+        * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
+        (WebKit::WebResourceLoadStatisticsStore::setIsRunningTest):
+            Test infrastructure.
+        (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
+            Now takes a ShouldIncludeLocalhost parameter.
+        * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
+            Defines the new ShouldIncludeLocalhost boolean enum.
+        * NetworkProcess/NetworkProcess.cpp:
+        (WebKit::NetworkProcess::setIsRunningResourceLoadStatisticsTest):
+            Test infrastructure.
+        * NetworkProcess/NetworkProcess.h:
+        * NetworkProcess/NetworkProcess.messages.in:
+        * NetworkProcess/NetworkSession.cpp:
+        (WebKit::NetworkSession::setResourceLoadStatisticsEnabled):
+            Forwards the localhost setting to the create function.
+        * NetworkProcess/NetworkSession.h:
+        * NetworkProcess/NetworkSessionCreationParameters.cpp:
+        (WebKit::NetworkSessionCreationParameters::encode const):
+        (WebKit::NetworkSessionCreationParameters::decode):
+        * NetworkProcess/NetworkSessionCreationParameters.h:
+            New parameter called shouldIncludeLocalhostInResourceLoadStatistics.
+        * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
+        (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
+            Picks up the localhost setting from the parameters.
+        * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
+        (WKWebsiteDataStoreSetStatisticsIsRunningTest):
+            Test infrastructure.
+        * UIProcess/API/C/WKWebsiteDataStoreRef.h:
+        * UIProcess/Network/NetworkProcessProxy.cpp:
+        (WebKit::NetworkProcessProxy::setIsRunningResourceLoadStatisticsTest):
+            Test infrastructure.
+        * UIProcess/Network/NetworkProcessProxy.h:
+        * UIProcess/WebProcessPool.cpp:
+        (WebKit::WebProcessPool::ensureNetworkProcess):
+            Picks up the localhost setting from the WebsiteDataStore parameters.
+        * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
+        (WebKit::WebsiteDataStore::parameters):
+            Makes sure Safari does not exclude localhost.
+        * UIProcess/WebsiteData/WebsiteDataStore.cpp:
+        (WebKit::WebsiteDataStore::setIsRunningResourceLoadStatisticsTest):
+            Test infrastructure.
+        * UIProcess/WebsiteData/WebsiteDataStore.h:
+
</ins><span class="cx"> 2019-03-11  Alex Christensen  <achristensen@webkit.org>
</span><span class="cx"> 
</span><span class="cx">         Unreviewed, rolling out r242698.
</span></span></pre></div>
<a id="trunkSourceWebKitNetworkProcessClassifierResourceLoadStatisticsDatabaseStorecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp (242711 => 242712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp    2019-03-11 16:56:57 UTC (rev 242711)
+++ trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp       2019-03-11 17:01:27 UTC (rev 242712)
</span><span class="lines">@@ -158,8 +158,8 @@
</span><span class="cx">     "FOREIGN KEY(subresourceDomainID) REFERENCES ObservedDomains(domainID) ON DELETE CASCADE, "
</span><span class="cx">     "FOREIGN KEY(fromDomainID) REFERENCES ObservedDomains(domainID) ON DELETE CASCADE);"_s;
</span><span class="cx">     
</span><del>-ResourceLoadStatisticsDatabaseStore::ResourceLoadStatisticsDatabaseStore(WebResourceLoadStatisticsStore& store, WorkQueue& workQueue, const String& storageDirectoryPath)
-    : ResourceLoadStatisticsStore(store, workQueue)
</del><ins>+ResourceLoadStatisticsDatabaseStore::ResourceLoadStatisticsDatabaseStore(WebResourceLoadStatisticsStore& store, WorkQueue& workQueue, ShouldIncludeLocalhost shouldIncludeLocalhost, const String& storageDirectoryPath)
+    : ResourceLoadStatisticsStore(store, workQueue, shouldIncludeLocalhost)
</ins><span class="cx">     , m_storageDirectoryPath(storageDirectoryPath + "/observations.db")
</span><span class="cx">     , m_observedDomainCount(m_database, observedDomainCountQuery)
</span><span class="cx">     , m_insertObservedDomainStatement(m_database, insertObservedDomainQuery)
</span><span class="lines">@@ -689,6 +689,9 @@
</span><span class="cx">     auto notVeryPrevalentResources = findNotVeryPrevalentResources();
</span><span class="cx"> 
</span><span class="cx">     for (auto& resourceStatistic : notVeryPrevalentResources.values()) {
</span><ins>+        if (shouldSkip(resourceStatistic.registerableDomain))
+            continue;
+
</ins><span class="cx">         auto newPrevalence = classifier().calculateResourcePrevalence(resourceStatistic.subresourceUnderTopFrameDomainsCount, resourceStatistic.subresourceUniqueRedirectsToCount, resourceStatistic.subframeUnderTopFrameDomainsCount, resourceStatistic.topFrameUniqueRedirectsToCount, resourceStatistic.prevalence);
</span><span class="cx">         if (newPrevalence != resourceStatistic.prevalence)
</span><span class="cx">             setPrevalentResource(resourceStatistic.registerableDomain, newPrevalence);
</span><span class="lines">@@ -1066,6 +1069,8 @@
</span><span class="cx"> void ResourceLoadStatisticsDatabaseStore::setPrevalentResource(const RegistrableDomain& domain, ResourceLoadPrevalence newPrevalence)
</span><span class="cx"> {
</span><span class="cx">     ASSERT(!RunLoop::isMain());
</span><ins>+    if (shouldSkip(domain))
+        return;
</ins><span class="cx"> 
</span><span class="cx">     if (m_updatePrevalentResourceStatement.bindInt(1, 1) != SQLITE_OK
</span><span class="cx">         || m_updatePrevalentResourceStatement.bindText(2, domain.string()) != SQLITE_OK
</span><span class="lines">@@ -1139,6 +1144,9 @@
</span><span class="cx"> {
</span><span class="cx">     ASSERT(!RunLoop::isMain());
</span><span class="cx"> 
</span><ins>+    if (shouldSkip(domain))
+        return false;
+
</ins><span class="cx">     return predicateValueForDomain(m_isPrevalentResourceStatement, domain);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -1146,6 +1154,9 @@
</span><span class="cx"> {
</span><span class="cx">     ASSERT(!RunLoop::isMain());
</span><span class="cx"> 
</span><ins>+    if (shouldSkip(domain))
+        return false;
+
</ins><span class="cx">     return predicateValueForDomain(m_isVeryPrevalentResourceStatement, domain);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -1584,6 +1595,9 @@
</span><span class="cx"> {
</span><span class="cx">     ASSERT(!RunLoop::isMain());
</span><span class="cx"> 
</span><ins>+    if (shouldSkip(domain))
+        return;
+
</ins><span class="cx">     ensureResourceStatisticsForRegistrableDomain(domain);
</span><span class="cx">     setPrevalentResource(domain, ResourceLoadPrevalence::High);
</span><span class="cx"> }
</span><span class="lines">@@ -1592,6 +1606,9 @@
</span><span class="cx"> {
</span><span class="cx">     ASSERT(!RunLoop::isMain());
</span><span class="cx"> 
</span><ins>+    if (shouldSkip(domain))
+        return;
+    
</ins><span class="cx">     ensureResourceStatisticsForRegistrableDomain(domain);
</span><span class="cx">     setPrevalentResource(domain, ResourceLoadPrevalence::VeryHigh);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKitNetworkProcessClassifierResourceLoadStatisticsDatabaseStoreh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h (242711 => 242712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h      2019-03-11 16:56:57 UTC (rev 242711)
+++ trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h 2019-03-11 17:01:27 UTC (rev 242712)
</span><span class="lines">@@ -50,7 +50,7 @@
</span><span class="cx"> // This is always constructed / used / destroyed on the WebResourceLoadStatisticsStore's statistics queue.
</span><span class="cx"> class ResourceLoadStatisticsDatabaseStore final : public ResourceLoadStatisticsStore {
</span><span class="cx"> public:
</span><del>-    ResourceLoadStatisticsDatabaseStore(WebResourceLoadStatisticsStore&, WorkQueue&, const String& storageDirectoryPath);
</del><ins>+    ResourceLoadStatisticsDatabaseStore(WebResourceLoadStatisticsStore&, WorkQueue&, ShouldIncludeLocalhost, const String& storageDirectoryPath);
</ins><span class="cx"> 
</span><span class="cx">     void populateFromMemoryStore(const ResourceLoadStatisticsMemoryStore&);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKitNetworkProcessClassifierResourceLoadStatisticsMemoryStorecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp (242711 => 242712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp      2019-03-11 16:56:57 UTC (rev 242711)
+++ trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp 2019-03-11 17:01:27 UTC (rev 242712)
</span><span class="lines">@@ -67,8 +67,8 @@
</span><span class="cx">         statisticsMap.remove(statisticsToPrune[i].domain);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-ResourceLoadStatisticsMemoryStore::ResourceLoadStatisticsMemoryStore(WebResourceLoadStatisticsStore& store, WorkQueue& workQueue)
-    : ResourceLoadStatisticsStore(store, workQueue)
</del><ins>+ResourceLoadStatisticsMemoryStore::ResourceLoadStatisticsMemoryStore(WebResourceLoadStatisticsStore& store, WorkQueue& workQueue, ShouldIncludeLocalhost shouldIncludeLocalhost)
+    : ResourceLoadStatisticsStore(store, workQueue, shouldIncludeLocalhost)
</ins><span class="cx"> {
</span><span class="cx">     ASSERT(!RunLoop::isMain());
</span><span class="cx"> 
</span><span class="lines">@@ -175,6 +175,8 @@
</span><span class="cx"> void ResourceLoadStatisticsMemoryStore::classifyPrevalentResources()
</span><span class="cx"> {
</span><span class="cx">     for (auto& resourceStatistic : m_resourceStatisticsMap.values()) {
</span><ins>+        if (shouldSkip(resourceStatistic.registrableDomain))
+            continue;
</ins><span class="cx">         if (isPrevalentDueToDebugMode(resourceStatistic))
</span><span class="cx">             setPrevalentResource(resourceStatistic, ResourceLoadPrevalence::High);
</span><span class="cx">         else if (!resourceStatistic.isVeryPrevalentResource) {
</span><span class="lines">@@ -458,6 +460,9 @@
</span><span class="cx"> {
</span><span class="cx">     ASSERT(!RunLoop::isMain());
</span><span class="cx"> 
</span><ins>+    if (shouldSkip(resourceStatistic.registrableDomain))
+        return;
+
</ins><span class="cx">     resourceStatistic.isPrevalentResource = true;
</span><span class="cx">     resourceStatistic.isVeryPrevalentResource = newPrevalence == ResourceLoadPrevalence::VeryHigh;
</span><span class="cx">     HashSet<RegistrableDomain> domainsThatHaveRedirectedTo;
</span><span class="lines">@@ -486,6 +491,9 @@
</span><span class="cx"> {
</span><span class="cx">     ASSERT(!RunLoop::isMain());
</span><span class="cx"> 
</span><ins>+    if (shouldSkip(domain))
+        return false;
+
</ins><span class="cx">     auto mapEntry = m_resourceStatisticsMap.find(domain);
</span><span class="cx">     return mapEntry == m_resourceStatisticsMap.end() ? false : mapEntry->value.isPrevalentResource;
</span><span class="cx"> }
</span><span class="lines">@@ -494,6 +502,9 @@
</span><span class="cx"> {
</span><span class="cx">     ASSERT(!RunLoop::isMain());
</span><span class="cx"> 
</span><ins>+    if (shouldSkip(domain))
+        return false;
+    
</ins><span class="cx">     auto mapEntry = m_resourceStatisticsMap.find(domain);
</span><span class="cx">     return mapEntry == m_resourceStatisticsMap.end() ? false : mapEntry->value.isPrevalentResource && mapEntry->value.isVeryPrevalentResource;
</span><span class="cx"> }
</span><span class="lines">@@ -850,6 +861,9 @@
</span><span class="cx"> {
</span><span class="cx">     ASSERT(!RunLoop::isMain());
</span><span class="cx"> 
</span><ins>+    if (shouldSkip(domain))
+        return;
+    
</ins><span class="cx">     auto& resourceStatistic = ensureResourceStatisticsForRegistrableDomain(domain);
</span><span class="cx">     setPrevalentResource(resourceStatistic, ResourceLoadPrevalence::High);
</span><span class="cx"> }
</span><span class="lines">@@ -858,6 +872,9 @@
</span><span class="cx"> {
</span><span class="cx">     ASSERT(!RunLoop::isMain());
</span><span class="cx"> 
</span><ins>+    if (shouldSkip(domain))
+        return;
+    
</ins><span class="cx">     auto& resourceStatistic = ensureResourceStatisticsForRegistrableDomain(domain);
</span><span class="cx">     setPrevalentResource(resourceStatistic, ResourceLoadPrevalence::VeryHigh);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKitNetworkProcessClassifierResourceLoadStatisticsMemoryStoreh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h (242711 => 242712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h        2019-03-11 16:56:57 UTC (rev 242711)
+++ trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h   2019-03-11 17:01:27 UTC (rev 242712)
</span><span class="lines">@@ -47,7 +47,7 @@
</span><span class="cx"> // This is always constructed / used / destroyed on the WebResourceLoadStatisticsStore's statistics queue.
</span><span class="cx"> class ResourceLoadStatisticsMemoryStore final : public ResourceLoadStatisticsStore {
</span><span class="cx"> public:
</span><del>-    ResourceLoadStatisticsMemoryStore(WebResourceLoadStatisticsStore&, WorkQueue&);
</del><ins>+    ResourceLoadStatisticsMemoryStore(WebResourceLoadStatisticsStore&, WorkQueue&, ShouldIncludeLocalhost);
</ins><span class="cx"> 
</span><span class="cx">     void setPersistentStorage(ResourceLoadStatisticsPersistentStorage&);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKitNetworkProcessClassifierResourceLoadStatisticsStorecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp (242711 => 242712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp    2019-03-11 16:56:57 UTC (rev 242711)
+++ trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp       2019-03-11 17:01:27 UTC (rev 242712)
</span><span class="lines">@@ -101,9 +101,10 @@
</span><span class="cx">     return secondsSinceEpoch() <= other.secondsSinceEpoch();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-ResourceLoadStatisticsStore::ResourceLoadStatisticsStore(WebResourceLoadStatisticsStore& store, WorkQueue& workQueue)
</del><ins>+ResourceLoadStatisticsStore::ResourceLoadStatisticsStore(WebResourceLoadStatisticsStore& store, WorkQueue& workQueue, ShouldIncludeLocalhost shouldIncludeLocalhost)
</ins><span class="cx">     : m_store(store)
</span><span class="cx">     , m_workQueue(workQueue)
</span><ins>+    , m_shouldIncludeLocalhost(shouldIncludeLocalhost)
</ins><span class="cx"> {
</span><span class="cx">     ASSERT(!RunLoop::isMain());
</span><span class="cx"> 
</span><span class="lines">@@ -131,6 +132,19 @@
</span><span class="cx">     m_parameters.shouldNotifyPagesWhenDataRecordsWereScanned = value;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool ResourceLoadStatisticsStore::shouldSkip(const RegistrableDomain& domain) const
+{
+    ASSERT(!RunLoop::isMain());
+    return !(parameters().isRunningTest)
+    && m_shouldIncludeLocalhost == ShouldIncludeLocalhost::No && domain.string() == "localhost";
+}
+
+void ResourceLoadStatisticsStore::setIsRunningTest(bool value)
+{
+    ASSERT(!RunLoop::isMain());
+    m_parameters.isRunningTest = value;
+}
+
</ins><span class="cx"> void ResourceLoadStatisticsStore::setShouldClassifyResourcesBeforeDataRecordsRemoval(bool value)
</span><span class="cx"> {
</span><span class="cx">     ASSERT(!RunLoop::isMain());
</span></span></pre></div>
<a id="trunkSourceWebKitNetworkProcessClassifierResourceLoadStatisticsStoreh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsStore.h (242711 => 242712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsStore.h      2019-03-11 16:56:57 UTC (rev 242711)
+++ trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsStore.h 2019-03-11 17:01:27 UTC (rev 242712)
</span><span class="lines">@@ -146,6 +146,8 @@
</span><span class="cx">     virtual void calculateAndSubmitTelemetry() const = 0;
</span><span class="cx"> 
</span><span class="cx">     void setNotifyPagesWhenDataRecordsWereScanned(bool);
</span><ins>+    void setIsRunningTest(bool);
+    bool shouldSkip(const RegistrableDomain&) const;
</ins><span class="cx">     void setShouldClassifyResourcesBeforeDataRecordsRemoval(bool);
</span><span class="cx">     void setShouldSubmitTelemetry(bool);
</span><span class="cx">     void setTimeToLiveUserInteraction(Seconds);
</span><span class="lines">@@ -184,7 +186,7 @@
</span><span class="cx">     static Vector<OperatingDate> mergeOperatingDates(const Vector<OperatingDate>& existingDates, Vector<OperatingDate>&& newDates);
</span><span class="cx">     static void debugLogDomainsInBatches(const char* action, const Vector<RegistrableDomain>& domains);
</span><span class="cx"> 
</span><del>-    ResourceLoadStatisticsStore(WebResourceLoadStatisticsStore&, WorkQueue&);
</del><ins>+    ResourceLoadStatisticsStore(WebResourceLoadStatisticsStore&, WorkQueue&, ShouldIncludeLocalhost);
</ins><span class="cx"> 
</span><span class="cx">     bool hasStatisticsExpired(const ResourceLoadStatistics&) const;
</span><span class="cx">     bool hasStatisticsExpired(WallTime mostRecentUserInteractionTime) const;
</span><span class="lines">@@ -216,6 +218,7 @@
</span><span class="cx">         bool shouldNotifyPagesWhenDataRecordsWereScanned { false };
</span><span class="cx">         bool shouldClassifyResourcesBeforeDataRecordsRemoval { true };
</span><span class="cx">         bool shouldSubmitTelemetry { true };
</span><ins>+        bool isRunningTest { false };
</ins><span class="cx">     };
</span><span class="cx">     const Parameters& parameters() const { return m_parameters; }
</span><span class="cx">     const Vector<OperatingDate>& operatingDates() const { return m_operatingDates; }
</span><span class="lines">@@ -265,6 +268,7 @@
</span><span class="cx">     bool m_debugModeEnabled { false };
</span><span class="cx">     bool m_storageAccessPromptsEnabled { false };
</span><span class="cx">     bool m_dataRecordsBeingRemoved { false };
</span><ins>+    ShouldIncludeLocalhost m_shouldIncludeLocalhost { ShouldIncludeLocalhost::Yes };
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKitNetworkProcessClassifierWebResourceLoadStatisticsStorecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp (242711 => 242712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp 2019-03-11 16:56:57 UTC (rev 242711)
+++ trunk/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp    2019-03-11 17:01:27 UTC (rev 242712)
</span><span class="lines">@@ -108,6 +108,18 @@
</span><span class="cx">     });
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void WebResourceLoadStatisticsStore::setIsRunningTest(bool value, CompletionHandler<void()>&& completionHandler)
+{
+    ASSERT(RunLoop::isMain());
+    
+    postTask([this, value, completionHandler = WTFMove(completionHandler)]() mutable {
+        if (m_statisticsStore)
+            m_statisticsStore->setIsRunningTest(value);
+        
+        postTaskReply(WTFMove(completionHandler));
+    });
+}
+
</ins><span class="cx"> void WebResourceLoadStatisticsStore::setShouldClassifyResourcesBeforeDataRecordsRemoval(bool value, CompletionHandler<void()>&& completionHandler)
</span><span class="cx"> {
</span><span class="cx">     ASSERT(RunLoop::isMain());
</span><span class="lines">@@ -138,7 +150,7 @@
</span><span class="cx">     completionHandler();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore(NetworkSession& networkSession, const String& resourceLoadStatisticsDirectory)
</del><ins>+WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore(NetworkSession& networkSession, const String& resourceLoadStatisticsDirectory, ShouldIncludeLocalhost shouldIncludeLocalhost)
</ins><span class="cx">     : m_networkSession(makeWeakPtr(networkSession))
</span><span class="cx">     , m_statisticsQueue(WorkQueue::create("WebResourceLoadStatisticsStore Process Data Queue", WorkQueue::Type::Serial, WorkQueue::QOS::Utility))
</span><span class="cx">     , m_dailyTasksTimer(RunLoop::main(), this, &WebResourceLoadStatisticsStore::performDailyTasks)
</span><span class="lines">@@ -145,16 +157,16 @@
</span><span class="cx"> {
</span><span class="cx">     ASSERT(RunLoop::isMain());
</span><span class="cx">     
</span><del>-    postTask([this, resourceLoadStatisticsDirectory = resourceLoadStatisticsDirectory.isolatedCopy()] {
</del><ins>+    postTask([this, resourceLoadStatisticsDirectory = resourceLoadStatisticsDirectory.isolatedCopy(), shouldIncludeLocalhost] {
</ins><span class="cx">         if (RuntimeEnabledFeatures::sharedFeatures().isITPDatabaseEnabled()) {
</span><del>-            m_statisticsStore = std::make_unique<ResourceLoadStatisticsDatabaseStore>(*this, m_statisticsQueue, resourceLoadStatisticsDirectory);
</del><ins>+            m_statisticsStore = std::make_unique<ResourceLoadStatisticsDatabaseStore>(*this, m_statisticsQueue, shouldIncludeLocalhost, resourceLoadStatisticsDirectory);
</ins><span class="cx"> 
</span><del>-            auto memoryStore = std::make_unique<ResourceLoadStatisticsMemoryStore>(*this, m_statisticsQueue);
</del><ins>+            auto memoryStore = std::make_unique<ResourceLoadStatisticsMemoryStore>(*this, m_statisticsQueue, shouldIncludeLocalhost);
</ins><span class="cx">             auto persistentStore = std::make_unique<ResourceLoadStatisticsPersistentStorage>(*memoryStore, m_statisticsQueue, resourceLoadStatisticsDirectory);
</span><span class="cx"> 
</span><span class="cx">             downcast<ResourceLoadStatisticsDatabaseStore>(*m_statisticsStore.get()).populateFromMemoryStore(*memoryStore);
</span><span class="cx">         } else {
</span><del>-            m_statisticsStore = std::make_unique<ResourceLoadStatisticsMemoryStore>(*this, m_statisticsQueue);
</del><ins>+            m_statisticsStore = std::make_unique<ResourceLoadStatisticsMemoryStore>(*this, m_statisticsQueue, shouldIncludeLocalhost);
</ins><span class="cx">             m_persistentStorage = std::make_unique<ResourceLoadStatisticsPersistentStorage>(downcast<ResourceLoadStatisticsMemoryStore>(*m_statisticsStore), m_statisticsQueue, resourceLoadStatisticsDirectory);
</span><span class="cx">         }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKitNetworkProcessClassifierWebResourceLoadStatisticsStoreh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h (242711 => 242712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h   2019-03-11 16:56:57 UTC (rev 242711)
+++ trunk/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h      2019-03-11 17:01:27 UTC (rev 242712)
</span><span class="lines">@@ -58,6 +58,7 @@
</span><span class="cx"> class WebFrameProxy;
</span><span class="cx"> class WebProcessProxy;
</span><span class="cx"> enum class ShouldGrandfatherStatistics : bool;
</span><ins>+enum class ShouldIncludeLocalhost : bool { No, Yes };
</ins><span class="cx"> 
</span><span class="cx"> class WebResourceLoadStatisticsStore final : public ThreadSafeRefCounted<WebResourceLoadStatisticsStore, WTF::DestructionThread::Main>, public IPC::MessageReceiver {
</span><span class="cx"> public:
</span><span class="lines">@@ -77,9 +78,9 @@
</span><span class="cx">     using PageID = uint64_t;
</span><span class="cx">     using FrameID = uint64_t;
</span><span class="cx"> 
</span><del>-    static Ref<WebResourceLoadStatisticsStore> create(NetworkSession& networkSession, const String& resourceLoadStatisticsDirectory)
</del><ins>+    static Ref<WebResourceLoadStatisticsStore> create(NetworkSession& networkSession, const String& resourceLoadStatisticsDirectory, ShouldIncludeLocalhost shouldIncludeLocalhost)
</ins><span class="cx">     {
</span><del>-        return adoptRef(*new WebResourceLoadStatisticsStore(networkSession, resourceLoadStatisticsDirectory));
</del><ins>+        return adoptRef(*new WebResourceLoadStatisticsStore(networkSession, resourceLoadStatisticsDirectory, shouldIncludeLocalhost));
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     ~WebResourceLoadStatisticsStore();
</span><span class="lines">@@ -128,6 +129,7 @@
</span><span class="cx">     void isGrandfathered(const RegistrableDomain&, CompletionHandler<void(bool)>&&);
</span><span class="cx">     void removePrevalentDomains(const Vector<RegistrableDomain>&);
</span><span class="cx">     void setNotifyPagesWhenDataRecordsWereScanned(bool, CompletionHandler<void()>&&);
</span><ins>+    void setIsRunningTest(bool, CompletionHandler<void()>&&);
</ins><span class="cx">     void setSubframeUnderTopFrameDomain(const SubFrameDomain&, const TopFrameDomain&, CompletionHandler<void()>&&);
</span><span class="cx">     void setSubresourceUnderTopFrameDomain(const SubResourceDomain&, const TopFrameDomain&, CompletionHandler<void()>&&);
</span><span class="cx">     void setSubresourceUniqueRedirectTo(const SubResourceDomain&, const RedirectedToDomain&, CompletionHandler<void()>&&);
</span><span class="lines">@@ -171,7 +173,7 @@
</span><span class="cx">     void notifyPageStatisticsTelemetryFinished(unsigned totalPrevalentResources, unsigned totalPrevalentResourcesWithUserInteraction, unsigned top3SubframeUnderTopFrameOrigins) const;
</span><span class="cx"> 
</span><span class="cx"> private:
</span><del>-    explicit WebResourceLoadStatisticsStore(NetworkSession&, const String&);
</del><ins>+    explicit WebResourceLoadStatisticsStore(NetworkSession&, const String&, ShouldIncludeLocalhost);
</ins><span class="cx"> 
</span><span class="cx">     void postTask(WTF::Function<void()>&&);
</span><span class="cx">     static void postTaskReply(WTF::Function<void()>&&);
</span></span></pre></div>
<a id="trunkSourceWebKitNetworkProcessNetworkProcesscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp (242711 => 242712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp    2019-03-11 16:56:57 UTC (rev 242711)
+++ trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp       2019-03-11 17:01:27 UTC (rev 242712)
</span><span class="lines">@@ -786,6 +786,19 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void NetworkProcess::setIsRunningResourceLoadStatisticsTest(PAL::SessionID sessionID, bool value, CompletionHandler<void()>&& completionHandler)
+{
+    if (auto* networkSession = this->networkSession(sessionID)) {
+        if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics())
+            resourceLoadStatistics->setIsRunningTest(value, WTFMove(completionHandler));
+        else
+            completionHandler();
+    } else {
+        ASSERT_NOT_REACHED();
+        completionHandler();
+    }
+}
+
</ins><span class="cx"> void NetworkProcess::setNotifyPagesWhenTelemetryWasCaptured(PAL::SessionID sessionID, bool value, CompletionHandler<void()>&& completionHandler)
</span><span class="cx"> {
</span><span class="cx">     if (auto* networkSession = this->networkSession(sessionID)) {
</span></span></pre></div>
<a id="trunkSourceWebKitNetworkProcessNetworkProcessh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/NetworkProcess/NetworkProcess.h (242711 => 242712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/NetworkProcess/NetworkProcess.h      2019-03-11 16:56:57 UTC (rev 242711)
+++ trunk/Source/WebKit/NetworkProcess/NetworkProcess.h 2019-03-11 17:01:27 UTC (rev 242712)
</span><span class="lines">@@ -244,6 +244,7 @@
</span><span class="cx">     void setLastSeen(PAL::SessionID, const RegistrableDomain&, Seconds, CompletionHandler<void()>&&);
</span><span class="cx">     void setMinimumTimeBetweenDataRecordsRemoval(PAL::SessionID, Seconds, CompletionHandler<void()>&&);
</span><span class="cx">     void setNotifyPagesWhenDataRecordsWereScanned(PAL::SessionID, bool value, CompletionHandler<void()>&&);
</span><ins>+    void setIsRunningResourceLoadStatisticsTest(PAL::SessionID, bool value, CompletionHandler<void()>&&);
</ins><span class="cx">     void setNotifyPagesWhenTelemetryWasCaptured(PAL::SessionID, bool value, CompletionHandler<void()>&&);
</span><span class="cx">     void setResourceLoadStatisticsEnabled(bool);
</span><span class="cx">     void setResourceLoadStatisticsDebugMode(PAL::SessionID, bool debugMode, CompletionHandler<void()>&&d);
</span></span></pre></div>
<a id="trunkSourceWebKitNetworkProcessNetworkProcessmessagesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/NetworkProcess/NetworkProcess.messages.in (242711 => 242712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/NetworkProcess/NetworkProcess.messages.in    2019-03-11 16:56:57 UTC (rev 242711)
+++ trunk/Source/WebKit/NetworkProcess/NetworkProcess.messages.in       2019-03-11 17:01:27 UTC (rev 242712)
</span><span class="lines">@@ -121,6 +121,7 @@
</span><span class="cx">     SetPruneEntriesDownTo(PAL::SessionID sessionID, uint64_t maximumEntryCount) -> () Async
</span><span class="cx">     SetShouldClassifyResourcesBeforeDataRecordsRemoval(PAL::SessionID sessionID, bool value) -> () Async
</span><span class="cx">     SetNotifyPagesWhenDataRecordsWereScanned(PAL::SessionID sessionID, bool value) -> () Async
</span><ins>+    SetIsRunningResourceLoadStatisticsTest(PAL::SessionID sessionID, bool value) -> () Async
</ins><span class="cx">     SetNotifyPagesWhenTelemetryWasCaptured(PAL::SessionID sessionID, bool value) -> () Async
</span><span class="cx">     SetResourceLoadStatisticsDebugMode(PAL::SessionID sessionID, bool debugMode) -> () Async
</span><span class="cx">     SetVeryPrevalentResource(PAL::SessionID sessionID, WebCore::RegistrableDomain resourceDomain) -> () Async
</span></span></pre></div>
<a id="trunkSourceWebKitNetworkProcessNetworkSessioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/NetworkProcess/NetworkSession.cpp (242711 => 242712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/NetworkProcess/NetworkSession.cpp    2019-03-11 16:56:57 UTC (rev 242711)
+++ trunk/Source/WebKit/NetworkProcess/NetworkSession.cpp       2019-03-11 17:01:27 UTC (rev 242712)
</span><span class="lines">@@ -30,7 +30,6 @@
</span><span class="cx"> #include "NetworkProcess.h"
</span><span class="cx"> #include "NetworkProcessProxyMessages.h"
</span><span class="cx"> #include "WebProcessProxy.h"
</span><del>-#include "WebResourceLoadStatisticsStore.h"
</del><span class="cx"> #include <WebCore/AdClickAttribution.h>
</span><span class="cx"> #include <WebCore/CookieJar.h>
</span><span class="cx"> #include <WebCore/NetworkStorageSession.h>
</span><span class="lines">@@ -99,8 +98,8 @@
</span><span class="cx">     // FIXME(193728): Support ResourceLoadStatistics for ephemeral sessions, too.
</span><span class="cx">     if (m_sessionID.isEphemeral())
</span><span class="cx">         return;
</span><del>-    
-    m_resourceLoadStatistics = WebResourceLoadStatisticsStore::create(*this, m_resourceLoadStatisticsDirectory);
</del><ins>+
+    m_resourceLoadStatistics = WebResourceLoadStatisticsStore::create(*this, m_resourceLoadStatisticsDirectory, m_shouldIncludeLocalhostInResourceLoadStatistics);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void NetworkSession::notifyResourceLoadStatisticsProcessed()
</span></span></pre></div>
<a id="trunkSourceWebKitNetworkProcessNetworkSessionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/NetworkProcess/NetworkSession.h (242711 => 242712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/NetworkProcess/NetworkSession.h      2019-03-11 16:56:57 UTC (rev 242711)
+++ trunk/Source/WebKit/NetworkProcess/NetworkSession.h 2019-03-11 17:01:27 UTC (rev 242712)
</span><span class="lines">@@ -25,6 +25,7 @@
</span><span class="cx"> 
</span><span class="cx"> #pragma once
</span><span class="cx"> 
</span><ins>+#include "WebResourceLoadStatisticsStore.h"
</ins><span class="cx"> #include <WebCore/RegistrableDomain.h>
</span><span class="cx"> #include <pal/SessionID.h>
</span><span class="cx"> #include <wtf/HashSet.h>
</span><span class="lines">@@ -91,6 +92,7 @@
</span><span class="cx">     String m_resourceLoadStatisticsDirectory;
</span><span class="cx"> #if ENABLE(RESOURCE_LOAD_STATISTICS)
</span><span class="cx">     RefPtr<WebResourceLoadStatisticsStore> m_resourceLoadStatistics;
</span><ins>+    ShouldIncludeLocalhost m_shouldIncludeLocalhostInResourceLoadStatistics { ShouldIncludeLocalhost::Yes };
</ins><span class="cx"> #endif
</span><span class="cx">     UniqueRef<NetworkAdClickAttribution> m_adClickAttribution;
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebKitNetworkProcessNetworkSessionCreationParameterscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.cpp (242711 => 242712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.cpp  2019-03-11 16:56:57 UTC (rev 242711)
+++ trunk/Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.cpp     2019-03-11 17:01:27 UTC (rev 242712)
</span><span class="lines">@@ -79,6 +79,7 @@
</span><span class="cx">     encoder << resourceLoadStatisticsDirectory;
</span><span class="cx">     encoder << resourceLoadStatisticsDirectoryExtensionHandle;
</span><span class="cx">     encoder << enableResourceLoadStatistics;
</span><ins>+    encoder << shouldIncludeLocalhostInResourceLoadStatistics;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> Optional<NetworkSessionCreationParameters> NetworkSessionCreationParameters::decode(IPC::Decoder& decoder)
</span><span class="lines">@@ -172,6 +173,11 @@
</span><span class="cx">     if (!enableResourceLoadStatistics)
</span><span class="cx">         return WTF::nullopt;
</span><span class="cx"> 
</span><ins>+    Optional<bool> shouldIncludeLocalhostInResourceLoadStatistics;
+    decoder >> shouldIncludeLocalhostInResourceLoadStatistics;
+    if (!shouldIncludeLocalhostInResourceLoadStatistics)
+        return WTF::nullopt;
+
</ins><span class="cx">     return {{
</span><span class="cx">         sessionID
</span><span class="cx">         , WTFMove(*boundInterfaceIdentifier)
</span><span class="lines">@@ -196,6 +202,7 @@
</span><span class="cx">         , WTFMove(*resourceLoadStatisticsDirectory)
</span><span class="cx">         , WTFMove(*resourceLoadStatisticsDirectoryExtensionHandle)
</span><span class="cx">         , WTFMove(*enableResourceLoadStatistics)
</span><ins>+        , WTFMove(*shouldIncludeLocalhostInResourceLoadStatistics)
</ins><span class="cx">     }};
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKitNetworkProcessNetworkSessionCreationParametersh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.h (242711 => 242712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.h    2019-03-11 16:56:57 UTC (rev 242711)
+++ trunk/Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.h       2019-03-11 17:01:27 UTC (rev 242712)
</span><span class="lines">@@ -81,6 +81,7 @@
</span><span class="cx">     String resourceLoadStatisticsDirectory;
</span><span class="cx">     SandboxExtension::Handle resourceLoadStatisticsDirectoryExtensionHandle;
</span><span class="cx">     bool enableResourceLoadStatistics { false };
</span><ins>+    bool shouldIncludeLocalhostInResourceLoadStatistics { true };
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKitNetworkProcesscocoaNetworkSessionCocoamm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm (242711 => 242712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm  2019-03-11 16:56:57 UTC (rev 242711)
+++ trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm     2019-03-11 17:01:27 UTC (rev 242712)
</span><span class="lines">@@ -948,6 +948,7 @@
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(RESOURCE_LOAD_STATISTICS)
</span><span class="cx">     m_resourceLoadStatisticsDirectory = parameters.resourceLoadStatisticsDirectory;
</span><ins>+    m_shouldIncludeLocalhostInResourceLoadStatistics = parameters.shouldIncludeLocalhostInResourceLoadStatistics ? ShouldIncludeLocalhost::Yes : ShouldIncludeLocalhost::No;
</ins><span class="cx">     setResourceLoadStatisticsEnabled(parameters.enableResourceLoadStatistics);
</span><span class="cx"> #endif
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessAPICWKWebsiteDataStoreRefcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.cpp (242711 => 242712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.cpp    2019-03-11 16:56:57 UTC (rev 242711)
+++ trunk/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.cpp       2019-03-11 17:01:27 UTC (rev 242712)
</span><span class="lines">@@ -336,6 +336,17 @@
</span><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void WKWebsiteDataStoreSetStatisticsIsRunningTest(WKWebsiteDataStoreRef dataStoreRef, bool value, void* context, WKWebsiteDataStoreSetStatisticsIsRunningTestFunction callback)
+{
+#if ENABLE(RESOURCE_LOAD_STATISTICS)
+    WebKit::toImpl(dataStoreRef)->websiteDataStore().setIsRunningResourceLoadStatisticsTest(value, [context, callback] {
+        callback(context);
+    });
+#else
+    callback(context);
+#endif
+}
+
</ins><span class="cx"> void WKWebsiteDataStoreSetStatisticsShouldClassifyResourcesBeforeDataRecordsRemoval(WKWebsiteDataStoreRef dataStoreRef, bool value)
</span><span class="cx"> {
</span><span class="cx"> #if ENABLE(RESOURCE_LOAD_STATISTICS)
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessAPICWKWebsiteDataStoreRefh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.h (242711 => 242712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.h      2019-03-11 16:56:57 UTC (rev 242711)
+++ trunk/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.h 2019-03-11 17:01:27 UTC (rev 242712)
</span><span class="lines">@@ -79,6 +79,8 @@
</span><span class="cx"> WK_EXPORT void WKWebsiteDataStoreStatisticsUpdateCookieBlocking(WKWebsiteDataStoreRef dataStoreRef, void* context, WKWebsiteDataStoreStatisticsUpdateCookieBlockingFunction completionHandler);
</span><span class="cx"> WK_EXPORT void WKWebsiteDataStoreStatisticsSubmitTelemetry(WKWebsiteDataStoreRef dataStoreRef);
</span><span class="cx"> WK_EXPORT void WKWebsiteDataStoreSetStatisticsNotifyPagesWhenDataRecordsWereScanned(WKWebsiteDataStoreRef dataStoreRef, bool value);
</span><ins>+typedef void (*WKWebsiteDataStoreSetStatisticsIsRunningTestFunction)(void* functionContext);
+WK_EXPORT void WKWebsiteDataStoreSetStatisticsIsRunningTest(WKWebsiteDataStoreRef dataStoreRef, bool value, void* context, WKWebsiteDataStoreSetStatisticsIsRunningTestFunction callback);
</ins><span class="cx"> WK_EXPORT void WKWebsiteDataStoreSetStatisticsShouldClassifyResourcesBeforeDataRecordsRemoval(WKWebsiteDataStoreRef dataStoreRef, bool value);
</span><span class="cx"> WK_EXPORT void WKWebsiteDataStoreSetStatisticsNotifyPagesWhenTelemetryWasCaptured(WKWebsiteDataStoreRef dataStoreRef, bool value);
</span><span class="cx"> WK_EXPORT void WKWebsiteDataStoreSetStatisticsMinimumTimeBetweenDataRecordsRemoval(WKWebsiteDataStoreRef dataStoreRef, double seconds);
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessNetworkNetworkProcessProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp (242711 => 242712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp    2019-03-11 16:56:57 UTC (rev 242711)
+++ trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp       2019-03-11 17:01:27 UTC (rev 242712)
</span><span class="lines">@@ -594,6 +594,16 @@
</span><span class="cx">     sendWithAsyncReply(Messages::NetworkProcess::SetNotifyPagesWhenDataRecordsWereScanned(sessionID, value), WTFMove(completionHandler));
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void NetworkProcessProxy::setIsRunningResourceLoadStatisticsTest(PAL::SessionID sessionID, bool value, CompletionHandler<void()>&& completionHandler)
+{
+    if (!canSendMessage()) {
+        completionHandler();
+        return;
+    }
+    
+    sendWithAsyncReply(Messages::NetworkProcess::SetIsRunningResourceLoadStatisticsTest(sessionID, value), WTFMove(completionHandler));
+}
+
</ins><span class="cx"> void NetworkProcessProxy::setSubframeUnderTopFrameDomain(PAL::SessionID sessionID, const RegistrableDomain& subFrameDomain, const RegistrableDomain& topFrameDomain, CompletionHandler<void()>&& completionHandler)
</span><span class="cx"> {
</span><span class="cx">     if (!canSendMessage()) {
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessNetworkNetworkProcessProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h (242711 => 242712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h      2019-03-11 16:56:57 UTC (rev 242711)
+++ trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h 2019-03-11 17:01:27 UTC (rev 242712)
</span><span class="lines">@@ -113,6 +113,7 @@
</span><span class="cx">     void setCacheMaxAgeCap(PAL::SessionID, Seconds, CompletionHandler<void()>&&);
</span><span class="cx">     void setGrandfathered(PAL::SessionID, const RegistrableDomain&, bool isGrandfathered, CompletionHandler<void()>&&);
</span><span class="cx">     void setNotifyPagesWhenDataRecordsWereScanned(PAL::SessionID, bool, CompletionHandler<void()>&&);
</span><ins>+    void setIsRunningResourceLoadStatisticsTest(PAL::SessionID, bool, CompletionHandler<void()>&&);
</ins><span class="cx">     void setNotifyPagesWhenTelemetryWasCaptured(PAL::SessionID, bool, CompletionHandler<void()>&&);
</span><span class="cx">     void setSubframeUnderTopFrameDomain(PAL::SessionID, const SubFrameDomain&, const TopFrameDomain&, CompletionHandler<void()>&&);
</span><span class="cx">     void setSubresourceUnderTopFrameDomain(PAL::SessionID, const SubResourceDomain&, const TopFrameDomain&, CompletionHandler<void()>&&);
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessWebProcessPoolcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/WebProcessPool.cpp (242711 => 242712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/WebProcessPool.cpp 2019-03-11 16:56:57 UTC (rev 242711)
+++ trunk/Source/WebKit/UIProcess/WebProcessPool.cpp    2019-03-11 17:01:27 UTC (rev 242712)
</span><span class="lines">@@ -574,12 +574,17 @@
</span><span class="cx">     SandboxExtension::createHandleForReadWriteDirectory(parameters.defaultDataStoreParameters.networkSessionParameters.resourceLoadStatisticsDirectory, parameters.defaultDataStoreParameters.networkSessionParameters.resourceLoadStatisticsDirectoryExtensionHandle);
</span><span class="cx"> 
</span><span class="cx">     bool enableResourceLoadStatistics = false;
</span><del>-    if (withWebsiteDataStore)
</del><ins>+    bool shouldIncludeLocalhost = true;
+    if (withWebsiteDataStore) {
</ins><span class="cx">         enableResourceLoadStatistics = withWebsiteDataStore->resourceLoadStatisticsEnabled();
</span><del>-    else if (m_websiteDataStore)
</del><ins>+        shouldIncludeLocalhost = withWebsiteDataStore->parameters().networkSessionParameters.shouldIncludeLocalhostInResourceLoadStatistics;
+    } else if (m_websiteDataStore) {
</ins><span class="cx">         enableResourceLoadStatistics = m_websiteDataStore->resourceLoadStatisticsEnabled();
</span><ins>+        shouldIncludeLocalhost = m_websiteDataStore->websiteDataStore().parameters().networkSessionParameters.shouldIncludeLocalhostInResourceLoadStatistics;
+    }
</ins><span class="cx"> 
</span><span class="cx">     parameters.defaultDataStoreParameters.networkSessionParameters.enableResourceLoadStatistics = enableResourceLoadStatistics;
</span><ins>+    parameters.defaultDataStoreParameters.networkSessionParameters.shouldIncludeLocalhostInResourceLoadStatistics = shouldIncludeLocalhost;
</ins><span class="cx"> 
</span><span class="cx">     // Add any platform specific parameters
</span><span class="cx">     platformInitializeNetworkProcess(parameters);
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessWebsiteDataCocoaWebsiteDataStoreCocoamm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm (242711 => 242712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm 2019-03-11 16:56:57 UTC (rev 242711)
+++ trunk/Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm    2019-03-11 17:01:27 UTC (rev 242712)
</span><span class="lines">@@ -102,7 +102,8 @@
</span><span class="cx">         WTFMove(httpsProxy),
</span><span class="cx">         WTFMove(resourceLoadStatisticsDirectory),
</span><span class="cx">         WTFMove(resourceLoadStatisticsDirectoryHandle),
</span><del>-        false
</del><ins>+        false,
+        isSafari
</ins><span class="cx">     };
</span><span class="cx">     finalizeApplicationIdentifiers();
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessWebsiteDataWebsiteDataStorecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp (242711 => 242712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp   2019-03-11 16:56:57 UTC (rev 242711)
+++ trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp      2019-03-11 17:01:27 UTC (rev 242712)
</span><span class="lines">@@ -1608,6 +1608,14 @@
</span><span class="cx">         processPool->ensureNetworkProcess().setNotifyPagesWhenDataRecordsWereScanned(m_sessionID, value, [processPool, callbackAggregator = callbackAggregator.copyRef()] { });
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void WebsiteDataStore::setIsRunningResourceLoadStatisticsTest(bool value, CompletionHandler<void()>&& completionHandler)
+{
+    auto callbackAggregator = CallbackAggregator::create(WTFMove(completionHandler));
+    
+    for (auto& processPool : processPools())
+        processPool->ensureNetworkProcess().setIsRunningResourceLoadStatisticsTest(m_sessionID, value, [processPool, callbackAggregator = callbackAggregator.copyRef()] { });
+}
+
</ins><span class="cx"> void WebsiteDataStore::setNotifyPagesWhenTelemetryWasCaptured(bool value, CompletionHandler<void()>&& completionHandler)
</span><span class="cx"> {
</span><span class="cx">     auto callbackAggregator = CallbackAggregator::create(WTFMove(completionHandler));
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessWebsiteDataWebsiteDataStoreh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h (242711 => 242712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h     2019-03-11 16:56:57 UTC (rev 242711)
+++ trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h        2019-03-11 17:01:27 UTC (rev 242712)
</span><span class="lines">@@ -147,6 +147,7 @@
</span><span class="cx">     void setGrandfatheringTime(Seconds, CompletionHandler<void()>&&);
</span><span class="cx">     void setLastSeen(const URL&, Seconds, CompletionHandler<void()>&&);
</span><span class="cx">     void setNotifyPagesWhenDataRecordsWereScanned(bool, CompletionHandler<void()>&&);
</span><ins>+    void setIsRunningResourceLoadStatisticsTest(bool, CompletionHandler<void()>&&);
</ins><span class="cx">     void setPruneEntriesDownTo(size_t, CompletionHandler<void()>&&);
</span><span class="cx">     void setSubframeUnderTopFrameDomain(const URL& subframe, const URL& topFrame, CompletionHandler<void()>&&);
</span><span class="cx">     void setSubresourceUnderTopFrameDomain(const URL& subresource, const URL& topFrame, CompletionHandler<void()>&&);
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (242711 => 242712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog    2019-03-11 16:56:57 UTC (rev 242711)
+++ trunk/Tools/ChangeLog       2019-03-11 17:01:27 UTC (rev 242712)
</span><span class="lines">@@ -1,3 +1,28 @@
</span><ins>+2019-03-11  John Wilander  <wilander@apple.com>
+
+        Resource Load Statistics: Make it possible exclude localhost from classification
+        https://bugs.webkit.org/show_bug.cgi?id=195474
+        <rdar://problem/47520577>
+
+        Reviewed by Brent Fulgham.
+
+        This patch allows for localhost to be excluded from classification and
+        treatment as a prevalent resource.
+
+        The WebKit Tools change adds a new function called
+        testRunner.setStatisticsIsRunningTest() which can be used to control this
+        behavior.
+
+        * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
+        * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
+        (WTR::TestRunner::setStatisticsIsRunningTest):
+        * WebKitTestRunner/InjectedBundle/TestRunner.h:
+        * WebKitTestRunner/TestController.cpp:
+        (WTR::TestController::setStatisticsIsRunningTest):
+        * WebKitTestRunner/TestController.h:
+        * WebKitTestRunner/TestInvocation.cpp:
+        (WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle):
+
</ins><span class="cx"> 2019-03-11  Aakash Jain  <aakash_jain@apple.com>
</span><span class="cx"> 
</span><span class="cx">         [ews-build] Disable waterfall and console view for ews-build.webkit.org
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerInjectedBundleBindingsTestRunneridl"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl (242711 => 242712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl      2019-03-11 16:56:57 UTC (rev 242711)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl 2019-03-11 17:01:27 UTC (rev 242712)
</span><span class="lines">@@ -309,6 +309,7 @@
</span><span class="cx">     void statisticsUpdateCookieBlocking(object completionHandler);
</span><span class="cx">     void statisticsSubmitTelemetry();
</span><span class="cx">     void setStatisticsNotifyPagesWhenDataRecordsWereScanned(boolean value);
</span><ins>+    void setStatisticsIsRunningTest(boolean value);
</ins><span class="cx">     void setStatisticsShouldClassifyResourcesBeforeDataRecordsRemoval(boolean value);
</span><span class="cx">     void setStatisticsNotifyPagesWhenTelemetryWasCaptured(boolean value);
</span><span class="cx">     void setStatisticsMinimumTimeBetweenDataRecordsRemoval(double seconds);
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerInjectedBundleTestRunnercpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp (242711 => 242712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp       2019-03-11 16:56:57 UTC (rev 242711)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp  2019-03-11 17:01:27 UTC (rev 242712)
</span><span class="lines">@@ -1947,6 +1947,13 @@
</span><span class="cx">     WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), messageBody.get(), nullptr);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void TestRunner::setStatisticsIsRunningTest(bool value)
+{
+    WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("StatisticsSetIsRunningTest"));
+    WKRetainPtr<WKBooleanRef> messageBody(AdoptWK, WKBooleanCreate(value));
+    WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), messageBody.get(), nullptr);
+}
+
</ins><span class="cx"> void TestRunner::setStatisticsShouldClassifyResourcesBeforeDataRecordsRemoval(bool value)
</span><span class="cx"> {
</span><span class="cx">     WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("StatisticsShouldClassifyResourcesBeforeDataRecordsRemoval"));
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerInjectedBundleTestRunnerh"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h (242711 => 242712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h 2019-03-11 16:56:57 UTC (rev 242711)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h    2019-03-11 17:01:27 UTC (rev 242712)
</span><span class="lines">@@ -418,6 +418,7 @@
</span><span class="cx">     void setStatisticsTopFrameUniqueRedirectFrom(JSStringRef hostName, JSStringRef hostNameRedirectedFrom);
</span><span class="cx">     void setStatisticsTimeToLiveUserInteraction(double seconds);
</span><span class="cx">     void setStatisticsNotifyPagesWhenDataRecordsWereScanned(bool);
</span><ins>+    void setStatisticsIsRunningTest(bool);
</ins><span class="cx">     void setStatisticsShouldClassifyResourcesBeforeDataRecordsRemoval(bool);
</span><span class="cx">     void setStatisticsNotifyPagesWhenTelemetryWasCaptured(bool value);
</span><span class="cx">     void setStatisticsMinimumTimeBetweenDataRecordsRemoval(double);
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerTestControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (242711 => 242712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/TestController.cpp  2019-03-11 16:56:57 UTC (rev 242711)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp     2019-03-11 17:01:27 UTC (rev 242712)
</span><span class="lines">@@ -3288,6 +3288,14 @@
</span><span class="cx">     WKWebsiteDataStoreSetStatisticsNotifyPagesWhenDataRecordsWereScanned(dataStore, value);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void TestController::setStatisticsIsRunningTest(bool value)
+{
+    auto* dataStore = WKContextGetWebsiteDataStore(platformContext());
+    ResourceStatisticsCallbackContext context(*this);
+    WKWebsiteDataStoreSetStatisticsIsRunningTest(dataStore, value, &context, resourceStatisticsVoidResultCallback);
+    runUntil(context.done, noTimeout);
+}
+
</ins><span class="cx"> void TestController::setStatisticsShouldClassifyResourcesBeforeDataRecordsRemoval(bool value)
</span><span class="cx"> {
</span><span class="cx">     auto* dataStore = WKContextGetWebsiteDataStore(platformContext());
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerTestControllerh"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/TestController.h (242711 => 242712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/TestController.h    2019-03-11 16:56:57 UTC (rev 242711)
+++ trunk/Tools/WebKitTestRunner/TestController.h       2019-03-11 17:01:27 UTC (rev 242712)
</span><span class="lines">@@ -230,6 +230,7 @@
</span><span class="cx">     void statisticsUpdateCookieBlocking();
</span><span class="cx">     void statisticsSubmitTelemetry();
</span><span class="cx">     void setStatisticsNotifyPagesWhenDataRecordsWereScanned(bool);
</span><ins>+    void setStatisticsIsRunningTest(bool);
</ins><span class="cx">     void setStatisticsShouldClassifyResourcesBeforeDataRecordsRemoval(bool);
</span><span class="cx">     void setStatisticsNotifyPagesWhenTelemetryWasCaptured(bool value);
</span><span class="cx">     void setStatisticsMinimumTimeBetweenDataRecordsRemoval(double);
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerTestInvocationcpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/TestInvocation.cpp (242711 => 242712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/TestInvocation.cpp  2019-03-11 16:56:57 UTC (rev 242711)
+++ trunk/Tools/WebKitTestRunner/TestInvocation.cpp     2019-03-11 17:01:27 UTC (rev 242712)
</span><span class="lines">@@ -1333,6 +1333,13 @@
</span><span class="cx">         return nullptr;
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    if (WKStringIsEqualToUTF8CString(messageName, "StatisticsSetIsRunningTest")) {
+        ASSERT(WKGetTypeID(messageBody) == WKBooleanGetTypeID());
+        WKBooleanRef value = static_cast<WKBooleanRef>(messageBody);
+        TestController::singleton().setStatisticsIsRunningTest(WKBooleanGetValue(value));
+        return nullptr;
+    }
+    
</ins><span class="cx">     if (WKStringIsEqualToUTF8CString(messageName, "StatisticsNotifyPagesWhenTelemetryWasCaptured")) {
</span><span class="cx">         ASSERT(WKGetTypeID(messageBody) == WKBooleanGetTypeID());
</span><span class="cx">         WKBooleanRef value = static_cast<WKBooleanRef>(messageBody);
</span></span></pre>
</div>
</div>

</body>
</html>