Skip to content

object: Return undefined and not the actual function on disposed objects

Marco Trevisan requested to merge 3v1n0/gjs:undefined-returns-on-disposed into master

When calling a proto function on a disposed object we return true not to throw, however when doing this we implicitly return the actual underlying function pointer and that may cause use the return value to be used to wrongly set a variable or to be wrongly evaluated.

To avoid this and be consistent, return undefined instead.

Adapt tests for this and add more for uncovered methods.

Fixes #396 (closed)

Merge request reports