Changeset 220980 in webkit


Ignore:
Timestamp:
Aug 21, 2017 1:53:16 PM (7 years ago)
Author:
aestes@apple.com
Message:

[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:
Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r220979 r220980  
     12017-08-21  Andy Estes  <aestes@apple.com>
     2
     3        [Payment Request] Use ExistingExceptionError to propagate JS exceptions thrown during JSON stringification
     4        https://bugs.webkit.org/show_bug.cgi?id=175776
     5
     6        Reviewed by Darin Adler.
     7
     8        * Modules/paymentrequest/PaymentRequest.cpp:
     9        (WebCore::PaymentRequest::create):
     10        * Modules/paymentrequest/PaymentRequest.h:
     11
    1122017-08-21  Yoshiaki Jitsukawa  <Yoshiaki.Jitsukawa@sony.com>
    213
  • trunk/Source/WebCore/Modules/paymentrequest/PaymentRequest.cpp

    r220971 r220980  
    160160// Implements the PaymentRequest Constructor
    161161// https://www.w3.org/TR/payment-request/#constructor
    162 ExceptionOr<RefPtr<PaymentRequest>> PaymentRequest::create(Document& document, Vector<PaymentMethodData>&& methodData, PaymentDetailsInit&& details, PaymentOptions&& options)
     162ExceptionOr<Ref<PaymentRequest>> PaymentRequest::create(Document& document, Vector<PaymentMethodData>&& methodData, PaymentDetailsInit&& details, PaymentOptions&& options)
    163163{
    164164    // FIXME: Check if this document is allowed to access the PaymentRequest API based on the allowpaymentrequest attribute.
     
    180180            serializedData = JSONStringify(document.execState(), paymentMethod.data.get(), 0);
    181181            if (scope.exception())
    182                 return nullptr;
     182                return Exception { ExistingExceptionError };
    183183        }
    184184        serializedMethodData.add(paymentMethod.supportedMethods, WTFMove(serializedData));
     
    233233            serializedData = JSONStringify(document.execState(), modifier.data.get(), 0);
    234234            if (scope.exception())
    235                 return nullptr;
     235                return Exception { ExistingExceptionError };
    236236        }
    237237        serializedModifierData.uncheckedAppend(WTFMove(serializedData));
    238238    }
    239239
    240     return adoptRef(new PaymentRequest(document, WTFMove(options), WTFMove(details), WTFMove(serializedModifierData), WTFMove(serializedMethodData), WTFMove(selectedShippingOption)));
     240    return adoptRef(*new PaymentRequest(document, WTFMove(options), WTFMove(details), WTFMove(serializedModifierData), WTFMove(serializedMethodData), WTFMove(selectedShippingOption)));
    241241}
    242242
  • trunk/Source/WebCore/Modules/paymentrequest/PaymentRequest.h

    r220971 r220980  
    4545class PaymentRequest final : public RefCounted<PaymentRequest>, public ActiveDOMObject, public EventTargetWithInlineData {
    4646public:
    47     static ExceptionOr<RefPtr<PaymentRequest>> create(Document&, Vector<PaymentMethodData>&&, PaymentDetailsInit&&, PaymentOptions&&);
     47    static ExceptionOr<Ref<PaymentRequest>> create(Document&, Vector<PaymentMethodData>&&, PaymentDetailsInit&&, PaymentOptions&&);
    4848    ~PaymentRequest();
    4949
Note: See TracChangeset for help on using the changeset viewer.