Skip to content

Commit 6736338

Browse files
committed
Add a same-origin variant of active document test
1 parent a6087b9 commit 6736338

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<!doctype html>
2+
<title>PaymentRequest &lt;iframe allowpaymentrequest> in non-active document (same-origin)</title>
3+
<script src=/resources/testharness.js></script>
4+
<script src=/resources/testharnessreport.js></script>
5+
<script src=/common/utils.js></script>
6+
<iframe id="iframe" allowpaymentrequest></iframe>
7+
<script>
8+
async_test((t) => {
9+
const iframe = document.getElementById('iframe');
10+
const paymentArgs = [[{supportedMethods: ['foo']}], {total: {label: 'label', amount: {currency: 'USD', value: '5.00'}}}];
11+
12+
onload = () => {
13+
const win = window[0];
14+
const grabbedPaymentRequest = win.PaymentRequest;
15+
win.location.href = '/common/blank.html';
16+
iframe.onload = t.step_func_done(() => {
17+
assert_throws({name: 'SecurityError'}, () => {
18+
new grabbedPaymentRequest(...paymentArgs);
19+
});
20+
});
21+
}
22+
});
23+
</script>

0 commit comments

Comments
 (0)