From 1be13ddcad01da7b23275f26717941df07986870 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Fri, 23 Aug 2013 22:42:41 -0400 Subject: [PATCH] Bug 908576 part 6. Expose just a NativePropertyHooks pointer, not the object itself, so we can forward-declare it in bindings headers. r=smaug --- dom/bindings/Codegen.py | 17 +++++++++++------ dom/workers/DOMBindingInlines.h | 1 + js/xpconnect/src/dom_quickstubs.qsconf | 2 +- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/dom/bindings/Codegen.py b/dom/bindings/Codegen.py index 44b256ad47e5..7016e1b727b1 100644 --- a/dom/bindings/Codegen.py +++ b/dom/bindings/Codegen.py @@ -80,7 +80,7 @@ class CGNativePropertyHooks(CGThing): def declare(self): if self.descriptor.workers: return "" - return "extern const NativePropertyHooks sNativePropertyHooks;\n" + return "extern const NativePropertyHooks* sNativePropertyHooks;\n" def define(self): if self.descriptor.workers: return "" @@ -112,7 +112,7 @@ class CGNativePropertyHooks(CGThing): else: prototypeID += "_ID_Count" parent = self.descriptor.interface.parent - parentHooks = ("&" + toBindingNamespace(parent.identifier.name) + "::sNativePropertyHooks" + parentHooks = (toBindingNamespace(parent.identifier.name) + "::sNativePropertyHooks" if parent else 'nullptr') return CGWrapper(CGIndenter(CGList([CGGeneric(resolveOwnProperty), @@ -125,11 +125,13 @@ class CGNativePropertyHooks(CGThing): CGGeneric(constructorID), CGGeneric(parentHooks)], ",\n")), - pre="const NativePropertyHooks sNativePropertyHooks = {\n", - post="\n};\n").define() + pre="static const NativePropertyHooks sNativePropertyHooksStruct = {\n", + post=("\n" + "};\n" + "const NativePropertyHooks* sNativePropertyHooks = &sNativePropertyHooksStruct;\n")).define() def NativePropertyHooks(descriptor): - return "&sWorkerNativePropertyHooks" if descriptor.workers else "&sNativePropertyHooks" + return "&sWorkerNativePropertyHooks" if descriptor.workers else "sNativePropertyHooks" def DOMClass(descriptor): protoList = ['prototypes::id::' + proto for proto in descriptor.prototypeChain] @@ -8549,6 +8551,9 @@ class CGForwardDeclarations(CGWrapper): for d in descriptors: builder.add(d.nativeType) + # We just about always need NativePropertyHooks + builder.addInMozillaDom("NativePropertyHooks") + for callback in mainCallbacks: forwardDeclareForType(callback) for t in getTypesFromCallback(callback): @@ -8691,12 +8696,12 @@ class CGBindingRoot(CGThing): callbackDescriptors, ['mozilla/dom/BindingDeclarations.h', 'mozilla/ErrorResult.h', - 'mozilla/dom/DOMJSClass.h', 'mozilla/dom/DOMJSProxyHandler.h'], ['mozilla/dom/BindingUtils.h', 'mozilla/dom/Nullable.h', 'PrimitiveConversions.h', 'WrapperFactory.h', + 'mozilla/dom/DOMJSClass.h', ] + (['WorkerPrivate.h', 'nsThreadUtils.h'] if hasWorkerStuff else []) + (['mozilla/Preferences.h'] if requiresPreferences else []) diff --git a/dom/workers/DOMBindingInlines.h b/dom/workers/DOMBindingInlines.h index 44234ae7b4fd..a930ba54fe1b 100644 --- a/dom/workers/DOMBindingInlines.h +++ b/dom/workers/DOMBindingInlines.h @@ -7,6 +7,7 @@ #define mozilla_dom_workers_dombindinginlines_h__ #include "mozilla/dom/FileReaderSyncBinding.h" +#include "mozilla/dom/JSSlots.h" #include "mozilla/dom/XMLHttpRequestBinding.h" #include "mozilla/dom/XMLHttpRequestUploadBinding.h" #include "mozilla/dom/WorkerLocationBinding.h" diff --git a/js/xpconnect/src/dom_quickstubs.qsconf b/js/xpconnect/src/dom_quickstubs.qsconf index 23ded1a20792..99d1f64b23ca 100644 --- a/js/xpconnect/src/dom_quickstubs.qsconf +++ b/js/xpconnect/src/dom_quickstubs.qsconf @@ -151,5 +151,5 @@ customMethodCalls = { newBindingProperties = { # Once the last entry here goes away, we can make the sNativePropertyHooks # of bindings static. - 'nsIDOMEventTarget': 'mozilla::dom::EventTargetBinding::sNativePropertyHooks.mNativeProperties.regular', + 'nsIDOMEventTarget': 'mozilla::dom::EventTargetBinding::sNativePropertyHooks->mNativeProperties.regular', }