[xpcom] Fix lifetime issue with dict keys, the converted data was freed too early