The decision tree is roughly:
1. If the custom engine is one of our default options, keep it.
2. If the custom engine was set by an add-on, keep it.
3. If the custom engine uses HTTPS, prompt the user to actively choose by opening about:searchreset, and do not prompt again after the user has made a choice.
4. If the custom engine uses insecure HTTP, silently reset to the default.
You can open about:searchreset yourself to see what the prompt looks like.
Code at https://dxr.mozilla.org/mozilla-central/rev/a928be5dacc3b544...