Skip to content

Commit

Permalink
Release 63.0.3239.150
Browse files Browse the repository at this point in the history
  • Loading branch information
csagan5 committed Jan 27, 2018
1 parent b869bb5 commit 0d6534d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,9 @@
# 63.0.3239.150
* fixed crash when clicking on address bar lock (page info) or opening site settings (https://github.com/bromite/bromite/issues/28)
* build H264 with NEON optimizations for ARMv7
* updated AdBlock filters
* more builds for arm64 architecture

# 63.0.3239.144
* fixed invalid AdBlock filter rule blocking all connections (https://github.com/bromite/bromite/issues/26)
* updated AdBlock filters
Expand Down
4 changes: 2 additions & 2 deletions patches/privacy/disable-amp-from-search-results.patch
Expand Up @@ -45,7 +45,7 @@ index b53451c..ecfa473 100644
+ 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";
+ LOG(INFO) << "Bromite: injecting dont-track-me Javascript payload";
+ HTMLScriptElement* e = HTMLScriptElement::Create(*this, false);
+ e->setText(DONT_TRACK_ME_JS);
+ bodyElement->AppendChild(e);
Expand All @@ -62,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 v0.3.5 */\n\nfunction recreateHyperlink(a) {\n // skip already-sanitized hyperlinks\n if (a.sane) return false;\n\n // create new A element - old one has event listeners attached\n var newA = document.createElement('a');\n newA.referrerPolicy = 'origin';\n // property set when hyperlink has been created by this script\n newA.sane = 1;\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 false;\n }\n // leave original href unchanged\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 return true;\n}\n\nfunction isResult(a) {\n if (a.getAttribute('data-amp-cur'))\n return true;\n var inlineMousedown = a.getAttribute('onmousedown');\n if (!inlineMousedown)\n\treturn false;\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 return /\\ba?rwt\\(/.test(inlineMousedown) || /\\bctpacw\\b/.test(inlineMousedown);\n}\n\n// sanitize hyperlinks as they are long-touched - currently unused\n/*function handlePointerPress(e) {\n var a = e.target;\n while (a && !a.href) {\n a = a.parentElement;\n }\n if (!a) {\n return;\n }\n if (isResult(a)) {\n // In Chrome, removing onmousedown during event dispatch does not\n // prevent the inline listener from running... So we have to cancel\n // event propagation just in case.\n e.stopImmediatePropagation();\n\n a.removeAttribute('onmousedown');\n // remove also ping and oncontextmenu, just in case\n a.removeAttribute('ping');\n a.removeAttribute('oncontextmenu');\n // (event attributes are removed here, but hyperlinks is going to be re-created anyway)\n\n recreateHyperlink(a);\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.indexOf('www.google.') == 0) &&\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 sanitizeAds() {\n // scan all divs\n var div = document.getElementById('tads');\n if (div) {\n div.style.display = 'none';\n\treturn true;\n }\n return false;\n}\n\nfunction sanitizeAll() {\n console.log(\"ads removed: \", sanitizeAds());\n console.log(\"hyperlinks sanitized: \", sanitizeAllHyperlinks());\n}\n\nfunction setMlogoClick() {\n var mlogo = document.getElementById('mlogo');\n if (mlogo) {\n mlogo.removeAttribute(\"href\");\n mlogo.setAttribute(\"onclick\", \"sanitizeAll()\");\n console.log(\"logo link replaced\");\n } else {\n console.log(\"could not replace logo link\");\n }\n}\n\nfunction sanitizeAllHyperlinks() {\n var saned = 0, total = 0;\n document.querySelectorAll('div[data-hveid]:not([data-hveid=\"\"]) a').forEach(function(a) {\n\ttotal++;\n\tvar res = recreateHyperlink(a);\n\tif (res) saned++;\n });\n console.log(\"sanitized \", saned, \"/\", total, \" hyperlinks\");\n\n return saned;\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('touchstart', handlePointerPress, true);\n sanitizeAll();\n}\nsetMlogoClick();\n"
+#define DONT_TRACK_ME_JS "/* Bromite click-tracking and AMP removal v0.3.5 */\n\nfunction recreateHyperlink(a) {\n // skip already-sanitized hyperlinks\n if (a.sane) return false;\n\n // create new A element - old one has event listeners attached\n var newA = document.createElement('a');\n newA.referrerPolicy = 'origin';\n // property set when hyperlink has been created by this script\n newA.sane = 1;\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 false;\n }\n // leave original href unchanged\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 return true;\n}\n\nfunction isResult(a) {\n if (a.getAttribute('data-amp-cur'))\n return true;\n var inlineMousedown = a.getAttribute('onmousedown');\n if (!inlineMousedown)\n\treturn false;\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 return /\\ba?rwt\\(/.test(inlineMousedown) || /\\bctpacw\\b/.test(inlineMousedown);\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.indexOf('www.google.') == 0) &&\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 sanitizeAds() {\n // scan all divs\n var div = document.getElementById('tads');\n if (div) {\n div.style.display = 'none';\n\treturn true;\n }\n return false;\n}\n\nfunction sanitizeAll() {\n console.log(\"ads removed: \", sanitizeAds());\n console.log(\"hyperlinks sanitized: \", sanitizeAllHyperlinks());\n}\n\nfunction setMlogoClick() {\n var mlogo = document.getElementById('mlogo');\n if (mlogo) {\n mlogo.removeAttribute(\"href\");\n mlogo.setAttribute(\"onclick\", \"sanitizeAll()\");\n console.log(\"logo link replaced\");\n } else {\n console.log(\"could not replace logo link\");\n }\n}\n\nfunction sanitizeAllHyperlinks() {\n var saned = 0, total = 0;\n document.querySelectorAll('div[data-hveid]:not([data-hveid=\"\"]) a').forEach(function(a) {\n\ttotal++;\n\tvar res = recreateHyperlink(a);\n\tif (res) saned++;\n });\n console.log(\"sanitized \", saned, \"/\", total, \" hyperlinks\");\n\n return saned;\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('touchstart', handlePointerPress, true);\n sanitizeAll();\n}\nsetMlogoClick();\n"
+
+#endif // dont_track_me_h

0 comments on commit 0d6534d

Please sign in to comment.