diff options
Diffstat (limited to 'components/script/dom/bindings/codegen')
-rw-r--r-- | components/script/dom/bindings/codegen/Bindings.conf | 6 | ||||
-rw-r--r-- | components/script/dom/bindings/codegen/CodegenRust.py | 18 | ||||
-rw-r--r-- | components/script/dom/bindings/codegen/Configuration.py | 10 |
3 files changed, 24 insertions, 10 deletions
diff --git a/components/script/dom/bindings/codegen/Bindings.conf b/components/script/dom/bindings/codegen/Bindings.conf index 314151f8c58..44d835589c4 100644 --- a/components/script/dom/bindings/codegen/Bindings.conf +++ b/components/script/dom/bindings/codegen/Bindings.conf @@ -23,6 +23,12 @@ DOMInterfaces = { 'URL': { 'weakReferenceable': True, +}, + +'WindowProxy' : { + 'nativeType': 'BrowsingContext', + 'path': 'dom::browsingcontext::BrowsingContext', + 'register': False, } } diff --git a/components/script/dom/bindings/codegen/CodegenRust.py b/components/script/dom/bindings/codegen/CodegenRust.py index c356a7d066c..057246f05aa 100644 --- a/components/script/dom/bindings/codegen/CodegenRust.py +++ b/components/script/dom/bindings/codegen/CodegenRust.py @@ -1695,7 +1695,7 @@ class CGImports(CGWrapper): """ Generates the appropriate import/use statements. """ - def __init__(self, child, descriptors, callbacks, imports, ignored_warnings=None): + def __init__(self, child, descriptors, callbacks, imports, config, ignored_warnings=None): """ Adds a set of imports. """ @@ -1756,7 +1756,11 @@ class CGImports(CGWrapper): for c in callbacks: types += relatedTypesForSignatures(c) - imports += ['dom::types::%s' % getIdentifier(t).name for t in types if isImportable(t)] + descriptorProvider = config.getDescriptorProvider() + for t in types: + if isImportable(t): + descriptor = descriptorProvider.getDescriptor(getIdentifier(t).name) + imports += ['%s' % descriptor.path] statements = [] if len(ignored_warnings) > 0: @@ -2090,7 +2094,7 @@ def UnionTypes(descriptors, dictionaries, callbacks, config): # Sort unionStructs by key, retrieve value unionStructs = (i[1] for i in sorted(unionStructs.items(), key=operator.itemgetter(0))) - return CGImports(CGList(unionStructs, "\n\n"), [], [], imports, ignored_warnings=[]) + return CGImports(CGList(unionStructs, "\n\n"), [], [], imports, config, ignored_warnings=[]) class Argument(): @@ -5460,7 +5464,8 @@ class CGBindingRoot(CGThing): # (hence hasInterfaceObject=False). descriptors.extend(config.getDescriptors(webIDLFile=webIDLFile, hasInterfaceObject=False, - isCallback=False)) + isCallback=False, + register=True)) dictionaries = config.getDictionaries(webIDLFile=webIDLFile) @@ -5588,6 +5593,7 @@ class CGBindingRoot(CGThing): 'dom::bindings::str::{ByteString, DOMString, USVString}', 'dom::bindings::trace::RootedVec', 'dom::bindings::weakref::{DOM_WEAK_SLOT, WeakBox, WeakReferenceable}', + 'dom::browsingcontext::BrowsingContext', 'mem::heap_size_of_raw_self_and_children', 'libc', 'util::prefs', @@ -5602,7 +5608,7 @@ class CGBindingRoot(CGThing): 'std::rc::Rc', 'std::default::Default', 'std::ffi::CString', - ]) + ], config) # Add the auto-generated comment. curr = CGWrapper(curr, pre=AUTOGENERATED_WARNING_COMMENT) @@ -6278,7 +6284,7 @@ class GlobalGenRoots(): 'dom::bindings::codegen', 'dom::bindings::codegen::PrototypeList::Proxies', 'libc', - ], ignored_warnings=[]) + ], config, ignored_warnings=[]) @staticmethod def InterfaceTypes(config): diff --git a/components/script/dom/bindings/codegen/Configuration.py b/components/script/dom/bindings/codegen/Configuration.py index 3ee7fb37e77..7aad0f75f75 100644 --- a/components/script/dom/bindings/codegen/Configuration.py +++ b/components/script/dom/bindings/codegen/Configuration.py @@ -173,6 +173,7 @@ class Descriptor(DescriptorProvider): # Read the desc, and fill in the relevant defaults. ifaceName = self.interface.identifier.name + typeName = desc.get('nativeType', ifaceName) # Callback types do not use JS smart pointers, so we should not use the # built-in rooting mechanisms for them. @@ -184,12 +185,13 @@ class Descriptor(DescriptorProvider): self.nativeType = ty else: self.needsRooting = True - self.returnType = "Root<%s>" % ifaceName - self.argumentType = "&%s" % ifaceName - self.nativeType = "*const %s" % ifaceName + self.returnType = "Root<%s>" % typeName + self.argumentType = "&%s" % typeName + self.nativeType = "*const %s" % typeName - self.concreteType = ifaceName + self.concreteType = typeName self.register = desc.get('register', True) + self.path = desc.get('path', 'dom::types::%s' % typeName) self.outerObjectHook = desc.get('outerObjectHook', 'None') self.proxy = False self.weakReferenceable = desc.get('weakReferenceable', False) |