From a41c51ac84dc62b5f34a572014e38077c6f91aec Mon Sep 17 00:00:00 2001 From: Jonathan Almeida Date: Thu, 24 Apr 2025 22:37:33 +0000 Subject: [PATCH] Bug 1962312 - Make about:home load about:blank on GeckoView r=nalexander,gl,mconley Today, if we try to load `about:home`, we get a load error because it is not a valid about page. For an embedder to have `about:home` in the back-forward history, we need to allow the request to load successfully. That means that we need to let it, at minimum, do nothing - for this, we just load `about:blank`. Should this be behind a pref or GeckoRuntimeSetting? Our only prior art is `about:config` which controls Gecko functionality. This is a feature that has valid use cases for controlling behind a pref, whereas `about:home` does nothing similar to `about:blank` which does not have a pref. Differential Revision: https://phabricator.services.mozilla.com/D246543 --- docshell/base/nsAboutRedirector.cpp | 6 ++++++ docshell/build/components.conf | 2 ++ 2 files changed, 8 insertions(+) diff --git a/docshell/base/nsAboutRedirector.cpp b/docshell/base/nsAboutRedirector.cpp index 9d128f5f6118..77491402cb29 100644 --- a/docshell/base/nsAboutRedirector.cpp +++ b/docshell/base/nsAboutRedirector.cpp @@ -117,6 +117,12 @@ static const RedirEntry kRedirMap[] = { nsIAboutModule::HIDE_FROM_ABOUTABOUT | nsIAboutModule::ALLOW_SCRIPT | nsIAboutModule::URI_MUST_LOAD_IN_CHILD | nsIAboutModule::URI_CAN_LOAD_IN_PRIVILEGEDABOUT_PROCESS}, +#ifdef MOZ_WIDGET_ANDROID + {"home", "about:blank", + nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT | + nsIAboutModule::URI_CAN_LOAD_IN_PRIVILEGEDABOUT_PROCESS | + nsIAboutModule::URI_MUST_LOAD_IN_CHILD}, +#endif {"httpsonlyerror", "chrome://global/content/httpsonlyerror/errorpage.html", nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT | nsIAboutModule::URI_CAN_LOAD_IN_CHILD | nsIAboutModule::ALLOW_SCRIPT | diff --git a/docshell/build/components.conf b/docshell/build/components.conf index d3733ab32a89..34e06ce3324c 100644 --- a/docshell/build/components.conf +++ b/docshell/build/components.conf @@ -41,6 +41,8 @@ if defined('MOZ_CRASHREPORTER'): about_pages.append('crashes') if buildconfig.substs['MOZ_WIDGET_TOOLKIT'] != 'android': about_pages.append('profiles') +if buildconfig.substs['MOZ_WIDGET_TOOLKIT'] == 'android': + about_pages.append('home') if buildconfig.substs['MOZ_WIDGET_TOOLKIT'] == 'windows': about_pages.append('third-party') about_pages.append('windows-messages')