Add referrer-policy tests
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 6 Mar 2019 07:37:20 +0000 (07:37 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 6 Mar 2019 07:37:20 +0000 (07:37 +0000)
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.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@242531 268f45cc-cd09-0410-ab3c-d52691b4dbfc

25 files changed:
LayoutTests/ChangeLog
LayoutTests/http/tests/referrer-policy/no-referrer-when-downgrade/cross-origin-http-http-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/referrer-policy/no-referrer-when-downgrade/cross-origin-http-http.html [new file with mode: 0644]
LayoutTests/http/tests/referrer-policy/no-referrer-when-downgrade/cross-origin-http.https-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/referrer-policy/no-referrer-when-downgrade/cross-origin-http.https.html [new file with mode: 0644]
LayoutTests/http/tests/referrer-policy/no-referrer-when-downgrade/same-origin-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/referrer-policy/no-referrer-when-downgrade/same-origin.html [new file with mode: 0644]
LayoutTests/http/tests/referrer-policy/no-referrer/cross-origin-http-http-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/referrer-policy/no-referrer/cross-origin-http-http.html [new file with mode: 0644]
LayoutTests/http/tests/referrer-policy/no-referrer/cross-origin-http.https-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/referrer-policy/no-referrer/cross-origin-http.https.html [new file with mode: 0644]
LayoutTests/http/tests/referrer-policy/no-referrer/same-origin-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/referrer-policy/no-referrer/same-origin.html [new file with mode: 0644]
LayoutTests/http/tests/referrer-policy/origin/cross-origin-http-http-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/referrer-policy/origin/cross-origin-http-http.html [new file with mode: 0644]
LayoutTests/http/tests/referrer-policy/origin/cross-origin-http.https-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/referrer-policy/origin/cross-origin-http.https.html [new file with mode: 0644]
LayoutTests/http/tests/referrer-policy/origin/same-origin-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/referrer-policy/origin/same-origin.html [new file with mode: 0644]
LayoutTests/http/tests/referrer-policy/unsafe-url/cross-origin-http-http-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/referrer-policy/unsafe-url/cross-origin-http-http.html [new file with mode: 0644]
LayoutTests/http/tests/referrer-policy/unsafe-url/cross-origin-http.https-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/referrer-policy/unsafe-url/cross-origin-http.https.html [new file with mode: 0644]
LayoutTests/http/tests/referrer-policy/unsafe-url/same-origin-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/referrer-policy/unsafe-url/same-origin.html [new file with mode: 0644]

index b606c4e..046cbb5 100644 (file)
@@ -1,3 +1,38 @@
+2019-03-05  Rob Buis  <rbuis@igalia.com>
+
+        Add referrer-policy tests
+        https://bugs.webkit.org/show_bug.cgi?id=195269
+
+        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.
+
 2019-03-05  Eric Liang  <ericliang@apple.com>
 
         AX: Add remote search support for keyboard focusable element search type
diff --git a/LayoutTests/http/tests/referrer-policy/no-referrer-when-downgrade/cross-origin-http-http-expected.txt b/LayoutTests/http/tests/referrer-policy/no-referrer-when-downgrade/cross-origin-http-http-expected.txt
new file mode 100644 (file)
index 0000000..4ee58e5
--- /dev/null
@@ -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
+
diff --git a/LayoutTests/http/tests/referrer-policy/no-referrer-when-downgrade/cross-origin-http-http.html b/LayoutTests/http/tests/referrer-policy/no-referrer-when-downgrade/cross-origin-http-http.html
new file mode 100644 (file)
index 0000000..08086d0
--- /dev/null
@@ -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>
diff --git a/LayoutTests/http/tests/referrer-policy/no-referrer-when-downgrade/cross-origin-http.https-expected.txt b/LayoutTests/http/tests/referrer-policy/no-referrer-when-downgrade/cross-origin-http.https-expected.txt
new file mode 100644 (file)
index 0000000..5f2f410
--- /dev/null
@@ -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
+
diff --git a/LayoutTests/http/tests/referrer-policy/no-referrer-when-downgrade/cross-origin-http.https.html b/LayoutTests/http/tests/referrer-policy/no-referrer-when-downgrade/cross-origin-http.https.html
new file mode 100644 (file)
index 0000000..ab4b2e2
--- /dev/null
@@ -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>
diff --git a/LayoutTests/http/tests/referrer-policy/no-referrer-when-downgrade/same-origin-expected.txt b/LayoutTests/http/tests/referrer-policy/no-referrer-when-downgrade/same-origin-expected.txt
new file mode 100644 (file)
index 0000000..46dc21b
--- /dev/null
@@ -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
+
diff --git a/LayoutTests/http/tests/referrer-policy/no-referrer-when-downgrade/same-origin.html b/LayoutTests/http/tests/referrer-policy/no-referrer-when-downgrade/same-origin.html
new file mode 100644 (file)
index 0000000..a39e691
--- /dev/null
@@ -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>
diff --git a/LayoutTests/http/tests/referrer-policy/no-referrer/cross-origin-http-http-expected.txt b/LayoutTests/http/tests/referrer-policy/no-referrer/cross-origin-http-http-expected.txt
new file mode 100644 (file)
index 0000000..17d7c3e
--- /dev/null
@@ -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
+
diff --git a/LayoutTests/http/tests/referrer-policy/no-referrer/cross-origin-http-http.html b/LayoutTests/http/tests/referrer-policy/no-referrer/cross-origin-http-http.html
new file mode 100644 (file)
index 0000000..f227701
--- /dev/null
@@ -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>
diff --git a/LayoutTests/http/tests/referrer-policy/no-referrer/cross-origin-http.https-expected.txt b/LayoutTests/http/tests/referrer-policy/no-referrer/cross-origin-http.https-expected.txt
new file mode 100644 (file)
index 0000000..a306d6c
--- /dev/null
@@ -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
+
diff --git a/LayoutTests/http/tests/referrer-policy/no-referrer/cross-origin-http.https.html b/LayoutTests/http/tests/referrer-policy/no-referrer/cross-origin-http.https.html
new file mode 100644 (file)
index 0000000..8637f78
--- /dev/null
@@ -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>
diff --git a/LayoutTests/http/tests/referrer-policy/no-referrer/same-origin-expected.txt b/LayoutTests/http/tests/referrer-policy/no-referrer/same-origin-expected.txt
new file mode 100644 (file)
index 0000000..19114a6
--- /dev/null
@@ -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
+
diff --git a/LayoutTests/http/tests/referrer-policy/no-referrer/same-origin.html b/LayoutTests/http/tests/referrer-policy/no-referrer/same-origin.html
new file mode 100644 (file)
index 0000000..e43411e
--- /dev/null
@@ -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>
diff --git a/LayoutTests/http/tests/referrer-policy/origin/cross-origin-http-http-expected.txt b/LayoutTests/http/tests/referrer-policy/origin/cross-origin-http-http-expected.txt
new file mode 100644 (file)
index 0000000..83c2309
--- /dev/null
@@ -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
+
diff --git a/LayoutTests/http/tests/referrer-policy/origin/cross-origin-http-http.html b/LayoutTests/http/tests/referrer-policy/origin/cross-origin-http-http.html
new file mode 100644 (file)
index 0000000..de4cf23
--- /dev/null
@@ -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>
diff --git a/LayoutTests/http/tests/referrer-policy/origin/cross-origin-http.https-expected.txt b/LayoutTests/http/tests/referrer-policy/origin/cross-origin-http.https-expected.txt
new file mode 100644 (file)
index 0000000..fdd8b92
--- /dev/null
@@ -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
+
diff --git a/LayoutTests/http/tests/referrer-policy/origin/cross-origin-http.https.html b/LayoutTests/http/tests/referrer-policy/origin/cross-origin-http.https.html
new file mode 100644 (file)
index 0000000..0d892ed
--- /dev/null
@@ -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>
diff --git a/LayoutTests/http/tests/referrer-policy/origin/same-origin-expected.txt b/LayoutTests/http/tests/referrer-policy/origin/same-origin-expected.txt
new file mode 100644 (file)
index 0000000..f59fc57
--- /dev/null
@@ -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
+
diff --git a/LayoutTests/http/tests/referrer-policy/origin/same-origin.html b/LayoutTests/http/tests/referrer-policy/origin/same-origin.html
new file mode 100644 (file)
index 0000000..fe88458
--- /dev/null
@@ -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>
diff --git a/LayoutTests/http/tests/referrer-policy/unsafe-url/cross-origin-http-http-expected.txt b/LayoutTests/http/tests/referrer-policy/unsafe-url/cross-origin-http-http-expected.txt
new file mode 100644 (file)
index 0000000..23c45c3
--- /dev/null
@@ -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
+
diff --git a/LayoutTests/http/tests/referrer-policy/unsafe-url/cross-origin-http-http.html b/LayoutTests/http/tests/referrer-policy/unsafe-url/cross-origin-http-http.html
new file mode 100644 (file)
index 0000000..36eeb63
--- /dev/null
@@ -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>
diff --git a/LayoutTests/http/tests/referrer-policy/unsafe-url/cross-origin-http.https-expected.txt b/LayoutTests/http/tests/referrer-policy/unsafe-url/cross-origin-http.https-expected.txt
new file mode 100644 (file)
index 0000000..2d34be7
--- /dev/null
@@ -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
+
diff --git a/LayoutTests/http/tests/referrer-policy/unsafe-url/cross-origin-http.https.html b/LayoutTests/http/tests/referrer-policy/unsafe-url/cross-origin-http.https.html
new file mode 100644 (file)
index 0000000..4c391a3
--- /dev/null
@@ -0,0 +1,24 @@
+<!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 from HTTPS to HTTP.");
+jsTestIsAsync = true;
+
+if (window.internals)
+    internals.settings.setAllowDisplayOfInsecureContent(true);
+
+window.onmessage = function(event) {
+    referrer = event.data.referrer;
+    // Should be the full URL
+    shouldBeEqualToString("referrer", "https://127.0.0.1:8443/referrer-policy/unsafe-url/cross-origin-http.https.html");
+    finishJSTest();
+}
+</script>
+<iframe src="http://localhost:8000/referrer-policy/resources/document.html"></iframe>
+</body>
+</html>
diff --git a/LayoutTests/http/tests/referrer-policy/unsafe-url/same-origin-expected.txt b/LayoutTests/http/tests/referrer-policy/unsafe-url/same-origin-expected.txt
new file mode 100644 (file)
index 0000000..bd218b3
--- /dev/null
@@ -0,0 +1,10 @@
+Tests the behavior of unsafe-url 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/unsafe-url/same-origin.html"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/http/tests/referrer-policy/unsafe-url/same-origin.html b/LayoutTests/http/tests/referrer-policy/unsafe-url/same-origin.html
new file mode 100644 (file)
index 0000000..f6b97a7
--- /dev/null
@@ -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 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/unsafe-url/same-origin.html");
+    finishJSTest();
+}
+</script>
+<iframe src="http://127.0.0.1:8000/referrer-policy/resources/document.html"></iframe>
+</body>
+</html>