Opened 3 years ago

Last modified 3 months ago

#5146 closed change

[emscripten] Implement DownloadableSubscription.parseDownload() — at Initial Version

Reported by: trev Assignee:
Priority: P3 Milestone:
Module: Core Keywords: closed-in-favor-of-gitlab
Cc: Blocked By:
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

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.
  • ! 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.

Change History (0)

Note: See TracTickets for help on using tickets.