Pārlūkot izejas kodu

Release 102.0.5005.67

csagan5 3 gadi atpakaļ
vecāks
revīzija
cd52789b01

+ 5 - 0
CHANGELOG.md

@@ -1,3 +1,8 @@
+# 102.0.5005.67
+* dropped patch to disable mobile identity consistency by default
+* fix text for blocked ads (fixes https://github.com/bromite/bromite/issues/2026)
+* fix OpenSeach visited site detection bug (fixes https://github.com/bromite/bromite/issues/1994)
+
 # 101.0.4951.69
 * flag to toggle site engagement (thanks to @uazo, fixes https://github.com/bromite/bromite/issues/2022)
 * site settings to enable webGL (thanks to @uazo)

+ 27 - 17
build/patches/Add-an-always-incognito-mode.patch

@@ -38,11 +38,11 @@ See also: https://github.com/bromite/bromite/pull/1427
  .../browser/settings/SettingsActivity.java    |   4 +
  .../HistoricalTabModelObserver.java           |   8 +-
  .../tab/tab_restore/HistoricalTabSaver.java   |   2 +-
- .../tab_restore/HistoricalTabSaverImpl.java   |  12 +-
+ .../tab_restore/HistoricalTabSaverImpl.java   |  16 +-
  .../tabbed_mode/TabbedRootUiCoordinator.java  |   5 +-
  .../browser/tabmodel/ChromeTabCreator.java    |   5 +-
  .../tabmodel/TabModelSelectorImpl.java        |   3 +
- .../browser/tabmodel/TabPersistentStore.java  |  10 ++
+ .../browser/tabmodel/TabPersistentStore.java  |   9 +
  .../webapps/WebappIntentDataProvider.java     |  14 ++
  chrome/browser/about_flags.cc                 |   4 +
  .../browser/android/historical_tab_saver.cc   |  21 ++-
@@ -80,7 +80,7 @@ See also: https://github.com/bromite/bromite/pull/1427
  .../omnibox/browser/base_search_provider.cc   |   2 +-
  components/omnibox/browser/search_provider.cc |   4 +-
  .../host_content_settings_map_factory.cc      |   1 +
- 64 files changed, 686 insertions(+), 74 deletions(-)
+ 64 files changed, 688 insertions(+), 75 deletions(-)
  create mode 100644 chrome/android/java/res/xml/incognito_preferences.xml
  create mode 100644 chrome/android/java/src/org/chromium/chrome/browser/AlwaysIncognitoLinkInterceptor.java
  create mode 100644 chrome/android/java/src/org/chromium/chrome/browser/privacy/settings/IncognitoSettings.java
@@ -885,7 +885,16 @@ diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tab/tab_restore
 diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tab/tab_restore/HistoricalTabSaverImpl.java b/chrome/android/java/src/org/chromium/chrome/browser/tab/tab_restore/HistoricalTabSaverImpl.java
 --- a/chrome/android/java/src/org/chromium/chrome/browser/tab/tab_restore/HistoricalTabSaverImpl.java
 +++ b/chrome/android/java/src/org/chromium/chrome/browser/tab/tab_restore/HistoricalTabSaverImpl.java
-@@ -46,10 +46,10 @@ public class HistoricalTabSaverImpl implements HistoricalTabSaver {
+@@ -25,6 +25,8 @@ import java.util.Arrays;
+ import java.util.Collections;
+ import java.util.List;
+ 
++import org.chromium.chrome.browser.AlwaysIncognitoLinkInterceptor;
++
+ /**
+  * Creates historical entries in TabRestoreService.
+  */
+@@ -46,10 +48,10 @@ public class HistoricalTabSaverImpl implements HistoricalTabSaver {
  
      // HistoricalTabSaver implementation.
      @Override
@@ -898,7 +907,7 @@ diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tab/tab_restore
      }
  
      @Override
-@@ -90,7 +90,7 @@ public class HistoricalTabSaverImpl implements HistoricalTabSaver {
+@@ -90,7 +92,7 @@ public class HistoricalTabSaverImpl implements HistoricalTabSaver {
  
          // If there is only a single valid tab remaining save it individually.
          if (validEntries.size() == 1 && validEntries.get(0).isSingleTab()) {
@@ -907,7 +916,7 @@ diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tab/tab_restore
              return;
          }
  
-@@ -107,8 +107,8 @@ public class HistoricalTabSaverImpl implements HistoricalTabSaver {
+@@ -107,8 +109,8 @@ public class HistoricalTabSaverImpl implements HistoricalTabSaver {
                  CollectionUtil.integerListToIntArray(perTabGroupId), allTabs.toArray(new Tab[0]));
      }
  
@@ -918,7 +927,16 @@ diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tab/tab_restore
      }
  
      /**
-@@ -194,7 +194,7 @@ public class HistoricalTabSaverImpl implements HistoricalTabSaver {
+@@ -116,7 +118,7 @@ public class HistoricalTabSaverImpl implements HistoricalTabSaver {
+      * internal Chrome scheme, about:blank, or a native page and it cannot be incognito.
+      */
+     private boolean shouldSave(Tab tab) {
+-        if (tab.isIncognito()) return false;
++        if (tab.isIncognito() && !AlwaysIncognitoLinkInterceptor.isAlwaysIncognito()) return false;
+ 
+         // {@link GURL#getScheme()} is not available in unit tests.
+         if (mIgnoreUrlSchemesForTesting) return true;
+@@ -194,7 +196,7 @@ public class HistoricalTabSaverImpl implements HistoricalTabSaver {
  
      @NativeMethods
      interface Natives {
@@ -998,15 +1016,7 @@ diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabMod
 diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabPersistentStore.java b/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabPersistentStore.java
 --- a/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabPersistentStore.java
 +++ b/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabPersistentStore.java
-@@ -18,6 +18,7 @@ import androidx.core.util.AtomicFile;
- 
- import org.chromium.base.Callback;
- import org.chromium.base.CallbackController;
-+import org.chromium.base.ContextUtils;
- import org.chromium.base.FeatureList;
- import org.chromium.base.Log;
- import org.chromium.base.ObserverList;
-@@ -58,6 +59,8 @@ import org.chromium.content_public.browser.LoadUrlParams;
+@@ -58,6 +58,8 @@ import org.chromium.content_public.browser.LoadUrlParams;
  import org.chromium.content_public.browser.UiThreadTaskTraits;
  import org.chromium.url.GURL;
  
@@ -1015,7 +1025,7 @@ diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabPer
  import java.io.BufferedInputStream;
  import java.io.ByteArrayInputStream;
  import java.io.ByteArrayOutputStream;
-@@ -739,6 +742,13 @@ public class TabPersistentStore {
+@@ -739,6 +741,13 @@ public class TabPersistentStore {
                  }
              }
          }

+ 9 - 9
build/patches/Ask-user-before-closing-all-tabs.patch

@@ -9,16 +9,16 @@ Subject: Ask user before closing all tabs
 diff --git a/chrome/browser/flags/android/chrome_feature_list.cc b/chrome/browser/flags/android/chrome_feature_list.cc
 --- a/chrome/browser/flags/android/chrome_feature_list.cc
 +++ b/chrome/browser/flags/android/chrome_feature_list.cc
-@@ -457,8 +457,8 @@ const base::Feature kCastDeviceFilter{"CastDeviceFilter",
- const base::Feature kCloseAllTabsModalDialog{"CloseAllTabsModalDialog",
-                                              base::FEATURE_ENABLED_BY_DEFAULT};
+@@ -454,8 +454,8 @@ const base::Feature kConditionalTabStripAndroid{
+ const base::Feature kCastDeviceFilter{"CastDeviceFilter",
+                                       base::FEATURE_DISABLED_BY_DEFAULT};
  
--const base::Feature kCloseTabSuggestions{"CloseTabSuggestions",
--                                         base::FEATURE_DISABLED_BY_DEFAULT};
-+const base::Feature kCloseTabSuggestions{"CloseTabSuggestions",              // Enabled by default in Bromite
-+                                         base::FEATURE_ENABLED_BY_DEFAULT};
+-const base::Feature kCloseAllTabsModalDialog{"CloseAllTabsModalDialog",
+-                                             base::FEATURE_ENABLED_BY_DEFAULT};
++const base::Feature kCloseAllTabsModalDialog{"CloseAllTabsModalDialog",         // Enabled by default in Bromite
++                                             base::FEATURE_ENABLED_BY_DEFAULT}; // ^
  
- const base::Feature kCriticalPersistedTabData{
-     "CriticalPersistedTabData", base::FEATURE_DISABLED_BY_DEFAULT};
+ const base::Feature kCloseTabSuggestions{"CloseTabSuggestions",
+                                          base::FEATURE_DISABLED_BY_DEFAULT};
 --
 2.25.1

+ 16 - 1
build/patches/Bromite-AdBlockUpdaterService.patch

@@ -32,6 +32,7 @@ Fix RestoreForeignSessionTab by recreating the tab (issue #681)
  .../strings/android_chrome_strings.grd        |  14 +
  chrome/common/pref_names.cc                   |   3 +
  chrome/common/pref_names.h                    |   1 +
+ .../strings/android/site_settings.grdp        |   4 +-
  components/component_updater/BUILD.gn         |   7 +
  .../adblock_updater_service.cc                | 271 ++++++++++++++++++
  .../adblock_updater_service.h                 | 100 +++++++
@@ -45,7 +46,7 @@ Fix RestoreForeignSessionTab by recreating the tab (issue #681)
  .../browser/subresource_filter_features.cc    | 113 +-------
  .../core/common/indexed_ruleset.cc            |   5 +-
  .../navigation_throttle_runner.cc             |   5 -
- 36 files changed, 1158 insertions(+), 124 deletions(-)
+ 37 files changed, 1160 insertions(+), 126 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
@@ -685,6 +686,20 @@ diff --git a/chrome/common/pref_names.h b/chrome/common/pref_names.h
  extern const char kHttpsOnlyModeEnabled[];
  extern const char kImportantSitesDialogHistory[];
  extern const char kProfileCreationTime[];
+diff --git a/components/browser_ui/strings/android/site_settings.grdp b/components/browser_ui/strings/android/site_settings.grdp
+--- a/components/browser_ui/strings/android/site_settings.grdp
++++ b/components/browser_ui/strings/android/site_settings.grdp
+@@ -247,8 +247,8 @@
+   <message name="IDS_INTRUSIVE_ADS_INFORMATION" desc="The extra information at the top of the Site Details page when the site tends to show intrusive ads">
+     This site shows intrusive or misleading ads
+   </message>
+-  <message name="IDS_WEBSITE_SETTINGS_CATEGORY_ADS_BLOCKED" desc="A setting that, if turned on, will block intrusive or misleading ads on sites that have a history of showing such ads.">
+-    Block ads on sites that show intrusive or misleading ads
++  <message name="IDS_WEBSITE_SETTINGS_CATEGORY_ADS_BLOCKED" desc="A setting that, if turned on, will block ads.">
++    Block ads based on the current filters
+   </message>
+   <message name="IDS_WEBSITE_SETTINGS_CATEGORY_ADS_BLOCKED_LIST" desc="Summary text explaining that the Ads permission is set to block ads on some sites. To be shown in the list of permission categories.">
+     Blocked on some sites
 diff --git a/components/component_updater/BUILD.gn b/components/component_updater/BUILD.gn
 --- a/components/component_updater/BUILD.gn
 +++ b/components/component_updater/BUILD.gn

+ 13 - 1
build/patches/Disable-conversion-measurement-api.patch

@@ -12,13 +12,14 @@ being sent and being saved to disk, although it is currently in uncalled code.
  .../embedder_support/origin_trials/features.cc  |  3 ++-
  .../render_view_context_menu_base.cc            |  3 ---
  .../aggregatable_report_sender.cc               | 17 ++++++++---------
+ .../attribution_reporting/attribution_host.cc   |  1 +
  .../attribution_report_network_sender.cc        | 15 ++++++++-------
  .../attribution_storage_sql.cc                  |  2 +-
  content/browser/storage_partition_impl.cc       |  7 +------
  content/public/browser/navigation_controller.cc |  1 -
  third_party/blink/common/features.cc            |  2 +-
  .../platform/runtime_enabled_features.json5     |  9 ++++++++-
- 10 files changed, 30 insertions(+), 31 deletions(-)
+ 11 files changed, 31 insertions(+), 31 deletions(-)
 
 diff --git a/chrome/browser/flags/android/chrome_feature_list.cc b/chrome/browser/flags/android/chrome_feature_list.cc
 --- a/chrome/browser/flags/android/chrome_feature_list.cc
@@ -96,6 +97,17 @@ diff --git a/content/browser/aggregation_service/aggregatable_report_sender.cc b
 -}  // namespace content
 \ No newline at end of file
 +}  // namespace content
+diff --git a/content/browser/attribution_reporting/attribution_host.cc b/content/browser/attribution_reporting/attribution_host.cc
+--- a/content/browser/attribution_reporting/attribution_host.cc
++++ b/content/browser/attribution_reporting/attribution_host.cc
+@@ -141,6 +141,7 @@ void AttributionHost::DidFinishNavigation(NavigationHandle* navigation_handle) {
+     return;
+   }
+ 
++  if ((true)) return;
+   AttributionManager* attribution_manager =
+       attribution_manager_provider_->GetManager(web_contents());
+   if (!attribution_manager) {
 diff --git a/content/browser/attribution_reporting/attribution_report_network_sender.cc b/content/browser/attribution_reporting/attribution_report_network_sender.cc
 --- a/content/browser/attribution_reporting/attribution_report_network_sender.cc
 +++ b/content/browser/attribution_reporting/attribution_report_network_sender.cc

+ 1 - 1
build/patches/Keep-empty-tabs-between-sessions.patch

@@ -10,7 +10,7 @@ Subject: Keep empty tabs between sessions
 diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabPersistentStore.java b/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabPersistentStore.java
 --- a/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabPersistentStore.java
 +++ b/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabPersistentStore.java
-@@ -797,19 +797,6 @@ public class TabPersistentStore {
+@@ -796,19 +796,6 @@ public class TabPersistentStore {
                  mTabsToMigrate.add(tab);
              }
          } else {

+ 6 - 6
build/patches/Move-navigation-bar-to-bottom.patch

@@ -2316,14 +2316,14 @@ diff --git a/content/browser/renderer_host/render_widget_host_view_android.cc b/
  #include "cc/base/math_util.h"
  #include "cc/layers/layer.h"
  #include "cc/layers/surface_layer.h"
-@@ -461,6 +462,8 @@ void RenderWidgetHostViewAndroid::OnRenderFrameMetadataChangedBeforeActivation(
-     ime_adapter_android_->UpdateFrameInfo(metadata.selection.start, dip_scale,
-                                           top_shown_pix);
-   }
+@@ -455,6 +456,8 @@ void RenderWidgetHostViewAndroid::OnRenderFrameMetadataChangedBeforeActivation(
+   // factor. Thus, |top_content_offset| in CSS pixels is also in DIPs.
+   float top_content_offset =
+       metadata.top_controls_height * metadata.top_controls_shown_ratio;
 +  if (base::FeatureList::IsEnabled(::features::kMoveTopToolbarToBottom))
 +    top_content_offset = 0;
+   float top_shown_pix = top_content_offset;
  
-   if (!gesture_listener_manager_)
-     return;
+   if (ime_adapter_android_) {
 --
 2.25.1

+ 62 - 33
build/patches/OpenSearch-miscellaneous.patch

@@ -9,13 +9,12 @@ Allow adding search engines in incognito mode
 Allow using search engine URLs with non-empty paths
 Add verbose logging
 ---
- .../settings/SearchEngineAdapter.java         |  4 ++-
- .../search_engine_tab_helper.cc               | 34 +++++++++++++------
- .../renderer/chrome_render_frame_observer.cc  |  2 ++
- .../search_engines/template_url_fetcher.cc    | 23 ++++++++++---
- .../search_engines/template_url_service.cc    |  1 -
- .../search_engines/template_url_service.h     |  8 ++---
- 6 files changed, 51 insertions(+), 21 deletions(-)
+ .../settings/SearchEngineAdapter.java         |  4 +-
+ .../search_engine_tab_helper.cc               | 51 ++++++++++++++-----
+ .../renderer/chrome_render_frame_observer.cc  |  2 +
+ .../search_engines/template_url_fetcher.cc    | 23 +++++++--
+ .../search_engines/template_url_service.h     |  8 +--
+ 5 files changed, 65 insertions(+), 23 deletions(-)
 
 diff --git a/chrome/browser/search_engines/android/java/src/org/chromium/chrome/browser/search_engines/settings/SearchEngineAdapter.java b/chrome/browser/search_engines/android/java/src/org/chromium/chrome/browser/search_engines/settings/SearchEngineAdapter.java
 --- a/chrome/browser/search_engines/android/java/src/org/chromium/chrome/browser/search_engines/settings/SearchEngineAdapter.java
@@ -25,7 +24,7 @@ diff --git a/chrome/browser/search_engines/android/java/src/org/chromium/chrome/
              }
              if (recentEngineNum < MAX_RECENT_ENGINE_NUM
 -                    && templateUrl.getLastVisitedTime() > displayTime) {
-+                    // just-added search engines have never been visited
++                    // newly added search engines have never been visited
 +                    && (templateUrl.getLastVisitedTime() == 0 ||
 +                        templateUrl.getLastVisitedTime() > displayTime)) {
                  recentEngineNum++;
@@ -34,22 +33,21 @@ diff --git a/chrome/browser/search_engines/android/java/src/org/chromium/chrome/
 diff --git a/chrome/browser/ui/search_engines/search_engine_tab_helper.cc b/chrome/browser/ui/search_engines/search_engine_tab_helper.cc
 --- a/chrome/browser/ui/search_engines/search_engine_tab_helper.cc
 +++ b/chrome/browser/ui/search_engines/search_engine_tab_helper.cc
-@@ -6,6 +6,8 @@
+@@ -6,6 +6,7 @@
  
  #include <memory>
  
-+#include "base/logging.h"
 +#include "base/logging.h"
  #include "base/metrics/histogram_macros.h"
  #include "chrome/browser/favicon/favicon_utils.h"
  #include "chrome/browser/profiles/profile.h"
-@@ -69,16 +71,20 @@ std::u16string SearchEngineTabHelper::GenerateKeywordFromNavigationEntry(
+@@ -69,16 +70,20 @@ std::u16string SearchEngineTabHelper::GenerateKeywordFromNavigationEntry(
      NavigationEntry* entry) {
    // Don't autogenerate keywords for pages that are the result of form
    // submissions.
 -  if (IsFormSubmit(entry))
 +  if (IsFormSubmit(entry)) {
-+    LOG(INFO) << "OpenSearch: cannot generate keyword for a form submission";
++    LOG(INFO) << "OpenSearch: cannot generate keyword for a form submission for entry " << entry->GetURL();
      return std::u16string();
 +  }
  
@@ -60,13 +58,13 @@ diff --git a/chrome/browser/ui/search_engines/search_engine_tab_helper.cc b/chro
      url = entry->GetURL();
 -    if (!url.is_valid())
 +    if (!url.is_valid()) {
-+      LOG(INFO) << "OpenSearch: user-typed/entry URL are invalid";
++      LOG(INFO) << "OpenSearch: user-typed/entry URL are invalid for entry " << entry->GetURL();
        return std::u16string();
 +    }
    }
  
    // Don't autogenerate keywords for referrers that
-@@ -86,10 +92,10 @@ std::u16string SearchEngineTabHelper::GenerateKeywordFromNavigationEntry(
+@@ -86,10 +91,10 @@ std::u16string SearchEngineTabHelper::GenerateKeywordFromNavigationEntry(
    // b) have a path.
    //
    // If we relax the path constraint, we need to be sure to sanitize the path
@@ -76,17 +74,17 @@ diff --git a/chrome/browser/ui/search_engines/search_engine_tab_helper.cc b/chro
 -  if (!(url.SchemeIs(url::kHttpScheme) || url.SchemeIs(url::kHttpsScheme)) ||
 -      (url.path().length() > 1)) {
 +  if (!(url.SchemeIs(url::kHttpScheme) || url.SchemeIs(url::kHttpsScheme))) {
-+    LOG(INFO) << "OpenSearch: invalid scheme";
++    LOG(INFO) << "OpenSearch: invalid scheme for entry " << entry->GetURL();
      return std::u16string();
    }
  
-@@ -116,22 +122,27 @@ void SearchEngineTabHelper::PageHasOpenSearchDescriptionDocument(
+@@ -116,22 +121,27 @@ void SearchEngineTabHelper::PageHasOpenSearchDescriptionDocument(
  
    // Only accept messages from the main frame.
    if (osdd_handler_receivers_.GetCurrentTargetFrame() !=
 -      web_contents()->GetMainFrame())
 +      web_contents()->GetMainFrame()) {
-+    LOG(INFO) << "OpenSearch: frame mismatch";
++    LOG(INFO) << "OpenSearch: frame mismatch on page " << page_url;
      return;
 +  }
  
@@ -96,7 +94,7 @@ diff --git a/chrome/browser/ui/search_engines/search_engine_tab_helper.cc b/chro
    // urls referring to osdd urls with same schemes.
 -  if (!osdd_url.is_valid() || !osdd_url.SchemeIsHTTPOrHTTPS())
 +  if (!osdd_url.is_valid() || !osdd_url.SchemeIsHTTPOrHTTPS()) {
-+    LOG(INFO) << "OpenSearch: not a valid OSDD URL";
++    LOG(INFO) << "OpenSearch: not a valid OSDD URL " << osdd_url;
      return;
 +  }
  
@@ -106,25 +104,38 @@ diff --git a/chrome/browser/ui/search_engines/search_engine_tab_helper.cc b/chro
 -      !TemplateURLFetcherFactory::GetForProfile(profile) ||
 -      profile->IsOffTheRecord())
 +      !TemplateURLFetcherFactory::GetForProfile(profile)) {
-+    LOG(INFO) << "OpenSearch: page URL mismatch";
++    LOG(INFO) << "OpenSearch: page URL mismatch on page " << page_url;
      return;
 +  }
  
    // If the current page is a form submit, find the last page that was not a
    // form submit and use its url to generate the keyword from.
-@@ -141,8 +152,10 @@ void SearchEngineTabHelper::PageHasOpenSearchDescriptionDocument(
+@@ -141,8 +151,10 @@ void SearchEngineTabHelper::PageHasOpenSearchDescriptionDocument(
         (index > 0) && IsFormSubmit(entry);
         entry = controller.GetEntryAtIndex(index))
      --index;
 -  if (!entry || IsFormSubmit(entry))
 +  if (!entry || IsFormSubmit(entry)) {
-+    LOG(INFO) << "OpenSearch: cannot find form submission";
++    LOG(INFO) << "OpenSearch: cannot find form submission for entry " << entry->GetURL();
      return;
 +  }
  
    // Autogenerate a keyword for the autodetected case; in the other cases we'll
    // generate a keyword later after fetching the OSDD.
-@@ -157,6 +170,7 @@ void SearchEngineTabHelper::PageHasOpenSearchDescriptionDocument(
+@@ -150,6 +162,12 @@ void SearchEngineTabHelper::PageHasOpenSearchDescriptionDocument(
+   if (keyword.empty())
+     return;
+ 
++  std::u16string page_keyword = TemplateURL::GenerateKeyword(page_url);
++  if (page_keyword != keyword) {
++    LOG(INFO) << "OpenSearch: keyword mismatch for entry " << entry->GetURL();
++    return;
++  }
++
+   auto* frame = web_contents()->GetMainFrame();
+   mojo::Remote<network::mojom::URLLoaderFactory> url_loader_factory;
+   frame->CreateNetworkServiceDefaultFactory(
+@@ -157,6 +175,7 @@ void SearchEngineTabHelper::PageHasOpenSearchDescriptionDocument(
  
    // Download the OpenSearch description document. If this is successful, a
    // new keyword will be created when done.
@@ -132,6 +143,35 @@ diff --git a/chrome/browser/ui/search_engines/search_engine_tab_helper.cc b/chro
    TemplateURLFetcherFactory::GetForProfile(profile)->ScheduleDownload(
        keyword, osdd_url, entry->GetFavicon().url,
        frame->GetLastCommittedOrigin(), url_loader_factory.get(),
+@@ -198,11 +217,18 @@ void SearchEngineTabHelper::GenerateKeywordIfNecessary(
+   if (last_index <= 0)
+     return;
+ 
+-  std::u16string keyword(GenerateKeywordFromNavigationEntry(
+-      controller.GetEntryAtIndex(last_index - 1)));
++  NavigationEntry* entry = controller.GetEntryAtIndex(last_index - 1);
++  std::u16string keyword(GenerateKeywordFromNavigationEntry(entry));
+   if (keyword.empty())
+     return;
+ 
++  GURL url = handle->GetSearchableFormURL();
++  std::u16string page_keyword = TemplateURL::GenerateKeyword(url);
++  if (page_keyword != keyword) {
++    LOG(INFO) << "OpenSearch: GenerateKeywordIfNecessary(): keyword mismatch for entry " << entry->GetURL();
++    return;
++  }
++
+   TemplateURLService* url_service =
+       TemplateURLServiceFactory::GetForProfile(profile);
+   if (!url_service)
+@@ -213,7 +239,6 @@ void SearchEngineTabHelper::GenerateKeywordIfNecessary(
+     return;
+   }
+ 
+-  GURL url = handle->GetSearchableFormURL();
+   if (!url_service->CanAddAutogeneratedKeyword(keyword, url))
+     return;
+ 
 diff --git a/chrome/renderer/chrome_render_frame_observer.cc b/chrome/renderer/chrome_render_frame_observer.cc
 --- a/chrome/renderer/chrome_render_frame_observer.cc
 +++ b/chrome/renderer/chrome_render_frame_observer.cc
@@ -189,17 +229,6 @@ diff --git a/components/search_engines/template_url_fetcher.cc b/components/sear
    }
  
    requests_.push_back(std::make_unique<RequestDelegate>(
-diff --git a/components/search_engines/template_url_service.cc b/components/search_engines/template_url_service.cc
---- a/components/search_engines/template_url_service.cc
-+++ b/components/search_engines/template_url_service.cc
-@@ -463,7 +463,6 @@ TemplateURL* TemplateURLService::Add(
-       (!FindTemplateURLForExtension(template_url->extension_info_->extension_id,
-                                     template_url->type()) &&
-        template_url->id() == kInvalidTemplateURLID));
--
-   return Add(std::move(template_url), true);
- }
- 
 diff --git a/components/search_engines/template_url_service.h b/components/search_engines/template_url_service.h
 --- a/components/search_engines/template_url_service.h
 +++ b/components/search_engines/template_url_service.h

+ 3 - 4
build/patches/Revert-Permit-blocking-of-view-source.patch

@@ -8,8 +8,8 @@ This reverts commit e72fc9b64116bf259e516096fcc60b58ae8ae1b3.
  .../policy/url_blocking_policy_test_utils.cc  | 11 ---
  .../policy/url_blocking_policy_test_utils.h   |  3 -
  .../policy_blocklist_navigation_throttle.cc   | 19 -----
- .../policy_blocklist_navigation_throttle.h    |  5 +-
- 5 files changed, 1 insertion(+), 115 deletions(-)
+ .../policy_blocklist_navigation_throttle.h    |  4 -
+ 5 files changed, 115 deletions(-)
 
 diff --git a/chrome/browser/policy/test/url_blocklist_policy_browsertest.cc b/chrome/browser/policy/test/url_blocklist_policy_browsertest.cc
 --- a/chrome/browser/policy/test/url_blocklist_policy_browsertest.cc
@@ -184,7 +184,7 @@ diff --git a/components/policy/content/policy_blocklist_navigation_throttle.cc b
 diff --git a/components/policy/content/policy_blocklist_navigation_throttle.h b/components/policy/content/policy_blocklist_navigation_throttle.h
 --- a/components/policy/content/policy_blocklist_navigation_throttle.h
 +++ b/components/policy/content/policy_blocklist_navigation_throttle.h
-@@ -35,10 +35,7 @@ class PolicyBlocklistNavigationThrottle : public content::NavigationThrottle {
+@@ -35,10 +35,6 @@ class PolicyBlocklistNavigationThrottle : public content::NavigationThrottle {
    const char* GetNameForLogging() override;
  
   private:
@@ -192,7 +192,6 @@ diff --git a/components/policy/content/policy_blocklist_navigation_throttle.h b/
 -  // the URLBlocklist.
 -  bool IsBlockedViewSourceNavigation();
 -
-+  ThrottleCheckResult GetUrlThrottleResult(const GURL& url);
    // To ensure both allow and block policies override Safe Sites,
    // SafeSitesNavigationThrottle must be consulted as part of this throttle
    // rather than added separately to the list of throttles.

+ 9 - 7
build/patches/Welcome-screen.patch

@@ -6,11 +6,11 @@ Allow toggling automatic updates
 ---
  .../android/java/res/layout/fre_tosanduma.xml |   4 +-
  .../browser/firstrun/FirstRunActivity.java    |  43 +----
- .../firstrun/FirstRunFlowSequencer.java       |  63 ++-----
+ .../firstrun/FirstRunFlowSequencer.java       |  65 ++-----
  .../browser/firstrun/FirstRunUtils.java       |  13 +-
  .../firstrun/ToSAndUMAFirstRunFragment.java   | 163 +++++-------------
  .../strings/android_chrome_strings.grd        |  27 ++-
- 6 files changed, 86 insertions(+), 227 deletions(-)
+ 6 files changed, 88 insertions(+), 227 deletions(-)
 
 diff --git a/chrome/android/java/res/layout/fre_tosanduma.xml b/chrome/android/java/res/layout/fre_tosanduma.xml
 --- a/chrome/android/java/res/layout/fre_tosanduma.xml
@@ -197,7 +197,7 @@ diff --git a/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstR
          }
  
          /** @return true if first use hints should be skipped. */
-@@ -141,19 +111,6 @@ public abstract class FirstRunFlowSequencer  {
+@@ -141,19 +111,8 @@ public abstract class FirstRunFlowSequencer  {
       * Once finished, calls onFlowIsKnown().
       */
      void start() {
@@ -214,10 +214,12 @@ diff --git a/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstR
 -                        processFreEnvironmentPreNative();
 -                    });
 -        });
++        mIsChild = false;
++        processFreEnvironmentPreNative();
      }
  
      @VisibleForTesting
-@@ -172,7 +129,6 @@ public abstract class FirstRunFlowSequencer  {
+@@ -172,7 +131,6 @@ public abstract class FirstRunFlowSequencer  {
  
      private void processFreEnvironmentPreNative() {
          Bundle freProperties = new Bundle();
@@ -225,7 +227,7 @@ diff --git a/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstR
  
          onFlowIsKnown(freProperties);
      }
-@@ -183,8 +139,8 @@ public abstract class FirstRunFlowSequencer  {
+@@ -183,8 +141,8 @@ public abstract class FirstRunFlowSequencer  {
       * @param freProperties Resulting FRE properties bundle.
       */
      public void updateFirstRunProperties(Bundle freProperties) {
@@ -236,7 +238,7 @@ diff --git a/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstR
          freProperties.putBoolean(
                  FirstRunActivity.SHOW_SEARCH_ENGINE_PAGE, shouldShowSearchEnginePage());
      }
-@@ -243,6 +199,7 @@ public abstract class FirstRunFlowSequencer  {
+@@ -243,6 +201,7 @@ public abstract class FirstRunFlowSequencer  {
                          || FirstRunStatus.getLightweightFirstRunFlowComplete())) {
              return false;
          }
@@ -244,7 +246,7 @@ diff --git a/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstR
          return true;
      }
  
-@@ -290,15 +247,21 @@ public abstract class FirstRunFlowSequencer  {
+@@ -290,15 +249,21 @@ public abstract class FirstRunFlowSequencer  {
                  freIntent =
                          VrModuleProvider.getIntentDelegate().setupVrFreIntent(caller, freIntent);
                  // We cannot access Chrome right now, e.g. because the VR module is not installed.