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

Unified Diff: third_party/WebKit/Source/modules/payments/PaymentRequest.cpp

Issue 2029473002: PaymentRequest should throw if not in top context. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/modules/payments/PaymentRequest.cpp
diff --git a/third_party/WebKit/Source/modules/payments/PaymentRequest.cpp b/third_party/WebKit/Source/modules/payments/PaymentRequest.cpp
index 77c01005b8f9a30f8e63f05567013cc64196e55b..c0693450dc6b7841cd43fd2ea6d62480ae1d6b70 100644
--- a/third_party/WebKit/Source/modules/payments/PaymentRequest.cpp
+++ b/third_party/WebKit/Source/modules/payments/PaymentRequest.cpp
@@ -301,13 +301,16 @@ PaymentRequest::PaymentRequest(ScriptState* scriptState, const Vector<String>& s
, m_options(options)
, m_clientBinding(this)
{
- // TODO(rouslan): Also check for a top-level browsing context.
- // https://github.com/w3c/browser-payment-api/issues/2
if (!scriptState->getExecutionContext()->isSecureContext()) {
exceptionState.throwSecurityError("Must be in a secure context");
return;
}
+ if (scriptState->domWindow() != scriptState->domWindow()->top()) {
Marijn Kruisselbrink 2016/06/01 00:19:25 I believe this check is more typically written as
please use gerrit instead 2016/06/01 00:42:29 Done.
+ exceptionState.throwSecurityError("Must be in a top-level browsing context");
+ return;
+ }
+
if (supportedMethods.isEmpty()) {
exceptionState.throwTypeError("Must specify at least one payment method identifier");
return;

Powered by Google App Engine
This is Rietveld 408576698