After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 639164 - failing to handle namespaces correctly in native modules
failing to handle namespaces correctly in native modules
Status: RESOLVED OBSOLETE
Product: gjs
Classification: Bindings
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: gjs-maint
gjs-maint
Depends on:
Blocks:
 
 
Reported: 2011-01-10 17:54 UTC by Tommi Komulainen
Modified: 2017-01-06 04:20 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gjs: handle namespaces correctly when looking up native modules (1.02 KB, patch)
2011-01-10 17:54 UTC, Tommi Komulainen
committed Details | Review
test: build 'tests_dependencies' with += as other similar variables (1.95 KB, patch)
2011-01-10 17:54 UTC, Tommi Komulainen
rejected Details | Review
test: test importing namespaced native module (5.52 KB, patch)
2011-01-10 17:55 UTC, Tommi Komulainen
rejected Details | Review
gjs: fix memory leak looking up native modules in namespaces (933 bytes, patch)
2011-01-10 17:55 UTC, Tommi Komulainen
rejected Details | Review
gjs: avoid shadowing variables (970 bytes, patch)
2011-01-10 17:55 UTC, Tommi Komulainen
rejected Details | Review

Description Tommi Komulainen 2011-01-10 17:54:49 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
Comment 1 Tommi Komulainen 2011-01-10 17:54:52 UTC
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
Comment 2 Tommi Komulainen 2011-01-10 17:54:58 UTC
Created attachment 177949 [details] [review]
test: build 'tests_dependencies' with += as other similar variables

Makes it cleaner to add new elements in future patches.
Comment 3 Tommi Komulainen 2011-01-10 17:55:02 UTC
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.
Comment 4 Tommi Komulainen 2011-01-10 17:55:09 UTC
Created attachment 177951 [details] [review]
gjs: fix memory leak looking up native modules in namespaces
Comment 5 Tommi Komulainen 2011-01-10 17:55:13 UTC
Created attachment 177952 [details] [review]
gjs: avoid shadowing variables
Comment 6 Johan (not receiving bugmail) Dahlin 2011-02-17 17:19:34 UTC
Review of attachment 177948 [details] [review]:

Looks good.
Comment 7 Tommi Komulainen 2011-02-22 12:14:52 UTC
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
Comment 8 Philip Chimento 2017-01-02 04:46:14 UTC
Review of attachment 177952 [details] [review]:

This code doesn't exist anymore at this point.
Comment 9 Philip Chimento 2017-01-02 04:46:49 UTC
Review of attachment 177951 [details] [review]:

This code doesn't exist anymore at this point.
Comment 10 Philip Chimento 2017-01-02 04:47:02 UTC
Review of attachment 177951 [details] [review]:

This code doesn't exist anymore at this point.
Comment 11 Philip Chimento 2017-01-02 04:48:16 UTC
Review of attachment 177949 [details] [review]:

This code doesn't exist anymore at this point.
Comment 12 Philip Chimento 2017-01-06 04:18:59 UTC
Review of attachment 177950 [details] [review]:

...and on further examination this code doesn't exist anymore either :-)
Comment 13 Philip Chimento 2017-01-06 04:20:42 UTC
Going to close this one then. On behalf of the developers of the olden days, sorry it never got reviewed.