Bug 1553018 part 6. Allow [Pref] annotations on dictionary members. r=edgar
authorBoris Zbarsky <bzbarsky@mit.edu>
Thu, 30 May 2019 17:23:06 +0000
changeset 476241 293e5868cd10c8ab9679a79aec76f6c730119b06
parent 476240 f6affbe72b28c5595befede0fce9135f5681d2b5
child 476242 4796f71f2be46c812583129640ccc599bae1a865
push id36090
push usernbeleuzu@mozilla.com
push dateFri, 31 May 2019 03:59:09 +0000
treeherdermozilla-central@63568b2a8178 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersedgar
bugs1553018
milestone69.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1553018 part 6. Allow [Pref] annotations on dictionary members. r=edgar Differential Revision: https://phabricator.services.mozilla.com/D32947
dom/bindings/parser/WebIDL.py
dom/bindings/test/TestCodeGen.webidl
--- a/dom/bindings/parser/WebIDL.py
+++ b/dom/bindings/parser/WebIDL.py
@@ -4575,17 +4575,18 @@ class IDLArgument(IDLObjectWithIdentifie
         for attribute in attrs:
             identifier = attribute.identifier()
             if self.allowTypeAttributes and (identifier == "EnforceRange" or identifier == "Clamp" or
                                              identifier == "TreatNullAs"):
                 self.type = self.type.withExtendedAttributes([attribute])
             elif identifier == "TreatNonCallableAsNull":
                 self._allowTreatNonCallableAsNull = True
             elif (self.dictionaryMember and
-                  (identifier == "ChromeOnly" or identifier == "Func")):
+                  (identifier == "ChromeOnly" or identifier == "Func" or
+                   identifier == "Pref")):
                 if not self.optional:
                     raise WebIDLError("[%s] must not be used on a required "
                                       "dictionary member" % identifier,
                                       [attribute.location])
             else:
                 raise WebIDLError("Unhandled extended attribute on %s" %
                                   ("a dictionary member" if self.dictionaryMember else
                                    "an argument"),
--- a/dom/bindings/test/TestCodeGen.webidl
+++ b/dom/bindings/test/TestCodeGen.webidl
@@ -1215,16 +1215,22 @@ dictionary DictForConstructor {
 
 dictionary DictWithConditionalMembers {
   [ChromeOnly]
   long chromeOnlyMember;
   [Func="TestFuncControlledMember"]
   long funcControlledMember;
   [ChromeOnly, Func="nsGenericHTMLElement::LegacyTouchAPIEnabled"]
   long chromeOnlyFuncControlledMember;
+  // We need a pref name that's in StaticPrefList.h here.
+  [Pref="browser.dom.window.dump.enabled"]
+  long prefControlledMember;
+  [Pref="browser.dom.window.dump.enabled", ChromeOnly,
+   Func="TestFuncControlledMember"]
+  long chromeOnlyFuncAndPrefControlledMember;
 };
 
 interface TestIndexedGetterInterface {
   getter long item(unsigned long idx);
   readonly attribute unsigned long length;
   legacycaller void();
   [Cached, Pure] readonly attribute long cachedAttr;
   [StoreInSlot, Pure] readonly attribute long storeInSlotAttr;