-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inconsistency: session and dynamic DNR rules are applied with differing priorities across browsers #280
Comments
AI for Chrome from today's sync: explore the feasibility of changing the current behavior in Chrome to allow session, dynamic, and static rules to interleave priority. |
Note that Chrome has only documented As noted there (and pasted here by Timothy), the precedence is not only affected by The elaborate definition of precedence is needed to unambiguously arrive at an equivalent decision when multiple rules with the same priority and action matches. This is relevant in The relevant details of the disambiguation/conflict resolution behavior are not documented in Chrome's DNR API docs. The only documented precedence factors are priority and action precedence. To uniquely identify a rule, a stable rule identifier such as In short:
|
My last comment was based on a misunderstanding on my part. I thought that Chrome applied rules first by the type of rule, then by the priority of the rule. Chrome actually applies rules in priority order and only falls back to the type of rule for tie-breaking purposes. Thanks for helping clarify Chrome's behavior here, @Rob--W. We're supportive of clearly defining and aligning on a common rule precedence algorithm. Also, we're in the process of updating our declarativeNetRequest API documentation; I expect that as part of this work we will document Chrome's rule precedence. |
I made two mistakes before in the interpretation of Chrome's order of precedence:
I have examined the behavior again, and it turns out that the behavior is unstable when there are multiple same-priority actions of the same action type. Relevant sources:
|
For context, I assumed that the order to be session > dynamic > static rules, because that seems to be the most sensible design to me. And indeed, that expected order was historically present in Chrome until a patch broke that.
|
* DNR: Clarify precedence order across browsers. The currently documented order is not cross-browser, see w3c/webextensions#280. Therefore, drop that part of the documentation and replace it with guidance on how to create stable rules. * Apply suggestions from code review Co-authored-by: rebloor <git@sherpa.co.nz>
I have updated the MDN documentation in mdn/content#26793 to remove the mention of a guaranteed rule evaluation order in relation to rulesets and rule IDs, for now. @xeenon @oliverdunk I would like to get to a resolution here - how do we resolve this inconsistency? This inconsistency mainly matters for a limited scenario:
The current inconsistency forces extension developers to try and come up with a "priority" to establish a rule order. But the downside to that is that the rule priority is global and takes precedence over the precedence implies by the action type. There is currently no standard & guaranteed way for extensions to specify an explicit order between multiple actions. Having an established way would make the DNR API more useful. Currently, for same-priority actions of the same action type, the resolution is unspecified, undocumented and implementation-dependent:
|
Per Mozilla's PR here [https://phabricator.services.mozilla.com/D156233], session and dynamic rulesets are applied at a higher priority than the static rulesets defined in the manifest.
Safari does not give session and dynamic rulesets higher priority when determining which rule to apply.
The text was updated successfully, but these errors were encountered: