Diff
Modified: trunk/Source/WebCore/ChangeLog (289577 => 289578)
--- trunk/Source/WebCore/ChangeLog 2022-02-10 22:21:28 UTC (rev 289577)
+++ trunk/Source/WebCore/ChangeLog 2022-02-10 22:23:23 UTC (rev 289578)
@@ -1,3 +1,76 @@
+2022-02-10 Devin Rousso <[email protected]>
+
+ Permit simultaneous Apple Pay and script injection
+ https://bugs.webkit.org/show_bug.cgi?id=236254
+ <rdar://problem/87736727>
+
+ Reviewed by Kate Cheney.
+
+ Tests: ApplePay.ApplePayAvailableByDefault
+ ApplePay.ApplePayAvailableInFrame
+ ApplePay.UserScriptAtDocumentStartDoesNotDisableApplePay
+ ApplePay.UserScriptAtDocumentEndDoesNotDisableApplePay
+ ApplePay.UserAgentScriptEvaluationDoesNotDisableApplePay
+ ApplePay.UserAgentScriptEvaluationDoesNotDisableApplePayInExistingObjects
+ ApplePay.CanMakePaymentsDoesNotBlockUserAgentScripts
+ ApplePay.CanMakePaymentsWithActiveCardDoesNotBlockUserAgentScripts
+ ApplePay.CanMakePaymentDoesNotBlockUserAgentScripts
+
+ * dom/Document.h:
+ * dom/Document.cpp:
+ (WebCore::Document::ensurePlugInsInjectedScript):
+ (WebCore::Document::hasEvaluatedUserAgentScripts const): Deleted.
+ (WebCore::Document::setHasEvaluatedUserAgentScripts): Deleted.
+ (WebCore::Document::isApplePayActive const): Deleted.
+ (WebCore::Document::setApplePayIsActive): Deleted.
+ Remove logic that tracks script injection activity.
+
+ * bindings/js/ScriptController.h:
+ * bindings/js/ScriptController.cpp:
+ (WebCore::ScriptController::executeUserAgentScriptInWorld):
+ (WebCore::ScriptController::executeAsynchronousUserAgentScriptInWorld):
+ (WebCore::ScriptController::executeUserAgentScriptInWorldInternal): Deleted.
+ (WebCore::ScriptController::shouldAllowUserAgentScripts const): Deleted.
+ * loader/EmptyClients.cpp:
+ (WebCore::EmptyPaymentCoordinatorClient::supportsUnrestrictedApplePay): Deleted.
+ * page/Frame.cpp:
+ (WebCore::Frame::injectUserScriptImmediately):
+ Remove logic that disables script injection after an Apple Pay session is started.
+
+ * Modules/applepay/PaymentCoordinator.h:
+ * Modules/applepay/PaymentCoordinator.cpp:
+ (WebCore::PaymentCoordinator::canMakePayments):
+ (WebCore::PaymentCoordinator::canMakePaymentsWithActiveCard):
+ (WebCore::PaymentCoordinator::beginPaymentSession):
+ (WebCore::PaymentCoordinator::shouldEnableApplePayAPIs const): Deleted.
+ (WebCore::PaymentCoordinator::setApplePayIsActiveIfAllowed const): Deleted.
+ (WebCore::PaymentCoordinator::shouldAllowUserAgentScripts const): Deleted.
+ * Modules/applepay/PaymentCoordinatorClient.h:
+ (WebCore::PaymentCoordinatorClient::userAgentScriptsBlockedErrorMessage const): Deleted.
+ Remove logic that tracks Apple Pay activity.
+
+ * Modules/applepay/ApplePaySession.idl:
+ * Modules/applepay/PaymentSession.h:
+ * Modules/applepay/PaymentSession.cpp:
+ (WebCore::PaymentSession::enabledForContext): Deleted.
+ * Modules/paymentrequest/PaymentHandler.cpp:
+ (WebCore::PaymentHandler::enabledForContext): Deleted.
+ * Modules/paymentrequest/PaymentRequest.idl:
+ * Modules/paymentrequest/PaymentRequest.h:
+ * Modules/paymentrequest/PaymentRequest.cpp:
+ (WebCore::PaymentRequest::enabledForContext): Deleted.
+ Remove logic that disables `ApplePaySession`/`PaymentRequest` after script injection.
+
+ * testing/Internals.idl:
+ * testing/Internals.h:
+ * testing/Internals.cpp:
+ (WebCore::Internals::setApplePayIsActive): Deleted.
+ * testing/MockPaymentCoordinator.idl:
+ * testing/MockPaymentCoordinator.h:
+ (WebCore::MockPaymentCoordinator::supportsUnrestrictedApplePay): Deleted.
+ (WebCore::MockPaymentCoordinator::setSupportsUnrestrictedApplePay): Deleted.
+ Remove testing support since all uses of these have been removed (above).
+
2022-02-10 Ada Chan <[email protected]>
Fix linker errors when CG_DISPLAY_LIST_BACKED_IMAGE_BUFFER is enabled
Modified: trunk/Source/WebCore/Modules/applepay/ApplePaySession.cpp (289577 => 289578)
--- trunk/Source/WebCore/Modules/applepay/ApplePaySession.cpp 2022-02-10 22:21:28 UTC (rev 289577)
+++ trunk/Source/WebCore/Modules/applepay/ApplePaySession.cpp 2022-02-10 22:23:23 UTC (rev 289578)
@@ -369,7 +369,7 @@
if (!page)
return Exception { InvalidAccessError };
- return page->paymentCoordinator().canMakePayments(document);
+ return page->paymentCoordinator().canMakePayments();
}
ExceptionOr<void> ApplePaySession::canMakePaymentsWithActiveCard(Document& document, const String& merchantIdentifier, Ref<DeferredPromise>&& passedPromise)
@@ -385,7 +385,7 @@
return Exception { InvalidAccessError };
auto& paymentCoordinator = page->paymentCoordinator();
- bool canMakePayments = paymentCoordinator.canMakePayments(document);
+ bool canMakePayments = paymentCoordinator.canMakePayments();
RunLoop::main().dispatch([promise, canMakePayments]() mutable {
promise->resolve<IDLBoolean>(canMakePayments);
Modified: trunk/Source/WebCore/Modules/applepay/ApplePaySession.idl (289577 => 289578)
--- trunk/Source/WebCore/Modules/applepay/ApplePaySession.idl 2022-02-10 22:21:28 UTC (rev 289577)
+++ trunk/Source/WebCore/Modules/applepay/ApplePaySession.idl 2022-02-10 22:23:23 UTC (rev 289578)
@@ -27,7 +27,6 @@
ActiveDOMObject,
Conditional=APPLE_PAY,
EnabledBySetting=ApplePayEnabled,
- EnabledForContext,
Exposed=Window
] interface ApplePaySession : EventTarget {
[CallWith=CurrentDocument] constructor(unsigned long version, ApplePayPaymentRequest paymentRequest);
Modified: trunk/Source/WebCore/Modules/applepay/PaymentCoordinator.cpp (289577 => 289578)
--- trunk/Source/WebCore/Modules/applepay/PaymentCoordinator.cpp 2022-02-10 22:21:28 UTC (rev 289577)
+++ trunk/Source/WebCore/Modules/applepay/PaymentCoordinator.cpp 2022-02-10 22:23:23 UTC (rev 289578)
@@ -66,18 +66,11 @@
return supportsVersion;
}
-bool PaymentCoordinator::canMakePayments(Document& document)
+bool PaymentCoordinator::canMakePayments()
{
auto canMakePayments = m_client.canMakePayments();
PAYMENT_COORDINATOR_RELEASE_LOG("canMakePayments() -> %d", canMakePayments);
-
- if (!canMakePayments)
- return false;
-
- if (!setApplePayIsActiveIfAllowed(document))
- return false;
-
- return true;
+ return canMakePayments;
}
void PaymentCoordinator::canMakePaymentsWithActiveCard(Document& document, const String& merchantIdentifier, Function<void(bool)>&& completionHandler)
@@ -91,7 +84,7 @@
if (!canMakePayments)
return completionHandler(false);
- if (!document || !setApplePayIsActiveIfAllowed(*document))
+ if (!document)
return completionHandler(false);
completionHandler(true);
@@ -108,9 +101,6 @@
{
ASSERT(!m_activeSession);
- if (!setApplePayIsActiveIfAllowed(document))
- return false;
-
Vector<URL> linkIconURLs;
for (auto& icon : LinkIconCollector { document }.iconsOfTypes({ LinkIconType::TouchIcon, LinkIconType::TouchPrecomposedIcon }))
linkIconURLs.append(icon.url);
@@ -285,49 +275,6 @@
return m_client.validatedPaymentNetwork(paymentNetwork);
}
-bool PaymentCoordinator::shouldEnableApplePayAPIs(Document& document) const
-{
- if (m_client.supportsUnrestrictedApplePay())
- return true;
-
- bool shouldEnableAPIs = true;
- document.page()->userContentProvider().forEachUserScript([&](DOMWrapperWorld&, const UserScript&) {
- shouldEnableAPIs = false;
- });
-
- if (!shouldEnableAPIs)
- PAYMENT_COORDINATOR_RELEASE_LOG("shouldEnableApplePayAPIs() -> false (user scripts)");
-
- return shouldEnableAPIs;
-}
-
-bool PaymentCoordinator::setApplePayIsActiveIfAllowed(Document& document) const
-{
- auto hasEvaluatedUserAgentScripts = document.hasEvaluatedUserAgentScripts();
- auto isRunningUserScripts = document.isRunningUserScripts();
- auto supportsUnrestrictedApplePay = m_client.supportsUnrestrictedApplePay();
-
- if (!supportsUnrestrictedApplePay && (hasEvaluatedUserAgentScripts || isRunningUserScripts)) {
- ASSERT(!document.isApplePayActive());
- PAYMENT_COORDINATOR_RELEASE_LOG("setApplePayIsActiveIfAllowed() -> false (hasEvaluatedUserAgentScripts: %d, isRunningUserScripts: %d)", hasEvaluatedUserAgentScripts, isRunningUserScripts);
- return false;
- }
-
- document.setApplePayIsActive();
- return true;
-}
-
-Expected<void, ExceptionDetails> PaymentCoordinator::shouldAllowUserAgentScripts(Document& document) const
-{
- if (m_client.supportsUnrestrictedApplePay() || !document.isApplePayActive())
- return { };
-
- ASSERT(!document.hasEvaluatedUserAgentScripts());
- ASSERT(!document.isRunningUserScripts());
- PAYMENT_COORDINATOR_RELEASE_LOG_ERROR("shouldAllowUserAgentScripts() -> false (active session)");
- return makeUnexpected(ExceptionDetails { m_client.userAgentScriptsBlockedErrorMessage() });
-}
-
void PaymentCoordinator::getSetupFeatures(const ApplePaySetupConfiguration& configuration, const URL& url, CompletionHandler<void(Vector<Ref<ApplePaySetupFeature>>&&)>&& completionHandler)
{
PAYMENT_COORDINATOR_RELEASE_LOG("getSetupFeatures()");
Modified: trunk/Source/WebCore/Modules/applepay/PaymentCoordinator.h (289577 => 289578)
--- trunk/Source/WebCore/Modules/applepay/PaymentCoordinator.h 2022-02-10 22:21:28 UTC (rev 289577)
+++ trunk/Source/WebCore/Modules/applepay/PaymentCoordinator.h 2022-02-10 22:23:23 UTC (rev 289578)
@@ -61,7 +61,7 @@
PaymentCoordinatorClient& client() { return m_client; }
bool supportsVersion(Document&, unsigned version) const;
- bool canMakePayments(Document&);
+ bool canMakePayments();
void canMakePaymentsWithActiveCard(Document&, const String& merchantIdentifier, Function<void(bool)>&& completionHandler);
void openPaymentSetup(Document&, const String& merchantIdentifier, Function<void(bool)>&& completionHandler);
@@ -91,16 +91,11 @@
std::optional<String> validatedPaymentNetwork(Document&, unsigned version, const String&) const;
- bool shouldEnableApplePayAPIs(Document&) const;
- WEBCORE_EXPORT Expected<void, ExceptionDetails> shouldAllowUserAgentScripts(Document&) const;
-
void getSetupFeatures(const ApplePaySetupConfiguration&, const URL&, CompletionHandler<void(Vector<Ref<ApplePaySetupFeature>>&&)>&&);
void beginApplePaySetup(const ApplePaySetupConfiguration&, const URL&, Vector<RefPtr<ApplePaySetupFeature>>&&, CompletionHandler<void(bool)>&&);
void endApplePaySetup();
private:
- bool setApplePayIsActiveIfAllowed(Document&) const;
-
PaymentCoordinatorClient& m_client;
RefPtr<PaymentSession> m_activeSession;
};
Modified: trunk/Source/WebCore/Modules/applepay/PaymentCoordinatorClient.h (289577 => 289578)
--- trunk/Source/WebCore/Modules/applepay/PaymentCoordinatorClient.h 2022-02-10 22:21:28 UTC (rev 289577)
+++ trunk/Source/WebCore/Modules/applepay/PaymentCoordinatorClient.h 2022-02-10 22:23:23 UTC (rev 289578)
@@ -65,10 +65,7 @@
virtual void abortPaymentSession() = 0;
virtual void cancelPaymentSession() = 0;
virtual void paymentCoordinatorDestroyed() = 0;
- virtual bool supportsUnrestrictedApplePay() const = 0;
- virtual String userAgentScriptsBlockedErrorMessage() const { return { }; }
-
virtual bool isMockPaymentCoordinator() const { return false; }
virtual bool isWebPaymentCoordinator() const { return false; }
Modified: trunk/Source/WebCore/Modules/applepay/PaymentSession.cpp (289577 => 289578)
--- trunk/Source/WebCore/Modules/applepay/PaymentSession.cpp 2022-02-10 22:21:28 UTC (rev 289577)
+++ trunk/Source/WebCore/Modules/applepay/PaymentSession.cpp 2022-02-10 22:23:23 UTC (rev 289578)
@@ -31,8 +31,6 @@
#include "Document.h"
#include "DocumentLoader.h"
#include "FeaturePolicy.h"
-#include "Page.h"
-#include "PaymentCoordinator.h"
#include "SecurityOrigin.h"
namespace WebCore {
@@ -78,15 +76,6 @@
return { };
}
-bool PaymentSession::enabledForContext(ScriptExecutionContext& context)
-{
- auto& document = downcast<Document>(context);
- if (auto page = document.page())
- return page->paymentCoordinator().shouldEnableApplePayAPIs(document);
-
- return false;
-}
-
} // namespace WebCore
#endif // ENABLE(APPLE_PAY)
Modified: trunk/Source/WebCore/Modules/applepay/PaymentSession.h (289577 => 289578)
--- trunk/Source/WebCore/Modules/applepay/PaymentSession.h 2022-02-10 22:21:28 UTC (rev 289577)
+++ trunk/Source/WebCore/Modules/applepay/PaymentSession.h 2022-02-10 22:23:23 UTC (rev 289578)
@@ -43,7 +43,6 @@
class PaymentSession : public virtual PaymentSessionBase {
public:
static ExceptionOr<void> canCreateSession(Document&);
- static bool enabledForContext(ScriptExecutionContext&);
virtual unsigned version() const = 0;
virtual void validateMerchant(URL&&) = 0;
Modified: trunk/Source/WebCore/Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp (289577 => 289578)
--- trunk/Source/WebCore/Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp 2022-02-10 22:21:28 UTC (rev 289577)
+++ trunk/Source/WebCore/Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp 2022-02-10 22:23:23 UTC (rev 289578)
@@ -304,9 +304,9 @@
paymentCoordinator().abortPaymentSession();
}
-void ApplePayPaymentHandler::canMakePayment(Document& document, Function<void(bool)>&& completionHandler)
+void ApplePayPaymentHandler::canMakePayment(Document&, Function<void(bool)>&& completionHandler)
{
- completionHandler(paymentCoordinator().canMakePayments(document));
+ completionHandler(paymentCoordinator().canMakePayments());
}
ExceptionOr<Vector<ApplePayShippingMethod>> ApplePayPaymentHandler::computeShippingMethods() const
Modified: trunk/Source/WebCore/Modules/paymentrequest/PaymentHandler.cpp (289577 => 289578)
--- trunk/Source/WebCore/Modules/paymentrequest/PaymentHandler.cpp 2022-02-10 22:21:28 UTC (rev 289577)
+++ trunk/Source/WebCore/Modules/paymentrequest/PaymentHandler.cpp 2022-02-10 22:23:23 UTC (rev 289578)
@@ -87,16 +87,6 @@
return { };
}
-bool PaymentHandler::enabledForContext(ScriptExecutionContext& context)
-{
-#if ENABLE(APPLE_PAY)
- return PaymentSession::enabledForContext(context);
-#else
- UNUSED_PARAM(context);
- return false;
-#endif
-}
-
bool PaymentHandler::hasActiveSession(Document& document)
{
#if ENABLE(APPLE_PAY)
Modified: trunk/Source/WebCore/Modules/paymentrequest/PaymentRequest.cpp (289577 => 289578)
--- trunk/Source/WebCore/Modules/paymentrequest/PaymentRequest.cpp 2022-02-10 22:21:28 UTC (rev 289577)
+++ trunk/Source/WebCore/Modules/paymentrequest/PaymentRequest.cpp 2022-02-10 22:23:23 UTC (rev 289578)
@@ -349,11 +349,6 @@
return request;
}
-bool PaymentRequest::enabledForContext(ScriptExecutionContext& context)
-{
- return PaymentHandler::enabledForContext(context);
-}
-
PaymentRequest::PaymentRequest(Document& document, PaymentOptions&& options, PaymentDetailsInit&& details, Vector<String>&& serializedModifierData, Vector<Method>&& serializedMethodData, String&& selectedShippingOption)
: ActiveDOMObject { document }
, m_options { WTFMove(options) }
Modified: trunk/Source/WebCore/Modules/paymentrequest/PaymentRequest.h (289577 => 289578)
--- trunk/Source/WebCore/Modules/paymentrequest/PaymentRequest.h 2022-02-10 22:21:28 UTC (rev 289577)
+++ trunk/Source/WebCore/Modules/paymentrequest/PaymentRequest.h 2022-02-10 22:23:23 UTC (rev 289578)
@@ -60,7 +60,6 @@
using ShowPromise = DOMPromiseDeferred<IDLInterface<PaymentResponse>>;
static ExceptionOr<Ref<PaymentRequest>> create(Document&, Vector<PaymentMethodData>&&, PaymentDetailsInit&&, PaymentOptions&&);
- static bool enabledForContext(ScriptExecutionContext&);
~PaymentRequest();
void show(Document&, RefPtr<DOMPromise>&& detailsPromise, ShowPromise&&);
Modified: trunk/Source/WebCore/Modules/paymentrequest/PaymentRequest.idl (289577 => 289578)
--- trunk/Source/WebCore/Modules/paymentrequest/PaymentRequest.idl 2022-02-10 22:21:28 UTC (rev 289577)
+++ trunk/Source/WebCore/Modules/paymentrequest/PaymentRequest.idl 2022-02-10 22:23:23 UTC (rev 289578)
@@ -27,7 +27,6 @@
ActiveDOMObject,
Conditional=PAYMENT_REQUEST,
EnabledBySetting=PaymentRequestEnabled,
- EnabledForContext,
SecureContext,
Exposed=Window
] interface PaymentRequest : EventTarget {
Modified: trunk/Source/WebCore/bindings/js/ScriptController.cpp (289577 => 289578)
--- trunk/Source/WebCore/bindings/js/ScriptController.cpp 2022-02-10 22:21:28 UTC (rev 289577)
+++ trunk/Source/WebCore/bindings/js/ScriptController.cpp 2022-02-10 22:23:23 UTC (rev 289578)
@@ -691,23 +691,12 @@
}
ValueOrException ScriptController::executeUserAgentScriptInWorld(DOMWrapperWorld& world, const String& script, bool forceUserGesture)
{
- return executeUserAgentScriptInWorldInternal(world, { script, URL { }, false, std::nullopt, forceUserGesture });
+ return executeScriptInWorld(world, { script, URL { }, false, std::nullopt, forceUserGesture });
}
-ValueOrException ScriptController::executeUserAgentScriptInWorldInternal(DOMWrapperWorld& world, RunJavaScriptParameters&& parameters)
-{
- auto& document = *m_frame.document();
- auto allowed = shouldAllowUserAgentScripts(document);
- if (!allowed)
- return makeUnexpected(allowed.error());
-
- document.setHasEvaluatedUserAgentScripts();
- return executeScriptInWorld(world, WTFMove(parameters));
-}
-
void ScriptController::executeAsynchronousUserAgentScriptInWorld(DOMWrapperWorld& world, RunJavaScriptParameters&& parameters, ResolveFunction&& resolveCompletionHandler)
{
- auto result = executeUserAgentScriptInWorldInternal(world, WTFMove(parameters));
+ auto result = executeScriptInWorld(world, WTFMove(parameters));
if (parameters.runAsAsyncFunction == RunAsAsyncFunction::No || !result || !result.value().isObject()) {
resolveCompletionHandler(result);
@@ -767,17 +756,6 @@
call(&globalObject, thenFunction, callData, result.value(), arguments);
}
-Expected<void, ExceptionDetails> ScriptController::shouldAllowUserAgentScripts(Document& document) const
-{
-#if ENABLE(APPLE_PAY)
- if (auto page = m_frame.page())
- return page->paymentCoordinator().shouldAllowUserAgentScripts(document);
-#else
- UNUSED_PARAM(document);
-#endif
- return { };
-}
-
bool ScriptController::canExecuteScripts(ReasonForCallingCanExecuteScripts reason)
{
if (reason == AboutToExecuteScript)
Modified: trunk/Source/WebCore/bindings/js/ScriptController.h (289577 => 289578)
--- trunk/Source/WebCore/bindings/js/ScriptController.h 2022-02-10 22:21:28 UTC (rev 289577)
+++ trunk/Source/WebCore/bindings/js/ScriptController.h 2022-02-10 22:23:23 UTC (rev 289578)
@@ -106,8 +106,6 @@
JSC::JSValue evaluateIgnoringException(const ScriptSourceCode&);
JSC::JSValue evaluateInWorldIgnoringException(const ScriptSourceCode&, DOMWrapperWorld&);
- Expected<void, ExceptionDetails> shouldAllowUserAgentScripts(Document&) const;
-
// This asserts that URL argument is a _javascript_ URL.
void executeJavaScriptURL(const URL&, RefPtr<SecurityOrigin> = nullptr, ShouldReplaceDocumentIfJavaScriptURL = ReplaceDocumentIfJavaScriptURL);
@@ -172,7 +170,6 @@
void reportExceptionFromScriptError(LoadableScript::Error, bool);
private:
- ValueOrException executeUserAgentScriptInWorldInternal(DOMWrapperWorld&, RunJavaScriptParameters&&);
ValueOrException executeScriptInWorld(DOMWrapperWorld&, RunJavaScriptParameters&&);
ValueOrException callInWorld(RunJavaScriptParameters&&, DOMWrapperWorld&);
Modified: trunk/Source/WebCore/dom/Document.cpp (289577 => 289578)
--- trunk/Source/WebCore/dom/Document.cpp 2022-02-10 22:21:28 UTC (rev 289577)
+++ trunk/Source/WebCore/dom/Document.cpp 2022-02-10 22:23:23 UTC (rev 289578)
@@ -7650,10 +7650,9 @@
// Use the JS file provided by the Chrome client, or fallback to the default one.
String jsString = page()->chrome().client().plugInExtraScript();
- if (!jsString || !scriptController.shouldAllowUserAgentScripts(*this))
+ if (!jsString)
jsString = StringImpl::createWithoutCopying(plugInsJavaScript, sizeof(plugInsJavaScript));
- setHasEvaluatedUserAgentScripts();
scriptController.evaluateInWorldIgnoringException(ScriptSourceCode(jsString), world);
m_hasInjectedPlugInsScript = true;
@@ -8864,12 +8863,6 @@
#endif
-bool Document::hasEvaluatedUserAgentScripts() const
-{
- auto& top = topDocument();
- return this == &top ? m_hasEvaluatedUserAgentScripts : top.hasEvaluatedUserAgentScripts();
-}
-
bool Document::isRunningUserScripts() const
{
auto& top = topDocument();
@@ -8885,15 +8878,6 @@
top.setAsRunningUserScripts();
}
-void Document::setHasEvaluatedUserAgentScripts()
-{
- auto& top = topDocument();
- if (this == &top)
- m_hasEvaluatedUserAgentScripts = true;
- else
- top.setHasEvaluatedUserAgentScripts();
-}
-
void Document::didRejectSyncXHRDuringPageDismissal()
{
++m_numberOfRejectedSyncXHRs;
@@ -8912,25 +8896,6 @@
return m_numberOfRejectedSyncXHRs > maxRejectedSyncXHRsPerEventLoopIteration;
}
-#if ENABLE(APPLE_PAY)
-
-bool Document::isApplePayActive() const
-{
- auto& top = topDocument();
- return this == &top ? m_hasStartedApplePaySession : top.isApplePayActive();
-}
-
-void Document::setApplePayIsActive()
-{
- auto& top = topDocument();
- if (this == &top)
- m_hasStartedApplePaySession = true;
- else
- top.setApplePayIsActive();
-}
-
-#endif
-
MessagePortChannelProvider& Document::messagePortChannelProvider()
{
return MessagePortChannelProvider::singleton();
Modified: trunk/Source/WebCore/dom/Document.h (289577 => 289578)
--- trunk/Source/WebCore/dom/Document.h 2022-02-10 22:21:28 UTC (rev 289577)
+++ trunk/Source/WebCore/dom/Document.h 2022-02-10 22:23:23 UTC (rev 289578)
@@ -1597,14 +1597,8 @@
void setPaintWorkletGlobalScopeForName(const String& name, Ref<PaintWorkletGlobalScope>&&);
#endif
- WEBCORE_EXPORT bool hasEvaluatedUserAgentScripts() const;
WEBCORE_EXPORT bool isRunningUserScripts() const;
WEBCORE_EXPORT void setAsRunningUserScripts();
- void setHasEvaluatedUserAgentScripts();
-#if ENABLE(APPLE_PAY)
- WEBCORE_EXPORT bool isApplePayActive() const;
- WEBCORE_EXPORT void setApplePayIsActive();
-#endif
void frameWasDisconnectedFromOwner();
@@ -2227,15 +2221,11 @@
HashMap<String, Ref<PaintWorkletGlobalScope>> m_paintWorkletGlobalScopes;
#endif
unsigned m_numberOfRejectedSyncXHRs { 0 };
- bool m_hasEvaluatedUserAgentScripts { false };
bool m_isRunningUserScripts { false };
bool m_mayBeDetachedFromFrame { true };
bool m_shouldPreventEnteringBackForwardCacheForTesting { false };
bool m_hasLoadedThirdPartyScript { false };
bool m_hasLoadedThirdPartyFrame { false };
-#if ENABLE(APPLE_PAY)
- bool m_hasStartedApplePaySession { false };
-#endif
bool m_hasVisuallyNonEmptyCustomContent { false };
bool m_visibilityHiddenDueToDismissal { false };
Modified: trunk/Source/WebCore/loader/EmptyClients.cpp (289577 => 289578)
--- trunk/Source/WebCore/loader/EmptyClients.cpp 2022-02-10 22:21:28 UTC (rev 289577)
+++ trunk/Source/WebCore/loader/EmptyClients.cpp 2022-02-10 22:23:23 UTC (rev 289578)
@@ -430,7 +430,6 @@
void cancelPaymentSession() final { }
void abortPaymentSession() final { }
void paymentCoordinatorDestroyed() final { }
- bool supportsUnrestrictedApplePay() const final { return false; }
};
#endif
Modified: trunk/Source/WebCore/page/Frame.cpp (289577 => 289578)
--- trunk/Source/WebCore/page/Frame.cpp 2022-02-10 22:21:28 UTC (rev 289577)
+++ trunk/Source/WebCore/page/Frame.cpp 2022-02-10 22:23:23 UTC (rev 289578)
@@ -694,8 +694,6 @@
return;
if (!UserContentURLPattern::matchesPatterns(document->url(), script.allowlist(), script.blocklist()))
return;
- if (!m_script->shouldAllowUserAgentScripts(*document))
- return;
document->setAsRunningUserScripts();
loader().client().willInjectUserScript(world);
Modified: trunk/Source/WebCore/testing/Internals.cpp (289577 => 289578)
--- trunk/Source/WebCore/testing/Internals.cpp 2022-02-10 22:21:28 UTC (rev 289577)
+++ trunk/Source/WebCore/testing/Internals.cpp 2022-02-10 22:23:23 UTC (rev 289578)
@@ -5325,13 +5325,6 @@
document.setAsRunningUserScripts();
}
-#if ENABLE(APPLE_PAY)
-void Internals::setApplePayIsActive(Document& document)
-{
- document.setApplePayIsActive();
-}
-#endif
-
#if ENABLE(WEBGL)
void Internals::simulateEventForWebGLContext(SimulatedWebGLContextEvent event, WebGLRenderingContext& context)
{
Modified: trunk/Source/WebCore/testing/Internals.h (289577 => 289578)
--- trunk/Source/WebCore/testing/Internals.h 2022-02-10 22:21:28 UTC (rev 289577)
+++ trunk/Source/WebCore/testing/Internals.h 2022-02-10 22:23:23 UTC (rev 289578)
@@ -824,9 +824,6 @@
void setQuickLookPassword(const String&);
void setAsRunningUserScripts(Document&);
-#if ENABLE(APPLE_PAY)
- void setApplePayIsActive(Document&);
-#endif
#if ENABLE(WEBGL)
enum class SimulatedWebGLContextEvent {
Modified: trunk/Source/WebCore/testing/Internals.idl (289577 => 289578)
--- trunk/Source/WebCore/testing/Internals.idl 2022-02-10 22:21:28 UTC (rev 289577)
+++ trunk/Source/WebCore/testing/Internals.idl 2022-02-10 22:23:23 UTC (rev 289578)
@@ -885,7 +885,6 @@
undefined setQuickLookPassword(DOMString password);
[CallWith=CurrentDocument] undefined setAsRunningUserScripts();
- [CallWith=CurrentDocument, Conditional=APPLE_PAY] undefined setApplePayIsActive();
undefined disableTileSizeUpdateDelay();
undefined setSpeculativeTilingDelayDisabledForTesting(boolean disabled);
Modified: trunk/Source/WebCore/testing/MockPaymentCoordinator.h (289577 => 289578)
--- trunk/Source/WebCore/testing/MockPaymentCoordinator.h 2022-02-10 22:21:28 UTC (rev 289577)
+++ trunk/Source/WebCore/testing/MockPaymentCoordinator.h 2022-02-10 22:23:23 UTC (rev 289578)
@@ -75,9 +75,6 @@
const MockPaymentContactFields& requiredBillingContactFields() const { return m_requiredBillingContactFields; }
const MockPaymentContactFields& requiredShippingContactFields() const { return m_requiredShippingContactFields; }
- bool supportsUnrestrictedApplePay() const final { return m_supportsUnrestrictedApplePay; }
- void setSupportsUnrestrictedApplePay(bool supports) { m_supportsUnrestrictedApplePay = supports; }
-
#if ENABLE(APPLE_PAY_INSTALLMENTS)
ApplePayInstallmentConfiguration installmentConfiguration() const { return m_installmentConfiguration; }
#endif
@@ -133,7 +130,6 @@
HashSet<String, ASCIICaseInsensitiveHash> m_availablePaymentNetworks;
MockPaymentContactFields m_requiredBillingContactFields;
MockPaymentContactFields m_requiredShippingContactFields;
- bool m_supportsUnrestrictedApplePay { true };
#if ENABLE(APPLE_PAY_INSTALLMENTS)
ApplePayInstallmentConfiguration m_installmentConfiguration;
#endif
Modified: trunk/Source/WebCore/testing/MockPaymentCoordinator.idl (289577 => 289578)
--- trunk/Source/WebCore/testing/MockPaymentCoordinator.idl 2022-02-10 22:21:28 UTC (rev 289577)
+++ trunk/Source/WebCore/testing/MockPaymentCoordinator.idl 2022-02-10 22:23:23 UTC (rev 289578)
@@ -47,8 +47,6 @@
readonly attribute ApplePaySetupConfiguration setupConfiguration;
- attribute boolean supportsUnrestrictedApplePay;
-
[Conditional=APPLE_PAY_INSTALLMENTS] readonly attribute ApplePayInstallmentConfiguration installmentConfiguration;
[Conditional=APPLE_PAY_COUPON_CODE] readonly attribute boolean? supportsCouponCode;
Modified: trunk/Source/WebKit/ChangeLog (289577 => 289578)
--- trunk/Source/WebKit/ChangeLog 2022-02-10 22:21:28 UTC (rev 289577)
+++ trunk/Source/WebKit/ChangeLog 2022-02-10 22:23:23 UTC (rev 289578)
@@ -1,3 +1,17 @@
+2022-02-10 Devin Rousso <[email protected]>
+
+ Permit simultaneous Apple Pay and script injection
+ https://bugs.webkit.org/show_bug.cgi?id=236254
+ <rdar://problem/87736727>
+
+ Reviewed by Kate Cheney.
+
+ * WebProcess/ApplePay/WebPaymentCoordinator.h:
+ * WebProcess/ApplePay/WebPaymentCoordinator.cpp:
+ (WebKit::WebPaymentCoordinator::supportsUnrestrictedApplePay const): Deleted.
+ (WebKit::WebPaymentCoordinator::userAgentScriptsBlockedErrorMessage const): Deleted.
+ Remove logic that tracks Apple Pay activity.
+
2022-02-10 Alex Christensen <[email protected]>
Unreviewed, reverting r289485.
Modified: trunk/Source/WebKit/WebProcess/ApplePay/WebPaymentCoordinator.cpp (289577 => 289578)
--- trunk/Source/WebKit/WebProcess/ApplePay/WebPaymentCoordinator.cpp 2022-02-10 22:21:28 UTC (rev 289577)
+++ trunk/Source/WebKit/WebProcess/ApplePay/WebPaymentCoordinator.cpp 2022-02-10 22:23:23 UTC (rev 289578)
@@ -158,21 +158,6 @@
delete this;
}
-bool WebPaymentCoordinator::supportsUnrestrictedApplePay() const
-{
-#if ENABLE(APPLE_PAY_REMOTE_UI)
- static bool hasEntitlement = WebProcess::singleton().parentProcessHasEntitlement("com.apple.private.WebKit.UnrestrictedApplePay");
- return hasEntitlement;
-#else
- return true;
-#endif
-}
-
-String WebPaymentCoordinator::userAgentScriptsBlockedErrorMessage() const
-{
- return "Unable to run user agent scripts because this document has previously accessed Apple Pay. Documents can be prevented from accessing Apple Pay by adding a WKUserScript to the WKWebView's WKUserContentController."_s;
-}
-
IPC::Connection* WebPaymentCoordinator::messageSenderConnection() const
{
#if ENABLE(APPLE_PAY_REMOTE_UI)
Modified: trunk/Source/WebKit/WebProcess/ApplePay/WebPaymentCoordinator.h (289577 => 289578)
--- trunk/Source/WebKit/WebProcess/ApplePay/WebPaymentCoordinator.h 2022-02-10 22:21:28 UTC (rev 289577)
+++ trunk/Source/WebKit/WebProcess/ApplePay/WebPaymentCoordinator.h 2022-02-10 22:23:23 UTC (rev 289578)
@@ -80,10 +80,6 @@
bool isWebPaymentCoordinator() const override { return true; }
- bool supportsUnrestrictedApplePay() const override;
-
- String userAgentScriptsBlockedErrorMessage() const final;
-
void getSetupFeatures(const WebCore::ApplePaySetupConfiguration&, const URL&, CompletionHandler<void(Vector<Ref<WebCore::ApplePaySetupFeature>>&&)>&&) final;
void beginApplePaySetup(const WebCore::ApplePaySetupConfiguration&, const URL&, Vector<RefPtr<WebCore::ApplePaySetupFeature>>&&, CompletionHandler<void(bool)>&&) final;
void endApplePaySetup() final;
Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (289577 => 289578)
--- trunk/Source/WebKitLegacy/mac/ChangeLog 2022-02-10 22:21:28 UTC (rev 289577)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog 2022-02-10 22:23:23 UTC (rev 289578)
@@ -1,3 +1,16 @@
+2022-02-10 Devin Rousso <[email protected]>
+
+ Permit simultaneous Apple Pay and script injection
+ https://bugs.webkit.org/show_bug.cgi?id=236254
+ <rdar://problem/87736727>
+
+ Reviewed by Kate Cheney.
+
+ * WebCoreSupport/WebPaymentCoordinatorClient.h:
+ * WebCoreSupport/WebPaymentCoordinatorClient.mm:
+ (WebPaymentCoordinatorClient::supportsUnrestrictedApplePay const): Deleted.
+ Remove logic that tracks Apple Pay activity.
+
2022-02-06 Tyler Wilcock <[email protected]>
AX: Add internal-only flag to enable WIP display: contents support
Modified: trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebPaymentCoordinatorClient.h (289577 => 289578)
--- trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebPaymentCoordinatorClient.h 2022-02-10 22:21:28 UTC (rev 289577)
+++ trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebPaymentCoordinatorClient.h 2022-02-10 22:23:23 UTC (rev 289578)
@@ -52,7 +52,6 @@
void abortPaymentSession() override;
void cancelPaymentSession() override;
void paymentCoordinatorDestroyed() override;
- bool supportsUnrestrictedApplePay() const override;
};
#endif
Modified: trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebPaymentCoordinatorClient.mm (289577 => 289578)
--- trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebPaymentCoordinatorClient.mm 2022-02-10 22:21:28 UTC (rev 289577)
+++ trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebPaymentCoordinatorClient.mm 2022-02-10 22:23:23 UTC (rev 289578)
@@ -109,9 +109,4 @@
delete this;
}
-bool WebPaymentCoordinatorClient::supportsUnrestrictedApplePay() const
-{
- return false;
-}
-
#endif
Modified: trunk/Tools/ChangeLog (289577 => 289578)
--- trunk/Tools/ChangeLog 2022-02-10 22:21:28 UTC (rev 289577)
+++ trunk/Tools/ChangeLog 2022-02-10 22:23:23 UTC (rev 289578)
@@ -1,3 +1,32 @@
+2022-02-10 Devin Rousso <[email protected]>
+
+ Permit simultaneous Apple Pay and script injection
+ https://bugs.webkit.org/show_bug.cgi?id=236254
+ <rdar://problem/87736727>
+
+ Reviewed by Kate Cheney.
+
+ * TestWebKitAPI/Tests/WebKitCocoa/ApplePay.mm:
+ (TestWebKitAPI::TEST.ApplePay.ApplePayAvailableByDefault):
+ (TestWebKitAPI::TEST.ApplePay.ApplePayAvailableInFrame): Renamed from ApplePay.ApplePayAvailableInUnrestrictedClients.
+ (TestWebKitAPI::TEST.ApplePay.UserScriptAtDocumentStartDoesNotDisableApplePay): Renamed from ApplePay.UserScriptAtDocumentStartDisablesApplePay.
+ (TestWebKitAPI::TEST.ApplePay.UserScriptAtDocumentEndDoesNotDisableApplePay): Renamed from ApplePay.UserScriptAtDocumentEndDisablesApplePay.
+ (TestWebKitAPI::TEST.ApplePay.UserAgentScriptEvaluationDoesNotDisableApplePay): Renamed from ApplePay.UserAgentScriptEvaluationDisablesApplePay.
+ (TestWebKitAPI::TEST.ApplePay.UserAgentScriptEvaluationDoesNotDisableApplePayInExistingObjects): Renamed from ApplePay.UserAgentScriptEvaluationDisablesApplePayInExistingObjects.
+ (TestWebKitAPI::TEST.ApplePay.CanMakePaymentsDoesNotBlockUserAgentScripts): Renamed from ApplePay.CanMakePaymentsBlocksUserAgentScripts.
+ (TestWebKitAPI::TEST.ApplePay.CanMakePaymentsWithActiveCardDoesNotBlockUserAgentScripts): Renamed from ApplePay.CanMakePaymentsWithActiveCardBlocksUserAgentScripts.
+ (TestWebKitAPI::TEST.ApplePay.CanMakePaymentDoesNotBlockUserAgentScripts): Renamed from ApplePay.CanMakePaymentBlocksUserAgentScripts.
+ (TestWebKitAPI::TEST.ApplePay.ActiveSessionBlocksUserAgentScripts): Deleted.
+ * TestWebKitAPI/Tests/WebKitCocoa/apple-pay-active-session.html: Removed.
+ * TestWebKitAPI/Tests/WebKitCocoa/apple-pay-availability.html:
+ * TestWebKitAPI/Tests/WebKitCocoa/apple-pay-availability-existing-object.html:
+ * TestWebKitAPI/Tests/WebKitCocoa/apple-pay-availability-in-iframe.html:
+ * TestWebKitAPI/Tests/WebKitCocoa/apple-pay-can-make-payment.html:
+ * TestWebKitAPI/Tests/WebKitCocoa/apple-pay-can-make-payments.html:
+ * TestWebKitAPI/Tests/WebKitCocoa/apple-pay-can-make-payments-with-active-card.html:
+
+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+
2022-02-10 Chris Dumez <[email protected]>
Resync web-platform-tests/service-workers from upstream
Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (289577 => 289578)
--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2022-02-10 22:21:28 UTC (rev 289577)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2022-02-10 22:23:23 UTC (rev 289578)
@@ -820,7 +820,6 @@
A1798B8522433647000764BD /* WebProcessPlugInWithInternals.mm in Sources */ = {isa = PBXBuildFile; fileRef = A1798B8422433647000764BD /* WebProcessPlugInWithInternals.mm */; };
A1798B872243449B000764BD /* apple-pay-availability.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = A1798B862243446B000764BD /* apple-pay-availability.html */; };
A1798B8922435E29000764BD /* apple-pay-availability-in-iframe.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = A1798B8822435D2E000764BD /* apple-pay-availability-in-iframe.html */; };
- A1798B8B224361A4000764BD /* apple-pay-active-session.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = A1798B8A2243611A000764BD /* apple-pay-active-session.html */; };
A17991881E1C994E00A505ED /* SharedBuffer.mm in Sources */ = {isa = PBXBuildFile; fileRef = A17991861E1C994E00A505ED /* SharedBuffer.mm */; };
A179918B1E1CA24100A505ED /* SharedBufferTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A17991891E1CA24100A505ED /* SharedBufferTest.cpp */; };
A17EAC55208305A00084B41B /* find.pdf in Copy Resources */ = {isa = PBXBuildFile; fileRef = A17EAC542083056E0084B41B /* find.pdf */; };
@@ -1222,7 +1221,6 @@
1A63479F183D72A4005B1707 /* all-content-in-one-iframe.html in Copy Resources */,
C25CCA0D1E5141840026CB8A /* AllAhem.svg in Copy Resources */,
F4A9202F1FEE34E900F59590 /* apple-data-url.html in Copy Resources */,
- A1798B8B224361A4000764BD /* apple-pay-active-session.html in Copy Resources */,
A1FB503D22A1CBE200D4D979 /* apple-pay-availability-existing-object.html in Copy Resources */,
A1798B8922435E29000764BD /* apple-pay-availability-in-iframe.html in Copy Resources */,
A1798B872243449B000764BD /* apple-pay-availability.html in Copy Resources */,
@@ -2656,7 +2654,6 @@
A1798B8422433647000764BD /* WebProcessPlugInWithInternals.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = WebProcessPlugInWithInternals.mm; sourceTree = "<group>"; };
A1798B862243446B000764BD /* apple-pay-availability.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = "apple-pay-availability.html"; sourceTree = "<group>"; };
A1798B8822435D2E000764BD /* apple-pay-availability-in-iframe.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = "apple-pay-availability-in-iframe.html"; sourceTree = "<group>"; };
- A1798B8A2243611A000764BD /* apple-pay-active-session.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = "apple-pay-active-session.html"; sourceTree = "<group>"; };
A17991861E1C994E00A505ED /* SharedBuffer.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SharedBuffer.mm; sourceTree = "<group>"; };
A17991891E1CA24100A505ED /* SharedBufferTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SharedBufferTest.cpp; sourceTree = "<group>"; };
A179918A1E1CA24100A505ED /* SharedBufferTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SharedBufferTest.h; sourceTree = "<group>"; };
@@ -4036,7 +4033,6 @@
46C1EA9725758805005E409E /* alert.html */,
C25CCA0C1E5140E50026CB8A /* AllAhem.svg */,
F4A9202E1FEE34C800F59590 /* apple-data-url.html */,
- A1798B8A2243611A000764BD /* apple-pay-active-session.html */,
A1FB503C22A1C24400D4D979 /* apple-pay-availability-existing-object.html */,
A1798B8822435D2E000764BD /* apple-pay-availability-in-iframe.html */,
A1798B862243446B000764BD /* apple-pay-availability.html */,
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ApplePay.mm (289577 => 289578)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ApplePay.mm 2022-02-10 22:21:28 UTC (rev 289577)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ApplePay.mm 2022-02-10 22:23:23 UTC (rev 289578)
@@ -104,7 +104,7 @@
[TestProtocol unregister];
}
-TEST(ApplePay, ApplePayAvailableInUnrestrictedClients)
+TEST(ApplePay, ApplePayAvailableInFrame)
{
[TestProtocol registerWithScheme:@"https"];
@@ -116,7 +116,7 @@
[configuration.userContentController addScriptMessageHandler:messageHandler.get() name:@"testApplePay"];
auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectZero configuration:configuration]);
- [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"https://bundle-file/apple-pay-availability-in-iframe.html?unrestricted"]]];
+ [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"https://bundle-file/apple-pay-availability-in-iframe.html"]]];
[webView _test_waitForDidFinishNavigation];
[webView evaluateJavaScript:@"loadApplePayFrame();" completionHandler:nil];
@@ -127,11 +127,11 @@
[TestProtocol unregister];
}
-TEST(ApplePay, UserScriptAtDocumentStartDisablesApplePay)
+TEST(ApplePay, UserScriptAtDocumentStartDoesNotDisableApplePay)
{
[TestProtocol registerWithScheme:@"https"];
- auto messageHandler = adoptNS([[TestApplePayAvailableScriptMessageHandler alloc] initWithAPIsAvailableExpectation:NO canMakePaymentsExpectation:NO]);
+ auto messageHandler = adoptNS([[TestApplePayAvailableScriptMessageHandler alloc] initWithAPIsAvailableExpectation:YES canMakePaymentsExpectation:YES]);
auto userScript = adoptNS([[WKUserScript alloc] initWithSource:userScriptSource injectionTime:WKUserScriptInjectionTimeAtDocumentStart forMainFrameOnly:YES]);
WKWebViewConfiguration *configuration = [WKWebViewConfiguration _test_configurationWithTestPlugInClassName:@"WebProcessPlugInWithInternals" configureJSCForTesting:YES];
@@ -148,11 +148,11 @@
[TestProtocol unregister];
}
-TEST(ApplePay, UserScriptAtDocumentEndDisablesApplePay)
+TEST(ApplePay, UserScriptAtDocumentEndDoesNotDisableApplePay)
{
[TestProtocol registerWithScheme:@"https"];
- auto messageHandler = adoptNS([[TestApplePayAvailableScriptMessageHandler alloc] initWithAPIsAvailableExpectation:NO canMakePaymentsExpectation:NO]);
+ auto messageHandler = adoptNS([[TestApplePayAvailableScriptMessageHandler alloc] initWithAPIsAvailableExpectation:YES canMakePaymentsExpectation:YES]);
auto userScript = adoptNS([[WKUserScript alloc] initWithSource:userScriptSource injectionTime:WKUserScriptInjectionTimeAtDocumentEnd forMainFrameOnly:YES]);
WKWebViewConfiguration *configuration = [WKWebViewConfiguration _test_configurationWithTestPlugInClassName:@"WebProcessPlugInWithInternals" configureJSCForTesting:YES];
@@ -169,11 +169,11 @@
[TestProtocol unregister];
}
-TEST(ApplePay, UserAgentScriptEvaluationDisablesApplePay)
+TEST(ApplePay, UserAgentScriptEvaluationDoesNotDisableApplePay)
{
[TestProtocol registerWithScheme:@"https"];
- auto messageHandler = adoptNS([[TestApplePayAvailableScriptMessageHandler alloc] initWithAPIsAvailableExpectation:YES canMakePaymentsExpectation:NO]);
+ auto messageHandler = adoptNS([[TestApplePayAvailableScriptMessageHandler alloc] initWithAPIsAvailableExpectation:YES canMakePaymentsExpectation:YES]);
WKWebViewConfiguration *configuration = [WKWebViewConfiguration _test_configurationWithTestPlugInClassName:@"WebProcessPlugInWithInternals" configureJSCForTesting:YES];
[configuration.userContentController addScriptMessageHandler:messageHandler.get() name:@"testApplePay"];
@@ -190,11 +190,11 @@
[TestProtocol unregister];
}
-TEST(ApplePay, UserAgentScriptEvaluationDisablesApplePayInExistingObjects)
+TEST(ApplePay, UserAgentScriptEvaluationDoesNotDisableApplePayInExistingObjects)
{
[TestProtocol registerWithScheme:@"https"];
- auto messageHandler = adoptNS([[TestApplePayAvailableScriptMessageHandler alloc] initWithAPIsAvailableExpectation:YES canMakePaymentsExpectation:NO]);
+ auto messageHandler = adoptNS([[TestApplePayAvailableScriptMessageHandler alloc] initWithAPIsAvailableExpectation:YES canMakePaymentsExpectation:YES]);
WKWebViewConfiguration *configuration = [WKWebViewConfiguration _test_configurationWithTestPlugInClassName:@"WebProcessPlugInWithInternals" configureJSCForTesting:YES];
[configuration.userContentController addScriptMessageHandler:messageHandler.get() name:@"testApplePay"];
@@ -205,7 +205,7 @@
Util::run(&isDone);
isDone = false;
- [messageHandler setCanMakePaymentsExpectation:NO];
+ [messageHandler setCanMakePaymentsExpectation:YES];
[webView evaluateJavaScript:@"document.location.hash = '#test'" completionHandler:nil];
Util::run(&isDone);
@@ -240,24 +240,19 @@
[TestProtocol unregister];
}
-TEST(ApplePay, ActiveSessionBlocksUserAgentScripts)
+TEST(ApplePay, CanMakePaymentsDoesNotBlockUserAgentScripts)
{
- runActiveSessionTest([NSURL URLWithString:@"https://bundle-file/apple-pay-active-session.html"], YES);
+ runActiveSessionTest([NSURL URLWithString:@"https://bundle-file/apple-pay-can-make-payments.html"], NO);
}
-TEST(ApplePay, CanMakePaymentsBlocksUserAgentScripts)
-{
- runActiveSessionTest([NSURL URLWithString:@"https://bundle-file/apple-pay-can-make-payments.html"], YES);
-}
-
TEST(ApplePay, CanMakePaymentsFalseDoesNotBlockUserAgentScripts)
{
runActiveSessionTest([NSURL URLWithString:@"https://bundle-file/apple-pay-can-make-payments.html?false"], NO);
}
-TEST(ApplePay, CanMakePaymentsWithActiveCardBlocksUserAgentScripts)
+TEST(ApplePay, CanMakePaymentsWithActiveCardDoesNotBlockUserAgentScripts)
{
- runActiveSessionTest([NSURL URLWithString:@"https://bundle-file/apple-pay-can-make-payments-with-active-card.html"], YES);
+ runActiveSessionTest([NSURL URLWithString:@"https://bundle-file/apple-pay-can-make-payments-with-active-card.html"], NO);
}
TEST(ApplePay, CanMakePaymentsWithActiveCardFalseDoesNotBlockUserAgentScripts)
@@ -265,9 +260,9 @@
runActiveSessionTest([NSURL URLWithString:@"https://bundle-file/apple-pay-can-make-payments-with-active-card.html?false"], NO);
}
-TEST(ApplePay, CanMakePaymentBlocksUserAgentScripts)
+TEST(ApplePay, CanMakePaymentDoesNotBlockUserAgentScripts)
{
- runActiveSessionTest([NSURL URLWithString:@"https://bundle-file/apple-pay-can-make-payment.html"], YES);
+ runActiveSessionTest([NSURL URLWithString:@"https://bundle-file/apple-pay-can-make-payment.html"], NO);
}
TEST(ApplePay, CanMakePaymentFalseDoesNotBlockUserAgentScripts)
Deleted: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/apple-pay-active-session.html (289577 => 289578)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/apple-pay-active-session.html 2022-02-10 22:21:28 UTC (rev 289577)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/apple-pay-active-session.html 2022-02-10 22:23:23 UTC (rev 289578)
@@ -1,7 +0,0 @@
-<!DOCTYPE html>
-<body>
-<script>
- internals.mockPaymentCoordinator.supportsUnrestrictedApplePay = false;
- internals.setApplePayIsActive();
- window.webkit.messageHandlers.testApplePay.postMessage("done");
-</script>
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/apple-pay-availability-existing-object.html (289577 => 289578)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/apple-pay-availability-existing-object.html 2022-02-10 22:21:28 UTC (rev 289577)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/apple-pay-availability-existing-object.html 2022-02-10 22:23:23 UTC (rev 289578)
@@ -3,24 +3,18 @@
<script src=""
<script>
const eventListener = async () => {
- internals.mockPaymentCoordinator.supportsUnrestrictedApplePay = false;
-
const applePaySessionAvailable = !!window.ApplePaySession;
const paymentRequestAvailable = !!window.PaymentRequest;
- const supportsVersion = ApplePaySession.supportsVersion(1);
-
- if (!window.wkPaymentRequest) {
- wkPaymentRequest = new PaymentRequest([applePayMethod()], applePayDetails);
-
- window.webkit.messageHandlers.testApplePay.postMessage({
- applePaySessionAvailable,
- paymentRequestAvailable,
- supportsVersion,
- });
-
+ if (!applePaySessionAvailable || !paymentRequestAvailable) {
+ window.webkit.messageHandlers.testApplePay.postMessage({ applePaySessionAvailable, paymentRequestAvailable });
return;
}
+ const supportsVersion = ApplePaySession.supportsVersion(1);
+ const canMakePayments = ApplePaySession.canMakePayments();
+ const canMakePaymentsWithActiveCard = await ApplePaySession.canMakePaymentsWithActiveCard('');
+
+ window.wkPaymentRequest ??= new PaymentRequest([applePayMethod()], applePayDetails);
const canMakePayment = await wkPaymentRequest.canMakePayment();
window.webkit.messageHandlers.testApplePay.postMessage({
@@ -27,6 +21,8 @@
applePaySessionAvailable,
paymentRequestAvailable,
supportsVersion,
+ canMakePayments,
+ canMakePaymentsWithActiveCard,
canMakePayment,
});
};
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/apple-pay-availability-in-iframe.html (289577 => 289578)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/apple-pay-availability-in-iframe.html 2022-02-10 22:21:28 UTC (rev 289577)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/apple-pay-availability-in-iframe.html 2022-02-10 22:23:23 UTC (rev 289578)
@@ -1,7 +1,6 @@
<!DOCTYPE html>
<body>
<script>
- internals.mockPaymentCoordinator.supportsUnrestrictedApplePay = window.location.search === "?unrestricted" ? true : false;
loadApplePayFrame = () => {
const iframe = document.createElement('iframe');
iframe.src = '' + window.location.search;
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/apple-pay-availability.html (289577 => 289578)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/apple-pay-availability.html 2022-02-10 22:21:28 UTC (rev 289577)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/apple-pay-availability.html 2022-02-10 22:23:23 UTC (rev 289578)
@@ -3,8 +3,6 @@
<script src=""
<script>
window.addEventListener('load', async () => {
- internals.mockPaymentCoordinator.supportsUnrestrictedApplePay = window.location.search === "?unrestricted" ? true : false;
-
const applePaySessionAvailable = !!window.ApplePaySession;
const paymentRequestAvailable = !!window.PaymentRequest;
if (!applePaySessionAvailable || !paymentRequestAvailable) {
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/apple-pay-can-make-payment.html (289577 => 289578)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/apple-pay-can-make-payment.html 2022-02-10 22:21:28 UTC (rev 289577)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/apple-pay-can-make-payment.html 2022-02-10 22:23:23 UTC (rev 289578)
@@ -2,7 +2,6 @@
<body>
<script src=""
<script>
- internals.mockPaymentCoordinator.supportsUnrestrictedApplePay = false;
internals.mockPaymentCoordinator.setCanMakePayments(window.location.search === "?false" ? false : true);
const paymentRequest = new PaymentRequest([applePayMethod()], applePayDetails);
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/apple-pay-can-make-payments-with-active-card.html (289577 => 289578)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/apple-pay-can-make-payments-with-active-card.html 2022-02-10 22:21:28 UTC (rev 289577)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/apple-pay-can-make-payments-with-active-card.html 2022-02-10 22:23:23 UTC (rev 289578)
@@ -1,7 +1,6 @@
<!DOCTYPE html>
<body>
<script>
- internals.mockPaymentCoordinator.supportsUnrestrictedApplePay = false;
internals.mockPaymentCoordinator.setCanMakePaymentsWithActiveCard(window.location.search === "?false" ? false : true);
ApplePaySession.canMakePaymentsWithActiveCard("").then(() => {
window.webkit.messageHandlers.testApplePay.postMessage("done");
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/apple-pay-can-make-payments.html (289577 => 289578)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/apple-pay-can-make-payments.html 2022-02-10 22:21:28 UTC (rev 289577)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/apple-pay-can-make-payments.html 2022-02-10 22:23:23 UTC (rev 289578)
@@ -1,7 +1,6 @@
<!DOCTYPE html>
<body>
<script>
- internals.mockPaymentCoordinator.supportsUnrestrictedApplePay = false;
internals.mockPaymentCoordinator.setCanMakePayments(window.location.search === "?false" ? false : true);
ApplePaySession.canMakePayments();
window.webkit.messageHandlers.testApplePay.postMessage("done");