Loading CHANGELOG.md +8 −0 Original line number Diff line number Diff line # 88.0.4324.207 * add flag for save-data-header * add option to force tablet UI * fix bug with wrong last checked time (thanks to @uazo, fixes https://github.com/bromite/bromite/issues/941) * fix bug with adblock filters not being downloaded correctly (fixes https://github.com/bromite/bromite/issues/960) * move up bookmark all tabs menu item (fixes https://github.com/bromite/bromite/issues/943) * fix icons for exit and view source menu items # 88.0.4324.187 * fix exit menu item not working in tablet mode * add menu item to bookmark all tabs (fixes https://github.com/bromite/bromite/issues/570) Loading build/patches/Bromite-AdBlockUpdaterService.patch +13 −16 Original line number Diff line number Diff line Loading @@ -37,7 +37,7 @@ Fix RestoreForeignSessionTab by recreating the tab (issue #681) components/component_updater/BUILD.gn | 6 + .../adblock_updater_service.cc | 337 ++++++++++++++++++ .../adblock_updater_service.h | 126 +++++++ .../download_filters_task.cc | 236 ++++++++++++ .../download_filters_task.cc | 233 ++++++++++++ .../component_updater/download_filters_task.h | 131 +++++++ ...ent_subresource_filter_throttle_manager.cc | 11 + .../content/browser/ruleset_publisher.h | 2 + Loading @@ -50,7 +50,7 @@ Fix RestoreForeignSessionTab by recreating the tab (issue #681) .../browser/subresource_filter_features.cc | 113 +----- .../core/common/common_features.cc | 2 +- .../navigation_throttle_runner.cc | 5 - 41 files changed, 1678 insertions(+), 141 deletions(-) 41 files changed, 1675 insertions(+), 141 deletions(-) create mode 100644 chrome/android/java/res/layout/adblock_editor.xml create mode 100644 chrome/android/java/res/xml/adblock_preferences.xml create mode 100644 chrome/android/java/src/org/chromium/chrome/browser/settings/AdBlockEditor.java Loading Loading @@ -1248,16 +1248,16 @@ new file mode 100644 + +namespace adblock_updater { + +// Holds the URL to an indexed subresource filters file. +// Preference name for URL to an indexed subresource filters file. +const char kAdBlockFiltersURL[] = "adblock.filters_url"; + +// Holds the URL to an indexed subresource filters file. +// Preference name for the filters update frequency (in days). +const char kAdBlockFiltersCheckFrequency[] = "adblock.check_frequency"; + +// Last update check time +// Preference name for the last filters update check. +const char kAdBlockLastCheckTime[] = "adblock.last_check_time"; + +// Last successful update check time +// Preference name for the last successful filters update check. +const char kAdBlockLastCheckTimeOk[] = "adblock.last_check_time_ok"; + +const int initial_check_delay_in_seconds = 5, Loading Loading @@ -1675,7 +1675,7 @@ diff --git a/components/component_updater/download_filters_task.cc b/components/ new file mode 100644 --- /dev/null +++ b/components/component_updater/download_filters_task.cc @@ -0,0 +1,236 @@ @@ -0,0 +1,233 @@ +/* + This file is part of Bromite. + Loading Loading @@ -1737,6 +1737,8 @@ new file mode 100644 + if (filters_url.empty()) { + return; + } + + createSimpleURLLoader(!min_last_modified_.is_null()); +} + +void DownloadFiltersTask::createSimpleURLLoader(bool headers_only) { Loading @@ -1747,6 +1749,7 @@ new file mode 100644 + + auto resource_request = std::make_unique<network::ResourceRequest>(); + resource_request->url = filters_url_; + resource_request->credentials_mode = network::mojom::CredentialsMode::kOmit; + resource_request->load_flags = net::LOAD_BYPASS_CACHE | net::LOAD_DISABLE_CACHE | net::LOAD_DO_NOT_SAVE_COOKIES; + resource_request->credentials_mode = network::mojom::CredentialsMode::kOmit; + if (headers_only) Loading @@ -1772,8 +1775,7 @@ new file mode 100644 +void DownloadFiltersTask::Run() { + DCHECK(thread_checker_.CalledOnValidThread()); + + createSimpleURLLoader(true); + + // will not be initialized if the URL was empty + if (!simple_url_loader_) { + TaskComplete(AdblockError::INVALID_ARGUMENT); + return; Loading @@ -1791,8 +1793,6 @@ new file mode 100644 +} + +void DownloadFiltersTask::internalDownload() { + LOG(INFO) << "DownloadFiltersTask: Start downloading"; + + simple_url_loader_->DownloadToTempFile( + shared_url_network_factory_.get(), + base::BindOnce(&DownloadFiltersTask::OnDownloadComplete, base::Unretained(this)), Loading @@ -1807,7 +1807,6 @@ new file mode 100644 + } + + int net_error = simple_url_loader_->NetError(); + simple_url_loader_.reset(); + + if (net_error == 0) { + // ignoring 'headers' as 'Last-Modified' has already been picked up by OnResponseStarted Loading Loading @@ -1837,11 +1836,11 @@ new file mode 100644 + response_code_ = response_head.headers ? response_head.headers->response_code() : -1; + + if (!response_head.headers->GetLastModifiedValue(&last_modified_)) + LOG(WARNING) << "DownloadFiltersTask: fetched URL '" << final_url.spec() + LOG(WARNING) << "DownloadFiltersTask: fetching URL '" << final_url.spec() + << "' with method " << (min_last_modified_.is_null() ? "GET" : "HEAD") + << " (no Last-Modified header)"; + else + LOG(INFO) << "DownloadFiltersTask: fetched URL '" << final_url.spec() + LOG(INFO) << "DownloadFiltersTask: fetching URL '" << final_url.spec() + << "' with method " << (min_last_modified_.is_null() ? "GET" : "HEAD") + << " response_code " << response_code_ + << " last_modified " << last_modified_; Loading Loading @@ -1870,8 +1869,6 @@ new file mode 100644 + error = net_error; + } + + simple_url_loader_.reset(); + + LOG(INFO) << "DownloadFiltersTask: downloaded " << content_size << " bytes in " + << download_time.InMilliseconds() << "ms from '" << final_url_.spec() + << "' to '" << file_path << "' with net_error " << net_error << " and error " << error; Loading Loading
CHANGELOG.md +8 −0 Original line number Diff line number Diff line # 88.0.4324.207 * add flag for save-data-header * add option to force tablet UI * fix bug with wrong last checked time (thanks to @uazo, fixes https://github.com/bromite/bromite/issues/941) * fix bug with adblock filters not being downloaded correctly (fixes https://github.com/bromite/bromite/issues/960) * move up bookmark all tabs menu item (fixes https://github.com/bromite/bromite/issues/943) * fix icons for exit and view source menu items # 88.0.4324.187 * fix exit menu item not working in tablet mode * add menu item to bookmark all tabs (fixes https://github.com/bromite/bromite/issues/570) Loading
build/patches/Bromite-AdBlockUpdaterService.patch +13 −16 Original line number Diff line number Diff line Loading @@ -37,7 +37,7 @@ Fix RestoreForeignSessionTab by recreating the tab (issue #681) components/component_updater/BUILD.gn | 6 + .../adblock_updater_service.cc | 337 ++++++++++++++++++ .../adblock_updater_service.h | 126 +++++++ .../download_filters_task.cc | 236 ++++++++++++ .../download_filters_task.cc | 233 ++++++++++++ .../component_updater/download_filters_task.h | 131 +++++++ ...ent_subresource_filter_throttle_manager.cc | 11 + .../content/browser/ruleset_publisher.h | 2 + Loading @@ -50,7 +50,7 @@ Fix RestoreForeignSessionTab by recreating the tab (issue #681) .../browser/subresource_filter_features.cc | 113 +----- .../core/common/common_features.cc | 2 +- .../navigation_throttle_runner.cc | 5 - 41 files changed, 1678 insertions(+), 141 deletions(-) 41 files changed, 1675 insertions(+), 141 deletions(-) create mode 100644 chrome/android/java/res/layout/adblock_editor.xml create mode 100644 chrome/android/java/res/xml/adblock_preferences.xml create mode 100644 chrome/android/java/src/org/chromium/chrome/browser/settings/AdBlockEditor.java Loading Loading @@ -1248,16 +1248,16 @@ new file mode 100644 + +namespace adblock_updater { + +// Holds the URL to an indexed subresource filters file. +// Preference name for URL to an indexed subresource filters file. +const char kAdBlockFiltersURL[] = "adblock.filters_url"; + +// Holds the URL to an indexed subresource filters file. +// Preference name for the filters update frequency (in days). +const char kAdBlockFiltersCheckFrequency[] = "adblock.check_frequency"; + +// Last update check time +// Preference name for the last filters update check. +const char kAdBlockLastCheckTime[] = "adblock.last_check_time"; + +// Last successful update check time +// Preference name for the last successful filters update check. +const char kAdBlockLastCheckTimeOk[] = "adblock.last_check_time_ok"; + +const int initial_check_delay_in_seconds = 5, Loading Loading @@ -1675,7 +1675,7 @@ diff --git a/components/component_updater/download_filters_task.cc b/components/ new file mode 100644 --- /dev/null +++ b/components/component_updater/download_filters_task.cc @@ -0,0 +1,236 @@ @@ -0,0 +1,233 @@ +/* + This file is part of Bromite. + Loading Loading @@ -1737,6 +1737,8 @@ new file mode 100644 + if (filters_url.empty()) { + return; + } + + createSimpleURLLoader(!min_last_modified_.is_null()); +} + +void DownloadFiltersTask::createSimpleURLLoader(bool headers_only) { Loading @@ -1747,6 +1749,7 @@ new file mode 100644 + + auto resource_request = std::make_unique<network::ResourceRequest>(); + resource_request->url = filters_url_; + resource_request->credentials_mode = network::mojom::CredentialsMode::kOmit; + resource_request->load_flags = net::LOAD_BYPASS_CACHE | net::LOAD_DISABLE_CACHE | net::LOAD_DO_NOT_SAVE_COOKIES; + resource_request->credentials_mode = network::mojom::CredentialsMode::kOmit; + if (headers_only) Loading @@ -1772,8 +1775,7 @@ new file mode 100644 +void DownloadFiltersTask::Run() { + DCHECK(thread_checker_.CalledOnValidThread()); + + createSimpleURLLoader(true); + + // will not be initialized if the URL was empty + if (!simple_url_loader_) { + TaskComplete(AdblockError::INVALID_ARGUMENT); + return; Loading @@ -1791,8 +1793,6 @@ new file mode 100644 +} + +void DownloadFiltersTask::internalDownload() { + LOG(INFO) << "DownloadFiltersTask: Start downloading"; + + simple_url_loader_->DownloadToTempFile( + shared_url_network_factory_.get(), + base::BindOnce(&DownloadFiltersTask::OnDownloadComplete, base::Unretained(this)), Loading @@ -1807,7 +1807,6 @@ new file mode 100644 + } + + int net_error = simple_url_loader_->NetError(); + simple_url_loader_.reset(); + + if (net_error == 0) { + // ignoring 'headers' as 'Last-Modified' has already been picked up by OnResponseStarted Loading Loading @@ -1837,11 +1836,11 @@ new file mode 100644 + response_code_ = response_head.headers ? response_head.headers->response_code() : -1; + + if (!response_head.headers->GetLastModifiedValue(&last_modified_)) + LOG(WARNING) << "DownloadFiltersTask: fetched URL '" << final_url.spec() + LOG(WARNING) << "DownloadFiltersTask: fetching URL '" << final_url.spec() + << "' with method " << (min_last_modified_.is_null() ? "GET" : "HEAD") + << " (no Last-Modified header)"; + else + LOG(INFO) << "DownloadFiltersTask: fetched URL '" << final_url.spec() + LOG(INFO) << "DownloadFiltersTask: fetching URL '" << final_url.spec() + << "' with method " << (min_last_modified_.is_null() ? "GET" : "HEAD") + << " response_code " << response_code_ + << " last_modified " << last_modified_; Loading Loading @@ -1870,8 +1869,6 @@ new file mode 100644 + error = net_error; + } + + simple_url_loader_.reset(); + + LOG(INFO) << "DownloadFiltersTask: downloaded " << content_size << " bytes in " + << download_time.InMilliseconds() << "ms from '" << final_url_.spec() + << "' to '" << file_path << "' with net_error " << net_error << " and error " << error; Loading