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

Unified Diff: Source/modules/notifications/Notification.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: 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
Index: Source/modules/notifications/Notification.cpp
diff --git a/Source/modules/notifications/Notification.cpp b/Source/modules/notifications/Notification.cpp
index f0964c3a66a09ebc1a3393f1c2061024cd9fcf24..99e8720e3324f84952eb997f8972b02a7e28b8a7 100644
--- a/Source/modules/notifications/Notification.cpp
+++ b/Source/modules/notifications/Notification.cpp
@@ -161,6 +161,10 @@ const String& Notification::permission(ExecutionContext* context)
void Notification::requestPermission(ExecutionContext* context, PassOwnPtrWillBeRawPtr<NotificationPermissionCallback> callback)
{
+ if (!UserGestureIndicator::processingUserGesture()) {
+ context->addConsoleMessage(ConsoleMessage::create(JSMessageSource, WarningMessageLevel,
+ "Notification.requestPermission() was invoked by script, without any user interaction involved!"));
+ }
Peter Beverloo 2014/09/24 14:59:44 We removed the user gesture requirement for reques
Mayur Kankanwadi 2014/09/24 15:03:42 No, not seeing any permission dialog for notificat
Peter Beverloo 2014/09/24 17:14:20 I made a test-page here: http://peter.sh/files/n
meacer 2014/09/24 17:59:21 I agree, a gesture isn't required for this API so
Mayur Kankanwadi 2014/09/25 06:43:01 Done.
// FIXME: Assert that this code-path will only be reached for Document environments
// when Blink supports [Exposed] annotations on class members in IDL definitions.
if (NotificationPermissionClient* permissionClient = NotificationPermissionClient::from(context)) {
« Source/core/page/PointerLockController.cpp ('K') | « Source/core/page/PointerLockController.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698