Bug 1500541 - Disable about:config in GeckoView on Release and Beta r=ehsan

Differential Revision: https://phabricator.services.mozilla.com/D10410
This commit is contained in:
James Willcox 2018-11-01 09:33:37 -05:00
Родитель eb69f98699
Коммит 1e1cda1530
1 изменённых файлов: 16 добавлений и 0 удалений

Просмотреть файл

@ -10,6 +10,14 @@
#include "mozilla/ArrayUtils.h" #include "mozilla/ArrayUtils.h"
#include "nsIProtocolHandler.h" #include "nsIProtocolHandler.h"
#if defined(MOZ_WIDGET_ANDROID) && defined(RELEASE_OR_BETA)
#define ABOUT_CONFIG_BLOCKED_GV
#endif
#ifdef ABOUT_CONFIG_BLOCKED_GV
#include "mozilla/jni/Utils.h" // for mozilla::jni::IsFennec()
#endif
NS_IMPL_ISUPPORTS(nsAboutRedirector, nsIAboutModule) NS_IMPL_ISUPPORTS(nsAboutRedirector, nsIAboutModule)
struct RedirEntry struct RedirEntry
@ -174,6 +182,14 @@ nsAboutRedirector::NewChannel(nsIURI* aURI,
MOZ_CRASH("Crash via about:crashcontent"); MOZ_CRASH("Crash via about:crashcontent");
} }
#ifdef ABOUT_CONFIG_BLOCKED_GV
// We don't want to allow access to about:config from
// GeckoView on release or beta, but it's fine for Fennec.
if (path.EqualsASCII("config") && !mozilla::jni::IsFennec()) {
return NS_ERROR_NOT_AVAILABLE;
}
#endif
for (int i = 0; i < kRedirTotal; i++) { for (int i = 0; i < kRedirTotal; i++) {
if (!strcmp(path.get(), kRedirMap[i].id)) { if (!strcmp(path.get(), kRedirMap[i].id)) {
nsCOMPtr<nsIChannel> tempChannel; nsCOMPtr<nsIChannel> tempChannel;