Referrer policy should be inherited from creator
authordbates@webkit.org <dbates@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 19 Oct 2017 20:17:42 +0000 (20:17 +0000)
committerdbates@webkit.org <dbates@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 19 Oct 2017 20:17:42 +0000 (20:17 +0000)
https://bugs.webkit.org/show_bug.cgi?id=178403
<rdar://problem/31546136>

Add missing file that I inadvertently forgot to commit in r223697. The tests depend on this file.

* http/tests/security/resources/nested-referrer-policy-postmessage.html: Added.

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

LayoutTests/ChangeLog
LayoutTests/http/tests/security/resources/nested-referrer-policy-postmessage.html [new file with mode: 0644]

index 3c615b9..1140aa0 100644 (file)
@@ -1,3 +1,13 @@
+2017-10-19  Daniel Bates  <dabates@apple.com>
+
+        Referrer policy should be inherited from creator
+        https://bugs.webkit.org/show_bug.cgi?id=178403
+        <rdar://problem/31546136>
+
+        Add missing file that I inadvertently forgot to commit in r223697. The tests depend on this file.
+
+        * http/tests/security/resources/nested-referrer-policy-postmessage.html: Added.
+
 2017-10-19  Matt Lewis  <jlewis3@apple.com>
 
         Marked http/tests/resourceLoadStatistics/prevalent-resource-handled-keydown.html as flaky.
diff --git a/LayoutTests/http/tests/security/resources/nested-referrer-policy-postmessage.html b/LayoutTests/http/tests/security/resources/nested-referrer-policy-postmessage.html
new file mode 100644 (file)
index 0000000..9f11dbf
--- /dev/null
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+function ownerWindow()
+{
+    var owner = window.parent;
+    if (owner === this)
+        owner = window.opener;
+    return owner;
+}
+
+function receiveMessage(messageEvent)
+{
+    if (messageEvent.source !== ownerWindow())
+        ownerWindow().postMessage(messageEvent.data, "*"); // Forward to owner
+    else {
+        // From owner
+        if (messageEvent.data === "new-window")
+            window.open("referrer-policy-postmessage.php");
+        else if (messageEvent.data === "new-subframe") {
+            var subframe = document.createElement("iframe");
+            subframe.src = "referrer-policy-postmessage.php";
+            document.body.appendChild(subframe);
+        }
+    }
+}
+
+window.addEventListener("message", receiveMessage, false);
+ownerWindow().postMessage("ready", "*");
+</script>
+</head>
+</html>