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

Unified Diff: Source/core/page/PointerLockController.cpp

Issue 600773002: Notify in console when an API fails because it needs to be invoked on user action. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixed console message and rebased expected.txt files. Created 6 years, 3 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
« Source/core/dom/Fullscreen.cpp ('K') | « Source/core/dom/Fullscreen.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/page/PointerLockController.cpp
diff --git a/Source/core/page/PointerLockController.cpp b/Source/core/page/PointerLockController.cpp
index 8fe61a2b9d856ee3161823457530778e31b82dbc..3a58ecc4d1ecbccf3685b3b1d37ba789ebda2b27 100644
--- a/Source/core/page/PointerLockController.cpp
+++ b/Source/core/page/PointerLockController.cpp
@@ -49,6 +49,11 @@ PassOwnPtrWillBeRawPtr<PointerLockController> PointerLockController::create(Page
void PointerLockController::requestPointerLock(Element* target)
{
+ if (!UserGestureIndicator::processingUserGesture()) {
+ target->document().executionContext()->addConsoleMessage(ConsoleMessage::create(JSMessageSource, WarningMessageLevel,
+ "requestPointerLock can only be initiated by a user gesture."));
Mike West 2014/09/29 12:24:08 Same here.
Mayur Kankanwadi 2014/09/30 13:56:40 Done.
+ }
Mike West 2014/09/29 12:24:08 You should return early here, right? Otherwise you
Mayur Kankanwadi 2014/09/30 13:56:40 The existing code flow does not do anything notici
Mike West 2014/09/30 14:18:11 Then I don't understand why you're adding a messag
+
if (!target || !target->inDocument() || m_documentOfRemovedElementWhileWaitingForUnlock) {
enqueueEvent(EventTypeNames::pointerlockerror, target);
return;
« Source/core/dom/Fullscreen.cpp ('K') | « Source/core/dom/Fullscreen.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698