Opened 4 years ago

Last modified 4 years ago

#4067 closed change

Make filter "keys" generated for element hiding filters numeric — at Version 1

Reported by: trev Assignee: trev
Priority: P3 Milestone:
Module: Core Keywords:
Cc: Blocked By:
Blocking: #4057 Platform: Unknown / Cross platform
Ready: yes Confidential: no
Tester: Ross Verified working: yes
Review URL(s):



In order to achieve significant speedups in #4057, we should make sure that filterByKey used by the ElemHide component is an array - filter IDs (called "keys" here) should be numeric and consecutive.

What to change

Turn filterByKey into an array and assign keys by simply pushing into that array. However, as the website can potentially read out the keys on Firefox, it has to be ensured that guessing the filter from key isn't possible. The most efficient way seems to be adding filters in a pseudo-random order.

In particular, FilterListener has to be changed - rather than calling forEach to add all filters from a subscription, a new randomizeOrder function should be called. It will choose a random prime (one that the array length cannot be divided by) and a random starting point. It will then iterate through using the prime as the increase.

Change History (1)

comment:1 Changed 4 years ago by trev

  • Review URL(s) modified (diff)
  • Status changed from new to reviewing
Note: See TracTickets for help on using tickets.