mirror of
https://github.com/servo/servo
synced 2026-05-11 09:26:59 +02:00
26 lines
912 B
HTML
26 lines
912 B
HTML
<!doctype html>
|
|
<script>
|
|
window.onmessage = (e) => {
|
|
const paymentArgs = [[{supportedMethods: 'foo'}], {total: {label: 'label', amount: {currency: 'USD', value: '5.00'}}}];
|
|
|
|
if (e.data === 'What is the result of new PaymentRequest(...)?') {
|
|
const result = {urlQuery: location.search.substring(1)}; // Used to distinguish subtests
|
|
try {
|
|
new PaymentRequest(...paymentArgs);
|
|
result.message = 'Success';
|
|
e.source.postMessage(result, '*');
|
|
} catch(ex) {
|
|
result.message = 'Exception';
|
|
const isDomException = ex instanceof DOMException;
|
|
const stack = "stack" in ex ? ex.stack : "";
|
|
result.details = [ isDomException, ex.code, ex.name, stack ];
|
|
e.source.postMessage(result, '*');
|
|
}
|
|
} else {
|
|
result.message = 'Incorrect message';
|
|
e.source.postMessage(result, '*');
|
|
}
|
|
}
|
|
</script>
|
|
<p>This page echos the result of new PaymentRequest(...).</p>
|