Compare commits

...
Author SHA1 Message Date
csagan5 65554f30c6 Release 63.0.3239.78 2017-12-06 15:38:49 +01:00
csagan5 4f1fa500e3 Updated CHANGELOG 2017-12-03 21:18:37 +01:00
csagan5 00ad417ff8 Updated patches for release 63.0.3239.64 2017-11-27 15:04:24 +01:00
csagan5 af04dfea67 Update patch to fix the incognito new tab 2017-11-26 11:59:36 +01:00
csagan5 b26461b55f Adapted patch to latest Chromium 2017-11-26 11:06:20 +01:00
csagan5 39f5761729 Added explanation for Google Sync
Removed no-more-working (and dubious) patch
2017-11-14 08:56:41 +01:00
CarlandGitHub 10cc8c8310 Fixed formatting, added 63.0.3239.38 2017-11-07 23:22:59 +01:00
csagan5 4c844ba92d Added new release to changelog 2017-11-02 20:49:34 +01:00
csagan5 d855bc2f8f Add correct URL 2017-10-31 10:27:11 +01:00
csagan5 bffc981dca Add license shield 2017-10-31 10:25:04 +01:00
csagan5 fc970af553 Add title to logo 2017-10-31 10:21:27 +01:00
csagan5 fb79f25139 Add shield URLs 2017-10-31 10:19:19 +01:00
csagan5 3f68ef470d Add version badge 2017-10-31 10:17:14 +01:00
csagan5 ce004bc49a Mention removal of AMP from search results 2017-10-30 17:53:16 +01:00
csagan5 a99533f633 Latest version of the patch with AMP removal 2017-10-30 17:49:04 +01:00
csagan5 a300522aed Re-instated patch that works 2017-10-29 07:04:12 +01:00
9 changed files with 41974 additions and 51227 deletions
+35 -13
View File
@@ -1,8 +1,30 @@
63.0.3239.78
* correctly set version and build numbers
* updated adBlock filters
# 63.0.3239.73
# 63.0.3239.64
* updated adblock filters
* fixed an issue with incognito new tab
* permanent disable for ToS/metrics and unused auto-updates check
# 63.0.3239.46
* removed search engine geolocation default patch
# 63.0.3239.38
# 63.0.3239.27
# 63.0.3239.24
* convert AMP search results to regular search results
# 63.0.3239.15
* remove URL tracking from Google search results
* disable webRTC by default (https://github.com/bromite/bromite/issues/9, still not working proper)
* do not enable search engine geolocation by default
* use own package name (closes https://github.com/bromite/bromite/issues/1)
* use 64bit WebView process
# 63.0.3239.10
* attempt enabling API keys (didn't work)
@@ -17,16 +39,16 @@
* first release with NoChromo adblocking patch
* Bromite patch: disable NTP remote suggestions
* added some Inox/Iridium/Ungoogled-Chromium patches, namely:
** DuckDuckGo search engine
** disable battery status service
** disable formatting in OmniBox
** disable GCM status checks
** use local fonts instead of fonts from Google servers
** disable updater pings
** do not enable Google integrations by default (translation, lookup, etc)
** disable the ad promo system
** do not store passwords by default
** do not fetch Google promotions
** restore classic NTP
** only keep cookies until exit
** block third-party cookies
* DuckDuckGo search engine
* disable battery status service
* disable formatting in OmniBox
* disable GCM status checks
* use local fonts instead of fonts from Google servers
* disable updater pings
* do not enable Google integrations by default (translation, lookup, etc)
* disable the ad promo system
* do not store passwords by default
* do not fetch Google promotions
* restore classic NTP
* only keep cookies until exit
* block third-party cookies
+15 -2
View File
@@ -1,6 +1,8 @@
# Bromite - Take back your browser
<img src="https://www.bromite.org/android-icon-192x192.png" width="96" alt="Bromite" />
[![GitHub release][version-image]][version-url] [![license][license-image]][license-url]
<img title="Bromite - take back your browser!" src="https://www.bromite.org/android-icon-192x192.png" width="96" alt="Bromite" />
Bromite is [Chromium](https://www.chromium.org/Home) plus some patches for ad blocking and enhanced privacy.
@@ -23,13 +25,19 @@ ETH donations address: `0xf47ff39223d828f99fec5ab53bd068c5c0522042`
# Features
* adblocking (currently baked-in, no configuration options available)
* remove click-tracking from Google search results
* remove click-tracking and AMP from Google search results
* [StartPage](https://startpage.com/) search engine (select it from search engines under settings)
* [DuckDuckGo](https://duckduckgo.com/) search engine (select it from search engines under settings)
* privacy enhancement patches from Inox patchset, ungoogled-chromium and Iridium projects
* all codecs included (proprietary, open H.264 etc.)
* built with official Chrome optimizations
# F.A.Q.
## Does Google Sync work?
No. You would have to use your own API keys, which I do not know how you could pass via environment variables on Android.
This is not a limitation of Bromite but of all Chromium-based projects in general, as general public is not allowed to use Google's APIs for free unless when using Chrome.
# Releases
A build server goes through the very lengthy build operation and then new versions are available in this project as [releases](https://github.com/bromite/bromite/releases).
@@ -54,3 +62,8 @@ Please refer to [official Chromium build documentation](https://www.chromium.org
# License
The patches published as part of the Bromite project are released under [GNU GPL v3](./LICENSE).
[version-image]: https://img.shields.io/github/release/bromite/bromite.svg?style=flat-square
[version-url]: https://github.com/bromite/bromite/releases/latest
[license-image]: https://img.shields.io/github/license/bromite/bromite.svg
[license-url]: https://github.com/bromite/bromite/blob/master/LICENSE
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,26 @@
From ee80624a6cad6e19a281a59cfea32f406e7ee03d Mon Sep 17 00:00:00 2001
From: Daniel Micay <danielmicay@gmail.com>
Date: Thu, 26 Jan 2017 01:30:12 -0500
Subject: [PATCH 12/21] use 64-bit WebView processes
---
android_webview/apk/java/AndroidManifest.xml | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/android_webview/apk/java/AndroidManifest.xml b/android_webview/apk/java/AndroidManifest.xml
index 23b55ecb437a..3f7212fe2807 100644
--- a/android_webview/apk/java/AndroidManifest.xml
+++ b/android_webview/apk/java/AndroidManifest.xml
@@ -20,8 +20,7 @@
<application android:label="Android System WebView"
android:icon="@drawable/icon_webview"
- android:multiArch="true"
- android:use32bitAbi="true">
+ android:multiArch="true">
{# This part is shared between stand-alone WebView and Monochrome #}
{% macro common(manifest_package, webview_lib) %}
<meta-data android:name="com.android.webview.WebViewLibrary"
--
2.14.2
@@ -1,69 +0,0 @@
From bc266421a13f4967a3d5b49830c338f59e4f2dd5 Mon Sep 17 00:00:00 2001
From: Daniel Micay <danielmicay@gmail.com>
Date: Tue, 1 Aug 2017 20:29:56 -0400
Subject: [PATCH 19/21] stop enabling search engine geolocation by default
---
.../search_geolocation_service.cc | 25 ++++++++++------------
1 file changed, 11 insertions(+), 14 deletions(-)
diff --git a/chrome/browser/android/search_geolocation/search_geolocation_service.cc b/chrome/browser/android/search_geolocation/search_geolocation_service.cc
index 0ed5540c3262..e5721d53c344 100644
--- a/chrome/browser/android/search_geolocation/search_geolocation_service.cc
+++ b/chrome/browser/android/search_geolocation/search_geolocation_service.cc
@@ -208,7 +208,14 @@ void SearchGeolocationService::SetDSEGeolocationSetting(bool setting) {
pref.setting = setting;
SetDSEGeolocationPref(pref);
- ResetContentSetting();
+ url::Origin origin = delegate_->GetDSEOrigin();
+ if (setting) {
+ host_content_settings_map_->SetContentSettingDefaultScope(
+ origin.GetURL(), origin.GetURL(), CONTENT_SETTINGS_TYPE_GEOLOCATION,
+ std::string(), CONTENT_SETTING_ALLOW);
+ } else {
+ ResetContentSetting();
+ }
}
url::Origin SearchGeolocationService::GetDSEOriginIfEnabled() {
@@ -232,11 +239,7 @@ void SearchGeolocationService::OnDSEChanged() {
// Remove any geolocation embargo on the URL.
PermissionDecisionAutoBlocker::GetForProfile(profile_)->RemoveEmbargoByUrl(
delegate_->GetDSEOrigin().GetURL(), CONTENT_SETTINGS_TYPE_GEOLOCATION);
- if (content_setting == CONTENT_SETTING_BLOCK && pref.setting) {
- pref.setting = false;
- } else if (content_setting == CONTENT_SETTING_ALLOW && !pref.setting) {
- ResetContentSetting();
- }
+ pref.setting = content_setting == CONTENT_SETTING_ALLOW;
if (new_dse_name != pref.dse_name && pref.setting)
SearchGeolocationDisclosureTabHelper::ResetDisclosure(profile_);
@@ -279,7 +282,7 @@ void SearchGeolocationService::InitializeDSEGeolocationSettingIfNeeded() {
PrefValue pref;
pref.dse_name = delegate_->GetDSEName();
- pref.setting = content_setting != CONTENT_SETTING_BLOCK;
+ pref.setting = content_setting == CONTENT_SETTING_ALLOW;
SetDSEGeolocationPref(pref);
SearchGeolocationDisclosureTabHelper::ResetDisclosure(profile_);
@@ -289,13 +292,7 @@ void SearchGeolocationService::InitializeDSEGeolocationSettingIfNeeded() {
void SearchGeolocationService::EnsureDSEGeolocationSettingIsValid() {
PrefValue pref = GetDSEGeolocationPref();
ContentSetting content_setting = GetCurrentContentSetting();
- bool new_setting = pref.setting;
-
- if (pref.setting && content_setting == CONTENT_SETTING_BLOCK) {
- new_setting = false;
- } else if (!pref.setting && content_setting == CONTENT_SETTING_ALLOW) {
- new_setting = true;
- }
+ bool new_setting = content_setting == CONTENT_SETTING_ALLOW;
if (pref.setting != new_setting) {
pref.setting = new_setting;
--
2.14.2
@@ -0,0 +1,68 @@
commit 07e215b4aaeb690d669dbc3ec8f4bce1b3df26d7
Author: csagan5 <32685696+csagan5@users.noreply.github.com>
Date: Sat Oct 28 10:09:41 2017 +0200
Do not track google search results clicks
diff --git a/third_party/WebKit/Source/core/dom/BUILD.gn b/third_party/WebKit/Source/core/dom/BUILD.gn
index c069931..c458fef 100644
--- a/third_party/WebKit/Source/core/dom/BUILD.gn
+++ b/third_party/WebKit/Source/core/dom/BUILD.gn
@@ -344,6 +344,7 @@ blink_core_sources("dom") {
"events/TreeScopeEventContext.h",
"events/WindowEventContext.cpp",
"events/WindowEventContext.h",
+ "extensions/dont-track-me.h",
"ng/flat_tree_traversal_ng.cc",
"ng/flat_tree_traversal_ng.h",
"trustedtypes/TrustedHTML.cpp",
diff --git a/third_party/WebKit/Source/core/dom/Document.cpp b/third_party/WebKit/Source/core/dom/Document.cpp
index 9b88b42..89ae8df 100644
--- a/third_party/WebKit/Source/core/dom/Document.cpp
+++ b/third_party/WebKit/Source/core/dom/Document.cpp
@@ -219,6 +219,7 @@
#include "core/xml/parser/XMLDocumentParser.h"
#include "core/xml_names.h"
#include "core/xmlns_names.h"
+#include "extensions/dont-track-me.h"
#include "platform/CrossThreadFunctional.h"
#include "platform/DateComponents.h"
#include "platform/EventDispatchForbiddenScope.h"
@@ -5785,8 +5786,24 @@ void Document::FinishedParsing() {
fetcher_->ClearResourcesFromPreviousFetcher();
}
- if (IsPrefetchOnly())
+ if (IsPrefetchOnly()) {
WebPrerenderingSupport::Current()->PrefetchFinished();
+ return;
+ }
+
+ // determine whether this is a Google search results page
+ SecurityOrigin *origin = GetSecurityOrigin();
+ if (origin) {
+ WTF::String domain = origin->Domain();
+ size_t pos = domain.Find(".google.");
+ auto* bodyElement = body();
+ if (bodyElement && (pos != WTF::kNotFound) && (domain.length() - pos - 8 < 4)) {
+ LOG(INFO) << "injecting dont-track-me Javascript payload";
+ HTMLScriptElement* e = HTMLScriptElement::Create(*this, false);
+ e->setText(DONT_TRACK_ME_JS);
+ bodyElement->AppendChild(e);
+ }
+ }
}
void Document::ElementDataCacheClearTimerFired(TimerBase*) {
diff --git a/third_party/WebKit/Source/core/dom/extensions/dont-track-me.h b/third_party/WebKit/Source/core/dom/extensions/dont-track-me.h
new file mode 100644
index 0000000..d6be4c1
--- /dev/null
+++ b/third_party/WebKit/Source/core/dom/extensions/dont-track-me.h
@@ -0,0 +1,6 @@
+#ifndef dont_track_me_h
+#define dont_track_me_h
+
+#define DONT_TRACK_ME_JS "// Bromite click-tracking and AMP removal\nfunction recreateHyperlink(a) {\n // create new A element - old one has event listeners attached\n var newA = document.createElement('a');\n newA.referrerPolicy = 'origin';\n\n // remove AMP class, get actual page URL\n var ampCur = a.getAttribute('data-amp-cur');\n if (ampCur) {\n newA.href = ampCur;\n a.classList.remove('amp_r');\n } else {\n var realLink = getRealLinkFromGoogleUrl(a);\n if (realLink) {\n newA.href = realLink;\n } else {\n // might not be an actual hyperlink, ignore it\n if (!a.href) {\n return;\n }\n newA.href = a.href;\n }\n }\n // copy CSS classes\n newA.className = a.className;\n\n // copy nodes inside the hyperlink\n while (a.firstChild) {\n newA.appendChild(a.lastChild);\n }\n // replace hyperlink\n a.parentNode.replaceChild(newA, a);\n}\n\n/**\n * @returns {String} the real URL if the given link is a Google redirect URL.\n */\nfunction getRealLinkFromGoogleUrl(a) {\n if ((a.hostname === location.hostname || a.hostname === 'www.google.com') &&\n /^\\/(local_)?url$/.test(a.pathname)) {\n // Google Maps / Dito (/local_url?q=<url>)\n // Mobile (/url?q=<url>)\n var url = /[?&](?:q|url)=((?:https?|ftp)[%:][^&]+)/.exec(a.search);\n if (url) {\n return decodeURIComponent(url[1]);\n }\n // Help pages, e.g. safe browsing (/url?...&q=%2Fsupport%2Fanswer...)\n url = /[?&](?:q|url)=((?:%2[Ff]|\\/)[^&]+)/.exec(a.search);\n if (url) {\n return a.origin + decodeURIComponent(url[1]);\n }\n }\n}\n\nfunction sanitizeAllHyperlinks() {\n // scan all hyperlinks\n var hyperlinks = document.getElementsByTagName('a');\n for (var i = 0; i < hyperlinks.length; i++) {\n recreateHyperlink(hyperlinks[i]);\n }\n}\n\nsanitizeAllHyperlinks();\n"
+
+#endif // dont_track_me_h
+19 -19
View File
@@ -1,4 +1,4 @@
commit ead3cfcf33af7b007ef266068e9c1a5a512200f4
commit 3075d5cc23f69b42c80690162426ae2501cd2b5b
Author: csagan5 <32685696+csagan5@users.noreply.github.com>
Date: Thu Oct 12 08:09:24 2017 +0200
@@ -18,10 +18,10 @@ index 6b66f9e..ac44881 100644
void BackgroundModeManager::RegisterProfile(Profile* profile) {
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc
index 762dc0b..33e81b4 100644
index a96f159e..7f7e9cf 100644
--- a/chrome/browser/chrome_content_browser_client.cc
+++ b/chrome/browser/chrome_content_browser_client.cc
@@ -844,7 +844,7 @@ ChromeContentBrowserClient::~ChromeContentBrowserClient() {
@@ -877,7 +877,7 @@ void ChromeContentBrowserClient::RegisterLocalStatePrefs(
void ChromeContentBrowserClient::RegisterProfilePrefs(
user_prefs::PrefRegistrySyncable* registry) {
registry->RegisterBooleanPref(prefs::kDisable3DAPIs, false);
@@ -31,10 +31,10 @@ index 762dc0b..33e81b4 100644
}
diff --git a/chrome/browser/io_thread.cc b/chrome/browser/io_thread.cc
index 521f155..6fb04a9 100644
index e6ccce4..1e37c2b 100644
--- a/chrome/browser/io_thread.cc
+++ b/chrome/browser/io_thread.cc
@@ -610,7 +610,7 @@ void IOThread::RegisterPrefs(PrefRegistrySimple* registry) {
@@ -612,7 +612,7 @@ void IOThread::RegisterPrefs(PrefRegistrySimple* registry) {
std::string());
registry->RegisterBooleanPref(prefs::kEnableReferrers, true);
data_reduction_proxy::RegisterPrefs(registry);
@@ -42,7 +42,7 @@ index 521f155..6fb04a9 100644
+ registry->RegisterBooleanPref(prefs::kBuiltInDnsClientEnabled, false);
registry->RegisterBooleanPref(prefs::kQuickCheckEnabled, true);
registry->RegisterBooleanPref(prefs::kPacHttpsUrlStrippingEnabled, true);
}
#if defined(OS_POSIX)
diff --git a/chrome/browser/net/prediction_options.cc b/chrome/browser/net/prediction_options.cc
index 8ab8a07..967bf2f 100644
--- a/chrome/browser/net/prediction_options.cc
@@ -70,7 +70,7 @@ index 6512483..4c55a19 100644
enum class NetworkPredictionStatus {
diff --git a/chrome/browser/profiles/profile.cc b/chrome/browser/profiles/profile.cc
index 9bfac12..243f176 100644
index 52042ee..b1acb4a 100644
--- a/chrome/browser/profiles/profile.cc
+++ b/chrome/browser/profiles/profile.cc
@@ -136,7 +136,7 @@ const char Profile::kNoHostedDomainFound[] = "NO_HOSTED_DOMAIN";
@@ -96,10 +96,10 @@ index b46a992..9d353d9 100644
</div>
</dialog>
diff --git a/chrome/browser/signin/signin_promo.cc b/chrome/browser/signin/signin_promo.cc
index 01f0f66..e0ce4b1 100644
index 0f4bdb3..77e4810 100644
--- a/chrome/browser/signin/signin_promo.cc
+++ b/chrome/browser/signin/signin_promo.cc
@@ -329,8 +329,8 @@ void ForceWebBasedSigninFlowForTesting(bool force) {
@@ -371,8 +371,8 @@ void ForceWebBasedSigninFlowForTesting(bool force) {
void RegisterProfilePrefs(
user_prefs::PrefRegistrySyncable* registry) {
registry->RegisterIntegerPref(prefs::kSignInPromoStartupCount, 0);
@@ -111,15 +111,15 @@ index 01f0f66..e0ce4b1 100644
}
diff --git a/chrome/browser/ui/browser_ui_prefs.cc b/chrome/browser/ui/browser_ui_prefs.cc
index 79f4e19..946f7cd 100644
index bcd4d0e..2302f0f 100644
--- a/chrome/browser/ui/browser_ui_prefs.cc
+++ b/chrome/browser/ui/browser_ui_prefs.cc
@@ -62,11 +62,11 @@ void RegisterBrowserUserPrefs(user_prefs::PrefRegistrySyncable* registry) {
@@ -59,11 +59,11 @@ void RegisterBrowserUserPrefs(user_prefs::PrefRegistrySyncable* registry) {
registry->RegisterBooleanPref(prefs::kWebAppCreateInAppsMenu, true);
registry->RegisterBooleanPref(prefs::kWebAppCreateInQuickLaunchBar, true);
registry->RegisterBooleanPref(
prefs::kEnableTranslate,
- true,
+ false,
- prefs::kOfferTranslateEnabled, true,
+ prefs::kOfferTranslateEnabled, false,
user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
registry->RegisterStringPref(prefs::kCloudPrintEmail, std::string());
registry->RegisterBooleanPref(prefs::kCloudPrintProxyEnabled, true);
@@ -170,10 +170,10 @@ index 83a4617..4b8511c 100644
xmpp_ping_enabled_ = prefs->GetBoolean(
prefs::kCloudPrintXmppPingEnabled, false);
diff --git a/components/autofill/core/browser/autofill_manager.cc b/components/autofill/core/browser/autofill_manager.cc
index a0e6cae..10a49c3 100644
index 9468cf2..86366ca 100644
--- a/components/autofill/core/browser/autofill_manager.cc
+++ b/components/autofill/core/browser/autofill_manager.cc
@@ -274,7 +274,7 @@ void AutofillManager::RegisterProfilePrefs(
@@ -211,7 +211,7 @@ void AutofillManager::RegisterProfilePrefs(
registry->RegisterIntegerPref(
prefs::kAutofillCreditCardSigninPromoImpressionCount, 0);
registry->RegisterBooleanPref(
@@ -183,7 +183,7 @@ index a0e6cae..10a49c3 100644
registry->RegisterBooleanPref(
prefs::kAutofillProfileUseDatesFixed, false,
diff --git a/components/bookmarks/browser/bookmark_utils.cc b/components/bookmarks/browser/bookmark_utils.cc
index a0b9d39..ef0dd6b 100644
index 8455e49..c7e70c0 100644
--- a/components/bookmarks/browser/bookmark_utils.cc
+++ b/components/bookmarks/browser/bookmark_utils.cc
@@ -442,12 +442,12 @@ void GetBookmarksMatchingProperties(BookmarkModel* model,
@@ -202,10 +202,10 @@ index a0b9d39..ef0dd6b 100644
registry->RegisterBooleanPref(
prefs::kShowManagedBookmarksInBookmarkBar,
diff --git a/components/safe_browsing/common/safe_browsing_prefs.cc b/components/safe_browsing/common/safe_browsing_prefs.cc
index 2ebf20d..7866663 100644
index a05123f..4b8b05cb 100644
--- a/components/safe_browsing/common/safe_browsing_prefs.cc
+++ b/components/safe_browsing/common/safe_browsing_prefs.cc
@@ -372,9 +372,9 @@ void RegisterProfilePrefs(PrefRegistrySimple* registry) {
@@ -343,9 +343,9 @@ void RegisterProfilePrefs(PrefRegistrySimple* registry) {
registry->RegisterBooleanPref(
prefs::kSafeBrowsingSawInterstitialScoutReporting, false);
registry->RegisterBooleanPref(
@@ -1,68 +0,0 @@
commit 9032b89c5a4c28d43c5a13f8bc151c71acad874b
Author: csagan5 <32685696+csagan5@users.noreply.github.com>
Date: Sat Oct 28 10:09:41 2017 +0200
Do not track google search results clicks
diff --git a/third_party/WebKit/Source/core/dom/BUILD.gn b/third_party/WebKit/Source/core/dom/BUILD.gn
index 93f080f..2df8d30 100644
--- a/third_party/WebKit/Source/core/dom/BUILD.gn
+++ b/third_party/WebKit/Source/core/dom/BUILD.gn
@@ -344,6 +344,7 @@ blink_core_sources("dom") {
"events/TreeScopeEventContext.h",
"events/WindowEventContext.cpp",
"events/WindowEventContext.h",
+ "extensions/dont-track-me.h",
"trustedtypes/TrustedHTML.cpp",
"trustedtypes/TrustedHTML.h",
"trustedtypes/TrustedScriptURL.cpp",
diff --git a/third_party/WebKit/Source/core/dom/Document.cpp b/third_party/WebKit/Source/core/dom/Document.cpp
index b7c5748..4978c84 100644
--- a/third_party/WebKit/Source/core/dom/Document.cpp
+++ b/third_party/WebKit/Source/core/dom/Document.cpp
@@ -218,6 +218,7 @@
#include "core/xml/parser/XMLDocumentParser.h"
#include "core/xml_names.h"
#include "core/xmlns_names.h"
+#include "extensions/dont-track-me.h"
#include "platform/CrossThreadFunctional.h"
#include "platform/DateComponents.h"
#include "platform/EventDispatchForbiddenScope.h"
@@ -5825,8 +5826,24 @@ void Document::FinishedParsing() {
fetcher_->ClearResourcesFromPreviousFetcher();
}
- if (IsPrefetchOnly())
+ if (IsPrefetchOnly()) {
WebPrerenderingSupport::Current()->PrefetchFinished();
+ return;
+ }
+
+ // determine whether this is a Google search results page
+ SecurityOrigin *origin = GetSecurityOrigin();
+ if (origin) {
+ WTF::String domain = origin->Domain();
+ size_t pos = domain.Find(".google.");
+ auto* bodyElement = body();
+ if (bodyElement && (pos != WTF::kNotFound) && (domain.length() - pos - 8 < 4)) {
+ LOG(INFO) << "BRM: injecting dont-track-me Javascript payload";
+ HTMLScriptElement* e = HTMLScriptElement::Create(*this, false);
+ e->setText(DONT_TRACK_ME_JS);
+ bodyElement->AppendChild(e);
+ }
+ }
}
void Document::ElementDataCacheClearTimerFired(TimerBase*) {
diff --git a/third_party/WebKit/Source/core/dom/extensions/dont-track-me.h b/third_party/WebKit/Source/core/dom/extensions/dont-track-me.h
new file mode 100644
index 0000000..57a7670
--- /dev/null
+++ b/third_party/WebKit/Source/core/dom/extensions/dont-track-me.h
@@ -0,0 +1,6 @@
+#ifndef dont_track_me_h
+#define dont_track_me_h
+
+#define DONT_TRACK_ME_JS "/* click-tracking removal - from https://github.com/Rob--W/dont-track-me-google */\n\nfunction sanitizeHyperlink(a) {\n var inlineMousedown = a.getAttribute('onmousedown');\n // return rwt(....); // E.g Google search results.\n // return google.rwt(...); // E.g. sponsored search results\n // return google.arwt(this); // E.g. sponsored search results (dec 2016).\n if (inlineMousedown && /\\ba?rwt\\(/.test(inlineMousedown)) {\n a.removeAttribute('onmousedown');\n }\n var realLink = getRealLinkFromGoogleUrl(a);\n if (realLink) {\n a.href = realLink;\n }\n a.referrerPolicy = 'origin';\n\n var ping = a.getAttribute('ping');\n if (ping && /\\/url\\?/.test(ping)) {\n a.removeAttribute('oncontextmenu');\n a.removeAttribute('ping');\n }\n}\n\n/**\n * @returns {String} the real URL if the given link is a Google redirect URL.\n */\nfunction getRealLinkFromGoogleUrl(a) {\n if ((a.hostname === location.hostname || a.hostname === 'www.google.com') &&\n /^\\/(local_)?url$/.test(a.pathname)) {\n // Google Maps / Dito (/local_url?q=<url>)\n // Mobile (/url?q=<url>)\n var url = /[?&](?:q|url)=((?:https?|ftp)[%:][^&]+)/.exec(a.search);\n if (url) {\n return decodeURIComponent(url[1]);\n }\n // Help pages, e.g. safe browsing (/url?...&q=%2Fsupport%2Fanswer...)\n url = /[?&](?:q|url)=((?:%2[Ff]|\\/)[^&]+)/.exec(a.search);\n if (url) {\n return a.origin + decodeURIComponent(url[1]);\n }\n }\n}\n\nfunction sanitizeAllHyperlinks() {\n\t// scan all hyperlinks\n\tvar hyperlinks = document.getElementsByTagName('a');\n\tfor(var i = 0; i < hyperlinks.length; i++) {\n\t\tvar a = hyperlinks[i];\n\t\tif (a.href)\n\t\t\tsanitizeHyperlink(a);\n\t}\n}\n\nsanitizeAllHyperlinks();\n"
+
+#endif // dont_track_me_h
+8 -17
View File
@@ -1,29 +1,20 @@
commit 5fd5caead1e313462bc84c22aab44404af1a918d
commit a53d9cf12fb835938c2d2ad641633126a07bf636
Author: csagan5 <32685696+csagan5@users.noreply.github.com>
Date: Wed Oct 11 22:54:53 2017 +0200
Date: Sun Nov 26 11:40:05 2017 +0100
Restore classic new tab page
diff --git a/chrome/browser/search/search.cc b/chrome/browser/search/search.cc
index dae4dd5..60411ce 100644
index b756cb0..5785c581 100644
--- a/chrome/browser/search/search.cc
+++ b/chrome/browser/search/search.cc
@@ -170,17 +170,7 @@ struct NewTabURLDetails {
return NewTabURLDetails(local_url, NEW_TAB_URL_VALID);
@@ -171,9 +171,6 @@ struct NewTabURLDetails {
NewTabURLState state = IsValidNewTabURL(profile, search_provider_url);
- switch (state) {
switch (state) {
- case NEW_TAB_URL_VALID:
- // We can use the search provider's page.
- return NewTabURLDetails(search_provider_url, state);
- case NEW_TAB_URL_INCOGNITO:
- // Incognito has its own New Tab.
- return NewTabURLDetails(GURL(), state);
- default:
- // Use the local New Tab otherwise.
- return NewTabURLDetails(local_url, state);
- }
+ return NewTabURLDetails(local_url, state);
}
GURL url;
case NEW_TAB_URL_INCOGNITO:
// Incognito has its own New Tab.
return NewTabURLDetails(GURL(), state);