Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test has a WPT meta file that expects 1 subtest issues.
- This WPT test may be referenced by the following Test IDs:
- /payment-method-manifest/link-header-non-https.https.sub.window.html - WPT Dashboard Interop Dashboard
// META: title=Link header targeting non-HTTPS URL is aborted
// META: script=/common/utils.js
// META: script=/payment-method-manifest/resources/helpers.js
promise_test(async t => {
const testId = token();
const httpManifestUrl = `http://{{host}}:{{ports[http][0]}}/payment-method-manifest/resources/payment-method-manifest.py?id=${testId}`;
const pmiUrl = createPaymentMethodIdentifierUrl(testId, { link: `<${httpManifestUrl}>; rel="payment-method-manifest"` });
const request = new PaymentRequest(
[{ supportedMethods: pmiUrl }],
{ total: { label: 'Total', amount: { currency: 'USD', value: '1.00' } } }
);
try {
await request.canMakePayment();
} catch (err) {}
const logs = await waitForServerAccessLogs(t, testId, 1);
assert_equals(logs.length, 1, 'Browser must issue only 1 server request (HEAD to PMI)');
assert_equals(logs[0].endpoint, 'payment-method-identifier', 'Request must hit PMI URL');
assert_equals(logs[0].method, 'HEAD', 'PMI request must use HEAD method');
}, 'Link header targeting non-HTTPS URL is aborted');