Skip to content
Permalink
Browse files
ResourceLoadObserver::logFrameNavigation() should use redirectRespons…
…e.url()

https://bugs.webkit.org/show_bug.cgi?id=175257
<rdar://problem/33359866>

Reviewed by Brent Fulgham.

Source/WebCore:

This patch was joint work between Michael Specter and John Wilander.

Tests: http/tests/resourceLoadStatistics/non-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html
       http/tests/resourceLoadStatistics/non-sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html
       http/tests/resourceLoadStatistics/non-sandboxed-nesting-iframe-with-non-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html
       http/tests/resourceLoadStatistics/non-sandboxed-nesting-iframe-with-non-sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html
       http/tests/resourceLoadStatistics/non-sandboxed-nesting-iframe-with-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html
       http/tests/resourceLoadStatistics/non-sandboxed-nesting-iframe-with-sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html
       http/tests/resourceLoadStatistics/sandboxed-iframe-redirect-ip-to-localhost-to-ip.html
       http/tests/resourceLoadStatistics/sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html
       http/tests/resourceLoadStatistics/sandboxed-nesting-iframe-with-non-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html
       http/tests/resourceLoadStatistics/sandboxed-nesting-iframe-with-non-sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html
       http/tests/resourceLoadStatistics/sandboxed-nesting-iframe-with-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html
       http/tests/resourceLoadStatistics/sandboxed-nesting-iframe-with-sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html

* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::willSendRequest):
    Now sends redirectResponse.url() to WebCore::ResourceLoadObserver::logFrameNavigation().
* loader/ResourceLoadObserver.cpp:
(WebCore::ResourceLoadObserver::logFrameNavigation):
    Now receives the redirect response URL from WebCore::DocumentLoader().
(WebCore::ResourceLoadObserver::nonNullOwnerURL const):
    New function to traverse the frame chain upward and find the first non-null URL.
* loader/ResourceLoadObserver.h:

Source/WebKit:

* UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
(-[WKWebsiteDataStore _resourceLoadStatisticsIsRegisteredAsSubFrameUnder:topFrameHost:completionHandler:]):
(-[WKWebsiteDataStore _resourceLoadStatisticsIsRegisteredAsRedirectingTo:hostRedirectedTo:completionHandler:]):
    Test infrastructure.
* UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
* UIProcess/WebResourceLoadStatisticsStore.cpp:
(WebKit::WebResourceLoadStatisticsStore::isRegisteredAsSubFrameUnder):
(WebKit::WebResourceLoadStatisticsStore::isRegisteredAsRedirectingTo):
    Test infrastructure.
* UIProcess/WebResourceLoadStatisticsStore.h:

Tools:

* WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
* WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::TestRunner::isStatisticsRegisteredAsSubFrameUnder):
(WTR::TestRunner::isStatisticsRegisteredAsRedirectingTo):
* WebKitTestRunner/InjectedBundle/TestRunner.h:
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::isStatisticsRegisteredAsSubFrameUnder):
    Not implemented.
(WTR::TestController::isStatisticsRegisteredAsRedirectingTo):
    Not implemented.
* WebKitTestRunner/TestController.h:
* WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle):
* WebKitTestRunner/cocoa/TestControllerCocoa.mm:
(WTR::TestController::isStatisticsRegisteredAsSubFrameUnder):
    Implemented platform-specific.
(WTR::TestController::isStatisticsRegisteredAsRedirectingTo):
    Implemented platform-specific.

LayoutTests:

* TestExpectations:
    Marked new directory as [ Skip ] since these are WK2-only.
* http/tests/resourceLoadStatistics: Added.
* http/tests/resourceLoadStatistics/non-sandboxed-iframe-redirect-ip-to-localhost-to-ip-expected.txt: Added.
* http/tests/resourceLoadStatistics/non-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html: Added.
* http/tests/resourceLoadStatistics/non-sandboxed-iframe-redirect-localhost-to-ip-to-localhost-expected.txt: Added.
* http/tests/resourceLoadStatistics/non-sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html: Added.
* http/tests/resourceLoadStatistics/non-sandboxed-nesting-iframe-with-non-sandboxed-iframe-redirect-ip-to-localhost-to-ip-expected.txt: Added.
* http/tests/resourceLoadStatistics/non-sandboxed-nesting-iframe-with-non-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html: Added.
* http/tests/resourceLoadStatistics/non-sandboxed-nesting-iframe-with-non-sandboxed-iframe-redirect-localhost-to-ip-to-localhost-expected.txt: Added.
* http/tests/resourceLoadStatistics/non-sandboxed-nesting-iframe-with-non-sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html: Added.
* http/tests/resourceLoadStatistics/non-sandboxed-nesting-iframe-with-sandboxed-iframe-redirect-ip-to-localhost-to-ip-expected.txt: Added.
* http/tests/resourceLoadStatistics/non-sandboxed-nesting-iframe-with-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html: Added.
* http/tests/resourceLoadStatistics/non-sandboxed-nesting-iframe-with-sandboxed-iframe-redirect-localhost-to-ip-to-localhost-expected.txt: Added.
* http/tests/resourceLoadStatistics/non-sandboxed-nesting-iframe-with-sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html: Added.
* http/tests/resourceLoadStatistics/resources: Added.
* http/tests/resourceLoadStatistics/resources/iframe-report-back-loaded.html: Added.
* http/tests/resourceLoadStatistics/resources/page-with-non-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html: Added.
* http/tests/resourceLoadStatistics/resources/page-with-non-sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html: Added.
* http/tests/resourceLoadStatistics/resources/page-with-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html: Added.
* http/tests/resourceLoadStatistics/resources/page-with-sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html: Added.
* http/tests/resourceLoadStatistics/resources/redirect.php: Added.
* http/tests/resourceLoadStatistics/sandboxed-iframe-redirect-ip-to-localhost-to-ip-expected.txt: Added.
* http/tests/resourceLoadStatistics/sandboxed-iframe-redirect-ip-to-localhost-to-ip.html: Added.
* http/tests/resourceLoadStatistics/sandboxed-iframe-redirect-localhost-to-ip-to-localhost-expected.txt: Added.
* http/tests/resourceLoadStatistics/sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html: Added.
* http/tests/resourceLoadStatistics/sandboxed-nesting-iframe-with-non-sandboxed-iframe-redirect-ip-to-localhost-to-ip-expected.txt: Added.
* http/tests/resourceLoadStatistics/sandboxed-nesting-iframe-with-non-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html: Added.
* http/tests/resourceLoadStatistics/sandboxed-nesting-iframe-with-non-sandboxed-iframe-redirect-localhost-to-ip-to-localhost-expected.txt: Added.
* http/tests/resourceLoadStatistics/sandboxed-nesting-iframe-with-non-sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html: Added.
* http/tests/resourceLoadStatistics/sandboxed-nesting-iframe-with-sandboxed-iframe-redirect-ip-to-localhost-to-ip-expected.txt: Added.
* http/tests/resourceLoadStatistics/sandboxed-nesting-iframe-with-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html: Added.
* http/tests/resourceLoadStatistics/sandboxed-nesting-iframe-with-sandboxed-iframe-redirect-localhost-to-ip-to-localhost-expected.txt: Added.
* http/tests/resourceLoadStatistics/sandboxed-nesting-iframe-with-sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html: Added.
* platform/gtk/TestExpectations:
    Marked new directory as [ Skip ].
* platform/wk2/TestExpectations:
    Marked new directory as [ Pass ].
* platform/wpe/TestExpectations:
    Marked new directory as [ Skip ].


Canonical link: https://commits.webkit.org/194472@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@223253 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
johnwilander committed Oct 12, 2017
1 parent 0066cf6 commit 2232398c5c3b6fcfddb1ba4b895600cebd876926
Showing with 1,062 additions and 12 deletions.
  1. +49 −0 LayoutTests/ChangeLog
  2. +1 −0 LayoutTests/TestExpectations
  3. +12 −0 ...ttp/tests/resourceLoadStatistics/non-sandboxed-iframe-redirect-ip-to-localhost-to-ip-expected.txt
  4. +42 −0 ...tTests/http/tests/resourceLoadStatistics/non-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html
  5. +12 −0 ...ts/resourceLoadStatistics/non-sandboxed-iframe-redirect-localhost-to-ip-to-localhost-expected.txt
  6. +42 −0 ...http/tests/resourceLoadStatistics/non-sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html
  7. +12 −0 ...on-sandboxed-nesting-iframe-with-non-sandboxed-iframe-redirect-ip-to-localhost-to-ip-expected.txt
  8. +42 −0 ...istics/non-sandboxed-nesting-iframe-with-non-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html
  9. +12 −0 ...boxed-nesting-iframe-with-non-sandboxed-iframe-redirect-localhost-to-ip-to-localhost-expected.txt
  10. +42 −0 ...non-sandboxed-nesting-iframe-with-non-sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html
  11. +12 −0 ...cs/non-sandboxed-nesting-iframe-with-sandboxed-iframe-redirect-ip-to-localhost-to-ip-expected.txt
  12. +42 −0 ...Statistics/non-sandboxed-nesting-iframe-with-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html
  13. +12 −0 ...sandboxed-nesting-iframe-with-sandboxed-iframe-redirect-localhost-to-ip-to-localhost-expected.txt
  14. +42 −0 ...ics/non-sandboxed-nesting-iframe-with-sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html
  15. +12 −0 LayoutTests/http/tests/resourceLoadStatistics/resources/iframe-report-back-loaded.html
  16. +9 −0 ...sourceLoadStatistics/resources/page-with-non-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html
  17. +9 −0 ...oadStatistics/resources/page-with-non-sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html
  18. +9 −0 ...s/resourceLoadStatistics/resources/page-with-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html
  19. +9 −0 ...rceLoadStatistics/resources/page-with-sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html
  20. +4 −0 LayoutTests/http/tests/resourceLoadStatistics/resources/redirect.php
  21. +12 −0 ...ts/http/tests/resourceLoadStatistics/sandboxed-iframe-redirect-ip-to-localhost-to-ip-expected.txt
  22. +42 −0 LayoutTests/http/tests/resourceLoadStatistics/sandboxed-iframe-redirect-ip-to-localhost-to-ip.html
  23. +12 −0 .../tests/resourceLoadStatistics/sandboxed-iframe-redirect-localhost-to-ip-to-localhost-expected.txt
  24. +42 −0 ...sts/http/tests/resourceLoadStatistics/sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html
  25. +12 −0 ...cs/sandboxed-nesting-iframe-with-non-sandboxed-iframe-redirect-ip-to-localhost-to-ip-expected.txt
  26. +42 −0 ...Statistics/sandboxed-nesting-iframe-with-non-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html
  27. +12 −0 ...boxed-nesting-iframe-with-non-sandboxed-iframe-redirect-localhost-to-ip-to-localhost-expected.txt
  28. +42 −0 ...ics/sandboxed-nesting-iframe-with-non-sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html
  29. +12 −0 ...istics/sandboxed-nesting-iframe-with-sandboxed-iframe-redirect-ip-to-localhost-to-ip-expected.txt
  30. +42 −0 ...LoadStatistics/sandboxed-nesting-iframe-with-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html
  31. +12 −0 ...sandboxed-nesting-iframe-with-sandboxed-iframe-redirect-localhost-to-ip-to-localhost-expected.txt
  32. +42 −0 ...tistics/sandboxed-nesting-iframe-with-sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html
  33. +3 −0 LayoutTests/platform/gtk/TestExpectations
  34. +1 −0 LayoutTests/platform/wk2/TestExpectations
  35. +1 −0 LayoutTests/platform/wpe/TestExpectations
  36. +33 −0 Source/WebCore/ChangeLog
  37. +1 −1 Source/WebCore/loader/DocumentLoader.cpp
  38. +46 −10 Source/WebCore/loader/ResourceLoadObserver.cpp
  39. +3 −1 Source/WebCore/loader/ResourceLoadObserver.h
  40. +19 −0 Source/WebKit/ChangeLog
  41. +28 −0 Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.mm
  42. +2 −0 Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h
  43. +22 −0 Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp
  44. +2 −0 Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.h
  45. +27 −0 Tools/ChangeLog
  46. +2 −0 Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl
  47. +52 −0 Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp
  48. +2 −0 Tools/WebKitTestRunner/InjectedBundle/TestRunner.h
  49. +10 −0 Tools/WebKitTestRunner/TestController.cpp
  50. +2 −0 Tools/WebKitTestRunner/TestController.h
  51. +30 −0 Tools/WebKitTestRunner/TestInvocation.cpp
  52. +26 −0 Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm
@@ -1,3 +1,52 @@
2017-10-12 John Wilander <wilander@apple.com>

ResourceLoadObserver::logFrameNavigation() should use redirectResponse.url()
https://bugs.webkit.org/show_bug.cgi?id=175257
<rdar://problem/33359866>

Reviewed by Brent Fulgham.

* TestExpectations:
Marked new directory as [ Skip ] since these are WK2-only.
* http/tests/resourceLoadStatistics: Added.
* http/tests/resourceLoadStatistics/non-sandboxed-iframe-redirect-ip-to-localhost-to-ip-expected.txt: Added.
* http/tests/resourceLoadStatistics/non-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html: Added.
* http/tests/resourceLoadStatistics/non-sandboxed-iframe-redirect-localhost-to-ip-to-localhost-expected.txt: Added.
* http/tests/resourceLoadStatistics/non-sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html: Added.
* http/tests/resourceLoadStatistics/non-sandboxed-nesting-iframe-with-non-sandboxed-iframe-redirect-ip-to-localhost-to-ip-expected.txt: Added.
* http/tests/resourceLoadStatistics/non-sandboxed-nesting-iframe-with-non-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html: Added.
* http/tests/resourceLoadStatistics/non-sandboxed-nesting-iframe-with-non-sandboxed-iframe-redirect-localhost-to-ip-to-localhost-expected.txt: Added.
* http/tests/resourceLoadStatistics/non-sandboxed-nesting-iframe-with-non-sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html: Added.
* http/tests/resourceLoadStatistics/non-sandboxed-nesting-iframe-with-sandboxed-iframe-redirect-ip-to-localhost-to-ip-expected.txt: Added.
* http/tests/resourceLoadStatistics/non-sandboxed-nesting-iframe-with-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html: Added.
* http/tests/resourceLoadStatistics/non-sandboxed-nesting-iframe-with-sandboxed-iframe-redirect-localhost-to-ip-to-localhost-expected.txt: Added.
* http/tests/resourceLoadStatistics/non-sandboxed-nesting-iframe-with-sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html: Added.
* http/tests/resourceLoadStatistics/resources: Added.
* http/tests/resourceLoadStatistics/resources/iframe-report-back-loaded.html: Added.
* http/tests/resourceLoadStatistics/resources/page-with-non-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html: Added.
* http/tests/resourceLoadStatistics/resources/page-with-non-sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html: Added.
* http/tests/resourceLoadStatistics/resources/page-with-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html: Added.
* http/tests/resourceLoadStatistics/resources/page-with-sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html: Added.
* http/tests/resourceLoadStatistics/resources/redirect.php: Added.
* http/tests/resourceLoadStatistics/sandboxed-iframe-redirect-ip-to-localhost-to-ip-expected.txt: Added.
* http/tests/resourceLoadStatistics/sandboxed-iframe-redirect-ip-to-localhost-to-ip.html: Added.
* http/tests/resourceLoadStatistics/sandboxed-iframe-redirect-localhost-to-ip-to-localhost-expected.txt: Added.
* http/tests/resourceLoadStatistics/sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html: Added.
* http/tests/resourceLoadStatistics/sandboxed-nesting-iframe-with-non-sandboxed-iframe-redirect-ip-to-localhost-to-ip-expected.txt: Added.
* http/tests/resourceLoadStatistics/sandboxed-nesting-iframe-with-non-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html: Added.
* http/tests/resourceLoadStatistics/sandboxed-nesting-iframe-with-non-sandboxed-iframe-redirect-localhost-to-ip-to-localhost-expected.txt: Added.
* http/tests/resourceLoadStatistics/sandboxed-nesting-iframe-with-non-sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html: Added.
* http/tests/resourceLoadStatistics/sandboxed-nesting-iframe-with-sandboxed-iframe-redirect-ip-to-localhost-to-ip-expected.txt: Added.
* http/tests/resourceLoadStatistics/sandboxed-nesting-iframe-with-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html: Added.
* http/tests/resourceLoadStatistics/sandboxed-nesting-iframe-with-sandboxed-iframe-redirect-localhost-to-ip-to-localhost-expected.txt: Added.
* http/tests/resourceLoadStatistics/sandboxed-nesting-iframe-with-sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html: Added.
* platform/gtk/TestExpectations:
Marked new directory as [ Skip ].
* platform/wk2/TestExpectations:
Marked new directory as [ Pass ].
* platform/wpe/TestExpectations:
Marked new directory as [ Skip ].

2017-10-12 Matt Lewis <jlewis3@apple.com>

Marked imported/w3c/web-platform-tests/fetch/security/dangling-markup-mitigation-data-url.tentative.sub.html as flaky on iOS.
@@ -87,6 +87,7 @@ http/tests/quicklook [ Skip ]
http/tests/appcache/decide-navigation-policy-after-delay.html [ Skip ]
http/tests/misc/will-send-request-with-client-provided-http-body.html [ Skip ]
http/tests/loading/resourceLoadStatistics/ [ Skip ]
http/tests/resourceLoadStatistics/ [ Skip ]
http/tests/storageAccess/ [ Skip ]

# Only Mac and iOS have an implementation of UIScriptController::doAsyncTask().
@@ -0,0 +1,12 @@
Tests that redirects for a non-sandboxed iframe get counted properly.

On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".


PASS testRunner.isStatisticsRegisteredAsSubFrameUnder("http://localhost", "http://127.0.0.1") is true
PASS testRunner.isStatisticsRegisteredAsRedirectingTo("http://localhost", "http://127.0.0.1") is true
PASS testRunner.isStatisticsRegisteredAsRedirectingTo("http://127.0.0.1", "http://localhost") is true
PASS successfullyParsed is true

TEST COMPLETE

@@ -0,0 +1,42 @@
<!DOCTYPE html>
<html>
<head>
<script src="/js-test-resources/js-test.js"></script>
<script src="/js-test-resources/ui-helper.js"></script>
<script>
description("Tests that redirects for a non-sandboxed iframe get counted properly.");
jsTestIsAsync = true;
window.addEventListener("message", receiveMessage, false);
if (testRunner) {
testRunner.setStatisticsNotifyPagesWhenDataRecordsWereScanned(true);
testRunner.installStatisticsDidScanDataRecordsCallback(checkStats);
}

var testPhasesDone = 0;

function receiveMessage(event) {
if (event.origin === "http://127.0.0.1:8000") {
if (event.data.indexOf("PASS") === -1)
testFailed(event.data.replace("FAIL ", ""));
} else
testFailed("Received a message from an unexpected origin: " + event.origin);
++testPhasesDone;
if (testPhasesDone === 2)
finishJSTest();
}

function checkStats() {
shouldBeTrue('testRunner.isStatisticsRegisteredAsSubFrameUnder("http://localhost", "http://127.0.0.1")');
shouldBeTrue('testRunner.isStatisticsRegisteredAsRedirectingTo("http://localhost", "http://127.0.0.1")');
shouldBeTrue('testRunner.isStatisticsRegisteredAsRedirectingTo("http://127.0.0.1", "http://localhost")');
++testPhasesDone;
if (testPhasesDone === 2)
finishJSTest();
}
</script>
</head>
<body>
<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">
</iframe>
</body>
</html>
@@ -0,0 +1,12 @@
Tests that redirects for a non-sandboxed iframe get counted properly.

On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".


PASS testRunner.isStatisticsRegisteredAsSubFrameUnder("http://localhost", "http://127.0.0.1") is true
PASS testRunner.isStatisticsRegisteredAsRedirectingTo("http://localhost", "http://127.0.0.1") is true
PASS testRunner.isStatisticsRegisteredAsRedirectingTo("http://127.0.0.1", "http://localhost") is true
PASS successfullyParsed is true

TEST COMPLETE

@@ -0,0 +1,42 @@
<!DOCTYPE html>
<html>
<head>
<script src="/js-test-resources/js-test.js"></script>
<script src="/js-test-resources/ui-helper.js"></script>
<script>
description("Tests that redirects for a non-sandboxed iframe get counted properly.");
jsTestIsAsync = true;
window.addEventListener("message", receiveMessage, false);
if (testRunner) {
testRunner.setStatisticsNotifyPagesWhenDataRecordsWereScanned(true);
testRunner.installStatisticsDidScanDataRecordsCallback(checkStats);
}

var testPhasesDone = 0;

function receiveMessage(event) {
if (event.origin === "http://localhost:8000") {
if (event.data.indexOf("PASS") === -1)
testFailed(event.data.replace("FAIL ", ""));
} else
testFailed("Received a message from an unexpected origin: " + event.origin);
++testPhasesDone;
if (testPhasesDone === 2)
finishJSTest();
}

function checkStats() {
shouldBeTrue('testRunner.isStatisticsRegisteredAsSubFrameUnder("http://localhost", "http://127.0.0.1")');
shouldBeTrue('testRunner.isStatisticsRegisteredAsRedirectingTo("http://localhost", "http://127.0.0.1")');
shouldBeTrue('testRunner.isStatisticsRegisteredAsRedirectingTo("http://127.0.0.1", "http://localhost")');
++testPhasesDone;
if (testPhasesDone === 2)
finishJSTest();
}
</script>
</head>
<body>
<iframe src="http://localhost:8000/resourceLoadStatistics/resources/redirect.php/?redirectTo=http://127.0.0.1:8000/resourceLoadStatistics/resources/redirect.php/?redirectTo=http://localhost:8000/resourceLoadStatistics/resources/iframe-report-back-loaded.html">
</iframe>
</body>
</html>
@@ -0,0 +1,12 @@
Tests that redirects for a non-sandboxed iframe nested in a non-sandboxed iframe get counted properly.

On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".


PASS testRunner.isStatisticsRegisteredAsSubFrameUnder("http://localhost", "http://127.0.0.1") is true
PASS testRunner.isStatisticsRegisteredAsRedirectingTo("http://localhost", "http://127.0.0.1") is true
PASS testRunner.isStatisticsRegisteredAsRedirectingTo("http://127.0.0.1", "http://localhost") is true
PASS successfullyParsed is true

TEST COMPLETE

@@ -0,0 +1,42 @@
<!DOCTYPE html>
<html>
<head>
<script src="/js-test-resources/js-test.js"></script>
<script src="/js-test-resources/ui-helper.js"></script>
<script>
description("Tests that redirects for a non-sandboxed iframe nested in a non-sandboxed iframe get counted properly.");
jsTestIsAsync = true;
window.addEventListener("message", receiveMessage, false);
if (testRunner) {
testRunner.setStatisticsNotifyPagesWhenDataRecordsWereScanned(true);
testRunner.installStatisticsDidScanDataRecordsCallback(checkStats);
}

var testPhasesDone = 0;

function receiveMessage(event) {
if (event.origin === "http://127.0.0.1:8000") {
if (event.data.indexOf("PASS") === -1)
testFailed(event.data.replace("FAIL ", ""));
} else
testFailed("Received a message from an unexpected origin: " + event.origin);
++testPhasesDone;
if (testPhasesDone === 2)
finishJSTest();
}

function checkStats() {
shouldBeTrue('testRunner.isStatisticsRegisteredAsSubFrameUnder("http://localhost", "http://127.0.0.1")');
shouldBeTrue('testRunner.isStatisticsRegisteredAsRedirectingTo("http://localhost", "http://127.0.0.1")');
shouldBeTrue('testRunner.isStatisticsRegisteredAsRedirectingTo("http://127.0.0.1", "http://localhost")');
++testPhasesDone;
if (testPhasesDone === 2)
finishJSTest();
}
</script>
</head>
<body>
<iframe src="http://127.0.0.1:8000/resourceLoadStatistics/resources/page-with-non-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html">
</iframe>
</body>
</html>
@@ -0,0 +1,12 @@
Tests that redirects for a non-sandboxed iframe nested in a non-sandboxed iframe get counted properly.

On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".


PASS testRunner.isStatisticsRegisteredAsSubFrameUnder("http://localhost", "http://127.0.0.1") is true
PASS testRunner.isStatisticsRegisteredAsRedirectingTo("http://localhost", "http://127.0.0.1") is true
PASS testRunner.isStatisticsRegisteredAsRedirectingTo("http://127.0.0.1", "http://localhost") is true
PASS successfullyParsed is true

TEST COMPLETE

@@ -0,0 +1,42 @@
<!DOCTYPE html>
<html>
<head>
<script src="/js-test-resources/js-test.js"></script>
<script src="/js-test-resources/ui-helper.js"></script>
<script>
description("Tests that redirects for a non-sandboxed iframe nested in a non-sandboxed iframe get counted properly.");
jsTestIsAsync = true;
window.addEventListener("message", receiveMessage, false);
if (testRunner) {
testRunner.setStatisticsNotifyPagesWhenDataRecordsWereScanned(true);
testRunner.installStatisticsDidScanDataRecordsCallback(checkStats);
}

var testPhasesDone = 0;

function receiveMessage(event) {
if (event.origin === "http://localhost:8000") {
if (event.data.indexOf("PASS") === -1)
testFailed(event.data.replace("FAIL ", ""));
} else
testFailed("Received a message from an unexpected origin: " + event.origin);
++testPhasesDone;
if (testPhasesDone === 2)
finishJSTest();
}

function checkStats() {
shouldBeTrue('testRunner.isStatisticsRegisteredAsSubFrameUnder("http://localhost", "http://127.0.0.1")');
shouldBeTrue('testRunner.isStatisticsRegisteredAsRedirectingTo("http://localhost", "http://127.0.0.1")');
shouldBeTrue('testRunner.isStatisticsRegisteredAsRedirectingTo("http://127.0.0.1", "http://localhost")');
++testPhasesDone;
if (testPhasesDone === 2)
finishJSTest();
}
</script>
</head>
<body>
<iframe src="http://127.0.0.1:8000/resourceLoadStatistics/resources/page-with-non-sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html">
</iframe>
</body>
</html>
@@ -0,0 +1,12 @@
Tests that redirects for a sandboxed iframe nested in a non-sandboxed iframe get counted properly.

On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".


PASS testRunner.isStatisticsRegisteredAsSubFrameUnder("http://localhost", "http://127.0.0.1") is true
PASS testRunner.isStatisticsRegisteredAsRedirectingTo("http://localhost", "http://127.0.0.1") is true
PASS testRunner.isStatisticsRegisteredAsRedirectingTo("http://127.0.0.1", "http://localhost") is true
PASS successfullyParsed is true

TEST COMPLETE

@@ -0,0 +1,42 @@
<!DOCTYPE html>
<html>
<head>
<script src="/js-test-resources/js-test.js"></script>
<script src="/js-test-resources/ui-helper.js"></script>
<script>
description("Tests that redirects for a sandboxed iframe nested in a non-sandboxed iframe get counted properly.");
jsTestIsAsync = true;
window.addEventListener("message", receiveMessage, false);
if (testRunner) {
testRunner.setStatisticsNotifyPagesWhenDataRecordsWereScanned(true);
testRunner.installStatisticsDidScanDataRecordsCallback(checkStats);
}

var testPhasesDone = 0;

function receiveMessage(event) {
if (event.origin === "null") {
if (event.data.indexOf("PASS") === -1)
testFailed(event.data.replace("FAIL ", ""));
} else
testFailed("Received a message from an unexpected origin: " + event.origin);
++testPhasesDone;
if (testPhasesDone === 2)
finishJSTest();
}

function checkStats() {
shouldBeTrue('testRunner.isStatisticsRegisteredAsSubFrameUnder("http://localhost", "http://127.0.0.1")');
shouldBeTrue('testRunner.isStatisticsRegisteredAsRedirectingTo("http://localhost", "http://127.0.0.1")');
shouldBeTrue('testRunner.isStatisticsRegisteredAsRedirectingTo("http://127.0.0.1", "http://localhost")');
++testPhasesDone;
if (testPhasesDone === 2)
finishJSTest();
}
</script>
</head>
<body>
<iframe src="http://127.0.0.1:8000/resourceLoadStatistics/resources/page-with-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html">
</iframe>
</body>
</html>
@@ -0,0 +1,12 @@
Tests that redirects for a sandboxed iframe nested in a non-sandboxed iframe get counted properly.

On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".


PASS testRunner.isStatisticsRegisteredAsSubFrameUnder("http://localhost", "http://127.0.0.1") is true
PASS testRunner.isStatisticsRegisteredAsRedirectingTo("http://localhost", "http://127.0.0.1") is true
PASS testRunner.isStatisticsRegisteredAsRedirectingTo("http://127.0.0.1", "http://localhost") is true
PASS successfullyParsed is true

TEST COMPLETE

0 comments on commit 2232398

Please sign in to comment.