Opened 21 months ago

Last modified 2 months ago

#5146 reviewing change

[emscripten] Implement DownloadableSubscription.parseDownload()

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

https://codereview.adblockplus.org/29606600/
https://codereview.adblockplus.org/29630576/
https://gitlab.com/eyeo/adblockplus/adblockpluscore/merge_requests/6

Description (last modified by hfiguiere)

Background

In order to leave all text processing in C++ code, we need to process filter list downloads here as well.

What to change

Implement a new method DownloadableSubscription.parseDownload() as an extended replacement of FilterStorage.updateSubscriptionFilters(), to be called from Synchronizer._onDownloadSuccess and implement most of its logic. The method should return a _DownloadableSubscription_Parser instance:

  • buffer property is a pointer to the input buffer and bufferSize property its size (64kB?).
  • The buffer should be filled with lines of data followed by line breaks, until there is not enough space left for the next line or no more lines.
  • process(numChars) should be called to process the current buffer.
  • finalize() should be called in order to replace subscription filters. If delete() is called before finalize() the entire state is discarded and there is no effect on the subscription object.

There is a number of special cases here:

  • Filter list header: if invalid, subscription status should be set to synchronize_invalid_data and further input ignored - no filter replacement. Otherwise the version number from the header should be saved in requiredVersion property.
  • ! Checksum: comment: not saved as filter, checksum validation should be performed (MD5 implementation required). If it fails, status should be set to synchronize_checksum_mismatch and the filters not replaced. obsolete with issue 6849.
  • ! Redirect, ! Homepage, ! Title comments: value should be saved in the corresponding subscription field. This field needs to be added for redirects, its value should not be serialized and should be used as an indicator for Synchronizer that it needs to handle a redirect.
  • ! Expires comment: the value should be returned by finalize() so that Synchronizer can update the expiration data properly. If finalize() returns 0 the default expiration interval is used.
  • If filters are replaced, a notification with topic subscription.beforefiltersreplaced should be sent out before the list of filter changes and another with topic subscription.filtersreplaced after the new filters are in place. These notifications replace current subscription.updated notification.

Change History (8)

comment:1 Changed 21 months ago by trev

  • Description modified (diff)

comment:2 Changed 20 months ago by trev

  • Blocked By 5137 added

comment:3 Changed 14 months ago by hfiguiere

  • Owner set to hfiguiere

comment:4 Changed 14 months ago by hfiguiere

  • Review URL(s) modified (diff)

comment:5 Changed 14 months ago by oleksandr

  • Status changed from new to reviewing

comment:6 Changed 14 months ago by hfiguiere

  • Review URL(s) modified (diff)

comment:7 Changed 5 months ago by hfiguiere

  • Description modified (diff)

With issue 6849 and 6850 we don't need to deal with checksum anymore.

comment:8 Changed 2 months ago by hfiguiere

  • Review URL(s) modified (diff)
Note: See TracTickets for help on using tickets.