Skip to content

Commit 44c2fc8

Browse files
committed
Add test case for Cross-Origin-Opener-Policy header
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.
1 parent 4423e4f commit 44c2fc8

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<!-- Header: Cross-Origin-Opener-Policy: same-origin -->
2+
<html>
3+
<head>
4+
<title>Cross-Origin-Opener-Policy test document</title>
5+
<style>
6+
body {
7+
font-family: sans-serif;
8+
font-size: 1rem;
9+
line-height: 1.5rem;
10+
}
11+
main {
12+
max-width: 600px;
13+
margin-top: 1rem;
14+
}
15+
</style>
16+
</head>
17+
<body>
18+
<main>
19+
<h1>Cross-Origin-Opener-Policy test</h1>
20+
<p>
21+
This page tests the client on a document which is served with a
22+
<a
23+
href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cross-Origin-Opener-Policy"
24+
><code>Cross-Origin-Opener-Policy: same-origin</code></a
25+
>
26+
header. This header prevents popup windows from accessing their opener
27+
using
28+
<a href="https://developer.mozilla.org/en-US/docs/Web/API/Window/opener"
29+
><code>window.opener</code></a
30+
>, which affects the client's login popup.
31+
</p>
32+
{{{ hypothesisScript }}}
33+
</main>
34+
</body>
35+
</html>

dev-server/templates/index.mustache

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
<ul>
3030
<li><a href="/document/z-index">Content with high <code>z-index</code> style</a></li>
3131
<li><a href="/document/shadow-dom">Content in shadow DOM</a></li>
32+
<li><a href="/document/coop-test"><code>Cross-Origin-Opener-Policy</code> test</a></li>
3233
<li><a href="/document/host-in-shadow-root">Hypothesis loaded into frame in shadow root</a></li>
3334
<li><a href="/document/parent-frame">Annotation-enabled iframe</a></li>
3435
<li><a href="/document/sidebar-external-container">Sidebar in external container</a></li>

0 commit comments

Comments
 (0)