Modified: trunk/Source/WebCore/ChangeLog (220979 => 220980)
--- trunk/Source/WebCore/ChangeLog 2017-08-21 20:35:39 UTC (rev 220979)
+++ trunk/Source/WebCore/ChangeLog 2017-08-21 20:53:16 UTC (rev 220980)
@@ -1,3 +1,14 @@
+2017-08-21 Andy Estes <aes...@apple.com>
+
+ [Payment Request] Use ExistingExceptionError to propagate JS exceptions thrown during JSON stringification
+ https://bugs.webkit.org/show_bug.cgi?id=175776
+
+ Reviewed by Darin Adler.
+
+ * Modules/paymentrequest/PaymentRequest.cpp:
+ (WebCore::PaymentRequest::create):
+ * Modules/paymentrequest/PaymentRequest.h:
+
2017-08-21 Yoshiaki Jitsukawa <yoshiaki.jitsuk...@sony.com>
[PAL] Move spi/mac directory into PAL
Modified: trunk/Source/WebCore/Modules/paymentrequest/PaymentRequest.cpp (220979 => 220980)
--- trunk/Source/WebCore/Modules/paymentrequest/PaymentRequest.cpp 2017-08-21 20:35:39 UTC (rev 220979)
+++ trunk/Source/WebCore/Modules/paymentrequest/PaymentRequest.cpp 2017-08-21 20:53:16 UTC (rev 220980)
@@ -159,7 +159,7 @@
// Implements the PaymentRequest Constructor
// https://www.w3.org/TR/payment-request/#constructor
-ExceptionOr<RefPtr<PaymentRequest>> PaymentRequest::create(Document& document, Vector<PaymentMethodData>&& methodData, PaymentDetailsInit&& details, PaymentOptions&& options)
+ExceptionOr<Ref<PaymentRequest>> PaymentRequest::create(Document& document, Vector<PaymentMethodData>&& methodData, PaymentDetailsInit&& details, PaymentOptions&& options)
{
// FIXME: Check if this document is allowed to access the PaymentRequest API based on the allowpaymentrequest attribute.
@@ -179,7 +179,7 @@
auto scope = DECLARE_THROW_SCOPE(document.execState()->vm());
serializedData = JSONStringify(document.execState(), paymentMethod.data.get(), 0);
if (scope.exception())
- return nullptr;
+ return Exception { ExistingExceptionError };
}
serializedMethodData.add(paymentMethod.supportedMethods, WTFMove(serializedData));
}
@@ -232,12 +232,12 @@
auto scope = DECLARE_THROW_SCOPE(document.execState()->vm());
serializedData = JSONStringify(document.execState(), modifier.data.get(), 0);
if (scope.exception())
- return nullptr;
+ return Exception { ExistingExceptionError };
}
serializedModifierData.uncheckedAppend(WTFMove(serializedData));
}
- return adoptRef(new PaymentRequest(document, WTFMove(options), WTFMove(details), WTFMove(serializedModifierData), WTFMove(serializedMethodData), WTFMove(selectedShippingOption)));
+ return adoptRef(*new PaymentRequest(document, WTFMove(options), WTFMove(details), WTFMove(serializedModifierData), WTFMove(serializedMethodData), WTFMove(selectedShippingOption)));
}
PaymentRequest::PaymentRequest(Document& document, PaymentOptions&& options, PaymentDetailsInit&& details, Vector<String>&& serializedModifierData, HashMap<String, String>&& serializedMethodData, String&& selectedShippingOption)
Modified: trunk/Source/WebCore/Modules/paymentrequest/PaymentRequest.h (220979 => 220980)
--- trunk/Source/WebCore/Modules/paymentrequest/PaymentRequest.h 2017-08-21 20:35:39 UTC (rev 220979)
+++ trunk/Source/WebCore/Modules/paymentrequest/PaymentRequest.h 2017-08-21 20:53:16 UTC (rev 220980)
@@ -44,7 +44,7 @@
class PaymentRequest final : public RefCounted<PaymentRequest>, public ActiveDOMObject, public EventTargetWithInlineData {
public:
- static ExceptionOr<RefPtr<PaymentRequest>> create(Document&, Vector<PaymentMethodData>&&, PaymentDetailsInit&&, PaymentOptions&&);
+ static ExceptionOr<Ref<PaymentRequest>> create(Document&, Vector<PaymentMethodData>&&, PaymentDetailsInit&&, PaymentOptions&&);
~PaymentRequest();
void show(DOMPromiseDeferred<IDLInterface<PaymentResponse>>&&);