diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:35:49 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:35:49 +0000 |
commit | d8bbc7858622b6d9c278469aab701ca0b609cddf (patch) | |
tree | eff41dc61d9f714852212739e6b3738b82a2af87 /xpcom/reflect/xptinfo | |
parent | Releasing progress-linux version 125.0.3-1~progress7.99u1. (diff) | |
download | firefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.tar.xz firefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.zip |
Merging upstream version 126.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'xpcom/reflect/xptinfo')
-rw-r--r-- | xpcom/reflect/xptinfo/xptcodegen.py | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/xpcom/reflect/xptinfo/xptcodegen.py b/xpcom/reflect/xptinfo/xptcodegen.py index d2859703b8..9dd54a6f07 100644 --- a/xpcom/reflect/xptinfo/xptcodegen.py +++ b/xpcom/reflect/xptinfo/xptcodegen.py @@ -9,6 +9,7 @@ import json from collections import OrderedDict import buildconfig +from mozbuild.util import memoize from perfecthash import PerfectHash # Pick a nice power-of-two size for our intermediate PHF tables. @@ -135,6 +136,7 @@ def split_iid(iid): # Get the individual components out of an IID string. return tuple(split_at_idxs(iid, (8, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2))) +@memoize def iid_bytes(iid): # Get the byte representation of the IID for hashing. bs = bytearray() for num in split_iid(iid): @@ -283,10 +285,6 @@ def link_to_cpp(interfaces, fd, header_fd): tag = type["tag"] d1 = d2 = 0 - # TD_VOID is used for types that can't be represented in JS, so they - # should not be represented in the XPT info. - assert tag != "TD_VOID" - if tag == "TD_LEGACY_ARRAY": d1 = type["size_is"] d2 = lower_extra_type(type["element"]) @@ -351,15 +349,15 @@ def link_to_cpp(interfaces, fd, header_fd): return True - def lower_method(method, ifacename): + def lower_method(method, ifacename, builtinclass): methodname = "%s::%s" % (ifacename, method["name"]) isSymbol = "symbol" in method["flags"] reflectable = is_method_reflectable(method) - if not reflectable: - # Hide the parameters of methods that can't be called from JS to - # reduce the size of the file. + if not reflectable and builtinclass: + # Hide the parameters of methods that can't be called from JS and + # are on builtinclass interfaces to reduce the size of the file. paramidx = name = numparams = 0 else: if isSymbol: @@ -440,6 +438,8 @@ def link_to_cpp(interfaces, fd, header_fd): assert method_cnt < 250, "%s has too many methods" % iface["name"] assert const_cnt < 256, "%s has too many constants" % iface["name"] + builtinclass = "builtinclass" in iface["flags"] + # Store the lowered interface as 'cxx' on the iface object. iface["cxx"] = nsXPTInterfaceInfo( "%d = %s" % (iface["idx"], iface["name"]), @@ -451,14 +451,14 @@ def link_to_cpp(interfaces, fd, header_fd): mConsts=len(consts), mNumConsts=const_cnt, # Flags - mBuiltinClass="builtinclass" in iface["flags"], + mBuiltinClass=builtinclass, mMainProcessScriptableOnly="main_process_only" in iface["flags"], mFunction="function" in iface["flags"], ) # Lower methods and constants used by this interface for method in iface["methods"]: - lower_method(method, iface["name"]) + lower_method(method, iface["name"], builtinclass) for const in iface["consts"]: lower_const(const, iface["name"]) @@ -625,6 +625,16 @@ def link_and_write(files, outfile, outheader): iids.add(interface["uuid"]) names.add(interface["name"]) + # All forwards referenced from scriptable members must be known (as scriptable). + for iface in interfaces: + for ref in iface["needs_scriptable"]: + if not ref in names: + raise Exception( + f"Scriptable member in {iface['name']} references unknown {ref}. " + "Forward must be a known and [scriptable] interface, " + "or the referencing member marked with [noscript]." + ) + link_to_cpp(interfaces, outfile, outheader) |