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 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
631 LocalFrame* frame = document.frame(); | 631 LocalFrame* frame = document.frame(); |
632 if (!host || !frame) | 632 if (!host || !frame) |
633 return; | 633 return; |
634 | 634 |
635 if (host->useCounter().recordMeasurement(feature)) { | 635 if (host->useCounter().recordMeasurement(feature)) { |
636 ASSERT(!host->useCounter().deprecationMessage(feature).isEmpty()); | 636 ASSERT(!host->useCounter().deprecationMessage(feature).isEmpty()); |
637 frame->console().addMessage(DeprecationMessageSource, WarningMessageLeve
l, host->useCounter().deprecationMessage(feature)); | 637 frame->console().addMessage(DeprecationMessageSource, WarningMessageLeve
l, host->useCounter().deprecationMessage(feature)); |
638 } | 638 } |
639 } | 639 } |
640 | 640 |
| 641 // FIXME: Update other UseCounter::deprecationMessage() cases to use this. |
| 642 static String replacedBy(const char* oldString, const char* newString) |
| 643 { |
| 644 return String::format("'%s' is deprecated. Please use '%s' instead.", oldStr
ing, newString); |
| 645 } |
| 646 |
641 String UseCounter::deprecationMessage(Feature feature) | 647 String UseCounter::deprecationMessage(Feature feature) |
642 { | 648 { |
643 switch (feature) { | 649 switch (feature) { |
644 // Quota | 650 // Quota |
645 case PrefixedStorageInfo: | 651 case PrefixedStorageInfo: |
646 return "'window.webkitStorageInfo' is deprecated. Please use 'navigator.
webkitTemporaryStorage' or 'navigator.webkitPersistentStorage' instead."; | 652 return "'window.webkitStorageInfo' is deprecated. Please use 'navigator.
webkitTemporaryStorage' or 'navigator.webkitPersistentStorage' instead."; |
647 | 653 |
648 // Keyboard Event (DOM Level 3) | 654 // Keyboard Event (DOM Level 3) |
649 case KeyboardEventKeyLocation: | 655 case KeyboardEventKeyLocation: |
650 return "'KeyboardEvent.keyLocation' is deprecated. Please use 'KeyboardE
vent.location' instead."; | 656 return replacedBy("KeyboardEvent.keyLocation", "KeyboardEvent.location")
; |
651 | 657 |
652 case ConsoleMarkTimeline: | 658 case ConsoleMarkTimeline: |
653 return "console.markTimeline is deprecated. Please use the console.timeS
tamp instead."; | 659 return "console.markTimeline is deprecated. Please use the console.timeS
tamp instead."; |
654 | 660 |
655 case FileError: | 661 case FileError: |
656 return "FileError is deprecated. Please use the 'name' or 'message' attr
ibutes of DOMError rather than 'code'."; | 662 return "FileError is deprecated. Please use the 'name' or 'message' attr
ibutes of DOMError rather than 'code'."; |
657 | 663 |
658 case ShowModalDialog: | 664 case ShowModalDialog: |
659 return "showModalDialog is deprecated. Please use window.open and postMe
ssage instead."; | 665 return "showModalDialog is deprecated. Please use window.open and postMe
ssage instead."; |
660 | 666 |
(...skipping 15 matching lines...) Expand all Loading... |
676 case PrefixedVideoEnterFullScreen: | 682 case PrefixedVideoEnterFullScreen: |
677 return "'HTMLVideoElement.webkitEnterFullScreen()' is deprecated. Please
use 'Element.requestFullscreen()' and 'Element.webkitRequestFullscreen()' inste
ad."; | 683 return "'HTMLVideoElement.webkitEnterFullScreen()' is deprecated. Please
use 'Element.requestFullscreen()' and 'Element.webkitRequestFullscreen()' inste
ad."; |
678 | 684 |
679 case PrefixedVideoExitFullScreen: | 685 case PrefixedVideoExitFullScreen: |
680 return "'HTMLVideoElement.webkitExitFullScreen()' is deprecated. Please
use 'Document.exitFullscreen()' and 'Document.webkitExitFullscreen()' instead."; | 686 return "'HTMLVideoElement.webkitExitFullScreen()' is deprecated. Please
use 'Document.exitFullscreen()' and 'Document.webkitExitFullscreen()' instead."; |
681 | 687 |
682 case MediaErrorEncrypted: | 688 case MediaErrorEncrypted: |
683 return "'MediaError.MEDIA_ERR_ENCRYPTED' is deprecated. This error code
is never used."; | 689 return "'MediaError.MEDIA_ERR_ENCRYPTED' is deprecated. This error code
is never used."; |
684 | 690 |
685 case PrefixedGamepad: | 691 case PrefixedGamepad: |
686 return "'navigator.webkitGetGamepads' is deprecated. Please use 'navigat
or.getGamepads' instead."; | 692 return replacedBy("navigator.webkitGetGamepads", "navigator.getGamepads"
); |
| 693 |
| 694 case PrefixedIndexedDB: |
| 695 return replacedBy("webkitIndexedDB", "indexedDB"); |
| 696 |
| 697 case PrefixedIDBCursorConstructor: |
| 698 return replacedBy("webkitIDBCursor", "IDBCursor"); |
| 699 |
| 700 case PrefixedIDBDatabaseConstructor: |
| 701 return replacedBy("webkitIDBDatabase", "IDBDatabase"); |
| 702 |
| 703 case PrefixedIDBFactoryConstructor: |
| 704 return replacedBy("webkitIDBFactory", "IDBFactory"); |
| 705 |
| 706 case PrefixedIDBIndexConstructor: |
| 707 return replacedBy("webkitIDBIndex", "IDBIndex"); |
| 708 |
| 709 case PrefixedIDBKeyRangeConstructor: |
| 710 return replacedBy("webkitIDBKeyRange", "IDBKeyRange"); |
| 711 |
| 712 case PrefixedIDBObjectStoreConstructor: |
| 713 return replacedBy("webkitIDBObjectStore", "IDBObjectStore"); |
| 714 |
| 715 case PrefixedIDBRequestConstructor: |
| 716 return replacedBy("webkitIDBRequest", "IDBRequest"); |
| 717 |
| 718 case PrefixedIDBTransactionConstructor: |
| 719 return replacedBy("webkitIDBTransaction", "IDBTransaction"); |
687 | 720 |
688 case PrefixedRequestAnimationFrame: | 721 case PrefixedRequestAnimationFrame: |
689 return "'webkitRequestAnimationFrame' is vendor-specific. Please use the
standard 'requestAnimationFrame' instead."; | 722 return "'webkitRequestAnimationFrame' is vendor-specific. Please use the
standard 'requestAnimationFrame' instead."; |
690 | 723 |
691 case PrefixedCancelAnimationFrame: | 724 case PrefixedCancelAnimationFrame: |
692 return "'webkitCancelAnimationFrame' is vendor-specific. Please use the
standard 'cancelAnimationFrame' instead."; | 725 return "'webkitCancelAnimationFrame' is vendor-specific. Please use the
standard 'cancelAnimationFrame' instead."; |
693 | 726 |
694 case PrefixedCancelRequestAnimationFrame: | 727 case PrefixedCancelRequestAnimationFrame: |
695 return "'webkitCancelRequestAnimationFrame' is vendor-specific. Please u
se the standard 'cancelAnimationFrame' instead."; | 728 return "'webkitCancelRequestAnimationFrame' is vendor-specific. Please u
se the standard 'cancelAnimationFrame' instead."; |
696 | 729 |
697 case DocumentCreateAttributeNS: | 730 case DocumentCreateAttributeNS: |
698 return "'Document.createAttributeNS' is deprecated and has been removed
from DOM4 (http://w3.org/tr/dom)."; | 731 return "'Document.createAttributeNS' is deprecated and has been removed
from DOM4 (http://w3.org/tr/dom)."; |
699 | 732 |
700 case AttributeOwnerElement: | 733 case AttributeOwnerElement: |
701 return "'Attr.ownerElement' is deprecated and has been removed from DOM4
(http://w3.org/tr/dom)."; | 734 return "'Attr.ownerElement' is deprecated and has been removed from DOM4
(http://w3.org/tr/dom)."; |
702 | 735 |
703 case ElementSetAttributeNodeNS: | 736 case ElementSetAttributeNodeNS: |
704 return "'Element.setAttributeNodeNS' is deprecated and has been removed
from DOM4 (http://w3.org/tr/dom)."; | 737 return "'Element.setAttributeNodeNS' is deprecated and has been removed
from DOM4 (http://w3.org/tr/dom)."; |
705 | 738 |
706 case NodeIteratorDetach: | 739 case NodeIteratorDetach: |
707 return "'NodeIterator.detach' is now a no-op, as per DOM (http://dom.spe
c.whatwg.org/#dom-nodeiterator-detach)."; | 740 return "'NodeIterator.detach' is now a no-op, as per DOM (http://dom.spe
c.whatwg.org/#dom-nodeiterator-detach)."; |
708 | 741 |
709 case AttrNodeValue: | 742 case AttrNodeValue: |
710 return "'Attr.nodeValue' is deprecated. Please use 'value' instead."; | 743 return replacedBy("Attr.nodeValue", "value"); |
711 | 744 |
712 case AttrTextContent: | 745 case AttrTextContent: |
713 return "'Attr.textContent' is deprecated. Please use 'value' instead."; | 746 return replacedBy("Attr.textContent", "value"); |
714 | 747 |
715 case NodeIteratorExpandEntityReferences: | 748 case NodeIteratorExpandEntityReferences: |
716 return "'NodeIterator.expandEntityReferences' is deprecated and has been
removed from DOM. It always returns false."; | 749 return "'NodeIterator.expandEntityReferences' is deprecated and has been
removed from DOM. It always returns false."; |
717 | 750 |
718 case TreeWalkerExpandEntityReferences: | 751 case TreeWalkerExpandEntityReferences: |
719 return "'TreeWalker.expandEntityReferences' is deprecated and has been r
emoved from DOM. It always returns false."; | 752 return "'TreeWalker.expandEntityReferences' is deprecated and has been r
emoved from DOM. It always returns false."; |
720 | 753 |
721 case RangeDetach: | 754 case RangeDetach: |
722 return "'Range.detach' is now a no-op, as per DOM (http://dom.spec.whatw
g.org/#dom-range-detach)."; | 755 return "'Range.detach' is now a no-op, as per DOM (http://dom.spec.whatw
g.org/#dom-range-detach)."; |
723 | 756 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
778 UseCounter* UseCounter::getFrom(const StyleSheetContents* sheetContents) | 811 UseCounter* UseCounter::getFrom(const StyleSheetContents* sheetContents) |
779 { | 812 { |
780 // FIXME: We may want to handle stylesheets that have multiple owners | 813 // FIXME: We may want to handle stylesheets that have multiple owners |
781 // http://crbug.com/242125 | 814 // http://crbug.com/242125 |
782 if (sheetContents && sheetContents->hasSingleOwnerNode()) | 815 if (sheetContents && sheetContents->hasSingleOwnerNode()) |
783 return getFrom(sheetContents->singleOwnerDocument()); | 816 return getFrom(sheetContents->singleOwnerDocument()); |
784 return 0; | 817 return 0; |
785 } | 818 } |
786 | 819 |
787 } // namespace blink | 820 } // namespace blink |
OLD | NEW |