Bug 1359269 - Part 2: Add codegen support for attributes on types in WebIDL; r=bzbarsky
authorManish Goregaokar <manishearth@gmail.com>
Sat, 02 Mar 2019 04:21:22 +0000
changeset 519955 87d4c51be96fbcac944f48e440b0f57e845f7658
parent 519954 21deba7e36c509a6ba39e3913d19619bfc38f3a5
child 519956 ee5af9ad9e458273f389e6952dd74ec81ab72036
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbzbarsky
bugs1359269
milestone67.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 1359269 - Part 2: Add codegen support for attributes on types in WebIDL; r=bzbarsky Depends on D19733 Differential Revision: https://phabricator.services.mozilla.com/D19734
dom/bindings/Codegen.py
--- a/dom/bindings/Codegen.py
+++ b/dom/bindings/Codegen.py
@@ -4645,16 +4645,22 @@ def getJSToNativeConversionInfo(type, de
     assert defaultValue is None or not isOptional
 
     # Also, we should not have a defaultValue if we know we're an object
     assert not isDefinitelyObject or defaultValue is None
 
     # And we can't both be an object and be null or undefined
     assert not isDefinitelyObject or not isNullOrUndefined
 
+    # Types can also have extended attributes, copy them over
+    isClamp = isClamp or type.clamp
+    isEnforceRange = isEnforceRange or type.enforceRange
+    if type.treatNullAsEmpty:
+        treatNullAs = "EmptyString"
+
     # If exceptionCode is not set, we'll just rethrow the exception we got.
     # Note that we can't just set failureCode to exceptionCode, because setting
     # failureCode will prevent pending exceptions from being set in cases when
     # they really should be!
     if exceptionCode is None:
         exceptionCode = "return false;\n"
 
     # Unfortunately, .capitalize() on a string will lowercase things inside the