Bug 1148496 - Allow to set an interface member as [Deprecated] in WebIDL. r=bz,smaug

This commit is contained in:
Paul Adenot 2015-04-14 17:03:49 +02:00
parent 18e48af44e
commit 0a319b6e65
6 changed files with 84 additions and 0 deletions

View File

@ -6662,6 +6662,22 @@ class CGPerSignatureCall(CGThing):
return false;
}
""")))
if idlNode.getExtendedAttribute("Deprecated"):
cgThings.append(CGGeneric(dedent(
"""
{
GlobalObject global(cx, obj);
if (global.Failed()) {
return false;
}
nsCOMPtr<nsPIDOMWindow> pWindow = do_QueryInterface(global.GetAsSupports());
if (pWindow && pWindow->GetExtantDoc()) {
pWindow->GetExtantDoc()->WarnOnceAbout(nsIDocument::e%s);
}
}
""" % idlNode.getExtendedAttribute("Deprecated")[0])))
lenientFloatCode = None
if idlNode.getExtendedAttribute('LenientFloat') is not None:
if setter:
@ -12405,6 +12421,12 @@ class CGBindingRoot(CGThing):
iface = desc.interface
return any(m.getExtendedAttribute("Pref") for m in iface.members + [iface])
def descriptorDeprecated(desc):
iface = desc.interface
return any(m.getExtendedAttribute("Deprecated") for m in iface.members + [iface])
bindingHeaders["nsIDocument.h"] = any(
descriptorDeprecated(d) for d in descriptors)
bindingHeaders["mozilla/Preferences.h"] = any(
descriptorRequiresPreferences(d) for d in descriptors)
bindingHeaders["mozilla/dom/DOMJSProxyHandler.h"] = any(

View File

@ -3504,6 +3504,7 @@ class IDLAttribute(IDLInterfaceMember):
[attr.location, self.location])
self._setDependsOn(attr.value())
elif (identifier == "Pref" or
identifier == "Deprecated" or
identifier == "SetterThrows" or
identifier == "Throws" or
identifier == "GetterThrows" or
@ -4139,6 +4140,7 @@ class IDLMethod(IDLInterfaceMember, IDLScope):
identifier == "ChromeOnly" or
identifier == "UnsafeInPrerendering" or
identifier == "Pref" or
identifier == "Deprecated" or
identifier == "Func" or
identifier == "AvailableIn" or
identifier == "CheckPermissions" or

View File

@ -737,12 +737,24 @@ public:
already_AddRefed<TestInterface> ExerciseTypedefInterfaces2(TestInterface*);
void ExerciseTypedefInterfaces3(TestInterface&);
// Deprecated methods and attributes
int8_t DeprecatedAttribute();
int8_t SetDeprecatedAttribute(int8_t);
int8_t DeprecatedMethod();
int8_t DeprecatedMethodWithContext(JSContext*, JS::Value);
// Static methods and attributes
static void StaticMethod(const GlobalObject&, bool);
static void StaticMethodWithContext(const GlobalObject&, JS::Value);
static bool StaticAttribute(const GlobalObject&);
static void SetStaticAttribute(const GlobalObject&, bool);
// Deprecated static methods and attributes
static int8_t StaticDeprecatedAttribute(const GlobalObject&);
static int8_t SetStaticDeprecatedAttribute(const GlobalObject&, int8_t);
static int8_t StaticDeprecatedMethod(const GlobalObject&);
static int8_t StaticDeprecatedMethodWithContext(const GlobalObject&, JS::Value);
// Overload resolution tests
bool Overload1(TestInterface&);
TestInterface* Overload1(const nsAString&, TestInterface&);

View File

@ -725,11 +725,27 @@ interface TestInterface {
AnotherNameForTestInterface exerciseTypedefInterfaces2(NullableTestInterface arg);
void exerciseTypedefInterfaces3(YetAnotherNameForTestInterface arg);
// Deprecated methods and attributes
[Deprecated="GetAttributeNode"]
attribute byte deprecatedAttribute;
[Deprecated="GetAttributeNode"]
byte deprecatedMethod();
[Deprecated="GetAttributeNode"]
byte deprecatedMethodWithContext(any arg);
// Static methods and attributes
static attribute boolean staticAttribute;
static void staticMethod(boolean arg);
static void staticMethodWithContext(any arg);
// Deprecated static methods and attributes
[Deprecated="GetAttributeNode"]
static attribute byte staticDeprecatedAttribute;
[Deprecated="GetAttributeNode"]
static void staticDeprecatedMethod();
[Deprecated="GetAttributeNode"]
static void staticDeprecatedMethodWithContext(any arg);
// Overload resolution tests
//void overload1(DOMString... strs);
boolean overload1(TestInterface arg);

View File

@ -589,11 +589,27 @@ interface TestExampleInterface {
AnotherNameForTestInterface exerciseTypedefInterfaces2(NullableTestInterface arg);
void exerciseTypedefInterfaces3(YetAnotherNameForTestInterface arg);
// Deprecated methods and attributes
[Deprecated="GetAttributeNode"]
attribute boolean deprecatedAttribute;
[Deprecated="GetAttributeNode"]
void deprecatedMethod(boolean arg);
[Deprecated="GetAttributeNode"]
void deprecatedMethodWithContext(any arg);
// Static methods and attributes
static attribute boolean staticAttribute;
static void staticMethod(boolean arg);
static void staticMethodWithContext(any arg);
// Deprecated methods and attributes;
[Deprecated="GetAttributeNode"]
static attribute boolean staticDeprecatedAttribute;
[Deprecated="GetAttributeNode"]
static void staticDeprecatedMethod(boolean arg);
[Deprecated="GetAttributeNode"]
static void staticDeprecatedMethodWithContext(any arg);
// Overload resolution tests
//void overload1(DOMString... strs);
boolean overload1(TestInterface arg);

View File

@ -602,12 +602,28 @@ interface TestJSImplInterface {
AnotherNameForTestJSImplInterface exerciseTypedefInterfaces2(NullableTestJSImplInterface arg);
void exerciseTypedefInterfaces3(YetAnotherNameForTestJSImplInterface arg);
// Deprecated methods and attributes
[Deprecated="GetAttributeNode"]
attribute byte deprecatedAttribute;
[Deprecated="GetAttributeNode"]
byte deprecatedMethod();
[Deprecated="GetAttributeNode"]
void deprecatedMethodWithContext(any arg);
// Static methods and attributes
// FIXME: Bug 863952 Static things are not supported yet
/*
static attribute boolean staticAttribute;
static void staticMethod(boolean arg);
static void staticMethodWithContext(any arg);
// Deprecated static methods and attributes
[Deprecated="GetAttributeNode"]
static attribute byte staticDeprecatedAttribute;
[Deprecated="GetAttributeNode"]
static byte staticDeprecatedMethod();
[Deprecated="GetAttributeNode"]
static byte staticDeprecatedMethodWithContext();
*/
// Overload resolution tests