Skip to content

Commit

Permalink
Add test case for Cross-Origin-Opener-Policy header
Browse files Browse the repository at this point in the history
Add a test case for pages served with the `Cross-Origin-Opener-Policy:
same-origin` header, which currently breaks the client's login popup.

This reproduces the issue from https://github.com/hypothesis/product-backlog/issues/1333.
  • Loading branch information
robertknight committed Mar 31, 2022
1 parent 9070056 commit 0f69016
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
35 changes: 35 additions & 0 deletions dev-server/documents/html/coop-test.mustache
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<!-- Header: Cross-Origin-Opener-Policy: same-origin -->
<html>
<head>
<title>Cross-Origin-Opener-Policy test document</title>
<style>
body {
font-family: sans-serif;
font-size: 1rem;
line-height: 1.5rem;
}
main {
max-width: 600px;
margin-top: 1rem;
}
</style>
</head>
<body>
<main>
<h1>Cross-Origin-Opener-Policy test</h1>
<p>
This page tests the client on a document which is served with a
<a
href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cross-Origin-Opener-Policy"
><code>Cross-Origin-Opener-Policy: same-origin</code></a
>
header. This header prevents popup windows from accessing their opener
using
<a href="https://developer.mozilla.org/en-US/docs/Web/API/Window/opener"
><code>window.opener</code></a
>, which affects the client's login popup.
</p>
{{{ hypothesisScript }}}
</main>
</body>
</html>
1 change: 1 addition & 0 deletions dev-server/templates/index.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
<ul>
<li><a href="/document/z-index">Content with high <code>z-index</code> style</a></li>
<li><a href="/document/shadow-dom">Content in shadow DOM</a></li>
<li><a href="/document/coop-test"><code>Cross-Origin-Opener-Policy</code> test</a></li>
<li><a href="/document/host-in-shadow-root">Hypothesis loaded into frame in shadow root</a></li>
<li><a href="/document/parent-frame">Annotation-enabled iframe</a></li>
<li><a href="/document/sidebar-external-container">Sidebar in external container</a></li>
Expand Down

0 comments on commit 0f69016

Please sign in to comment.