How can I explicitly call Atspi.Text.get_text()?

I’m writing a GNOME Shell extension in GJS and using AT-SPI to interact with another application’s text entry.

My accessible object implements the Text interface:

const textIface = entry.get_text_iface();

Methods like these work as expected:

textIface.get_character_count();
textIface.get_character_at_offset(0);

However, when I call:

textIface.get_text(0, -1);

instead of returning the text as a string, it returns the Atspi.Accessible object itself.

The only way I’ve found to get the expected result is:

const fullText = Atspi.Text.prototype.get_text.call(textIface, 0, -1);

which correctly returns the text.

I’m not sure why this happens. One possibility is that there is a name collision between the deprecated Accessible.get_text() and Text.get_text(), but I don’t know if that’s actually the cause.

My questions are:

  1. Is Atspi.Text.prototype.get_text.call(...) the intended way to invoke the Text interface method?
  2. Is there a more idiomatic or cleaner way to call Text.get_text() from GJS?
  3. If this behavior is due to a method name collision (or something else in the GObject Introspection bindings), could someone explain how GJS resolves these cases?

Any clarification would be appreciated.