I think that running the ifRilDisabled function first then checking mozMobileConnection are better way.
And it's the original solution. Is it OK for you?