Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Add referrer-policy tests
https://bugs.webkit.org/show_bug.cgi?id=195269 Patch by Rob Buis <rbuis@igalia.com> on 2019-03-05 Reviewed by Daniel Bates. The tests in http/tests/referrer-policy do not test all referrer-policy values, add the remaining values. * http/tests/referrer-policy/no-referrer-when-downgrade/cross-origin-http-http-expected.txt: Added. * http/tests/referrer-policy/no-referrer-when-downgrade/cross-origin-http-http.html: Added. * http/tests/referrer-policy/no-referrer-when-downgrade/cross-origin-http.https-expected.txt: Added. * http/tests/referrer-policy/no-referrer-when-downgrade/cross-origin-http.https.html: Added. * http/tests/referrer-policy/no-referrer-when-downgrade/same-origin-expected.txt: Added. * http/tests/referrer-policy/no-referrer-when-downgrade/same-origin.html: Added. * http/tests/referrer-policy/no-referrer/cross-origin-http-http-expected.txt: Added. * http/tests/referrer-policy/no-referrer/cross-origin-http-http.html: Added. * http/tests/referrer-policy/no-referrer/cross-origin-http.https-expected.txt: Added. * http/tests/referrer-policy/no-referrer/cross-origin-http.https.html: Added. * http/tests/referrer-policy/no-referrer/same-origin-expected.txt: Added. * http/tests/referrer-policy/no-referrer/same-origin.html: Added. * http/tests/referrer-policy/origin/cross-origin-http-http-expected.txt: Added. * http/tests/referrer-policy/origin/cross-origin-http-http.html: Added. * http/tests/referrer-policy/origin/cross-origin-http.https-expected.txt: Added. * http/tests/referrer-policy/origin/cross-origin-http.https.html: Added. * http/tests/referrer-policy/origin/same-origin-expected.txt: Added. * http/tests/referrer-policy/origin/same-origin.html: Added. * http/tests/referrer-policy/unsafe-url/cross-origin-http-http-expected.txt: Added. * http/tests/referrer-policy/unsafe-url/cross-origin-http-http.html: Added. * http/tests/referrer-policy/unsafe-url/cross-origin-http.https-expected.txt: Added. * http/tests/referrer-policy/unsafe-url/cross-origin-http.https.html: Added. * http/tests/referrer-policy/unsafe-url/same-origin-expected.txt: Added. * http/tests/referrer-policy/unsafe-url/same-origin.html: Added. Canonical link: https://commits.webkit.org/209694@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@242531 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
1 parent
ef9290c
commit ec09b7d66bf3ab101833c6174663891b0fe7f030
Showing
25 changed files
with
427 additions
and
0 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
Tests the behavior of no-referrer-when-downgrade referrer policy when cross origin. | ||
|
||
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". | ||
|
||
|
||
PASS referrer is "http://127.0.0.1:8000/referrer-policy/no-referrer-when-downgrade/cross-origin-http-http.html" | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta name='referrer' content='no-referrer-when-downgrade'> | ||
<script src="/js-test-resources/js-test.js"></script> | ||
</head> | ||
<body> | ||
<script> | ||
description("Tests the behavior of no-referrer-when-downgrade referrer policy when cross origin."); | ||
jsTestIsAsync = true; | ||
|
||
window.onmessage = function(event) { | ||
referrer = event.data.referrer; | ||
// Should be the full URL | ||
shouldBeEqualToString("referrer", "http://127.0.0.1:8000/referrer-policy/no-referrer-when-downgrade/cross-origin-http-http.html"); | ||
finishJSTest(); | ||
} | ||
</script> | ||
<iframe src="http://localhost:8000/referrer-policy/resources/document.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
CONSOLE MESSAGE: The page at about:blank was allowed to display insecure content from http://localhost:8000/referrer-policy/resources/document.html. | ||
|
||
Tests the behavior of no-referrer-when-downgrade referrer policy when cross origin from HTTPS to HTTP. | ||
|
||
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". | ||
|
||
|
||
PASS referrer is "" | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta name='referrer' content='no-referrer-when-downgrade'> | ||
<script src="/js-test-resources/js-test.js"></script> | ||
</head> | ||
<body> | ||
<script> | ||
description("Tests the behavior of no-referrer-when-downgrade referrer policy when cross origin from HTTPS to HTTP."); | ||
jsTestIsAsync = true; | ||
|
||
if (window.internals) | ||
internals.settings.setAllowDisplayOfInsecureContent(true); | ||
|
||
window.onmessage = function(event) { | ||
referrer = event.data.referrer; | ||
// Should be the empty string | ||
shouldBeEqualToString("referrer", ""); | ||
finishJSTest(); | ||
} | ||
</script> | ||
<iframe src="http://localhost:8000/referrer-policy/resources/document.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
Tests the behavior of no-referrer-when-downgrade referrer policy when same origin. | ||
|
||
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". | ||
|
||
|
||
PASS referrer is "http://127.0.0.1:8000/referrer-policy/no-referrer-when-downgrade/same-origin.html" | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta name='referrer' content='no-referrer-when-downgrade'> | ||
<script src="/js-test-resources/js-test.js"></script> | ||
</head> | ||
<body> | ||
<script> | ||
description("Tests the behavior of no-referrer-when-downgrade referrer policy when same origin."); | ||
jsTestIsAsync = true; | ||
|
||
window.onmessage = function(event) { | ||
referrer = event.data.referrer; | ||
// Should be the full URL | ||
shouldBeEqualToString("referrer", "http://127.0.0.1:8000/referrer-policy/no-referrer-when-downgrade/same-origin.html"); | ||
finishJSTest(); | ||
} | ||
</script> | ||
<iframe src="http://127.0.0.1:8000/referrer-policy/resources/document.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
Tests the behavior of no-referrer referrer policy when cross origin. | ||
|
||
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". | ||
|
||
|
||
PASS referrer is "" | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta name='referrer' content='no-referrer'> | ||
<script src="/js-test-resources/js-test.js"></script> | ||
</head> | ||
<body> | ||
<script> | ||
description("Tests the behavior of no-referrer referrer policy when cross origin."); | ||
jsTestIsAsync = true; | ||
|
||
window.onmessage = function(event) { | ||
referrer = event.data.referrer; | ||
// Should be the empty string | ||
shouldBeEqualToString("referrer", ""); | ||
finishJSTest(); | ||
} | ||
</script> | ||
<iframe src="http://localhost:8000/referrer-policy/resources/document.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
CONSOLE MESSAGE: The page at about:blank was allowed to display insecure content from http://localhost:8000/referrer-policy/resources/document.html. | ||
|
||
Tests the behavior of no-referrer referrer policy when cross origin from HTTPS to HTTP. | ||
|
||
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". | ||
|
||
|
||
PASS referrer is "" | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta name='referrer' content='no-referrer'> | ||
<script src="/js-test-resources/js-test.js"></script> | ||
</head> | ||
<body> | ||
<script> | ||
description("Tests the behavior of no-referrer referrer policy when cross origin from HTTPS to HTTP."); | ||
jsTestIsAsync = true; | ||
|
||
if (window.internals) | ||
internals.settings.setAllowDisplayOfInsecureContent(true); | ||
|
||
window.onmessage = function(event) { | ||
referrer = event.data.referrer; | ||
// Should be the empty string | ||
shouldBeEqualToString("referrer", ""); | ||
finishJSTest(); | ||
} | ||
</script> | ||
<iframe src="http://localhost:8000/referrer-policy/resources/document.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
Tests the behavior of no-referrer referrer policy when same origin. | ||
|
||
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". | ||
|
||
|
||
PASS referrer is "" | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta name='referrer' content='no-referrer'> | ||
<script src="/js-test-resources/js-test.js"></script> | ||
</head> | ||
<body> | ||
<script> | ||
description("Tests the behavior of no-referrer referrer policy when same origin."); | ||
jsTestIsAsync = true; | ||
|
||
window.onmessage = function(event) { | ||
referrer = event.data.referrer; | ||
// Should be the empty string | ||
shouldBeEqualToString("referrer", ""); | ||
finishJSTest(); | ||
} | ||
</script> | ||
<iframe src="http://127.0.0.1:8000/referrer-policy/resources/document.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
Tests the behavior of origin referrer policy when cross origin. | ||
|
||
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". | ||
|
||
|
||
PASS referrer is "http://127.0.0.1:8000/" | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta name='referrer' content='origin'> | ||
<script src="/js-test-resources/js-test.js"></script> | ||
</head> | ||
<body> | ||
<script> | ||
description("Tests the behavior of origin referrer policy when cross origin."); | ||
jsTestIsAsync = true; | ||
|
||
window.onmessage = function(event) { | ||
referrer = event.data.referrer; | ||
// Should be the origin | ||
shouldBeEqualToString("referrer", "http://127.0.0.1:8000/"); | ||
finishJSTest(); | ||
} | ||
</script> | ||
<iframe src="http://localhost:8000/referrer-policy/resources/document.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
CONSOLE MESSAGE: The page at about:blank was allowed to display insecure content from http://localhost:8000/referrer-policy/resources/document.html. | ||
|
||
Tests the behavior of origin referrer policy when cross origin from HTTPS to HTTP. | ||
|
||
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". | ||
|
||
|
||
PASS referrer is "https://127.0.0.1:8443/" | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta name='referrer' content='origin'> | ||
<script src="/js-test-resources/js-test.js"></script> | ||
</head> | ||
<body> | ||
<script> | ||
description("Tests the behavior of origin referrer policy when cross origin from HTTPS to HTTP."); | ||
jsTestIsAsync = true; | ||
|
||
if (window.internals) | ||
internals.settings.setAllowDisplayOfInsecureContent(true); | ||
|
||
window.onmessage = function(event) { | ||
referrer = event.data.referrer; | ||
// Should be the origin | ||
shouldBeEqualToString("referrer", "https://127.0.0.1:8443/"); | ||
finishJSTest(); | ||
} | ||
</script> | ||
<iframe src="http://localhost:8000/referrer-policy/resources/document.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
Tests the behavior of origin referrer policy when same origin. | ||
|
||
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". | ||
|
||
|
||
PASS referrer is "http://127.0.0.1:8000/" | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta name='referrer' content='origin'> | ||
<script src="/js-test-resources/js-test.js"></script> | ||
</head> | ||
<body> | ||
<script> | ||
description("Tests the behavior of origin referrer policy when same origin."); | ||
jsTestIsAsync = true; | ||
|
||
window.onmessage = function(event) { | ||
referrer = event.data.referrer; | ||
// Should be the origin | ||
shouldBeEqualToString("referrer", "http://127.0.0.1:8000/"); | ||
finishJSTest(); | ||
} | ||
</script> | ||
<iframe src="http://127.0.0.1:8000/referrer-policy/resources/document.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
Tests the behavior of unsafe-url referrer policy when cross origin. | ||
|
||
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". | ||
|
||
|
||
PASS referrer is "http://127.0.0.1:8000/referrer-policy/unsafe-url/cross-origin-http-http.html" | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta name='referrer' content='unsafe-url'> | ||
<script src="/js-test-resources/js-test.js"></script> | ||
</head> | ||
<body> | ||
<script> | ||
description("Tests the behavior of unsafe-url referrer policy when cross origin."); | ||
jsTestIsAsync = true; | ||
|
||
window.onmessage = function(event) { | ||
referrer = event.data.referrer; | ||
// Should be the full URL | ||
shouldBeEqualToString("referrer", "http://127.0.0.1:8000/referrer-policy/unsafe-url/cross-origin-http-http.html"); | ||
finishJSTest(); | ||
} | ||
</script> | ||
<iframe src="http://localhost:8000/referrer-policy/resources/document.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
CONSOLE MESSAGE: The page at about:blank was allowed to display insecure content from http://localhost:8000/referrer-policy/resources/document.html. | ||
|
||
Tests the behavior of unsafe-url referrer policy when cross origin from HTTPS to HTTP. | ||
|
||
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". | ||
|
||
|
||
PASS referrer is "https://127.0.0.1:8443/referrer-policy/unsafe-url/cross-origin-http.https.html" | ||
PASS successfullyParsed is true | ||
|
||
TEST COMPLETE | ||
|
Oops, something went wrong.