Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
Showing
with
1,062 additions
and 12 deletions.
- +49 −0 LayoutTests/ChangeLog
- +1 −0 LayoutTests/TestExpectations
- +12 −0 ...ttp/tests/resourceLoadStatistics/non-sandboxed-iframe-redirect-ip-to-localhost-to-ip-expected.txt
- +42 −0 ...tTests/http/tests/resourceLoadStatistics/non-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html
- +12 −0 ...ts/resourceLoadStatistics/non-sandboxed-iframe-redirect-localhost-to-ip-to-localhost-expected.txt
- +42 −0 ...http/tests/resourceLoadStatistics/non-sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html
- +12 −0 ...on-sandboxed-nesting-iframe-with-non-sandboxed-iframe-redirect-ip-to-localhost-to-ip-expected.txt
- +42 −0 ...istics/non-sandboxed-nesting-iframe-with-non-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html
- +12 −0 ...boxed-nesting-iframe-with-non-sandboxed-iframe-redirect-localhost-to-ip-to-localhost-expected.txt
- +42 −0 ...non-sandboxed-nesting-iframe-with-non-sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html
- +12 −0 ...cs/non-sandboxed-nesting-iframe-with-sandboxed-iframe-redirect-ip-to-localhost-to-ip-expected.txt
- +42 −0 ...Statistics/non-sandboxed-nesting-iframe-with-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html
- +12 −0 ...sandboxed-nesting-iframe-with-sandboxed-iframe-redirect-localhost-to-ip-to-localhost-expected.txt
- +42 −0 ...ics/non-sandboxed-nesting-iframe-with-sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html
- +12 −0 LayoutTests/http/tests/resourceLoadStatistics/resources/iframe-report-back-loaded.html
- +9 −0 ...sourceLoadStatistics/resources/page-with-non-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html
- +9 −0 ...oadStatistics/resources/page-with-non-sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html
- +9 −0 ...s/resourceLoadStatistics/resources/page-with-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html
- +9 −0 ...rceLoadStatistics/resources/page-with-sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html
- +4 −0 LayoutTests/http/tests/resourceLoadStatistics/resources/redirect.php
- +12 −0 ...ts/http/tests/resourceLoadStatistics/sandboxed-iframe-redirect-ip-to-localhost-to-ip-expected.txt
- +42 −0 LayoutTests/http/tests/resourceLoadStatistics/sandboxed-iframe-redirect-ip-to-localhost-to-ip.html
- +12 −0 .../tests/resourceLoadStatistics/sandboxed-iframe-redirect-localhost-to-ip-to-localhost-expected.txt
- +42 −0 ...sts/http/tests/resourceLoadStatistics/sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html
- +12 −0 ...cs/sandboxed-nesting-iframe-with-non-sandboxed-iframe-redirect-ip-to-localhost-to-ip-expected.txt
- +42 −0 ...Statistics/sandboxed-nesting-iframe-with-non-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html
- +12 −0 ...boxed-nesting-iframe-with-non-sandboxed-iframe-redirect-localhost-to-ip-to-localhost-expected.txt
- +42 −0 ...ics/sandboxed-nesting-iframe-with-non-sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html
- +12 −0 ...istics/sandboxed-nesting-iframe-with-sandboxed-iframe-redirect-ip-to-localhost-to-ip-expected.txt
- +42 −0 ...LoadStatistics/sandboxed-nesting-iframe-with-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html
- +12 −0 ...sandboxed-nesting-iframe-with-sandboxed-iframe-redirect-localhost-to-ip-to-localhost-expected.txt
- +42 −0 ...tistics/sandboxed-nesting-iframe-with-sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html
- +3 −0 LayoutTests/platform/gtk/TestExpectations
- +1 −0 LayoutTests/platform/wk2/TestExpectations
- +1 −0 LayoutTests/platform/wpe/TestExpectations
- +33 −0 Source/WebCore/ChangeLog
- +1 −1 Source/WebCore/loader/DocumentLoader.cpp
- +46 −10 Source/WebCore/loader/ResourceLoadObserver.cpp
- +3 −1 Source/WebCore/loader/ResourceLoadObserver.h
- +19 −0 Source/WebKit/ChangeLog
- +28 −0 Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.mm
- +2 −0 Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h
- +22 −0 Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp
- +2 −0 Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.h
- +27 −0 Tools/ChangeLog
- +2 −0 Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl
- +52 −0 Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp
- +2 −0 Tools/WebKitTestRunner/InjectedBundle/TestRunner.h
- +10 −0 Tools/WebKitTestRunner/TestController.cpp
- +2 −0 Tools/WebKitTestRunner/TestController.h
- +30 −0 Tools/WebKitTestRunner/TestInvocation.cpp
- +26 −0 Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -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 | ||
|
Oops, something went wrong.