User Migration - User's custom filters
Background
Some custom filters can be created by advanced users. These filters are important to the user and should not be lost when migrating to an extension version that supports MV3. Since there is no way to include them beforehand in static part, they should be migrated to dynamic DNR. An error may occur if the number of available dynamic filters overflows. However, the migration is performed as one of the first steps of the upgrade, so there is little chance of a conflict. Likewise, It is unlikely that the user has thousands of custom rules.
Use case
This is part of scenario of upgrade from MV2 extension to MV3.
Acceptance Criteria
- User's custom filters remain in place after the extension updates from Mv2 to Mv3
- Error when there are more than 5k filters is raised to integrator
Proposed Implementation
- It is convenient to have
SpecialSubscription
classes with no modifications for MV3. - On SDK initialization (dnr-filters.js /
init
) synchronize all custom filters not present inPrefs.dynamic_filters
to DNR. - Cases for adding or removing custom filters in runtime seems already covered. I think it would be good to make sure some meaningful metadata is set for such case. On the other side, this validation adds hidden preconditions for API call.
- Since custom filters, synchronization takes place on every initialization it takes care for the case of dynamic filter limit is hit. An exception will be thrown during initialization and we will try again on next startup.
Edited by Jens Rösler