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

Unified Diff: Source/modules/presentation/PresentationRequest.cpp

Issue 1296943003: Presentation API: PresentationRequest.start() requires user gesture. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 4 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
« no previous file with comments | « LayoutTests/presentation/presentationrequest.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/presentation/PresentationRequest.cpp
diff --git a/Source/modules/presentation/PresentationRequest.cpp b/Source/modules/presentation/PresentationRequest.cpp
index 63f8aa2b4bbeda17b2af28b4d2738fad84e4dbfb..04b209a8cd634a693adddfb955c5ec1123727b60 100644
--- a/Source/modules/presentation/PresentationRequest.cpp
+++ b/Source/modules/presentation/PresentationRequest.cpp
@@ -19,6 +19,7 @@
#include "modules/presentation/PresentationError.h"
#include "modules/presentation/PresentationSession.h"
#include "modules/presentation/PresentationSessionCallbacks.h"
+#include "platform/UserGestureIndicator.h"
namespace blink {
@@ -82,6 +83,11 @@ ScriptPromise PresentationRequest::start(ScriptState* scriptState)
ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState);
ScriptPromise promise = resolver->promise();
+ if (!UserGestureIndicator::processingUserGesture()) {
+ resolver->reject(DOMException::create(InvalidAccessError, "PresentationRequest::start() requires user gesture."));
+ return promise;
+ }
+
WebPresentationClient* client = presentationClient(executionContext());
if (!client) {
resolver->reject(DOMException::create(InvalidStateError, "The PresentationRequest is no longer associated to a frame."));
« no previous file with comments | « LayoutTests/presentation/presentationrequest.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698