Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | # This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 2 | # License, v. 2.0. If a copy of the MPL was not distributed with this file, |
michael@0 | 3 | # You can obtain one at http://mozilla.org/MPL/2.0/. |
michael@0 | 4 | |
michael@0 | 5 | import sys |
michael@0 | 6 | import string |
michael@0 | 7 | |
michael@0 | 8 | propList = eval(sys.stdin.read()) |
michael@0 | 9 | props = "" |
michael@0 | 10 | for [prop, id, flags, pref] in propList: |
michael@0 | 11 | extendedAttrs = ["Throws", "TreatNullAs=EmptyString"] |
michael@0 | 12 | # To limit the overhead of Func= annotations, we only generate them when |
michael@0 | 13 | # necessary, which is when the |
michael@0 | 14 | # CSS_PROPERTY_ALWAYS_ENABLED_IN_CHROME_OR_CERTIFIED_APP flag is set. |
michael@0 | 15 | # Otherwise, we try to get by with just a Pref= annotation or no annotation |
michael@0 | 16 | # at all. |
michael@0 | 17 | if "CSS_PROPERTY_ALWAYS_ENABLED_IN_CHROME_OR_CERTIFIED_APP" in flags: |
michael@0 | 18 | extendedAttrs.append('Func="IsCSSPropertyExposedToJS<eCSSProperty_%s>"' % id) |
michael@0 | 19 | # The following is an 'elif' because it is the responsibility of |
michael@0 | 20 | # IsCSSPropertyExposedToJS to handle the pref if there is one. |
michael@0 | 21 | elif pref is not "": |
michael@0 | 22 | extendedAttrs.append('Pref="%s"' % pref) |
michael@0 | 23 | if not prop.startswith("Moz"): |
michael@0 | 24 | prop = prop[0].lower() + prop[1:] |
michael@0 | 25 | # Unfortunately, even some of the getters here are fallible |
michael@0 | 26 | # (e.g. on nsComputedDOMStyle). |
michael@0 | 27 | props += " [%s] attribute DOMString %s;\n" % (", ".join(extendedAttrs), |
michael@0 | 28 | prop) |
michael@0 | 29 | |
michael@0 | 30 | idlFile = open(sys.argv[1], "r"); |
michael@0 | 31 | idlTemplate = idlFile.read(); |
michael@0 | 32 | idlFile.close(); |
michael@0 | 33 | |
michael@0 | 34 | print ("/* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT */\n\n" + |
michael@0 | 35 | string.Template(idlTemplate).substitute({ "props": props })) |