gjs: No way to copy Typelib
Submitted by Derek Dai
Link to original bug (#702365)
Description
I tried to load type information in gjs, here is my code snippet
const Gir = imports.gi.GIRepository;
var repo = Gir.Repository.get_default();
repo.require("Gtk", "3.0", 0);
gjs reports
JS ERROR: !!! Exception was: Error: Can't create a Javascript object for Typelib; no way to copy
JS ERROR: !!! message = '"Can't create a Javascript object for Typelib; no way to copy"'
JS ERROR: !!! fileName = '"gi-query.js"'
JS ERROR: !!! lineNumber = '3'
JS ERROR: !!! stack = '"@gi-query.js:3
"'
Exception was set even though JS_EvaluateScript() returned true - did you gjs_throw() but not return false somewhere perhaps?
I also tried in python, no problem reported
>>> from gi.repository import GIRepository
>>> repo = GIRepository.Repository.get_default()
>>> typelib = repo.require("Gtk", "3.0", 0)
>>> typelib.get_namespace()
'Gtk'