mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 731746 part 4. When wrapping a JS-implemented webidl object, define the new object as a property on the implementing object. r=mccr8
This commit is contained in:
parent
de9b7862dc
commit
c6af618fd5
@ -8459,7 +8459,20 @@ class CGJSImplClass(CGBindingImplClass):
|
||||
extradefinitions=extradefinitions)
|
||||
|
||||
def getWrapObjectBody(self):
|
||||
return "return %sBinding::Wrap(aCx, aScope, this);" % self.descriptor.name
|
||||
return ("JS::Rooted<JSObject*> obj(aCx, %sBinding::Wrap(aCx, aScope, this));\n"
|
||||
"if (!obj) {\n"
|
||||
" return nullptr;\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"// Now define it on our chrome object\n"
|
||||
"JSAutoCompartment ac(aCx, mImpl->Callback());\n"
|
||||
"if (!JS_WrapObject(aCx, obj.address())) {\n"
|
||||
" return nullptr;\n"
|
||||
"}\n"
|
||||
'if (!JS_DefineProperty(aCx, mImpl->Callback(), "__DOM_IMPL__", JS::ObjectValue(*obj), nullptr, nullptr, 0)) {\n'
|
||||
" return nullptr;\n"
|
||||
"}\n"
|
||||
"return obj;" % self.descriptor.name)
|
||||
|
||||
def getGetParentObjectReturnType(self):
|
||||
return "nsISupports*"
|
||||
|
Loading…
Reference in New Issue
Block a user