OLD | NEW |
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" |
11 #include "core/frame/LocalFrame.h" | 11 #include "core/frame/LocalFrame.h" |
12 #include "core/inspector/ConsoleMessage.h" | 12 #include "core/inspector/ConsoleMessage.h" |
13 #include "core/workers/WorkerGlobalScope.h" | 13 #include "core/workers/WorkerGlobalScope.h" |
14 | 14 |
15 namespace { | 15 namespace { |
16 | 16 |
17 const char* milestoneString(int milestone) | 17 const char* milestoneString(int milestone) |
18 { | 18 { |
19 // These are the Estimated Stable Dates: | 19 // These are the Estimated Stable Dates: |
20 // https://www.chromium.org/developers/calendar | 20 // https://www.chromium.org/developers/calendar |
21 | 21 |
22 switch (milestone) { | 22 switch (milestone) { |
23 case 50: | |
24 return "M50, around April 2016"; | |
25 case 51: | |
26 return "M51, around May 2016"; | |
27 case 52: | |
28 return "M52, around July 2016"; | |
29 case 53: | |
30 return "M53, around September 2016"; | |
31 case 54: | |
32 return "M54, around October 2016"; | |
33 case 55: | 23 case 55: |
34 return "M55, around November 2016"; | 24 return "M55, around November 2016"; |
35 case 56: | 25 case 56: |
36 return "M56, around January 2017"; | 26 return "M56, around January 2017"; |
37 } | 27 } |
38 | 28 |
39 ASSERT_NOT_REACHED(); | 29 ASSERT_NOT_REACHED(); |
40 return nullptr; | 30 return nullptr; |
41 } | 31 } |
42 | 32 |
43 String replacedBy(const char* feature, const char* replacement) | 33 String replacedBy(const char* feature, const char* replacement) |
44 { | 34 { |
45 return String::format("%s is deprecated. Please use %s instead.", feature, r
eplacement); | 35 return String::format("%s is deprecated. Please use %s instead.", feature, r
eplacement); |
46 } | 36 } |
47 | 37 |
48 String willBeRemoved(const char* feature, int milestone, const char* details) | 38 String willBeRemoved(const char* feature, int milestone, const char* details) |
49 { | 39 { |
50 return String::format("%s is deprecated and will be removed in %s. See https
://www.chromestatus.com/features/%s for more details.", feature, milestoneString
(milestone), details); | 40 return String::format("%s is deprecated and will be removed in %s. See https
://www.chromestatus.com/features/%s for more details.", feature, milestoneString
(milestone), details); |
51 } | 41 } |
52 | 42 |
53 String dopplerWillBeRemoved(const char* feature, int milestone, const char* deta
ils) | 43 String dopplerWillBeRemoved(const char* feature, int milestone, const char* deta
ils) |
54 { | 44 { |
55 return String::format("%s is deprecated and will be removed in %s. It has no
effect as the Web Audio doppler effects have already been removed internally. S
ee https://www.chromestatus.com/features/%s for more details.", feature, milesto
neString(milestone), details); | 45 return String::format("%s is deprecated and will be removed in %s. It has no
effect as the Web Audio doppler effects have already been removed internally. S
ee https://www.chromestatus.com/features/%s for more details.", feature, milesto
neString(milestone), details); |
56 } | 46 } |
57 | 47 |
58 String replacedWillBeRemoved(const char* feature, const char* replacement, int m
ilestone, const char* details) | |
59 { | |
60 return String::format("%s is deprecated and will be removed in %s. Please us
e %s instead. See https://www.chromestatus.com/features/%s for more details.", f
eature, milestoneString(milestone), replacement, details); | |
61 } | |
62 | |
63 } // anonymous namespace | 48 } // anonymous namespace |
64 | 49 |
65 namespace blink { | 50 namespace blink { |
66 | 51 |
67 Deprecation::Deprecation() | 52 Deprecation::Deprecation() |
68 : m_muteCount(0) | 53 : m_muteCount(0) |
69 { | 54 { |
70 m_cssPropertyDeprecationBits.ensureSize(lastUnresolvedCSSProperty + 1); | 55 m_cssPropertyDeprecationBits.ensureSize(lastUnresolvedCSSProperty + 1); |
71 } | 56 } |
72 | 57 |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 | 326 |
342 case UseCounter::MediaStreamTrackGetSources: | 327 case UseCounter::MediaStreamTrackGetSources: |
343 return "MediaStreamTrack.getSources is deprecated. See https://www.chrom
estatus.com/feature/4765305641369600 for more details."; | 328 return "MediaStreamTrack.getSources is deprecated. See https://www.chrom
estatus.com/feature/4765305641369600 for more details."; |
344 | 329 |
345 case UseCounter::WebAnimationHyphenatedProperty: | 330 case UseCounter::WebAnimationHyphenatedProperty: |
346 return "Hyphenated property names in Web Animations keyframes are invali
d and therefore ignored. Please use camelCase instead."; | 331 return "Hyphenated property names in Web Animations keyframes are invali
d and therefore ignored. Please use camelCase instead."; |
347 | 332 |
348 case UseCounter::HTMLKeygenElement: | 333 case UseCounter::HTMLKeygenElement: |
349 return willBeRemoved("The <keygen> element", 56, "5716060992962560"); | 334 return willBeRemoved("The <keygen> element", 56, "5716060992962560"); |
350 | 335 |
351 case UseCounter::WindowPostMessageWithLegacyTargetOriginArgument: | |
352 return replacedWillBeRemoved("'window.postMessage(message, transferables
, targetOrigin)'", "'window.postMessage(message, targetOrigin, transferables)'",
54, "5719033043222528"); | |
353 | |
354 case UseCounter::EncryptedMediaAllSelectedContentTypesMissingCodecs: | 336 case UseCounter::EncryptedMediaAllSelectedContentTypesMissingCodecs: |
355 return String::format("EME requires that contentType strings accepted by
requestMediaKeySystemAccess() include codecs. Non-standard support for contentT
ype strings without codecs will be removed in %s. Please specify the desired cod
ec(s) as part of the contentType.", milestoneString(54)); | 337 return String::format("EME requires that contentType strings accepted by
requestMediaKeySystemAccess() include codecs. Non-standard support for contentT
ype strings without codecs will be removed in %s. Please specify the desired cod
ec(s) as part of the contentType.", milestoneString(54)); |
356 | 338 |
357 case UseCounter::UntrustedEventDefaultHandled: | 339 case UseCounter::UntrustedEventDefaultHandled: |
358 return String::format("A DOM event generated from JavaScript has trigger
ed a default action inside the browser. This behavior is non-standard and will b
e removed in %s. See https://www.chromestatus.com/features/5718803933560832 for
more details.", milestoneString(53)); | 340 return String::format("A DOM event generated from JavaScript has trigger
ed a default action inside the browser. This behavior is non-standard and will b
e removed in %s. See https://www.chromestatus.com/features/5718803933560832 for
more details.", milestoneString(53)); |
359 | 341 |
360 case UseCounter::TouchStartUserGestureUtilized: | 342 case UseCounter::TouchStartUserGestureUtilized: |
361 return willBeRemoved("Performing operations that require explicit user i
nteraction on touchstart events", 55, "5649871251963904"); | 343 return willBeRemoved("Performing operations that require explicit user i
nteraction on touchstart events", 55, "5649871251963904"); |
362 | 344 |
363 case UseCounter::TouchMoveUserGestureUtilized: | 345 case UseCounter::TouchMoveUserGestureUtilized: |
(...skipping 17 matching lines...) Expand all Loading... |
381 case UseCounter::NavigatorPointerEnabled: | 363 case UseCounter::NavigatorPointerEnabled: |
382 return "Navigator.pointerEnabled is a non-standard API added for experim
ents only. It will be removed in near future."; | 364 return "Navigator.pointerEnabled is a non-standard API added for experim
ents only. It will be removed in near future."; |
383 | 365 |
384 // Features that aren't deprecated don't have a deprecation message. | 366 // Features that aren't deprecated don't have a deprecation message. |
385 default: | 367 default: |
386 return String(); | 368 return String(); |
387 } | 369 } |
388 } | 370 } |
389 | 371 |
390 } // namespace blink | 372 } // namespace blink |
OLD | NEW |