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

Side by Side Diff: third_party/WebKit/Source/core/frame/Deprecation.cpp

Issue 1753953002: Add new countDeprecationCrossOriginIframe for deprecated counters (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Fix lack-of-deprecation-msg Created 4 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/frame/Deprecation.h" 5 #include "core/frame/Deprecation.h"
6 6
7 #include "core/dom/Document.h" 7 #include "core/dom/Document.h"
8 #include "core/dom/ExecutionContext.h" 8 #include "core/dom/ExecutionContext.h"
9 #include "core/frame/FrameConsole.h" 9 #include "core/frame/FrameConsole.h"
10 #include "core/frame/FrameHost.h" 10 #include "core/frame/FrameHost.h"
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 Deprecation::countDeprecation(document.frame(), feature); 144 Deprecation::countDeprecation(document.frame(), feature);
145 } 145 }
146 146
147 void Deprecation::countDeprecationIfNotPrivateScript(v8::Isolate* isolate, Execu tionContext* context, UseCounter::Feature feature) 147 void Deprecation::countDeprecationIfNotPrivateScript(v8::Isolate* isolate, Execu tionContext* context, UseCounter::Feature feature)
148 { 148 {
149 if (DOMWrapperWorld::current(isolate).isPrivateScriptIsolatedWorld()) 149 if (DOMWrapperWorld::current(isolate).isPrivateScriptIsolatedWorld())
150 return; 150 return;
151 Deprecation::countDeprecation(context, feature); 151 Deprecation::countDeprecation(context, feature);
152 } 152 }
153 153
154 void Deprecation::countDeprecationCrossOriginIframe(const Document& document, Us eCounter::Feature feature)
155 {
156 LocalFrame* frame = document.frame();
157 if (!frame)
158 return;
159 // Check to see if the frame can script into the top level document.
160 SecurityOrigin* securityOrigin = frame->securityContext()->securityOrigin();
161 Frame* top = frame->tree().top();
162 if (top && !securityOrigin->canAccess(top->securityContext()->securityOrigin ()))
163 countDeprecation(frame, feature);
164 }
165
154 String Deprecation::deprecationMessage(UseCounter::Feature feature) 166 String Deprecation::deprecationMessage(UseCounter::Feature feature)
155 { 167 {
156 switch (feature) { 168 switch (feature) {
157 // Quota 169 // Quota
158 case UseCounter::PrefixedStorageInfo: 170 case UseCounter::PrefixedStorageInfo:
159 return replacedBy("'window.webkitStorageInfo'", "'navigator.webkitTempor aryStorage' or 'navigator.webkitPersistentStorage'"); 171 return replacedBy("'window.webkitStorageInfo'", "'navigator.webkitTempor aryStorage' or 'navigator.webkitPersistentStorage'");
160 172
161 case UseCounter::ConsoleMarkTimeline: 173 case UseCounter::ConsoleMarkTimeline:
162 return replacedBy("'console.markTimeline'", "'console.timeStamp'"); 174 return replacedBy("'console.markTimeline'", "'console.timeStamp'");
163 175
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 case UseCounter::DeviceMotionInsecureOrigin: 282 case UseCounter::DeviceMotionInsecureOrigin:
271 return "The devicemotion event is deprecated on insecure origins, and su pport will be removed in the future. You should consider switching your applicat ion to a secure origin, such as HTTPS. See https://goo.gl/rStTGz for more detail s."; 283 return "The devicemotion event is deprecated on insecure origins, and su pport will be removed in the future. You should consider switching your applicat ion to a secure origin, such as HTTPS. See https://goo.gl/rStTGz for more detail s.";
272 284
273 case UseCounter::DeviceOrientationInsecureOrigin: 285 case UseCounter::DeviceOrientationInsecureOrigin:
274 return "The deviceorientation event is deprecated on insecure origins, a nd support will be removed in the future. You should consider switching your app lication to a secure origin, such as HTTPS. See https://goo.gl/rStTGz for more d etails."; 286 return "The deviceorientation event is deprecated on insecure origins, a nd support will be removed in the future. You should consider switching your app lication to a secure origin, such as HTTPS. See https://goo.gl/rStTGz for more d etails.";
275 287
276 case UseCounter::DeviceOrientationAbsoluteInsecureOrigin: 288 case UseCounter::DeviceOrientationAbsoluteInsecureOrigin:
277 return "The deviceorientationabsolute event is deprecated on insecure or igins, and support will be removed in the future. You should consider switching your application to a secure origin, such as HTTPS. See https://goo.gl/rStTGz fo r more details."; 289 return "The deviceorientationabsolute event is deprecated on insecure or igins, and support will be removed in the future. You should consider switching your application to a secure origin, such as HTTPS. See https://goo.gl/rStTGz fo r more details.";
278 290
279 case UseCounter::GeolocationInsecureOrigin: 291 case UseCounter::GeolocationInsecureOrigin:
292 case UseCounter::GeolocationInsecureOriginIframe:
280 // TODO(jww): This message should be made less ambigous after WebView 293 // TODO(jww): This message should be made less ambigous after WebView
281 // is fixed so geolocation can be removed there. After that, this 294 // is fixed so geolocation can be removed there. After that, this
282 // should be updated to read similarly to GetUserMediaInsecureOrigin's 295 // should be updated to read similarly to GetUserMediaInsecureOrigin's
283 // message. 296 // message.
284 return "getCurrentPosition() and watchPosition() are deprecated on insec ure origins. To use this feature, you should consider switching your application to a secure origin, such as HTTPS. See https://goo.gl/rStTGz for more details." ; 297 return "getCurrentPosition() and watchPosition() are deprecated on insec ure origins. To use this feature, you should consider switching your application to a secure origin, such as HTTPS. See https://goo.gl/rStTGz for more details." ;
285 298
286 case UseCounter::GetUserMediaInsecureOrigin: 299 case UseCounter::GetUserMediaInsecureOrigin:
300 case UseCounter::GetUserMediaInsecureOriginIframe:
287 return "getUserMedia() no longer works on insecure origins. To use this feature, you should consider switching your application to a secure origin, such as HTTPS. See https://goo.gl/rStTGz for more details."; 301 return "getUserMedia() no longer works on insecure origins. To use this feature, you should consider switching your application to a secure origin, such as HTTPS. See https://goo.gl/rStTGz for more details.";
288 302
289 case UseCounter::EncryptedMediaInsecureOrigin: 303 case UseCounter::EncryptedMediaInsecureOrigin:
290 return "requestMediaKeySystemAccess() is deprecated on insecure origins in the specification. Support will be removed in the future. You should consider switching your application to a secure origin, such as HTTPS. See https://goo.g l/rStTGz for more details."; 304 return "requestMediaKeySystemAccess() is deprecated on insecure origins in the specification. Support will be removed in the future. You should consider switching your application to a secure origin, such as HTTPS. See https://goo.g l/rStTGz for more details.";
291 305
292 case UseCounter::ApplicationCacheManifestSelectInsecureOrigin: 306 case UseCounter::ApplicationCacheManifestSelectInsecureOrigin:
293 case UseCounter::ApplicationCacheAPIInsecureOrigin: 307 case UseCounter::ApplicationCacheAPIInsecureOrigin:
294 return "Use of the Application Cache is deprecated on insecure origins. Support will be removed in the future. You should consider switching your applic ation to a secure origin, such as HTTPS. See https://goo.gl/rStTGz for more deta ils."; 308 return "Use of the Application Cache is deprecated on insecure origins. Support will be removed in the future. You should consider switching your applic ation to a secure origin, such as HTTPS. See https://goo.gl/rStTGz for more deta ils.";
295 309
296 case UseCounter::ElementCreateShadowRootMultiple: 310 case UseCounter::ElementCreateShadowRootMultiple:
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 case UseCounter::ResultsAttribute: 371 case UseCounter::ResultsAttribute:
358 return willBeRemoved("'results' attribute", 53, "5738199536107520"); 372 return willBeRemoved("'results' attribute", 53, "5738199536107520");
359 373
360 // Features that aren't deprecated don't have a deprecation message. 374 // Features that aren't deprecated don't have a deprecation message.
361 default: 375 default:
362 return String(); 376 return String();
363 } 377 }
364 } 378 }
365 379
366 } // namespace blink 380 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698