> There is not even any Gio.LocalFile known to JS.

```js
const a = imports.gi.Gio.File.new_for_path('./a.js');

// here the "now known to JS" Gio.LocalFile.prototype
Object.getPrototypeOf(a).shenanigans = true;

const b = imports.gi.Gio.File.new_for_path('./b.js');

// all instances affected indeed
print(b.shenanigans); // true
```

> It's not exposed in the GIR file, so there is never a prototype object
created in the first place

There is:

```js
const a = imports.gi.Gio.File.new_for_path('./a.js');
// here the *shared* Gio.LocalFile.prototype
Object.getPrototypeOf(a);
```

> In GJS, you can check if an object implements an interface with
myObj.constructor.implements(Gio.File).

That's good to know, thanks, yet if you read first messages of this thread
it was about patching upfront and not at runtime.
I understand I can find at runtime pretty much anything I want, but since
there is an introspection ability, why are there undocumented instances
around with undocumented prototypes?

Or better, why `Gio.File.new` creates something unrelated with
`Gio.File.prototype` or `Gio.File` methods ?
Since this super secret thing is easily leaked, why not fixing this instead
of saying that it shouldn't be known?

The reason I've asked is that I've discovered there are hidden classes the
GIR won't tell me, doesn't know, but **are** on my way.

> I don't believe Spidermonkey would support overloading instanceof for this

`instanceof` is the most easily "overloaded" ( not actually overloaded, it
just checks `rightSide.prototype.isPrototypeOf(leftSide)` ) operator which
is why I am asking if this would ever be solved.

"No", as answer, would be more than OK, I'm just trying to find a solution
to *my* problem.

Thanks for understanding and Best Regards
_______________________________________________
javascript-list mailing list
javascript-list@gnome.org
https://mail.gnome.org/mailman/listinfo/javascript-list

Reply via email to