Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright (C) 2012 Google, Inc. All rights reserved. | 3 * Copyright (C) 2012 Google, Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 657 UseCounter::countDeprecation(document.frame(), feature); | 657 UseCounter::countDeprecation(document.frame(), feature); |
| 658 } | 658 } |
| 659 | 659 |
| 660 void UseCounter::countDeprecationIfNotPrivateScript(v8::Isolate* isolate, Execut ionContext* context, Feature feature) | 660 void UseCounter::countDeprecationIfNotPrivateScript(v8::Isolate* isolate, Execut ionContext* context, Feature feature) |
| 661 { | 661 { |
| 662 if (DOMWrapperWorld::current(isolate).isPrivateScriptIsolatedWorld()) | 662 if (DOMWrapperWorld::current(isolate).isPrivateScriptIsolatedWorld()) |
| 663 return; | 663 return; |
| 664 UseCounter::countDeprecation(context, feature); | 664 UseCounter::countDeprecation(context, feature); |
| 665 } | 665 } |
| 666 | 666 |
| 667 // FIXME: Update other UseCounter::deprecationMessage() cases to use this. | 667 // FIXME: Update other UseCounter::deprecationMessage() cases to use this. |
|
Julien - ping for review
2014/11/18 00:24:33
Shouldn't this be removed?
| |
| 668 static String replacedBy(const char* oldString, const char* newString) | 668 static String replacedBy(const char* oldString, const char* newString, bool useA postrophe = true) |
|
Julien - ping for review
2014/11/18 00:24:32
Booleans are not a good idea in a function's signa
| |
| 669 { | 669 { |
| 670 return String::format("'%s' is deprecated. Please use '%s' instead.", oldStr ing, newString); | 670 if (useApostrophe) |
| 671 return String::format("'%s' is deprecated. Please use '%s' instead.", ol dString, newString); | |
| 672 | |
| 673 return String::format("%s is deprecated. Please use %s instead.", oldString, newString); | |
| 671 } | 674 } |
| 672 | 675 |
| 673 String UseCounter::deprecationMessage(Feature feature) | 676 String UseCounter::deprecationMessage(Feature feature) |
| 674 { | 677 { |
| 675 switch (feature) { | 678 switch (feature) { |
| 676 // Quota | 679 // Quota |
| 677 case PrefixedStorageInfo: | 680 case PrefixedStorageInfo: |
| 678 return "'window.webkitStorageInfo' is deprecated. Please use 'navigator. webkitTemporaryStorage' or 'navigator.webkitPersistentStorage' instead."; | 681 return replacedBy("window.webkitStorageInfo", "navigator.webkitTemporary Storage' or 'navigator.webkitPersistentStorage"); |
|
Julien - ping for review
2014/11/18 00:24:32
This call is just magical. If you don't know what
| |
| 679 | 682 |
| 680 // Keyboard Event (DOM Level 3) | 683 // Keyboard Event (DOM Level 3) |
| 681 case KeyboardEventKeyLocation: | 684 case KeyboardEventKeyLocation: |
| 682 return replacedBy("KeyboardEvent.keyLocation", "KeyboardEvent.location") ; | 685 return replacedBy("KeyboardEvent.keyLocation", "KeyboardEvent.location") ; |
| 683 | 686 |
| 684 case ConsoleMarkTimeline: | 687 case ConsoleMarkTimeline: |
| 685 return "console.markTimeline is deprecated. Please use the console.timeS tamp instead."; | 688 return replacedBy("console.markTimeline", "the console.timeStamp", false ); |
| 686 | 689 |
| 687 case FileError: | 690 case FileError: |
| 688 return "FileError is deprecated. Please use the 'name' or 'message' attr ibutes of DOMError rather than 'code'."; | 691 return "FileError is deprecated. Please use the 'name' or 'message' attr ibutes of DOMError rather than 'code'."; |
| 689 | 692 |
| 690 case ShowModalDialog: | 693 case ShowModalDialog: |
| 691 return "showModalDialog is deprecated. Please use window.open and postMe ssage instead."; | 694 return replacedBy("showModalDialog", "window.open and postMessage"); |
| 692 | 695 |
| 693 case CSSStyleSheetInsertRuleOptionalArg: | 696 case CSSStyleSheetInsertRuleOptionalArg: |
| 694 return "Calling CSSStyleSheet.insertRule() with one argument is deprecat ed. Please pass the index argument as well: insertRule(x, 0)."; | 697 return "Calling CSSStyleSheet.insertRule() with one argument is deprecat ed. Please pass the index argument as well: insertRule(x, 0)."; |
| 695 | 698 |
| 696 case PrefixedVideoSupportsFullscreen: | 699 case PrefixedVideoSupportsFullscreen: |
| 697 return "'HTMLVideoElement.webkitSupportsFullscreen' is deprecated. Its v alue is true if the video is loaded."; | 700 return "'HTMLVideoElement.webkitSupportsFullscreen' is deprecated. Its v alue is true if the video is loaded."; |
| 698 | 701 |
| 699 case PrefixedVideoDisplayingFullscreen: | 702 case PrefixedVideoDisplayingFullscreen: |
| 700 return "'HTMLVideoElement.webkitDisplayingFullscreen' is deprecated. Ple ase use the 'fullscreenchange' and 'webkitfullscreenchange' events instead."; | 703 return replacedBy("'HTMLVideoElement.webkitDisplayingFullscreen'", "the 'fullscreenchange' and 'webkitfullscreenchange' events", false); |
|
Julien - ping for review
2014/11/18 00:24:33
I think your mistake here is to assume that we *ha
| |
| 701 | 704 |
| 702 case PrefixedVideoEnterFullscreen: | 705 case PrefixedVideoEnterFullscreen: |
| 703 return "'HTMLVideoElement.webkitEnterFullscreen()' is deprecated. Please use 'Element.requestFullscreen()' and 'Element.webkitRequestFullscreen()' inste ad."; | 706 return replacedBy("HTMLVideoElement.webkitEnterFullscreen()", "Element.r equestFullscreen()' and 'Element.webkitRequestFullscreen()"); |
| 704 | 707 |
| 705 case PrefixedVideoExitFullscreen: | 708 case PrefixedVideoExitFullscreen: |
| 706 return "'HTMLVideoElement.webkitExitFullscreen()' is deprecated. Please use 'Document.exitFullscreen()' and 'Document.webkitExitFullscreen()' instead."; | 709 return replacedBy("HTMLVideoElement.webkitExitFullscreen()", "Document.e xitFullscreen()' and 'Document.webkitExitFullscreen()"); |
| 707 | 710 |
| 708 case PrefixedVideoEnterFullScreen: | 711 case PrefixedVideoEnterFullScreen: |
| 709 return "'HTMLVideoElement.webkitEnterFullScreen()' is deprecated. Please use 'Element.requestFullscreen()' and 'Element.webkitRequestFullscreen()' inste ad."; | 712 return replacedBy("HTMLVideoElement.webkitEnterFullScreen()", "Element.r equestFullscreen()' and 'Element.webkitRequestFullscreen()"); |
| 710 | 713 |
| 711 case PrefixedVideoExitFullScreen: | 714 case PrefixedVideoExitFullScreen: |
| 712 return "'HTMLVideoElement.webkitExitFullScreen()' is deprecated. Please use 'Document.exitFullscreen()' and 'Document.webkitExitFullscreen()' instead."; | 715 return replacedBy("HTMLVideoElement.webkitExitFullScreen()", "Document.e xitFullscreen()' and 'Document.webkitExitFullscreen()"); |
| 713 | 716 |
| 714 case MediaErrorEncrypted: | 717 case MediaErrorEncrypted: |
| 715 return "'MediaError.MEDIA_ERR_ENCRYPTED' is deprecated. This error code is never used."; | 718 return "'MediaError.MEDIA_ERR_ENCRYPTED' is deprecated. This error code is never used."; |
| 716 | 719 |
| 717 case PrefixedGamepad: | 720 case PrefixedGamepad: |
| 718 return replacedBy("navigator.webkitGetGamepads", "navigator.getGamepads" ); | 721 return replacedBy("navigator.webkitGetGamepads", "navigator.getGamepads" ); |
| 719 | 722 |
| 720 case PrefixedIndexedDB: | 723 case PrefixedIndexedDB: |
| 721 return replacedBy("webkitIndexedDB", "indexedDB"); | 724 return replacedBy("webkitIndexedDB", "indexedDB"); |
| 722 | 725 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 780 case RangeDetach: | 783 case RangeDetach: |
| 781 return "'Range.detach' is now a no-op, as per DOM (http://dom.spec.whatw g.org/#dom-range-detach)."; | 784 return "'Range.detach' is now a no-op, as per DOM (http://dom.spec.whatw g.org/#dom-range-detach)."; |
| 782 | 785 |
| 783 case OverflowChangedEvent: | 786 case OverflowChangedEvent: |
| 784 return "The 'overflowchanged' event is deprecated and may be removed. Pl ease do not use it."; | 787 return "The 'overflowchanged' event is deprecated and may be removed. Pl ease do not use it."; |
| 785 | 788 |
| 786 case SyncXHRWithCredentials: | 789 case SyncXHRWithCredentials: |
| 787 return "Setting 'XMLHttpRequest.withCredentials' for synchronous request s is deprecated."; | 790 return "Setting 'XMLHttpRequest.withCredentials' for synchronous request s is deprecated."; |
| 788 | 791 |
| 789 case EventSourceURL: | 792 case EventSourceURL: |
| 790 return "'EventSource.URL' is deprecated. Please use 'EventSource.url' in stead."; | 793 return replacedBy("EventSource.URL", "EventSource.url"); |
| 791 | 794 |
| 792 case WebSocketURL: | 795 case WebSocketURL: |
| 793 return "'WebSocket.URL' is deprecated. Please use 'WebSocket.url' instea d."; | 796 return replacedBy("WebSocket.URL", "WebSocket.url"); |
| 794 | 797 |
| 795 case HTMLTableElementVspace: | 798 case HTMLTableElementVspace: |
| 796 return "The 'vspace' attribute on table is deprecated. Please use CSS in stead."; | 799 return replacedBy("The 'vspace' attribute on table", "CSS", false); |
|
Julien - ping for review
2014/11/18 00:24:32
This should be moved to a more useful suggestion:
| |
| 797 | 800 |
| 798 case HTMLTableElementHspace: | 801 case HTMLTableElementHspace: |
| 799 return "The 'hspace' attribute on table is deprecated. Please use CSS in stead."; | 802 return replacedBy("The 'hspace' attribute on table", "CSS", false); |
|
Julien - ping for review
2014/11/18 00:24:33
Same comment here: margin-left and margin-right
| |
| 800 | 803 |
| 801 case PictureSourceSrc: | 804 case PictureSourceSrc: |
| 802 return "<source src> with a <picture> parent is invalid and therefore ig nored. Please use <source srcset> instead."; | 805 return "<source src> with a <picture> parent is invalid and therefore ig nored. Please use <source srcset> instead."; |
| 803 | 806 |
| 804 case XHRProgressEventPosition: | 807 case XHRProgressEventPosition: |
| 805 return "The XMLHttpRequest progress event property 'position' is depreca ted. Please use 'loaded' instead."; | 808 return replacedBy("The XMLHttpRequest progress event property 'position' ", "'loaded'", false); |
| 806 | 809 |
| 807 case XHRProgressEventTotalSize: | 810 case XHRProgressEventTotalSize: |
| 808 return "The XMLHttpRequest progress event property 'totalSize' is deprec ated. Please use 'total' instead."; | 811 return replacedBy("The XMLHttpRequest progress event property 'totalSize '", "'total'", false); |
| 809 | 812 |
| 810 case ConsoleTimeline: | 813 case ConsoleTimeline: |
| 811 return "console.timeline is deprecated. Please use the console.time inst ead."; | 814 return replacedBy("console.timeline", "the console.time", false); |
| 812 | 815 |
| 813 case ConsoleTimelineEnd: | 816 case ConsoleTimelineEnd: |
| 814 return "console.timelineEnd is deprecated. Please use the console.timeEn d instead."; | 817 return replacedBy("console.timelineEnd", "the console.timeEnd", false); |
| 815 | 818 |
| 816 case XMLHttpRequestSynchronousInNonWorkerOutsideBeforeUnload: | 819 case XMLHttpRequestSynchronousInNonWorkerOutsideBeforeUnload: |
| 817 return "Synchronous XMLHttpRequest on the main thread is deprecated beca use of its detrimental effects to the end user's experience. For more help, chec k http://xhr.spec.whatwg.org/."; | 820 return "Synchronous XMLHttpRequest on the main thread is deprecated beca use of its detrimental effects to the end user's experience. For more help, chec k http://xhr.spec.whatwg.org/."; |
| 818 | 821 |
| 819 case FontFaceSetReady: | 822 case FontFaceSetReady: |
| 820 return "document.fonts.ready() method is going to be replaced with docum ent.fonts.ready attribute in future releases. Please be prepared. For more help, check https://code.google.com/p/chromium/issues/detail?id=392077#c3 ."; | 823 return "document.fonts.ready() method is going to be replaced with docum ent.fonts.ready attribute in future releases. Please be prepared. For more help, check https://code.google.com/p/chromium/issues/detail?id=392077#c3 ."; |
| 821 | 824 |
| 822 // Features that aren't deprecated don't have a deprecation message. | 825 // Features that aren't deprecated don't have a deprecation message. |
| 823 default: | 826 default: |
| 824 return String(); | 827 return String(); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 860 UseCounter* UseCounter::getFrom(const StyleSheetContents* sheetContents) | 863 UseCounter* UseCounter::getFrom(const StyleSheetContents* sheetContents) |
| 861 { | 864 { |
| 862 // FIXME: We may want to handle stylesheets that have multiple owners | 865 // FIXME: We may want to handle stylesheets that have multiple owners |
| 863 // http://crbug.com/242125 | 866 // http://crbug.com/242125 |
| 864 if (sheetContents && sheetContents->hasSingleOwnerNode()) | 867 if (sheetContents && sheetContents->hasSingleOwnerNode()) |
| 865 return getFrom(sheetContents->singleOwnerDocument()); | 868 return getFrom(sheetContents->singleOwnerDocument()); |
| 866 return 0; | 869 return 0; |
| 867 } | 870 } |
| 868 | 871 |
| 869 } // namespace blink | 872 } // namespace blink |
| OLD | NEW |