diff --git a/dom/bindings/Codegen.py b/dom/bindings/Codegen.py index 171dc97b49e..862e348f92a 100644 --- a/dom/bindings/Codegen.py +++ b/dom/bindings/Codegen.py @@ -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 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( diff --git a/dom/bindings/parser/WebIDL.py b/dom/bindings/parser/WebIDL.py index 36a0a216cbd..005dc010324 100644 --- a/dom/bindings/parser/WebIDL.py +++ b/dom/bindings/parser/WebIDL.py @@ -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 diff --git a/dom/bindings/test/TestBindingHeader.h b/dom/bindings/test/TestBindingHeader.h index cc3525e0e3f..b5ee14930c9 100644 --- a/dom/bindings/test/TestBindingHeader.h +++ b/dom/bindings/test/TestBindingHeader.h @@ -737,12 +737,24 @@ public: already_AddRefed 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&); diff --git a/dom/bindings/test/TestCodeGen.webidl b/dom/bindings/test/TestCodeGen.webidl index 0e6ed455910..7bdd6f2757c 100644 --- a/dom/bindings/test/TestCodeGen.webidl +++ b/dom/bindings/test/TestCodeGen.webidl @@ -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); diff --git a/dom/bindings/test/TestExampleGen.webidl b/dom/bindings/test/TestExampleGen.webidl index 8c4a4725cc9..0534fc9a289 100644 --- a/dom/bindings/test/TestExampleGen.webidl +++ b/dom/bindings/test/TestExampleGen.webidl @@ -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); diff --git a/dom/bindings/test/TestJSImplGen.webidl b/dom/bindings/test/TestJSImplGen.webidl index fa64fe06108..028e3cc97d1 100644 --- a/dom/bindings/test/TestJSImplGen.webidl +++ b/dom/bindings/test/TestJSImplGen.webidl @@ -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