diff --git a/build/patches/Bromite-subresource-adblocker.patch b/build/patches/Bromite-subresource-adblocker.patch index fb065289..8d105330 100644 --- a/build/patches/Bromite-subresource-adblocker.patch +++ b/build/patches/Bromite-subresource-adblocker.patch @@ -32,7 +32,7 @@ License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html .../flags/android/cached_feature_flags.cc | 11 + .../browser/flags/CachedFeatureFlags.java | 10 + .../net/system_network_context_manager.cc | 4 + - .../sessions/session_restore_android.cc | 4 +- + .../sessions/session_restore_android.cc | 6 +- .../strings/android_chrome_strings.grd | 14 + chrome/common/pref_names.cc | 3 + chrome/common/pref_names.h | 1 + @@ -43,14 +43,15 @@ License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html .../download_filters_task.cc | 239 ++++++++++++++++ .../component_updater/download_filters_task.h | 129 +++++++++ ...ent_subresource_filter_throttle_manager.cc | 11 + - .../content/browser/ruleset_service.cc | 33 ++- + .../content/browser/ruleset_service.cc | 42 ++- .../content/browser/ruleset_service.h | 7 +- .../content/browser/ruleset_version.h | 4 + + .../unindexed_ruleset_stream_generator.cc | 3 + .../browser/verified_ruleset_dealer.cc | 4 + .../browser/subresource_filter_features.cc | 116 +------- .../core/common/indexed_ruleset.cc | 5 +- third_party/blink/common/features.cc | 12 +- - 38 files changed, 1175 insertions(+), 130 deletions(-) + 39 files changed, 1184 insertions(+), 135 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 @@ -641,17 +642,19 @@ diff --git a/chrome/browser/net/system_network_context_manager.cc b/chrome/brows diff --git a/chrome/browser/sessions/session_restore_android.cc b/chrome/browser/sessions/session_restore_android.cc --- a/chrome/browser/sessions/session_restore_android.cc +++ b/chrome/browser/sessions/session_restore_android.cc -@@ -56,7 +56,9 @@ content::WebContents* SessionRestore::RestoreForeignSessionTab( +@@ -56,8 +56,10 @@ content::WebContents* SessionRestore::RestoreForeignSessionTab( DCHECK(current_tab); // If swapped, return the current tab's most up-to-date web contents. if (disposition == WindowOpenDisposition::CURRENT_TAB) { - current_tab->SwapWebContents(std::move(new_web_contents), false, false); +- return current_tab->web_contents(); + int active_tab_index = tab_model->GetActiveIndex(); + tab_model->CreateTab(current_tab, new_web_contents.release()); + tab_model->CloseTabAt(active_tab_index); - return current_tab->web_contents(); ++ return raw_new_web_contents; } DCHECK(disposition == WindowOpenDisposition::NEW_FOREGROUND_TAB || + disposition == WindowOpenDisposition::NEW_BACKGROUND_TAB); diff --git a/chrome/browser/ui/android/strings/android_chrome_strings.grd b/chrome/browser/ui/android/strings/android_chrome_strings.grd --- a/chrome/browser/ui/android/strings/android_chrome_strings.grd +++ b/chrome/browser/ui/android/strings/android_chrome_strings.grd @@ -1595,7 +1598,22 @@ diff --git a/components/subresource_filter/content/browser/ruleset_service.cc b/ RecordIndexAndWriteRulesetResult( IndexAndWriteRulesetResult::FAILED_CREATING_VERSION_DIR); return IndexedRulesetVersion(); -@@ -311,6 +329,7 @@ IndexedRulesetVersion RulesetService::IndexAndWriteRuleset( +@@ -293,12 +311,11 @@ IndexedRulesetVersion RulesetService::IndexAndWriteRuleset( + + SentinelFile sentinel_file(indexed_ruleset_version_dir); + if (sentinel_file.IsPresent()) { +- RecordIndexAndWriteRulesetResult( +- IndexAndWriteRulesetResult::ABORTED_BECAUSE_SENTINEL_FILE_PRESENT); +- return IndexedRulesetVersion(); ++ LOG(WARNING) << "RulesetService: sentinel file is present in " << indexed_ruleset_version_dir; + } + + if (!sentinel_file.Create()) { ++ LOG(WARNING) << "RulesetService: cannot create sentinel file in " << indexed_ruleset_version_dir; + RecordIndexAndWriteRulesetResult( + IndexAndWriteRulesetResult::FAILED_CREATING_SENTINEL_FILE); + return IndexedRulesetVersion(); +@@ -311,6 +328,7 @@ IndexedRulesetVersion RulesetService::IndexAndWriteRuleset( RulesetIndexer indexer; if (!(*g_index_ruleset_func)(&unindexed_ruleset_stream_generator, &indexer)) { @@ -1603,16 +1621,21 @@ diff --git a/components/subresource_filter/content/browser/ruleset_service.cc b/ RecordIndexAndWriteRulesetResult( IndexAndWriteRulesetResult::FAILED_PARSING_UNINDEXED_RULESET); return IndexedRulesetVersion(); -@@ -331,6 +350,8 @@ IndexedRulesetVersion RulesetService::IndexAndWriteRuleset( - if (result != IndexAndWriteRulesetResult::SUCCESS) +@@ -328,8 +346,12 @@ IndexedRulesetVersion RulesetService::IndexAndWriteRuleset( + indexed_ruleset_version_dir, unindexed_ruleset_info.license_path, + indexer.data(), indexer.size()); + RecordIndexAndWriteRulesetResult(result); +- if (result != IndexAndWriteRulesetResult::SUCCESS) ++ if (result != IndexAndWriteRulesetResult::SUCCESS) { ++ LOG(INFO) << "RulesetService: failed to index."; return IndexedRulesetVersion(); - -+ LOG(INFO) << "RulesetService: successful parsing."; ++ } + ++ LOG(INFO) << "RulesetService: successful parsing."; + DCHECK(indexed_version.IsValid()); return indexed_version; - } -@@ -453,6 +474,7 @@ void RulesetService::IndexAndStoreRuleset( +@@ -453,6 +475,7 @@ void RulesetService::IndexAndStoreRuleset( void RulesetService::OnWrittenRuleset(WriteRulesetCallback result_callback, const IndexedRulesetVersion& version) { DCHECK(!result_callback.is_null()); @@ -1620,7 +1643,7 @@ diff --git a/components/subresource_filter/content/browser/ruleset_service.cc b/ if (!version.IsValid()) return; version.SaveToPrefs(local_state_); -@@ -465,7 +487,6 @@ void RulesetService::OpenAndPublishRuleset( +@@ -465,7 +488,6 @@ void RulesetService::OpenAndPublishRuleset( IndexedRulesetLocator::GetRulesetDataFilePath( IndexedRulesetLocator::GetSubdirectoryPathForVersion( indexed_ruleset_base_dir_, version)); @@ -1666,6 +1689,26 @@ diff --git a/components/subresource_filter/content/browser/ruleset_version.h b/c }; // Encapsulates the combination of the binary format version of the indexed +diff --git a/components/subresource_filter/content/browser/unindexed_ruleset_stream_generator.cc b/components/subresource_filter/content/browser/unindexed_ruleset_stream_generator.cc +--- a/components/subresource_filter/content/browser/unindexed_ruleset_stream_generator.cc ++++ b/components/subresource_filter/content/browser/unindexed_ruleset_stream_generator.cc +@@ -12,6 +12,7 @@ + #include "third_party/protobuf/src/google/protobuf/io/zero_copy_stream_impl.h" + #include "third_party/protobuf/src/google/protobuf/io/zero_copy_stream_impl_lite.h" + #include "ui/base/resource/resource_bundle.h" ++#include "base/logging.h" + + namespace subresource_filter { + +@@ -46,6 +47,8 @@ void UnindexedRulesetStreamGenerator::GenerateStreamFromFile( + + ruleset_size_ = unindexed_ruleset_file.GetLength(); + ++ LOG(INFO) << "Opened " << ruleset_path << " size " << ruleset_size_; ++ + copying_stream_ = std::make_unique( + std::move(unindexed_ruleset_file)); + ruleset_stream_ = diff --git a/components/subresource_filter/content/browser/verified_ruleset_dealer.cc b/components/subresource_filter/content/browser/verified_ruleset_dealer.cc --- a/components/subresource_filter/content/browser/verified_ruleset_dealer.cc +++ b/components/subresource_filter/content/browser/verified_ruleset_dealer.cc