diff options
author | Anthony Ramine <n.oxyde@gmail.com> | 2015-12-25 04:52:13 +0100 |
---|---|---|
committer | Anthony Ramine <n.oxyde@gmail.com> | 2016-02-23 17:06:13 +0100 |
commit | c95855c7ea6f4451bb549bee4bc1302b92ed951b (patch) | |
tree | 3bc438a9137bd558b4cef3b0db52e99395be574c /components/script | |
parent | 3550993075a0dedb5857a421cf39c3e8942b30f8 (diff) | |
download | servo-c95855c7ea6f4451bb549bee4bc1302b92ed951b.tar.gz servo-c95855c7ea6f4451bb549bee4bc1302b92ed951b.zip |
Implement [LegacyUnenumerableNamedProperties] in the WebIDL parser
http://github.com/heycam/webidl/issues/82
Diffstat (limited to 'components/script')
3 files changed, 34 insertions, 1 deletions
diff --git a/components/script/dom/bindings/codegen/parser/WebIDL.py b/components/script/dom/bindings/codegen/parser/WebIDL.py index 273824fb1b0..c17e1c975a0 100644 --- a/components/script/dom/bindings/codegen/parser/WebIDL.py +++ b/components/script/dom/bindings/codegen/parser/WebIDL.py @@ -1069,6 +1069,12 @@ class IDLInterface(IDLObjectWithScope, IDLExposureMixins): specialMembersSeen[memberType] = member + if (self.getExtendedAttribute("LegacyUnenumerableNamedProperties") and + "named getters" not in specialMembersSeen): + raise WebIDLError("[LegacyUnenumerableNamedProperties] used on an interface " + "without a named getter", + [self.location]) + if self._isOnGlobalProtoChain: # Make sure we have no named setters, creators, or deleters for memberType in ["setter", "creator", "deleter"]: @@ -1417,7 +1423,8 @@ class IDLInterface(IDLObjectWithScope, IDLExposureMixins): identifier == "UnsafeInPrerendering" or identifier == "LegacyEventInit" or identifier == "ProbablyShortLivingObject" or - identifier == "Abstract"): + identifier == "Abstract" or + identifier == "LegacyUnenumerableNamedProperties"): # Known extended attributes that do not take values if not attr.noArguments(): raise WebIDLError("[%s] must take no arguments" % identifier, diff --git a/components/script/dom/bindings/codegen/parser/legacy-unenumerable-named-properties.patch b/components/script/dom/bindings/codegen/parser/legacy-unenumerable-named-properties.patch new file mode 100644 index 00000000000..3472d054940 --- /dev/null +++ b/components/script/dom/bindings/codegen/parser/legacy-unenumerable-named-properties.patch @@ -0,0 +1,25 @@ +--- WebIDL.py ++++ WebIDL.py +@@ -1069,6 +1069,12 @@ class IDLInterface(IDLObjectWithScope, IDLExposureMixins): + + specialMembersSeen[memberType] = member + ++ if (self.getExtendedAttribute("LegacyUnenumerableNamedProperties") and ++ "named getters" not in specialMembersSeen): ++ raise WebIDLError("[LegacyUnenumerableNamedProperties] used on an interface " ++ "without a named getter", ++ [self.location]) ++ + if self._isOnGlobalProtoChain: + # Make sure we have no named setters, creators, or deleters + for memberType in ["setter", "creator", "deleter"]: +@@ -1417,7 +1423,8 @@ class IDLInterface(IDLObjectWithScope, IDLExposureMixins): + identifier == "UnsafeInPrerendering" or + identifier == "LegacyEventInit" or + identifier == "ProbablyShortLivingObject" or +- identifier == "Abstract"): ++ identifier == "Abstract" or ++ identifier == "LegacyUnenumerableNamedProperties"): + # Known extended attributes that do not take values + if not attr.noArguments(): + raise WebIDLError("[%s] must take no arguments" % identifier, diff --git a/components/script/dom/bindings/codegen/parser/update.sh b/components/script/dom/bindings/codegen/parser/update.sh index 96a98f1ea95..c9f1aa5365b 100755 --- a/components/script/dom/bindings/codegen/parser/update.sh +++ b/components/script/dom/bindings/codegen/parser/update.sh @@ -1,4 +1,5 @@ wget https://mxr.mozilla.org/mozilla-central/source/dom/bindings/parser/WebIDL.py?raw=1 -O WebIDL.py patch < abstract.patch +patch < legacy-unenumerable-named-properties.patch # TODO: update test files from https://dxr.mozilla.org/mozilla-central/source/dom/bindings/parser/tests |