# Path: validator/compat.py
# FX47_DEFINITION = _build_definition(47, fennec=False, android=False, thunderbird=False)


from helper import CompatTestCase
from validator.compat import FX47_DEFINITION

        # There are other checks because using nsIX509CertDB is
        # potentially dangerous.
        warning = [x for x in self.compat_err.warnings if x['message'] == expected]
        assert warning
        assert warning[0]['compatibility_type'] == 'error'

    def test_changed_return_type(self):
        """https://github.com/mozilla/addons-server/issues/2220"""
        message = (
            'listTokens(), listModules() and listSlots() now return '
            'nsISimpleEnumerator instead of nsIEnumerator.')

        script = '''
            var db = Components.classes["@mozilla.org/security/pk11tokendb;1"]
                        .getService(Components.interfaces.nsIPK11TokenDB);
            var modules = db.listTokens();
        '''
        self.run_script_for_compat(script)

        assert not self.compat_err.notices
        assert not self.compat_err.errors

        assert len(self.compat_err.warnings) == 1
        assert self.compat_err.warnings[0]['compatibility_type'] == 'error'
        assert self.compat_err.warnings[0]['message'].startswith(message)

        script = '''
            var db = Components.classes["@mozilla.org/security/pkcs11moduledb;1"]
                        .getService(Components.interfaces.nsIPKCS11ModuleDB);

# Path: validator/compat.py
# FX47_DEFINITION = _build_definition(47, fennec=False, android=False, thunderbird=False)


# Path: tests/compat/test_gecko47.py
from helper import CompatTestCase
from validator.compat import FX47_DEFINITION


        # There are other checks because using nsIX509CertDB is
        # potentially dangerous.
        warning = [x for x in self.compat_err.warnings if x['message'] == expected]
        assert warning
        assert warning[0]['compatibility_type'] == 'error'

    def test_changed_return_type(self):
        """https://github.com/mozilla/addons-server/issues/2220"""
        message = (
            'listTokens(), listModules() and listSlots() now return '
            'nsISimpleEnumerator instead of nsIEnumerator.')

        script = '''
            var db = Components.classes["@mozilla.org/security/pk11tokendb;1"]
                        .getService(Components.interfaces.nsIPK11TokenDB);
            var modules = db.listTokens();
        '''
        self.run_script_for_compat(script)

        assert not self.compat_err.notices
        assert not self.compat_err.errors

        assert len(self.compat_err.warnings) == 1
        assert self.compat_err.warnings[0]['compatibility_type'] == 'error'
        assert self.compat_err.warnings[0]['message'].startswith(message)

        script = '''
            var db = Components.classes["@mozilla.org/security/pkcs11moduledb;1"]
                        .getService(Components.interfaces.nsIPKCS11ModuleDB);

            var modules = db.listModules();