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

Unified Diff: third_party/WebKit/Source/modules/notifications/Notification.cpp

Issue 2681723003: Add a deprecation warning for notifications on insecure contexts. (Closed)
Patch Set: Rebase Created 3 years, 10 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 | « third_party/WebKit/Source/core/frame/UseCounter.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/modules/notifications/Notification.cpp
diff --git a/third_party/WebKit/Source/modules/notifications/Notification.cpp b/third_party/WebKit/Source/modules/notifications/Notification.cpp
index 8f9f047cd452193f2771eeca159e7480adf8382c..41227ea4b4c0f1ef31d03af083ff8f4c55f1a0a5 100644
--- a/third_party/WebKit/Source/modules/notifications/Notification.cpp
+++ b/third_party/WebKit/Source/modules/notifications/Notification.cpp
@@ -41,6 +41,7 @@
#include "core/dom/ScopedWindowFocusAllowedIndicator.h"
#include "core/dom/TaskRunnerHelper.h"
#include "core/events/Event.h"
+#include "core/frame/Deprecation.h"
#include "core/frame/UseCounter.h"
#include "modules/notifications/NotificationAction.h"
#include "modules/notifications/NotificationData.h"
@@ -98,9 +99,10 @@ Notification* Notification::create(ExecutionContext* context,
UseCounter::countCrossOriginIframe(
*toDocument(context), UseCounter::NotificationAPISecureOriginIframe);
} else {
- UseCounter::count(context, UseCounter::NotificationInsecureOrigin);
+ Deprecation::countDeprecation(context,
+ UseCounter::NotificationInsecureOrigin);
if (context->isDocument())
- UseCounter::countCrossOriginIframe(
+ Deprecation::countDeprecationCrossOriginIframe(
*toDocument(context),
UseCounter::NotificationAPIInsecureOriginIframe);
}
@@ -358,8 +360,13 @@ String Notification::permission(ExecutionContext* context) {
ScriptPromise Notification::requestPermission(
ScriptState* scriptState,
NotificationPermissionCallback* deprecatedCallback) {
- return NotificationManager::from(scriptState->getExecutionContext())
- ->requestPermission(scriptState, deprecatedCallback);
+ ExecutionContext* context = scriptState->getExecutionContext();
+ if (!context->isSecureContext()) {
+ Deprecation::countDeprecation(
+ context, UseCounter::NotificationPermissionRequestedInsecureOrigin);
+ }
+ return NotificationManager::from(context)->requestPermission(
+ scriptState, deprecatedCallback);
}
size_t Notification::maxActions() {
« no previous file with comments | « third_party/WebKit/Source/core/frame/UseCounter.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698