Opened on 05/24/2016 at 10:50:44 AM

Closed on 05/24/2016 at 01:01:28 PM

Last modified on 06/27/2016 at 12:57:09 PM

#4067 closed change (fixed)

Make filter "keys" generated for element hiding filters numeric

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):

Description (last modified by trev)


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.

Hints for testers

This change affects element hiding functionality, it should still work correctly on startup, after adding or updating a filter subscription. Also, filter hits should be registered correctly in Firefox.

Attachments (0)

Change History (5)

comment:1 Changed on 05/24/2016 at 11:49:13 AM by trev

  • Review URL(s) modified (diff)
  • Status changed from new to reviewing

comment:2 Changed on 05/24/2016 at 12:40:08 PM by trev

  • Description modified (diff)

comment:3 Changed on 05/24/2016 at 01:00:54 PM by abpbot

comment:4 Changed on 05/24/2016 at 01:01:28 PM by trev

  • Resolution set to fixed
  • Status changed from reviewing to closed

comment:5 Changed on 06/27/2016 at 12:57:09 PM by Ross

  • Tester changed from Unknown to Ross
  • Verified working set

Element hiding seems to be working as expected except in Firefox 38-40, which is open as #4198.

Chrome 30 / 40 / 50 / Windows 7
Opera 19 / 36 / Windows 7
Safari 7 / 9 / / OS X 10.9 / OS X 10.11

Firefox 41-45 / Windows 7

Add Comment

Modify Ticket

Change Properties
as closed .
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from trev.
Note: See TracTickets for help on using tickets.