Title: [235600] trunk
Revision
235600
Author
[email protected]
Date
2018-09-03 10:16:00 -0700 (Mon, 03 Sep 2018)

Log Message

[Payment Request] Implement the MerchantValidationEvent constructor
https://bugs.webkit.org/show_bug.cgi?id=189235

Reviewed by Daniel Bates.

LayoutTests/imported/w3c:

Updated payment-request web platform tests to 0313d9f.

* resources/TestRepositories:
* resources/import-expectations.json:
* web-platform-tests/payment-request/MerchantValidationEvent/complete-method-manual.https.html: Added.
* web-platform-tests/payment-request/MerchantValidationEvent/constructor.http-expected.txt: Added.
* web-platform-tests/payment-request/MerchantValidationEvent/constructor.http.html: Added.
* web-platform-tests/payment-request/MerchantValidationEvent/constructor.https-expected.txt: Added.
* web-platform-tests/payment-request/MerchantValidationEvent/constructor.https.html: Added.
* web-platform-tests/payment-request/MerchantValidationEvent/w3c-import.log: Added.
* web-platform-tests/payment-request/PaymentRequestUpdateEvent/constructor.http-expected.txt: Added.
* web-platform-tests/payment-request/PaymentRequestUpdateEvent/constructor.http.html: Added.
* web-platform-tests/payment-request/PaymentRequestUpdateEvent/constructor.https-expected.txt: Added.
* web-platform-tests/payment-request/PaymentRequestUpdateEvent/constructor.https.html: Added.
* web-platform-tests/payment-request/PaymentRequestUpdateEvent/updateWith-call-immediate-manual.https.html: Added.
* web-platform-tests/payment-request/PaymentRequestUpdateEvent/updateWith-duplicate-shipping-options-manual.https.html: Added.
* web-platform-tests/payment-request/PaymentRequestUpdateEvent/updateWith-incremental-update-manual.https.html: Added.
* web-platform-tests/payment-request/PaymentRequestUpdateEvent/updateWith-method-abort-update-manual.https.html: Added.
* web-platform-tests/payment-request/PaymentRequestUpdateEvent/updateWith-state-checks-manual.https.html: Added.
* web-platform-tests/payment-request/PaymentRequestUpdateEvent/updatewith-method.https-expected.txt: Added.
* web-platform-tests/payment-request/PaymentRequestUpdateEvent/updatewith-method.https.html: Added.
* web-platform-tests/payment-request/PaymentRequestUpdateEvent/w3c-import.log: Added.
* web-platform-tests/payment-request/allowpaymentrequest/common.sub.js:
(window.onmessage.e.t.step):
(string_appeared_here.forEach):
(window.onmessage): Deleted.
* web-platform-tests/payment-request/allowpaymentrequest/echo-PaymentRequest.html:
* web-platform-tests/payment-request/onmerchantvalidation-attribute.https-expected.txt: Added.
* web-platform-tests/payment-request/onmerchantvalidation-attribute.https.html: Added.
* web-platform-tests/payment-request/w3c-import.log:

Source/WebCore:

Implemented the constructor for MerchantValidationEvent as defined in the Payment Request API W3C Editor's Draft of 30 August 2018.

Updated the payment-request web platform tests to include MerchantValidationEvent tests.

Tests: imported/w3c/web-platform-tests/payment-request/MerchantValidationEvent/constructor.http.html
       imported/w3c/web-platform-tests/payment-request/MerchantValidationEvent/constructor.https.html
       imported/w3c/web-platform-tests/payment-request/PaymentRequestUpdateEvent/constructor.http.html
       imported/w3c/web-platform-tests/payment-request/PaymentRequestUpdateEvent/constructor.https.html
       imported/w3c/web-platform-tests/payment-request/PaymentRequestUpdateEvent/updatewith-method.https.html
       imported/w3c/web-platform-tests/payment-request/onmerchantvalidation-attribute.https.html

* CMakeLists.txt:
* DerivedSources.make:
* Modules/paymentrequest/MerchantValidationEvent.cpp:
(WebCore::MerchantValidationEvent::create):
(WebCore::MerchantValidationEvent::MerchantValidationEvent):
(WebCore::MerchantValidationEvent::complete):
* Modules/paymentrequest/MerchantValidationEvent.h:
* Modules/paymentrequest/MerchantValidationEvent.idl:
* Modules/paymentrequest/MerchantValidationEventInit.h: Added.
* Modules/paymentrequest/MerchantValidationEventInit.idl: Added.
* Modules/paymentrequest/PaymentRequest.idl:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/WebCoreBuiltinNames.h:

LayoutTests:

Skipped new manual tests.

* platform/ios-wk2/TestExpectations:
* platform/mac-wk2/TestExpectations:

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (235599 => 235600)


--- trunk/LayoutTests/ChangeLog	2018-09-03 13:41:59 UTC (rev 235599)
+++ trunk/LayoutTests/ChangeLog	2018-09-03 17:16:00 UTC (rev 235600)
@@ -1,3 +1,15 @@
+2018-09-03  Andy Estes  <[email protected]>
+
+        [Payment Request] Implement the MerchantValidationEvent constructor
+        https://bugs.webkit.org/show_bug.cgi?id=189235
+
+        Reviewed by Daniel Bates.
+
+        Skipped new manual tests.
+
+        * platform/ios-wk2/TestExpectations:
+        * platform/mac-wk2/TestExpectations:
+
 2018-09-03  Frederic Wang  <[email protected]>
 
         Remove duplicate directory web-platform-tests/cssom-view

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (235599 => 235600)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2018-09-03 13:41:59 UTC (rev 235599)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2018-09-03 17:16:00 UTC (rev 235600)
@@ -1,3 +1,41 @@
+2018-09-03  Andy Estes  <[email protected]>
+
+        [Payment Request] Implement the MerchantValidationEvent constructor
+        https://bugs.webkit.org/show_bug.cgi?id=189235
+
+        Reviewed by Daniel Bates.
+
+        Updated payment-request web platform tests to 0313d9f.
+
+        * resources/TestRepositories:
+        * resources/import-expectations.json:
+        * web-platform-tests/payment-request/MerchantValidationEvent/complete-method-manual.https.html: Added.
+        * web-platform-tests/payment-request/MerchantValidationEvent/constructor.http-expected.txt: Added.
+        * web-platform-tests/payment-request/MerchantValidationEvent/constructor.http.html: Added.
+        * web-platform-tests/payment-request/MerchantValidationEvent/constructor.https-expected.txt: Added.
+        * web-platform-tests/payment-request/MerchantValidationEvent/constructor.https.html: Added.
+        * web-platform-tests/payment-request/MerchantValidationEvent/w3c-import.log: Added.
+        * web-platform-tests/payment-request/PaymentRequestUpdateEvent/constructor.http-expected.txt: Added.
+        * web-platform-tests/payment-request/PaymentRequestUpdateEvent/constructor.http.html: Added.
+        * web-platform-tests/payment-request/PaymentRequestUpdateEvent/constructor.https-expected.txt: Added.
+        * web-platform-tests/payment-request/PaymentRequestUpdateEvent/constructor.https.html: Added.
+        * web-platform-tests/payment-request/PaymentRequestUpdateEvent/updateWith-call-immediate-manual.https.html: Added.
+        * web-platform-tests/payment-request/PaymentRequestUpdateEvent/updateWith-duplicate-shipping-options-manual.https.html: Added.
+        * web-platform-tests/payment-request/PaymentRequestUpdateEvent/updateWith-incremental-update-manual.https.html: Added.
+        * web-platform-tests/payment-request/PaymentRequestUpdateEvent/updateWith-method-abort-update-manual.https.html: Added.
+        * web-platform-tests/payment-request/PaymentRequestUpdateEvent/updateWith-state-checks-manual.https.html: Added.
+        * web-platform-tests/payment-request/PaymentRequestUpdateEvent/updatewith-method.https-expected.txt: Added.
+        * web-platform-tests/payment-request/PaymentRequestUpdateEvent/updatewith-method.https.html: Added.
+        * web-platform-tests/payment-request/PaymentRequestUpdateEvent/w3c-import.log: Added.
+        * web-platform-tests/payment-request/allowpaymentrequest/common.sub.js:
+        (window.onmessage.e.t.step):
+        (string_appeared_here.forEach):
+        (window.onmessage): Deleted.
+        * web-platform-tests/payment-request/allowpaymentrequest/echo-PaymentRequest.html:
+        * web-platform-tests/payment-request/onmerchantvalidation-attribute.https-expected.txt: Added.
+        * web-platform-tests/payment-request/onmerchantvalidation-attribute.https.html: Added.
+        * web-platform-tests/payment-request/w3c-import.log:
+
 2018-09-03  Frederic Wang  <[email protected]>
 
         Remove duplicate directory web-platform-tests/cssom-view

Modified: trunk/LayoutTests/imported/w3c/resources/TestRepositories (235599 => 235600)


--- trunk/LayoutTests/imported/w3c/resources/TestRepositories	2018-09-03 13:41:59 UTC (rev 235599)
+++ trunk/LayoutTests/imported/w3c/resources/TestRepositories	2018-09-03 17:16:00 UTC (rev 235600)
@@ -2,7 +2,7 @@
     {
         "name": "web-platform-tests",
         "url": "https://github.com/web-platform-tests/wpt.git",
-        "revision": "94b33b5",
+        "revision": "0313d9f",
         "paths_to_skip": [
             "conformance-checkers",
             "docs",

Modified: trunk/LayoutTests/imported/w3c/resources/import-expectations.json (235599 => 235600)


--- trunk/LayoutTests/imported/w3c/resources/import-expectations.json	2018-09-03 13:41:59 UTC (rev 235599)
+++ trunk/LayoutTests/imported/w3c/resources/import-expectations.json	2018-09-03 17:16:00 UTC (rev 235600)
@@ -273,7 +273,6 @@
     "web-platform-tests/payment-method-basic-card": "skip", 
     "web-platform-tests/payment-method-id": "skip", 
     "web-platform-tests/payment-request": "import", 
-    "web-platform-tests/payment-request/PaymentRequestUpdateEvent": "skip", 
     "web-platform-tests/performance-timeline": "skip", 
     "web-platform-tests/pointerevents": "skip", 
     "web-platform-tests/pointerlock": "skip", 

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/MerchantValidationEvent/complete-method-manual.https.html (0 => 235600)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/MerchantValidationEvent/complete-method-manual.https.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/MerchantValidationEvent/complete-method-manual.https.html	2018-09-03 17:16:00 UTC (rev 235600)
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<link rel="help" href=""
+<title>Test for the MerchantValidationEvent's complete() method.</title>
+<script src=""
+<script src=""
+<body>
+<script>
+test(() => {
+  const event = new MerchantValidationEvent("test");
+  assert_throws(() => {
+    event.complete("");
+  })
+}, "If event's isTrusted attribute is false, then then throw an InvalidStateError DOMException.");
+</script>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/MerchantValidationEvent/constructor.http-expected.txt (0 => 235600)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/MerchantValidationEvent/constructor.http-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/MerchantValidationEvent/constructor.http-expected.txt	2018-09-03 17:16:00 UTC (rev 235600)
@@ -0,0 +1,3 @@
+
+PASS MerchantValidationEvent constructor must not be exposed in insecure context 
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/MerchantValidationEvent/constructor.http.html (0 => 235600)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/MerchantValidationEvent/constructor.http.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/MerchantValidationEvent/constructor.http.html	2018-09-03 17:16:00 UTC (rev 235600)
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>Test for MerchantValidationEvent Constructor (insecure)</title>
+<link rel="help" href=""
+<script src=""
+<script src=""
+<script>
+test(() => {
+  assert_false("MerchantValidationEvent" in Window);
+}, "MerchantValidationEvent constructor must not be exposed in insecure context");
+</script>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/MerchantValidationEvent/constructor.https-expected.txt (0 => 235600)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/MerchantValidationEvent/constructor.https-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/MerchantValidationEvent/constructor.https-expected.txt	2018-09-03 17:16:00 UTC (rev 235600)
@@ -0,0 +1,8 @@
+
+PASS MerchantValidationEvent can be constructed in secure-context. 
+PASS MerchantValidationEvent can be constructed with an EventInitDict, even if not trusted. 
+PASS MerchantValidationEvent can be dispatched, even if not trusted. 
+PASS Must have a validationURL IDL attribute, which is initialized with to the validationURL dictionary value. 
+PASS Must throw TypeError if initialized with an invalid URL. 
+PASS Relative validationURLs use the document as the base. 
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/MerchantValidationEvent/constructor.https.html (0 => 235600)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/MerchantValidationEvent/constructor.https.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/MerchantValidationEvent/constructor.https.html	2018-09-03 17:16:00 UTC (rev 235600)
@@ -0,0 +1,76 @@
+<!DOCTYPE html>
+<!-- Copyright © 2017 Chromium authors and World Wide Web Consortium, (Massachusetts Institute of Technology, ERCIM, Keio University, Beihang). -->
+<meta charset="utf-8">
+<title>Test for MerchantValidationEvent Constructor</title>
+<link rel="help" href=""
+<script src=""
+<script src=""
+<script>
+const applePay = Object.freeze({ supportedMethods: "https://apple.com/apple-pay"});
+const basicCard = Object.freeze({ supportedMethods: "basic-card" });
+const defaultMethods = Object.freeze([basicCard, applePay]);
+const defaultDetails = Object.freeze({
+  total: {
+    label: "Total",
+    amount: {
+      currency: "USD",
+      value: "1.00",
+    },
+  },
+});
+
+test(() => {
+  new MerchantValidationEvent("test");
+}, "MerchantValidationEvent can be constructed in secure-context.");
+
+test(() => {
+  const ev = new MerchantValidationEvent("test", {
+    bubbles: true,
+    cancelable: true,
+    composed: true,
+  });
+  assert_false(ev.isTrusted, "constructed in script, so not trusted");
+  assert_true(ev.bubbles, "set by EventInitDict");
+  assert_true(ev.cancelable, "set by EventInitDict");
+  assert_true(ev.composed, "set by EventInitDict");
+  assert_equals(ev.target, null, "initially null");
+  assert_equals(ev.type, "test");
+}, "MerchantValidationEvent can be constructed with an EventInitDict, even if not trusted.");
+
+test(() => {
+  const request = new PaymentRequest(defaultMethods, defaultDetails);
+  const ev = new MerchantValidationEvent("test");
+  request.addEventListener("test", evt => {
+    assert_equals(ev, evt);
+  });
+  request.dispatchEvent(ev);
+}, "MerchantValidationEvent can be dispatched, even if not trusted.");
+
+test(() => {
+  const validationURL = "https://pass.com";
+  const event = new MerchantValidationEvent("test", { validationURL });
+  assert_idl_attribute(event, "validationURL");
+  assert_equals(event.validationURL, "https://pass.com/");
+}, "Must have a validationURL IDL attribute, which is initialized with to the validationURL dictionary value.");
+
+test(() => {
+  const validationURL = "http://\u005B"; // invalid URL
+  assert_throws(new TypeError(), () => {
+    new MerchantValidationEvent("test", { validationURL })
+  });
+}, "Must throw TypeError if initialized with an invalid URL.");
+
+test(() => {
+  const validationURL = "";
+  const relativePaths = [
+    "",
+    ".",
+    "/test",
+  ]
+  for(const path of relativePaths ) {
+    const event = new MerchantValidationEvent("test", { validationURL: path });
+    const expected = new URL(path, document.location.href).href;
+    assert_equals(event.validationURL, expected);
+  }
+}, "Relative validationURLs use the document as the base.");
+</script>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/MerchantValidationEvent/w3c-import.log (0 => 235600)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/MerchantValidationEvent/w3c-import.log	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/MerchantValidationEvent/w3c-import.log	2018-09-03 17:16:00 UTC (rev 235600)
@@ -0,0 +1,19 @@
+The tests in this directory were imported from the W3C repository.
+Do NOT modify these tests directly in WebKit.
+Instead, create a pull request on the WPT github:
+	https://github.com/web-platform-tests/wpt
+
+Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport
+
+Do NOT modify or remove this file.
+
+------------------------------------------------------------------------
+Properties requiring vendor prefixes:
+None
+Property values requiring vendor prefixes:
+None
+------------------------------------------------------------------------
+List of files:
+/LayoutTests/imported/w3c/web-platform-tests/payment-request/MerchantValidationEvent/complete-method-manual.https.html
+/LayoutTests/imported/w3c/web-platform-tests/payment-request/MerchantValidationEvent/constructor.http.html
+/LayoutTests/imported/w3c/web-platform-tests/payment-request/MerchantValidationEvent/constructor.https.html

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentRequestUpdateEvent/constructor.http-expected.txt (0 => 235600)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentRequestUpdateEvent/constructor.http-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentRequestUpdateEvent/constructor.http-expected.txt	2018-09-03 17:16:00 UTC (rev 235600)
@@ -0,0 +1,3 @@
+
+PASS PaymentRequestUpdateEvent constructor must not be exposed in insecure context 
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentRequestUpdateEvent/constructor.http.html (0 => 235600)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentRequestUpdateEvent/constructor.http.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentRequestUpdateEvent/constructor.http.html	2018-09-03 17:16:00 UTC (rev 235600)
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<!-- Copyright © 2017 Chromium authors and World Wide Web Consortium, (Massachusetts Institute of Technology, ERCIM, Keio University, Beihang). -->
+<meta charset="utf-8">
+<title>Test for PaymentRequestUpdateEvent Constructor (insecure)</title>
+<link rel="help" href=""
+<script src=""
+<script src=""
+<script>
+test(() => {
+  assert_false("PaymentRequestUpdateEvent" in Window);
+}, "PaymentRequestUpdateEvent constructor must not be exposed in insecure context");
+</script>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentRequestUpdateEvent/constructor.https-expected.txt (0 => 235600)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentRequestUpdateEvent/constructor.https-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentRequestUpdateEvent/constructor.https-expected.txt	2018-09-03 17:16:00 UTC (rev 235600)
@@ -0,0 +1,5 @@
+
+PASS PaymentRequestUpdateEvent can be constructed in secure-context 
+PASS PaymentRequestUpdateEvent can be constructed with an EventInitDict, even if not trusted 
+PASS PaymentRequestUpdateEvent can be dispatched, even if not trusted 
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentRequestUpdateEvent/constructor.https.html (0 => 235600)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentRequestUpdateEvent/constructor.https.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentRequestUpdateEvent/constructor.https.html	2018-09-03 17:16:00 UTC (rev 235600)
@@ -0,0 +1,52 @@
+<!DOCTYPE html>
+<!-- Copyright © 2017 Chromium authors and World Wide Web Consortium, (Massachusetts Institute of Technology, ERCIM, Keio University, Beihang). -->
+<meta charset="utf-8">
+<title>Test for PaymentRequestUpdateEvent Constructor</title>
+<link rel="help" href=""
+<script src=""
+<script src=""
+<script>
+const basicCard = Object.freeze({ supportedMethods: "basic-card" });
+const defaultMethods = Object.freeze([basicCard]);
+const defaultDetails = Object.freeze({
+  total: {
+    label: "Total",
+    amount: {
+      currency: "USD",
+      value: "1.00",
+    },
+  },
+});
+
+test(() => {
+  try {
+    new PaymentRequestUpdateEvent("test");
+  } catch (err) {
+    assert_unreached(`Unexpected exception: ${err.message}`);
+  }
+}, "PaymentRequestUpdateEvent can be constructed in secure-context");
+
+test(() => {
+  const ev = new PaymentRequestUpdateEvent("test", {
+    bubbles: true,
+    cancelable: true,
+    composed: true,
+  });
+  assert_false(ev.isTrusted, "constructed in script, so not be trusted");
+  assert_true(ev.bubbles, "set by EventInitDict");
+  assert_true(ev.cancelable, "set by EventInitDict");
+  assert_true(ev.composed, "set by EventInitDict");
+  assert_equals(ev.target, null, "initially null");
+  assert_equals(ev.type, "test");
+}, "PaymentRequestUpdateEvent can be constructed with an EventInitDict, even if not trusted");
+
+test(() => {
+  const request = new PaymentRequest(defaultMethods, defaultDetails);
+  const ev = new PaymentRequestUpdateEvent("test");
+  request.addEventListener("test", evt => {
+    assert_equals(ev, evt);
+  });
+  request.dispatchEvent(ev);
+}, "PaymentRequestUpdateEvent can be dispatched, even if not trusted");
+
+</script>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentRequestUpdateEvent/updateWith-call-immediate-manual.https.html (0 => 235600)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentRequestUpdateEvent/updateWith-call-immediate-manual.https.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentRequestUpdateEvent/updateWith-call-immediate-manual.https.html	2018-09-03 17:16:00 UTC (rev 235600)
@@ -0,0 +1,193 @@
+<!doctype html>
+<meta charset="utf8">
+<link rel="help" href=""
+<link rel="help" href=""
+<title>
+  PaymentRequestUpdateEvent.updateWith() needs to be called immediately
+</title>
+<script src=""
+<script src=""
+<script>
+setup({ explicit_done: true, explicit_timeout: true });
+const validMethod = Object.freeze({ supportedMethods: "basic-card" });
+const validMethods = Object.freeze([validMethod]);
+const validAmount = Object.freeze({ currency: "USD", value: "5.00" });
+const validTotal = Object.freeze({
+  label: "label",
+  amount: validAmount,
+});
+const validShippingOptionA = Object.freeze({
+  id: "a-shipping-option",
+  label: "A shipping option",
+  amount: validAmount,
+  selected: true,
+});
+const validShippingOptionB = Object.freeze({
+  id: "b-shipping-option",
+  label: "B shipping option",
+  amount: validAmount,
+});
+const validDetails = Object.freeze({
+  total: validTotal,
+  shippingOptions: [validShippingOptionA, validShippingOptionB],
+});
+const validOptions = Object.freeze({
+  requestShipping: true,
+});
+
+function testImmediateUpdate({ textContent: testName }) {
+  promise_test(async t => {
+    const request = new PaymentRequest(
+      validMethods,
+      validDetails,
+      validOptions
+    );
+    const eventPromise = new Promise((resolve, reject) => {
+      request.addEventListener(
+        "shippingaddresschange",
+        async ev => {
+          // spin the event loop, sets [[waitForUpdate]] to true.
+          await Promise.resolve();
+          try {
+            ev.updateWith(validDetails);
+            resolve(); // This is bad.
+          } catch (err) {
+            reject(err); // this is good.
+          }
+        },
+        { once: true }
+      );
+    });
+    const response = await request.show();
+    await promise_rejects(
+      t,
+      "InvalidStateError",
+      eventPromise,
+      "The event loop already spun, so [[waitForUpdate]] is now true"
+    );
+    await response.complete();
+  }, testName.trim());
+}
+
+function testSubsequentUpdateWithCalls({ textContent: testName }) {
+  promise_test(async t => {
+    const request = new PaymentRequest(
+      validMethods,
+      validDetails,
+      validOptions
+    );
+    const eventPromise = new Promise((resolve, reject) => {
+      request.addEventListener("shippingaddresschange", async ev => {
+        const p = Promise.resolve(validDetails);
+        ev.updateWith(p);
+        await p;
+        try {
+          ev.updateWith(validDetails);
+          resolve(); // this is bad, we should never get to here.
+        } catch (err) {
+          reject(err); // this is good!
+        }
+      });
+    });
+    const responsePromise = request.show();
+    await promise_rejects(
+      t,
+      "InvalidStateError",
+      eventPromise,
+      "Expected eventPromise to have rejected, because updateWith() was a called twice"
+    );
+    const response = await responsePromise;
+    await response.complete();
+  }, testName.trim());
+}
+
+function testRecycleEvents({ textContent: testName }) {
+  promise_test(async t => {
+    const request = new PaymentRequest(
+      validMethods,
+      validDetails,
+      validOptions
+    );
+
+    // Register both listeners.
+    const addressChangedPromise = new Promise(resolve => {
+      request.addEventListener("shippingaddresschange", resolve, {
+        once: true,
+      });
+    });
+
+    const optionChangedPromise = new Promise(resolve => {
+      request.addEventListener("shippingoptionchange", resolve, {
+        once: true,
+      });
+    });
+
+    const responsePromise = request.show();
+
+    // Let's wait for the address to change.
+    const addressChangeEvent = await addressChangedPromise;
+
+    // Sets [[waitingForUpdate]] to true.
+    addressChangeEvent.updateWith(validDetails);
+
+    // Let's wait for the shippingOption.
+    const optionChangeEvent = await optionChangedPromise;
+
+    // Here, we try to be sneaky, and reuse the addressChangeEvent to perform the update.
+    // However, addressChangeEvent [[waitingForUpdate]] is true, so it throws.
+    assert_throws(
+      "InvalidStateError",
+      () => {
+        addressChangeEvent.updateWith(validDetails);
+      },
+      "addressChangeEvent [[waitingForUpdate]] is true, so it must throw"
+    );
+
+    // But optionChangeEvent is still usable tho, so...
+    optionChangeEvent.updateWith(validDetails);
+
+    assert_throws(
+      "InvalidStateError",
+      () => {
+        optionChangeEvent.updateWith(validDetails);
+      },
+      "optionChangeEvent [[waitingForUpdate]] is true, so it must throw"
+    );
+
+    const response = await responsePromise;
+    await response.complete();
+  }, testName.trim());
+}
+</script>
+<h2>updateWith() method</h2>
+<p>
+  Click on each button in sequence from top to bottom without refreshing the page.
+  Each button will bring up the Payment Request UI window.
+</p>
+<p>
+  When the payment sheet is shown, select a different shipping address once. Then pay.
+</p>
+<ol>
+  <li id="test-0">
+    <button _onclick_="testImmediateUpdate(this);">
+      updateWith() must be called immediately, otherwise must throw an InvalidStateError.
+    </button>
+  </li>
+  <li id="test-1">
+    <button _onclick_="testSubsequentUpdateWithCalls(this);">
+      Once the event has performed an update, subsequent calls to updateWith() must throw InvalidStateError.
+    </button>
+  </li>
+  <li id="test-2">
+    <button _onclick_="testRecycleEvents(this);">
+      Recycling events must not be possible.
+    </button> When the payment sheet is shown, select a different shipping address once, then change shipping option once. Then pay.
+  </li>
+  <li>
+    <button _onclick_="done();">Done!</button>
+  </li>
+</ol>
+<small>
+  If you find a buggy test, please <a href="" a bug</a>
+  and tag one of the <a href="" reviewers</a>.
+</small>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentRequestUpdateEvent/updateWith-duplicate-shipping-options-manual.https.html (0 => 235600)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentRequestUpdateEvent/updateWith-duplicate-shipping-options-manual.https.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentRequestUpdateEvent/updateWith-duplicate-shipping-options-manual.https.html	2018-09-03 17:16:00 UTC (rev 235600)
@@ -0,0 +1,97 @@
+<!doctype html>
+<meta charset="utf8">
+<link rel="help" href=""
+<title>
+  updateWith() method - duplicate shippingOption ids
+</title>
+<script src=""
+<script src=""
+<script>
+setup({ explicit_done: true, explicit_timeout: true });
+
+const validMethod = Object.freeze({ supportedMethods: "basic-card" });
+const validMethods = [validMethod];
+const validAmount = Object.freeze({
+  currency: "USD",
+  value: "5.00",
+});
+const validShippingOption = Object.freeze({
+  id: "option1",
+  label: "Option 1",
+  amount: validAmount,
+  selected: true,
+});
+const validShippingOptions = Object.freeze([validShippingOption]);
+const validDetails = Object.freeze({
+  total: {
+    label: "Total due",
+    amount: validAmount,
+  },
+  shippingOptions: validShippingOptions,
+});
+const validOptions = Object.freeze({
+  requestShipping: true,
+});
+
+test(() => {
+  try {
+    const request = new PaymentRequest(validMethods, validDetails);
+  } catch (err) {
+    done();
+    throw err;
+  }
+}, "Must construct a PaymentRequest (smoke test)");
+
+function testFireEvents(button) {
+  button.disabled = true;
+  promise_test(async t => {
+    const request = new PaymentRequest(
+      validMethods,
+      validDetails,
+      validOptions
+    );
+    request.addEventListener("shippingaddresschange", event => {
+      // Same option, so duplicate ids
+      const otherShippingOption = Object.assign({}, validShippingOption, {
+        id: "other",
+      });
+      const shippingOptions = [
+        validShippingOption,
+        otherShippingOption,
+        validShippingOption,
+      ];
+      const newDetails = Object.assign({}, validDetails, { shippingOptions });
+      event.updateWith(newDetails);
+    });
+    const acceptPromise = request.show();
+    await promise_rejects(
+      t,
+      new TypeError(),
+      acceptPromise,
+      "Duplicate shippingOption ids must abort with TypeError"
+    );
+  }, button.textContent.trim());
+  done();
+}
+</script>
+<h2>updateWith() method - duplicate shippingOptions ids</h2>
+<p>
+  Click on each button in sequence from top to bottom without refreshing the page.
+  Each button will bring up the Payment Request UI window.
+</p>
+<p>
+  When the payment sheet is shown, select a different shipping address.
+  If you have to manually abort the test from the payment sheet, then the
+  test has failed.
+</p>
+<ol>
+  <li>
+    <button _onclick_="testFireEvents(this)">
+      If there are duplicate shippingOption ids, then abort payment request.
+    </button>
+  </li>
+</ol>
+<small>
+  If you find a buggy test, please <a href="" a bug</a>
+  and tag one of the <a href="" reviewers</a>.
+</small>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentRequestUpdateEvent/updateWith-incremental-update-manual.https.html (0 => 235600)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentRequestUpdateEvent/updateWith-incremental-update-manual.https.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentRequestUpdateEvent/updateWith-incremental-update-manual.https.html	2018-09-03 17:16:00 UTC (rev 235600)
@@ -0,0 +1,187 @@
+<!doctype html>
+<meta charset="utf8">
+<link rel="help" href=""
+<title>
+  Incremental updates via updateWith()
+</title>
+<script src=""
+<script src=""
+<script>
+setup({
+  explicit_done: true,
+  explicit_timeout: true,
+});
+
+const methods = [{
+  supportedMethods: "basic-card",
+}];
+
+const options = {
+  requestShipping: true,
+};
+
+const initialDetails = {
+  total: {
+    label: "Initial total",
+    amount: {
+      currency: "USD",
+      value: "1.0",
+    },
+  },
+  shippingOptions: [
+    {
+      id: "neutral",
+      label: "NEUTRAL SHIPPING OPTION",
+      selected: true,
+      amount: {
+        currency: "USD",
+        value: "0.00",
+      },
+    },
+  ],
+};
+
+function testFireEvent(button, updateDetails) {
+  button.disabled = true;
+  const request = new PaymentRequest(methods, initialDetails, options);
+  const handlerPromise = new Promise(resolve => {
+    request._onshippingaddresschange_ = event => {
+      event.updateWith(updateDetails);
+      resolve(event);
+    };
+  });
+  promise_test(async t => {
+    const response = await request.show();
+    const event = await handlerPromise;
+    await response.complete("success");
+  }, button.textContent.trim());
+}
+
+</script>
+<h2>
+  Incremental updates
+</h2>
+<p>
+  Click on each button in sequence from top to bottom without refreshing the page.
+  Each button will bring up the Payment Request UI window.
+</p>
+<p>
+  Unless stated otherwise, each test will update some part of the displayed payment sheet in
+  a manner indicated below. When prompted, please change or enter a new
+  shipping address, look for the tested change, and complete the payment.
+</p>
+<p>
+  If the payment request locks up or otherwise aborts, the test has failed.
+</p>
+<ol>
+  <li>
+    <button _onclick_="testFireEvent(this, {});">
+      Passing an empty dictionary does not cause the sheet to change.
+      No values in the sheet must change.
+    </button>
+  </li>
+</ol>
+
+<section>
+  <h3>Incremental updates via PaymentDetailsUpdate.total</h3>
+  <ol>
+    <li>
+      <button _onclick_="
+      const total = {
+        label: 'PASS',
+        amount: {
+          currency: 'XXX',
+          value: '20',
+        },
+      };
+      const updatedDetails = { total };
+      testFireEvent(this, updatedDetails);">
+        After changing shipping address, the total becomes XXX20, with the label "PASS".
+      </button>
+    </li>
+  </ol>
+</section>
+
+<section>
+  <h3>Incremental updates via PaymentDetailsBase.displayItems</h3>
+  <ol>
+    <li>
+      <button _onclick_="
+      const item = {
+        label: 'PASS',
+        amount: { currency: 'ABC', value: '55.00' },
+      };
+      const updatedDetails = {
+        displayItems: [ item ]
+      };
+      testFireEvent(this, updatedDetails);">
+        After changing shipping address, a new display item is shown
+        with a with label PASS, and value of ABC55.00.
+      </button>
+    </li>
+  </ol>
+</section>
+
+<section>
+  <h3>Incremental updates via PaymentDetailsBase.shippingOptions</h3>
+  <ol>
+    <li>
+      <button _onclick_="
+      const shippingOptions = [
+        {
+          id: 'pass',
+          label: 'PASS',
+          amount: { currency: 'USD', value: '1.00' },
+          selected: true,
+        },
+        {
+          id: 'fail',
+          label: 'FAIL IF THIS IS SELECTED',
+          amount: { currency: 'USD', value: '25.00' }
+        },
+      ];
+      const updatedDetails = {
+        shippingOptions
+      };
+      testFireEvent(this, updatedDetails);">
+        After changing shipping address, two new shipping options appear.
+        The shipping option labelled "PASS" with a value of USD1.0 is selected.
+      </button>
+    </li>
+  </ol>
+</section>
+
+<section>
+  <h3>Incremental updates via PaymentDetailsBase.modifiers</h3>
+  <ol>
+    <li>
+      <button _onclick_="
+      const additionalItem = {
+        label: 'PASS-DISPLAY-ITEM',
+        amount: { currency: 'USD', value: '3.00' },
+      };
+      const modifiers = [{
+        additionalDisplayItems: [ additionalItem ],
+        supportedMethods: 'basic-card',
+        total: {
+          label: 'PASS-TOTAL',
+          amount: { currency: 'USD', value: '123.00' },
+        },
+      }];
+      const updatedDetails = { modifiers };
+      testFireEvent(this, updatedDetails);">
+        After changing shipping address, a new display item is shown
+        with a with label PASS-DISPLAY-ITEM, and value of ABC55.00 and the total is
+        labelled PASS-TOTAL with a value of USD123.0
+      </button>
+    </li>
+    <li>
+      <button _onclick_="done()">DONE - see results</button>
+    </li>
+  </ol>
+</section>
+
+<small>
+  If you find a buggy test, please <a href="" a bug</a>
+  and tag one of the <a href="" reviewers</a>.
+</small>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentRequestUpdateEvent/updateWith-method-abort-update-manual.https.html (0 => 235600)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentRequestUpdateEvent/updateWith-method-abort-update-manual.https.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentRequestUpdateEvent/updateWith-method-abort-update-manual.https.html	2018-09-03 17:16:00 UTC (rev 235600)
@@ -0,0 +1,269 @@
+<!doctype html>
+<meta charset="utf8">
+<link rel="help" href=""
+<title>
+  updateWith() method - "abort the update"
+</title>
+<script src=""
+<script src=""
+<script>
+setup({ explicit_done: true, explicit_timeout: true });
+
+// PaymentMethod
+const validMethod = Object.freeze({
+  supportedMethods: "valid-but-wont-ever-match",
+});
+
+const validMethodBasicCard = Object.freeze({
+  supportedMethods: "basic-card",
+});
+
+// Methods
+const validMethods = Object.freeze([validMethodBasicCard, validMethod]);
+
+// Amounts
+const validAmount = Object.freeze({
+  currency: "USD",
+  value: "1.00",
+});
+
+const invalidAmount = Object.freeze({
+  currency: "¡INVALID!",
+  value: "A1.0",
+});
+
+const negativeAmount = Object.freeze({
+  currency: "USD",
+  value: "-1.00",
+});
+
+// Totals
+const validTotal = Object.freeze({
+  label: "Valid Total",
+  amount: validAmount,
+});
+
+const invalidTotal = Object.freeze({
+  label: "Invalid Total",
+  amount: invalidAmount,
+});
+
+const invalidNegativeTotal = Object.freeze({
+  label: "Invalid negative total",
+  amount: negativeAmount,
+});
+
+// PaymentDetailsInit
+const validDetails = Object.freeze({
+  total: validTotal,
+});
+
+const invalidDetailsNegativeTotal = Object.freeze({
+  total: invalidNegativeTotal,
+});
+
+// PaymentOptions
+const validOptions = Object.freeze({
+  requestShipping: true,
+});
+
+// PaymentItem
+const validPaymentItem = Object.freeze({
+  amount: validAmount,
+  label: "Valid payment item",
+});
+
+const invalidPaymentItem = Object.freeze({
+  amount: invalidAmount,
+  label: "Invalid payment item",
+});
+
+// PaymentItem
+const validPaymentItems = Object.freeze([validPaymentItem]);
+const invalidPaymentItems = Object.freeze([invalidPaymentItem]);
+
+// PaymentShippingOption
+const invalidShippingOption = Object.freeze({
+  id: "abc",
+  label: "Invalid shipping option",
+  amount: invalidAmount,
+  selected: true,
+});
+
+// PaymentShippingOptions
+const validShippingOption = Object.freeze({
+  id: "abc",
+  label: "valid shipping option",
+  amount: validAmount,
+});
+
+const validShippingOptions = Object.freeze([validShippingOption]);
+const invalidShippingOptions = Object.freeze([invalidShippingOption]);
+
+// PaymentDetailsModifier
+const validModifier = Object.freeze({
+  additionalDisplayItems: validPaymentItems,
+  supportedMethods: "valid-but-wont-ever-match",
+  total: validTotal,
+});
+
+const modifierWithInvalidDisplayItems = Object.freeze({
+  additionalDisplayItems: invalidPaymentItems,
+  supportedMethods: "basic-card",
+  total: validTotal,
+});
+
+const modifierWithValidDisplayItems = Object.freeze({
+  additionalDisplayItems: validPaymentItems,
+  supportedMethods: "basic-card",
+  total: validTotal,
+});
+
+const modifierWithInvalidTotal = Object.freeze({
+  additionalDisplayItems: validPaymentItems,
+  supportedMethods: "basic-card",
+  total: invalidTotal,
+});
+
+const recursiveData = {};
+recursiveData.foo = recursiveData;
+Object.freeze(recursiveData);
+
+const modifierWithRecursiveData = Object.freeze({
+  supportedMethods: validMethodBasicCard,
+  total: validTotal,
+  data: recursiveData,
+});
+
+function testBadUpdate(button, badDetails, expectedError, errorCode) {
+  button.disabled = true;
+  promise_test(async t => {
+    const request = new PaymentRequest(
+      validMethods,
+      validDetails,
+      validOptions
+    );
+    request._onshippingaddresschange_ = event => {
+      event.updateWith(badDetails);
+    };
+    // First we check the bad update.
+    const acceptPromise = request.show();
+    await promise_rejects(
+      t,
+      expectedError,
+      acceptPromise,
+      "badDetails must cause acceptPromise to reject with expectedError"
+    );
+    // The request [[state]] is now "closed", so let's check for InvalidStateError
+    await promise_rejects(
+      t,
+      "InvalidStateError",
+      request.show(),
+      "show() must reject with InvalidStateError"
+    );
+  }, button.innerText.trim());
+}
+</script>
+<h2>updateWith() method - "abort the update"</h2>
+<p>
+  Click on each button in sequence from top to bottom without refreshing the page.
+  Each button will bring up the Payment Request UI window.
+</p>
+<p>
+  When the payment sheet is shown, change the shipping address.
+</p>
+<ol>
+  <li>
+    <button _onclick_="
+      const rejectedPromise = Promise.reject(new SyntaxError('test')).catch(err => err);
+      testBadUpdate(this, rejectedPromise, 'AbortError');
+    ">
+      Rejection of detailsPromise must abort the update with an "AbortError" DOMException.
+    </button>
+  </li>
+  <li>
+    <button _onclick_="
+      const invalidDetails = { total: `this will cause a TypeError!` };
+      testBadUpdate(this, invalidDetails, new TypeError());
+    ">
+      Total in the update is a string, so converting to IDL must abort the update with a TypeError.
+    </button>
+  </li>
+  <li>
+    <button _onclick_="
+      const invalidDetails = { total: recursiveData };
+      testBadUpdate(this, invalidDetails, new TypeError());
+    ">
+      Total is recursive, so converting to IDL must abort the update with a TypeError.
+    </button>
+  </li>
+  <li>
+    <button _onclick_="
+      testBadUpdate(this, invalidDetailsNegativeTotal, new TypeError());
+    ">
+      Updating with a negative total results in a TypeError.
+    </button>
+  </li>
+  <li>
+    <button _onclick_="
+      const badDetails = Object.assign({}, validDetails, { displayItems: invalidPaymentItems });
+      testBadUpdate(this, badDetails, new RangeError());
+    ">
+      Updating with a displayItem with an invalid currency results in TypeError.
+    </button>
+  </li>
+  <li>
+    <button _onclick_="
+      const duplicateShippingOptions = [validShippingOption, validShippingOption];
+      const badDetails = Object.assign({}, validDetails, { shippingOptions: duplicateShippingOptions });
+      testBadUpdate(this, badDetails, new TypeError());
+    ">
+      Updating with duplicate shippingOptions (same IDs) results in a TypeError.
+    </button>
+  </li>
+  <li>
+    <button _onclick_="
+      const badDetails = Object.assign({}, validDetails, { shippingOptions: invalidShippingOptions });
+      testBadUpdate(this, badDetails, new RangeError());
+    ">
+      Updating with a shippingOption with an invalid currency value results in a RangError.
+    </button>
+  </li>
+  <li>
+    <button _onclick_="
+      // validModifier is there as to avoid false positives - it should just get ignored
+      const badModifiers = { modifiers: [ modifierWithInvalidTotal, validModifier ] };
+      const badDetails = Object.assign({}, validDetails, badModifiers);
+      testBadUpdate(this, badDetails, new RangeError());
+    ">
+      Must throw a RangeError when a modifier's total item has an invalid currency.
+    </button>
+  </li>
+  <li>
+    <button _onclick_="
+      // validModifier is there as to avoid false positives - it should just get ignored
+      const badModifiers = { modifiers: [ modifierWithInvalidDisplayItems, validModifier ] };
+      const badDetails = Object.assign({}, validDetails, badModifiers);
+      testBadUpdate(this, badDetails, new RangeError());
+    ">
+      Must throw a RangeError when a modifier display item has an invalid currency.
+   </button>
+  </li>
+  <li>
+    <button _onclick_="
+      // validModifier is there as to avoid false positives - it should just get ignored
+      const badModifiers = { modifiers: [ modifierWithRecursiveData, validModifier ] };
+      const badDetails = Object.assign({}, validDetails, badModifiers);
+      testBadUpdate(this, badDetails, new TypeError());
+    ">
+      Must throw as Modifier has a recursive dictionary.
+    </button>
+  </li>
+  <li>
+    <button _onclick_="done();">Done!</button>
+  </li>
+</ol>
+<small>
+  If you find a buggy test, please <a href="" a bug</a>
+  and tag one of the <a href="" reviewers</a>.
+</small>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentRequestUpdateEvent/updateWith-state-checks-manual.https.html (0 => 235600)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentRequestUpdateEvent/updateWith-state-checks-manual.https.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentRequestUpdateEvent/updateWith-state-checks-manual.https.html	2018-09-03 17:16:00 UTC (rev 235600)
@@ -0,0 +1,115 @@
+<!doctype html>
+<meta charset="utf8">
+<link rel="help" href=""
+<title>updateWith() method - state machine checks</title>
+<script src=""
+<script src=""
+<script>
+setup({ explicit_done: true, explicit_timeout: true });
+const validMethod = Object.freeze({ supportedMethods: "basic-card" });
+const validMethods = Object.freeze([validMethod]);
+const validAmount = Object.freeze({ currency: "USD", value: "5.00" });
+const validTotal = Object.freeze({
+  label: "label",
+  amount: validAmount,
+});
+const validShippingOption = Object.freeze({
+  id: "a-shipping-option",
+  label: "A shipping option",
+  amount: validAmount,
+  selected: true,
+});
+const validDetails = Object.freeze({
+  total: validTotal,
+  shippingOptions: [validShippingOption],
+});
+const validOptions = Object.freeze({
+  requestShipping: true,
+});
+
+function getPaymentPromises() {
+  const request = new PaymentRequest(validMethods, validDetails, validOptions);
+  const eventPromise = new Promise(resolve => {
+    request.addEventListener("shippingaddresschange", resolve);
+  });
+  const responsePromise = request.show();
+  return { eventPromise, responsePromise };
+}
+
+function testRequestIsClosed(button) {
+  button.disabled = "true";
+  promise_test(async t => {
+    const { eventPromise, responsePromise } = getPaymentPromises();
+    const event = await eventPromise;
+    // We are going to abort the responsePromise, so we can ignore error.
+    responsePromise.catch(err => err);
+    // Set request.[[state]] to closed
+    await event.target.abort();
+    assert_throws(
+      "InvalidStateError",
+      () => {
+        event.updateWith(validDetails);
+      },
+      "request.[[state]] is not interactive, must throw an InvalidStateError."
+    );
+    responsePromise.catch(err => err);
+  }, button.textContent.trim());
+}
+
+function testRequestIsUpdating(button) {
+  button.disabled = "true";
+  promise_test(async t => {
+    const { eventPromise, responsePromise } = getPaymentPromises();
+    const event = await eventPromise;
+    // We are going to put a promise into a pending state
+    // check that a second call to updateWith() throws,
+    // then resolve the pending promise below.
+    let resolver;
+    const pendingPromise = new Promise(resolve => {
+      resolver = resolve;
+    });
+    // Set request.[[updating]] to true
+    event.updateWith(pendingPromise);
+    assert_throws(
+      "InvalidStateError",
+      () => {
+        event.updateWith(validDetails);
+      },
+      "request.[[updating]] to true, must throw an InvalidStateError."
+    );
+    // We got the error we wanted, so let's resolve with valid details.
+    resolver(validDetails);
+    await pendingPromise;
+    await event.target.abort();
+    responsePromise.catch(err => err);
+  }, button.textContent.trim());
+}
+
+</script>
+<h2>updateWith() method - state machine checks</h2>
+<p>
+  Click on each button in sequence from top to bottom without refreshing the page.
+  Each button will bring up the Payment Request UI window.
+</p>
+<p>
+  When the payment sheet is shown, select a different shipping address once. Then pay.
+</p>
+<ol>
+  <li id="test-0">
+    <button _onclick_="testRequestIsClosed(this);">
+      When updateWith() is called, if request.[[state]] is not "interactive", then throw an " InvalidStateError" DOMException.
+    </button>
+  </li>
+  <li id="test-1">
+    <button _onclick_="testRequestIsUpdating(this);">
+      When updateWith() is called, If request.[[updating]] is true, then throw an "InvalidStateError" DOMException.
+    </button>
+  </li>
+  <li>
+    <button _onclick_="done();">Done!</button>
+  </li>
+</ol>
+<small>
+  If you find a buggy test, please <a href="" a bug</a>
+  and tag one of the <a href="" reviewers</a>.
+</small>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentRequestUpdateEvent/updatewith-method.https-expected.txt (0 => 235600)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentRequestUpdateEvent/updatewith-method.https-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentRequestUpdateEvent/updatewith-method.https-expected.txt	2018-09-03 17:16:00 UTC (rev 235600)
@@ -0,0 +1,5 @@
+
+PASS Let target be the request which is dispatching the event. 
+PASS Calling .updateWith() with an undispatched untrusted event throws "InvalidStateError" 
+PASS Calling .updateWith() with a dispatched, untrusted event, throws "InvalidStateError" 
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentRequestUpdateEvent/updatewith-method.https.html (0 => 235600)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentRequestUpdateEvent/updatewith-method.https.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentRequestUpdateEvent/updatewith-method.https.html	2018-09-03 17:16:00 UTC (rev 235600)
@@ -0,0 +1,66 @@
+<!DOCTYPE html>
+<!-- Copyright © 2017 Chromium authors and World Wide Web Consortium, (Massachusetts Institute of Technology, ERCIM, Keio University, Beihang). -->
+<meta charset="utf-8">
+<title>Test for PaymentRequestUpdateEvent's updateWith() method</title>
+<link rel="help" href=""
+<script src=""
+<script src=""
+<script>
+const basicCard = Object.freeze({ supportedMethods: "basic-card" });
+const defaultMethods = Object.freeze([basicCard]);
+const defaultDetails = Object.freeze({
+  total: {
+    label: "Total",
+    amount: {
+      currency: "USD",
+      value: "1.00",
+    },
+  },
+});
+
+test(() => {
+  // Smoke test - checks target is set as expected
+  const request = new PaymentRequest(defaultMethods, defaultDetails);
+  const ev = new PaymentRequestUpdateEvent("test");
+  request.dispatchEvent(ev);
+  assert_equals(ev.target, request, "The request and the target at the same");
+}, "Let target be the request which is dispatching the event.");
+
+// Github issue: https://github.com/w3c/browser-payment-api/issues/546
+test(() => {
+  const untrustedEvents = [
+    new PaymentRequestUpdateEvent("just a test"),
+    new PaymentRequestUpdateEvent("shippingaddresschange"),
+    new PaymentRequestUpdateEvent("shippingoptionchange"),
+  ].forEach(ev => {
+    assert_throws(
+      "InvalidStateError",
+      () => {
+        ev.updateWith(Promise.resolve());
+      },
+      `untrusted event of type "${ev.type}" must throw "InvalidStateError"`
+    );
+  });
+}, `Calling .updateWith() with an undispatched untrusted event throws "InvalidStateError"`);
+
+// Github issue: https://github.com/w3c/browser-payment-api/issues/546
+test(() => {
+  const request = new PaymentRequest(defaultMethods, defaultDetails);
+  const untrustedEvents = [
+    new PaymentRequestUpdateEvent("just a test"),
+    new PaymentRequestUpdateEvent("shippingaddresschange"),
+    new PaymentRequestUpdateEvent("shippingoptionchange"),
+  ].map(ev => {
+    request.dispatchEvent(ev); // set .target and dispatch flag
+    // unstrusted event.
+    assert_throws(
+      "InvalidStateError",
+      () => {
+        ev.updateWith(Promise.resolve())
+      },
+      `untrusted event of type "${ev.type}" must throw "InvalidStateError"`
+    );
+  });
+}, `Calling .updateWith() with a dispatched, untrusted event, throws "InvalidStateError"`);
+
+</script>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentRequestUpdateEvent/w3c-import.log (0 => 235600)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentRequestUpdateEvent/w3c-import.log	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentRequestUpdateEvent/w3c-import.log	2018-09-03 17:16:00 UTC (rev 235600)
@@ -0,0 +1,24 @@
+The tests in this directory were imported from the W3C repository.
+Do NOT modify these tests directly in WebKit.
+Instead, create a pull request on the WPT github:
+	https://github.com/web-platform-tests/wpt
+
+Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport
+
+Do NOT modify or remove this file.
+
+------------------------------------------------------------------------
+Properties requiring vendor prefixes:
+None
+Property values requiring vendor prefixes:
+None
+------------------------------------------------------------------------
+List of files:
+/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentRequestUpdateEvent/constructor.http.html
+/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentRequestUpdateEvent/constructor.https.html
+/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentRequestUpdateEvent/updateWith-call-immediate-manual.https.html
+/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentRequestUpdateEvent/updateWith-duplicate-shipping-options-manual.https.html
+/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentRequestUpdateEvent/updateWith-incremental-update-manual.https.html
+/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentRequestUpdateEvent/updateWith-method-abort-update-manual.https.html
+/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentRequestUpdateEvent/updateWith-state-checks-manual.https.html
+/LayoutTests/imported/w3c/web-platform-tests/payment-request/PaymentRequestUpdateEvent/updatewith-method.https.html

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/allowpaymentrequest/common.sub.js (235599 => 235600)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/allowpaymentrequest/common.sub.js	2018-09-03 13:41:59 UTC (rev 235599)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/allowpaymentrequest/common.sub.js	2018-09-03 17:16:00 UTC (rev 235600)
@@ -5,41 +5,57 @@
 
 const tests = {};
 
-window._onmessage_ = (e) => {
+window._onmessage_ = e => {
   const result = e.data;
   const tagName = result.urlQuery;
   const t = tests[tagName];
   t.step(() => {
     if (expectSuccess[tagName]) {
-      assert_equals(result.message, 'Success');
+      assert_equals(result.message, "Success");
+      if (result.message === "Exception") {
+        const [, code, name, stack] = result.details;
+        assert_unreached(`Unexpected exception "${name}" (${code}) ${stack}`);
+      }
     } else {
-      assert_equals(result.message, 'Exception');
-      assert_array_equals(result.details, [true /*ex instanceof DOMException*/,
-                                           DOMException.SECURITY_ERR /*ex.code*/,
-                                           'SecurityError' /*ex.name*/]);
+      assert_equals(result.message, "Exception");
+      const detailsArray = result.details.slice(0,3);
+      assert_array_equals(detailsArray, [
+        true /*ex instanceof DOMException*/,
+        DOMException.SECURITY_ERR /*ex.code*/,
+        "SecurityError" /*ex.name*/,
+      ]);
     }
     t.done();
   });
 };
 
-['iframe', 'frame', 'object', 'embed'].forEach((tagName, i) => {
-  tests[tagName] = async_test((t) => {
+["iframe", "frame", "object", "embed"].forEach((tagName, i) => {
+  tests[tagName] = async_test(t => {
     const elm = document.createElement(tagName);
     if (setAllowPaymentRequest) {
-      elm.setAttribute('allowpaymentrequest', '');
+      elm.setAttribute("allowpaymentrequest", "");
     }
-    const path = location.pathname.substring(0, location.pathname.lastIndexOf('/') + 1);
-    const url = "" ? "https://{{domains[www1]}}:{{ports[https][0]}}" : "") +
-                path + "echo-PaymentRequest.html?" + tagName;
-    if (tagName === 'object') {
+    const path = location.pathname.substring(
+      0,
+      location.pathname.lastIndexOf("/") + 1
+    );
+    const url =
+      (testCrossOrigin ? "https://{{domains[www1]}}:{{ports[https][0]}}" : "") +
+      path +
+      "echo-PaymentRequest.html?" +
+      tagName;
+    if (tagName === "object") {
       elm.data = ""
     } else {
       elm.src = ""
     }
     elm._onload_ = t.step_func(() => {
-      window[i].postMessage('What is the result of new PaymentRequest(...)?', '*');
+      window[i].postMessage(
+        "What is the result of new PaymentRequest(...)?",
+        "*"
+      );
     });
-    elm._onerror_ = t.unreached_func('elm.onerror');
+    elm._onerror_ = t.unreached_func("elm.onerror");
     document.body.appendChild(elm);
   }, tagName);
 });

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/allowpaymentrequest/echo-PaymentRequest.html (235599 => 235600)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/allowpaymentrequest/echo-PaymentRequest.html	2018-09-03 13:41:59 UTC (rev 235599)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/allowpaymentrequest/echo-PaymentRequest.html	2018-09-03 17:16:00 UTC (rev 235600)
@@ -11,7 +11,9 @@
       e.source.postMessage(result, '*');
     } catch(ex) {
       result.message = 'Exception';
-      result.details = [ex instanceof DOMException, ex.code, ex.name];
+      const isDomException = ex instanceof DOMException;
+      const stack = "stack" in ex ? ex.stack : "";
+      result.details = [ isDomException, ex.code, ex.name, stack ];
       e.source.postMessage(result, '*');
     }
   } else {

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/onmerchantvalidation-attribute.https-expected.txt (0 => 235600)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/onmerchantvalidation-attribute.https-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/onmerchantvalidation-attribute.https-expected.txt	2018-09-03 17:16:00 UTC (rev 235600)
@@ -0,0 +1,6 @@
+
+PASS Must have a onmerchantvalidation IDL attribute 
+PASS onmerchantvalidation attribute is a generic handler for "merchantvalidation" 
+PASS onmerchantvalidation attribute is a handler for MerchantValidationEvent 
+PASS onmerchantvalidation attribute and listeners both work 
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/onmerchantvalidation-attribute.https.html (0 => 235600)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/onmerchantvalidation-attribute.https.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/onmerchantvalidation-attribute.https.html	2018-09-03 17:16:00 UTC (rev 235600)
@@ -0,0 +1,69 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>Test for PaymentRequest's onmerchantvalidation attribute</title>
+<link rel="help" href=""
+<script src=""
+<script src=""
+<script>
+"use strict";
+const testMethod = Object.freeze({ supportedMethods: "not-a-real-method" });
+const applePay = Object.freeze({ supportedMethods: "https://apple.com/apple-pay" });
+const defaultMethods = Object.freeze([testMethod, applePay]);
+const defaultDetails = Object.freeze({
+  total: {
+    label: "Total",
+    amount: {
+      currency: "USD",
+      value: "1.00",
+    },
+  },
+});
+const validationURL = "https://example.com";
+
+test(() => {
+  const request = new PaymentRequest(defaultMethods, defaultDetails);
+  assert_idl_attribute(request, "onmerchantvalidation");
+}, "Must have a onmerchantvalidation IDL attribute");
+
+test(() => {
+  const request = new PaymentRequest(defaultMethods, defaultDetails);
+  const ev = new Event("merchantvalidation");
+  let didHandle = false;
+  request._onmerchantvalidation_ = evt => {
+    assert_equals(ev, evt, "must be same event");
+    didHandle = true;
+  };
+  request.dispatchEvent(ev);
+  assert_true(didHandle, "event did not fire");
+}, `onmerchantvalidation attribute is a generic handler for "merchantvalidation"`);
+
+test(() => {
+  const request = new PaymentRequest(defaultMethods, defaultDetails);
+  const ev = new MerchantValidationEvent("merchantvalidation", { validationURL });
+  let didHandle = false;
+  request._onmerchantvalidation_ = evt => {
+    assert_equals(ev, evt, "must be same event");
+    didHandle = true;
+  };
+  request.dispatchEvent(ev);
+  assert_true(didHandle, "event did not fire");
+}, `onmerchantvalidation attribute is a handler for MerchantValidationEvent`);
+
+test(() => {
+  const request = new PaymentRequest(defaultMethods, defaultDetails);
+  const ev = new MerchantValidationEvent("merchantvalidation", { validationURL });
+  let didHandle = false;
+  let didListen = false;
+  request._onmerchantvalidation_ = evt => {
+    assert_equals(ev, evt, "must be same event");
+    didHandle = true;
+  };
+  request.addEventListener("merchantvalidation", evt => {
+    assert_equals(ev, evt, "must be same event");
+    didListen = true;
+  });
+  request.dispatchEvent(ev);
+  assert_true(didHandle, "onmerchantvalidation must receive the event");
+  assert_true(didListen, "addEventListener must receive the event");
+}, `onmerchantvalidation attribute and listeners both work`);
+</script>

Deleted: trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-abort-method.https-expected.txt (235599 => 235600)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-abort-method.https-expected.txt	2018-09-03 13:41:59 UTC (rev 235599)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-abort-method.https-expected.txt	2018-09-03 17:16:00 UTC (rev 235600)
@@ -1,9 +0,0 @@
-CONSOLE MESSAGE: Unhandled Promise Rejection: InvalidStateError: The object is in an invalid state.
-CONSOLE MESSAGE: Unhandled Promise Rejection: InvalidStateError: The object is in an invalid state.
-CONSOLE MESSAGE: Unhandled Promise Rejection: InvalidStateError: The object is in an invalid state.
-
-PASS Throws if the promise [[state]] is not "interactive" 
-FAIL Test for PaymentRequest.abort() method promise_test: Unhandled rejection with value: object "ReferenceError: Can't find variable: test_driver"
-FAIL Test for PaymentRequest.abort() method 1 promise_test: Unhandled rejection with value: object "ReferenceError: Can't find variable: test_driver"
-PASS Calling abort() multiple times is always a new object. 
-

Deleted: trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-canmakepayment-method.https-expected.txt (235599 => 235600)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-canmakepayment-method.https-expected.txt	2018-09-03 13:41:59 UTC (rev 235599)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-canmakepayment-method.https-expected.txt	2018-09-03 17:16:00 UTC (rev 235600)
@@ -1,10 +0,0 @@
-If you find a buggy test, please file a bug and tag one of the suggested reviewers.
-
-FAIL If request.[[state]] is "created", then return a promise that resolves to true for known method. assert_equals: if it throws, then it must be a NotAllowedError. expected "NotAllowedError" but got "Error"
-FAIL If payment method identifier and serialized parts are supported, resolve promise with true. assert_true: basic-card should be supported expected true got false
-PASS If payment method identifier is unknown, resolve promise with false. 
-PASS Optionally, at the user agent's discretion, return a promise rejected with a "NotAllowedError" DOMException. 
-FAIL If request.[[state]] is "interactive", then return a promise rejected with an "InvalidStateError" DOMException. Can't find variable: test_driver
-FAIL If request.[[state]] is "closed", then return a promise rejected with an "InvalidStateError" DOMException. Can't find variable: test_driver
-PASS Calling canMakePayment() multiple times is always a new object. 
-

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/w3c-import.log (235599 => 235600)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/w3c-import.log	2018-09-03 13:41:59 UTC (rev 235599)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/w3c-import.log	2018-09-03 17:16:00 UTC (rev 235600)
@@ -20,6 +20,7 @@
 /LayoutTests/imported/w3c/web-platform-tests/payment-request/change-shipping-option-select-last-manual.https.html
 /LayoutTests/imported/w3c/web-platform-tests/payment-request/historical.https.html
 /LayoutTests/imported/w3c/web-platform-tests/payment-request/idlharness.https.window.js
+/LayoutTests/imported/w3c/web-platform-tests/payment-request/onmerchantvalidation-attribute.https.html
 /LayoutTests/imported/w3c/web-platform-tests/payment-request/onpaymentmenthodchange-attribute.https.html
 /LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-abort-method.https.html
 /LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-canmakepayment-method.https.html

Modified: trunk/LayoutTests/platform/ios-wk2/TestExpectations (235599 => 235600)


--- trunk/LayoutTests/platform/ios-wk2/TestExpectations	2018-09-03 13:41:59 UTC (rev 235599)
+++ trunk/LayoutTests/platform/ios-wk2/TestExpectations	2018-09-03 17:16:00 UTC (rev 235600)
@@ -39,6 +39,8 @@
 webkit.org/b/175611 imported/w3c/web-platform-tests/payment-request/allowpaymentrequest/setting-allowpaymentrequest.https.sub.html [ Skip ]
 
 # skip in favor of tests in http/tests/paymentrequest
+imported/w3c/web-platform-tests/payment-request/payment-request-abort-method.https.html [ WontFix ]
+imported/w3c/web-platform-tests/payment-request/payment-request-canmakepayment-method.https.html [ WontFix ]
 imported/w3c/web-platform-tests/payment-request/payment-request-show-method.https.html [ WontFix ]
 imported/w3c/web-platform-tests/payment-request/rejects_if_not_active.https.html [ WontFix ]
 
@@ -1263,31 +1265,37 @@
 webkit.org/b/179853 [ Debug ] imported/blink/fast/text/international-iteration-simple-text.html [ Pass Failure ]
 
 # skip manual payment-request tests
-webkit.org/b/188985 imported/w3c/web-platform-tests/payment-request/PaymentValidationErrors/retry-shows-error-member-manual.https.html [ Skip ]
-webkit.org/b/188985 imported/w3c/web-platform-tests/payment-request/PaymentValidationErrors/retry-shows-payer-member-manual.https.html [ Skip ]
-webkit.org/b/188985 imported/w3c/web-platform-tests/payment-request/PaymentValidationErrors/retry-shows-shippingAddress-member-manual.https.html [ Skip ]
-webkit.org/b/188985 imported/w3c/web-platform-tests/payment-request/algorithms-manual.https.html [ Skip ]
-webkit.org/b/188985 imported/w3c/web-platform-tests/payment-request/change-shipping-option-manual.https.html [ Skip ]
-webkit.org/b/188985 imported/w3c/web-platform-tests/payment-request/change-shipping-option-select-last-manual.https.html [ Skip ]
-webkit.org/b/188985 imported/w3c/web-platform-tests/payment-request/payment-response/complete-method-manual.https.html [ Skip ]
-webkit.org/b/188985 imported/w3c/web-platform-tests/payment-request/payment-response/methodName-attribute-manual.https.html [ Skip ]
-webkit.org/b/188985 imported/w3c/web-platform-tests/payment-request/payment-response/onpayerdetailchange-attribute.manual.https.html [ Skip ]
-webkit.org/b/188985 imported/w3c/web-platform-tests/payment-request/payment-response/payerEmail-attribute-manual.https.html [ Skip ]
-webkit.org/b/188985 imported/w3c/web-platform-tests/payment-request/payment-response/payerName-attribute-manual.https.html [ Skip ]
-webkit.org/b/188985 imported/w3c/web-platform-tests/payment-request/payment-response/payerPhone-attribute-manual.https.html [ Skip ]
-webkit.org/b/188985 imported/w3c/web-platform-tests/payment-request/payment-response/rejects_if_not_active-manual.https.html [ Skip ]
-webkit.org/b/188985 imported/w3c/web-platform-tests/payment-request/payment-response/requestId-attribute-manual.https.html [ Skip ]
-webkit.org/b/188985 imported/w3c/web-platform-tests/payment-request/payment-response/retry-method-manual.https.html [ Skip ]
-webkit.org/b/188985 imported/w3c/web-platform-tests/payment-request/payment-response/shippingAddress-attribute-manual.https.html [ Skip ]
-webkit.org/b/188985 imported/w3c/web-platform-tests/payment-request/payment-response/shippingOption-attribute-manual.https.html [ Skip ]
-webkit.org/b/188985 imported/w3c/web-platform-tests/payment-request/PaymentAddress/attributes-and-toJSON-method-manual.https.html [ Skip ]
-webkit.org/b/188985 imported/w3c/web-platform-tests/payment-request/shipping-address-changed-manual.https.html [ Skip ]
-webkit.org/b/188985 imported/w3c/web-platform-tests/payment-request/show-method-optional-promise-rejects-manual.https.html [ Skip ]
-webkit.org/b/188985 imported/w3c/web-platform-tests/payment-request/show-method-optional-promise-resolves-manual.https.html [ Skip ]
-webkit.org/b/188985 imported/w3c/web-platform-tests/payment-request/show-method-postmessage-manual.https.html [ Skip ]
-webkit.org/b/188985 imported/w3c/web-platform-tests/payment-request/updateWith-method-pmi-handling-manual.https.html [ Skip ]
-webkit.org/b/188985 imported/w3c/web-platform-tests/payment-request/user-abort-algorithm-manual.https.html [ Skip ]
-webkit.org/b/188985 imported/w3c/web-platform-tests/payment-request/user-accepts-payment-request-algo-manual.https.html [ Skip ]
+imported/w3c/web-platform-tests/payment-request/MerchantValidationEvent/complete-method-manual.https.html [ Skip ]
+imported/w3c/web-platform-tests/payment-request/PaymentRequestUpdateEvent/updateWith-call-immediate-manual.https.html [ Skip ]
+imported/w3c/web-platform-tests/payment-request/PaymentRequestUpdateEvent/updateWith-duplicate-shipping-options-manual.https.html [ Skip ]
+imported/w3c/web-platform-tests/payment-request/PaymentRequestUpdateEvent/updateWith-incremental-update-manual.https.html [ Skip ]
+imported/w3c/web-platform-tests/payment-request/PaymentRequestUpdateEvent/updateWith-method-abort-update-manual.https.html [ Skip ]
+imported/w3c/web-platform-tests/payment-request/PaymentRequestUpdateEvent/updateWith-state-checks-manual.https.html [ Skip ]
+imported/w3c/web-platform-tests/payment-request/PaymentValidationErrors/retry-shows-error-member-manual.https.html [ Skip ]
+imported/w3c/web-platform-tests/payment-request/PaymentValidationErrors/retry-shows-payer-member-manual.https.html [ Skip ]
+imported/w3c/web-platform-tests/payment-request/PaymentValidationErrors/retry-shows-shippingAddress-member-manual.https.html [ Skip ]
+imported/w3c/web-platform-tests/payment-request/algorithms-manual.https.html [ Skip ]
+imported/w3c/web-platform-tests/payment-request/change-shipping-option-manual.https.html [ Skip ]
+imported/w3c/web-platform-tests/payment-request/change-shipping-option-select-last-manual.https.html [ Skip ]
+imported/w3c/web-platform-tests/payment-request/payment-response/complete-method-manual.https.html [ Skip ]
+imported/w3c/web-platform-tests/payment-request/payment-response/methodName-attribute-manual.https.html [ Skip ]
+imported/w3c/web-platform-tests/payment-request/payment-response/onpayerdetailchange-attribute.manual.https.html [ Skip ]
+imported/w3c/web-platform-tests/payment-request/payment-response/payerEmail-attribute-manual.https.html [ Skip ]
+imported/w3c/web-platform-tests/payment-request/payment-response/payerName-attribute-manual.https.html [ Skip ]
+imported/w3c/web-platform-tests/payment-request/payment-response/payerPhone-attribute-manual.https.html [ Skip ]
+imported/w3c/web-platform-tests/payment-request/payment-response/rejects_if_not_active-manual.https.html [ Skip ]
+imported/w3c/web-platform-tests/payment-request/payment-response/requestId-attribute-manual.https.html [ Skip ]
+imported/w3c/web-platform-tests/payment-request/payment-response/retry-method-manual.https.html [ Skip ]
+imported/w3c/web-platform-tests/payment-request/payment-response/shippingAddress-attribute-manual.https.html [ Skip ]
+imported/w3c/web-platform-tests/payment-request/payment-response/shippingOption-attribute-manual.https.html [ Skip ]
+imported/w3c/web-platform-tests/payment-request/PaymentAddress/attributes-and-toJSON-method-manual.https.html [ Skip ]
+imported/w3c/web-platform-tests/payment-request/shipping-address-changed-manual.https.html [ Skip ]
+imported/w3c/web-platform-tests/payment-request/show-method-optional-promise-rejects-manual.https.html [ Skip ]
+imported/w3c/web-platform-tests/payment-request/show-method-optional-promise-resolves-manual.https.html [ Skip ]
+imported/w3c/web-platform-tests/payment-request/show-method-postmessage-manual.https.html [ Skip ]
+imported/w3c/web-platform-tests/payment-request/updateWith-method-pmi-handling-manual.https.html [ Skip ]
+imported/w3c/web-platform-tests/payment-request/user-abort-algorithm-manual.https.html [ Skip ]
+imported/w3c/web-platform-tests/payment-request/user-accepts-payment-request-algo-manual.https.html [ Skip ]
 
 webkit.org/b/189087 svg/animations/animate-end-attribute-numeric-precision.html [ Pass Failure ]
 

Modified: trunk/LayoutTests/platform/mac-wk2/TestExpectations (235599 => 235600)


--- trunk/LayoutTests/platform/mac-wk2/TestExpectations	2018-09-03 13:41:59 UTC (rev 235599)
+++ trunk/LayoutTests/platform/mac-wk2/TestExpectations	2018-09-03 17:16:00 UTC (rev 235600)
@@ -42,6 +42,8 @@
 webkit.org/b/175611 imported/w3c/web-platform-tests/payment-request/allowpaymentrequest/setting-allowpaymentrequest.https.sub.html [ Skip ]
 
 # skip in favor of tests in http/tests/paymentrequest
+imported/w3c/web-platform-tests/payment-request/payment-request-abort-method.https.html [ WontFix ]
+imported/w3c/web-platform-tests/payment-request/payment-request-canmakepayment-method.https.html [ WontFix ]
 imported/w3c/web-platform-tests/payment-request/payment-request-show-method.https.html [ WontFix ]
 imported/w3c/web-platform-tests/payment-request/rejects_if_not_active.https.html [ WontFix ]
 
@@ -836,28 +838,34 @@
 [ Mojave+ ] fast/canvas/webgl/context-update-on-display-configuration.html [ Pass ]
 
 # skip manual payment-request tests
-webkit.org/b/188985 imported/w3c/web-platform-tests/payment-request/PaymentValidationErrors/retry-shows-error-member-manual.https.html [ Skip ]
-webkit.org/b/188985 imported/w3c/web-platform-tests/payment-request/PaymentValidationErrors/retry-shows-payer-member-manual.https.html [ Skip ]
-webkit.org/b/188985 imported/w3c/web-platform-tests/payment-request/PaymentValidationErrors/retry-shows-shippingAddress-member-manual.https.html [ Skip ]
-webkit.org/b/188985 imported/w3c/web-platform-tests/payment-request/algorithms-manual.https.html [ Skip ]
-webkit.org/b/188985 imported/w3c/web-platform-tests/payment-request/change-shipping-option-manual.https.html [ Skip ]
-webkit.org/b/188985 imported/w3c/web-platform-tests/payment-request/change-shipping-option-select-last-manual.https.html [ Skip ]
-webkit.org/b/188985 imported/w3c/web-platform-tests/payment-request/payment-response/complete-method-manual.https.html [ Skip ]
-webkit.org/b/188985 imported/w3c/web-platform-tests/payment-request/payment-response/methodName-attribute-manual.https.html [ Skip ]
-webkit.org/b/188985 imported/w3c/web-platform-tests/payment-request/payment-response/onpayerdetailchange-attribute.manual.https.html [ Skip ]
-webkit.org/b/188985 imported/w3c/web-platform-tests/payment-request/payment-response/payerEmail-attribute-manual.https.html [ Skip ]
-webkit.org/b/188985 imported/w3c/web-platform-tests/payment-request/payment-response/payerName-attribute-manual.https.html [ Skip ]
-webkit.org/b/188985 imported/w3c/web-platform-tests/payment-request/payment-response/payerPhone-attribute-manual.https.html [ Skip ]
-webkit.org/b/188985 imported/w3c/web-platform-tests/payment-request/payment-response/rejects_if_not_active-manual.https.html [ Skip ]
-webkit.org/b/188985 imported/w3c/web-platform-tests/payment-request/payment-response/requestId-attribute-manual.https.html [ Skip ]
-webkit.org/b/188985 imported/w3c/web-platform-tests/payment-request/payment-response/retry-method-manual.https.html [ Skip ]
-webkit.org/b/188985 imported/w3c/web-platform-tests/payment-request/payment-response/shippingAddress-attribute-manual.https.html [ Skip ]
-webkit.org/b/188985 imported/w3c/web-platform-tests/payment-request/payment-response/shippingOption-attribute-manual.https.html [ Skip ]
-webkit.org/b/188985 imported/w3c/web-platform-tests/payment-request/PaymentAddress/attributes-and-toJSON-method-manual.https.html [ Skip ]
-webkit.org/b/188985 imported/w3c/web-platform-tests/payment-request/shipping-address-changed-manual.https.html [ Skip ]
-webkit.org/b/188985 imported/w3c/web-platform-tests/payment-request/show-method-optional-promise-rejects-manual.https.html [ Skip ]
-webkit.org/b/188985 imported/w3c/web-platform-tests/payment-request/show-method-optional-promise-resolves-manual.https.html [ Skip ]
-webkit.org/b/188985 imported/w3c/web-platform-tests/payment-request/show-method-postmessage-manual.https.html [ Skip ]
-webkit.org/b/188985 imported/w3c/web-platform-tests/payment-request/updateWith-method-pmi-handling-manual.https.html [ Skip ]
-webkit.org/b/188985 imported/w3c/web-platform-tests/payment-request/user-abort-algorithm-manual.https.html [ Skip ]
-webkit.org/b/188985 imported/w3c/web-platform-tests/payment-request/user-accepts-payment-request-algo-manual.https.html [ Skip ]
+imported/w3c/web-platform-tests/payment-request/MerchantValidationEvent/complete-method-manual.https.html [ Skip ]
+imported/w3c/web-platform-tests/payment-request/PaymentRequestUpdateEvent/updateWith-call-immediate-manual.https.html [ Skip ]
+imported/w3c/web-platform-tests/payment-request/PaymentRequestUpdateEvent/updateWith-duplicate-shipping-options-manual.https.html [ Skip ]
+imported/w3c/web-platform-tests/payment-request/PaymentRequestUpdateEvent/updateWith-incremental-update-manual.https.html [ Skip ]
+imported/w3c/web-platform-tests/payment-request/PaymentRequestUpdateEvent/updateWith-method-abort-update-manual.https.html [ Skip ]
+imported/w3c/web-platform-tests/payment-request/PaymentRequestUpdateEvent/updateWith-state-checks-manual.https.html [ Skip ]
+imported/w3c/web-platform-tests/payment-request/PaymentValidationErrors/retry-shows-error-member-manual.https.html [ Skip ]
+imported/w3c/web-platform-tests/payment-request/PaymentValidationErrors/retry-shows-payer-member-manual.https.html [ Skip ]
+imported/w3c/web-platform-tests/payment-request/PaymentValidationErrors/retry-shows-shippingAddress-member-manual.https.html [ Skip ]
+imported/w3c/web-platform-tests/payment-request/algorithms-manual.https.html [ Skip ]
+imported/w3c/web-platform-tests/payment-request/change-shipping-option-manual.https.html [ Skip ]
+imported/w3c/web-platform-tests/payment-request/change-shipping-option-select-last-manual.https.html [ Skip ]
+imported/w3c/web-platform-tests/payment-request/payment-response/complete-method-manual.https.html [ Skip ]
+imported/w3c/web-platform-tests/payment-request/payment-response/methodName-attribute-manual.https.html [ Skip ]
+imported/w3c/web-platform-tests/payment-request/payment-response/onpayerdetailchange-attribute.manual.https.html [ Skip ]
+imported/w3c/web-platform-tests/payment-request/payment-response/payerEmail-attribute-manual.https.html [ Skip ]
+imported/w3c/web-platform-tests/payment-request/payment-response/payerName-attribute-manual.https.html [ Skip ]
+imported/w3c/web-platform-tests/payment-request/payment-response/payerPhone-attribute-manual.https.html [ Skip ]
+imported/w3c/web-platform-tests/payment-request/payment-response/rejects_if_not_active-manual.https.html [ Skip ]
+imported/w3c/web-platform-tests/payment-request/payment-response/requestId-attribute-manual.https.html [ Skip ]
+imported/w3c/web-platform-tests/payment-request/payment-response/retry-method-manual.https.html [ Skip ]
+imported/w3c/web-platform-tests/payment-request/payment-response/shippingAddress-attribute-manual.https.html [ Skip ]
+imported/w3c/web-platform-tests/payment-request/payment-response/shippingOption-attribute-manual.https.html [ Skip ]
+imported/w3c/web-platform-tests/payment-request/PaymentAddress/attributes-and-toJSON-method-manual.https.html [ Skip ]
+imported/w3c/web-platform-tests/payment-request/shipping-address-changed-manual.https.html [ Skip ]
+imported/w3c/web-platform-tests/payment-request/show-method-optional-promise-rejects-manual.https.html [ Skip ]
+imported/w3c/web-platform-tests/payment-request/show-method-optional-promise-resolves-manual.https.html [ Skip ]
+imported/w3c/web-platform-tests/payment-request/show-method-postmessage-manual.https.html [ Skip ]
+imported/w3c/web-platform-tests/payment-request/updateWith-method-pmi-handling-manual.https.html [ Skip ]
+imported/w3c/web-platform-tests/payment-request/user-abort-algorithm-manual.https.html [ Skip ]
+imported/w3c/web-platform-tests/payment-request/user-accepts-payment-request-algo-manual.https.html [ Skip ]

Modified: trunk/Source/WebCore/CMakeLists.txt (235599 => 235600)


--- trunk/Source/WebCore/CMakeLists.txt	2018-09-03 13:41:59 UTC (rev 235599)
+++ trunk/Source/WebCore/CMakeLists.txt	2018-09-03 17:16:00 UTC (rev 235600)
@@ -334,6 +334,7 @@
     Modules/notifications/NotificationPermissionCallback.idl
 
     Modules/paymentrequest/MerchantValidationEvent.idl
+    Modules/paymentrequest/MerchantValidationEventInit.idl
     Modules/paymentrequest/PaymentAddress.idl
     Modules/paymentrequest/PaymentComplete.idl
     Modules/paymentrequest/PaymentCurrencyAmount.idl

Modified: trunk/Source/WebCore/ChangeLog (235599 => 235600)


--- trunk/Source/WebCore/ChangeLog	2018-09-03 13:41:59 UTC (rev 235599)
+++ trunk/Source/WebCore/ChangeLog	2018-09-03 17:16:00 UTC (rev 235600)
@@ -1,3 +1,36 @@
+2018-09-03  Andy Estes  <[email protected]>
+
+        [Payment Request] Implement the MerchantValidationEvent constructor
+        https://bugs.webkit.org/show_bug.cgi?id=189235
+
+        Reviewed by Daniel Bates.
+
+        Implemented the constructor for MerchantValidationEvent as defined in the Payment Request API W3C Editor's Draft of 30 August 2018.
+
+        Updated the payment-request web platform tests to include MerchantValidationEvent tests.
+
+        Tests: imported/w3c/web-platform-tests/payment-request/MerchantValidationEvent/constructor.http.html
+               imported/w3c/web-platform-tests/payment-request/MerchantValidationEvent/constructor.https.html
+               imported/w3c/web-platform-tests/payment-request/PaymentRequestUpdateEvent/constructor.http.html
+               imported/w3c/web-platform-tests/payment-request/PaymentRequestUpdateEvent/constructor.https.html
+               imported/w3c/web-platform-tests/payment-request/PaymentRequestUpdateEvent/updatewith-method.https.html
+               imported/w3c/web-platform-tests/payment-request/onmerchantvalidation-attribute.https.html
+
+        * CMakeLists.txt:
+        * DerivedSources.make:
+        * Modules/paymentrequest/MerchantValidationEvent.cpp:
+        (WebCore::MerchantValidationEvent::create):
+        (WebCore::MerchantValidationEvent::MerchantValidationEvent):
+        (WebCore::MerchantValidationEvent::complete):
+        * Modules/paymentrequest/MerchantValidationEvent.h:
+        * Modules/paymentrequest/MerchantValidationEvent.idl:
+        * Modules/paymentrequest/MerchantValidationEventInit.h: Added.
+        * Modules/paymentrequest/MerchantValidationEventInit.idl: Added.
+        * Modules/paymentrequest/PaymentRequest.idl:
+        * Sources.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+        * bindings/js/WebCoreBuiltinNames.h:
+
 2018-09-03  Philippe Normand  <[email protected]>
 
         [GStreamer] elements registration clean-ups

Modified: trunk/Source/WebCore/DerivedSources.make (235599 => 235600)


--- trunk/Source/WebCore/DerivedSources.make	2018-09-03 13:41:59 UTC (rev 235599)
+++ trunk/Source/WebCore/DerivedSources.make	2018-09-03 17:16:00 UTC (rev 235600)
@@ -254,6 +254,7 @@
     $(WebCore)/Modules/notifications/NotificationPermission.idl \
     $(WebCore)/Modules/notifications/NotificationPermissionCallback.idl \
     $(WebCore)/Modules/paymentrequest/MerchantValidationEvent.idl \
+    $(WebCore)/Modules/paymentrequest/MerchantValidationEventInit.idl \
     $(WebCore)/Modules/paymentrequest/PaymentAddress.idl \
     $(WebCore)/Modules/paymentrequest/PaymentComplete.idl \
     $(WebCore)/Modules/paymentrequest/PaymentCurrencyAmount.idl \

Modified: trunk/Source/WebCore/Modules/paymentrequest/MerchantValidationEvent.cpp (235599 => 235600)


--- trunk/Source/WebCore/Modules/paymentrequest/MerchantValidationEvent.cpp	2018-09-03 13:41:59 UTC (rev 235599)
+++ trunk/Source/WebCore/Modules/paymentrequest/MerchantValidationEvent.cpp	2018-09-03 17:16:00 UTC (rev 235600)
@@ -28,6 +28,8 @@
 
 #if ENABLE(PAYMENT_REQUEST)
 
+#include "Document.h"
+#include "MerchantValidationEventInit.h"
 #include "PaymentRequest.h"
 
 namespace WebCore {
@@ -37,13 +39,32 @@
     return adoptRef(*new MerchantValidationEvent(type, validationURL, paymentRequest));
 }
 
+ExceptionOr<Ref<MerchantValidationEvent>> MerchantValidationEvent::create(Document& document, const AtomicString& type, MerchantValidationEventInit&& eventInit)
+{
+    URL validationURL { document.url(), eventInit.validationURL };
+    if (!validationURL.isValid())
+        return Exception { TypeError };
+
+    return adoptRef(*new MerchantValidationEvent(type, WTFMove(validationURL), WTFMove(eventInit)));
+}
+
 MerchantValidationEvent::MerchantValidationEvent(const AtomicString& type, const URL& validationURL, PaymentRequest& paymentRequest)
     : Event { type, Event::CanBubble::No, Event::IsCancelable::No }
     , m_validationURL { validationURL }
-    , m_paymentRequest { paymentRequest }
+    , m_paymentRequest { &paymentRequest }
 {
+    ASSERT(isTrusted());
+    ASSERT(m_validationURL.isValid());
 }
 
+MerchantValidationEvent::MerchantValidationEvent(const AtomicString& type, URL&& validationURL, MerchantValidationEventInit&& eventInit)
+    : Event { type, WTFMove(eventInit), IsTrusted::No }
+    , m_validationURL { WTFMove(validationURL) }
+{
+    ASSERT(!isTrusted());
+    ASSERT(m_validationURL.isValid());
+}
+
 EventInterface MerchantValidationEvent::eventInterface() const
 {
     return MerchantValidationEventInterfaceType;
@@ -54,6 +75,8 @@
     if (!isTrusted())
         return Exception { InvalidStateError };
 
+    ASSERT(m_paymentRequest);
+
     if (m_isCompleted)
         return Exception { InvalidStateError };
 

Modified: trunk/Source/WebCore/Modules/paymentrequest/MerchantValidationEvent.h (235599 => 235600)


--- trunk/Source/WebCore/Modules/paymentrequest/MerchantValidationEvent.h	2018-09-03 13:41:59 UTC (rev 235599)
+++ trunk/Source/WebCore/Modules/paymentrequest/MerchantValidationEvent.h	2018-09-03 17:16:00 UTC (rev 235600)
@@ -35,10 +35,12 @@
 class DOMPromise;
 class Document;
 class PaymentRequest;
+struct MerchantValidationEventInit;
 
 class MerchantValidationEvent final : public Event {
 public:
     static Ref<MerchantValidationEvent> create(const AtomicString&, const URL&, PaymentRequest&);
+    static ExceptionOr<Ref<MerchantValidationEvent>> create(Document&, const AtomicString&, MerchantValidationEventInit&&);
 
     const String& validationURL() const { return m_validationURL.string(); }
     ExceptionOr<void> complete(Ref<DOMPromise>&&);
@@ -45,6 +47,7 @@
 
 private:
     MerchantValidationEvent(const AtomicString&, const URL&, PaymentRequest&);
+    MerchantValidationEvent(const AtomicString&, URL&&, MerchantValidationEventInit&&);
 
     // Event
     EventInterface eventInterface() const final;
@@ -51,7 +54,7 @@
 
     bool m_isCompleted { false };
     URL m_validationURL;
-    Ref<PaymentRequest> m_paymentRequest;
+    RefPtr<PaymentRequest> m_paymentRequest;
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/Modules/paymentrequest/MerchantValidationEvent.idl (235599 => 235600)


--- trunk/Source/WebCore/Modules/paymentrequest/MerchantValidationEvent.idl	2018-09-03 13:41:59 UTC (rev 235599)
+++ trunk/Source/WebCore/Modules/paymentrequest/MerchantValidationEvent.idl	2018-09-03 17:16:00 UTC (rev 235600)
@@ -25,7 +25,11 @@
 
 [
     Conditional=PAYMENT_REQUEST,
-    NoInterfaceObject,
+    Constructor(DOMString type, optional MerchantValidationEventInit eventInitDict),
+    ConstructorCallWith=Document,
+    ConstructorMayThrowException,
+    Exposed=Window,
+    SecureContext,
 ] interface MerchantValidationEvent : Event {
     readonly attribute DOMString validationURL;
     [MayThrowException] void complete(Promise<any> merchantSessionPromise);

Copied: trunk/Source/WebCore/Modules/paymentrequest/MerchantValidationEventInit.h (from rev 235599, trunk/Source/WebCore/Modules/paymentrequest/MerchantValidationEvent.idl) (0 => 235600)


--- trunk/Source/WebCore/Modules/paymentrequest/MerchantValidationEventInit.h	                        (rev 0)
+++ trunk/Source/WebCore/Modules/paymentrequest/MerchantValidationEventInit.h	2018-09-03 17:16:00 UTC (rev 235600)
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2018 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if ENABLE(PAYMENT_REQUEST)
+
+#include "EventInit.h"
+
+namespace WebCore {
+
+struct MerchantValidationEventInit final : EventInit {
+    String validationURL;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(PAYMENT_REQUEST)

Copied: trunk/Source/WebCore/Modules/paymentrequest/MerchantValidationEventInit.idl (from rev 235599, trunk/Source/WebCore/Modules/paymentrequest/MerchantValidationEvent.idl) (0 => 235600)


--- trunk/Source/WebCore/Modules/paymentrequest/MerchantValidationEventInit.idl	                        (rev 0)
+++ trunk/Source/WebCore/Modules/paymentrequest/MerchantValidationEventInit.idl	2018-09-03 17:16:00 UTC (rev 235600)
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2018 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+[
+    Conditional=PAYMENT_REQUEST,
+] dictionary MerchantValidationEventInit : EventInit {
+    USVString validationURL = "";
+};

Modified: trunk/Source/WebCore/Modules/paymentrequest/PaymentRequest.idl (235599 => 235600)


--- trunk/Source/WebCore/Modules/paymentrequest/PaymentRequest.idl	2018-09-03 13:41:59 UTC (rev 235599)
+++ trunk/Source/WebCore/Modules/paymentrequest/PaymentRequest.idl	2018-09-03 17:16:00 UTC (rev 235600)
@@ -41,8 +41,8 @@
     readonly attribute DOMString? shippingOption;
     readonly attribute PaymentShippingType? shippingType;
 
+    attribute EventHandler onmerchantvalidation;
     attribute EventHandler onshippingaddresschange;
     attribute EventHandler onshippingoptionchange;
     attribute EventHandler onpaymentmethodchange;
-    attribute EventHandler onmerchantvalidation;
 };

Modified: trunk/Source/WebCore/Sources.txt (235599 => 235600)


--- trunk/Source/WebCore/Sources.txt	2018-09-03 13:41:59 UTC (rev 235599)
+++ trunk/Source/WebCore/Sources.txt	2018-09-03 17:16:00 UTC (rev 235600)
@@ -2764,6 +2764,7 @@
 JSMediaTrackConstraints.cpp
 JSMediaTrackSupportedConstraints.cpp
 JSMerchantValidationEvent.cpp
+JSMerchantValidationEventInit.cpp
 JSMessageChannel.cpp
 JSMessageEvent.cpp
 JSMessagePort.cpp

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (235599 => 235600)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2018-09-03 13:41:59 UTC (rev 235599)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2018-09-03 17:16:00 UTC (rev 235600)
@@ -2923,6 +2923,8 @@
 		A164A24E2134BDD800509156 /* PaymentMethodChangeEventInit.h in Headers */ = {isa = PBXBuildFile; fileRef = A164A24B2134BDD800509156 /* PaymentMethodChangeEventInit.h */; };
 		A164A2552134C1CC00509156 /* JSPaymentMethodChangeEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = A164A2512134C1CB00509156 /* JSPaymentMethodChangeEvent.h */; };
 		A164A2562134C1CC00509156 /* JSPaymentMethodChangeEventInit.h in Headers */ = {isa = PBXBuildFile; fileRef = A164A2522134C1CB00509156 /* JSPaymentMethodChangeEventInit.h */; };
+		A1677DE9213CDFAA00A08C34 /* MerchantValidationEventInit.h in Headers */ = {isa = PBXBuildFile; fileRef = A1677DE6213CDFAA00A08C34 /* MerchantValidationEventInit.h */; };
+		A1677DF0213CE0B100A08C34 /* JSMerchantValidationEventInit.h in Headers */ = {isa = PBXBuildFile; fileRef = A1677DEE213CE0B000A08C34 /* JSMerchantValidationEventInit.h */; };
 		A1763F3F1E205234001D58DE /* WebArchiveDumpSupport.h in Headers */ = {isa = PBXBuildFile; fileRef = A1763F3D1E205234001D58DE /* WebArchiveDumpSupport.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		A1763F411E20586E001D58DE /* CFNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A1763F401E20586E001D58DE /* CFNetwork.framework */; };
 		A17C81230F2A5CF7005DAAEB /* HTMLElementFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = A17C81210F2A5CF7005DAAEB /* HTMLElementFactory.h */; };
@@ -10934,6 +10936,10 @@
 		A164A2522134C1CB00509156 /* JSPaymentMethodChangeEventInit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSPaymentMethodChangeEventInit.h; sourceTree = "<group>"; };
 		A164A2532134C1CB00509156 /* JSPaymentMethodChangeEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSPaymentMethodChangeEvent.cpp; sourceTree = "<group>"; };
 		A164A2542134C1CC00509156 /* JSPaymentMethodChangeEventInit.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSPaymentMethodChangeEventInit.cpp; sourceTree = "<group>"; };
+		A1677DE6213CDFAA00A08C34 /* MerchantValidationEventInit.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MerchantValidationEventInit.h; sourceTree = "<group>"; };
+		A1677DE8213CDFAA00A08C34 /* MerchantValidationEventInit.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = MerchantValidationEventInit.idl; sourceTree = "<group>"; };
+		A1677DED213CE0AF00A08C34 /* JSMerchantValidationEventInit.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMerchantValidationEventInit.cpp; sourceTree = "<group>"; };
+		A1677DEE213CE0B000A08C34 /* JSMerchantValidationEventInit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSMerchantValidationEventInit.h; sourceTree = "<group>"; };
 		A1763F3C1E205234001D58DE /* WebArchiveDumpSupport.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebArchiveDumpSupport.mm; sourceTree = "<group>"; };
 		A1763F3D1E205234001D58DE /* WebArchiveDumpSupport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebArchiveDumpSupport.h; sourceTree = "<group>"; };
 		A1763F401E20586E001D58DE /* CFNetwork.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CFNetwork.framework; path = System/Library/Frameworks/CFNetwork.framework; sourceTree = SDKROOT; };
@@ -21236,6 +21242,8 @@
 			children = (
 				A11AE0D01FFD61DE0047348B /* JSMerchantValidationEvent.cpp */,
 				A11AE0D11FFD61DF0047348B /* JSMerchantValidationEvent.h */,
+				A1677DED213CE0AF00A08C34 /* JSMerchantValidationEventInit.cpp */,
+				A1677DEE213CE0B000A08C34 /* JSMerchantValidationEventInit.h */,
 				A1CC565F1F46146100A4555B /* JSPaymentAddress.cpp */,
 				A1CC56651F46146800A4555B /* JSPaymentAddress.h */,
 				A1CC56601F46146200A4555B /* JSPaymentComplete.cpp */,
@@ -21295,6 +21303,8 @@
 				A11AE0CA1FFD60530047348B /* MerchantValidationEvent.cpp */,
 				A11AE0C91FFD60530047348B /* MerchantValidationEvent.h */,
 				A11AE0CB1FFD60530047348B /* MerchantValidationEvent.idl */,
+				A1677DE6213CDFAA00A08C34 /* MerchantValidationEventInit.h */,
+				A1677DE8213CDFAA00A08C34 /* MerchantValidationEventInit.idl */,
 				A1CFE0311F9E71290065C345 /* PaymentAddress.cpp */,
 				A1F76B401F44CF7F0014C318 /* PaymentAddress.h */,
 				A1F76B421F44CF7F0014C318 /* PaymentAddress.idl */,
@@ -28749,6 +28759,7 @@
 				932CC0D51DFFD667004C0F9F /* JSMediaTrackConstraints.h in Headers */,
 				0787C46A1BFBDF6F006DCD7F /* JSMediaTrackSupportedConstraints.h in Headers */,
 				A11AE0D31FFD61DF0047348B /* JSMerchantValidationEvent.h in Headers */,
+				A1677DF0213CE0B100A08C34 /* JSMerchantValidationEventInit.h in Headers */,
 				E107400E0E77BDC00033AF24 /* JSMessageChannel.h in Headers */,
 				75793EC90D0CE72D007FC0AC /* JSMessageEvent.h in Headers */,
 				E1ADEDDA0E76BD93004A1A5E /* JSMessagePort.h in Headers */,
@@ -29386,6 +29397,7 @@
 				517139061BF64DEC000D5F01 /* MemoryObjectStoreCursor.h in Headers */,
 				413E00791DB0E4F2002341D2 /* MemoryRelease.h in Headers */,
 				A11AE0CC1FFD60530047348B /* MerchantValidationEvent.h in Headers */,
+				A1677DE9213CDFAA00A08C34 /* MerchantValidationEventInit.h in Headers */,
 				93309DFA099E64920056E581 /* MergeIdenticalElementsCommand.h in Headers */,
 				E1ADECCE0E76AD8B004A1A5E /* MessageChannel.h in Headers */,
 				75793E840D0CE0B3007FC0AC /* MessageEvent.h in Headers */,

Modified: trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h (235599 => 235600)


--- trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h	2018-09-03 13:41:59 UTC (rev 235599)
+++ trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h	2018-09-03 17:16:00 UTC (rev 235600)
@@ -100,6 +100,7 @@
     macro(MediaSource) \
     macro(MediaStream) \
     macro(MediaStreamTrack) \
+    macro(MerchantValidationEvent) \
     macro(ModernMediaControls) \
     macro(NavigatorCredentials) \
     macro(NavigatorMediaDevices) \
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to