Comment 19 for bug 334191

Created attachment 25458
New version of the proposed fix

Thanks to Pino Toscano for pointing out that I checked hasMainComponent twice.