xdgmime: Handle buggy type definitions with circular inheritance
This fixes a stack overflow reported by a user who had both the definition of text/javascript from shared-mime-info 2.3 and the definition of text/javascript from shared-mime-info 2.4 installed at the same time. In 2.3, text/javascript is a subtype of application/ecmascript, but in 2.4 application/ecmascript is a subtype of text/javascript. Having both at the same time resulted in circular inheritance.
The new logic keeps a list of all parents that have already been checked, which is more comprehensive than the old workaround that was implemented in commit 38869ece2 ("xdgmime: Prevent infinite loops from badly-formed MIME registrations").