Diff
Modified: trunk/Source/WebCore/ChangeLog (277738 => 277739)
--- trunk/Source/WebCore/ChangeLog 2021-05-19 18:17:57 UTC (rev 277738)
+++ trunk/Source/WebCore/ChangeLog 2021-05-19 18:36:48 UTC (rev 277739)
@@ -1,3 +1,26 @@
+2021-05-19 Devin Rousso <[email protected]>
+
+ [Apple Pay] use a `dictionary ApplePayPaymentMethodModeDetails` instead of a raw `JSObject`
+ https://bugs.webkit.org/show_bug.cgi?id=225903
+ <rdar://problem/78134060>
+
+ Reviewed by Andy Estes.
+
+ No change in functionality.
+
+ * Modules/applepay/ApplePayPaymentMethodModeDetails.idl: Added.
+ * Modules/applepay/ApplePayPaymentMethodModeDetails.h: Added.
+
+ * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:
+ (WebCore::ApplePayPaymentHandler::didChangePaymentMethodMode):
+
+ * DerivedSources-input.xcfilelist:
+ * DerivedSources-output.xcfilelist:
+ * DerivedSources.make:
+ * PlatformMac.cmake:
+ * SourcesCocoa.txt:
+ * WebCore.xcodeproj/project.pbxproj:
+
2021-05-19 Alan Bujtas <[email protected]>
Calculated width percent loses the floating point and cause line wrap
Modified: trunk/Source/WebCore/DerivedSources-input.xcfilelist (277738 => 277739)
--- trunk/Source/WebCore/DerivedSources-input.xcfilelist 2021-05-19 18:17:57 UTC (rev 277738)
+++ trunk/Source/WebCore/DerivedSources-input.xcfilelist 2021-05-19 18:36:48 UTC (rev 277739)
@@ -41,6 +41,7 @@
$(PROJECT_DIR)/Modules/applepay/ApplePayPaymentAuthorizedEvent.idl
$(PROJECT_DIR)/Modules/applepay/ApplePayPaymentContact.idl
$(PROJECT_DIR)/Modules/applepay/ApplePayPaymentMethod.idl
+$(PROJECT_DIR)/Modules/applepay/ApplePayPaymentMethodModeDetails.idl
$(PROJECT_DIR)/Modules/applepay/ApplePayPaymentMethodModeUpdate.idl
$(PROJECT_DIR)/Modules/applepay/ApplePayPaymentMethodSelectedEvent.idl
$(PROJECT_DIR)/Modules/applepay/ApplePayPaymentMethodType.idl
Modified: trunk/Source/WebCore/DerivedSources-output.xcfilelist (277738 => 277739)
--- trunk/Source/WebCore/DerivedSources-output.xcfilelist 2021-05-19 18:17:57 UTC (rev 277738)
+++ trunk/Source/WebCore/DerivedSources-output.xcfilelist 2021-05-19 18:36:48 UTC (rev 277739)
@@ -123,6 +123,8 @@
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSApplePayPaymentContact.h
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSApplePayPaymentMethod.cpp
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSApplePayPaymentMethod.h
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSApplePayPaymentMethodModeDetails.cpp
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSApplePayPaymentMethodModeDetails.h
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSApplePayPaymentMethodModeUpdate.cpp
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSApplePayPaymentMethodModeUpdate.h
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSApplePayPaymentMethodSelectedEvent.cpp
Modified: trunk/Source/WebCore/DerivedSources.make (277738 => 277739)
--- trunk/Source/WebCore/DerivedSources.make 2021-05-19 18:17:57 UTC (rev 277738)
+++ trunk/Source/WebCore/DerivedSources.make 2021-05-19 18:36:48 UTC (rev 277739)
@@ -70,6 +70,7 @@
$(WebCore)/Modules/applepay/ApplePayPaymentAuthorizedEvent.idl \
$(WebCore)/Modules/applepay/ApplePayPaymentContact.idl \
$(WebCore)/Modules/applepay/ApplePayPaymentMethod.idl \
+ $(WebCore)/Modules/applepay/ApplePayPaymentMethodModeDetails.idl \
$(WebCore)/Modules/applepay/ApplePayPaymentMethodModeUpdate.idl \
$(WebCore)/Modules/applepay/ApplePayPaymentMethodSelectedEvent.idl \
$(WebCore)/Modules/applepay/ApplePayPaymentMethodType.idl \
Added: trunk/Source/WebCore/Modules/applepay/ApplePayPaymentMethodModeDetails.h (0 => 277739)
--- trunk/Source/WebCore/Modules/applepay/ApplePayPaymentMethodModeDetails.h (rev 0)
+++ trunk/Source/WebCore/Modules/applepay/ApplePayPaymentMethodModeDetails.h 2021-05-19 18:36:48 UTC (rev 277739)
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2021 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(APPLE_PAY_PAYMENT_METHOD_MODE)
+
+#if USE(APPLE_INTERNAL_SDK)
+#include <WebKitAdditions/ApplePayPaymentMethodModeDetailsAdditions.h>
+#endif
+
+namespace WebCore {
+
+struct ApplePayPaymentMethodModeDetails {
+#if defined(ApplePayPaymentMethodModeDetailsAdditions_members)
+ ApplePayPaymentMethodModeDetailsAdditions_members
+#endif
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(APPLE_PAY_PAYMENT_METHOD_MODE)
Added: trunk/Source/WebCore/Modules/applepay/ApplePayPaymentMethodModeDetails.idl (0 => 277739)
--- trunk/Source/WebCore/Modules/applepay/ApplePayPaymentMethodModeDetails.idl (rev 0)
+++ trunk/Source/WebCore/Modules/applepay/ApplePayPaymentMethodModeDetails.idl 2021-05-19 18:36:48 UTC (rev 277739)
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2021 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=APPLE_PAY_PAYMENT_METHOD_MODE,
+ ExportMacro=WEBCORE_EXPORT,
+ JSGenerateToJSObject,
+] dictionary ApplePayPaymentMethodModeDetails {
+};
Modified: trunk/Source/WebCore/Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp (277738 => 277739)
--- trunk/Source/WebCore/Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp 2021-05-19 18:17:57 UTC (rev 277738)
+++ trunk/Source/WebCore/Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp 2021-05-19 18:36:48 UTC (rev 277739)
@@ -38,6 +38,7 @@
#include "ApplePayMerchantCapability.h"
#include "ApplePayModifier.h"
#include "ApplePayPayment.h"
+#include "ApplePayPaymentMethodModeDetails.h"
#include "ApplePayPaymentMethodModeUpdate.h"
#include "ApplePayPaymentMethodUpdate.h"
#include "ApplePaySessionPaymentRequest.h"
@@ -51,6 +52,7 @@
#include "JSApplePayLineItemData.h"
#include "JSApplePayPayment.h"
#include "JSApplePayPaymentMethod.h"
+#include "JSApplePayPaymentMethodModeDetails.h"
#include "JSApplePayRequest.h"
#include "JSDOMConvert.h"
#include "LinkIconCollector.h"
@@ -71,12 +73,12 @@
#include "Settings.h"
#include <_javascript_Core/JSONObject.h>
-namespace WebCore {
-
#if USE(APPLE_INTERNAL_SDK)
#include <WebKitAdditions/ApplePayPaymentHandlerAdditions.cpp>
#endif
+namespace WebCore {
+
static ExceptionOr<ApplePayRequest> convertAndValidate(ScriptExecutionContext& context, JSC::JSValue data)
{
if (data.isEmpty())
@@ -757,16 +759,9 @@
ASSERT(m_updateState == UpdateState::None);
m_updateState = UpdateState::PaymentMethodMode;
- m_paymentRequest->paymentMethodChanged(WTF::get<URL>(m_identifier).string(), [paymentMethodMode = WTFMove(paymentMethodMode)] (JSC::JSGlobalObject& lexicalGlobalObject) -> JSC::Strong<JSC::JSObject> {
- auto& vm = lexicalGlobalObject.vm();
-
- JSC::JSLockHolder lock(vm);
-
- auto* object = JSC::constructEmptyObject(&lexicalGlobalObject);
-#if defined(ApplePayPaymentHandlerAdditions_didChangePaymentMethodMode)
- ApplePayPaymentHandlerAdditions_didChangePaymentMethodMode
-#endif
- return { vm, object };
+ ApplePayPaymentMethodModeDetails applePayPaymentMethodModeDetails { WTFMove(paymentMethodMode) };
+ m_paymentRequest->paymentMethodChanged(WTF::get<URL>(m_identifier).string(), [applePayPaymentMethodModeDetails = WTFMove(applePayPaymentMethodModeDetails)] (JSC::JSGlobalObject& lexicalGlobalObject) {
+ return toJSDictionary(lexicalGlobalObject, applePayPaymentMethodModeDetails);
});
}
Modified: trunk/Source/WebCore/PlatformMac.cmake (277738 => 277739)
--- trunk/Source/WebCore/PlatformMac.cmake 2021-05-19 18:17:57 UTC (rev 277738)
+++ trunk/Source/WebCore/PlatformMac.cmake 2021-05-19 18:36:48 UTC (rev 277739)
@@ -456,6 +456,7 @@
Modules/applepay/ApplePayErrorContactField.h
Modules/applepay/ApplePayLineItem.h
Modules/applepay/ApplePayLineItemData.h
+ Modules/applepay/ApplePayPaymentMethodModeDetails.h
Modules/applepay/ApplePayPaymentMethodModeUpdate.h
Modules/applepay/ApplePayPaymentMethodUpdate.h
Modules/applepay/ApplePaySetupConfiguration.h
@@ -751,6 +752,7 @@
Modules/applepay/ApplePayPaymentAuthorizedEvent.idl
Modules/applepay/ApplePayPaymentContact.idl
Modules/applepay/ApplePayPaymentMethod.idl
+ Modules/applepay/ApplePayPaymentMethodModeDetails.idl
Modules/applepay/ApplePayPaymentMethodModeUpdate.idl
Modules/applepay/ApplePayPaymentMethodSelectedEvent.idl
Modules/applepay/ApplePayPaymentMethodType.idl
Modified: trunk/Source/WebCore/SourcesCocoa.txt (277738 => 277739)
--- trunk/Source/WebCore/SourcesCocoa.txt 2021-05-19 18:17:57 UTC (rev 277738)
+++ trunk/Source/WebCore/SourcesCocoa.txt 2021-05-19 18:36:48 UTC (rev 277739)
@@ -41,6 +41,7 @@
JSApplePayPaymentAuthorizedEvent.cpp
JSApplePayPaymentContact.cpp
JSApplePayPaymentMethod.cpp
+JSApplePayPaymentMethodModeDetails.cpp
JSApplePayPaymentMethodModeUpdate.cpp
JSApplePayPaymentMethodSelectedEvent.cpp
JSApplePayPaymentMethodType.cpp
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (277738 => 277739)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2021-05-19 18:17:57 UTC (rev 277738)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2021-05-19 18:36:48 UTC (rev 277739)
@@ -2983,6 +2983,7 @@
9527D7AF25D5FE6C00A6E176 /* JSApplePayDetailsUpdateData.h in Headers */ = {isa = PBXBuildFile; fileRef = 9527D7AD25D5FE6B00A6E176 /* JSApplePayDetailsUpdateData.h */; };
953BCEB225D6283D00A4A2A1 /* JSApplePayDetailsUpdateBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 953BCEAF25D6283C00A4A2A1 /* JSApplePayDetailsUpdateBase.h */; };
9562EEDD25F18DE700334442 /* PaymentRequestUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 9562EEDB25F18DE600334442 /* PaymentRequestUtilities.h */; };
+ 95684D83265357F800026938 /* ApplePayPaymentMethodModeDetails.h in Headers */ = {isa = PBXBuildFile; fileRef = 95684D81265357F700026938 /* ApplePayPaymentMethodModeDetails.h */; };
956FC4BB25D49C7B00F7B3A2 /* ApplePayLineItemData.h in Headers */ = {isa = PBXBuildFile; fileRef = 956FC4B825D49C7A00F7B3A2 /* ApplePayLineItemData.h */; settings = {ATTRIBUTES = (Private, ); }; };
956FC4BB25D49C7B00F7B3A3 /* JSApplePayLineItemData.h in Headers */ = {isa = PBXBuildFile; fileRef = 956FC4BA25D49C7D00F7B3A2 /* JSApplePayLineItemData.h */; };
9596B93325DEEEA000ED2CFA /* ApplePayPaymentMethodModeUpdate.h in Headers */ = {isa = PBXBuildFile; fileRef = 9596B93025DEEE9F00ED2CFA /* ApplePayPaymentMethodModeUpdate.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -11923,6 +11924,8 @@
9551959D25FA9EFB00F58CF0 /* skip-forward-button.js */ = {isa = PBXFileReference; lastKnownFileType = sourcecode._javascript_; path = "skip-forward-button.js"; sourceTree = "<group>"; };
9562EED925F18DE500334442 /* PaymentRequestUtilities.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PaymentRequestUtilities.cpp; sourceTree = "<group>"; };
9562EEDB25F18DE600334442 /* PaymentRequestUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PaymentRequestUtilities.h; sourceTree = "<group>"; };
+ 95684D7F265357F700026938 /* ApplePayPaymentMethodModeDetails.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ApplePayPaymentMethodModeDetails.idl; sourceTree = "<group>"; };
+ 95684D81265357F700026938 /* ApplePayPaymentMethodModeDetails.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ApplePayPaymentMethodModeDetails.h; sourceTree = "<group>"; };
956FC4B825D49C7A00F7B3A2 /* ApplePayLineItemData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ApplePayLineItemData.h; sourceTree = "<group>"; };
956FC4B825D49C7C00F7B3A2 /* JSApplePayLineItemData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSApplePayLineItemData.cpp; sourceTree = "<group>"; };
956FC4BA25D49C7B00F7B3A2 /* ApplePayLineItemData.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ApplePayLineItemData.idl; sourceTree = "<group>"; };
@@ -18556,6 +18559,8 @@
7C6522F91E00C90900677F22 /* ApplePayPaymentContact.idl */,
7C6522EC1E00A4C700677F22 /* ApplePayPaymentMethod.h */,
7C6522ED1E00A4C700677F22 /* ApplePayPaymentMethod.idl */,
+ 95684D81265357F700026938 /* ApplePayPaymentMethodModeDetails.h */,
+ 95684D7F265357F700026938 /* ApplePayPaymentMethodModeDetails.idl */,
9596B93025DEEE9F00ED2CFA /* ApplePayPaymentMethodModeUpdate.h */,
9596B93225DEEE9F00ED2CFA /* ApplePayPaymentMethodModeUpdate.idl */,
1A8A64401D19FCFB00D0E00F /* ApplePayPaymentMethodSelectedEvent.cpp */,
@@ -31509,6 +31514,7 @@
7C6522FB1E00C90900677F22 /* ApplePayPaymentContact.h in Headers */,
A1DF5AA21F7EE1130058A477 /* ApplePayPaymentHandler.h in Headers */,
7C6522EF1E00A4C700677F22 /* ApplePayPaymentMethod.h in Headers */,
+ 95684D83265357F800026938 /* ApplePayPaymentMethodModeDetails.h in Headers */,
9596B93325DEEEA000ED2CFA /* ApplePayPaymentMethodModeUpdate.h in Headers */,
1A8A64561D19FCFC00D0E00F /* ApplePayPaymentMethodSelectedEvent.h in Headers */,
A1F6D0061FE096F60018078C /* ApplePayPaymentMethodType.h in Headers */,