Title: [235625] trunk
Revision
235625
Author
[email protected]
Date
2018-09-04 12:14:23 -0700 (Tue, 04 Sep 2018)

Log Message

[Payment Request] PaymentResponse should have an onpayerdetailchange event handler
https://bugs.webkit.org/show_bug.cgi?id=189249

Reviewed by Alex Christensen.

LayoutTests/imported/w3c:

* web-platform-tests/payment-request/payment-response/onpayerdetailchange-attribute.https-expected.txt:

Source/WebCore:

Implemented the onpayerdetailchange event handler as defined in the Payment Request API W3C Editor's Draft of 30 August 2018.

The "payer detail changed" algorithm will be implemented in a follow-up patch.

Covered by existing web platform tests.

* Modules/paymentrequest/PaymentResponse.cpp:
(WebCore::PaymentResponse::scriptExecutionContext const):
* Modules/paymentrequest/PaymentResponse.h:
* Modules/paymentrequest/PaymentResponse.idl:
* dom/EventNames.h:
* dom/EventTargetFactory.in:

Modified Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (235624 => 235625)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2018-09-04 18:53:47 UTC (rev 235624)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2018-09-04 19:14:23 UTC (rev 235625)
@@ -1,3 +1,12 @@
+2018-09-04  Andy Estes  <[email protected]>
+
+        [Payment Request] PaymentResponse should have an onpayerdetailchange event handler
+        https://bugs.webkit.org/show_bug.cgi?id=189249
+
+        Reviewed by Alex Christensen.
+
+        * web-platform-tests/payment-request/payment-response/onpayerdetailchange-attribute.https-expected.txt:
+
 2018-09-03  Andy Estes  <[email protected]>
 
         [Payment Request] Implement the MerchantValidationEvent constructor

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/onpayerdetailchange-attribute.https-expected.txt (235624 => 235625)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/onpayerdetailchange-attribute.https-expected.txt	2018-09-04 18:53:47 UTC (rev 235624)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-response/onpayerdetailchange-attribute.https-expected.txt	2018-09-04 19:14:23 UTC (rev 235625)
@@ -1,8 +1,4 @@
 
-FAIL PaymentResponse inherits from EventTarget assert_equals: expected function "function EventTarget() {
-    [native code]
-}" but got function "function () {
-    [native code]
-}"
-FAIL PaymentResponse has an onpayerdetailchange in the prototype chain assert_true: expected true got false
+PASS PaymentResponse inherits from EventTarget 
+PASS PaymentResponse has an onpayerdetailchange in the prototype chain 
 

Modified: trunk/Source/WebCore/ChangeLog (235624 => 235625)


--- trunk/Source/WebCore/ChangeLog	2018-09-04 18:53:47 UTC (rev 235624)
+++ trunk/Source/WebCore/ChangeLog	2018-09-04 19:14:23 UTC (rev 235625)
@@ -1,3 +1,23 @@
+2018-09-04  Andy Estes  <[email protected]>
+
+        [Payment Request] PaymentResponse should have an onpayerdetailchange event handler
+        https://bugs.webkit.org/show_bug.cgi?id=189249
+
+        Reviewed by Alex Christensen.
+
+        Implemented the onpayerdetailchange event handler as defined in the Payment Request API W3C Editor's Draft of 30 August 2018.
+
+        The "payer detail changed" algorithm will be implemented in a follow-up patch.
+
+        Covered by existing web platform tests.
+
+        * Modules/paymentrequest/PaymentResponse.cpp:
+        (WebCore::PaymentResponse::scriptExecutionContext const):
+        * Modules/paymentrequest/PaymentResponse.h:
+        * Modules/paymentrequest/PaymentResponse.idl:
+        * dom/EventNames.h:
+        * dom/EventTargetFactory.in:
+
 2018-09-04  Youenn Fablet  <[email protected]>
 
         Introduce LibWebRTC backends for sender and receiver

Modified: trunk/Source/WebCore/Modules/paymentrequest/PaymentResponse.cpp (235624 => 235625)


--- trunk/Source/WebCore/Modules/paymentrequest/PaymentResponse.cpp	2018-09-04 18:53:47 UTC (rev 235624)
+++ trunk/Source/WebCore/Modules/paymentrequest/PaymentResponse.cpp	2018-09-04 19:14:23 UTC (rev 235625)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2017 Apple Inc. All rights reserved.
+ * Copyright (C) 2017-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
@@ -59,6 +59,11 @@
     promise.reject(Exception { NotSupportedError });
 }
 
+ScriptExecutionContext* PaymentResponse::scriptExecutionContext() const
+{
+    return static_cast<ActiveDOMObject&>(m_request.get()).scriptExecutionContext();
+}
+
 } // namespace WebCore
 
 #endif // ENABLE(PAYMENT_REQUEST)

Modified: trunk/Source/WebCore/Modules/paymentrequest/PaymentResponse.h (235624 => 235625)


--- trunk/Source/WebCore/Modules/paymentrequest/PaymentResponse.h	2018-09-04 18:53:47 UTC (rev 235624)
+++ trunk/Source/WebCore/Modules/paymentrequest/PaymentResponse.h	2018-09-04 19:14:23 UTC (rev 235625)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2017 Apple Inc. All rights reserved.
+ * Copyright (C) 2017-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
@@ -27,6 +27,7 @@
 
 #if ENABLE(PAYMENT_REQUEST)
 
+#include "EventTarget.h"
 #include "JSDOMPromiseDeferred.h"
 #include "PaymentAddress.h"
 #include "PaymentComplete.h"
@@ -37,7 +38,7 @@
 class PaymentRequest;
 struct PaymentValidationErrors;
 
-class PaymentResponse final : public RefCounted<PaymentResponse> {
+class PaymentResponse final : public RefCounted<PaymentResponse>, public EventTargetWithInlineData {
 public:
     static Ref<PaymentResponse> create(PaymentRequest& request)
     {
@@ -73,9 +74,18 @@
     void complete(std::optional<PaymentComplete>&&, DOMPromiseDeferred<void>&&);
     void retry(PaymentValidationErrors&&, DOMPromiseDeferred<void>&&);
 
+    using RefCounted<PaymentResponse>::ref;
+    using RefCounted<PaymentResponse>::deref;
+
 private:
     explicit PaymentResponse(PaymentRequest&);
 
+    // EventTarget
+    EventTargetInterface eventTargetInterface() const final { return PaymentResponseEventTargetInterfaceType; }
+    ScriptExecutionContext* scriptExecutionContext() const final;
+    void refEventTarget() final { ref(); }
+    void derefEventTarget() final { deref(); }
+
     Ref<PaymentRequest> m_request;
     String m_requestId;
     String m_methodName;

Modified: trunk/Source/WebCore/Modules/paymentrequest/PaymentResponse.idl (235624 => 235625)


--- trunk/Source/WebCore/Modules/paymentrequest/PaymentResponse.idl	2018-09-04 18:53:47 UTC (rev 235624)
+++ trunk/Source/WebCore/Modules/paymentrequest/PaymentResponse.idl	2018-09-04 19:14:23 UTC (rev 235625)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2017 Apple Inc. All rights reserved.
+ * Copyright (C) 2017-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
@@ -26,9 +26,9 @@
 [
     Conditional=PAYMENT_REQUEST,
     EnabledBySetting=PaymentRequest,
-    ImplementationLacksVTable,
-    SecureContext
-] interface PaymentResponse {
+    Exposed=Window,
+    SecureContext,
+] interface PaymentResponse : EventTarget {
     serializer = { attribute };
 
     readonly attribute DOMString requestId;
@@ -42,4 +42,6 @@
 
     [NewObject] Promise<void> complete(optional PaymentComplete result = "unknown");
     [NewObject] Promise<void> retry(PaymentValidationErrors errorFields);
+
+    attribute EventHandler onpayerdetailchange;
 };

Modified: trunk/Source/WebCore/dom/EventNames.h (235624 => 235625)


--- trunk/Source/WebCore/dom/EventNames.h	2018-09-04 18:53:47 UTC (rev 235624)
+++ trunk/Source/WebCore/dom/EventNames.h	2018-09-04 19:14:23 UTC (rev 235625)
@@ -189,6 +189,7 @@
     macro(pageshow) \
     macro(paste) \
     macro(pause) \
+    macro(payerdetailchange) \
     macro(paymentauthorized) \
     macro(paymentmethodchange) \
     macro(paymentmethodselected) \

Modified: trunk/Source/WebCore/dom/EventTargetFactory.in (235624 => 235625)


--- trunk/Source/WebCore/dom/EventTargetFactory.in	2018-09-04 18:53:47 UTC (rev 235624)
+++ trunk/Source/WebCore/dom/EventTargetFactory.in	2018-09-04 19:14:23 UTC (rev 235625)
@@ -29,6 +29,7 @@
 Notification conditional=NOTIFICATIONS
 OffscreenCanvas
 PaymentRequest conditional=PAYMENT_REQUEST
+PaymentResponse conditional=PAYMENT_REQUEST
 Performance
 RTCDataChannel conditional=WEB_RTC
 RTCDTMFSender conditional=WEB_RTC_DTMF
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to