From 426b1b699a47d5a91d301d13ab80099abdfa8e5b Mon Sep 17 00:00:00 2001 From: Peter Van der Beken Date: Wed, 25 Nov 2015 16:31:42 +0100 Subject: [PATCH] Bug 1227987: Simplify CGDOMJSClass::define. r=bz. --HG-- extra : rebase_source : aaf309c651b97ec750c56c2fbdf635529718fa14 --- dom/bindings/Codegen.py | 45 ++++++++--------------------------------- 1 file changed, 8 insertions(+), 37 deletions(-) diff --git a/dom/bindings/Codegen.py b/dom/bindings/Codegen.py index 20e775a23b96..824c7e18a4cf 100644 --- a/dom/bindings/Codegen.py +++ b/dom/bindings/Codegen.py @@ -410,51 +410,17 @@ class CGDOMJSClass(CGThing): return "" def define(self): - traceHook = 'nullptr' callHook = LEGACYCALLER_HOOK_NAME if self.descriptor.operations["LegacyCaller"] else 'nullptr' objectMovedHook = OBJECT_MOVED_HOOK_NAME if self.descriptor.wrapperCache else 'nullptr' slotCount = INSTANCE_RESERVED_SLOTS + self.descriptor.interface.totalMembersInSlots classFlags = "JSCLASS_IS_DOMJSCLASS | " - classExtensionAndObjectOps = fill( - """ - { - false, /* isWrappedNative */ - nullptr, /* weakmapKeyDelegateOp */ - ${objectMoved} /* objectMovedOp */ - }, - JS_NULL_OBJECT_OPS - """, - objectMoved=objectMovedHook) if self.descriptor.isGlobal(): classFlags += "JSCLASS_DOM_GLOBAL | JSCLASS_GLOBAL_FLAGS_WITH_SLOTS(DOM_GLOBAL_SLOTS)" traceHook = "JS_GlobalObjectTraceHook" reservedSlots = "JSCLASS_GLOBAL_APPLICATION_SLOTS" - if self.descriptor.interface.identifier.name == "Window": - classExtensionAndObjectOps = fill( - """ - { - false, /* isWrappedNative */ - nullptr, /* weakmapKeyDelegateOp */ - ${objectMoved} /* objectMovedOp */ - }, - { - nullptr, /* lookupProperty */ - nullptr, /* defineProperty */ - nullptr, /* hasProperty */ - nullptr, /* getProperty */ - nullptr, /* setProperty */ - nullptr, /* getOwnPropertyDescriptor */ - nullptr, /* deleteProperty */ - nullptr, /* watch */ - nullptr, /* unwatch */ - nullptr, /* getElements */ - nullptr, /* enumerate */ - nullptr, /* funToString */ - } - """, - objectMoved=objectMovedHook) else: classFlags += "JSCLASS_HAS_RESERVED_SLOTS(%d)" % slotCount + traceHook = 'nullptr' reservedSlots = slotCount if self.descriptor.interface.getExtendedAttribute("NeedResolve"): resolveHook = RESOLVE_HOOK_NAME @@ -487,7 +453,12 @@ class CGDOMJSClass(CGThing): nullptr, /* construct */ ${trace}, /* trace */ JS_NULL_CLASS_SPEC, - $*{classExtensionAndObjectOps} + { + false, /* isWrappedNative */ + nullptr, /* weakmapKeyDelegateOp */ + ${objectMoved} /* objectMovedOp */ + }, + JS_NULL_OBJECT_OPS }, $*{descriptor} }; @@ -505,7 +476,7 @@ class CGDOMJSClass(CGThing): finalize=FINALIZE_HOOK_NAME, call=callHook, trace=traceHook, - classExtensionAndObjectOps=classExtensionAndObjectOps, + objectMoved=objectMovedHook, descriptor=DOMClass(self.descriptor), instanceReservedSlots=INSTANCE_RESERVED_SLOTS, reservedSlots=reservedSlots,