[GLib] Returning G_TYPE_OBJECT from a method does not work
authorcarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 21 Mar 2019 09:43:15 +0000 (09:43 +0000)
committercarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 21 Mar 2019 09:43:15 +0000 (09:43 +0000)
commit18033c7b62c044b69e2621864800178780cba7ec
tree4ef127723e915bd4e16990d858a8d61e5a3e5d95
parentbd66dbb8a200bfdcc06a5d244074a4052e29e9fd
[GLib] Returning G_TYPE_OBJECT from a method does not work
https://bugs.webkit.org/show_bug.cgi?id=195574

Reviewed by Michael Catanzaro.

Source/JavaScriptCore:

Add more documentation to clarify the ownership of wrapped objects when created and when returned by functions.

* API/glib/JSCCallbackFunction.cpp:
(JSC::JSCCallbackFunction::construct): Also allow to return boxed types from a constructor.
* API/glib/JSCClass.cpp:
* API/glib/JSCValue.cpp:

Tools:

Add new test cases to check the behavior of constructors and functions returning GObject and boxed types.

* TestWebKitAPI/Tests/JavaScriptCore/glib/TestJSC.cpp:
(getGFile):
(getParent):
(createGString):
(getGString):
(getGStringCopyWillRaise):
(getGStringCopy):
(getGStringStr):
(getGStringLen):
(freeGString):
(testJSCClass):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243283 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/JavaScriptCore/API/glib/JSCCallbackFunction.cpp
Source/JavaScriptCore/API/glib/JSCClass.cpp
Source/JavaScriptCore/API/glib/JSCValue.cpp
Source/JavaScriptCore/ChangeLog
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/JavaScriptCore/glib/TestJSC.cpp