diff --git a/docs/topics/api/addons.rst b/docs/topics/api/addons.rst index f1800f3859..2343904ea6 100644 --- a/docs/topics/api/addons.rst +++ b/docs/topics/api/addons.rst @@ -394,34 +394,6 @@ This endpoint allows you to fetch a single version belonging to a specific add-o :>json string version: The version number string for the version. ----------------------------- -Add-on Feature Compatibility ----------------------------- - -.. _addon-feature-compatibility: - -This endpoint allows you to fetch feature compatibility information for a -a specific add-on by id, slug or guid. - -.. http:get:: /api/v4/addons/addon/(int:id|string:slug|string:guid)/feature_compatibility/ - - .. note:: - Non-public add-ons and add-ons with only unlisted versions require both: - - * authentication - * reviewer permissions or an account listed as a developer of the add-on - - :>json int e10s: The add-on e10s compatibility. Can be one of the following: - - ======================= ========================================================== - Value Description - ======================= ========================================================== - compatible multiprocessCompatible marked as true in the install.rdf. - compatible-webextension A WebExtension, so compatible. - incompatible multiprocessCompatible marked as false in the install.rdf. - unknown multiprocessCompatible has not been set. - ======================= ========================================================== - ------------------------------ Add-on EULA and Privacy Policy ------------------------------ diff --git a/docs/topics/api/v3_legacy/addons.rst b/docs/topics/api/v3_legacy/addons.rst index 6b1c514bfb..936c3d0c72 100644 --- a/docs/topics/api/v3_legacy/addons.rst +++ b/docs/topics/api/v3_legacy/addons.rst @@ -388,34 +388,6 @@ This endpoint allows you to fetch a single version belonging to a specific add-o :>json string version: The version number string for the version. ----------------------------- -Add-on Feature Compatibility ----------------------------- - -.. _v3-addon-feature-compatibility: - -This endpoint allows you to fetch feature compatibility information for a -a specific add-on by id, slug or guid. - -.. http:get:: /api/v3/addons/addon/(int:id|string:slug|string:guid)/feature_compatibility/ - - .. note:: - Non-public add-ons and add-ons with only unlisted versions require both: - - * authentication - * reviewer permissions or an account listed as a developer of the add-on - - :>json int e10s: The add-on e10s compatibility. Can be one of the following: - - ======================= ========================================================== - Value Description - ======================= ========================================================== - compatible multiprocessCompatible marked as true in the install.rdf. - compatible-webextension A WebExtension, so compatible. - incompatible multiprocessCompatible marked as false in the install.rdf. - unknown multiprocessCompatible has not been set. - ======================= ========================================================== - ------------------------------ Add-on EULA and Privacy Policy ------------------------------ diff --git a/src/olympia/addons/models.py b/src/olympia/addons/models.py index 46d3825bf9..63437b8e47 100644 --- a/src/olympia/addons/models.py +++ b/src/olympia/addons/models.py @@ -1409,17 +1409,6 @@ class Addon(OnChangeMixin, ModelBase): dev=(not require_owner), ignore_disabled=ignore_disabled) - @property - def feature_compatibility(self): - try: - feature_compatibility = self.addonfeaturecompatibility - except AddonFeatureCompatibility.DoesNotExist: - # If it does not exist, return a blank one, no need to create. It's - # the caller responsibility to create when needed to avoid - # unexpected database writes. - feature_compatibility = AddonFeatureCompatibility() - return feature_compatibility - def should_show_permissions(self, version=None): version = version or self.current_version return (self.type == amo.ADDON_EXTENSION and @@ -1808,19 +1797,6 @@ def watch_addon_user(old_attr=None, new_attr=None, instance=None, sender=None, update_search_index(sender=sender, instance=instance.addon, **kwargs) -class AddonFeatureCompatibility(ModelBase): - addon = models.OneToOneField( - Addon, primary_key=True, on_delete=models.CASCADE) - e10s = models.PositiveSmallIntegerField( - choices=amo.E10S_COMPATIBILITY_CHOICES, default=amo.E10S_UNKNOWN) - - def __unicode__(self): - return unicode(self.addon) if self.pk else u"" - - def get_e10s_classname(self): - return amo.E10S_COMPATIBILITY_CHOICES_API[self.e10s] - - class AddonApprovalsCounter(ModelBase): """Model holding a counter of the number of times a listed version belonging to an add-on has been approved by a human. Reset everytime a diff --git a/src/olympia/addons/serializers.py b/src/olympia/addons/serializers.py index 388309e67d..ccae3380fa 100644 --- a/src/olympia/addons/serializers.py +++ b/src/olympia/addons/serializers.py @@ -23,19 +23,10 @@ from olympia.versions.models import ( ApplicationsVersions, License, Version, VersionPreview) from .models import ( - Addon, AddonFeatureCompatibility, CompatOverride, Persona, Preview, + Addon, CompatOverride, Persona, Preview, ReplacementAddon, attach_tags) -class AddonFeatureCompatibilitySerializer(serializers.ModelSerializer): - e10s = ReverseChoiceField( - choices=amo.E10S_COMPATIBILITY_CHOICES_API.items()) - - class Meta: - model = AddonFeatureCompatibility - fields = ('e10s', ) - - class FileSerializer(serializers.ModelSerializer): url = serializers.SerializerMethodField() platform = ReverseChoiceField(choices=amo.PLATFORM_CHOICES_API.items()) diff --git a/src/olympia/addons/tests/test_models.py b/src/olympia/addons/tests/test_models.py index 56f0a20116..3e7c768a3b 100644 --- a/src/olympia/addons/tests/test_models.py +++ b/src/olympia/addons/tests/test_models.py @@ -20,7 +20,7 @@ from olympia.addons import models as addons_models from olympia.activity.models import ActivityLog, AddonLog from olympia.addons.models import ( Addon, AddonApprovalsCounter, AddonCategory, - AddonFeatureCompatibility, AddonReviewerFlags, AddonUser, AppSupport, + AddonReviewerFlags, AddonUser, AppSupport, Category, CompatOverride, CompatOverrideRange, DeniedGuid, DeniedSlug, FrozenAddon, IncompatibleVersions, MigratedLWT, Persona, Preview, track_addon_status_change) @@ -1800,21 +1800,6 @@ class TestAddonDelete(TestCase): assert Addon.unfiltered.filter(pk=addon.pk).exists() -class TestAddonFeatureCompatibility(TestCase): - fixtures = ['base/addon_3615'] - - def test_feature_compatibility_not_present(self): - addon = Addon.objects.get(pk=3615) - assert addon.feature_compatibility - assert not addon.feature_compatibility.pk - - def test_feature_compatibility_present(self): - addon = Addon.objects.get(pk=3615) - AddonFeatureCompatibility.objects.create(addon=addon) - assert addon.feature_compatibility - assert addon.feature_compatibility.pk - - class TestUpdateStatus(TestCase): def test_no_file_ends_with_NULL(self): @@ -2462,54 +2447,6 @@ class TestAddonFromUpload(UploadTest): parsed_data=parsed_data) assert e.exception.messages == ['Duplicate add-on ID found.'] - def test_basic_extension_is_marked_as_e10s_unknown(self): - # extension.xpi does not have multiprocessCompatible set to true, so - # it's marked as not-compatible. - self.upload = self.get_upload('extension.xpi') - parsed_data = parse_addon(self.upload, user=Mock()) - addon = Addon.from_upload( - self.upload, [self.selected_app], parsed_data=parsed_data) - - assert addon.guid - feature_compatibility = addon.feature_compatibility - assert feature_compatibility.pk - assert feature_compatibility.e10s == amo.E10S_UNKNOWN - - def test_extension_is_marked_as_e10s_incompatible(self): - self.upload = self.get_upload( - 'multiprocess_incompatible_extension.xpi') - parsed_data = parse_addon(self.upload, user=Mock()) - addon = Addon.from_upload( - self.upload, [self.selected_app], parsed_data=parsed_data) - - assert addon.guid - feature_compatibility = addon.feature_compatibility - assert feature_compatibility.pk - assert feature_compatibility.e10s == amo.E10S_INCOMPATIBLE - - def test_multiprocess_extension_is_marked_as_e10s_compatible(self): - self.upload = self.get_upload( - 'multiprocess_compatible_extension.xpi') - parsed_data = parse_addon(self.upload, user=Mock()) - addon = Addon.from_upload( - self.upload, [self.selected_app], parsed_data=parsed_data) - - assert addon.guid - feature_compatibility = addon.feature_compatibility - assert feature_compatibility.pk - assert feature_compatibility.e10s == amo.E10S_COMPATIBLE - - def test_webextension_is_marked_as_e10s_compatible(self): - self.upload = self.get_upload('webextension.xpi') - parsed_data = parse_addon(self.upload, user=Mock()) - addon = Addon.from_upload( - self.upload, [self.selected_app], parsed_data=parsed_data) - - assert addon.guid - feature_compatibility = addon.feature_compatibility - assert feature_compatibility.pk - assert feature_compatibility.e10s == amo.E10S_COMPATIBLE_WEBEXTENSION - def test_webextension_resolve_translations(self): self.upload = self.get_upload('notify-link-clicks-i18n.xpi') parsed_data = parse_addon(self.upload, user=Mock()) @@ -2534,7 +2471,6 @@ class TestAddonFromUpload(UploadTest): """Make sure we correct invalid `default_locale` values""" parsed_data = { 'default_locale': u'sv', - 'e10s_compatibility': 2, 'guid': u'notify-link-clicks-i18n@notzilla.org', 'name': u'__MSG_extensionName__', 'is_webextension': True, @@ -2558,7 +2494,6 @@ class TestAddonFromUpload(UploadTest): """ parsed_data = { 'default_locale': u'xxx', - 'e10s_compatibility': 2, 'guid': u'notify-link-clicks-i18n@notzilla.org', 'name': u'__MSG_extensionName__', 'is_webextension': True, diff --git a/src/olympia/addons/tests/test_views.py b/src/olympia/addons/tests/test_views.py index 299d61c406..972521665e 100644 --- a/src/olympia/addons/tests/test_views.py +++ b/src/olympia/addons/tests/test_views.py @@ -21,7 +21,7 @@ from rest_framework.test import APIRequestFactory from olympia import amo from olympia.abuse.models import AbuseReport from olympia.addons.models import ( - Addon, AddonFeatureCompatibility, AddonUser, Category, + Addon, AddonUser, Category, CompatOverride, CompatOverrideRange, Persona, ReplacementAddon, AddonCategory) from olympia.addons.utils import generate_addon_guid @@ -2152,41 +2152,6 @@ class TestVersionViewSetList(AddonAndVersionViewSetDetailMixin, TestCase): assert response.status_code == 403 -class TestAddonViewSetFeatureCompatibility(TestCase): - client_class = APITestClient - - def setUp(self): - super(TestAddonViewSetFeatureCompatibility, self).setUp() - self.addon = addon_factory( - guid=generate_addon_guid(), name=u'My Addôn', slug='my-addon') - self.url = reverse_ns( - 'addon-feature-compatibility', kwargs={'pk': self.addon.pk}) - - def test_url(self): - self.detail_url = reverse_ns( - 'addon-detail', kwargs={'pk': self.addon.pk}) - assert self.url == '%s%s' % (self.detail_url, 'feature_compatibility/') - - def test_disabled_anonymous(self): - self.addon.update(disabled_by_user=True) - response = self.client.get(self.url) - assert response.status_code == 401 - - def test_feature_compatibility_unknown(self): - response = self.client.get(self.url) - assert response.status_code == 200 - data = json.loads(response.content) - assert data['e10s'] == 'unknown' - - def test_feature_compatibility_compatible(self): - AddonFeatureCompatibility.objects.create( - addon=self.addon, e10s=amo.E10S_COMPATIBLE) - response = self.client.get(self.url) - assert response.status_code == 200 - data = json.loads(response.content) - assert data['e10s'] == 'compatible' - - class TestAddonViewSetEulaPolicy(TestCase): client_class = APITestClient diff --git a/src/olympia/addons/views.py b/src/olympia/addons/views.py index bd6190083f..4a8b36b66f 100644 --- a/src/olympia/addons/views.py +++ b/src/olympia/addons/views.py @@ -53,7 +53,7 @@ from .indexers import AddonIndexer from .models import ( Addon, CompatOverride, FrozenAddon, Persona, ReplacementAddon) from .serializers import ( - AddonEulaPolicySerializer, AddonFeatureCompatibilitySerializer, + AddonEulaPolicySerializer, AddonSerializer, AddonSerializerWithUnlistedData, CompatOverrideSerializer, ESAddonAutoCompleteSerializer, ESAddonSerializer, LanguageToolsSerializer, ReplacementAddonSerializer, StaticCategorySerializer, VersionSerializer) @@ -500,14 +500,6 @@ class AddonViewSet(RetrieveModelMixin, GenericViewSet): } raise exc - @action(detail=True) - def feature_compatibility(self, request, pk=None): - obj = self.get_object() - serializer = AddonFeatureCompatibilitySerializer( - obj.feature_compatibility, - context=self.get_serializer_context()) - return Response(serializer.data) - @action(detail=True) def eula_policy(self, request, pk=None): obj = self.get_object() diff --git a/src/olympia/constants/base.py b/src/olympia/constants/base.py index d2626f810c..a750cf8385 100644 --- a/src/olympia/constants/base.py +++ b/src/olympia/constants/base.py @@ -434,27 +434,6 @@ DEFAULT_STATIC_THEME_MIN_VERSION_ANDROID = '65.0' DEFAULT_WEBEXT_DICT_MIN_VERSION_FIREFOX = '61.0' -E10S_UNKNOWN = 0 -E10S_COMPATIBLE = 1 -E10S_COMPATIBLE_WEBEXTENSION = 2 -E10S_INCOMPATIBLE = 3 - -E10S_COMPATIBILITY_CHOICES = ( - (E10S_UNKNOWN, _('Unknown')), - # We don't need to show developers the actual, more granular state, only - # that it's compatible or not. - (E10S_COMPATIBLE_WEBEXTENSION, _('Compatible')), - (E10S_COMPATIBLE, _('Compatible')), - (E10S_INCOMPATIBLE, _('Incompatible')), -) - -E10S_COMPATIBILITY_CHOICES_API = { - E10S_UNKNOWN: 'unknown', - E10S_COMPATIBLE_WEBEXTENSION: 'compatible-webextension', - E10S_COMPATIBLE: 'compatible', - E10S_INCOMPATIBLE: 'incompatible', -} - ADDON_GUID_PATTERN = re.compile( # Match {uuid} or something@host.tld ("something" being optional) # guids. Copied from mozilla-central XPIProvider.jsm. diff --git a/src/olympia/devhub/templates/devhub/includes/addon_details.html b/src/olympia/devhub/templates/devhub/includes/addon_details.html index a74ec20cb6..66a471c7a7 100644 --- a/src/olympia/devhub/templates/devhub/includes/addon_details.html +++ b/src/olympia/devhub/templates/devhub/includes/addon_details.html @@ -44,13 +44,6 @@ {{ addon.last_updated|date }} {% endif %} -{% if addon.type == amo.ADDON_EXTENSION and amo.FIREFOX in addon.compatible_apps %} -