Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(231)

Side by Side Diff: third_party/WebKit/Source/modules/payments/PaymentRequest.cpp

Issue 2532953006: Throw if PaymentRequest() built with 'error' message (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "modules/payments/PaymentRequest.h" 5 #include "modules/payments/PaymentRequest.h"
6 6
7 #include "bindings/core/v8/ExceptionState.h" 7 #include "bindings/core/v8/ExceptionState.h"
8 #include "bindings/core/v8/ScriptPromiseResolver.h" 8 #include "bindings/core/v8/ScriptPromiseResolver.h"
9 #include "bindings/core/v8/ScriptState.h" 9 #include "bindings/core/v8/ScriptState.h"
10 #include "bindings/core/v8/V8StringResource.h" 10 #include "bindings/core/v8/V8StringResource.h"
(...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after
743 ? "Must be in a top-level browsing context or an iframe needs to " 743 ? "Must be in a top-level browsing context or an iframe needs to "
744 "specify 'allowpaymentrequest' explicitly" 744 "specify 'allowpaymentrequest' explicitly"
745 : "Must be in a top-level browsing context"); 745 : "Must be in a top-level browsing context");
746 return; 746 return;
747 } 747 }
748 748
749 bool keepShippingOptions = validatePaymentDetails(details, exceptionState); 749 bool keepShippingOptions = validatePaymentDetails(details, exceptionState);
750 if (exceptionState.hadException()) 750 if (exceptionState.hadException())
751 return; 751 return;
752 752
753 if (details.hasError() && !details.error().isEmpty()) { 753 if (details.hasError()) {
754 exceptionState.throwTypeError("Error value should be empty"); 754 exceptionState.throwTypeError("Error message not allowed in constructor");
755 return; 755 return;
756 } 756 }
757 757
758 if (m_options.requestShipping()) { 758 if (m_options.requestShipping()) {
759 if (keepShippingOptions) 759 if (keepShippingOptions)
760 m_shippingOption = getSelectedShippingOption(details); 760 m_shippingOption = getSelectedShippingOption(details);
761 m_shippingType = getValidShippingType(m_options.shippingType()); 761 m_shippingType = getValidShippingType(m_options.shippingType());
762 } 762 }
763 763
764 scriptState->domWindow()->frame()->interfaceProvider()->getInterface( 764 scriptState->domWindow()->frame()->interfaceProvider()->getInterface(
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
972 m_completeResolver.clear(); 972 m_completeResolver.clear();
973 m_showResolver.clear(); 973 m_showResolver.clear();
974 m_abortResolver.clear(); 974 m_abortResolver.clear();
975 m_canMakeActivePaymentResolver.clear(); 975 m_canMakeActivePaymentResolver.clear();
976 if (m_clientBinding.is_bound()) 976 if (m_clientBinding.is_bound())
977 m_clientBinding.Close(); 977 m_clientBinding.Close();
978 m_paymentProvider.reset(); 978 m_paymentProvider.reset();
979 } 979 }
980 980
981 } // namespace blink 981 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698