blob: a4d683840456070d328a52d1a33fcb4931737934 [file] [log] [blame]
<!DOCTYPE html>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<script src="../resources/mojo-helpers.js"></script>
<script src="resources/payment-request-mock.js"></script>
<script>
var details = {
total:
{
label: 'Total',
amount: {currency: 'USD', value: '55.00'}, // US$55.00
}
};
var response_data = {
method_name: 'visa',
stringified_details: '{}'
};
promise_test(t => {
var mock;
var completeResult;
return paymentRequestMock
.then(m => {
mock = m;
var result = new PaymentRequest([{'supportedMethods': ['visa']}], details).show();
gc();
mock.onPaymentResponse(response_data);
return result;
})
.then(response => {
completeResult = response.complete("success");
// Return before calling gc() to make sure reference to response
// is gone.
})
.then(() => {
gc();
mock.onComplete();
return completeResult;
});
}, 'Promises resolve even without references to request or response.');
</script>