Search code examples
firefox-addonfirefox-addon-sdkfirefox-addon-restartlessfirefox-addon-bootstrapfirefox-addon-overlay

maxVersion of Firefox Add-on is not enforced?


I have a Firefox add-on (not distributed via AOD) that was supposed to be active (in that version) only with Firefox up to version 50, cf. This snippet is from my install.rdf:

 <em:targetApplication>
   <Description>
     <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
     <em:minVersion>35.0</em:minVersion>
     <em:maxVersion>50.0</em:maxVersion>
   </Description>
 </em:targetApplication>

I intended that, when a user updates to Firefox 51, this add-on would be automatically disabled (at least until the add-on is updated as well). However, I noticed that this was not the case: The add-on was still active, even after Firefox restart (which had happened during the update anyway).

Is there something wrong with the versioning I did?


Solution

  • The maxVersion property is ignored unless you also set strictCompatibility:

    <em:strictCompatibility>true</em:strictCompatibility>
    

    MDN says the following about strictCompatibility:

    A Boolean value indicating if the add-on should be enabled when the version of the application is greater than its max version. By default, the value of this property is false meaning that the compatibility checking will not be performed against the max version.

    Usually, there is no need to restrict the compatibility: not all new releases will break your extension and, if it is hosted on AMO, you'll get notice several weeks in advance if a potential risk has been detected. Moreover, an extension being disabled, even for a short period, leads to a bad experience for the user. About the only time you should need to set this if your add-on does things that are likely to be broken by Firefox updates. You do not need to set this flag if your add-on has a binary component, since add-ons with binary components are always subject to strict compatibility checking (because binary components need to be rebuilt for every major application release anyway).

    I have updated the targetApplication section of the Install Manifests page on MDN to state that strictCompatibility is required for maxVersion not to be ignored. While this interaction was stated in the strictCompatibility section, the above quoted text is not something that would be found by someone only checking what is needed for maxVersion.

    I suspect that this situation came about because of the evolution of the instal.rdf file and how handling of maxVersion evolved over time. Unfortunately, it has resulted in a situation where a property, maxVersion is required, but ignored.

    The equivalent of this in a WebExtension is the "applications": {"strict_max_version": "50.*",. The strict_max_version value is enforced for WebExtensions.