Bug 667618. Prevent mismatches between our enum and our strings. r=sicking

This commit is contained in:
Boris Zbarsky 2011-06-28 21:05:34 -04:00
Родитель 5e00074f21
Коммит 32ffe92855
5 изменённых файлов: 83 добавлений и 64 удалений

Просмотреть файл

@ -54,6 +54,7 @@ nsContentErrors.h \
nsContentPolicyUtils.h \
nsContentUtils.h \
nsIDocument.h \
nsDeprecatedOperationList.h \
nsIDocumentObserver.h \
nsIMutationObserver.h \
nsIMutationObserver2.h \

Просмотреть файл

@ -0,0 +1,72 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2011
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/*
* This file contains the list of deprecated DOM operations. It is
* designed to be used as input to the C preprocessor *only*.
*/
DEPRECATED_OPERATION(GetAttributeNode)
DEPRECATED_OPERATION(SetAttributeNode)
DEPRECATED_OPERATION(GetAttributeNodeNS)
DEPRECATED_OPERATION(SetAttributeNodeNS)
DEPRECATED_OPERATION(RemoveAttributeNode)
DEPRECATED_OPERATION(CreateAttribute)
DEPRECATED_OPERATION(CreateAttributeNS)
DEPRECATED_OPERATION(Specified)
DEPRECATED_OPERATION(OwnerElement)
DEPRECATED_OPERATION(NodeName)
DEPRECATED_OPERATION(NodeValue)
DEPRECATED_OPERATION(NodeType)
DEPRECATED_OPERATION(ParentNode)
DEPRECATED_OPERATION(ChildNodes)
DEPRECATED_OPERATION(HasChildNodes)
DEPRECATED_OPERATION(HasAttributes)
DEPRECATED_OPERATION(FirstChild)
DEPRECATED_OPERATION(LastChild)
DEPRECATED_OPERATION(PreviousSibling)
DEPRECATED_OPERATION(NextSibling)
DEPRECATED_OPERATION(Attributes)
DEPRECATED_OPERATION(InsertBefore)
DEPRECATED_OPERATION(ReplaceChild)
DEPRECATED_OPERATION(RemoveChild)
DEPRECATED_OPERATION(AppendChild)
DEPRECATED_OPERATION(CloneNode)
DEPRECATED_OPERATION(OwnerDocument)
DEPRECATED_OPERATION(Normalize)
DEPRECATED_OPERATION(IsSupported)
DEPRECATED_OPERATION(IsEqualNode)
DEPRECATED_OPERATION(TextContent)

Просмотреть файл

@ -1526,39 +1526,11 @@ public:
virtual Element* FindImageMap(const nsAString& aNormalizedMapName) = 0;
#define DEPRECATED_OPERATION(_op) e##_op,
enum DeprecatedOperations {
eGetAttributeNode = 0,
eSetAttributeNode,
eGetAttributeNodeNS,
eSetAttributeNodeNS,
eRemoveAttributeNode,
eCreateAttribute,
eCreateAttributeNS,
eSpecified,
eOwnerElement,
eNodeName,
eNodeValue,
eNodeType,
eParentNode,
eChildNodes,
eHasChildNodes,
eHasAttributes,
eFirstChild,
eLastChild,
ePreviousSibling,
eNextSibling,
eAttributes,
eInsertBefore,
eReplaceChild,
eRemoveChild,
eAppendChild,
eCloneNode,
eOwnerDocument,
eNormalize,
eIsSupported,
eIsEqualNode,
eTextContent
#include "nsDeprecatedOperationList.h"
};
#undef DEPRECATED_OPERATION
void WarnOnceAbout(DeprecatedOperations aOperation);
private:

Просмотреть файл

@ -8130,38 +8130,11 @@ nsDocument::FindImageMap(const nsAString& aUseMapValue)
return nsnull;
}
#define DEPRECATED_OPERATION(_op) #_op "Warning",
static const char* kWarnings[] = {
"GetAttributeNodeWarning",
"SetAttributeNodeWarning",
"GetAttributeNodeNSWarning",
"SetAttributeNodeNSWarning",
"RemoveAttributeNodeWarning",
"CreateAttributeWarning",
"CreateAttributeNSWarning",
"SpecifiedWarning",
"OwnerElementWarning",
"NodeNameWarning",
"NodeValueWarning",
"NodeTypeWarning",
"ParentNodeWarning",
"ChildNodesWarning",
"HasChildNodesWarning",
"HasAttributesWarning",
"FirstChildWarning",
"LastChildWarning",
"PreviousSiblingWarning",
"NextSiblingWarning",
"AttributesWarning",
"InsertBeforeWarning",
"ReplaceChildWarning",
"RemoveChildWarning",
"AppendChildWarning",
"CloneNodeWarning",
"GetOwnerDocumentWarning",
"IsSupportedWarning",
"IsEqualNodeWarning",
"TextContentWarning"
#include "nsDeprecatedOperationList.h"
};
#undef DEPRECATED_OPERATION
void
nsIDocument::WarnOnceAbout(DeprecatedOperations aOperation)

Просмотреть файл

@ -81,8 +81,8 @@ SetAttributeNodeWarning=Use of setAttributeNode() is deprecated. Use setAttribut
GetAttributeNodeNSWarning=Use of getAttributeNodeNS() is deprecated. Use getAttributeNS() instead.
SetAttributeNodeNSWarning=Use of setAttributeNodeNS() is deprecated. Use setAttributeNS() instead.
RemoveAttributeNodeWarning=Use of removeAttributeNode() is deprecated. Use removeAttribute() instead.
CreateAttribute=Use of document.createAttribute() is deprecated. Use element.setAttribute() instead.
CreateAttributeNS=Use of document.createAttributeNS() is deprecated. Use element.setAttributeNS() instead.
CreateAttributeWarning=Use of document.createAttribute() is deprecated. Use element.setAttribute() instead.
CreateAttributeNSWarning=Use of document.createAttributeNS() is deprecated. Use element.setAttributeNS() instead.
SpecifiedWarning=Use of attributes' specified attribute is deprecated. It always returns true.
OwnerElementWarning=Use of attributes' ownerElement attribute is deprecated.
NodeNameWarning=Use of attributes' nodeName attribute is deprecated. Use name instead.
@ -102,7 +102,8 @@ ReplaceChildWarning=Use of attributes' replaceChild() is deprecated. Use value i
RemoveChildWarning=Use of attributes' removeChild() is deprecated. Use value instead.
AppendChildWarning=Use of attributes' appendChild() is deprecated. Use value instead.
CloneNodeWarning=Use of attributes' cloneNode() is deprecated.
GetOwnerDocumentWarning=Use of attributes' ownerDocument attribute is deprecated.
OwnerDocumentWarning=Use of attributes' ownerDocument attribute is deprecated.
NormalizeWarning=Use of attributes' normalize() is deprecated.
IsSupportedWarning=Use of attributes' isSupported() is deprecated.
IsEqualNodeWarning=Use of attributes' isEqualNode() is deprecated.
TextContentWarning=Use of attributes' textContent attribute is deprecated. Use value instead.