Skip to content

Commit 70f5f94

Browse files
authored
Merge 9f91238 into 04b3b0d
2 parents 04b3b0d + 9f91238 commit 70f5f94

File tree

4 files changed

+80
-0
lines changed

4 files changed

+80
-0
lines changed
+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<!DOCTYPE html>
2+
<title>Element ready check for containing iframe, element's document is not the active document</title>
3+
<script src="/resources/testharness.js"></script>
4+
<script src="/resources/testharnessreport.js"></script>
5+
<script src="../trusted-click.js"></script>
6+
<div id="log"></div>
7+
<iframe allowfullscreen></iframe>
8+
<script>
9+
async_test((t) => {
10+
onload = () => {
11+
var iframes = document.getElementsByTagName("iframe");
12+
trusted_request(iframes[0].contentDocument.body, document.body);
13+
window[0].location.href = '/common/blank.html';
14+
iframes[0].contentDocument.onfullscreenchange = t.unreached_func("fullscreenchange event");
15+
iframes[0].contentDocument.onfullscreenerror = t.step_func_done();
16+
};
17+
});
18+
</script>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<!doctype html>
2+
<title>PaymentRequest &lt;iframe allowpaymentrequest> in non-active document (cross-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 = make_absolute_url({
16+
hostname: '{{domains[www1]}}',
17+
path: '/common/blank.html'
18+
});
19+
iframe.onload = t.step_func_done(() => {
20+
assert_throws({name: 'SecurityError'}, () => {
21+
new grabbedPaymentRequest(...paymentArgs);
22+
});
23+
});
24+
}
25+
});
26+
</script>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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+
<iframe id="iframe" allowpaymentrequest></iframe>
6+
<script>
7+
async_test((t) => {
8+
const iframe = document.getElementById('iframe');
9+
const paymentArgs = [[{supportedMethods: ['foo']}], {total: {label: 'label', amount: {currency: 'USD', value: '5.00'}}}];
10+
11+
onload = () => {
12+
const win = window[0];
13+
const grabbedPaymentRequest = win.PaymentRequest;
14+
win.location.href = '/common/blank.html';
15+
iframe.onload = t.step_func_done(() => {
16+
assert_throws({name: 'SecurityError'}, () => {
17+
new grabbedPaymentRequest(...paymentArgs);
18+
});
19+
});
20+
}
21+
});
22+
</script>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<!doctype html>
2+
<title>PaymentRequest &lt;iframe allowpaymentrequest> basic</title>
3+
<script src=/resources/testharness.js></script>
4+
<script src=/resources/testharnessreport.js></script>
5+
<iframe id="iframe" allowpaymentrequest></iframe>
6+
<script>
7+
async_test((t) => {
8+
const paymentArgs = [[{supportedMethods: ['foo']}], {total: {label: 'label', amount: {currency: 'USD', value: '5.00'}}}];
9+
10+
onload = t.step_func_done(() => {
11+
new window[0].PaymentRequest(...paymentArgs);
12+
});
13+
});
14+
</script>

0 commit comments

Comments
 (0)