From 0859cd46af6cadecd00af30cf44b9162b21d616c Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Tue, 19 Feb 2013 11:54:41 -0500 Subject: [PATCH] Bug 838691 part 4. Add tests for pref-controlled and function-controlled properties. r=peterv I've manually verified that the generated code for this looks like it should. --- dom/bindings/test/TestBindingHeader.h | 23 ++++++++++++++ dom/bindings/test/TestCodeGen.webidl | 40 +++++++++++++++++++++++++ dom/bindings/test/TestExampleGen.webidl | 40 +++++++++++++++++++++++++ 3 files changed, 103 insertions(+) diff --git a/dom/bindings/test/TestBindingHeader.h b/dom/bindings/test/TestBindingHeader.h index b76bc2f5b8d..4f26f0b77ad 100644 --- a/dom/bindings/test/TestBindingHeader.h +++ b/dom/bindings/test/TestBindingHeader.h @@ -16,6 +16,8 @@ #include "../TestCodeGenBinding.h" #include "mozilla/dom/UnionTypes.h" +extern bool TestFuncControlledMember(JSContext*, JSObject*); + namespace mozilla { namespace dom { @@ -470,6 +472,27 @@ public: void PassVariadicThirdArg(const nsAString&, int32_t, const Sequence >&); + // Conditionally exposed methods/attributes + bool Prefable1(); + bool Prefable2(); + bool Prefable3(); + bool Prefable4(); + bool Prefable5(); + bool Prefable6(); + bool Prefable7(); + bool Prefable8(); + bool Prefable9(); + void Prefable10(); + void Prefable11(); + bool Prefable12(); + void Prefable13(); + bool Prefable14(); + bool Prefable15(); + bool Prefable16(); + void Prefable17(); + void Prefable18(); + void Prefable19(); + // Miscellania int32_t AttrWithLenientThis(); void SetAttrWithLenientThis(int32_t); diff --git a/dom/bindings/test/TestCodeGen.webidl b/dom/bindings/test/TestCodeGen.webidl index 1d990896d71..1cf9a699bf9 100644 --- a/dom/bindings/test/TestCodeGen.webidl +++ b/dom/bindings/test/TestCodeGen.webidl @@ -449,6 +449,46 @@ interface TestInterface { // Variadic handling void passVariadicThirdArg(DOMString arg1, long arg2, TestInterface... arg3); + // Conditionally exposed methods/attributes + [Pref="abc.def"] + readonly attribute boolean prefable1; + [Pref="abc.def"] + readonly attribute boolean prefable2; + [Pref="ghi.jkl"] + readonly attribute boolean prefable3; + [Pref="ghi.jkl"] + readonly attribute boolean prefable4; + [Pref="abc.def"] + readonly attribute boolean prefable5; + [Pref="abc.def", Func="nsGenericHTMLElement::TouchEventsEnabled"] + readonly attribute boolean prefable6; + [Pref="abc.def", Func="nsGenericHTMLElement::TouchEventsEnabled"] + readonly attribute boolean prefable7; + [Pref="ghi.jkl", Func="nsGenericHTMLElement::TouchEventsEnabled"] + readonly attribute boolean prefable8; + [Pref="abc.def", Func="nsGenericHTMLElement::TouchEventsEnabled"] + readonly attribute boolean prefable9; + [Pref="abc.def"] + void prefable10(); + [Pref="abc.def", Func="nsGenericHTMLElement::TouchEventsEnabled"] + void prefable11(); + [Pref="abc.def", Func="TestFuncControlledMember"] + readonly attribute boolean prefable12; + [Pref="abc.def", Func="nsGenericHTMLElement::TouchEventsEnabled"] + void prefable13(); + [Pref="abc.def", Func="TestFuncControlledMember"] + readonly attribute boolean prefable14; + [Func="TestFuncControlledMember"] + readonly attribute boolean prefable15; + [Func="TestFuncControlledMember"] + readonly attribute boolean prefable16; + [Pref="abc.def", Func="TestFuncControlledMember"] + void prefable17(); + [Func="TestFuncControlledMember"] + void prefable18(); + [Func="TestFuncControlledMember"] + void prefable19(); + // Miscellania [LenientThis] attribute long attrWithLenientThis; [Unforgeable] readonly attribute long unforgeableAttr; diff --git a/dom/bindings/test/TestExampleGen.webidl b/dom/bindings/test/TestExampleGen.webidl index 82ef645f687..9e3a5a2797e 100644 --- a/dom/bindings/test/TestExampleGen.webidl +++ b/dom/bindings/test/TestExampleGen.webidl @@ -365,6 +365,46 @@ interface TestExampleInterface { // Variadic handling void passVariadicThirdArg(DOMString arg1, long arg2, TestInterface... arg3); + // Conditionally exposed methods/attributes + [Pref="abc.def"] + readonly attribute boolean prefable1; + [Pref="abc.def"] + readonly attribute boolean prefable2; + [Pref="ghi.jkl"] + readonly attribute boolean prefable3; + [Pref="ghi.jkl"] + readonly attribute boolean prefable4; + [Pref="abc.def"] + readonly attribute boolean prefable5; + [Pref="abc.def", Func="nsGenericHTMLElement::TouchEventsEnabled"] + readonly attribute boolean prefable6; + [Pref="abc.def", Func="nsGenericHTMLElement::TouchEventsEnabled"] + readonly attribute boolean prefable7; + [Pref="ghi.jkl", Func="nsGenericHTMLElement::TouchEventsEnabled"] + readonly attribute boolean prefable8; + [Pref="abc.def", Func="nsGenericHTMLElement::TouchEventsEnabled"] + readonly attribute boolean prefable9; + [Pref="abc.def"] + void prefable10(); + [Pref="abc.def", Func="nsGenericHTMLElement::TouchEventsEnabled"] + void prefable11(); + [Pref="abc.def", Func="TestFuncControlledMember"] + readonly attribute boolean prefable12; + [Pref="abc.def", Func="nsGenericHTMLElement::TouchEventsEnabled"] + void prefable13(); + [Pref="abc.def", Func="TestFuncControlledMember"] + readonly attribute boolean prefable14; + [Func="TestFuncControlledMember"] + readonly attribute boolean prefable15; + [Func="TestFuncControlledMember"] + readonly attribute boolean prefable16; + [Pref="abc.def", Func="TestFuncControlledMember"] + void prefable17(); + [Func="TestFuncControlledMember"] + void prefable18(); + [Func="TestFuncControlledMember"] + void prefable19(); + // Miscellania [LenientThis] attribute long attrWithLenientThis; [Unforgeable] readonly attribute long unforgeableAttr;