Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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. Canonical link: https://commits.webkit.org/194722@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@223704 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Showing
2 changed files
with
43 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
33 changes: 33 additions & 0 deletions
33
LayoutTests/http/tests/security/resources/nested-referrer-policy-postmessage.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,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> |