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


import pytest
from helper import CompatTestCase
from validator.compat import FX50_DEFINITION
        script = '''
            var certdb = Components.classes["@mozilla.org/security/x509certdb;1"].
                getService(Components.interfaces.nsIX509CertDB);
            var cert = certdb.findCertByDBKey(
                tgt.parentNode.firstChild.getAttribute("display"),
                null);

            cert.QueryInterface(Components.interfaces.nsIX509Cert3);
            cert.getUsagesString();
        '''

        self.run_script_for_compat(script)

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

        warning = [msg for msg in self.compat_err.warnings if msg['message'] == expected]
        assert warning
        assert warning[0]['compatibility_type'] == 'error'

    def test_events_removed_html_xul(self):
        """https://github.com/mozilla/addons-server/issues/3407"""
        expected = (
            'The draggesture and dragdrop events are no longer supported. '
            'You should use the standard equivalents instead: '
            'dragstart and drop.')

        events = ('draggesture', 'dragdrop', 'ondraggesture', 'ondragdrop')

        base = '''

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


# Path: tests/compat/test_gecko50.py
import pytest
from helper import CompatTestCase
from validator.compat import FX50_DEFINITION

        script = '''
            var certdb = Components.classes["@mozilla.org/security/x509certdb;1"].
                getService(Components.interfaces.nsIX509CertDB);
            var cert = certdb.findCertByDBKey(
                tgt.parentNode.firstChild.getAttribute("display"),
                null);

            cert.QueryInterface(Components.interfaces.nsIX509Cert3);
            cert.getUsagesString();
        '''

        self.run_script_for_compat(script)

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

        warning = [msg for msg in self.compat_err.warnings if msg['message'] == expected]
        assert warning
        assert warning[0]['compatibility_type'] == 'error'

    def test_events_removed_html_xul(self):
        """https://github.com/mozilla/addons-server/issues/3407"""
        expected = (
            'The draggesture and dragdrop events are no longer supported. '
            'You should use the standard equivalents instead: '
            'dragstart and drop.')

        events = ('draggesture', 'dragdrop', 'ondraggesture', 'ondragdrop')

        base = '''

            <treechildren