From 23623ffc1f05beb1484c8405a802c945d79d760d Mon Sep 17 00:00:00 2001 From: csagan5 <32685696+csagan5@users.noreply.github.com> Date: Sat, 16 Dec 2017 12:22:24 +0100 Subject: [PATCH] Add Google EN search engine Update anti-AMP patch --- CHANGELOG.md | 5 + patches/privacy/add-google-en-search.patch | 717 ++++++++++++++++++ .../disable-amp-from-search-results.patch | 15 +- 3 files changed, 730 insertions(+), 7 deletions(-) create mode 100644 patches/privacy/add-google-en-search.patch diff --git a/CHANGELOG.md b/CHANGELOG.md index 648a02ea..7d015c7f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +# 63.0.3239.105 +* limit impact of AMP-removal to not break tabs (https://github.com/bromite/bromite/issues/20) +* remove also ads from search results +* add Google search engine with English-only results, no RLZ and field trials + # 63.0.3239.85 * no suggest URL for DuckDuckGo (https://github.com/bromite/bromite/issues/19) * fixed 4chan blocking rule diff --git a/patches/privacy/add-google-en-search.patch b/patches/privacy/add-google-en-search.patch new file mode 100644 index 00000000..34b9bc72 --- /dev/null +++ b/patches/privacy/add-google-en-search.patch @@ -0,0 +1,717 @@ +Author: csagan5 <32685696+csagan5@users.noreply.github.com> +Date: Mon Dec 11 22:42:11 2017 +0100 + + Added Google English-only engine, no RLZ and field experiments + +diff --git a/components/search_engines/prepopulated_engines.json b/components/search_engines/prepopulated_engines.json +--- a/components/search_engines/prepopulated_engines.json ++++ b/components/search_engines/prepopulated_engines.json +@@ -32,7 +32,7 @@ + + // Increment this if you change the data in ways that mean users with + // existing data should get a new version. +- "kCurrentDataVersion": 101 ++ "kCurrentDataVersion": 102 + }, + + // The following engines are included in country lists and are added to the +@@ -141,6 +141,27 @@ + "id": 1 + }, + ++ "googleen": { ++ "name": "GoogleEN", ++ "keyword": "google.co.uk", ++ "favicon_url": "https://www.google.com/favicon.ico", ++ "search_url": "{google:baseURL}search?q={searchTerms}&{google:originalQueryForSuggestion}{google:iOSSearchLanguage}{google:searchClient}{google:contextualSearchVersion}ie={inputEncoding}&hl=en", ++ "suggest_url": "{google:baseSuggestURL}search?client={google:suggestClient}&gs_ri={google:suggestRid}&xssi=t&q={searchTerms}&{google:inputType}{google:pageClassification}{google:searchVersion}{google:prefetchQuery}sugkey={google:suggestAPIKeyParameter}&hl=en", ++ "image_url": "{google:baseURL}searchbyimage/upload?hl=en", ++ "new_tab_url": "{google:baseURL}_/chrome/newtab?hl=en&ie={inputEncoding}", ++ "contextual_search_url": "{google:baseURL}_/contextualsearch?{google:contextualSearchVersion}{google:contextualSearchContextData}&hl=en", ++ "image_url_post_params": "encoded_image={google:imageThumbnail},image_url={google:imageURL},sbisrc={google:imageSearchSource},original_width={google:imageOriginalWidth},original_height={google:imageOriginalHeight}", ++ "alternate_urls": [ ++ "{google:baseURL}?hl=en#q={searchTerms}", ++ "{google:baseURL}search?hl=en#q={searchTerms}", ++ "{google:baseURL}webhp?hl=en#q={searchTerms}", ++ "{google:baseURL}s?hl=en#q={searchTerms}", ++ "{google:baseURL}s?hl=en&q={searchTerms}" ++ ], ++ "type": "SEARCH_ENGINE_GOOGLE_EN", ++ "id": 13 ++ }, ++ + "kvasir": { + "name": "Kvasir", + "keyword": "kvasir.no", +diff --git a/components/search_engines/search_engine_type.h b/components/search_engines/search_engine_type.h +--- a/components/search_engines/search_engine_type.h ++++ b/components/search_engines/search_engine_type.h +@@ -65,6 +65,7 @@ enum SearchEngineType { + SEARCH_ENGINE_360, + SEARCH_ENGINE_DUCKDUCKGO, + SEARCH_ENGINE_STARTPAGE, ++ SEARCH_ENGINE_GOOGLE_EN, + SEARCH_ENGINE_MAX // Bounding value needed for UMA histogram macro. + }; + +diff --git a/components/search_engines/template_url_prepopulate_data.cc b/components/search_engines/template_url_prepopulate_data.cc +--- a/components/search_engines/template_url_prepopulate_data.cc ++++ b/components/search_engines/template_url_prepopulate_data.cc +@@ -50,548 +50,548 @@ namespace { + + // Default (for countries with no better engine set) + const PrepopulatedEngine* const engines_default[] = { +- &google, &startpage, &duckduckgo, &bing, &yahoo, ++ &googleen, &google, &startpage, &duckduckgo, &bing, &yahoo, + }; + + // United Arab Emirates + const PrepopulatedEngine* const engines_AE[] = { +- &google, &startpage, &duckduckgo, &yahoo_maktoob, &bing, ++ &googleen, &google, &startpage, &duckduckgo, &yahoo_maktoob, &bing, + }; + + // Albania + const PrepopulatedEngine* const engines_AL[] = { +- &google, &startpage, &duckduckgo, &yahoo, &bing, ++ &googleen, &google, &startpage, &duckduckgo, &yahoo, &bing, + }; + + // Argentina + const PrepopulatedEngine* const engines_AR[] = { +- &google, &startpage, &duckduckgo, &bing, &yahoo_ar, ++ &googleen, &google, &startpage, &duckduckgo, &bing, &yahoo_ar, + }; + + // Austria + const PrepopulatedEngine* const engines_AT[] = { +- &google, &startpage, &duckduckgo, &bing, &yahoo_at, ++ &googleen, &google, &startpage, &duckduckgo, &bing, &yahoo_at, + }; + + // Australia + const PrepopulatedEngine* const engines_AU[] = { +- &google, &startpage, &duckduckgo, &bing, &yahoo_au, ++ &googleen, &google, &startpage, &duckduckgo, &bing, &yahoo_au, + }; + + // Bosnia and Herzegovina + const PrepopulatedEngine* const engines_BA[] = { +- &google, &startpage, &duckduckgo, &yahoo, &bing, ++ &googleen, &google, &startpage, &duckduckgo, &yahoo, &bing, + }; + + // Belgium + const PrepopulatedEngine* const engines_BE[] = { +- &google, &startpage, &duckduckgo, &bing, &yahoo, &yahoo_fr, ++ &googleen, &google, &startpage, &duckduckgo, &bing, &yahoo, &yahoo_fr, + }; + + // Bulgaria + const PrepopulatedEngine* const engines_BG[] = { +- &google, &startpage, &duckduckgo, &bing, &ask, ++ &googleen, &google, &startpage, &duckduckgo, &bing, &ask, + }; + + // Bahrain + const PrepopulatedEngine* const engines_BH[] = { +- &google, &startpage, &duckduckgo, &yahoo_maktoob, &bing, ++ &googleen, &google, &startpage, &duckduckgo, &yahoo_maktoob, &bing, + }; + + // Burundi + const PrepopulatedEngine* const engines_BI[] = { +- &google, &startpage, &duckduckgo, &yahoo, &bing, ++ &googleen, &google, &startpage, &duckduckgo, &yahoo, &bing, + }; + + // Brunei + const PrepopulatedEngine* const engines_BN[] = { +- &google, &startpage, &duckduckgo, &yahoo_my, &bing, ++ &googleen, &google, &startpage, &duckduckgo, &yahoo_my, &bing, + }; + + // Bolivia + const PrepopulatedEngine* const engines_BO[] = { +- &google, &startpage, &duckduckgo, &bing, &yahoo, ++ &googleen, &google, &startpage, &duckduckgo, &bing, &yahoo, + }; + + // Brazil + const PrepopulatedEngine* const engines_BR[] = { +- &google, &startpage, &duckduckgo, &ask_br, &bing, &yahoo_br, ++ &googleen, &google, &startpage, &duckduckgo, &ask_br, &bing, &yahoo_br, + }; + + // Belarus + const PrepopulatedEngine* const engines_BY[] = { +- &google, &startpage, &duckduckgo, &yandex_by, &mail_ru, ++ &googleen, &google, &startpage, &duckduckgo, &yandex_by, &mail_ru, + }; + + // Belize + const PrepopulatedEngine* const engines_BZ[] = { +- &google, &startpage, &duckduckgo, &yahoo, &bing, ++ &googleen, &google, &startpage, &duckduckgo, &yahoo, &bing, + }; + + // Canada + const PrepopulatedEngine* const engines_CA[] = { +- &google, &startpage, &duckduckgo, &bing, &ask, &yahoo_ca, &yahoo_qc, ++ &googleen, &google, &startpage, &duckduckgo, &bing, &ask, &yahoo_ca, &yahoo_qc, + }; + + // Switzerland + const PrepopulatedEngine* const engines_CH[] = { +- &google, &startpage, &duckduckgo, &bing, &yahoo_ch, ++ &googleen, &google, &startpage, &duckduckgo, &bing, &yahoo_ch, + }; + + // Chile + const PrepopulatedEngine* const engines_CL[] = { +- &google, &startpage, &duckduckgo, &bing, &yahoo_cl, ++ &googleen, &google, &startpage, &duckduckgo, &bing, &yahoo_cl, + }; + + // China + const PrepopulatedEngine* const engines_CN[] = { +- &google, &startpage, &duckduckgo, &baidu, &sogou, &so_360, ++ &googleen, &google, &startpage, &duckduckgo, &baidu, &sogou, &so_360, + }; + + // Colombia + const PrepopulatedEngine* const engines_CO[] = { +- &google, &startpage, &duckduckgo, &bing, &yahoo_co, ++ &googleen, &google, &startpage, &duckduckgo, &bing, &yahoo_co, + }; + + // Costa Rica + const PrepopulatedEngine* const engines_CR[] = { +- &google, &startpage, &duckduckgo, &yahoo, &bing, ++ &googleen, &google, &startpage, &duckduckgo, &yahoo, &bing, + }; + + // Czech Republic + const PrepopulatedEngine* const engines_CZ[] = { +- &google, &startpage, &duckduckgo, &seznam, &bing, ++ &googleen, &google, &startpage, &duckduckgo, &seznam, &bing, + }; + + // Germany + const PrepopulatedEngine* const engines_DE[] = { +- &google, &startpage, &duckduckgo, &bing, &yahoo_de, ++ &googleen, &google, &startpage, &duckduckgo, &bing, &yahoo_de, + }; + + // Denmark + const PrepopulatedEngine* const engines_DK[] = { +- &google, &startpage, &duckduckgo, &bing, &yahoo_dk, ++ &googleen, &google, &startpage, &duckduckgo, &bing, &yahoo_dk, + }; + + // Dominican Republic + const PrepopulatedEngine* const engines_DO[] = { +- &google, &startpage, &duckduckgo, &yahoo, &bing, ++ &googleen, &google, &startpage, &duckduckgo, &yahoo, &bing, + }; + + // Algeria + const PrepopulatedEngine* const engines_DZ[] = { +- &google, &startpage, &duckduckgo, &bing, &yahoo_maktoob, ++ &googleen, &google, &startpage, &duckduckgo, &bing, &yahoo_maktoob, + }; + + // Ecuador + const PrepopulatedEngine* const engines_EC[] = { +- &google, &startpage, &duckduckgo, &bing, &yahoo, ++ &googleen, &google, &startpage, &duckduckgo, &bing, &yahoo, + }; + + // Estonia + const PrepopulatedEngine* const engines_EE[] = { +- &google, &startpage, &duckduckgo, &bing, &yahoo, ++ &googleen, &google, &startpage, &duckduckgo, &bing, &yahoo, + }; + + // Egypt + const PrepopulatedEngine* const engines_EG[] = { +- &google, &startpage, &duckduckgo, &yahoo_maktoob, &bing, ++ &googleen, &google, &startpage, &duckduckgo, &yahoo_maktoob, &bing, + }; + + // Spain + const PrepopulatedEngine* const engines_ES[] = { +- &google, &startpage, &duckduckgo, &bing, &yahoo_es, ++ &googleen, &google, &startpage, &duckduckgo, &bing, &yahoo_es, + }; + + // Faroe Islands + const PrepopulatedEngine* const engines_FO[] = { +- &google, &startpage, &duckduckgo, &bing, &ask, ++ &googleen, &google, &startpage, &duckduckgo, &bing, &ask, + }; + + // Finland + const PrepopulatedEngine* const engines_FI[] = { +- &google, &startpage, &duckduckgo, &bing, &yahoo_fi, ++ &googleen, &google, &startpage, &duckduckgo, &bing, &yahoo_fi, + }; + + // France + const PrepopulatedEngine* const engines_FR[] = { +- &google, &startpage, &duckduckgo, &bing, &yahoo_fr, ++ &googleen, &google, &startpage, &duckduckgo, &bing, &yahoo_fr, + }; + + // United Kingdom + const PrepopulatedEngine* const engines_GB[] = { +- &google, &startpage, &duckduckgo, &bing, &yahoo_uk, &ask_uk, ++ &googleen, &google, &startpage, &duckduckgo, &bing, &yahoo_uk, &ask_uk, + }; + + // Greece + const PrepopulatedEngine* const engines_GR[] = { +- &google, &startpage, &duckduckgo, &bing, &yahoo_gr, ++ &googleen, &google, &startpage, &duckduckgo, &bing, &yahoo_gr, + }; + + // Guatemala + const PrepopulatedEngine* const engines_GT[] = { +- &google, &startpage, &duckduckgo, &yahoo, &bing, ++ &googleen, &google, &startpage, &duckduckgo, &yahoo, &bing, + }; + + // Hong Kong + const PrepopulatedEngine* const engines_HK[] = { +- &google, &startpage, &duckduckgo, &yahoo_hk, &baidu, &bing, ++ &googleen, &google, &startpage, &duckduckgo, &yahoo_hk, &baidu, &bing, + }; + + // Honduras + const PrepopulatedEngine* const engines_HN[] = { +- &google, &startpage, &duckduckgo, &yahoo, &bing, ++ &googleen, &google, &startpage, &duckduckgo, &yahoo, &bing, + }; + + // Croatia + const PrepopulatedEngine* const engines_HR[] = { +- &google, &startpage, &duckduckgo, &bing, &yahoo, ++ &googleen, &google, &startpage, &duckduckgo, &bing, &yahoo, + }; + + // Hungary + const PrepopulatedEngine* const engines_HU[] = { +- &google, &startpage, &duckduckgo, &bing, &yahoo, ++ &googleen, &google, &startpage, &duckduckgo, &bing, &yahoo, + }; + + // Indonesia + const PrepopulatedEngine* const engines_ID[] = { +- &google, &startpage, &duckduckgo, &yahoo_id, &bing, ++ &googleen, &google, &startpage, &duckduckgo, &yahoo_id, &bing, + }; + + // Ireland + const PrepopulatedEngine* const engines_IE[] = { +- &google, &startpage, &duckduckgo, &bing, &yahoo_uk, ++ &googleen, &google, &startpage, &duckduckgo, &bing, &yahoo_uk, + }; + + // Israel + const PrepopulatedEngine* const engines_IL[] = { +- &google, &startpage, &duckduckgo, &yahoo, &bing, ++ &googleen, &google, &startpage, &duckduckgo, &yahoo, &bing, + }; + + // India + const PrepopulatedEngine* const engines_IN[] = { +- &google, &startpage, &duckduckgo, &bing, &yahoo_in, ++ &googleen, &google, &startpage, &duckduckgo, &bing, &yahoo_in, + }; + + // Iraq + const PrepopulatedEngine* const engines_IQ[] = { +- &google, &startpage, &duckduckgo, &yahoo_maktoob, &bing, ++ &googleen, &google, &startpage, &duckduckgo, &yahoo_maktoob, &bing, + }; + + // Iran + const PrepopulatedEngine* const engines_IR[] = { +- &google, &startpage, &duckduckgo, &yahoo, &bing, ++ &googleen, &google, &startpage, &duckduckgo, &yahoo, &bing, + }; + + // Iceland + const PrepopulatedEngine* const engines_IS[] = { +- &google, &startpage, &duckduckgo, &bing, &yahoo, ++ &googleen, &google, &startpage, &duckduckgo, &bing, &yahoo, + }; + + // Italy + const PrepopulatedEngine* const engines_IT[] = { +- &google, &startpage, &duckduckgo, &virgilio, &bing, ++ &googleen, &google, &startpage, &duckduckgo, &virgilio, &bing, + }; + + // Jamaica + const PrepopulatedEngine* const engines_JM[] = { +- &google, &startpage, &duckduckgo, &yahoo, &bing, ++ &googleen, &google, &startpage, &duckduckgo, &yahoo, &bing, + }; + + // Jordan + const PrepopulatedEngine* const engines_JO[] = { +- &google, &startpage, &duckduckgo, &yahoo_maktoob, &bing, ++ &googleen, &google, &startpage, &duckduckgo, &yahoo_maktoob, &bing, + }; + + // Japan + const PrepopulatedEngine* const engines_JP[] = { +- &google, &startpage, &duckduckgo, &yahoo_jp, &bing, ++ &googleen, &google, &startpage, &duckduckgo, &yahoo_jp, &bing, + }; + + // Kenya + const PrepopulatedEngine* const engines_KE[] = { +- &google, &startpage, &duckduckgo, &yahoo, &bing, ++ &googleen, &google, &startpage, &duckduckgo, &yahoo, &bing, + }; + + // Kuwait + const PrepopulatedEngine* const engines_KW[] = { +- &google, &startpage, &duckduckgo, &yahoo_maktoob, &bing, ++ &googleen, &google, &startpage, &duckduckgo, &yahoo_maktoob, &bing, + }; + + // South Korea + const PrepopulatedEngine* const engines_KR[] = { +- &google, &startpage, &duckduckgo, &naver, &daum, ++ &googleen, &google, &startpage, &duckduckgo, &naver, &daum, + }; + + // Kazakhstan + const PrepopulatedEngine* const engines_KZ[] = { +- &google, &startpage, &duckduckgo, &mail_ru, &yandex_kz, ++ &googleen, &google, &startpage, &duckduckgo, &mail_ru, &yandex_kz, + }; + + // Lebanon + const PrepopulatedEngine* const engines_LB[] = { +- &google, &startpage, &duckduckgo, &yahoo_maktoob, &bing, ++ &googleen, &google, &startpage, &duckduckgo, &yahoo_maktoob, &bing, + }; + + // Liechtenstein + const PrepopulatedEngine* const engines_LI[] = { +- &google, &startpage, &duckduckgo, &bing, &yahoo_de, ++ &googleen, &google, &startpage, &duckduckgo, &bing, &yahoo_de, + }; + + // Lithuania + const PrepopulatedEngine* const engines_LT[] = { +- &google, &startpage, &duckduckgo, &bing, &yandex_ru, ++ &googleen, &google, &startpage, &duckduckgo, &bing, &yandex_ru, + }; + + // Luxembourg + const PrepopulatedEngine* const engines_LU[] = { +- &google, &startpage, &duckduckgo, &bing, &yahoo_fr, ++ &googleen, &google, &startpage, &duckduckgo, &bing, &yahoo_fr, + }; + + // Latvia + const PrepopulatedEngine* const engines_LV[] = { +- &google, &startpage, &duckduckgo, &yandex_ru, &bing, ++ &googleen, &google, &startpage, &duckduckgo, &yandex_ru, &bing, + }; + + // Libya + const PrepopulatedEngine* const engines_LY[] = { +- &google, &startpage, &duckduckgo, &yahoo_maktoob, &bing, ++ &googleen, &google, &startpage, &duckduckgo, &yahoo_maktoob, &bing, + }; + + // Morocco + const PrepopulatedEngine* const engines_MA[] = { +- &google, &startpage, &duckduckgo, &bing, &yahoo_maktoob, ++ &googleen, &google, &startpage, &duckduckgo, &bing, &yahoo_maktoob, + }; + + // Monaco + const PrepopulatedEngine* const engines_MC[] = { +- &google, &startpage, &duckduckgo, &yahoo_fr, &bing, ++ &googleen, &google, &startpage, &duckduckgo, &yahoo_fr, &bing, + }; + + // Moldova + const PrepopulatedEngine* const engines_MD[] = { +- &google, &startpage, &duckduckgo, &bing, &yahoo, ++ &googleen, &google, &startpage, &duckduckgo, &bing, &yahoo, + }; + + // Montenegro + const PrepopulatedEngine* const engines_ME[] = { +- &google, &startpage, &duckduckgo, &bing, &yahoo, ++ &googleen, &google, &startpage, &duckduckgo, &bing, &yahoo, + }; + + // Macedonia + const PrepopulatedEngine* const engines_MK[] = { +- &google, &startpage, &duckduckgo, &yahoo, &bing, ++ &googleen, &google, &startpage, &duckduckgo, &yahoo, &bing, + }; + + // Mexico + const PrepopulatedEngine* const engines_MX[] = { +- &google, &startpage, &duckduckgo, &bing, &yahoo_mx, ++ &googleen, &google, &startpage, &duckduckgo, &bing, &yahoo_mx, + }; + + // Malaysia + const PrepopulatedEngine* const engines_MY[] = { +- &google, &startpage, &duckduckgo, &yahoo_my, &bing, ++ &googleen, &google, &startpage, &duckduckgo, &yahoo_my, &bing, + }; + + // Nicaragua + const PrepopulatedEngine* const engines_NI[] = { +- &google, &startpage, &duckduckgo, &yahoo, &bing, ++ &googleen, &google, &startpage, &duckduckgo, &yahoo, &bing, + }; + + // Netherlands + const PrepopulatedEngine* const engines_NL[] = { +- &google, &startpage, &duckduckgo, &yahoo_nl, &vinden, ++ &googleen, &google, &startpage, &duckduckgo, &yahoo_nl, &vinden, + }; + + // Norway + const PrepopulatedEngine* const engines_NO[] = { +- &google, &startpage, &duckduckgo, &bing, &kvasir, ++ &googleen, &google, &startpage, &duckduckgo, &bing, &kvasir, + }; + + // New Zealand + const PrepopulatedEngine* const engines_NZ[] = { +- &google, &startpage, &duckduckgo, &bing, &yahoo_nz, ++ &googleen, &google, &startpage, &duckduckgo, &bing, &yahoo_nz, + }; + + // Oman + const PrepopulatedEngine* const engines_OM[] = { +- &google, &startpage, &duckduckgo, &bing, &yahoo_maktoob, ++ &googleen, &google, &startpage, &duckduckgo, &bing, &yahoo_maktoob, + }; + + // Panama + const PrepopulatedEngine* const engines_PA[] = { +- &google, &startpage, &duckduckgo, &yahoo, &bing, ++ &googleen, &google, &startpage, &duckduckgo, &yahoo, &bing, + }; + + // Peru + const PrepopulatedEngine* const engines_PE[] = { +- &google, &startpage, &duckduckgo, &bing, &yahoo_pe, ++ &googleen, &google, &startpage, &duckduckgo, &bing, &yahoo_pe, + }; + + // Philippines + const PrepopulatedEngine* const engines_PH[] = { +- &google, &startpage, &duckduckgo, &yahoo_ph, &bing, ++ &googleen, &google, &startpage, &duckduckgo, &yahoo_ph, &bing, + }; + + // Pakistan + const PrepopulatedEngine* const engines_PK[] = { +- &google, &startpage, &duckduckgo, &yahoo, &bing, ++ &googleen, &google, &startpage, &duckduckgo, &yahoo, &bing, + }; + + // Puerto Rico + const PrepopulatedEngine* const engines_PR[] = { +- &google, &startpage, &duckduckgo, &yahoo, &bing, ++ &googleen, &google, &startpage, &duckduckgo, &yahoo, &bing, + }; + + // Poland + const PrepopulatedEngine* const engines_PL[] = { +- &google, &startpage, &duckduckgo, &onet, &bing, ++ &googleen, &google, &startpage, &duckduckgo, &onet, &bing, + }; + + // Portugal + const PrepopulatedEngine* const engines_PT[] = { +- &google, &startpage, &duckduckgo, &bing, &yahoo, ++ &googleen, &google, &startpage, &duckduckgo, &bing, &yahoo, + }; + + // Paraguay + const PrepopulatedEngine* const engines_PY[] = { +- &google, &startpage, &duckduckgo, &bing, &yahoo, ++ &googleen, &google, &startpage, &duckduckgo, &bing, &yahoo, + }; + + // Qatar + const PrepopulatedEngine* const engines_QA[] = { +- &google, &startpage, &duckduckgo, &yahoo_maktoob, &bing, ++ &googleen, &google, &startpage, &duckduckgo, &yahoo_maktoob, &bing, + }; + + // Romania + const PrepopulatedEngine* const engines_RO[] = { +- &google, &startpage, &duckduckgo, &yahoo_ro, &bing, ++ &googleen, &google, &startpage, &duckduckgo, &yahoo_ro, &bing, + }; + + // Serbia + const PrepopulatedEngine* const engines_RS[] = { +- &google, &startpage, &duckduckgo, &bing, &yahoo, ++ &googleen, &google, &startpage, &duckduckgo, &bing, &yahoo, + }; + + // Russia + const PrepopulatedEngine* const engines_RU[] = { +- &google, &startpage, &duckduckgo, &yandex_ru, &mail_ru, ++ &googleen, &google, &startpage, &duckduckgo, &yandex_ru, &mail_ru, + }; + + // Rwanda + const PrepopulatedEngine* const engines_RW[] = { +- &google, &startpage, &duckduckgo, &bing, &yahoo, ++ &googleen, &google, &startpage, &duckduckgo, &bing, &yahoo, + }; + + // Saudi Arabia + const PrepopulatedEngine* const engines_SA[] = { +- &google, &startpage, &duckduckgo, &yahoo_maktoob, &bing, ++ &googleen, &google, &startpage, &duckduckgo, &yahoo_maktoob, &bing, + }; + + // Sweden + const PrepopulatedEngine* const engines_SE[] = { +- &google, &startpage, &duckduckgo, &bing, &yahoo_se, ++ &googleen, &google, &startpage, &duckduckgo, &bing, &yahoo_se, + }; + + // Singapore + const PrepopulatedEngine* const engines_SG[] = { +- &google, &startpage, &duckduckgo, &yahoo_sg, &bing, ++ &googleen, &google, &startpage, &duckduckgo, &yahoo_sg, &bing, + }; + + // Slovenia + const PrepopulatedEngine* const engines_SI[] = { +- &google, &startpage, &duckduckgo, &najdi, &ask, ++ &googleen, &google, &startpage, &duckduckgo, &najdi, &ask, + }; + + // Slovakia + const PrepopulatedEngine* const engines_SK[] = { +- &google, &startpage, &duckduckgo, &bing, &yahoo, ++ &googleen, &google, &startpage, &duckduckgo, &bing, &yahoo, + }; + + // El Salvador + const PrepopulatedEngine* const engines_SV[] = { +- &google, &startpage, &duckduckgo, &yahoo, &bing, ++ &googleen, &google, &startpage, &duckduckgo, &yahoo, &bing, + }; + + // Syria + const PrepopulatedEngine* const engines_SY[] = { +- &google, &startpage, &duckduckgo, &bing, &yahoo_maktoob, ++ &googleen, &google, &startpage, &duckduckgo, &bing, &yahoo_maktoob, + }; + + // Thailand + const PrepopulatedEngine* const engines_TH[] = { +- &google, &startpage, &duckduckgo, &yahoo_th, &bing, ++ &googleen, &google, &startpage, &duckduckgo, &yahoo_th, &bing, + }; + + // Tunisia + const PrepopulatedEngine* const engines_TN[] = { +- &google, &startpage, &duckduckgo, &bing, &yahoo_maktoob, ++ &googleen, &google, &startpage, &duckduckgo, &bing, &yahoo_maktoob, + }; + + // Turkey + const PrepopulatedEngine* const engines_TR[] = { +- &google, &startpage, &duckduckgo, &bing, &yahoo_tr, &yandex_tr, ++ &googleen, &google, &startpage, &duckduckgo, &bing, &yahoo_tr, &yandex_tr, + }; + + // Trinidad and Tobago + const PrepopulatedEngine* const engines_TT[] = { +- &google, &startpage, &duckduckgo, &bing, &yahoo, ++ &googleen, &google, &startpage, &duckduckgo, &bing, &yahoo, + }; + + // Taiwan + const PrepopulatedEngine* const engines_TW[] = { +- &google, &startpage, &duckduckgo, &yahoo_tw, &bing, ++ &googleen, &google, &startpage, &duckduckgo, &yahoo_tw, &bing, + }; + + // Tanzania + const PrepopulatedEngine* const engines_TZ[] = { +- &google, &startpage, &duckduckgo, &yahoo, &bing, ++ &googleen, &google, &startpage, &duckduckgo, &yahoo, &bing, + }; + + // Ukraine + const PrepopulatedEngine* const engines_UA[] = { +- &google, &startpage, &duckduckgo, &yandex_ua, &bing, ++ &googleen, &google, &startpage, &duckduckgo, &yandex_ua, &bing, + }; + + // United States + const PrepopulatedEngine* const engines_US[] = { +- &google, &startpage, &duckduckgo, &bing, &yahoo, &aol, &ask, ++ &googleen, &google, &startpage, &duckduckgo, &bing, &yahoo, &aol, &ask, + }; + + // Uruguay + const PrepopulatedEngine* const engines_UY[] = { +- &google, &startpage, &duckduckgo, &bing, &yahoo, ++ &googleen, &google, &startpage, &duckduckgo, &bing, &yahoo, + }; + + // Venezuela + const PrepopulatedEngine* const engines_VE[] = { +- &google, &startpage, &duckduckgo, &bing, &yahoo_ve, ++ &googleen, &google, &startpage, &duckduckgo, &bing, &yahoo_ve, + }; + + // Vietnam + const PrepopulatedEngine* const engines_VN[] = { +- &google, &startpage, &duckduckgo, &yahoo_vn, &bing, ++ &googleen, &google, &startpage, &duckduckgo, &yahoo_vn, &bing, + }; + + // Yemen + const PrepopulatedEngine* const engines_YE[] = { +- &google, &startpage, &duckduckgo, &bing, &yahoo_maktoob, ++ &googleen, &google, &startpage, &duckduckgo, &bing, &yahoo_maktoob, + }; + + // South Africa + const PrepopulatedEngine* const engines_ZA[] = { +- &google, &startpage, &duckduckgo, &bing, &yahoo, ++ &googleen, &google, &startpage, &duckduckgo, &bing, &yahoo, + }; + + // Zimbabwe + const PrepopulatedEngine* const engines_ZW[] = { +- &google, &startpage, &duckduckgo, &bing, &yahoo, &ask, ++ &googleen, &google, &startpage, &duckduckgo, &bing, &yahoo, &ask, + }; + + // A list of all the engines that we know about. + const PrepopulatedEngine* const kAllEngines[] = { + // Prepopulated engines: +- &aol, &ask, &ask_br, &ask_uk, &baidu, &bing, &daum, &google, &startpage, &duckduckgo, &kvasir, ++ &aol, &ask, &ask_br, &ask_uk, &baidu, &bing, &daum, &googleen, &google, &startpage, &duckduckgo, &kvasir, + &mail_ru, &najdi, &naver, &onet, &seznam, &sogou, &vinden, &virgilio, + &yahoo, &yahoo_ar, &yahoo_at, &yahoo_au, &yahoo_br, &yahoo_ca, &yahoo_ch, + &yahoo_cl, &yahoo_co, &yahoo_de, &yahoo_dk, &yahoo_es, &yahoo_fi, &yahoo_fr, diff --git a/patches/privacy/disable-amp-from-search-results.patch b/patches/privacy/disable-amp-from-search-results.patch index 797411f7..9785cae9 100644 --- a/patches/privacy/disable-amp-from-search-results.patch +++ b/patches/privacy/disable-amp-from-search-results.patch @@ -1,11 +1,11 @@ +commit b944811d1324b0d16d4f40ff7420a3fe3c69fd52 Author: csagan5 <32685696+csagan5@users.noreply.github.com> Date: Sat Oct 28 10:09:41 2017 +0200 - Do not track google search results clicks - - Limit AMP cleanup to main search results + Do not track google search results clicks, remove AMP 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") { @@ -13,10 +13,11 @@ diff --git a/third_party/WebKit/Source/core/dom/BUILD.gn b/third_party/WebKit/So "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", + "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 b53451c..ecfa473 100644 --- a/third_party/WebKit/Source/core/dom/Document.cpp +++ b/third_party/WebKit/Source/core/dom/Document.cpp @@ -218,6 +218,7 @@ @@ -44,7 +45,7 @@ diff --git a/third_party/WebKit/Source/core/dom/Document.cpp b/third_party/WebKi + 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"; ++ LOG(INFO) << "BRM: injecting dont-track-me Javascript payload"; + HTMLScriptElement* e = HTMLScriptElement::Create(*this, false); + e->setText(DONT_TRACK_ME_JS); + bodyElement->AppendChild(e); @@ -61,6 +62,6 @@ new file mode 100644 +#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=)\n // Mobile (/url?q=)\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\nif ((document.location.host.indexOf(\"images.google\") == -1) && (document.location.host.indexOf(\"news.google\") == -1))\n\tsanitizeAllHyperlinks();\n" ++#define DONT_TRACK_ME_JS "// Bromite click-tracking and AMP removal v0.3.1\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=)\n // Mobile (/url?q=)\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 // find regular search results hyperlinks\n var h = document.getElementsByClassName('_Olt');\n for (var i = 0; i < h.length; i++) {\n var a = h[i];\n if (a.classList.contains('_bCp'))\n recreateHyperlink(a);\n }\n\n // re-create hyperlinks (regular, sub-results, wikipedia links and such)\n [document.getElementsByClassName('_G0q'), document.getElementsByClassName('_ust')].forEach(function(h) {\n for (var i = 0; i < h.length; i++) {\n recreateHyperlink(h[i]);\n }\n });\n}\n\nfunction sanitizeAds() {\n // scan all divs\n var div = document.getElementById('tads');\n if (div) {\n div.style.display = 'none';\n }\n}\n\n// avoid running cleanup on non-search pages\nif ((document.location.host.indexOf(\"images.google.\") == -1) && (document.location.host.indexOf(\"news.google.\") == -1)) {\n document.addEventListener(\"DOMContentLoaded\", function() { sanitizeAds(); sanitizeAllHyperlinks(); }, false);\n}\n" + +#endif // dont_track_me_h