Please add `req.onerror` case to revert preference setting.