fix: normalizedUrl is set too early#5743
Conversation
fixes ghostery#5703 Setting `normalizedUrl` earlier may result in performance degradation and inconsistent behaviour in matching. `checkPattern` function uses this property depending on the case sensitivity and using the full base64 string instead of shorten version would add a computation pressure.
Co-authored-by: Philipp Claßen <philipp.classen@posteo.de>
chrmod
left a comment
There was a problem hiding this comment.
if that lets to matching problems, please provide a proof in form of a test.
Also, that made me wonder if we should ever lowercase data urls. What do you think?
|
At the bottom level, the affected scope would be restricted by the data URIs and the data URIs should not be lowercased at all. However, the original logic cuts the data URIs at comma which is not directly visible from the current diff. Therefore, it's safe that we can just proceed without considering it (maybe a comment worth it). |
|
The problem is the input value to the |
|
Added a failing test case but again - we rather should not process data uri contents. |
fixes #5703
Setting
normalizedUrlearlier may result in performance degradation and inconsistent behaviour in matching.checkPatternfunction uses this property depending on the case sensitivity and using the full base64 string instead of shorten version would add a computation pressure.