GNOME Bugzilla – Bug 639164
failing to handle namespaces correctly in native modules
Last modified: 2017-01-06 04:20:42 UTC
When registering a native module in namespace, e.g. GJS_REGISTER_NATIVE_MODULE("test.testNative", define_stuff) and installing the module in proper directory ($moduledir/test/) importing the module with "const testNative = imports.test.testNative;" is failing: JS ERROR: !!! Exception was: Error: No native module 'testtestNative' has registered itself
Created attachment 177948 [details] [review] gjs: handle namespaces correctly when looking up native modules That is, look up 'imports.test.testNative' correctly as registered. Previosly the dots were lost and while the module was registered as 'test.testNative' it was looked up as 'testtestNative' which was not found: JS ERROR: !!! Exception was: Error: No native module 'testtestNative' has registered itself
Created attachment 177949 [details] [review] test: build 'tests_dependencies' with += as other similar variables Makes it cleaner to add new elements in future patches.
Created attachment 177950 [details] [review] test: test importing namespaced native module Build a 'test.testNative' native module (not installed) and add test to verify it gets loaded properly. Includes some automake rules to get the module in correct directory.
Created attachment 177951 [details] [review] gjs: fix memory leak looking up native modules in namespaces
Created attachment 177952 [details] [review] gjs: avoid shadowing variables
Review of attachment 177948 [details] [review]: Looks good.
Comment on attachment 177948 [details] [review] gjs: handle namespaces correctly when looking up native modules Attachment 177948 [details] pushed as 79e5160 - gjs: handle namespaces correctly when looking up native modules
Review of attachment 177952 [details] [review]: This code doesn't exist anymore at this point.
Review of attachment 177951 [details] [review]: This code doesn't exist anymore at this point.
Review of attachment 177949 [details] [review]: This code doesn't exist anymore at this point.
Review of attachment 177950 [details] [review]: ...and on further examination this code doesn't exist anymore either :-)
Going to close this one then. On behalf of the developers of the olden days, sorry it never got reviewed.