⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 264239 in webkit


Ignore:
Timestamp:
Jul 10, 2020, 2:48:27 PM (6 years ago)
Author:
Chris Dumez
Message:

Resync web-platform-tests/payment-request from upstream
​https://bugs.webkit.org/show_bug.cgi?id=214167

Reviewed by Sam Weinig.

LayoutTests/imported/w3c:

Resync web-platform-tests/payment-request from upstream cef93b58e7cf31f1d47c.

  • resources/resource-files.json:
  • web-platform-tests/payment-request/*: Updated.

LayoutTests:

  • tests-options.json:
Location:
trunk/LayoutTests
Files:
25 added
60 edited
1 copied
7 moved

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r264235 r264239  
     12020-07-10  Chris Dumez  <cdumez@apple.com>
     2
     3        Resync web-platform-tests/payment-request from upstream
     4        https://bugs.webkit.org/show_bug.cgi?id=214167
     5
     6        Reviewed by Sam Weinig.
     7
     8        * tests-options.json:
     9
    1102020-07-10  Chris Fleizach  <cfleizach@apple.com>
    211
  • trunk/LayoutTests/TestExpectations

    r264223 r264239  
    337337imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/location-protocol-setter-non-broken-weird.html [ DumpJSConsoleLogInStdErr ]
    338338imported/w3c/web-platform-tests/html/canvas/element/imagebitmap/createImageBitmap-invalid-args.html [ DumpJSConsoleLogInStdErr ]
     339imported/w3c/web-platform-tests/payment-request/payment-request-hasenrolledinstrument-method.tentative.https.html [ DumpJSConsoleLogInStdErr ]
    339340imported/w3c/web-platform-tests/workers/WorkerGlobalScope_ErrorEvent_lineno.htm [ DumpJSConsoleLogInStdErr ]
    340341imported/w3c/web-platform-tests/webaudio/the-audio-api/the-audionode-interface/audionode-disconnect-audioparam.html [ DumpJSConsoleLogInStdErr ]
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r264202 r264239  
     12020-07-10  Chris Dumez  <cdumez@apple.com>
     2
     3        Resync web-platform-tests/payment-request from upstream
     4        https://bugs.webkit.org/show_bug.cgi?id=214167
     5
     6        Reviewed by Sam Weinig.
     7
     8        Resync web-platform-tests/payment-request from upstream cef93b58e7cf31f1d47c.
     9
     10        * resources/resource-files.json:
     11        * web-platform-tests/payment-request/*: Updated.
     12
    1132020-07-09  Chris Dumez  <cdumez@apple.com>
    214
  • trunk/LayoutTests/imported/w3c/resources/resource-files.json

    r264117 r264239  
    25592559        "web-platform-tests/mediacapture-record/support/MediaRecorder-iframe.html",
    25602560        "web-platform-tests/payment-request/allowpaymentrequest/echo-PaymentRequest.html",
     2561        "web-platform-tests/payment-request/blank.html",
    25612562        "web-platform-tests/payment-request/payment-request-response-id.html",
    25622563        "web-platform-tests/payment-request/show-method-postmessage-iframe.html",
  • trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/META.yml

    r237995 r264239  
    33  - marcoscaceres
    44  - rsolomakhin
    5   - domenic
    65  - zouhir
    7   - mnoorenberghe
    86  - romandev
    9   - edenchuang
     7  - aestes
     8  - danyao
  • trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/MerchantValidationEvent/complete-method.https.html

    r236570 r264239  
    99test(() => {
    1010  const event = new MerchantValidationEvent("test");
    11   assert_throws("InvalidStateError", () => {
     11  assert_throws_dom("InvalidStateError", () => {
    1212    event.complete("");
    1313  })
  • trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/MerchantValidationEvent/constructor.https-expected.txt

    r237521 r264239  
    66PASS Must throw TypeError if initialized with an invalid URL.
    77PASS Relative validationURLs use the document as the base.
     8FAIL Relative validationURLs use the document.baseURI as the base. assert_equals: expected "https://pass.com/pass" but got "https://localhost:9443/payment-request/MerchantValidationEvent/pass"
    89PASS Must have a methodName IDL attribute, which is initialized with to the methodName dictionary value.
    910PASS When no methodName is passed, methodName attribute defaults to the empty string
  • trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/MerchantValidationEvent/constructor.https.html

    r236570 r264239  
    99const applePay = Object.freeze({
    1010  supportedMethods: "https://apple.com/apple-pay",
     11  data: {
     12    version: 3,
     13    merchantIdentifier: "merchant.com.example",
     14    countryCode: "US",
     15    merchantCapabilities: ["supports3DS"],
     16    supportedNetworks: ["visa"],
     17  }
    1118});
    1219const basicCard = Object.freeze({ supportedMethods: "basic-card" });
    … …  
    5865test(() => {
    5966  const validationURL = "http://\u005B"; // invalid URL
    60   assert_throws(new TypeError(), () => {
     67  assert_throws_js(TypeError, () => {
    6168    new MerchantValidationEvent("test", { validationURL });
    6269  });
    … …  
    7279  }
    7380}, "Relative validationURLs use the document as the base.");
     81
     82test(() => {
     83  const validationURL = "pass";
     84  const base = document.createElement("base");
     85  base.href = "https://pass.com";
     86  document.head.append(base);
     87  const event = new MerchantValidationEvent("test", { validationURL });
     88  try {
     89    assert_idl_attribute(event, "validationURL");
     90    assert_equals(event.validationURL, "https://pass.com/pass");
     91  } finally {
     92    base.remove();
     93  }
     94}, "Relative validationURLs use the document.baseURI as the base.");
    7495
    7596test(() => {
    … …  
    115136  ];
    116137  for (const methodName of invalidPMIs) {
    117     assert_throws(
    118       new RangeError(),
     138    assert_throws_js(
     139      RangeError,
    119140      () => {
    120141        const event = new MerchantValidationEvent("test", { methodName });
  • trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentAddress/attributes-and-toJSON-method-manual.https.html

    r236570 r264239  
    2929      "Expected addressLine to be an array"
    3030    );
    31     assert_throws(
    32       new TypeError(),
     31    assert_throws_js(
     32      TypeError,
    3333      () => {
    3434        addr.addressLine.push("this must throw");
    … …  
    7474      dependentLocality: '',
    7575      postalCode: '6095',
     76      region: 'QLD',
    7677      sortingCode: '',
    7778      organization: 'w3c',
  • trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentMethodChangeEvent/methodDetails-attribute.https.html

    r236570 r264239  
    1818  const { test } = event.methodDetails;
    1919  assert_equals(test, "pass");
    20   assert_equals(event.methodDetails, methodDetails);
    2120}, "Must have a methodDetails IDL attribute, which is initialized with to the methodName dictionary value");
    2221
  • trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentRequestUpdateEvent/constructor.https.html

    r235600 r264239  
    77<script src="/resources/testharnessreport.js"></script>
    88<script>
     9const applePay = Object.freeze({
     10  supportedMethods: "https://apple.com/apple-pay",
     11  data: {
     12    version: 3,
     13    merchantIdentifier: "merchant.com.example",
     14    countryCode: "US",
     15    merchantCapabilities: ["supports3DS"],
     16    supportedNetworks: ["visa"],
     17  }
     18});
    919const basicCard = Object.freeze({ supportedMethods: "basic-card" });
    10 const defaultMethods = Object.freeze([basicCard]);
     20const defaultMethods = Object.freeze([basicCard, applePay]);
    1121const defaultDetails = Object.freeze({
    1222  total: {
  • trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentRequestUpdateEvent/updateWith-call-immediate-manual.https.html

    r235600 r264239  
    1010<script>
    1111setup({ explicit_done: true, explicit_timeout: true });
     12const applePay = Object.freeze({
     13  supportedMethods: "https://apple.com/apple-pay",
     14  data: {
     15    version: 3,
     16    merchantIdentifier: "merchant.com.example",
     17    countryCode: "US",
     18    merchantCapabilities: ["supports3DS"],
     19    supportedNetworks: ["visa"],
     20  }
     21});
    1222const validMethod = Object.freeze({ supportedMethods: "basic-card" });
    13 const validMethods = Object.freeze([validMethod]);
     23const validMethods = Object.freeze([validMethod, applePay]);
    1424const validAmount = Object.freeze({ currency: "USD", value: "5.00" });
    1525const validTotal = Object.freeze({
    … …  
    4656      request.addEventListener(
    4757        "shippingaddresschange",
    48         async ev => {
    49           // spin the event loop, sets [[waitForUpdate]] to true.
    50           await Promise.resolve();
    51           try {
    52             ev.updateWith(validDetails);
    53             resolve(); // This is bad.
    54           } catch (err) {
    55             reject(err); // this is good.
    56           }
     58        ev => {
     59          // Forces updateWith() to be run in the next event loop tick so that
     60          // [[waitForUpdate]] is already true when it runs.
     61          t.step_timeout(() => {
     62            try {
     63              ev.updateWith(validDetails);
     64              resolve(); // This is bad.
     65            } catch (err) {
     66              reject(err); // this is good.
     67            }
     68          });
    5769        },
    5870        { once: true }
    5971      );
    6072    });
    61     const response = await request.show();
    62     await promise_rejects(
     73    const acceptPromise = request.show();
     74    await promise_rejects_dom(
    6375      t,
    6476      "InvalidStateError",
    … …  
    6678      "The event loop already spun, so [[waitForUpdate]] is now true"
    6779    );
     80    const response = await acceptPromise;
    6881    await response.complete();
    6982  }, testName.trim());
    … …  
    91104    });
    92105    const responsePromise = request.show();
    93     await promise_rejects(
     106    await promise_rejects_dom(
    94107      t,
    95108      "InvalidStateError",
    … …  
    136149    // Here, we try to be sneaky, and reuse the addressChangeEvent to perform the update.
    137150    // However, addressChangeEvent [[waitingForUpdate]] is true, so it throws.
    138     assert_throws(
     151    assert_throws_dom(
    139152      "InvalidStateError",
    140153      () => {
    … …  
    147160    optionChangeEvent.updateWith(validDetails);
    148161
    149     assert_throws(
     162    assert_throws_dom(
    150163      "InvalidStateError",
    151164      () => {
  • trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentRequestUpdateEvent/updateWith-duplicate-shipping-options-manual.https.html

    r235600 r264239  
    99<script>
    1010setup({ explicit_done: true, explicit_timeout: true });
    11 
     11const applePay = Object.freeze({
     12  supportedMethods: "https://apple.com/apple-pay",
     13  data: {
     14    version: 3,
     15    merchantIdentifier: "merchant.com.example",
     16    countryCode: "US",
     17    merchantCapabilities: ["supports3DS"],
     18    supportedNetworks: ["visa"],
     19  }
     20});
    1221const validMethod = Object.freeze({ supportedMethods: "basic-card" });
    13 const validMethods = [validMethod];
     22const validMethods = [validMethod, applePay];
    1423const validAmount = Object.freeze({
    1524  currency: "USD",
    … …  
    6574    });
    6675    const acceptPromise = request.show();
    67     await promise_rejects(
     76    await promise_rejects_js(
    6877      t,
    69       new TypeError(),
     78      TypeError,
    7079      acceptPromise,
    7180      "Duplicate shippingOption ids must abort with TypeError"
  • trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentRequestUpdateEvent/updateWith-incremental-update-manual.https.html

    r235600 r264239  
    1515const methods = [{
    1616  supportedMethods: "basic-card",
     17}, {
     18  supportedMethods: "https://apple.com/apple-pay",
     19  data: {
     20    version: 3,
     21    merchantIdentifier: "merchant.com.example",
     22    countryCode: "US",
     23    merchantCapabilities: ["supports3DS"],
     24    supportedNetworks: ["visa"],
     25  }
    1726}];
    1827
  • trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentRequestUpdateEvent/updateWith-method-abort-update-manual.https.html

    r235600 r264239  
    1919});
    2020
     21const applePay = Object.freeze({
     22  supportedMethods: "https://apple.com/apple-pay",
     23  data: {
     24    version: 3,
     25    merchantIdentifier: "merchant.com.example",
     26    countryCode: "US",
     27    merchantCapabilities: ["supports3DS"],
     28    supportedNetworks: ["visa"],
     29  }
     30});
     31
    2132// Methods
    22 const validMethods = Object.freeze([validMethodBasicCard, validMethod]);
     33const validMethods = Object.freeze([validMethodBasicCard, validMethod, applePay]);
    2334
    2435// Amounts
    … …  
    131142
    132143const modifierWithRecursiveData = Object.freeze({
    133   supportedMethods: validMethodBasicCard,
     144  supportedMethods: "basic-card",
    134145  total: validTotal,
    135146  data: recursiveData,
    … …  
    149160    // First we check the bad update.
    150161    const acceptPromise = request.show();
    151     await promise_rejects(
     162    let test_func;
     163    if (typeof expectedError == "function") {
     164      test_func = promise_rejects_js;
     165    } else {
     166      test_func = promise_rejects_dom;
     167    }
     168    await test_func(
    152169      t,
    153170      expectedError,
    … …  
    156173    );
    157174    // The request [[state]] is now "closed", so let's check for InvalidStateError
    158     await promise_rejects(
     175    await promise_rejects_dom(
    159176      t,
    160177      "InvalidStateError",
    … …  
    176193  <li>
    177194    <button onclick="
    178       const rejectedPromise = Promise.reject(new SyntaxError('test')).catch(err => err);
     195      const rejectedPromise = Promise.reject(new SyntaxError('test'));
    179196      testBadUpdate(this, rejectedPromise, 'AbortError');
    180197    ">
    … …  
    185202    <button onclick="
    186203      const invalidDetails = { total: `this will cause a TypeError!` };
    187       testBadUpdate(this, invalidDetails, new TypeError());
     204      testBadUpdate(this, invalidDetails, TypeError);
    188205    ">
    189206      Total in the update is a string, so converting to IDL must abort the update with a TypeError.
    … …  
    193210    <button onclick="
    194211      const invalidDetails = { total: recursiveData };
    195       testBadUpdate(this, invalidDetails, new TypeError());
     212      testBadUpdate(this, invalidDetails, TypeError);
    196213    ">
    197214      Total is recursive, so converting to IDL must abort the update with a TypeError.
    … …  
    200217  <li>
    201218    <button onclick="
    202       testBadUpdate(this, invalidDetailsNegativeTotal, new TypeError());
     219      testBadUpdate(this, invalidDetailsNegativeTotal, TypeError);
    203220    ">
    204221      Updating with a negative total results in a TypeError.
    … …  
    208225    <button onclick="
    209226      const badDetails = Object.assign({}, validDetails, { displayItems: invalidPaymentItems });
    210       testBadUpdate(this, badDetails, new RangeError());
    211     ">
    212       Updating with a displayItem with an invalid currency results in TypeError.
     227      testBadUpdate(this, badDetails, RangeError);
     228    ">
     229      Updating with a displayItem with an invalid currency results in RangeError.
    213230    </button>
    214231  </li>
    … …  
    217234      const duplicateShippingOptions = [validShippingOption, validShippingOption];
    218235      const badDetails = Object.assign({}, validDetails, { shippingOptions: duplicateShippingOptions });
    219       testBadUpdate(this, badDetails, new TypeError());
     236      testBadUpdate(this, badDetails, TypeError);
    220237    ">
    221238      Updating with duplicate shippingOptions (same IDs) results in a TypeError.
    … …  
    225242    <button onclick="
    226243      const badDetails = Object.assign({}, validDetails, { shippingOptions: invalidShippingOptions });
    227       testBadUpdate(this, badDetails, new RangeError());
     244      testBadUpdate(this, badDetails, RangeError);
    228245    ">
    229246      Updating with a shippingOption with an invalid currency value results in a RangError.
    … …  
    235252      const badModifiers = { modifiers: [ modifierWithInvalidTotal, validModifier ] };
    236253      const badDetails = Object.assign({}, validDetails, badModifiers);
    237       testBadUpdate(this, badDetails, new RangeError());
     254      testBadUpdate(this, badDetails, RangeError);
    238255    ">
    239256      Must throw a RangeError when a modifier's total item has an invalid currency.
    … …  
    245262      const badModifiers = { modifiers: [ modifierWithInvalidDisplayItems, validModifier ] };
    246263      const badDetails = Object.assign({}, validDetails, badModifiers);
    247       testBadUpdate(this, badDetails, new RangeError());
     264      testBadUpdate(this, badDetails, RangeError);
    248265    ">
    249266      Must throw a RangeError when a modifier display item has an invalid currency.
    … …  
    255272      const badModifiers = { modifiers: [ modifierWithRecursiveData, validModifier ] };
    256273      const badDetails = Object.assign({}, validDetails, badModifiers);
    257       testBadUpdate(this, badDetails, new TypeError());
     274      testBadUpdate(this, badDetails, TypeError);
    258275    ">
    259276      Must throw as Modifier has a recursive dictionary.
  • trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentRequestUpdateEvent/updateWith-state-checks-manual.https.html

    r235600 r264239  
    77<script>
    88setup({ explicit_done: true, explicit_timeout: true });
     9const applePay = Object.freeze({
     10  supportedMethods: "https://apple.com/apple-pay",
     11  data: {
     12    version: 3,
     13    merchantIdentifier: "merchant.com.example",
     14    countryCode: "US",
     15    merchantCapabilities: ["supports3DS"],
     16    supportedNetworks: ["visa"],
     17  }
     18});
    919const validMethod = Object.freeze({ supportedMethods: "basic-card" });
    10 const validMethods = Object.freeze([validMethod]);
     20const validMethods = Object.freeze([validMethod, applePay]);
    1121const validAmount = Object.freeze({ currency: "USD", value: "5.00" });
    1222const validTotal = Object.freeze({
    … …  
    4656    // Set request.[[state]] to closed
    4757    await event.target.abort();
    48     assert_throws(
     58    assert_throws_dom(
    4959      "InvalidStateError",
    5060      () => {
    … …  
    7181    // Set request.[[updating]] to true
    7282    event.updateWith(pendingPromise);
    73     assert_throws(
     83    assert_throws_dom(
    7484      "InvalidStateError",
    7585      () => {
  • trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentRequestUpdateEvent/updatewith-method.https.html

    r235600 r264239  
    77<script src="/resources/testharnessreport.js"></script>
    88<script>
     9const applePay = Object.freeze({
     10  supportedMethods: "https://apple.com/apple-pay",
     11  data: {
     12    version: 3,
     13    merchantIdentifier: "merchant.com.example",
     14    countryCode: "US",
     15    merchantCapabilities: ["supports3DS"],
     16    supportedNetworks: ["visa"],
     17  }
     18});
    919const basicCard = Object.freeze({ supportedMethods: "basic-card" });
    10 const defaultMethods = Object.freeze([basicCard]);
     20const defaultMethods = Object.freeze([basicCard, applePay]);
    1121const defaultDetails = Object.freeze({
    1222  total: {
    … …  
    3444    new PaymentRequestUpdateEvent("shippingoptionchange"),
    3545  ].forEach(ev => {
    36     assert_throws(
     46    assert_throws_dom(
    3747      "InvalidStateError",
    3848      () => {
    … …  
    5464    request.dispatchEvent(ev); // set .target and dispatch flag
    5565    // unstrusted event.
    56     assert_throws(
     66    assert_throws_dom(
    5767      "InvalidStateError",
    5868      () => {
  • trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentValidationErrors/retry-shows-error-member-manual.https.html

    r235390 r264239  
    4646</ol>
    4747<small>
    48   If you find a buggy test, please <a href="https://github.com/w3c/web-platform-tests/issues">file a bug</a>
    49   and tag one of the <a href="https://github.com/w3c/web-platform-tests/blob/master/payment-request/OWNERS">owners</a>.
     48  If you find a buggy test, please <a href="https://github.com/web-platform-tests/wpt/issues">file a bug</a>
     49  and tag one of the <a href="https://github.com/web-platform-tests/wpt/blob/master/payment-request/META.yml">owners</a>.
    5050</small>
  • trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentValidationErrors/retry-shows-payer-member-manual.https.html

    r235390 r264239  
    6161</ol>
    6262<small>
    63   If you find a buggy test, please <a href="https://github.com/w3c/web-platform-tests/issues">file a bug</a>
    64   and tag one of the <a href="https://github.com/w3c/web-platform-tests/blob/master/payment-request/OWNERS">owners</a>.
     63  If you find a buggy test, please <a href="https://github.com/web-platform-tests/wpt/issues">file a bug</a>
     64  and tag one of the <a href="https://github.com/web-platform-tests/wpt/blob/master/payment-request/META.yml">owners</a>.
    6565</small>
  • trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentValidationErrors/retry-shows-shippingAddress-member-manual.https.html

    r236570 r264239  
    9999</ol>
    100100<small>
    101   If you find a buggy test, please <a href="https://github.com/w3c/web-platform-tests/issues">file a bug</a>
    102   and tag one of the <a href="https://github.com/w3c/web-platform-tests/blob/master/payment-request/OWNERS">owners</a>.
     101  If you find a buggy test, please <a href="https://github.com/web-platform-tests/wpt/issues">file a bug</a>
     102  and tag one of the <a href="https://github.com/web-platform-tests/wpt/blob/master/payment-request/META.yml">owners</a>.
    103103</small>
  • trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/algorithms-manual.https.html

    r235390 r264239  
    1616    supportedMethods: "basic-card",
    1717  },
     18  {
     19    supportedMethods: "https://apple.com/apple-pay",
     20    data: {
     21      version: 3,
     22      merchantIdentifier: "merchant.com.example",
     23      countryCode: "US",
     24      merchantCapabilities: ["supports3DS"],
     25      supportedNetworks: ["visa"],
     26    },
     27  }
    1828];
    1929const shippingOptions = {
    … …  
    101111    const request = new PaymentRequest(methods, detailsNoShippingOptions);
    102112    // Await the user to abort
    103     await promise_rejects(t, "AbortError", request.show());
     113    await promise_rejects_dom(t, "AbortError", request.show());
    104114    // [[state]] is now closed
    105     await promise_rejects(t, "InvalidStateError", request.show());
     115    await promise_rejects_dom(t, "InvalidStateError", request.show());
    106116  }, testName.trim());
    107117}
  • trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/allowpaymentrequest/active-document-cross-origin.https.sub-expected.txt

    r224061 r264239  
    22
    33
    4 PASS PaymentRequest <iframe allowpaymentrequest> in non-active document (cross-origin)
     4FAIL PaymentRequest <iframe allowpaymentrequest> in non-active document (cross-origin) assert_throws_dom: function "() => {
     5        new grabbedPaymentRequest(...paymentArgs);
     6      }" threw an exception from the wrong global
    57
  • trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/allowpaymentrequest/active-document-cross-origin.https.sub.html

    r222307 r264239  
    1818    });
    1919    iframe.onload = t.step_func_done(() => {
    20       assert_throws({name: 'SecurityError'}, () => {
     20      assert_throws_dom('SecurityError', () => {
    2121        new grabbedPaymentRequest(...paymentArgs);
    2222      });
  • trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/allowpaymentrequest/active-document-same-origin.https-expected.txt

    r224061 r264239  
    11
    22
    3 PASS PaymentRequest <iframe allowpaymentrequest> in non-active document (same-origin)
     3FAIL PaymentRequest <iframe allowpaymentrequest> in non-active document (same-origin) assert_throws_dom: function "() => {
     4        new grabbedPaymentRequest(...paymentArgs);
     5      }" threw an exception from the wrong global
    46
  • trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/allowpaymentrequest/active-document-same-origin.https.html

    r222307 r264239  
    1414    win.location.href = '/common/blank.html';
    1515    iframe.onload = t.step_func_done(() => {
    16       assert_throws({name: 'SecurityError'}, () => {
     16      assert_throws_dom('SecurityError', () => {
    1717        new grabbedPaymentRequest(...paymentArgs);
    1818      });
  • trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/allowpaymentrequest/removing-allowpaymentrequest.https.sub.html

    r222307 r264239  
    2828
    2929  window.onmessage = t.step_func((e) => {
     30    // Ignore messages that are not part of the test.
     31    if (e.source != iframe.contentWindow) return;
     32
    3033    i++;
    3134    if (i === 1) {
    … …  
    4952      // Since the allowpaymentrequest flag was not set, we expect an exception.
    5053      assert_equals(e.data.message, 'Exception', 'after navigation');
    51       assert_array_equals(e.data.details, [true /* ex instanceof DOMException*/, 18 /* ex.code */, 'SecurityError' /* ex.name */], 'after navigation');
     54      assert_equals(4, e.data.details.length);
     55      // The last entry is the error stacktrace. Ignore it in comparison.
     56      assert_array_equals(e.data.details.slice(0, 3), [true /* ex instanceof DOMException*/, 18 /* ex.code */, 'SecurityError' /* ex.name */], 'after navigation');
    5257      t.done();
    5358    }
  • trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/allowpaymentrequest/setting-allowpaymentrequest-timing.https.sub.html

    r222307 r264239  
    11<!doctype html>
    22<title>PaymentRequest setting allowpaymentrequest after document creation, before response</title>
     3<meta name="timeout" content="long">
    34<script src=/resources/testharness.js></script>
    45<script src=/resources/testharnessreport.js></script>
    … …  
    2223  });
    2324
    24   window.onmessage = t.step_func_done((e) => {
     25  window.onmessage = t.step_func((e) => {
     26    // Ignore messages that are not part of the test.
     27    if (e.source != iframe.contentWindow) return;
     28
    2529    assert_equals(e.data.message, 'Exception');
    26     assert_array_equals(e.data.details, [true /* ex instanceof DOMException */, DOMException.SECURITY_ERR, 'SecurityError']);
     30    assert_equals(4, e.data.details.length);
     31    // The last entry is the error stacktrace. Ignore it in comparison.
     32    assert_array_equals(e.data.details.slice(0, 3), [true /* ex instanceof DOMException */, DOMException.SECURITY_ERR, 'SecurityError']);
     33    t.done();
    2734  });
    2835
  • trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/allowpaymentrequest/setting-allowpaymentrequest.https.sub.html

    r220785 r264239  
    2121
    2222  window.onmessage = t.step_func((e) => {
     23    // Ignore messages that are not part of the test.
     24    if (e.source != iframe.contentWindow) return;
     25
    2326    i++;
    2427    if (i === 1) {
    2528      assert_equals(e.data.message, 'Exception', 'before navigation');
    26       assert_array_equals(e.data.details, [true /* ex instanceof DOMException*/, 18 /* ex.code */, 'SecurityError' /* ex.name */], 'before navigation');
     29      assert_equals(4, e.data.details.length);
     30      // The last entry is the error stacktrace. Ignore it in comparison.
     31      assert_array_equals(e.data.details.slice(0, 3), [true /* ex instanceof DOMException*/, 18 /* ex.code */, 'SecurityError' /* ex.name */], 'before navigation');
    2732
    2833      // Navigate the iframe. This will fire a second 'load' event on the iframe.
  • trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/change-shipping-option-manual.https.html

    r235390 r264239  
    1010setup({ explicit_done: true, explicit_timeout: true });
    1111const validMethod = Object.freeze({ supportedMethods: "basic-card" });
    12 const validMethods = Object.freeze([validMethod]);
     12const applePayMethod = {
     13  supportedMethods: "https://apple.com/apple-pay",
     14  data: {
     15    version: 3,
     16    merchantIdentifier: "merchant.com.example",
     17    countryCode: "US",
     18    merchantCapabilities: ["supports3DS"],
     19    supportedNetworks: ["visa"],
     20  },
     21};
     22const validMethods = Object.freeze([validMethod, applePayMethod]);
    1323const validAmount = Object.freeze({ currency: "USD", value: "5.00" });
    1424const validTotal = Object.freeze({
  • trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/change-shipping-option-select-last-manual.https.html

    r235390 r264239  
    99const validMethods = Object.freeze([
    1010  { supportedMethods: "basic-card" },
    11   { supportedMethods: "https://apple.com/apple-pay" },
     11  {
     12    supportedMethods: "https://apple.com/apple-pay",
     13    data: {
     14      version: 3,
     15      merchantIdentifier: "merchant.com.example",
     16      countryCode: "US",
     17      merchantCapabilities: ["supports3DS"],
     18      supportedNetworks: ["visa"],
     19    },
     20  },
    1221]);
    1322const validAmount = Object.freeze({ currency: "USD", value: "5.00" });
  • trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/constructor_convert_method_data.https.html

    r253986 r264239  
    3333      const method = { supportedMethods };
    3434      const request = new PaymentRequest([method], details);
    35       assert_throws(
    36         new TypeError(),
     35      assert_throws_js(
     36        TypeError,
    3737        () => {
    3838          const badMethod = Object.assign(
    … …  
    5656      if (!(await request.canMakePayment())) continue;
    5757
    58       assert_throws(
    59         new TypeError(),
     58      assert_throws_js(
     59        TypeError,
    6060        () => {
    6161          const badMethod = Object.assign(
  • trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/historical.https.html

    r236570 r264239  
    3535  methods.toString = () => { throw expectedError; };
    3636  Object.defineProperty(methods, '0', { get: () => { throw unexpectedError; } });
    37   assert_throws(expectedError, () => {
     37  assert_throws_exactly(expectedError, () => {
    3838    new PaymentRequest([{supportedMethods: methods}], {total: {label: 'bar', amount: {currency: 'BAZ', value: '0'}}});
    3939  });
  • trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/onmerchantvalidation-attribute.https.html

    r235600 r264239  
    88"use strict";
    99const testMethod = Object.freeze({ supportedMethods: "not-a-real-method" });
    10 const applePay = Object.freeze({ supportedMethods: "https://apple.com/apple-pay" });
     10const applePay = Object.freeze({
     11  supportedMethods: "https://apple.com/apple-pay",
     12  data: {
     13    version: 3,
     14    merchantIdentifier: "merchant.com.example",
     15    countryCode: "US",
     16    merchantCapabilities: ["supports3DS"],
     17    supportedNetworks: ["visa"],
     18  },
     19});
    1120const defaultMethods = Object.freeze([testMethod, applePay]);
    1221const defaultDetails = Object.freeze({
  • trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/onpaymentmethodchange-attribute.https.html

    r264238 r264239  
    88"use strict";
    99const testMethod = Object.freeze({ supportedMethods: "not-a-real-method" });
    10 const applePay = Object.freeze({ supportedMethods: "https://apple.com/apple-pay" });
     10const applePay = Object.freeze({
     11  supportedMethods: "https://apple.com/apple-pay",
     12  data: {
     13    version: 3,
     14    merchantIdentifier: "merchant.com.example",
     15    countryCode: "US",
     16    merchantCapabilities: ["supports3DS"],
     17    supportedNetworks: ["visa"],
     18  }
     19});
    1120const defaultMethods = Object.freeze([testMethod, applePay]);
    1221const defaultDetails = Object.freeze({
  • trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-abort-method.https.html

    r237995 r264239  
    22<meta charset="utf-8">
    33<title>Test for PaymentRequest.abort() method</title>
    4 <link rel="help" href="https://w3c.github.io/browser-payment-api/#abort-method">
     4<link rel="help" href="https://w3c.github.io/payment-request/#abort-method">
    55<script src="/resources/testharness.js"></script>
    66<script src="/resources/testharnessreport.js"></script>
     7<script src="/resources/testdriver.js"></script>
    78<script src='/resources/testdriver-vendor.js'></script>
    8 <script src="/resources/testdriver.js"></script>
    99<script>
    1010"use strict";
    … …  
    1818const applePay = Object.freeze({
    1919  supportedMethods: "https://apple.com/apple-pay",
     20  data: {
     21    version: 3,
     22    merchantIdentifier: "merchant.com.example",
     23    countryCode: "US",
     24    merchantCapabilities: ["supports3DS"],
     25    supportedNetworks: ["visa"],
     26  }
    2027});
    2128const defaultMethods = Object.freeze([basicCard, applePay]);
    … …  
    3340  // request is in "created" state
    3441  const request = new PaymentRequest(defaultMethods, defaultDetails);
    35   await promise_rejects(t, "InvalidStateError", request.abort());
     42  await promise_rejects_dom(t, "InvalidStateError", request.abort());
    3643}, `Throws if the promise [[state]] is not "interactive"`);
    37 
    38 promise_test(async t => {
    39   const request = new PaymentRequest(defaultMethods, defaultDetails);
    40   const acceptPromise = test_driver.bless("show payment request", () =>
    41     request.show()
    42   );
    43   try {
    44     await request.abort();
    45   } catch (err) {
    46     assert_unreached("Unexpected promise rejection: " + err.message);
    47   }
    48   await promise_rejects(t, "AbortError", acceptPromise);
    49   // As request is now "closed", trying to show it will fail
    50   await promise_rejects(t, "InvalidStateError", request.show());
    51 }, "The same request cannot be shown multiple times.");
    52 
    53 promise_test(async t => {
    54   // request is in "created" state.
    55   const request = new PaymentRequest(defaultMethods, defaultDetails);
    56   await promise_rejects(t, "InvalidStateError", request.abort());
    57   // Call it again, for good measure.
    58   await promise_rejects(t, "InvalidStateError", request.abort());
    59   // The request's state is "created", so let's show it
    60   // which changes the state to "interactive.".
    61   const acceptPromise = test_driver.bless("show payment request", () =>
    62     request.show()
    63   );
    64   // Let's set request the state to "closed" by calling .abort()
    65   try {
    66     await request.abort();
    67   } catch (err) {
    68     assert_unreached("Unexpected promise rejection: " + err.message);
    69   }
    70   // The request is now "closed", so...
    71   await promise_rejects(t, "InvalidStateError", request.abort());
    72   await promise_rejects(t, "AbortError", acceptPromise);
    73 }, "Aborting a request before it is shown doesn't prevent it from being shown later.");
    7444
    7545promise_test(async t => {
    … …  
    7848  assert_equals(promises.size, 3, "Must have three unique objects");
    7949}, "Calling abort() multiple times is always a new object.");
     50
     51promise_test(async t => {
     52  const request = new PaymentRequest(defaultMethods, defaultDetails);
     53  const [abortPromise, acceptPromise] = await test_driver.bless(
     54    "show payment request",
     55    () => {
     56      const acceptPromise = request.show()
     57      acceptPromise.catch(() => {}); // no-op, just to silence unhandled rejection in devtools.
     58      const abortPromise = request.abort();
     59      return [abortPromise, acceptPromise];
     60    });
     61
     62  await abortPromise;
     63  await promise_rejects_dom(t, "AbortError", acceptPromise);
     64  // As request is now "closed", trying to show it will fail
     65  await promise_rejects_dom(t, "InvalidStateError", request.show());
     66}, "The same request cannot be shown multiple times.");
     67
     68promise_test(async t => {
     69  // request is in "created" state.
     70  const request = new PaymentRequest(defaultMethods, defaultDetails);
     71  await promise_rejects_dom(t, "InvalidStateError", request.abort());
     72  // Call it again, for good measure.
     73  await promise_rejects_dom(t, "InvalidStateError", request.abort());
     74  // The request's state is "created", so let's show it
     75  // which changes the state to "interactive.".
     76  const [abortPromise, acceptPromise] = await test_driver.bless(
     77    "show payment request",
     78    () => {
     79      const acceptPromise = request.show()
     80      // Let's set request the state to "closed" by calling .abort()
     81      const abortPromise = request.abort();
     82      return [abortPromise, acceptPromise];
     83    });
     84
     85  await abortPromise;
     86  // The request is now "closed", so...
     87  await promise_rejects_dom(t, "InvalidStateError", request.abort());
     88  await promise_rejects_dom(t, "AbortError", acceptPromise);
     89}, "Aborting a request before it is shown doesn't prevent it from being shown later.");
    8090</script>
    81 
     91<small>
     92  If you find a buggy test, please <a href="https://github.com/web-platform-tests/wpt/issues">file a bug</a>
     93  and tag one of the <a href="https://github.com/web-platform-tests/wpt/blob/master/payment-request/META.yml">suggested reviewers</a>.
     94</small>
  • trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-canmakepayment-method-protection.https.html

    r237995 r264239  
    99<script>
    1010const basicCard = Object.freeze({ supportedMethods: "basic-card" });
    11 const applePay = Object.freeze({ supportedMethods: "https://apple.com/apple-pay" });
     11const applePay = Object.freeze({
     12  supportedMethods: "https://apple.com/apple-pay",
     13  data: {
     14    version: 3,
     15    merchantIdentifier: "merchant.com.example",
     16    countryCode: "US",
     17    merchantCapabilities: ["supports3DS"],
     18    supportedNetworks: ["visa"],
     19  }
     20});
    1221const defaultMethods = Object.freeze([basicCard, applePay]);
    1322const defaultDetails = Object.freeze({
  • trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-canmakepayment-method.https-expected.txt

    r244393 r264239  
    1 This test requires user interaction.
    2 Please click here to allow show payment request.This test requires user interaction.
    3 Please click here to allow show payment request. If you find a buggy test, please file a bug and tag one of the suggested reviewers.
     1If you find a buggy test, please file a bug and tag one of the suggested reviewers.
    42
    53PASS If payment method identifier are supported, resolve promise with true.
    6 FAIL If request.[[state]] is "interactive", then return a promise rejected with an "InvalidStateError" DOMException. assert_unreached: Should have rejected: undefined Reached unreachable code
    7 FAIL If request.[[state]] is "closed", then return a promise rejected with an "InvalidStateError" DOMException. promise_test: Unhandled rejection with value: object "InvalidStateError: The object is in an invalid state."
    84PASS If request.[[state]] is "created", then return a promise that resolves to true for known method.
    95PASS All methods are unsupported
    106PASS Mix of supported and unsupported methods, at least one method is supported.
     7FAIL If request.[[state]] is "interactive", then return a promise rejected with an "InvalidStateError" DOMException. assert_unreached: Should have rejected: undefined Reached unreachable code
     8FAIL If request.[[state]] is "closed", then return a promise rejected with an "InvalidStateError" DOMException. promise_test: Unhandled rejection with value: object "InvalidStateError: The object is in an invalid state."
    119
  • trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-canmakepayment-method.https.html

    r237995 r264239  
    22<meta charset="utf-8">
    33<title>Tests for PaymentRequest.canMakePayment() method</title>
    4 <link rel="help" href="https://w3c.github.io/browser-payment-api/#show-method">
     4<link rel="help" href="https://w3c.github.io/payment-request/#canmakepayment-method">
    55<script src="/resources/testharness.js"></script>
    66<script src="/resources/testharnessreport.js"></script>
     7<script src="/resources/testdriver.js"></script>
    78<script src='/resources/testdriver-vendor.js'></script>
    8 <script src="/resources/testdriver.js"></script>
    99<script>
     10"use strict";
    1011const basicCard = Object.freeze({ supportedMethods: "basic-card" });
    1112const applePay = Object.freeze({
    1213  supportedMethods: "https://apple.com/apple-pay",
     14  data: {
     15    version: 3,
     16    merchantIdentifier: "merchant.com.example",
     17    countryCode: "US",
     18    merchantCapabilities: ["supports3DS"],
     19    supportedNetworks: ["visa"],
     20  }
    1321});
    1422const defaultMethods = Object.freeze([basicCard, applePay]);
    … …  
    3543  );
    3644}, `If payment method identifier are supported, resolve promise with true.`);
    37 
    38 promise_test(async t => {
    39   const request = new PaymentRequest(defaultMethods, defaultDetails);
    40   const acceptPromise = test_driver.bless("show payment request", () => {
    41     request.show(); // Sets state to "interactive"
    42   });
    43   const canMakePaymentPromise = request.canMakePayment();
    44   try {
    45     const result = await canMakePaymentPromise;
    46     assert_true(
    47       false,
    48       `canMakePaymentPromise should have thrown InvalidStateError`
    49     );
    50   } catch (err) {
    51     await promise_rejects(t, "InvalidStateError", canMakePaymentPromise);
    52   } finally {
    53     await request.abort();
    54     await promise_rejects(t, "AbortError", acceptPromise);
    55   }
    56   // The state should be "closed"
    57   await promise_rejects(t, "InvalidStateError", request.canMakePayment());
    58 }, 'If request.[[state]] is "interactive", then return a promise rejected with an "InvalidStateError" DOMException.');
    59 
    60 promise_test(async t => {
    61   const request = new PaymentRequest(defaultMethods, defaultDetails);
    62   const acceptPromise = test_driver.bless("show payment request", () => {
    63     request.show(); // Sets state to "interactive"
    64   });
    65   acceptPromise.catch(() => {}); // no-op, just to silence unhandled rejection in devtools.
    66   await request.abort(); // The state is now "closed"
    67   await promise_rejects(t, "InvalidStateError", request.canMakePayment());
    68   try {
    69     const result = await request.canMakePayment();
    70     assert_true(
    71       false,
    72       `should have thrown InvalidStateError, but instead returned "${result}"`
    73     );
    74   } catch (err) {
    75     assert_equals(
    76       err.name,
    77       "InvalidStateError",
    78       "must be an InvalidStateError."
    79     );
    80   }
    81 }, 'If request.[[state]] is "closed", then return a promise rejected with an "InvalidStateError" DOMException.');
    8245
    8346promise_test(async t => {
    … …  
    11679  assert_true(await someSupported, `At least one method is expected to be supported.`);
    11780}, `Mix of supported and unsupported methods, at least one method is supported.`);
     81
     82promise_test(async t => {
     83  const request = new PaymentRequest(defaultMethods, defaultDetails);
     84  const [acceptPromise, canMakePaymentPromise] = await test_driver.bless(
     85    "show payment request",
     86    () => {
     87      const acceptPromise = request.show(); // Sets state to "interactive"
     88      const canMakePaymentPromise = request.canMakePayment();
     89      return [acceptPromise, canMakePaymentPromise];
     90    });
     91
     92  await promise_rejects_dom(t, "InvalidStateError", canMakePaymentPromise);
     93  request.abort();
     94  await promise_rejects_dom(t, "AbortError", acceptPromise);
     95
     96  // The state should be "closed"
     97  await promise_rejects_dom(t, "InvalidStateError", request.canMakePayment());
     98}, 'If request.[[state]] is "interactive", then return a promise rejected with an "InvalidStateError" DOMException.');
     99
     100promise_test(async t => {
     101  const request = new PaymentRequest(defaultMethods, defaultDetails);
     102  const [abortPromise, acceptPromise] = await test_driver.bless(
     103    "show payment request",
     104    () => {
     105      const acceptPromise = request.show(); // Sets state to "interactive"
     106      acceptPromise.catch(() => {}); // no-op, just to silence unhandled rejection in devtools.
     107      const abortPromise = request.abort();  // Sets state to "closed"
     108      return [abortPromise, acceptPromise];
     109    });
     110
     111  await abortPromise;
     112  await promise_rejects_dom(t, "AbortError", acceptPromise);
     113  await promise_rejects_dom(t, "InvalidStateError", request.canMakePayment());
     114}, 'If request.[[state]] is "closed", then return a promise rejected with an "InvalidStateError" DOMException.');
    118115</script>
    119116
  • trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-constructor-thcrash.https.html

    r264238 r264239  
    2929const ABUSIVE_AMOUNT = 100000;
    3030
     31const applePay = {
     32  supportedMethods: "https://apple.com/apple-pay",
     33  data: {
     34    version: 3,
     35    merchantIdentifier: "merchant.com.example",
     36    countryCode: "US",
     37    merchantCapabilities: ["supports3DS"],
     38    supportedNetworks: ["visa"],
     39  }
     40};
     41
    3142const basicCard = Object.freeze({
    3243  supportedMethods: "basic-card",
    … …  
    4354});
    4455
    45 const defaultMethods = Object.freeze([basicCard]);
     56const defaultMethods = Object.freeze([basicCard, applePay]);
    4657
    4758const defaultTotal = Object.freeze({
  • trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-constructor.https.sub.html

    r264238 r264239  
    99"use strict";
    1010const testMethod = Object.freeze({
    11   supportedMethods: "https://wpt.fyi/payment-request",
     11  supportedMethods: "https://{{domains[nonexistent]}}/payment-request",
    1212});
    1313const defaultMethods = Object.freeze([testMethod]);
    … …  
    109109test(() => {
    110110  smokeTest();
    111   assert_throws(new TypeError(), () => new PaymentRequest([], defaultDetails));
     111  assert_throws_js(TypeError, () => new PaymentRequest([], defaultDetails));
    112112}, "If the length of the methodData sequence is zero, then throw a TypeError");
     113
     114test(() => {
     115  smokeTest();
     116  const duplicateMethods = [
     117    {
     118      supportedMethods: "https://{{domains[nonexistent]}}/payment-request",
     119    },
     120    {
     121      supportedMethods: "https://{{domains[nonexistent]}}/payment-request",
     122    },
     123  ];
     124  assert_throws_js(RangeError, () => new PaymentRequest(duplicateMethods, defaultDetails));
     125}, "If payment method is duplicate, then throw a RangeError");
    113126
    114127test(() => {
    … …  
    119132      const methods = [
    120133        {
    121           supportedMethods: "https://wpt.fyi/payment-request",
     134          supportedMethods: "https://{{domains[nonexistent]}}/payment-request",
    122135          data,
    123136        },
    … …  
    138151  const recursiveDictionary = {};
    139152  recursiveDictionary.foo = recursiveDictionary;
    140   assert_throws(new TypeError(), () => {
     153  assert_throws_js(TypeError, () => {
    141154    const methods = [
    142155      {
    143         supportedMethods: "https://wpt.fyi/payment-request",
     156        supportedMethods: "https://{{domains[nonexistent]}}/payment-request",
    144157        data: recursiveDictionary,
    145158      },
    … …  
    147160    new PaymentRequest(methods, defaultDetails);
    148161  });
    149   assert_throws(new TypeError(), () => {
     162  assert_throws_js(TypeError, () => {
    150163    const methods = [
    151164      {
    152         supportedMethods: "https://wpt.fyi/payment-request",
     165        supportedMethods: "https://{{domains[nonexistent]}}/payment-request",
    153166        data: "a string",
    154167      },
    … …  
    156169    new PaymentRequest(methods, defaultDetails);
    157170  });
    158   assert_throws(
    159     new TypeError(),
     171  assert_throws_js(
     172    TypeError,
    160173    () => {
    161174      const methods = [
    162175        {
    163           supportedMethods: "https://wpt.fyi/payment-request",
     176          supportedMethods: "https://{{domains[nonexistent]}}/payment-request",
    164177          data: null,
    165178        },
    … …  
    216229      },
    217230    };
    218     assert_throws(
    219       new TypeError(),
     231    assert_throws_js(
     232      TypeError,
    220233      () => {
    221234        new PaymentRequest(defaultMethods, invalidDetails);
    … …  
    239252test(() => {
    240253  smokeTest();
    241   assert_throws(new TypeError(), () => {
     254  assert_throws_js(TypeError, () => {
    242255    new PaymentRequest(defaultMethods, {
    243256      total: {
    … …  
    267280      ],
    268281    };
    269     assert_throws(
    270       new TypeError(),
     282    assert_throws_js(
     283      TypeError,
    271284      () => {
    272285        new PaymentRequest(defaultMethods, invalidDetails);
    … …  
    283296      [
    284297        {
    285           supportedMethods: "https://wpt.fyi/payment-request",
     298          supportedMethods: "https://{{domains[nonexistent]}}/payment-request",
    286299        },
    287300      ],
    … …  
    373386      shippingOptions: [invalidShippingOption],
    374387    });
    375     assert_throws(
    376       new TypeError(),
     388    assert_throws_js(
     389      TypeError,
    377390      () => {
    378391        new PaymentRequest(defaultMethods, details, { requestShipping: true });
    … …  
    491504    "shippingOption must be null, because requestShipping is false"
    492505  );
    493   assert_throws(
    494     new TypeError(),
     506  assert_throws_js(
     507    TypeError,
    495508    () => {
    496509      new PaymentRequest(defaultMethods, details, { requestShipping: true });
    … …  
    520533    "shippingOption must be null, because requestShipping is false"
    521534  );
    522   assert_throws(
    523     new TypeError(),
     535  assert_throws_js(
     536    TypeError,
    524537    () => {
    525538      new PaymentRequest(defaultMethods, details, { requestShipping: true });
    … …  
    534547  for (const invalidTotal of invalidTotalAmounts) {
    535548    const invalidModifier = {
    536       supportedMethods: "https://wpt.fyi/payment-request",
     549      supportedMethods: "https://{{domains[nonexistent]}}/payment-request",
    537550      total: {
    538551        label: "",
    … …  
    543556      },
    544557    };
    545     assert_throws(
    546       new TypeError(),
     558    assert_throws_js(
     559      TypeError,
    547560      () => {
    548561        new PaymentRequest(defaultMethods, {
    … …  
    560573  for (const invalidAmount of invalidAmounts) {
    561574    const invalidModifier = {
    562       supportedMethods: "https://wpt.fyi/payment-request",
     575      supportedMethods: "https://{{domains[nonexistent]}}/payment-request",
    563576      total: defaultTotal,
    564577      additionalDisplayItems: [
    … …  
    572585      ],
    573586    };
    574     assert_throws(
    575       new TypeError(),
     587    assert_throws_js(
     588      TypeError,
    576589      () => {
    577590        new PaymentRequest(defaultMethods, {
    … …  
    590603    modifiers: [
    591604      {
    592         supportedMethods: "https://wpt.fyi/payment-request",
     605        supportedMethods: "https://{{domains[nonexistent]}}/payment-request",
    593606        data: ["some-data"],
    594607      },
    … …  
    609622    modifiers: [
    610623      {
    611         supportedMethods: "https://wpt.fyi/payment-request",
     624        supportedMethods: "https://{{domains[nonexistent]}}/payment-request",
    612625        data: {
    613626          some: "data",
    … …  
    632645    modifiers: [
    633646      {
    634         supportedMethods: "https://wpt.fyi/payment-request",
     647        supportedMethods: "https://{{domains[nonexistent]}}/payment-request",
    635648        data: recursiveDictionary,
    636649      },
    637650    ],
    638651  });
    639   assert_throws(new TypeError(), () => {
     652  assert_throws_js(TypeError, () => {
    640653    new PaymentRequest(defaultMethods, modifiedDetails);
    641654  });
    … …  
    645658test(() => {
    646659  smokeTest();
    647   assert_throws(new TypeError(), () => {
     660  assert_throws_js(TypeError, () => {
    648661    new PaymentRequest(defaultMethods, defaultDetails, {
    649662      shippingType: "invalid",
  • trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-ctor-currency-code-checks.https.sub.html

    r264238 r264239  
    88const defaultMethods = [
    99  Object.freeze({
    10     supportedMethods: "https://wpt.fyi",
     10    supportedMethods: "https://{{domains[nonexistent]}}",
    1111  }),
    1212];
    … …  
    4949];
    5050
    51 const RANGE_ERROR = new RangeError();
     51const RANGE_ERROR = RangeError;
    5252
    5353const invalidAmount = Object.freeze({
    … …  
    7070// Process the total:
    7171test(() => {
    72   assert_throws(RANGE_ERROR, smokeTest, "Expected smoke test to throw.");
     72  assert_throws_js(RANGE_ERROR, smokeTest, "Expected smoke test to throw.");
    7373  for (const validCurrency of wellFormedCurrencyCodes) {
    7474    const amount = {
    … …  
    9494
    9595test(() => {
    96   assert_throws(RANGE_ERROR, smokeTest, "Expected smoke test to throw.");
     96  assert_throws_js(RANGE_ERROR, smokeTest, "Expected smoke test to throw.");
    9797  for (const invalidCurrency of invalidCurrencyCodes) {
    9898    const amount = {
    … …  
    107107      total,
    108108    };
    109     assert_throws(
     109    assert_throws_js(
    110110      RANGE_ERROR,
    111111      () => {
    … …  
    119119// If the displayItems member of details is present, then for each item in details.displayItems:
    120120test(() => {
    121   assert_throws(RANGE_ERROR, smokeTest, "Expected smoke test to throw.");
     121  assert_throws_js(RANGE_ERROR, smokeTest, "Expected smoke test to throw.");
    122122  const displayItems = [];
    123123  for (const validCurrency of wellFormedCurrencyCodes) {
    … …  
    155155
    156156test(() => {
    157   assert_throws(RANGE_ERROR, smokeTest, "Expected smoke test to throw.");
     157  assert_throws_js(RANGE_ERROR, smokeTest, "Expected smoke test to throw.");
    158158  for (const invalidCurrency of invalidCurrencyCodes) {
    159159    const amount = {
    … …  
    169169      displayItems: [displayItem],
    170170    };
    171     assert_throws(
     171    assert_throws_js(
    172172      RANGE_ERROR,
    173173      () => {
    … …  
    181181// Process shipping options:
    182182test(() => {
    183   assert_throws(RANGE_ERROR, smokeTest, "Expected smoke test to throw.");
     183  assert_throws_js(RANGE_ERROR, smokeTest, "Expected smoke test to throw.");
    184184  const shippingOptions = [];
    185185  for (const validCurrency of wellFormedCurrencyCodes) {
    … …  
    214214
    215215test(() => {
    216   assert_throws(RANGE_ERROR, smokeTest, "Expected smoke test to throw.");
     216  assert_throws_js(RANGE_ERROR, smokeTest, "Expected smoke test to throw.");
    217217  for (const invalidCurrency of invalidCurrencyCodes) {
    218218    const shippingOption = {
    … …  
    226226      shippingOptions: [shippingOption],
    227227    };
    228     assert_throws(
     228    assert_throws_js(
    229229      RANGE_ERROR,
    230230      () => {
    … …  
    238238// Process payment details modifiers:
    239239test(() => {
    240   assert_throws(RANGE_ERROR, smokeTest, "Expected smoke test to throw.");
     240  assert_throws_js(RANGE_ERROR, smokeTest, "Expected smoke test to throw.");
    241241  for (const validCurrency of wellFormedCurrencyCodes) {
    242242    const modifier = {
    243       supportedMethods: "https://wpt.fyi",
     243      supportedMethods: "https://{{domains[nonexistent]}}",
    244244      total: {
    245245        label: "Total due",
    … …  
    262262
    263263test(() => {
    264   assert_throws(RANGE_ERROR, smokeTest, "Expected smoke test to throw.");
     264  assert_throws_js(RANGE_ERROR, smokeTest, "Expected smoke test to throw.");
    265265  for (const invalidCurrency of invalidCurrencyCodes) {
    266266    const modifier = {
    267       supportedMethods: "https://wpt.fyi",
     267      supportedMethods: "https://{{domains[nonexistent]}}",
    268268      total: {
    269269        label: "Total due",
    … …  
    275275      modifiers: [modifier],
    276276    };
    277     assert_throws(
     277    assert_throws_js(
    278278      RANGE_ERROR,
    279279      () => {
    … …  
    287287// Process payment details modifiers:
    288288test(() => {
    289   assert_throws(RANGE_ERROR, smokeTest, "Expected smoke test to throw.");
     289  assert_throws_js(RANGE_ERROR, smokeTest, "Expected smoke test to throw.");
    290290  for (const validCurrency of wellFormedCurrencyCodes) {
    291291    const additionalItem = {
    … …  
    294294    };
    295295    const modifier = {
    296       supportedMethods: "https://wpt.fyi",
     296      supportedMethods: "https://{{domains[nonexistent]}}",
    297297      total: defaultTotal,
    298298      additionalDisplayItems: [additionalItem],
    … …  
    313313
    314314test(() => {
    315   assert_throws(RANGE_ERROR, smokeTest, "Expected smoke test to throw.");
     315  assert_throws_js(RANGE_ERROR, smokeTest, "Expected smoke test to throw.");
    316316  for (const invalidCurrency of invalidCurrencyCodes) {
    317317    const additionalItem = {
    … …  
    320320    };
    321321    const modifier = {
    322       supportedMethods: "https://wpt.fyi",
     322      supportedMethods: "https://{{domains[nonexistent]}}",
    323323      total: defaultTotal,
    324324      additionalDisplayItems: [additionalItem],
    … …  
    328328      modifiers: [modifier],
    329329    };
    330     assert_throws(
     330    assert_throws_js(
    331331      RANGE_ERROR,
    332332      () => {
  • trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-ctor-pmi-handling.https.sub.html

    r264238 r264239  
    2323  const validMethods = [
    2424    "https://wpt",
    25     "https://wpt.fyi/",
    26     "https://wpt.fyi/payment",
    27     "https://wpt.fyi/payment-request",
    28     "https://wpt.fyi/payment-request?",
    29     "https://wpt.fyi/payment-request?this=is",
    30     "https://wpt.fyi/payment-request?this=is&totally",
    31     "https://wpt.fyi:443/payment-request?this=is&totally",
    32     "https://wpt.fyi:443/payment-request?this=is&totally#fine",
    33     "https://:@wpt.fyi:443/payment-request?this=is&totally#👍",
     25    "https://{{domains[nonexistent]}}/",
     26    "https://{{domains[nonexistent]}}/payment",
     27    "https://{{domains[nonexistent]}}/payment-request",
     28    "https://{{domains[nonexistent]}}/payment-request?",
     29    "https://{{domains[nonexistent]}}/payment-request?this=is",
     30    "https://{{domains[nonexistent]}}/payment-request?this=is&totally",
     31    "https://{{domains[nonexistent]}}:443/payment-request?this=is&totally",
     32    "https://{{domains[nonexistent]}}:443/payment-request?this=is&totally#fine",
     33    "https://:@{{domains[nonexistent]}}:443/payment-request?this=is&totally#👍",
    3434    " \thttps://wpt\n ",
    3535    "https://xn--c1yn36f",
    … …  
    112112  ];
    113113  for (const invalidMethod of invalidMethods) {
    114     assert_throws(
    115       new RangeError(),
     114    assert_throws_js(
     115      RangeError,
    116116      () => {
    117117        const methods = [{ supportedMethods: invalidMethod }];
    … …  
    130130    "http://username:password@example.com/pay",
    131131    "http://foo.com:100000000/pay",
    132     "not-https://wpt.fyi/payment-request",
     132    "not-https://{{domains[nonexistent]}}/payment-request",
    133133    "../realitive/url",
    134134    "/absolute/../path?",
    … …  
    136136  ];
    137137  for (const invalidMethod of invalidMethods) {
    138     assert_throws(
    139       new RangeError(),
     138    assert_throws_js(
     139      RangeError,
    140140      () => {
    141141        const methods = [{ supportedMethods: invalidMethod }];
  • trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-hasenrolledinstrument-method-protection.tentative.https.html

    r264238 r264239  
    11<!DOCTYPE html>
    22<meta charset="utf-8">
    3 <title>Tests for PaymentRequest.canMakePayment() method</title>
    4 <link rel="help" href="https://w3c.github.io/browser-payment-api/#show-method">
     3<title>Tests for PaymentRequest.hasEnrolledInstrument() method</title>
     4<link rel="help" href="https://w3c.github.io/payment-request/#hasenrolledinstrument-method">
    55<script src="/resources/testharness.js"></script>
    66<script src="/resources/testharnessreport.js"></script>
     7<script src="/resources/testdriver.js"></script>
    78<script src='/resources/testdriver-vendor.js'></script>
    8 <script src="/resources/testdriver.js"></script>
    99<script>
    10 const basicCard = Object.freeze({ supportedMethods: "basic-card" });
    11 const applePay = Object.freeze({ supportedMethods: "https://apple.com/apple-pay" });
    12 const defaultMethods = Object.freeze([basicCard, applePay]);
     10const visaMethod = Object.freeze({
     11    supportedMethods: "basic-card",
     12    data: {
     13      supportedNetworks: ['visa']
     14    }
     15});
     16const mastercardMethod = Object.freeze({
     17    supportedMethods: "basic-card",
     18    data: {
     19      supportedNetworks: ['mastercard']
     20    }
     21});
    1322const defaultDetails = Object.freeze({
    1423  total: {
    … …  
    2231
    2332promise_test(async t => {
    24   // This test might never actually hit its assertion, but that's allowed.
    25   const request = new PaymentRequest(defaultMethods, defaultDetails);
     33  // This test may never actually hit its assertion, but that's allowed.
     34  const request = new PaymentRequest([visaMethod], defaultDetails);
    2635  for (let i = 0; i < 1000; i++) {
    2736    try {
    28       await request.canMakePayment();
     37      await request.hasEnrolledInstrument();
    2938    } catch (err) {
    3039      assert_equals(
    3140        err.name,
    3241        "NotAllowedError",
    33         "if it throws, then it must be a NotAllowedError."
     42        "If it throws, then it must be a NotAllowedError."
    3443      );
    3544      break;
    3645    }
    3746  }
     47
    3848  for (let i = 0; i < 1000; i++) {
    3949    try {
    40       await new PaymentRequest(defaultMethods, defaultDetails).canMakePayment();
     50      const request2 = new PaymentRequest([mastercardMethod], defaultDetails);
     51      await request2.hasEnrolledInstrument();
    4152    } catch (err) {
    4253      assert_equals(
    4354        err.name,
    4455        "NotAllowedError",
    45         "if it throws, then it must be a NotAllowedError."
     56        "If it throws, then it must be a NotAllowedError."
    4657      );
    4758      break;
    … …  
    4960  }
    5061}, `Optionally, at the user agent's discretion, return a promise rejected with a "NotAllowedError" DOMException.`);
     62
    5163</script>
    5264
  • trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-onshippingaddresschange-attribute.https.html

    r224156 r264239  
    88<script>
    99"use strict";
     10const applePay = Object.freeze({
     11  supportedMethods: "https://apple.com/apple-pay",
     12  data: {
     13    version: 3,
     14    merchantIdentifier: "merchant.com.example",
     15    countryCode: "US",
     16    merchantCapabilities: ["supports3DS"],
     17    supportedNetworks: ["visa"],
     18  }
     19});
    1020const basicCard = Object.freeze({ supportedMethods: "basic-card" });
    11 const defaultMethods = Object.freeze([basicCard]);
     21const defaultMethods = Object.freeze([basicCard, applePay]);
    1222const defaultDetails = Object.freeze({
    1323  total: {
  • trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-onshippingoptionchange-attribute.https.html

    r224156 r264239  
    88<script>
    99"use strict";
     10const applePay = Object.freeze({
     11  supportedMethods: "https://apple.com/apple-pay",
     12  data: {
     13    version: 3,
     14    merchantIdentifier: "merchant.com.example",
     15    countryCode: "US",
     16    merchantCapabilities: ["supports3DS"],
     17    supportedNetworks: ["visa"],
     18  }
     19});
    1020const basicCard = Object.freeze({ supportedMethods: "basic-card" });
    11 const defaultMethods = Object.freeze([basicCard]);
     21const defaultMethods = Object.freeze([basicCard, applePay]);
    1222const defaultDetails = Object.freeze({
    1323  total: {
  • trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-shippingType-attribute.https.html

    r224156 r264239  
    99"use strict";
    1010const paymentShipingTypes = Object.freeze(["delivery", "pickup", "shipping"]);
     11const applePay = Object.freeze({
     12  supportedMethods: "https://apple.com/apple-pay",
     13  data: {
     14    version: 3,
     15    merchantIdentifier: "merchant.com.example",
     16    countryCode: "US",
     17    merchantCapabilities: ["supports3DS"],
     18    supportedNetworks: ["visa"],
     19  }
     20});
    1121const basicCard = Object.freeze({ supportedMethods: "basic-card" });
    12 const defaultMethods = Object.freeze([basicCard]);
     22const defaultMethods = Object.freeze([basicCard, applePay]);
    1323const defaultDetails = Object.freeze({
    1424  total: {
  • trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-show-method.https.html

    r235390 r264239  
    22<meta charset="utf-8">
    33<title>Test for PaymentRequest.show() method</title>
    4 <link rel="help" href="https://w3c.github.io/browser-payment-api/#show-method">
     4<link rel="help" href="https://w3c.github.io/payment-request/#show-method">
    55<script src="/resources/testharness.js"></script>
    66<script src="/resources/testharnessreport.js"></script>
    … …  
    1111const defaultMethods = Object.freeze([
    1212  { supportedMethods: "basic-card" },
    13   { supportedMethods: "https://apple.com/apple-pay" },
     13  {
     14    supportedMethods: "https://apple.com/apple-pay",
     15    data: {
     16      version: 3,
     17      merchantIdentifier: "merchant.com.example",
     18      countryCode: "US",
     19      merchantCapabilities: ["supports3DS"],
     20      supportedNetworks: ["visa"],
     21    }
     22  },
    1423]);
    1524
    … …  
    2736  const request = new PaymentRequest(defaultMethods, defaultDetails);
    2837  const acceptPromise = request.show();
    29   await promise_rejects(t, "SecurityError", acceptPromise);
     38  // Abort the request after 2 seconds if it has not rejected. This allows the
     39  // other tests in this file to run even if a non-compliant browser shows the
     40  // payment sheet without user activation.
     41  t.step_timeout(() => {
     42    t.force_timeout();
     43    request.abort();
     44  }, 2000);
     45
     46  await promise_rejects_dom(t, "SecurityError", acceptPromise);
    3047}, `Calling show() without being triggered by user interaction throws`);
    3148
    32 promise_test(t => {
    33   return test_driver.bless("show payment request", async () => {
    34     const request = new PaymentRequest(defaultMethods, defaultDetails);
    35     const acceptPromise = request.show(); // Sets state to "interactive"
    36     await promise_rejects(t, "InvalidStateError", request.show());
    37     await request.abort();
    38     await promise_rejects(t, "AbortError", acceptPromise);
    39   });
     49promise_test(async t => {
     50  const request = new PaymentRequest(defaultMethods, defaultDetails);
     51  const [acceptPromise] = await test_driver.bless(
     52    "test: throws if the promise [[state]] is not 'created'",
     53    () => {
     54      const acceptPromise = request.show(); // Sets state to "interactive"
     55      return [acceptPromise];
     56    });
     57  await promise_rejects_dom(t, "InvalidStateError", request.show());
     58  await request.abort();
     59  await promise_rejects_dom(t, "AbortError", acceptPromise);
    4060}, "Throws if the promise [[state]] is not 'created'.");
    4161
    42 promise_test(t => {
    43   return test_driver.bless("show payment request", async () => {
    44     const request1 = new PaymentRequest(defaultMethods, defaultDetails);
    45     const request2 = new PaymentRequest(defaultMethods, defaultDetails);
    46     const acceptPromise1 = request1.show();
    47     const acceptPromise2 = request2.show();
    48     await promise_rejects(t, "AbortError", acceptPromise2);
    49     await request1.abort();
    50     await promise_rejects(t, "AbortError", acceptPromise1);
    51   });
     62promise_test(async t => {
     63  const request1 = new PaymentRequest(defaultMethods, defaultDetails);
     64  const request2 = new PaymentRequest(defaultMethods, defaultDetails);
     65  const [acceptPromise1] = await test_driver.bless(
     66    `test: reject promise with "AbortedError" if payment request is already showing`,
     67    async () => {
     68      const acceptPromise1 = request1.show();
     69      const acceptPromise2 = request2.show();
     70      await promise_rejects_dom(t, "AbortError", acceptPromise2);
     71      return [acceptPromise1];
     72    });
     73
     74  await request1.abort();
     75  await promise_rejects_dom(t, "AbortError", acceptPromise1);
    5276}, `If the user agent's "payment request is showing" boolean is true, then return a promise rejected with an "AbortError" DOMException.`);
    5377
    54 promise_test(t => {
    55   return test_driver.bless("show payment request", async () => {
    56     const request = new PaymentRequest(
    57       [{ supportedMethods: "this-is-not-supported" }],
    58       defaultDetails
    59     );
    60     const acceptPromise = request.show();
    61     await promise_rejects(t, "NotSupportedError", acceptPromise);
    62   });
     78promise_test(async t => {
     79  const request = new PaymentRequest(
     80    [{ supportedMethods: "this-is-not-supported" }],
     81    defaultDetails
     82  );
     83  const [acceptPromise] = await test_driver.bless(
     84    `test: reject promise with "NotSupportedError"`,
     85    () => {
     86      const acceptPromise = request.show();
     87      return [acceptPromise];
     88    });
     89  await promise_rejects_dom(t, "NotSupportedError", acceptPromise);
    6390}, `If payment method consultation produces no supported method of payment, then return a promise rejected with a "NotSupportedError" DOMException.`);
    6491
    65 promise_test(t => {
    66   return test_driver.bless("show payment request", async () => {
    67     const request = new PaymentRequest(
    68       [{ supportedMethods: "basic-card" }],
    69       defaultDetails
    70     );
    71     const promises = new Set([request.show(), request.show(), request.show()]);
    72     await request.abort();
    73     assert_equals(promises.size, 3, "Must have three unique objects");
    74   });
    75 }, "Calling show() multiple times is always a new object.");
     92promise_test(async t => {
     93  const request = new PaymentRequest(defaultMethods, defaultDetails);
     94  const [p1, p2, p3] = await test_driver.bless(
     95    `test: calling show() multiple times always returns a new promise`,
     96    () => {
     97      const p1 = request.show();
     98      const p2 = request.show();
     99      const p3 = request.show();
     100      return [p1, p2, p3];
     101    });
     102  const promises = new Set([p1, p2, p3]);
     103  assert_equals(promises.size, 3, "Must have three unique objects");
     104
     105  await promise_rejects_dom(t, "InvalidStateError", p2);
     106  await promise_rejects_dom(t, "InvalidStateError", p3);
     107
     108  await request.abort();
     109  await promise_rejects_dom(t, "AbortError", p1);
     110}, "Calling show() multiple times always returns a new promise.");
     111
    76112</script>
    77113<small>
  • trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/complete-method-manual.https.html

    r235390 r264239  
    1313  const { response, request } = await getPaymentRequestResponse();
    1414  promise_test(async t => {
     15    let completePromise;
     16    let invalidComplete;
     17    let afterComplete;
    1518    try {
    1619      // We .complete() as normal, using the passed test value
    17       const completePromise = response.complete(result);
     20      completePromise = response.complete(result);
    1821      assert_true(completePromise instanceof Promise, "returns a promise");
    1922      // Immediately calling complete() again yields a rejected promise.
    20       const invalidComplete = response.complete(result);
    21       await promise_rejects(t, "InvalidStateError", invalidComplete);
     23      invalidComplete = response.complete(result);
     24      await promise_rejects_dom(t, "InvalidStateError", invalidComplete);
    2225      // but the original promise is unaffected
    2326      const returnedValue = await completePromise;
    … …  
    2932      // We now call .complete() again, to force an exception
    3033      // because [[complete]] is true.
    31       const afterComplete = response.complete(result);
    32       await promise_rejects(t, "InvalidStateError", afterComplete);
     34      afterComplete = response.complete(result);
     35      await promise_rejects_dom(t, "InvalidStateError", afterComplete);
    3336      button.innerHTML = `✅  ${button.textContent}`;
    3437    } catch (err) {
    … …  
    4245    ]);
    4346    assert_equals(
    44       allPromises.length,
     47      allPromises.size,
    4548      3,
    4649      "Calling complete() multiple times is always a new object."
    … …  
    6972  </li>
    7073  <li>
    71     <button onclick="runManualTest({completeWith: 'unknown'}, this)">
     74    <button onclick="runManualTest({completeWith: undefined}, this)">
    7275      Passing no argument defaults to "unknown",
    7376      eventually closing the sheet and doesn't throw.
    … …  
    8083  </li>
    8184  <li>
    82     <button onclick="runManualTest({completeWith: 'fail'}, this).then(done)">
     85    <button onclick="runManualTest({completeWith: 'fail'}, this)">
    8386      Passing "fail" eventually closes the sheet and doesn't throw.
    8487    </button>
     88  </li>
     89  <li>
     90    <button onclick="runManualTest({completeWith: 'unknown'}, this)">
     91      Passing "unknown" eventually closes the sheet and doesn't throw.
     92    </button>
     93  </li>
     94  <li>
     95    <button onclick="done()">Done!</button>
    8596  </li>
    8697</ol>
  • trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/helpers.js

    r235390 r264239  
    11setup({ explicit_done: true, explicit_timeout: true });
     2
     3const applePay = Object.freeze({
     4  supportedMethods: "https://apple.com/apple-pay",
     5  data: {
     6    version: 3,
     7    merchantIdentifier: "merchant.com.example",
     8    countryCode: "US",
     9    merchantCapabilities: ["supports3DS"],
     10    supportedNetworks: ["visa"],
     11  }
     12});
    213
    314const validMethod = Object.freeze({
    … …  
    516});
    617
    7 const validMethods = Object.freeze([validMethod]);
     18const validMethods = Object.freeze([validMethod, applePay]);
    819
    920const validAmount = Object.freeze({
  • trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/onpayerdetailchange-attribute-manual.https.html

    r236570 r264239  
    1717    const event = await eventPromise;
    1818    assert_true(event instanceof PaymentRequestUpdateEvent);
    19     for(const [prop, value] of Object.entries(expected)){
     19    for([prop, value] of Object.entries(expected)){
     20      if (prop === 'payerPhone') {
     21        // |payerPhone| may optionally adhere to E164 structure, which does not
     22        // contain formatting, e.g. +180000000 instead of +1-800-000-0000.
     23        // Strip out the formatting in case the user agent implements E164.
     24        // https://w3c.github.io/payment-request/#addressinit-dictionary
     25        value = value.replace(/[-\(\) ]/g, '');
     26      }
    2027      assert_equals(response[prop], value);
    2128    }
    … …  
    5360      Change payer's phone to "+1-800-000-0000".
    5461    </p>
    55     <button onclick="runTest(this, {requestPayerPhone: true}, { payerPhone: '+1-800-000-0000' })">
     62    <button onclick="runTest(this, {requestPayerPhone: true}, { payerPhone: '+18000000000' })">
    5663      PaymentRequestUpdateEvent is dispatched when payer phone changes.
    5764    </button>
    … …  
    6370<small>
    6471  If you find a buggy test, please <a href="https://github.com/web-platform-tests/wpt/issues">file a bug</a>
    65   and tag one of the <a href="https://github.com/web-platform-tests/wpt/blob/master/payment-request/OWNERS">owners</a>.
     72  and tag one of the <a href="https://github.com/web-platform-tests/wpt/blob/master/payment-request/META.yml">owners</a>.
    6673</small>
  • trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/rejects_if_not_active-manual.https.html

    r235390 r264239  
    1212  supportedMethods: "basic-card",
    1313});
    14 const validMethods = Object.freeze([validMethod]);
     14const applePay = Object.freeze({
     15  supportedMethods: "https://apple.com/apple-pay",
     16  data: {
     17    version: 3,
     18    merchantIdentifier: "merchant.com.example",
     19    countryCode: "US",
     20    merchantCapabilities: ["supports3DS"],
     21    supportedNetworks: ["visa"],
     22  }
     23});
     24const validMethods = Object.freeze([validMethod, applePay]);
    1525const validAmount = Object.freeze({
    1626  currency: "USD",
    … …  
    6373    // So, promise needs to reject appropriately.
    6474    const promise = response[methodName](...args);
    65     await promise_rejects(
     75    await promise_rejects_dom(
    6676      t,
    6777      "AbortError",
    … …  
    98108    // Now, response's relevant global object's document is no longer active.
    99109    // So, promise needs to reject appropriately.
    100     await promise_rejects(
     110    await promise_rejects_dom(
    101111      t,
    102112      "AbortError",
  • trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/retry-method-manual.https.html

    r237995 r264239  
    2626    // sets response.[[complete]] to true.
    2727    await response.complete("success");
    28     return promise_rejects(
     28    return promise_rejects_dom(
    2929      t,
    3030      "InvalidStateError",
    … …  
    4040    const { response } = await getPaymentRequestResponse();
    4141    const retryPromise = response.retry();
    42     await promise_rejects(
     42    await promise_rejects_dom(
    4343      t,
    4444      "InvalidStateError",
    … …  
    5656    const { response } = await getPaymentRequestResponse();
    5757    const retryPromise = response.retry();
    58     await promise_rejects(
    59       t,
    60       "InvalidStateError",
    61       response.complete("success"),
     58    const completePromise1 = response.complete("success");
     59    const completePromise2 = response.complete("fail");
     60    assert_not_equals(
     61      completePromise1,
     62      completePromise2,
     63      "complete() must return unique promises"
     64    );
     65    await promise_rejects_dom(
     66      t,
     67      "InvalidStateError",
     68      completePromise1,
    6269      "Calling complete() while retrying rejects with an InvalidStateError"
    6370    );
     71    await promise_rejects_dom(
     72      t,
     73      "InvalidStateError",
     74      completePromise2,
     75      "Calling complete() while retrying rejects with an InvalidStateError"
     76    );
     77    assert_not_equals(
     78      completePromise1,
     79      completePromise2,
     80      "complete() must return unique promises"
     81    );
    6482    await retryPromise;
    6583    await response.complete("success");
    … …  
    7290    const { response, request } = await getPaymentRequestResponse();
    7391    const retryPromise = response.retry();
    74     await promise_rejects(
     92    await promise_rejects_dom(
    7593      t,
    7694      "InvalidStateError",
    … …  
    98116    );
    99117    await response.complete("success");
    100     await promise_rejects(
     118    await promise_rejects_dom(
    101119      t,
    102120      "InvalidStateError",
    … …  
    111129  promise_test(async t => {
    112130    const { response } = await getPaymentRequestResponse();
    113     await promise_rejects(
     131    await promise_rejects_dom(
    114132      t,
    115133      "AbortError",
    … …  
    117135      "The user aborting a retry rejects with a AbortError"
    118136    );
    119     await promise_rejects(
     137    await promise_rejects_dom(
    120138      t,
    121139      "InvalidStateError",
    … …  
    123141      "After the user aborts, response [[complete]] is true so retry() must reject with InvalidStateError"
    124142    );
    125     await promise_rejects(
     143    await promise_rejects_dom(
    126144      t,
    127145      "InvalidStateError",
    … …  
    147165  button.disabled = true;
    148166  promise_test(async t => {
    149     const { response, request } = await getPaymentRequestResponse({ requestShipping: true });
    150     // causes "abort the update" to run
    151     const shippingChangedPromise = new Promise(resolve => {
    152       request.onshippingoptionchange = () => {
    153         event.updateWith({ total: { amount: { currency: "USD", value: "INVALID" } }});
     167    const { response, request } = await getPaymentRequestResponse({
     168      requestShipping: true,
     169    });
     170    const shipOptionChangePromise = new Promise(resolve => {
     171      request.onshippingoptionchange = event => {
     172        // causes "abort the update" to run
     173        event.updateWith({ total: "error!" });
    154174        resolve();
    155175      };
    156176    });
    157177    const retryPromise = response.retry();
    158     await shippingChangedPromise;
    159     await promise_rejects(
    160       t,
    161       new TypeError(),
     178    await shipOptionChangePromise;
     179    await promise_rejects_js(
     180      t,
     181      TypeError,
    162182      retryPromise,
    163183      "retry() aborts with a TypeError, because totals' value is invalid"
    164184    );
    165     await promise_rejects(
     185    await promise_rejects_dom(
    166186      t,
    167187      "InvalidStateError",
    … …  
    248268  <li>
    249269    <p>
    250       When shown the payment sheet, hit pay once. Then retry once.
     270      When shown the payment sheet, hit pay once.
     271      Then, change the shipping option.
     272      Select to pay again.
    251273    </p>
    252274    <button onclick="abortTheUpdate(this);">
    … …  
    270292</ol>
    271293<small>
    272   If you find a buggy test, please <a href="https://github.com/w3c/web-platform-tests/issues">file a bug</a>
    273   and tag one of the <a href="https://github.com/w3c/web-platform-tests/blob/master/payment-request/OWNERS">owners</a>.
     294  If you find a buggy test, please <a href="https://github.com/web-platform-tests/wpt/issues">file a bug</a>
     295  and tag one of the <a href="https://github.com/web-platform-tests/wpt/blob/master/payment-request/META.yml">owners</a>.
    274296</small>
  • trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/w3c-import.log

    r236570 r264239  
    2323/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/payerName-attribute-manual.https.html
    2424/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/payerPhone-attribute-manual.https.html
     25/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/payerdetailschange-updateWith-immediate-manual.https.html
     26/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/payerdetailschange-updateWith-manual.https.html
    2527/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/rejects_if_not_active-manual.https.html
    2628/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/requestId-attribute-manual.https.html
    2729/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/retry-method-manual.https.html
     30/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/retry-method-warnings-manual.https.html
    2831/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/shippingAddress-attribute-manual.https.html
    2932/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/shippingOption-attribute-manual.https.html
  • trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/rejects_if_not_active.https.html

    r237995 r264239  
    11<!DOCTYPE html>
    22<meta charset=utf-8>
    3 <link rel="help" href="https://w3c.github.io/payment-request/#show()-method">
    43<title>PaymentRequest show() rejects if doc is not fully active</title>
     4<link rel="help" href="https://w3c.github.io/payment-request/#show-method">
    55<script src="/resources/testharness.js"></script>
    66<script src="/resources/testharnessreport.js"></script>
    77<script src="/resources/testdriver.js"></script>
    88<script src="/resources/testdriver-vendor.js"></script>
    9 <link rel="help" href="https://w3c.github.io/payment-request/#dom-paymentrequest-show()">
    109<body>
    1110<script>
     11const applePay = Object.freeze({
     12  supportedMethods: "https://apple.com/apple-pay",
     13  data: {
     14    version: 3,
     15    merchantIdentifier: "merchant.com.example",
     16    countryCode: "US",
     17    merchantCapabilities: ["supports3DS"],
     18    supportedNetworks: ["visa"],
     19  }
     20});
    1221const validMethod = Object.freeze({
    1322  supportedMethods: "basic-card",
    1423});
    15 const validMethods = Object.freeze([validMethod]);
     24const validMethods = Object.freeze([validMethod, applePay]);
    1625const validAmount = Object.freeze({
    1726  currency: "USD",
    … …  
    4554  iframe.allowPaymentRequest = true;
    4655  document.body.appendChild(iframe);
    47   // We first got to page1.html, grab a PaymentRequest instance.
    48   const request1 = await getLoadedPaymentRequest(
    49     iframe,
    50     "/payment-request/resources/page1.html"
    51   );
    52   // We navigate the iframe again, putting request1's document into an inactive state.
    53   const request2 = await getLoadedPaymentRequest(
    54     iframe,
    55     "/payment-request/resources/page2.html"
    56   );
    57   await test_driver.bless("show payment request", async () => {
    58     // Now, request1's relevant global object's document is no longer active.
    59     // So, call .show(), and make sure it rejects appropriately.
    60     await promise_rejects(
    61       t,
    62       "AbortError",
    63       request1.show(),
    64       "Inactive document, so must throw AbortError"
    65     );
    66   });
    67   await test_driver.bless("show payment request", async () => {
    68     // request2 has an active document tho, so confirm it's working as expected:
    69     request2.show();
    70     await request2.abort();
    71     await promise_rejects(
    72       t,
    73       "InvalidStateError",
    74       request2.show(),
    75       "Abort already called, so InvalidStateError"
    76     );
    77     // We are done, so clean up.
    78     iframe.remove();
    79   });
    80 }, "PaymentRequest.show() aborts if the document is not active");
    81 
    82 promise_test(async t => {
    83   // We nest two iframes and wait for them to load.
    84   const outerIframe = document.createElement("iframe");
    85   outerIframe.allowPaymentRequest = true;
    86   document.body.appendChild(outerIframe);
    87   // Load the outer iframe (we don't care about the awaited request)
    88   await getLoadedPaymentRequest(
    89     outerIframe,
    90     "/payment-request/resources/page1.html"
    91   );
    92 
    93   // Now we create the inner iframe
    94   const innerIframe = outerIframe.contentDocument.createElement("iframe");
    95   innerIframe.allowPaymentRequest = true;
    96 
    97   // nest them
    98   outerIframe.contentDocument.body.appendChild(innerIframe);
    99 
    100   // load innerIframe, and get the PaymentRequest instance
    101   const request = await getLoadedPaymentRequest(
    102     innerIframe,
    103     "/payment-request/resources/page2.html"
    104   );
    105 
    106   // Navigate the outer iframe to a new location.
    107   // Wait for the load event to fire.
    108   await new Promise(resolve => {
    109     outerIframe.addEventListener("load", resolve);
    110     outerIframe.src = "/payment-request/resources/page2.html";
    111   });
    112 
    113   const showPromise = await test_driver.bless("show payment request", () => {
    114     return request.show();
    115   });
    116   // Now, request's relevant global object's document is still active
    117   // (it is the active document of the inner iframe), but is not fully active
    118   // (since the parent of the inner iframe is itself no longer active).
    119   // So, call request.show() and make sure it rejects appropriately.
    120   await promise_rejects(
    121     t,
    122     "AbortError",
    123     showPromise,
    124     "Active, but not fully active, so must throw AbortError"
    125   );
    126   // We are done, so clean up.
    127 
    128   iframe.remove();
    129 }, "PaymentRequest.show() aborts if the document is active, but not fully active");
    130 
    131 promise_test(async t => {
    132   const iframe = document.createElement("iframe");
    133   iframe.allowPaymentRequest = true;
    134   document.body.appendChild(iframe);
    13556  // Make a request in the iframe.
    13657  const request = await getLoadedPaymentRequest(
    … …  
    13859    "/payment-request/resources/page1.html"
    13960  );
    140   const showPromise = await test_driver.bless("show payment request", () => {
    141     return request.show();
     61  const [showPromise] = await test_driver.bless("show payment request", () => {
     62    return [request.show()];
    14263  });
    14364  // Navigate the iframe to a new location. Wait for the load event to fire.
    … …  
    14566    iframe.addEventListener("load", resolve);
    14667    iframe.src = "/payment-request/resources/page2.html";
     68    // An implementation may optionally reject |showPromise|.
     69    showPromise.catch(e => {});
    14770  });
    148   await promise_rejects(
    149     t,
    150     "AbortError",
    151     showPromise,
    152     "The iframe was navigated away, so showPromise must reject with AbortError"
    153   );
    154   // We are done, so clean up.
    155   iframe.remove();
    156 }, "If a payment request is showing, but its document is navigated away (so no longer fully active), the payment request aborts.");
     71
     72  // The navigaton should have dismissed the previous payment request so it
     73  // should be possible to show another one now.
     74  const request2 = new iframe.contentWindow.PaymentRequest(
     75    validMethods, validDetails);
     76  const [showPromise2] = await test_driver.bless(
     77    "show 2nd payment request", () => {
     78      return [request2.show()];
     79    });
     80
     81  // Stop the test in 1 second if it has not rejected, which means that a
     82  // payment sheet is successfully shown.
     83  t.step_timeout(async () => {
     84    // We are done, so clean up.
     85    iframe.remove();
     86    t.done();
     87  }, 1000);
     88
     89  // This should never settle because the payment sheet should be pending.
     90  await showPromise2.then(() => {
     91    assert_true(false, "Second payment should be pending but is resolved.");
     92  })
     93  .catch(e => {
     94    assert_true(false, "Second payment should be pending but is rejected.");
     95  });
     96}, "If a payment request is showing, but its document is navigated away (so no longer fully active), the payment sheet is dismissed.");
    15797</script>
  • trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/shipping-address-changed-manual.https.html

    r235390 r264239  
    99<script>
    1010setup({ explicit_done: true, explicit_timeout: true });
     11const applePay = Object.freeze({
     12  supportedMethods: "https://apple.com/apple-pay",
     13  data: {
     14    version: 3,
     15    merchantIdentifier: "merchant.com.example",
     16    countryCode: "US",
     17    merchantCapabilities: ["supports3DS"],
     18    supportedNetworks: ["visa"],
     19  }
     20});
    1121const validMethod = Object.freeze({ supportedMethods: "basic-card" });
    12 const validMethods = Object.freeze([validMethod]);
     22const validMethods = Object.freeze([validMethod, applePay]);
    1323const validAmount = Object.freeze({ currency: "USD", value: "5.00" });
    1424const validTotal = Object.freeze({
    … …  
    5464    request.show().catch(err => err);
    5565    const results = await Promise.all([listenerPromise, handlerPromise]);
    56     assert_true(
    57       results.every(obj => obj instanceof PaymentAddress),
    58       "Expected instances of PaymentAddress"
    59     );
     66    results.forEach(obj => {
     67      assert_true(obj instanceof PaymentAddress,
     68                  "Expected instance of PaymentAddress");
     69      assert_equals(obj.organization, "", "organization should be redacted");
     70      assert_equals(obj.phone, "", "phone should be redacted");
     71      assert_equals(obj.recipient, "", "recipient should be redacted");
     72      assert_equals(obj.addressLine.length, 0, "addressLine should be redacted");
     73    });
    6074    await request.abort();
    6175  });
  • trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/show-method-optional-promise-rejects-manual.https.html

    r235390 r264239  
    2525  const validMethodApplePay = Object.freeze({
    2626    supportedMethods: "https://apple.com/apple-pay",
     27    data: {
     28      version: 3,
     29      merchantIdentifier: "merchant.com.example",
     30      countryCode: "US",
     31      merchantCapabilities: ["supports3DS"],
     32      supportedNetworks: ["visa"],
     33    }
    2734  });
    2835
    … …  
    162169      const detailsPromise = Promise.resolve(badDetails);
    163170      const acceptPromise = request.show(detailsPromise);
    164       await promise_rejects(
     171      let test_func;
     172      if (typeof expectedError == "function") {
     173        test_func = promise_rejects_js;
     174      } else {
     175        test_func = promise_rejects_dom;
     176      }
     177      await test_func(
    165178        t,
    166179        expectedError,
    … …  
    197210  <li><button onclick="
    198211    const invalidDetails = { total: `this will cause a TypeError!` };
    199     testBadUpdate(this.textContent, invalidDetails, new TypeError());
     212    testBadUpdate(this.textContent, invalidDetails, TypeError);
    200213  ">
    201214  Total in the update is a string, so converting to IDL must abort the update with a TypeError.
    … …  
    204217  <li><button onclick="
    205218    const invalidDetails = { total: recursiveData };
    206     testBadUpdate(this.textContent, invalidDetails, new TypeError());
     219    testBadUpdate(this.textContent, invalidDetails, TypeError);
    207220  ">
    208221  Total is recursive, so converting to IDL must abort the update with a TypeError.
    … …  
    210223
    211224  <li><button onclick="
    212     testBadUpdate(this.textContent, invalidDetailsNegativeTotal, new TypeError());
     225    testBadUpdate(this.textContent, invalidDetailsNegativeTotal, TypeError);
    213226  ">
    214227  Updating with a negative total results in a TypeError.
    … …  
    219232      displayItems: invalidPaymentItems
    220233    });
    221     testBadUpdate(this.textContent, badDetails, new RangeError());
     234    testBadUpdate(this.textContent, badDetails, RangeError);
    222235  ">
    223236  Updating with a displayItem with an invalid currency results in RangeError.
    … …  
    229242      shippingOptions: duplicateShippingOptions,
    230243    });
    231     testBadUpdate(this.textContent, badDetails, new TypeError());
     244    testBadUpdate(this.textContent, badDetails, TypeError);
    232245  ">
    233246  Updating with duplicate shippingOptions (same IDs) results in a TypeError.
    … …  
    237250      shippingOptions: invalidShippingOptions,
    238251    });
    239     testBadUpdate(this.textContent, badDetails, new RangeError());
     252    testBadUpdate(this.textContent, badDetails, RangeError);
    240253  ">
    241254  Updating with a shippingOption with an invalid currency value results in a RangError.
    … …  
    246259    const badModifiers = { modifiers: [modifierWithInvalidTotal, validModifier] };
    247260    const badDetails = Object.assign({}, validDetails, badModifiers);
    248     testBadUpdate(this.textContent, badDetails, new RangeError());
     261    testBadUpdate(this.textContent, badDetails, RangeError);
    249262  ">
    250263  Must throw a RangeError when a modifier's total item has an invalid currency.
    … …  
    257270    };
    258271    const badDetails = Object.assign({}, validDetails, badModifiers);
    259     testBadUpdate(this.textContent, badDetails, new RangeError());
     272    testBadUpdate(this.textContent, badDetails, RangeError);
    260273  ">
    261274  Must throw a RangeError when a modifier display item has an invalid currency.
    … …  
    268281    };
    269282    const badDetails = Object.assign({}, validDetails, badModifiers);
    270     testBadUpdate(this.textContent, badDetails, new TypeError());
     283    testBadUpdate(this.textContent, badDetails, TypeError);
    271284  ">
    272285  Must throw as Modifier has a recursive dictionary.
  • trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/show-method-optional-promise-resolves-manual.https.html

    r235390 r264239  
    2424  {
    2525    supportedMethods: "https://apple.com/apple-pay",
     26    data: {
     27      version: 3,
     28      merchantIdentifier: "merchant.com.example",
     29      countryCode: "US",
     30      merchantCapabilities: ["supports3DS"],
     31      supportedNetworks: ["visa"],
     32    }
    2633  },
    2734]);
    … …  
    158165  promise_test(async t => {
    159166    const request = new PaymentRequest(validMethods, failDetails);
    160     await promise_rejects(
     167    await promise_rejects_js(
    161168      t,
    162       new TypeError(),
     169      TypeError,
    163170      request.show({
    164171        total: "This throws a TypeError",
    … …  
    174181  options = {
    175182    requestShipping: true,
    176   }
     183  },
     184  initialDetails = failDetails,
    177185) {
    178186  const testAssertion = buttonElement.textContent.trim();
    179187  buttonElement.disabled = true;
    180188  promise_test(async t => {
    181     const request = new PaymentRequest(validMethods, failDetails, options);
     189    const request = new PaymentRequest(validMethods, initialDetails, options);
    182190    const detailsPromise = Promise.resolve(details);
    183191    const acceptPromise = request.show(detailsPromise);
    184192    assert_equals(request.id, "this cannot be changed", "id must never change.");
    185     await promise_rejects(
     193    await promise_rejects_dom(
    186194      t,
    187195      "AbortError",
    … …  
    310318  </li>
    311319  <li>
     320    <button onclick="
     321      const initialDetails = {total: passTotal, id: 'this cannot be changed'};
     322      const updatedDetails = {};
     323      runUpdateDetailsAlgorithm(
     324            this, updatedDetails, {requestShipping: false}, initialDetails);
     325    ">
     326    Resolving the show promise with empty details will preserve the details from
     327    the constructor. When the payment sheet is shown, the string
     328    "✅ TEST HAS PASSED ✅" should be shown.
     329    </button>
     330  </li>
     331  <li>
    312332    <button onclick="done();">Done!</button>
    313333  </li>
  • trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/show-method-postmessage-iframe.html

    r235390 r264239  
    44const defaultMethods = Object.freeze([
    55  { supportedMethods: "basic-card" },
    6   { supportedMethods: "https://apple.com/apple-pay" },
     6  {
     7    supportedMethods: "https://apple.com/apple-pay",
     8    data: {
     9      version: 3,
     10      merchantIdentifier: "merchant.com.example",
     11      countryCode: "US",
     12      merchantCapabilities: ["supports3DS"],
     13      supportedNetworks: ["visa"],
     14    }
     15  },
    716]);
    817
  • trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/show-method-postmessage-manual.https.html

    r235390 r264239  
    1111  explicit_timeout: true,
    1212  allow_uncaught_exception: true,
    13 });
    14 
    15 const defaultMethods = Object.freeze([
    16   { supportedMethods: "basic-card" },
    17   { supportedMethods: "https://apple.com/apple-pay" },
    18 ]);
    19 
    20 const defaultDetails = Object.freeze({
    21   id: "fail",
    22   total: {
    23     label: "Total",
    24     amount: {
    25       currency: "USD",
    26       value: "1.00",
    27     },
    28   },
    29 });
    30 
    31 test(() => {
    32   assert_throws(
    33     "SecurityError",
    34     () => {
    35       const request = new PaymentRequest(defaultMethods, defaultDetails);
    36       request.show(); // <--- should throw here
    37       request.abort();
    38     },
    39     "throws a SecurityError if not triggered by user activation"
    40   );
    4113});
    4214
  • trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/updateWith-method-pmi-handling-manual.https.html

    r235390 r264239  
    11<!DOCTYPE html>
    2 <!-- Copyright © 2017 Mozilla and World Wide Web Consortium, (Massachusetts Institute of Technology, ERCIM, Keio University, Beihang). -->
    32<meta charset="utf-8">
    43<title>Test for validity of payment method identifiers when calling updateWith() method</title>
    … …  
    87<script>
    98"use strict";
    10 setup({ explicit_done: true, explicit_timeout: true });
     9setup({
     10  explicit_done: true,
     11  explicit_timeout: true,
     12  allow_uncaught_exception: true,
     13});
     14const applePay = Object.freeze({
     15  supportedMethods: "https://apple.com/apple-pay",
     16  data: {
     17    version: 3,
     18    merchantIdentifier: "merchant.com.example",
     19    countryCode: "US",
     20    merchantCapabilities: ["supports3DS"],
     21    supportedNetworks: ["visa"],
     22  },
     23});
    1124const validMethod = Object.freeze({
    1225  supportedMethods: "https://:@wpt.fyi:443/payment-request",
    1326});
    1427
    15 const validMethods = Object.freeze([validMethod]);
     28const validMethods = Object.freeze([
     29  validMethod,
     30  applePay,
     31  { supportedMethods: "basic-card" },
     32]);
    1633
    1734const validAmount = Object.freeze({
    … …  
    4259});
    4360
    44 test(() => {
    45   try {
    46     new PaymentRequest(validMethods, validDetails);
    47   } catch (err) {
    48     done();
    49     throw err;
    50   }
    51 }, "smoke test");
    52 
    5361function manualTest(button, { invalidMethod }) {
    5462  button.disabled = true;
    5563  promise_test(async t => {
    56     const request = new PaymentRequest(
    57       [{ supportedMethods: "basic-card" }],
    58       validDetails,
    59       { requestShipping: true }
    60     );
     64    const request = new PaymentRequest(validMethods, validDetails, {
     65      requestShipping: true,
     66    });
    6167    const listener = ev => {
    6268      const invalidModifier = Object.assign({}, validModifier, {
    … …  
    7177    request.addEventListener("shippingaddresschange", listener, { once: true });
    7278    const showPromise = request.show();
    73     await promise_rejects(t, new RangeError(), showPromise);
     79    await promise_rejects_js(t, RangeError, showPromise);
    7480  }, button.textContent.trim());
    7581}
    … …  
    121127  </li>
    122128  <li>
    123     <button onclick="manualTest(this, {invalidMethod: 'Basic-Card'}); done();">
     129    <button onclick="manualTest(this, {invalidMethod: 'Basic-Card'});">
    124130      Must throw if standardized PMI has uppercase characters.
    125131    </button>
     132  </li>
     133  <li>
     134    <button onclick="done();">Done!</button>
    126135  </li>
    127136</ol>
  • trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/user-abort-algorithm-manual.https.html

    r235390 r264239  
    1818  amount: validAmount,
    1919});
     20const applePay = Object.freeze({
     21  supportedMethods: "https://apple.com/apple-pay",
     22  data: {
     23    version: 3,
     24    merchantIdentifier: "merchant.com.example",
     25    countryCode: "US",
     26    merchantCapabilities: ["supports3DS"],
     27    supportedNetworks: ["visa"],
     28  }
     29});
    2030const validMethod = Object.freeze({
    2131  supportedMethods: "basic-card",
    2232});
    23 const validMethods = Object.freeze([validMethod]);
     33const validMethods = Object.freeze([validMethod, applePay]);
    2434const validDetails = Object.freeze({
    2535  total: validTotal,
    … …  
    4151    const request = new PaymentRequest(validMethods, validDetails);
    4252    // Await the user to abort
    43     await promise_rejects(t, "AbortError", request.show());
     53    await promise_rejects_dom(t, "AbortError", request.show());
    4454    // [[state]] is now closed
    45     await promise_rejects(t, "InvalidStateError", request.show());
     55    await promise_rejects_dom(t, "InvalidStateError", request.show());
    4656  }, testName.trim());
    4757}
  • trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/user-accepts-payment-request-algo-manual.https.html

    r235390 r264239  
    99<script>
    1010setup({ explicit_done: true, explicit_timeout: true });
     11const applePay = Object.freeze({
     12  supportedMethods: "https://apple.com/apple-pay",
     13  data: {
     14    version: 3,
     15    merchantIdentifier: "merchant.com.example",
     16    countryCode: "US",
     17    merchantCapabilities: ["supports3DS"],
     18    supportedNetworks: ["visa"],
     19  }
     20});
    1121const basicCardMethod = Object.freeze({
    1222  supportedMethods: "basic-card",
    … …  
    1525  supportedMethods: "this-is-just-for-testings-will-never-match",
    1626});
    17 const methods = Object.freeze([basicCardMethod, validMethod]);
     27const methods = Object.freeze([basicCardMethod, validMethod, applePay]);
    1828const validAmount = Object.freeze({
    1929  currency: "USD",
    … …  
    8898    // For good measure, test that subsequent complete()
    8999    for (const state of [undefined, "success", "fail", "unknown"]) {
    90       await promise_rejects(
     100      await promise_rejects_dom(
    91101        t,
    92102        "InvalidStateError",
    … …  
    134144      );
    135145    }
    136     await promise_rejects(
     146    await promise_rejects_dom(
    137147      t,
    138148      "InvalidStateError",
  • trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/w3c-import.log

    r253986 r264239  
    1717/LayoutTests/imported/w3c/web-platform-tests/payment-request/META.yml
    1818/LayoutTests/imported/w3c/web-platform-tests/payment-request/algorithms-manual.https.html
     19/LayoutTests/imported/w3c/web-platform-tests/payment-request/billing-address-changed-manual.https.html
     20/LayoutTests/imported/w3c/web-platform-tests/payment-request/blank.html
    1921/LayoutTests/imported/w3c/web-platform-tests/payment-request/change-shipping-option-manual.https.html
    2022/LayoutTests/imported/w3c/web-platform-tests/payment-request/change-shipping-option-select-last-manual.https.html
    2123/LayoutTests/imported/w3c/web-platform-tests/payment-request/constructor_convert_method_data.https.html
     24/LayoutTests/imported/w3c/web-platform-tests/payment-request/dynamically-change-shipping-options-manual.https.html
    2225/LayoutTests/imported/w3c/web-platform-tests/payment-request/historical.https.html
    2326/LayoutTests/imported/w3c/web-platform-tests/payment-request/idlharness.https.window.js
    2427/LayoutTests/imported/w3c/web-platform-tests/payment-request/onmerchantvalidation-attribute.https.html
    25 /LayoutTests/imported/w3c/web-platform-tests/payment-request/onpaymentmenthodchange-attribute.https.html
     28/LayoutTests/imported/w3c/web-platform-tests/payment-request/onpaymentmethodchange-attribute.https.html
     29/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-is-showing.https.html
    2630/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-abort-method.https.html
    2731/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-canmakepayment-method-protection.https.html
    2832/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-canmakepayment-method.https.html
    29 /LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-constructor-crash.https.html
    30 /LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-constructor.https.html
    31 /LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-ctor-currency-code-checks.https.html
    32 /LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-ctor-pmi-handling.https.html
     33/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-constructor-thcrash.https.html
     34/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-constructor.https.sub.html
     35/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-ctor-currency-code-checks.https.sub.html
     36/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-ctor-pmi-handling.https.sub.html
     37/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-hasenrolledinstrument-method-manual.tentative.https.html
     38/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-hasenrolledinstrument-method-protection.tentative.https.html
     39/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-hasenrolledinstrument-method.tentative.https.html
    3340/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-id-attribute.https.html
    3441/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-insecure.http.html
    … …  
    4047/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-shippingType-attribute.https.html
    4148/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-show-method.https.html
     49/LayoutTests/imported/w3c/web-platform-tests/payment-request/rejects_if_not_active-manual.https.html
    4250/LayoutTests/imported/w3c/web-platform-tests/payment-request/rejects_if_not_active.https.html
    4351/LayoutTests/imported/w3c/web-platform-tests/payment-request/shipping-address-changed-manual.https.html
  • trunk/LayoutTests/platform/ios-wk2/TestExpectations

    r264172 r264239  
    5656webkit.org/b/175611 imported/w3c/web-platform-tests/payment-request/allowpaymentrequest/setting-allowpaymentrequest-timing.https.sub.html [ Skip ]
    5757webkit.org/b/175611 imported/w3c/web-platform-tests/payment-request/allowpaymentrequest/setting-allowpaymentrequest.https.sub.html [ Skip ]
     58imported/w3c/web-platform-tests/payment-request/payment-request-canmakepayment-method.https.html [ Skip ]
     59imported/w3c/web-platform-tests/payment-request/payment-request-hasenrolledinstrument-method.tentative.https.html [ Skip ]
    5860
    5961# skip in favor of tests in http/tests/paymentrequest
  • trunk/LayoutTests/platform/mac-wk2/TestExpectations

    r264131 r264239  
    655655webkit.org/b/173779 [ Debug ] fast/scrolling/arrow-key-scroll-in-rtl-document.html [ Pass Failure ]
    656656
    657 webkit.org/b/175773 [ Debug ] imported/w3c/web-platform-tests/payment-request/payment-request-constructor-crash.https.html [ Skip ]
    658 
    659657webkit.org/b/173672 imported/w3c/web-platform-tests/fetch/http-cache/invalidate.html [ Pass Failure ]
    660658
  • trunk/LayoutTests/tests-options.json

    r264202 r264239  
    24572457        "slow"
    24582458    ],
     2459    "imported/w3c/web-platform-tests/payment-request/allowpaymentrequest/setting-allowpaymentrequest-timing.https.sub.html": [
     2460        "slow"
     2461    ],
     2462    "imported/w3c/web-platform-tests/payment-request/payment-is-showing.https.html": [
     2463        "slow"
     2464    ],
    24592465    "imported/w3c/web-platform-tests/payment-request/payment-request-constructor-crash.https.html": [
     2466        "slow"
     2467    ],
     2468    "imported/w3c/web-platform-tests/payment-request/payment-request-constructor-thcrash.https.html": [
    24602469        "slow"
    24612470    ],
Note: See TracChangeset for help on using the changeset viewer.