Import WPT tests to verify pings do not send a referrer header
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 2 Feb 2020 10:20:09 +0000 (10:20 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 2 Feb 2020 10:20:09 +0000 (10:20 +0000)
https://bugs.webkit.org/show_bug.cgi?id=207090

Patch by Rob Buis <rbuis@igalia.com> on 2020-02-02
Reviewed by Darin Adler.

Import WPT tests to verify pings do not send a referrer header.

* resources/import-expectations.json:
* web-platform-tests/html/semantics/links/downloading-resources/contains.json: Removed.
* web-platform-tests/html/semantics/links/downloading-resources/header-referrer-expected.txt: Added.
* web-platform-tests/html/semantics/links/downloading-resources/header-referrer-no-referrer-expected.txt: Added.
* web-platform-tests/html/semantics/links/downloading-resources/header-referrer-no-referrer-when-downgrade-expected.txt: Added.
* web-platform-tests/html/semantics/links/downloading-resources/header-referrer-no-referrer-when-downgrade.html: Added.
* web-platform-tests/html/semantics/links/downloading-resources/header-referrer-no-referrer.html: Added.
* web-platform-tests/html/semantics/links/downloading-resources/header-referrer-origin-expected.txt: Added.
* web-platform-tests/html/semantics/links/downloading-resources/header-referrer-origin-when-cross-origin-expected.txt: Added.
* web-platform-tests/html/semantics/links/downloading-resources/header-referrer-origin-when-cross-origin.html: Added.
* web-platform-tests/html/semantics/links/downloading-resources/header-referrer-origin.html: Added.
* web-platform-tests/html/semantics/links/downloading-resources/header-referrer-same-origin-expected.txt: Added.
* web-platform-tests/html/semantics/links/downloading-resources/header-referrer-same-origin.html: Added.
* web-platform-tests/html/semantics/links/downloading-resources/header-referrer-strict-origin-expected.txt: Added.
* web-platform-tests/html/semantics/links/downloading-resources/header-referrer-strict-origin-when-cross-origin-expected.txt: Added.
* web-platform-tests/html/semantics/links/downloading-resources/header-referrer-strict-origin-when-cross-origin.html: Added.
* web-platform-tests/html/semantics/links/downloading-resources/header-referrer-strict-origin.html: Added.
* web-platform-tests/html/semantics/links/downloading-resources/header-referrer-unsafe-url-expected.txt: Added.
* web-platform-tests/html/semantics/links/downloading-resources/header-referrer-unsafe-url.html: Added.
* web-platform-tests/html/semantics/links/downloading-resources/header-referrer.html: Added.
* web-platform-tests/html/semantics/links/downloading-resources/header-referrer.js: Added.
(testReferrerHeader):
(pollResult.return.new.Promise.):
(pollResult.return.new.Promise):
* web-platform-tests/html/semantics/links/downloading-resources/resources/inspect-header.py: Added.
(main):
* web-platform-tests/html/semantics/links/downloading-resources/resources/w3c-import.log: Copied from LayoutTests/imported/w3c/web-platform-tests/html/semantics/links/downloading-resources/w3c-import.log.
* web-platform-tests/html/semantics/links/downloading-resources/w3c-import.log:

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

25 files changed:
LayoutTests/imported/w3c/ChangeLog
LayoutTests/imported/w3c/resources/import-expectations.json
LayoutTests/imported/w3c/web-platform-tests/html/semantics/links/downloading-resources/contains.json [deleted file]
LayoutTests/imported/w3c/web-platform-tests/html/semantics/links/downloading-resources/header-referrer-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/html/semantics/links/downloading-resources/header-referrer-no-referrer-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/html/semantics/links/downloading-resources/header-referrer-no-referrer-when-downgrade-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/html/semantics/links/downloading-resources/header-referrer-no-referrer-when-downgrade.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/html/semantics/links/downloading-resources/header-referrer-no-referrer.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/html/semantics/links/downloading-resources/header-referrer-origin-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/html/semantics/links/downloading-resources/header-referrer-origin-when-cross-origin-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/html/semantics/links/downloading-resources/header-referrer-origin-when-cross-origin.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/html/semantics/links/downloading-resources/header-referrer-origin.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/html/semantics/links/downloading-resources/header-referrer-same-origin-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/html/semantics/links/downloading-resources/header-referrer-same-origin.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/html/semantics/links/downloading-resources/header-referrer-strict-origin-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/html/semantics/links/downloading-resources/header-referrer-strict-origin-when-cross-origin-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/html/semantics/links/downloading-resources/header-referrer-strict-origin-when-cross-origin.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/html/semantics/links/downloading-resources/header-referrer-strict-origin.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/html/semantics/links/downloading-resources/header-referrer-unsafe-url-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/html/semantics/links/downloading-resources/header-referrer-unsafe-url.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/html/semantics/links/downloading-resources/header-referrer.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/html/semantics/links/downloading-resources/header-referrer.js [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/html/semantics/links/downloading-resources/resources/inspect-header.py [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/html/semantics/links/downloading-resources/resources/w3c-import.log [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/html/semantics/links/downloading-resources/w3c-import.log

index 4066356..fc53f84 100644 (file)
@@ -1,3 +1,41 @@
+2020-02-02  Rob Buis  <rbuis@igalia.com>
+
+        Import WPT tests to verify pings do not send a referrer header
+        https://bugs.webkit.org/show_bug.cgi?id=207090
+
+        Reviewed by Darin Adler.
+
+        Import WPT tests to verify pings do not send a referrer header.
+
+        * resources/import-expectations.json:
+        * web-platform-tests/html/semantics/links/downloading-resources/contains.json: Removed.
+        * web-platform-tests/html/semantics/links/downloading-resources/header-referrer-expected.txt: Added.
+        * web-platform-tests/html/semantics/links/downloading-resources/header-referrer-no-referrer-expected.txt: Added.
+        * web-platform-tests/html/semantics/links/downloading-resources/header-referrer-no-referrer-when-downgrade-expected.txt: Added.
+        * web-platform-tests/html/semantics/links/downloading-resources/header-referrer-no-referrer-when-downgrade.html: Added.
+        * web-platform-tests/html/semantics/links/downloading-resources/header-referrer-no-referrer.html: Added.
+        * web-platform-tests/html/semantics/links/downloading-resources/header-referrer-origin-expected.txt: Added.
+        * web-platform-tests/html/semantics/links/downloading-resources/header-referrer-origin-when-cross-origin-expected.txt: Added.
+        * web-platform-tests/html/semantics/links/downloading-resources/header-referrer-origin-when-cross-origin.html: Added.
+        * web-platform-tests/html/semantics/links/downloading-resources/header-referrer-origin.html: Added.
+        * web-platform-tests/html/semantics/links/downloading-resources/header-referrer-same-origin-expected.txt: Added.
+        * web-platform-tests/html/semantics/links/downloading-resources/header-referrer-same-origin.html: Added.
+        * web-platform-tests/html/semantics/links/downloading-resources/header-referrer-strict-origin-expected.txt: Added.
+        * web-platform-tests/html/semantics/links/downloading-resources/header-referrer-strict-origin-when-cross-origin-expected.txt: Added.
+        * web-platform-tests/html/semantics/links/downloading-resources/header-referrer-strict-origin-when-cross-origin.html: Added.
+        * web-platform-tests/html/semantics/links/downloading-resources/header-referrer-strict-origin.html: Added.
+        * web-platform-tests/html/semantics/links/downloading-resources/header-referrer-unsafe-url-expected.txt: Added.
+        * web-platform-tests/html/semantics/links/downloading-resources/header-referrer-unsafe-url.html: Added.
+        * web-platform-tests/html/semantics/links/downloading-resources/header-referrer.html: Added.
+        * web-platform-tests/html/semantics/links/downloading-resources/header-referrer.js: Added.
+        (testReferrerHeader):
+        (pollResult.return.new.Promise.):
+        (pollResult.return.new.Promise):
+        * web-platform-tests/html/semantics/links/downloading-resources/resources/inspect-header.py: Added.
+        (main):
+        * web-platform-tests/html/semantics/links/downloading-resources/resources/w3c-import.log: Copied from LayoutTests/imported/w3c/web-platform-tests/html/semantics/links/downloading-resources/w3c-import.log.
+        * web-platform-tests/html/semantics/links/downloading-resources/w3c-import.log:
+
 2020-01-30  Rossana Monteriso  <rmonteriso@igalia.com>
 
         [css-grid] Move grid-item-alignment tests to WPT folder
index a3a6dd5..e7fbc8c 100644 (file)
     "web-platform-tests/html/semantics/forms/the-textarea-element": "import", 
     "web-platform-tests/html/semantics/interactive-elements/the-details-element/toggleEvent.html": "skip", 
     "web-platform-tests/html/semantics/interactive-elements/the-summary-element": "skip", 
+    "web-platform-tests/html/semantics/links/downloading-resources": "import", 
     "web-platform-tests/html/semantics/links/following-hyperlinks": "skip", 
     "web-platform-tests/html/semantics/links/links-created-by-a-and-area-elements": "skip", 
     "web-platform-tests/html/semantics/scripting-1/the-script-element/execution-timing": "skip", 
     "web-platform-tests/worklets": "skip", 
     "web-platform-tests/x-frame-options": "skip", 
     "web-platform-tests/xhr": "import"
-}
\ No newline at end of file
+}
diff --git a/LayoutTests/imported/w3c/web-platform-tests/html/semantics/links/downloading-resources/contains.json b/LayoutTests/imported/w3c/web-platform-tests/html/semantics/links/downloading-resources/contains.json
deleted file mode 100644 (file)
index b67f855..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-[
-    {
-        "id": "hyperlink-auditing",
-        "original_id": "hyperlink-auditing"
-    }
-]
\ No newline at end of file
diff --git a/LayoutTests/imported/w3c/web-platform-tests/html/semantics/links/downloading-resources/header-referrer-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/html/semantics/links/downloading-resources/header-referrer-expected.txt
new file mode 100644 (file)
index 0000000..8bf345b
--- /dev/null
@@ -0,0 +1,3 @@
+
+PASS Test referer header /html/semantics/links/downloading-resources/resources/ 
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/html/semantics/links/downloading-resources/header-referrer-no-referrer-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/html/semantics/links/downloading-resources/header-referrer-no-referrer-expected.txt
new file mode 100644 (file)
index 0000000..8bf345b
--- /dev/null
@@ -0,0 +1,3 @@
+
+PASS Test referer header /html/semantics/links/downloading-resources/resources/ 
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/html/semantics/links/downloading-resources/header-referrer-no-referrer-when-downgrade-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/html/semantics/links/downloading-resources/header-referrer-no-referrer-when-downgrade-expected.txt
new file mode 100644 (file)
index 0000000..8bf345b
--- /dev/null
@@ -0,0 +1,3 @@
+
+PASS Test referer header /html/semantics/links/downloading-resources/resources/ 
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/html/semantics/links/downloading-resources/header-referrer-no-referrer-when-downgrade.html b/LayoutTests/imported/w3c/web-platform-tests/html/semantics/links/downloading-resources/header-referrer-no-referrer-when-downgrade.html
new file mode 100644 (file)
index 0000000..96c19d1
--- /dev/null
@@ -0,0 +1,20 @@
+<!doctype html>
+<html>
+  <head>
+    <meta charset="utf-8">
+    <title>Ping attribute Referrer Header No Referrer When Downgrade Policy</title>
+    <script src="/resources/testharness.js"></script>
+    <script src="/resources/testharnessreport.js"></script>
+    <meta name='referrer' content='no-referrer-when-downgrade'>
+  </head>
+  <body>
+    <a id="a" href="#">
+    <script src="/common/utils.js"></script>
+    <script src="/common/get-host-info.sub.js"></script>
+    <script src="/resources/chromium/enable-hyperlink-auditing.js"></script>
+    <script src="header-referrer.js"></script>
+    <script>
+      testReferrerHeader("");
+    </script>
+  </body>
+</html>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/html/semantics/links/downloading-resources/header-referrer-no-referrer.html b/LayoutTests/imported/w3c/web-platform-tests/html/semantics/links/downloading-resources/header-referrer-no-referrer.html
new file mode 100644 (file)
index 0000000..0650630
--- /dev/null
@@ -0,0 +1,20 @@
+<!doctype html>
+<html>
+  <head>
+    <meta charset="utf-8">
+    <title>Ping attribute Referrer Header No Referrer Policy</title>
+    <script src="/resources/testharness.js"></script>
+    <script src="/resources/testharnessreport.js"></script>
+    <meta name='referrer' content='no-referrer'>
+  </head>
+  <body>
+    <a id="a" href="#">
+    <script src="/common/utils.js"></script>
+    <script src="/common/get-host-info.sub.js"></script>
+    <script src="/resources/chromium/enable-hyperlink-auditing.js"></script>
+    <script src="header-referrer.js"></script>
+    <script>
+      testReferrerHeader("");
+    </script>
+  </body>
+</html>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/html/semantics/links/downloading-resources/header-referrer-origin-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/html/semantics/links/downloading-resources/header-referrer-origin-expected.txt
new file mode 100644 (file)
index 0000000..8bf345b
--- /dev/null
@@ -0,0 +1,3 @@
+
+PASS Test referer header /html/semantics/links/downloading-resources/resources/ 
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/html/semantics/links/downloading-resources/header-referrer-origin-when-cross-origin-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/html/semantics/links/downloading-resources/header-referrer-origin-when-cross-origin-expected.txt
new file mode 100644 (file)
index 0000000..8bf345b
--- /dev/null
@@ -0,0 +1,3 @@
+
+PASS Test referer header /html/semantics/links/downloading-resources/resources/ 
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/html/semantics/links/downloading-resources/header-referrer-origin-when-cross-origin.html b/LayoutTests/imported/w3c/web-platform-tests/html/semantics/links/downloading-resources/header-referrer-origin-when-cross-origin.html
new file mode 100644 (file)
index 0000000..f039426
--- /dev/null
@@ -0,0 +1,20 @@
+<!doctype html>
+<html>
+  <head>
+    <meta charset="utf-8">
+    <title>Ping attribute Referrer Header Origin When Cross Origin Policy</title>
+    <script src="/resources/testharness.js"></script>
+    <script src="/resources/testharnessreport.js"></script>
+    <meta name='referrer' content='origin-when-cross-origin'>
+  </head>
+  <body>
+    <a id="a" href="#">
+    <script src="/common/utils.js"></script>
+    <script src="/common/get-host-info.sub.js"></script>
+    <script src="/resources/chromium/enable-hyperlink-auditing.js"></script>
+    <script src="header-referrer.js"></script>
+    <script>
+      testReferrerHeader("");
+    </script>
+  </body>
+</html>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/html/semantics/links/downloading-resources/header-referrer-origin.html b/LayoutTests/imported/w3c/web-platform-tests/html/semantics/links/downloading-resources/header-referrer-origin.html
new file mode 100644 (file)
index 0000000..bef4355
--- /dev/null
@@ -0,0 +1,20 @@
+<!doctype html>
+<html>
+  <head>
+    <meta charset="utf-8">
+    <title>Ping attribute Referrer Header Origin Policy</title>
+    <script src="/resources/testharness.js"></script>
+    <script src="/resources/testharnessreport.js"></script>
+    <meta name='referrer' content='origin'>
+  </head>
+  <body>
+    <a id="a" href="#">
+    <script src="/common/utils.js"></script>
+    <script src="/common/get-host-info.sub.js"></script>
+    <script src="/resources/chromium/enable-hyperlink-auditing.js"></script>
+    <script src="header-referrer.js"></script>
+    <script>
+      testReferrerHeader("");
+    </script>
+  </body>
+</html>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/html/semantics/links/downloading-resources/header-referrer-same-origin-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/html/semantics/links/downloading-resources/header-referrer-same-origin-expected.txt
new file mode 100644 (file)
index 0000000..8bf345b
--- /dev/null
@@ -0,0 +1,3 @@
+
+PASS Test referer header /html/semantics/links/downloading-resources/resources/ 
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/html/semantics/links/downloading-resources/header-referrer-same-origin.html b/LayoutTests/imported/w3c/web-platform-tests/html/semantics/links/downloading-resources/header-referrer-same-origin.html
new file mode 100644 (file)
index 0000000..19b2d02
--- /dev/null
@@ -0,0 +1,20 @@
+<!doctype html>
+<html>
+  <head>
+    <meta charset="utf-8">
+    <title>Ping attribute Referrer Header Same Origin Policy</title>
+    <script src="/resources/testharness.js"></script>
+    <script src="/resources/testharnessreport.js"></script>
+    <meta name='referrer' content='same-origin'>
+  </head>
+  <body>
+    <a id="a" href="#">
+    <script src="/common/utils.js"></script>
+    <script src="/common/get-host-info.sub.js"></script>
+    <script src="/resources/chromium/enable-hyperlink-auditing.js"></script>
+    <script src="header-referrer.js"></script>
+    <script>
+      testReferrerHeader("");
+    </script>
+  </body>
+</html>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/html/semantics/links/downloading-resources/header-referrer-strict-origin-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/html/semantics/links/downloading-resources/header-referrer-strict-origin-expected.txt
new file mode 100644 (file)
index 0000000..8bf345b
--- /dev/null
@@ -0,0 +1,3 @@
+
+PASS Test referer header /html/semantics/links/downloading-resources/resources/ 
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/html/semantics/links/downloading-resources/header-referrer-strict-origin-when-cross-origin-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/html/semantics/links/downloading-resources/header-referrer-strict-origin-when-cross-origin-expected.txt
new file mode 100644 (file)
index 0000000..8bf345b
--- /dev/null
@@ -0,0 +1,3 @@
+
+PASS Test referer header /html/semantics/links/downloading-resources/resources/ 
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/html/semantics/links/downloading-resources/header-referrer-strict-origin-when-cross-origin.html b/LayoutTests/imported/w3c/web-platform-tests/html/semantics/links/downloading-resources/header-referrer-strict-origin-when-cross-origin.html
new file mode 100644 (file)
index 0000000..95132ee
--- /dev/null
@@ -0,0 +1,20 @@
+<!doctype html>
+<html>
+  <head>
+    <meta charset="utf-8">
+    <title>Ping attribute Referrer Header Strict Origin When Cross Origin Policy</title>
+    <script src="/resources/testharness.js"></script>
+    <script src="/resources/testharnessreport.js"></script>
+    <meta name='referrer' content='strict-origin-when-cross-origin'>
+  </head>
+  <body>
+    <a id="a" href="#">
+    <script src="/common/utils.js"></script>
+    <script src="/common/get-host-info.sub.js"></script>
+    <script src="/resources/chromium/enable-hyperlink-auditing.js"></script>
+    <script src="header-referrer.js"></script>
+    <script>
+      testReferrerHeader("");
+    </script>
+  </body>
+</html>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/html/semantics/links/downloading-resources/header-referrer-strict-origin.html b/LayoutTests/imported/w3c/web-platform-tests/html/semantics/links/downloading-resources/header-referrer-strict-origin.html
new file mode 100644 (file)
index 0000000..e2678e8
--- /dev/null
@@ -0,0 +1,20 @@
+<!doctype html>
+<html>
+  <head>
+    <meta charset="utf-8">
+    <title>Ping attribute Referrer Header Strict Origin Policy</title>
+    <script src="/resources/testharness.js"></script>
+    <script src="/resources/testharnessreport.js"></script>
+    <meta name='referrer' content='strict-origin'>
+  </head>
+  <body>
+    <a id="a" href="#">
+    <script src="/common/utils.js"></script>
+    <script src="/common/get-host-info.sub.js"></script>
+    <script src="/resources/chromium/enable-hyperlink-auditing.js"></script>
+    <script src="header-referrer.js"></script>
+    <script>
+      testReferrerHeader("");
+    </script>
+  </body>
+</html>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/html/semantics/links/downloading-resources/header-referrer-unsafe-url-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/html/semantics/links/downloading-resources/header-referrer-unsafe-url-expected.txt
new file mode 100644 (file)
index 0000000..8bf345b
--- /dev/null
@@ -0,0 +1,3 @@
+
+PASS Test referer header /html/semantics/links/downloading-resources/resources/ 
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/html/semantics/links/downloading-resources/header-referrer-unsafe-url.html b/LayoutTests/imported/w3c/web-platform-tests/html/semantics/links/downloading-resources/header-referrer-unsafe-url.html
new file mode 100644 (file)
index 0000000..cc3d1dd
--- /dev/null
@@ -0,0 +1,20 @@
+<!doctype html>
+<html>
+  <head>
+    <meta charset="utf-8">
+    <title>Ping attribute Referrer Header Unsafe Url Policy</title>
+    <script src="/resources/testharness.js"></script>
+    <script src="/resources/testharnessreport.js"></script>
+    <meta name='referrer' content='unsafe-url'>
+  </head>
+  <body>
+    <a id="a" href="#">
+    <script src="/common/utils.js"></script>
+    <script src="/common/get-host-info.sub.js"></script>
+    <script src="/resources/chromium/enable-hyperlink-auditing.js"></script>
+    <script src="header-referrer.js"></script>
+    <script>
+      testReferrerHeader("");
+    </script>
+  </body>
+</html>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/html/semantics/links/downloading-resources/header-referrer.html b/LayoutTests/imported/w3c/web-platform-tests/html/semantics/links/downloading-resources/header-referrer.html
new file mode 100644 (file)
index 0000000..5e2d136
--- /dev/null
@@ -0,0 +1,19 @@
+<!doctype html>
+<html>
+  <head>
+    <meta charset="utf-8">
+    <title>Ping attribute no Referrer Header given</title>
+    <script src="/resources/testharness.js"></script>
+    <script src="/resources/testharnessreport.js"></script>
+  </head>
+  <body>
+    <a id="a" href="#">
+    <script src="/common/utils.js"></script>
+    <script src="/common/get-host-info.sub.js"></script>
+    <script src="/resources/chromium/enable-hyperlink-auditing.js"></script>
+    <script src="header-referrer.js"></script>
+    <script>
+      testReferrerHeader("");
+    </script>
+  </body>
+</html>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/html/semantics/links/downloading-resources/header-referrer.js b/LayoutTests/imported/w3c/web-platform-tests/html/semantics/links/downloading-resources/header-referrer.js
new file mode 100644 (file)
index 0000000..818649f
--- /dev/null
@@ -0,0 +1,40 @@
+const RESOURCES_DIR = "/html/semantics/links/downloading-resources/resources/";
+
+function testReferrerHeader(expectedReferrer) {
+  let id = self.token();
+  let testUrl = RESOURCES_DIR + "inspect-header.py?header=referer&cmd=put&id=" + id;
+
+  promise_test(function(test) {
+    const anchor = document.getElementById("a");
+    anchor.setAttribute("ping", testUrl);
+    anchor.click();
+    return pollResult(id) .then(result => {
+      assert_equals(result, expectedReferrer, "Correct referrer header result");
+    });
+  }, "Test referer header " + RESOURCES_DIR);
+}
+
+// Sending a ping is an asynchronous and non-blocking request to a web server.
+// We may have to create a poll loop to get result from server
+function pollResult(id) {
+  let checkUrl = RESOURCES_DIR + "inspect-header.py?header=referer&cmd=get&id=" + id;
+
+  return new Promise(resolve => {
+    function checkResult() {
+      fetch(checkUrl).then(
+        function(response) {
+          assert_equals(response.status, 200, "Inspect header response's status is 200");
+          let result = response.headers.get("x-request-referer");
+
+          if (result != undefined) {
+            resolve(result);
+          } else {
+            step_timeout(checkResult.bind(this), 100);
+          }
+        });
+    }
+
+    checkResult();
+  });
+
+}
diff --git a/LayoutTests/imported/w3c/web-platform-tests/html/semantics/links/downloading-resources/resources/inspect-header.py b/LayoutTests/imported/w3c/web-platform-tests/html/semantics/links/downloading-resources/resources/inspect-header.py
new file mode 100644 (file)
index 0000000..d868ccd
--- /dev/null
@@ -0,0 +1,18 @@
+def main(request, response):
+    headers = [("Content-Type", "text/plain")]
+    command = request.GET.first("cmd").lower()
+    test_id = request.GET.first("id")
+    header = request.GET.first("header")
+    if command == "put":
+        request.server.stash.put(test_id, request.headers.get(header, ""))
+
+    elif command == "get":
+        stashed_header = request.server.stash.take(test_id)
+        if stashed_header is not None:
+            headers.append(("x-request-" + header, stashed_header))
+
+    else:
+        response.set_error(400, "Bad Command")
+        return "ERROR: Bad Command!"
+
+    return headers, ""
diff --git a/LayoutTests/imported/w3c/web-platform-tests/html/semantics/links/downloading-resources/resources/w3c-import.log b/LayoutTests/imported/w3c/web-platform-tests/html/semantics/links/downloading-resources/resources/w3c-import.log
new file mode 100644 (file)
index 0000000..f67d043
--- /dev/null
@@ -0,0 +1,17 @@
+The tests in this directory were imported from the W3C repository.
+Do NOT modify these tests directly in WebKit.
+Instead, create a pull request on the WPT github:
+       https://github.com/web-platform-tests/wpt
+
+Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport
+
+Do NOT modify or remove this file.
+
+------------------------------------------------------------------------
+Properties requiring vendor prefixes:
+None
+Property values requiring vendor prefixes:
+None
+------------------------------------------------------------------------
+List of files:
+/LayoutTests/imported/w3c/web-platform-tests/html/semantics/links/downloading-resources/resources/inspect-header.py
index a9b22cb..c59b0f7 100644 (file)
@@ -1,7 +1,7 @@
 The tests in this directory were imported from the W3C repository.
 Do NOT modify these tests directly in WebKit.
 Instead, create a pull request on the WPT github:
-       https://github.com/w3c/web-platform-tests
+       https://github.com/web-platform-tests/wpt
 
 Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport
 
@@ -14,4 +14,13 @@ Property values requiring vendor prefixes:
 None
 ------------------------------------------------------------------------
 List of files:
-/LayoutTests/imported/w3c/web-platform-tests/html/semantics/links/downloading-resources/contains.json
+/LayoutTests/imported/w3c/web-platform-tests/html/semantics/links/downloading-resources/header-referrer-no-referrer-when-downgrade.html
+/LayoutTests/imported/w3c/web-platform-tests/html/semantics/links/downloading-resources/header-referrer-no-referrer.html
+/LayoutTests/imported/w3c/web-platform-tests/html/semantics/links/downloading-resources/header-referrer-origin-when-cross-origin.html
+/LayoutTests/imported/w3c/web-platform-tests/html/semantics/links/downloading-resources/header-referrer-origin.html
+/LayoutTests/imported/w3c/web-platform-tests/html/semantics/links/downloading-resources/header-referrer-same-origin.html
+/LayoutTests/imported/w3c/web-platform-tests/html/semantics/links/downloading-resources/header-referrer-strict-origin-when-cross-origin.html
+/LayoutTests/imported/w3c/web-platform-tests/html/semantics/links/downloading-resources/header-referrer-strict-origin.html
+/LayoutTests/imported/w3c/web-platform-tests/html/semantics/links/downloading-resources/header-referrer-unsafe-url.html
+/LayoutTests/imported/w3c/web-platform-tests/html/semantics/links/downloading-resources/header-referrer.html
+/LayoutTests/imported/w3c/web-platform-tests/html/semantics/links/downloading-resources/header-referrer.js