Changeset 223565 in webkit
- Timestamp:
- Oct 17, 2017 11:57:21 AM (7 years ago)
- Location:
- trunk
- Files:
-
- 6 added
- 29 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r223563 r223565 1 2017-10-17 John Wilander <wilander@apple.com> 2 3 Add and remove cookie partition accordingly in intermediary redirect requests 4 https://bugs.webkit.org/show_bug.cgi?id=178369 5 <rdar://problem/34467603> 6 7 Reviewed by Brent Fulgham. 8 9 This patch adds two new tests, relevant for the code change. 10 Also makes changes to existing tests to increase speed and 11 reliability. 12 13 * http/tests/resourceLoadStatistics/add-partitioning-to-redirect-expected.txt: Added. 14 * http/tests/resourceLoadStatistics/add-partitioning-to-redirect.html: Added. 15 * http/tests/resourceLoadStatistics/non-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html: 16 * http/tests/resourceLoadStatistics/non-sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html: 17 * http/tests/resourceLoadStatistics/non-sandboxed-nesting-iframe-with-non-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html: 18 * http/tests/resourceLoadStatistics/non-sandboxed-nesting-iframe-with-non-sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html: 19 * http/tests/resourceLoadStatistics/non-sandboxed-nesting-iframe-with-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html: 20 * http/tests/resourceLoadStatistics/non-sandboxed-nesting-iframe-with-sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html: 21 * http/tests/resourceLoadStatistics/remove-partitioning-from-redirect-expected.txt: Added. 22 * http/tests/resourceLoadStatistics/remove-partitioning-from-redirect.html: Added. 23 * http/tests/resourceLoadStatistics/resources/get-cookies.php: Added. 24 * http/tests/resourceLoadStatistics/resources/redirect.php: 25 * http/tests/resourceLoadStatistics/resources/set-cookie.php: Added. 26 * http/tests/resourceLoadStatistics/sandboxed-iframe-redirect-ip-to-localhost-to-ip.html: 27 * http/tests/resourceLoadStatistics/sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html: 28 * http/tests/resourceLoadStatistics/sandboxed-nesting-iframe-with-non-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html: 29 * http/tests/resourceLoadStatistics/sandboxed-nesting-iframe-with-non-sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html: 30 * http/tests/resourceLoadStatistics/sandboxed-nesting-iframe-with-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html: 31 * http/tests/resourceLoadStatistics/sandboxed-nesting-iframe-with-sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html: 32 * platform/ios/TestExpectations: 33 The two new tests are marked [ Pass ]. 34 * platform/mac-wk2/TestExpectations: 35 The two new tests are marked [ Pass ]. 36 * platform/wk2/TestExpectations: 37 The two new tests are marked [ Skip ] because they require cookie partitioning. 38 1 39 2017-10-17 Ryan Haddad <ryanhaddad@apple.com> 2 40 -
trunk/LayoutTests/http/tests/resourceLoadStatistics/non-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html
r223253 r223565 3 3 <head> 4 4 <script src="/js-test-resources/js-test.js"></script> 5 <script src="/js-test-resources/ui-helper.js"></script>6 5 <script> 7 6 description("Tests that redirects for a non-sandboxed iframe get counted properly."); 8 7 jsTestIsAsync = true; 9 8 window.addEventListener("message", receiveMessage, false); 9 10 function setEnableFeature(enable) { 11 if (!enable) 12 testRunner.statisticsResetToConsistentState(); 13 internals.setResourceLoadStatisticsEnabled(enable); 14 testRunner.setCookieStoragePartitioningEnabled(enable); 15 } 16 17 function finishTest() { 18 setEnableFeature(false); 19 finishJSTest(); 20 } 21 10 22 if (testRunner) { 23 setEnableFeature(true); 11 24 testRunner.setStatisticsNotifyPagesWhenDataRecordsWereScanned(true); 12 25 testRunner.installStatisticsDidScanDataRecordsCallback(checkStats); 13 26 } 14 27 15 var testPhasesDone = 0; 28 var lastPageInRedirectChainLoaded = false; 29 var statsChecked = false; 16 30 17 31 function receiveMessage(event) { … … 21 35 } else 22 36 testFailed("Received a message from an unexpected origin: " + event.origin); 23 ++testPhasesDone; 24 if (testPhasesDone === 2) 25 finishJSTest(); 37 38 lastPageInRedirectChainLoaded = true; 39 if (statsChecked) 40 finishTest(); 41 else 42 testRunner.statisticsNotifyObserver(); 26 43 } 27 44 … … 30 47 shouldBeTrue('testRunner.isStatisticsRegisteredAsRedirectingTo("http://localhost", "http://127.0.0.1")'); 31 48 shouldBeTrue('testRunner.isStatisticsRegisteredAsRedirectingTo("http://127.0.0.1", "http://localhost")'); 32 ++testPhasesDone; 33 if (testPhasesDone === 2) 34 finishJSTest(); 49 50 statsChecked = true; 51 if (lastPageInRedirectChainLoaded) 52 finishTest(); 35 53 } 36 54 </script> 37 55 </head> 38 56 <body> 39 <iframe src="http://127.0.0.1:8000/resourceLoadStatistics/resources/redirect.php /?redirectTo=http://localhost:8000/resourceLoadStatistics/resources/redirect.php/?redirectTo=http://127.0.0.1:8000/resourceLoadStatistics/resources/iframe-report-back-loaded.html">57 <iframe src="http://127.0.0.1:8000/resourceLoadStatistics/resources/redirect.php?redirectTo=http://localhost:8000/resourceLoadStatistics/resources/redirect.php/?redirectTo=http://127.0.0.1:8000/resourceLoadStatistics/resources/iframe-report-back-loaded.html"> 40 58 </iframe> 41 59 </body> -
trunk/LayoutTests/http/tests/resourceLoadStatistics/non-sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html
r223253 r223565 3 3 <head> 4 4 <script src="/js-test-resources/js-test.js"></script> 5 <script src="/js-test-resources/ui-helper.js"></script>6 5 <script> 7 6 description("Tests that redirects for a non-sandboxed iframe get counted properly."); 8 7 jsTestIsAsync = true; 9 8 window.addEventListener("message", receiveMessage, false); 9 10 function setEnableFeature(enable) { 11 if (!enable) 12 testRunner.statisticsResetToConsistentState(); 13 internals.setResourceLoadStatisticsEnabled(enable); 14 testRunner.setCookieStoragePartitioningEnabled(enable); 15 } 16 17 function finishTest() { 18 setEnableFeature(false); 19 finishJSTest(); 20 } 21 10 22 if (testRunner) { 23 setEnableFeature(true); 11 24 testRunner.setStatisticsNotifyPagesWhenDataRecordsWereScanned(true); 12 25 testRunner.installStatisticsDidScanDataRecordsCallback(checkStats); 13 26 } 14 27 15 var testPhasesDone = 0; 28 var lastPageInRedirectChainLoaded = false; 29 var statsChecked = false; 16 30 17 31 function receiveMessage(event) { … … 21 35 } else 22 36 testFailed("Received a message from an unexpected origin: " + event.origin); 23 ++testPhasesDone; 24 if (testPhasesDone === 2) 25 finishJSTest(); 37 38 lastPageInRedirectChainLoaded = true; 39 if (statsChecked) 40 finishTest(); 41 else 42 testRunner.statisticsNotifyObserver(); 26 43 } 27 44 … … 30 47 shouldBeTrue('testRunner.isStatisticsRegisteredAsRedirectingTo("http://localhost", "http://127.0.0.1")'); 31 48 shouldBeTrue('testRunner.isStatisticsRegisteredAsRedirectingTo("http://127.0.0.1", "http://localhost")'); 32 ++testPhasesDone; 33 if (testPhasesDone === 2) 34 finishJSTest(); 49 50 statsChecked = true; 51 if (lastPageInRedirectChainLoaded) 52 finishTest(); 35 53 } 36 54 </script> -
trunk/LayoutTests/http/tests/resourceLoadStatistics/non-sandboxed-nesting-iframe-with-non-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html
r223253 r223565 3 3 <head> 4 4 <script src="/js-test-resources/js-test.js"></script> 5 <script src="/js-test-resources/ui-helper.js"></script>6 5 <script> 7 6 description("Tests that redirects for a non-sandboxed iframe nested in a non-sandboxed iframe get counted properly."); 8 7 jsTestIsAsync = true; 9 8 window.addEventListener("message", receiveMessage, false); 9 10 function setEnableFeature(enable) { 11 if (!enable) 12 testRunner.statisticsResetToConsistentState(); 13 internals.setResourceLoadStatisticsEnabled(enable); 14 testRunner.setCookieStoragePartitioningEnabled(enable); 15 } 16 17 function finishTest() { 18 setEnableFeature(false); 19 finishJSTest(); 20 } 21 10 22 if (testRunner) { 23 setEnableFeature(true); 11 24 testRunner.setStatisticsNotifyPagesWhenDataRecordsWereScanned(true); 12 25 testRunner.installStatisticsDidScanDataRecordsCallback(checkStats); 13 26 } 14 27 15 var testPhasesDone = 0; 28 var lastPageInRedirectChainLoaded = false; 29 var statsChecked = false; 16 30 17 31 function receiveMessage(event) { … … 21 35 } else 22 36 testFailed("Received a message from an unexpected origin: " + event.origin); 23 ++testPhasesDone; 24 if (testPhasesDone === 2) 25 finishJSTest(); 37 38 lastPageInRedirectChainLoaded = true; 39 if (statsChecked) 40 finishTest(); 41 else 42 testRunner.statisticsNotifyObserver(); 26 43 } 27 44 … … 30 47 shouldBeTrue('testRunner.isStatisticsRegisteredAsRedirectingTo("http://localhost", "http://127.0.0.1")'); 31 48 shouldBeTrue('testRunner.isStatisticsRegisteredAsRedirectingTo("http://127.0.0.1", "http://localhost")'); 32 ++testPhasesDone; 33 if (testPhasesDone === 2) 34 finishJSTest(); 49 50 statsChecked = true; 51 if (lastPageInRedirectChainLoaded) 52 finishTest(); 35 53 } 36 54 </script> -
trunk/LayoutTests/http/tests/resourceLoadStatistics/non-sandboxed-nesting-iframe-with-non-sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html
r223253 r223565 3 3 <head> 4 4 <script src="/js-test-resources/js-test.js"></script> 5 <script src="/js-test-resources/ui-helper.js"></script>6 5 <script> 7 6 description("Tests that redirects for a non-sandboxed iframe nested in a non-sandboxed iframe get counted properly."); 8 7 jsTestIsAsync = true; 9 8 window.addEventListener("message", receiveMessage, false); 9 10 function setEnableFeature(enable) { 11 if (!enable) 12 testRunner.statisticsResetToConsistentState(); 13 internals.setResourceLoadStatisticsEnabled(enable); 14 testRunner.setCookieStoragePartitioningEnabled(enable); 15 } 16 17 function finishTest() { 18 setEnableFeature(false); 19 finishJSTest(); 20 } 21 10 22 if (testRunner) { 23 setEnableFeature(true); 11 24 testRunner.setStatisticsNotifyPagesWhenDataRecordsWereScanned(true); 12 25 testRunner.installStatisticsDidScanDataRecordsCallback(checkStats); 13 26 } 14 27 15 var testPhasesDone = 0; 28 var lastPageInRedirectChainLoaded = false; 29 var statsChecked = false; 16 30 17 31 function receiveMessage(event) { … … 21 35 } else 22 36 testFailed("Received a message from an unexpected origin: " + event.origin); 23 ++testPhasesDone; 24 if (testPhasesDone === 2) 25 finishJSTest(); 37 38 lastPageInRedirectChainLoaded = true; 39 if (statsChecked) 40 finishTest(); 41 else 42 testRunner.statisticsNotifyObserver(); 26 43 } 27 44 … … 30 47 shouldBeTrue('testRunner.isStatisticsRegisteredAsRedirectingTo("http://localhost", "http://127.0.0.1")'); 31 48 shouldBeTrue('testRunner.isStatisticsRegisteredAsRedirectingTo("http://127.0.0.1", "http://localhost")'); 32 ++testPhasesDone; 33 if (testPhasesDone === 2) 34 finishJSTest(); 49 50 statsChecked = true; 51 if (lastPageInRedirectChainLoaded) 52 finishTest(); 35 53 } 36 54 </script> -
trunk/LayoutTests/http/tests/resourceLoadStatistics/non-sandboxed-nesting-iframe-with-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html
r223253 r223565 3 3 <head> 4 4 <script src="/js-test-resources/js-test.js"></script> 5 <script src="/js-test-resources/ui-helper.js"></script>6 5 <script> 7 6 description("Tests that redirects for a sandboxed iframe nested in a non-sandboxed iframe get counted properly."); 8 7 jsTestIsAsync = true; 9 8 window.addEventListener("message", receiveMessage, false); 9 10 function setEnableFeature(enable) { 11 if (!enable) 12 testRunner.statisticsResetToConsistentState(); 13 internals.setResourceLoadStatisticsEnabled(enable); 14 testRunner.setCookieStoragePartitioningEnabled(enable); 15 } 16 17 function finishTest() { 18 setEnableFeature(false); 19 finishJSTest(); 20 } 21 10 22 if (testRunner) { 23 setEnableFeature(true); 11 24 testRunner.setStatisticsNotifyPagesWhenDataRecordsWereScanned(true); 12 25 testRunner.installStatisticsDidScanDataRecordsCallback(checkStats); 13 26 } 14 27 15 var testPhasesDone = 0; 28 var lastPageInRedirectChainLoaded = false; 29 var statsChecked = false; 16 30 17 31 function receiveMessage(event) { … … 21 35 } else 22 36 testFailed("Received a message from an unexpected origin: " + event.origin); 23 ++testPhasesDone; 24 if (testPhasesDone === 2) 25 finishJSTest(); 37 38 lastPageInRedirectChainLoaded = true; 39 if (statsChecked) 40 finishTest(); 41 else 42 testRunner.statisticsNotifyObserver(); 26 43 } 27 44 … … 30 47 shouldBeTrue('testRunner.isStatisticsRegisteredAsRedirectingTo("http://localhost", "http://127.0.0.1")'); 31 48 shouldBeTrue('testRunner.isStatisticsRegisteredAsRedirectingTo("http://127.0.0.1", "http://localhost")'); 32 ++testPhasesDone; 33 if (testPhasesDone === 2) 34 finishJSTest(); 49 50 statsChecked = true; 51 if (lastPageInRedirectChainLoaded) 52 finishTest(); 35 53 } 36 54 </script> -
trunk/LayoutTests/http/tests/resourceLoadStatistics/non-sandboxed-nesting-iframe-with-sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html
r223253 r223565 3 3 <head> 4 4 <script src="/js-test-resources/js-test.js"></script> 5 <script src="/js-test-resources/ui-helper.js"></script>6 5 <script> 7 6 description("Tests that redirects for a sandboxed iframe nested in a non-sandboxed iframe get counted properly."); 8 7 jsTestIsAsync = true; 9 8 window.addEventListener("message", receiveMessage, false); 9 10 function setEnableFeature(enable) { 11 if (!enable) 12 testRunner.statisticsResetToConsistentState(); 13 internals.setResourceLoadStatisticsEnabled(enable); 14 testRunner.setCookieStoragePartitioningEnabled(enable); 15 } 16 17 function finishTest() { 18 setEnableFeature(false); 19 finishJSTest(); 20 } 21 10 22 if (testRunner) { 23 setEnableFeature(true); 11 24 testRunner.setStatisticsNotifyPagesWhenDataRecordsWereScanned(true); 12 25 testRunner.installStatisticsDidScanDataRecordsCallback(checkStats); 13 26 } 14 27 15 var testPhasesDone = 0; 28 var lastPageInRedirectChainLoaded = false; 29 var statsChecked = false; 16 30 17 31 function receiveMessage(event) { … … 21 35 } else 22 36 testFailed("Received a message from an unexpected origin: " + event.origin); 23 ++testPhasesDone; 24 if (testPhasesDone === 2) 25 finishJSTest(); 37 38 lastPageInRedirectChainLoaded = true; 39 if (statsChecked) 40 finishTest(); 41 else 42 testRunner.statisticsNotifyObserver(); 26 43 } 27 44 … … 30 47 shouldBeTrue('testRunner.isStatisticsRegisteredAsRedirectingTo("http://localhost", "http://127.0.0.1")'); 31 48 shouldBeTrue('testRunner.isStatisticsRegisteredAsRedirectingTo("http://127.0.0.1", "http://localhost")'); 32 ++testPhasesDone; 33 if (testPhasesDone === 2) 34 finishJSTest(); 49 50 statsChecked = true; 51 if (lastPageInRedirectChainLoaded) 52 finishTest(); 35 53 } 36 54 </script> -
trunk/LayoutTests/http/tests/resourceLoadStatistics/resources/redirect.php
r223253 r223565 1 1 <?php 2 header('Location: ' . $_GET["redirectTo"]); 2 $redirectURL = $_GET["redirectTo"]; 3 if (isset($_GET["name2"])) { 4 $redirectURL = $redirectURL . "&name2=" . $_GET["name2"]; 5 } 6 if (isset($_GET["name3"])) { 7 $redirectURL = $redirectURL . "&name3=" . $_GET["name3"]; 8 } 9 if (isset($_GET["message"])) { 10 $redirectURL = $redirectURL . "&message=" . $_GET["message"]; 11 } 12 header('Location: ' . $redirectURL); 3 13 die(); 4 14 ?> -
trunk/LayoutTests/http/tests/resourceLoadStatistics/sandboxed-iframe-redirect-ip-to-localhost-to-ip.html
r223253 r223565 3 3 <head> 4 4 <script src="/js-test-resources/js-test.js"></script> 5 <script src="/js-test-resources/ui-helper.js"></script>6 5 <script> 7 6 description("Tests that redirects for sandboxed iframes get counted properly."); 8 7 jsTestIsAsync = true; 9 8 window.addEventListener("message", receiveMessage, false); 9 10 function setEnableFeature(enable) { 11 if (!enable) 12 testRunner.statisticsResetToConsistentState(); 13 internals.setResourceLoadStatisticsEnabled(enable); 14 testRunner.setCookieStoragePartitioningEnabled(enable); 15 } 16 17 function finishTest() { 18 setEnableFeature(false); 19 finishJSTest(); 20 } 21 10 22 if (testRunner) { 23 setEnableFeature(true); 11 24 testRunner.setStatisticsNotifyPagesWhenDataRecordsWereScanned(true); 12 25 testRunner.installStatisticsDidScanDataRecordsCallback(checkStats); 13 26 } 14 27 15 var testPhasesDone = 0; 28 var lastPageInRedirectChainLoaded = false; 29 var statsChecked = false; 16 30 17 31 function receiveMessage(event) { … … 21 35 } else 22 36 testFailed("Received a message from an unexpected origin: " + event.origin); 23 ++testPhasesDone; 24 if (testPhasesDone === 2) 25 finishJSTest(); 37 38 lastPageInRedirectChainLoaded = true; 39 if (statsChecked) 40 finishTest(); 41 else 42 testRunner.statisticsNotifyObserver(); 26 43 } 27 44 … … 30 47 shouldBeTrue('testRunner.isStatisticsRegisteredAsRedirectingTo("http://localhost", "http://127.0.0.1")'); 31 48 shouldBeTrue('testRunner.isStatisticsRegisteredAsRedirectingTo("http://127.0.0.1", "http://localhost")'); 32 ++testPhasesDone; 33 if (testPhasesDone === 2) 34 finishJSTest(); 49 50 statsChecked = true; 51 if (lastPageInRedirectChainLoaded) 52 finishTest(); 35 53 } 36 54 </script> -
trunk/LayoutTests/http/tests/resourceLoadStatistics/sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html
r223253 r223565 3 3 <head> 4 4 <script src="/js-test-resources/js-test.js"></script> 5 <script src="/js-test-resources/ui-helper.js"></script>6 5 <script> 7 6 description("Tests that redirects for sandboxed iframes get counted properly."); 8 7 jsTestIsAsync = true; 9 8 window.addEventListener("message", receiveMessage, false); 9 10 function setEnableFeature(enable) { 11 if (!enable) 12 testRunner.statisticsResetToConsistentState(); 13 internals.setResourceLoadStatisticsEnabled(enable); 14 testRunner.setCookieStoragePartitioningEnabled(enable); 15 } 16 17 function finishTest() { 18 setEnableFeature(false); 19 finishJSTest(); 20 } 21 10 22 if (testRunner) { 23 setEnableFeature(true); 11 24 testRunner.setStatisticsNotifyPagesWhenDataRecordsWereScanned(true); 12 25 testRunner.installStatisticsDidScanDataRecordsCallback(checkStats); 13 26 } 14 27 15 var testPhasesDone = 0; 28 var lastPageInRedirectChainLoaded = false; 29 var statsChecked = false; 16 30 17 31 function receiveMessage(event) { … … 21 35 } else 22 36 testFailed("Received a message from an unexpected origin: " + event.origin); 23 ++testPhasesDone; 24 if (testPhasesDone === 2) 25 finishJSTest(); 37 38 lastPageInRedirectChainLoaded = true; 39 if (statsChecked) 40 finishTest(); 41 else 42 testRunner.statisticsNotifyObserver(); 26 43 } 27 44 … … 30 47 shouldBeTrue('testRunner.isStatisticsRegisteredAsRedirectingTo("http://localhost", "http://127.0.0.1")'); 31 48 shouldBeTrue('testRunner.isStatisticsRegisteredAsRedirectingTo("http://127.0.0.1", "http://localhost")'); 32 ++testPhasesDone; 33 if (testPhasesDone === 2) 34 finishJSTest(); 49 50 statsChecked = true; 51 if (lastPageInRedirectChainLoaded) 52 finishTest(); 35 53 } 36 54 </script> -
trunk/LayoutTests/http/tests/resourceLoadStatistics/sandboxed-nesting-iframe-with-non-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html
r223253 r223565 3 3 <head> 4 4 <script src="/js-test-resources/js-test.js"></script> 5 <script src="/js-test-resources/ui-helper.js"></script>6 5 <script> 7 6 description("Tests that redirects for a non-sandboxed iframe nested in a sandboxed iframe get counted properly."); 8 7 jsTestIsAsync = true; 9 8 window.addEventListener("message", receiveMessage, false); 9 10 function setEnableFeature(enable) { 11 if (!enable) 12 testRunner.statisticsResetToConsistentState(); 13 internals.setResourceLoadStatisticsEnabled(enable); 14 testRunner.setCookieStoragePartitioningEnabled(enable); 15 } 16 17 function finishTest() { 18 setEnableFeature(false); 19 finishJSTest(); 20 } 21 10 22 if (testRunner) { 23 setEnableFeature(true); 11 24 testRunner.setStatisticsNotifyPagesWhenDataRecordsWereScanned(true); 12 25 testRunner.installStatisticsDidScanDataRecordsCallback(checkStats); 13 26 } 14 27 15 var testPhasesDone = 0; 28 var lastPageInRedirectChainLoaded = false; 29 var statsChecked = false; 16 30 17 31 function receiveMessage(event) { … … 21 35 } else 22 36 testFailed("Received a message from an unexpected origin: " + event.origin); 23 ++testPhasesDone; 24 if (testPhasesDone === 2) 25 finishJSTest(); 37 38 lastPageInRedirectChainLoaded = true; 39 if (statsChecked) 40 finishTest(); 41 else 42 testRunner.statisticsNotifyObserver(); 26 43 } 27 44 … … 30 47 shouldBeTrue('testRunner.isStatisticsRegisteredAsRedirectingTo("http://localhost", "http://127.0.0.1")'); 31 48 shouldBeTrue('testRunner.isStatisticsRegisteredAsRedirectingTo("http://127.0.0.1", "http://localhost")'); 32 ++testPhasesDone; 33 if (testPhasesDone === 2) 34 finishJSTest(); 49 50 statsChecked = true; 51 if (lastPageInRedirectChainLoaded) 52 finishTest(); 35 53 } 36 54 </script> -
trunk/LayoutTests/http/tests/resourceLoadStatistics/sandboxed-nesting-iframe-with-non-sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html
r223253 r223565 3 3 <head> 4 4 <script src="/js-test-resources/js-test.js"></script> 5 <script src="/js-test-resources/ui-helper.js"></script>6 5 <script> 7 6 description("Tests that redirects for a non-sandboxed iframe nested in a sandboxed iframe get counted properly."); 8 7 jsTestIsAsync = true; 9 8 window.addEventListener("message", receiveMessage, false); 9 10 function setEnableFeature(enable) { 11 if (!enable) 12 testRunner.statisticsResetToConsistentState(); 13 internals.setResourceLoadStatisticsEnabled(enable); 14 testRunner.setCookieStoragePartitioningEnabled(enable); 15 } 16 17 function finishTest() { 18 setEnableFeature(false); 19 finishJSTest(); 20 } 21 10 22 if (testRunner) { 23 setEnableFeature(true); 11 24 testRunner.setStatisticsNotifyPagesWhenDataRecordsWereScanned(true); 12 25 testRunner.installStatisticsDidScanDataRecordsCallback(checkStats); 13 26 } 14 27 15 var testPhasesDone = 0; 28 var lastPageInRedirectChainLoaded = false; 29 var statsChecked = false; 16 30 17 31 function receiveMessage(event) { … … 21 35 } else 22 36 testFailed("Received a message from an unexpected origin: " + event.origin); 23 ++testPhasesDone; 24 if (testPhasesDone === 2) 25 finishJSTest(); 37 38 lastPageInRedirectChainLoaded = true; 39 if (statsChecked) 40 finishTest(); 41 else 42 testRunner.statisticsNotifyObserver(); 26 43 } 27 44 … … 30 47 shouldBeTrue('testRunner.isStatisticsRegisteredAsRedirectingTo("http://localhost", "http://127.0.0.1")'); 31 48 shouldBeTrue('testRunner.isStatisticsRegisteredAsRedirectingTo("http://127.0.0.1", "http://localhost")'); 32 ++testPhasesDone; 33 if (testPhasesDone === 2) 34 finishJSTest(); 49 50 statsChecked = true; 51 if (lastPageInRedirectChainLoaded) 52 finishTest(); 35 53 } 36 54 </script> -
trunk/LayoutTests/http/tests/resourceLoadStatistics/sandboxed-nesting-iframe-with-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html
r223253 r223565 3 3 <head> 4 4 <script src="/js-test-resources/js-test.js"></script> 5 <script src="/js-test-resources/ui-helper.js"></script>6 5 <script> 7 6 description("Tests that redirects for a sandboxed iframe nested in a non-sandboxed iframe get counted properly."); 8 7 jsTestIsAsync = true; 9 8 window.addEventListener("message", receiveMessage, false); 9 10 function setEnableFeature(enable) { 11 if (!enable) 12 testRunner.statisticsResetToConsistentState(); 13 internals.setResourceLoadStatisticsEnabled(enable); 14 testRunner.setCookieStoragePartitioningEnabled(enable); 15 } 16 17 function finishTest() { 18 setEnableFeature(false); 19 finishJSTest(); 20 } 21 10 22 if (testRunner) { 23 setEnableFeature(true); 11 24 testRunner.setStatisticsNotifyPagesWhenDataRecordsWereScanned(true); 12 25 testRunner.installStatisticsDidScanDataRecordsCallback(checkStats); 13 26 } 14 27 15 var testPhasesDone = 0; 28 var lastPageInRedirectChainLoaded = false; 29 var statsChecked = false; 16 30 17 31 function receiveMessage(event) { … … 21 35 } else 22 36 testFailed("Received a message from an unexpected origin: " + event.origin); 23 ++testPhasesDone; 24 if (testPhasesDone === 2) 25 finishJSTest(); 37 38 lastPageInRedirectChainLoaded = true; 39 if (statsChecked) 40 finishTest(); 41 else 42 testRunner.statisticsNotifyObserver(); 26 43 } 27 44 … … 30 47 shouldBeTrue('testRunner.isStatisticsRegisteredAsRedirectingTo("http://localhost", "http://127.0.0.1")'); 31 48 shouldBeTrue('testRunner.isStatisticsRegisteredAsRedirectingTo("http://127.0.0.1", "http://localhost")'); 32 ++testPhasesDone; 33 if (testPhasesDone === 2) 34 finishJSTest(); 49 50 statsChecked = true; 51 if (lastPageInRedirectChainLoaded) 52 finishTest(); 35 53 } 36 54 </script> -
trunk/LayoutTests/http/tests/resourceLoadStatistics/sandboxed-nesting-iframe-with-sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html
r223253 r223565 3 3 <head> 4 4 <script src="/js-test-resources/js-test.js"></script> 5 <script src="/js-test-resources/ui-helper.js"></script>6 5 <script> 7 6 description("Tests that redirects for a sandboxed iframe nested in a non-sandboxed iframe get counted properly."); 8 7 jsTestIsAsync = true; 9 8 window.addEventListener("message", receiveMessage, false); 9 10 function setEnableFeature(enable) { 11 if (!enable) 12 testRunner.statisticsResetToConsistentState(); 13 internals.setResourceLoadStatisticsEnabled(enable); 14 testRunner.setCookieStoragePartitioningEnabled(enable); 15 } 16 17 function finishTest() { 18 setEnableFeature(false); 19 finishJSTest(); 20 } 21 10 22 if (testRunner) { 23 setEnableFeature(true); 11 24 testRunner.setStatisticsNotifyPagesWhenDataRecordsWereScanned(true); 12 25 testRunner.installStatisticsDidScanDataRecordsCallback(checkStats); 13 26 } 14 27 15 var testPhasesDone = 0; 28 var lastPageInRedirectChainLoaded = false; 29 var statsChecked = false; 16 30 17 31 function receiveMessage(event) { … … 21 35 } else 22 36 testFailed("Received a message from an unexpected origin: " + event.origin); 23 ++testPhasesDone; 24 if (testPhasesDone === 2) 25 finishJSTest(); 37 38 lastPageInRedirectChainLoaded = true; 39 if (statsChecked) 40 finishTest(); 41 else 42 testRunner.statisticsNotifyObserver(); 26 43 } 27 44 … … 30 47 shouldBeTrue('testRunner.isStatisticsRegisteredAsRedirectingTo("http://localhost", "http://127.0.0.1")'); 31 48 shouldBeTrue('testRunner.isStatisticsRegisteredAsRedirectingTo("http://127.0.0.1", "http://localhost")'); 32 ++testPhasesDone; 33 if (testPhasesDone === 2) 34 finishJSTest(); 49 50 statsChecked = true; 51 if (lastPageInRedirectChainLoaded) 52 finishTest(); 35 53 } 36 54 </script> -
trunk/LayoutTests/platform/ios/TestExpectations
r223414 r223565 2783 2783 2784 2784 webkit.org/b/174120 http/tests/loading/resourceLoadStatistics/user-interaction-in-cross-origin-sub-frame.html [ Skip ] 2785 # Skipped in WK2 expectations because cookie partitioning is only available in macOS High Sierra and iOS 11. 2786 http/tests/resourceLoadStatistics/add-partitioning-to-redirect.html [ Pass ] 2787 http/tests/resourceLoadStatistics/remove-partitioning-from-redirect.html [ Pass ] 2785 2788 2786 2789 webkit.org/b/175273 imported/w3c/web-platform-tests/html/browsers/windows/noreferrer-window-name.html [ Failure ] -
trunk/LayoutTests/platform/mac-wk2/TestExpectations
r223556 r223565 808 808 [ HighSierra+ ] http/tests/loading/resourceLoadStatistics/partitioned-and-unpartitioned-cookie-with-partitioning-timeout.html [ Pass Failure ] 809 809 [ HighSierra+ ] http/tests/loading/resourceLoadStatistics/third-party-cookie-with-and-without-user-interaction.html [ Pass Failure ] 810 [ HighSierra+ ] http/tests/resourceLoadStatistics/add-partitioning-to-redirect.html [ Pass ] 811 [ HighSierra+ ] http/tests/resourceLoadStatistics/remove-partitioning-from-redirect.html [ Pass ] 810 812 811 813 # <rdar://problem/33555759> -
trunk/LayoutTests/platform/wk2/TestExpectations
r223408 r223565 692 692 http/tests/storageAccess/request-storage-access-top-frame.html [ Pass ] 693 693 http/tests/resourceLoadStatistics [ Pass ] 694 # Cookie partitioning is only supported in macOS High Sierra and iOS 11. 695 http/tests/resourceLoadStatistics/add-partitioning-to-redirect.html [ Skip ] 696 http/tests/resourceLoadStatistics/remove-partitioning-from-redirect.html [ Skip ] 697 694 698 695 699 ### END OF (5) Progressions, expected successes that are expected failures in WebKit1. -
trunk/Source/WebCore/ChangeLog
r223564 r223565 1 2017-10-17 John Wilander <wilander@apple.com> 2 3 Add and remove cookie partition accordingly in intermediary redirect requests 4 https://bugs.webkit.org/show_bug.cgi?id=178369 5 <rdar://problem/34467603> 6 7 Reviewed by Brent Fulgham. 8 9 Tests: http/tests/resourceLoadStatistics/add-partitioning-to-redirect.html 10 http/tests/resourceLoadStatistics/remove-partitioning-from-redirect.html 11 12 * loader/ResourceLoadObserver.h: 13 Now exposes notifyObserver() so that it can be triggered 14 by the TestRunner. 15 Removed unimplemented ResourceLoadObserver::setShouldThrottleObserverNotifications(). 16 1 17 2017-10-17 Jer Noble <jer.noble@apple.com> 2 18 -
trunk/Source/WebCore/loader/ResourceLoadObserver.h
r223253 r223565 54 54 WEBCORE_EXPORT static ResourceLoadObserver& shared(); 55 55 56 WEBCORE_EXPORT void setShouldThrottleObserverNotifications(bool);57 58 56 void logFrameNavigation(const Frame&, const Frame& topFrame, const ResourceRequest& newRequest, const URL& redirectUrl); 59 57 void logSubresourceLoading(const Frame*, const ResourceRequest& newRequest, const ResourceResponse& redirectResponse); … … 65 63 WEBCORE_EXPORT void setNotificationCallback(WTF::Function<void (Vector<ResourceLoadStatistics>&&)>&&); 66 64 65 WEBCORE_EXPORT void notifyObserver(); 67 66 WEBCORE_EXPORT void clearState(); 68 67 private: … … 73 72 74 73 void scheduleNotificationIfNeeded(); 75 void notifyObserver();76 74 Vector<ResourceLoadStatistics> takeStatistics(); 77 75 -
trunk/Source/WebKit/ChangeLog
r223558 r223565 1 2017-10-17 John Wilander <wilander@apple.com> 2 3 Add and remove cookie partition accordingly in intermediary redirect requests 4 https://bugs.webkit.org/show_bug.cgi?id=178369 5 <rdar://problem/34467603> 6 7 Reviewed by Brent Fulgham. 8 9 * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm: 10 (WebKit::shouldChangePartition): 11 Convenience function. Comment documents the logic. 12 (WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection): 13 Now adds and removes cookie partition based on the 14 redirect-to URL's domain. 15 * WebProcess/InjectedBundle/API/c/WKBundle.cpp: 16 (WKBundleResourceLoadStatisticsNotifyObserver): 17 Test infrastructure. 18 * WebProcess/InjectedBundle/API/c/WKBundlePrivate.h: 19 1 20 2017-10-17 Youenn Fablet <youenn@apple.com> 2 21 -
trunk/Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm
r222667 r223565 197 197 } 198 198 199 static bool shouldChangePartition(const String& requiredStoragePartition, const String& currentStoragePartition) 200 { 201 // The need for a partion change is according to the following: 202 // currentStoragePartition: null "" abc 203 // requiredStoragePartition: "" false false true 204 // abc true true false 205 // xyz true true true 206 return !((requiredStoragePartition.isEmpty() && currentStoragePartition.isEmpty()) || currentStoragePartition == requiredStoragePartition); 207 } 208 199 209 void NetworkDataTaskCocoa::willPerformHTTPRedirection(WebCore::ResourceResponse&& redirectResponse, WebCore::ResourceRequest&& request, RedirectCompletionHandler&& completionHandler) 200 210 { … … 241 251 } 242 252 253 #if HAVE(CFNETWORK_STORAGE_PARTITIONING) 254 if (m_storedCredentialsPolicy == WebCore::StoredCredentialsPolicy::Use) { 255 String requiredStoragePartition = m_session->networkStorageSession().cookieStoragePartition(request); 256 if (shouldChangePartition(requiredStoragePartition, m_task.get()._storagePartitionIdentifier)) { 257 LOG(NetworkSession, "%llu %s cookies for redirected URL %s", [m_task taskIdentifier], (requiredStoragePartition.isEmpty() ? "Not partitioning" : "Partitioning"), request.url().string().utf8().data()); 258 m_task.get()._storagePartitionIdentifier = requiredStoragePartition; 259 } 260 } 261 #endif 262 243 263 if (m_client) 244 264 m_client->willPerformHTTPRedirection(WTFMove(redirectResponse), WTFMove(request), WTFMove(completionHandler)); -
trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundle.cpp
r220302 r223565 283 283 ResourceLoadObserver::shared().clearState(); 284 284 } 285 286 void WKBundleResourceLoadStatisticsNotifyObserver(WKBundleRef) 287 { 288 ResourceLoadObserver::shared().notifyObserver(); 289 } -
trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h
r220302 r223565 93 93 94 94 WK_EXPORT void WKBundleClearResourceLoadStatistics(WKBundleRef); 95 WK_EXPORT void WKBundleResourceLoadStatisticsNotifyObserver(WKBundleRef); 95 96 96 97 #ifdef __cplusplus -
trunk/Tools/ChangeLog
r223558 r223565 1 2017-10-17 John Wilander <wilander@apple.com> 2 3 Add and remove cookie partition accordingly in intermediary redirect requests 4 https://bugs.webkit.org/show_bug.cgi?id=178369 5 <rdar://problem/34467603> 6 7 Reviewed by Brent Fulgham. 8 9 Adds the function statisticsNotifyObserver(). 10 11 * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl: 12 * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp: 13 (WTR::InjectedBundle::statisticsNotifyObserver): 14 * WebKitTestRunner/InjectedBundle/InjectedBundle.h: 15 * WebKitTestRunner/InjectedBundle/TestRunner.cpp: 16 (WTR::TestRunner::statisticsNotifyObserver): 17 * WebKitTestRunner/InjectedBundle/TestRunner.h: 18 1 19 2017-10-17 Youenn Fablet <youenn@apple.com> 2 20 -
trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl
r223558 r223565 279 279 void setStatisticsTimeToLiveUserInteraction(double seconds); 280 280 void setStatisticsTimeToLiveCookiePartitionFree(double seconds); 281 void statisticsNotifyObserver(); 281 282 void statisticsProcessStatisticsAndDataRecords(); 282 283 void statisticsUpdateCookiePartitioning(); -
trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp
r223433 r223565 841 841 } 842 842 843 void InjectedBundle::statisticsNotifyObserver() 844 { 845 WKBundleResourceLoadStatisticsNotifyObserver(m_bundle); 846 } 847 843 848 } // namespace WTR -
trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h
r223211 r223565 134 134 135 135 void setAllowsAnySSLCertificate(bool); 136 136 137 void statisticsNotifyObserver(); 138 137 139 private: 138 140 InjectedBundle(); -
trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp
r223558 r223565 1519 1519 callTestRunnerCallback(StatisticsDidRunTelemetryCallbackID, 1, &result); 1520 1520 } 1521 1521 1522 void TestRunner::statisticsNotifyObserver() 1523 { 1524 InjectedBundle::singleton().statisticsNotifyObserver(); 1525 } 1526 1522 1527 void TestRunner::statisticsProcessStatisticsAndDataRecords() 1523 1528 { -
trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h
r223558 r223565 364 364 void statisticsDidScanDataRecordsCallback(); 365 365 void statisticsDidRunTelemetryCallback(unsigned totalPrevalentResources, unsigned totalPrevalentResourcesWithUserInteraction, unsigned top3SubframeUnderTopFrameOrigins); 366 void statisticsNotifyObserver(); 366 367 void statisticsProcessStatisticsAndDataRecords(); 367 368 void statisticsUpdateCookiePartitioning();
Note: See TracChangeset
for help on using the changeset viewer.