diff options
author | André Fabian Silva Delgado <emulatorman@parabola.nu> | 2013-10-22 21:06:08 -0200 |
---|---|---|
committer | André Fabian Silva Delgado <emulatorman@parabola.nu> | 2013-10-22 21:06:08 -0200 |
commit | cd47d5b56c742003a87387de5856dc6af3a9c404 (patch) | |
tree | 52c6e44029996aada6f91595b4183a5edc7961f9 | |
parent | 6b8ac7e5b9723cb37bf40f4f35bb6864902e30e1 (diff) |
iceweasel-libre: patch and remove snippets (adware) from source code
-rw-r--r-- | libre/iceweasel-libre/PKGBUILD | 6 | ||||
-rw-r--r-- | libre/iceweasel-libre/libre.patch | 454 |
2 files changed, 399 insertions, 61 deletions
diff --git a/libre/iceweasel-libre/PKGBUILD b/libre/iceweasel-libre/PKGBUILD index 08efafb34..305da3c9e 100644 --- a/libre/iceweasel-libre/PKGBUILD +++ b/libre/iceweasel-libre/PKGBUILD @@ -62,7 +62,7 @@ md5sums=('8f24807d67599516850a4bdca2b2fbd6' '1f4f1347e05b15f5af137787d614ecdf' '350feec44d359c31679dbec3de6685df' 'df08eaa1ac3bc6c2356be4fbf8ec8932' - '5b32b39c033a33f45e2cfc6c3e80f20c' + '5e01a51ec4f3dd72ff2525edfe6cd371' '7b9e5996dd9fe0b186a43a297db1c6b5' 'abf5ecb74caa857abb42bcfbb3442d9c' '121fefaa040936c3b96298da0c49f450' @@ -102,8 +102,10 @@ prepare() { fi done - # Patch anything that's left + # Patch and remove anything that's left patch -Np1 -i "$srcdir/libre.patch" + rm -v browser/base/content/abouthome/snippet*.png || true + sed -i "\|abouthome/snippet|d" browser/base/jar.mn cp "$srcdir/mozconfig" .mozconfig # Load our build config, disable SafeSearch diff --git a/libre/iceweasel-libre/libre.patch b/libre/iceweasel-libre/libre.patch index 504ebca91..c0e61d5b9 100644 --- a/libre/iceweasel-libre/libre.patch +++ b/libre/iceweasel-libre/libre.patch @@ -1,7 +1,8 @@ -diff -ruN mozilla-release.orig/browser/app/profile/firefox.js mozilla-release/browser/app/profile/firefox.js ---- mozilla-release.orig/browser/app/profile/firefox.js 2013-08-07 10:36:49.891513965 -0300 -+++ mozilla-release/browser/app/profile/firefox.js 2013-08-12 22:34:34.309460804 -0300 -@@ -1206,14 +1206,6 @@ +diff --git a/browser/app/profile/firefox.js b/browser/app/profile/firefox.js +index 2617a7f..a70434a 100644 +--- a/browser/app/profile/firefox.js ++++ b/browser/app/profile/firefox.js +@@ -1242,14 +1242,6 @@ pref("pdfjs.previousHandler.alwaysAskBeforeHandling", false); // (This is intentionally on the high side; see bug 746055.) pref("image.mem.max_decoded_image_kb", 256000); @@ -16,10 +17,107 @@ diff -ruN mozilla-release.orig/browser/app/profile/firefox.js mozilla-release/br // Turn on the CSP 1.0 parser for Content Security Policy headers pref("security.csp.speccompliant", true); -diff -ruN mozilla-release.orig/browser/base/content/abouthome/aboutHome.js mozilla-release/browser/base/content/abouthome/aboutHome.js ---- mozilla-release.orig/browser/base/content/abouthome/aboutHome.js 2013-08-07 11:44:11.230486326 -0300 -+++ mozilla-release/browser/base/content/abouthome/aboutHome.js 2013-08-08 08:27:08.189418422 -0300 -@@ -3,132 +3,41 @@ +diff --git a/browser/base/content/abouthome/aboutHome.css b/browser/base/content/abouthome/aboutHome.css +index ce8db3c..27ff8b6 100644 +--- a/browser/base/content/abouthome/aboutHome.css ++++ b/browser/base/content/abouthome/aboutHome.css +@@ -51,11 +51,6 @@ a { + background-repeat: no-repeat; + } + +-#searchForm, +-#snippets { +- width: 470px; +-} +- + #searchForm { + display: -moz-box; + } +@@ -74,8 +69,7 @@ a { + #searchEngineLogo { + display: inline-block; + height: 28px; +- width: 70px; +- min-width: 70px; ++ width: 47px; + } + + #searchText { +@@ -147,48 +141,6 @@ a { + transition-duration: 0ms; + } + +-#defaultSnippet1, +-#defaultSnippet2, +-#rightsSnippet { +- display: block; +- min-height: 38px; +- background: 30px center no-repeat; +- padding: 6px 0; +- -moz-padding-start: 79px; +-} +- +-#rightsSnippet[hidden] { +- display: none; +-} +- +-#defaultSnippet1:-moz-dir(rtl), +-#defaultSnippet2:-moz-dir(rtl), +-#rightsSnippet:-moz-dir(rtl) { +- background-position: right 30px center; +-} +- +-#defaultSnippet1 { +- background-image: url("chrome://browser/content/abouthome/snippet1.png"); +-} +- +-#defaultSnippet2 { +- background-image: url("chrome://browser/content/abouthome/snippet2.png"); +-} +- +-#snippets { +- display: inline-block; +- text-align: start; +- margin: 12px 0; +- color: #3c3c3c; +- font-size: 75%; +- /* 12px is the computed font size, 15px the computed line height of the snippets +- with Segoe UI on a default Windows 7 setup. The 15/12 multiplier approximately +- converts em from units of font-size to units of line-height. The goal is to +- preset the height of a three-line snippet to avoid visual moving/flickering as +- the snippets load. */ +- min-height: calc(15/12 * 3em); +-} +- + #launcher { + display: -moz-box; + -moz-box-align: center; +@@ -368,20 +320,6 @@ body[narrow] #restorePreviousSession::before { + background-image: url("chrome://branding/content/about-logo@2x.png"); + } + +- #defaultSnippet1, +- #defaultSnippet2, +- #rightsSnippet { +- background-size: 40px; +- } +- +- #defaultSnippet1 { +- background-image: url("chrome://browser/content/abouthome/snippet1@2x.png"); +- } +- +- #defaultSnippet2 { +- background-image: url("chrome://browser/content/abouthome/snippet2@2x.png"); +- } +- + .launchButton::before, + #aboutMozilla::before { + transform: scale(.5); +diff --git a/browser/base/content/abouthome/aboutHome.js b/browser/base/content/abouthome/aboutHome.js +index dd050d3..7ae28d2 100644 +--- a/browser/base/content/abouthome/aboutHome.js ++++ b/browser/base/content/abouthome/aboutHome.js +@@ -3,147 +3,44 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ const SEARCH_ENGINES = { @@ -186,31 +284,265 @@ diff -ruN mozilla-release.orig/browser/base/content/abouthome/aboutHome.js mozil } }; -@@ -138,7 +47,7 @@ - // * add an entry here in the proper ordering (based on spans) - // The <a/> part of the snippet will be linked to the corresponding url. - const DEFAULT_SNIPPETS_URLS = [ +-// The process of adding a new default snippet involves: +-// * add a new entity to aboutHome.dtd +-// * add a <span/> for it in aboutHome.xhtml +-// * add an entry here in the proper ordering (based on spans) +-// The <a/> part of the snippet will be linked to the corresponding url. +-const DEFAULT_SNIPPETS_URLS = [ - "https://www.mozilla.org/firefox/features/?utm_source=snippet&utm_medium=snippet&utm_campaign=default+feature+snippet" -+ "http://packages.debian.org/experimental/iceweasel" - , "https://www.gnu.org/software/gnuzilla/addons.html" - ]; +-, "https://addons.mozilla.org/firefox/?utm_source=snippet&utm_medium=snippet&utm_campaign=addons" +-]; +- +-const SNIPPETS_UPDATE_INTERVAL_MS = 86400000; // 1 Day. +- + // This global tracks if the page has been set up before, to prevent double inits + let gInitialized = false; + let gObserver = new MutationObserver(function (mutations) { +@@ -151,7 +48,6 @@ let gObserver = new MutationObserver(function (mutations) { + if (mutation.attributeName == "searchEngineURL") { + setupSearchEngine(); + if (!gInitialized) { +- ensureSnippetsMapThen(loadSnippets); + gInitialized = true; + } + return; +@@ -172,70 +68,6 @@ window.addEventListener("pagehide", function() { + window.removeEventListener("resize", fitToWidth); + }); + +-// This object has the same interface as Map and is used to store and retrieve +-// the snippets data. It is lazily initialized by ensureSnippetsMapThen(), so +-// be sure its callback returned before trying to use it. +-let gSnippetsMap; +-let gSnippetsMapCallbacks = []; +- +-/** +- * Ensure the snippets map is properly initialized. +- * +- * @param aCallback +- * Invoked once the map has been initialized, gets the map as argument. +- * @note Snippets should never directly manage the underlying storage, since +- * it may change inadvertently. +- */ +-function ensureSnippetsMapThen(aCallback) +-{ +- if (gSnippetsMap) { +- aCallback(gSnippetsMap); +- return; +- } +- +- // Handle multiple requests during the async initialization. +- gSnippetsMapCallbacks.push(aCallback); +- if (gSnippetsMapCallbacks.length > 1) { +- // We are already updating, the callbacks will be invoked when done. +- return; +- } +- +- // TODO (bug 789348): use a real asynchronous storage here. This setTimeout +- // is done just to catch bugs with the asynchronous behavior. +- setTimeout(function() { +- // Populate the cache from the persistent storage. +- let cache = new Map(); +- for (let key of [ "snippets-last-update", +- "snippets-cached-version", +- "snippets" ]) { +- cache.set(key, localStorage[key]); +- } +- +- gSnippetsMap = Object.freeze({ +- get: function (aKey) cache.get(aKey), +- set: function (aKey, aValue) { +- localStorage[aKey] = aValue; +- return cache.set(aKey, aValue); +- }, +- has: function(aKey) cache.has(aKey), +- delete: function(aKey) { +- delete localStorage[aKey]; +- return cache.delete(aKey); +- }, +- clear: function() { +- localStorage.clear(); +- return cache.clear(); +- }, +- get size() cache.size +- }); +- +- for (let callback of gSnippetsMapCallbacks) { +- callback(gSnippetsMap); +- } +- gSnippetsMapCallbacks.length = 0; +- }, 0); +-} +- + function onSearchSubmit(aEvent) + { + let searchTerms = document.getElementById("searchText").value; +@@ -320,140 +152,6 @@ function setupSearchEngine() -diff -urN mozilla-release.orig/browser/base/content/abouthome/aboutHome.css mozilla-release/browser/base/content/abouthome/aboutHome.css ---- mozilla-release.orig/browser/base/content/abouthome/aboutHome.css 2013-01-04 21:44:27.000000000 -0200 -+++ mozilla-release/browser/base/content/abouthome/aboutHome.css 2013-01-10 01:35:44.497079456 -0200 -@@ -66,8 +66,7 @@ - #searchEngineLogo { - display: inline-block; - height: 28px; -- width: 70px; -- min-width: 70px; -+ width: 47px; } - #searchText { -diff -urN mozilla-release.orig/browser/locales/en-US/chrome/browser-region/region.properties mozilla-release/browser/locales/en-US/chrome/browser-region/region.properties ---- mozilla-release.orig/browser/locales/en-US/chrome/browser-region/region.properties 2013-09-10 20:14:52.000000000 -0300 -+++ mozilla-release/browser/locales/en-US/chrome/browser-region/region.properties 2013-09-18 17:24:08.209539436 -0300 +-/** +- * Update the local snippets from the remote storage, then show them through +- * showSnippets. +- */ +-function loadSnippets() +-{ +- if (!gSnippetsMap) +- throw new Error("Snippets map has not properly been initialized"); +- +- // Check cached snippets version. +- let cachedVersion = gSnippetsMap.get("snippets-cached-version") || 0; +- let currentVersion = document.documentElement.getAttribute("snippetsVersion"); +- if (cachedVersion < currentVersion) { +- // The cached snippets are old and unsupported, restart from scratch. +- gSnippetsMap.clear(); +- } +- +- // Check last snippets update. +- let lastUpdate = gSnippetsMap.get("snippets-last-update"); +- let updateURL = document.documentElement.getAttribute("snippetsURL"); +- let shouldUpdate = !lastUpdate || +- Date.now() - lastUpdate > SNIPPETS_UPDATE_INTERVAL_MS; +- if (updateURL && shouldUpdate) { +- // Try to update from network. +- let xhr = new XMLHttpRequest(); +- try { +- xhr.open("GET", updateURL, true); +- } catch (ex) { +- showSnippets(); +- return; +- } +- // Even if fetching should fail we don't want to spam the server, thus +- // set the last update time regardless its results. Will retry tomorrow. +- gSnippetsMap.set("snippets-last-update", Date.now()); +- xhr.onerror = function (event) { +- showSnippets(); +- }; +- xhr.onload = function (event) +- { +- if (xhr.status == 200) { +- gSnippetsMap.set("snippets", xhr.responseText); +- gSnippetsMap.set("snippets-cached-version", currentVersion); +- } +- showSnippets(); +- }; +- xhr.send(null); +- } else { +- showSnippets(); +- } +-} +- +-/** +- * Shows locally cached remote snippets, or default ones when not available. +- * +- * @note: snippets should never invoke showSnippets(), or they may cause +- * a "too much recursion" exception. +- */ +-let _snippetsShown = false; +-function showSnippets() +-{ +- let snippetsElt = document.getElementById("snippets"); +- +- // Show about:rights notification, if needed. +- let showRights = document.documentElement.getAttribute("showKnowYourRights"); +- if (showRights) { +- let rightsElt = document.getElementById("rightsSnippet"); +- let anchor = rightsElt.getElementsByTagName("a")[0]; +- anchor.href = "about:rights"; +- snippetsElt.appendChild(rightsElt); +- rightsElt.removeAttribute("hidden"); +- return; +- } +- +- if (!gSnippetsMap) +- throw new Error("Snippets map has not properly been initialized"); +- if (_snippetsShown) { +- // There's something wrong with the remote snippets, just in case fall back +- // to the default snippets. +- showDefaultSnippets(); +- throw new Error("showSnippets should never be invoked multiple times"); +- } +- _snippetsShown = true; +- +- let snippets = gSnippetsMap.get("snippets"); +- // If there are remotely fetched snippets, try to to show them. +- if (snippets) { +- // Injecting snippets can throw if they're invalid XML. +- try { +- snippetsElt.innerHTML = snippets; +- // Scripts injected by innerHTML are inactive, so we have to relocate them +- // through DOM manipulation to activate their contents. +- Array.forEach(snippetsElt.getElementsByTagName("script"), function(elt) { +- let relocatedScript = document.createElement("script"); +- relocatedScript.type = "text/javascript;version=1.8"; +- relocatedScript.text = elt.text; +- elt.parentNode.replaceChild(relocatedScript, elt); +- }); +- return; +- } catch (ex) { +- // Bad content, continue to show default snippets. +- } +- } +- +- showDefaultSnippets(); +-} +- +-/** +- * Clear snippets element contents and show default snippets. +- */ +-function showDefaultSnippets() +-{ +- // Clear eventual contents... +- let snippetsElt = document.getElementById("snippets"); +- snippetsElt.innerHTML = ""; +- +- // ...then show default snippets. +- let defaultSnippetsElt = document.getElementById("defaultSnippets"); +- let entries = defaultSnippetsElt.querySelectorAll("span"); +- // Choose a random snippet. Assume there is always at least one. +- let randIndex = Math.floor(Math.random() * entries.length); +- let entry = entries[randIndex]; +- // Inject url in the eventual link. +- if (DEFAULT_SNIPPETS_URLS[randIndex]) { +- let links = entry.getElementsByTagName("a"); +- // Default snippets can have only one link, otherwise something is messed +- // up in the translation. +- if (links.length == 1) { +- links[0].href = DEFAULT_SNIPPETS_URLS[randIndex]; +- } +- } +- // Move the default snippet to the snippets element. +- snippetsElt.appendChild(entry); +-} +- + function fitToWidth() { + if (window.scrollMaxX) { + document.body.setAttribute("narrow", "true"); +diff --git a/browser/base/content/abouthome/aboutHome.xhtml b/browser/base/content/abouthome/aboutHome.xhtml +index cd821c4..9816d54 100644 +--- a/browser/base/content/abouthome/aboutHome.xhtml ++++ b/browser/base/content/abouthome/aboutHome.xhtml +@@ -43,15 +43,6 @@ + <input id="searchSubmit" type="submit" value="&abouthome.searchEngineButton.label;"/> + </form> + </div> +- +- <div id="snippetContainer"> +- <div id="defaultSnippets" hidden="true"> +- <span id="defaultSnippet1">&abouthome.defaultSnippet1.v1;</span> +- <span id="defaultSnippet2">&abouthome.defaultSnippet2.v1;</span> +- </div> +- <span id="rightsSnippet" hidden="true">&abouthome.rightsSnippet;</span> +- <div id="snippets"/> +- </div> + </div> + <div class="spacer"/> + +diff --git a/browser/locales/en-US/chrome/browser-region/region.properties b/browser/locales/en-US/chrome/browser-region/region.properties +index 23a30d0..fe7f265 100644 +--- a/browser/locales/en-US/chrome/browser-region/region.properties ++++ b/browser/locales/en-US/chrome/browser-region/region.properties @@ -3,17 +3,12 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. @@ -233,7 +565,7 @@ diff -urN mozilla-release.orig/browser/locales/en-US/chrome/browser-region/regio # increment this number when anything gets changed in the list below. This will # cause Firefox to re-read these prefs and inject any new handlers into the -@@ -22,20 +17,10 @@ +@@ -22,20 +17,10 @@ browser.contentHandlers.types.0.uri=http://add.my.yahoo.com/rss?url=%s # don't make any spelling errors here. gecko.handlerService.defaultHandlersVersion=3 @@ -258,31 +590,10 @@ diff -urN mozilla-release.orig/browser/locales/en-US/chrome/browser-region/regio -gecko.handlerService.schemes.ircs.0.uriTemplate=https://www.mibbit.com/?url=%s +gecko.handlerService.schemes.ircs.0.name=Freenode Web IRC +gecko.handlerService.schemes.ircs.0.uriTemplate=https://webchat.freenode.net -diff -ruN mozilla-release.orig/dom/ipc/test.xul mozilla-release/dom/ipc/test.xul ---- mozilla-release.orig/dom/ipc/test.xul 2013-01-04 18:44:31.000000000 -0500 -+++ mozilla-release/dom/ipc/test.xul 2013-01-10 18:19:26.000000000 -0500 -@@ -299,6 +299,6 @@ - oncommand="document.getElementById('page').QueryInterface(Components.interfaces.nsIFrameLoaderOwner).frameLoader.delayRemoteDialogs = this.checked;"/> - </toolbar> - -- <browser type="content" src="http://www.google.com/" flex="1" id="page" remote="true"/> -+ <browser type="content" src="https://duckduckgo.com/html" flex="1" id="page" remote="true"/> - <label id="messageLog" value="" crop="center"/> - </window> -diff -ruN mozilla-release.orig/layout/ipc/test-ipcbrowser.xul mozilla-release/layout/ipc/test-ipcbrowser.xul ---- mozilla-release.orig/layout/ipc/test-ipcbrowser.xul 2013-01-04 18:44:37.000000000 -0500 -+++ mozilla-release/layout/ipc/test-ipcbrowser.xul 2013-01-10 18:20:03.000000000 -0500 -@@ -73,6 +73,6 @@ - label="setViewportScale"/> - </toolbar> - -- <browser type="content" src="http://www.google.com/" flex="1" id="content" -+ <browser type="content" src="https://duckduckgo.com/html" flex="1" id="content" - remote="true"/> - </window> -diff -urN mozilla-release.orig/browser/locales/generic/profile/bookmarks.html.in mozilla-release/browser/locales/generic/profile/bookmarks.html.in ---- mozilla-release.orig/browser/locales/generic/profile/bookmarks.html.in 2013-09-10 20:14:52.000000000 -0300 -+++ mozilla-release/browser/locales/generic/profile/bookmarks.html.in 2013-09-18 17:41:28.559462661 -0300 +diff --git a/browser/locales/generic/profile/bookmarks.html.in b/browser/locales/generic/profile/bookmarks.html.in +index e925c1e..5101035 100644 +--- a/browser/locales/generic/profile/bookmarks.html.in ++++ b/browser/locales/generic/profile/bookmarks.html.in @@ -15,13 +15,20 @@ <DT><H3 PERSONAL_TOOLBAR_FOLDER="true" ID="rdf:#$FvPhC3">@bookmarks_toolbarfolder@</H3> <DD>@bookmarks_toolbarfolder_description@ @@ -310,10 +621,35 @@ diff -urN mozilla-release.orig/browser/locales/generic/profile/bookmarks.html.in + <DT><A HREF="http://www.h-node.org/" ICON="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABgElEQVQ4jaXRz2uSARzHcb0vlRGEzTVWISU1BVkFYTIyjNK1pKcxHA+yhWMWIamHYikFgpoLIi9jwegi3QbL9SzdLmMbM9J+DkJBgm5RDvEPeHeQHOyQz0OH9+V7ePGBr0pqpPmfVPsP8a0AR4MnMEwf48x9K0s/E8oAY9iEMOvD+8yP2qVjrhhRBnSN61n5sIpULqC+pGHh8wNlgEY8jPQXcGh4VXukDND5evYAl46odIuXtYdKAANSudAChO52/XeMZMohecCbcoGdH99Y+7LO72adT9+/4nh8nYOjBl7/SsoB8gBkpHk8T0S2K++pN3fRin3cfnFDHvCuWkI9rEMvHGEo5gbAHnXhnLF1BpZLeRaLOVT2A8Q3A5wMngXgWtKLxX9KPqC+rCWQvYkpeK4NWKcGOgO50ts2MJJ0cPreeQDciTHMchZYIhcwh2wcuqjn+ccwGm9v6wsTxxn0dVgQXZ7Ek3Agpq6QrcaQGmmebtxFSDkRU1fJVmL/BpT2ByV/3eDMhinRAAAAAElFTkSuQmCC">h-node</A> </DL><p> </DL><p> -diff -ruN mozilla-release.orig/modules/libpref/src/init/all.js mozilla-release/modules/libpref/src/init/all.js ---- mozilla-release.orig/modules/libpref/src/init/all.js 2013-08-07 10:36:49.851516239 -0300 -+++ mozilla-release/modules/libpref/src/init/all.js 2013-08-12 22:35:19.870374357 -0300 -@@ -4127,20 +4127,6 @@ +diff --git a/dom/ipc/test.xul b/dom/ipc/test.xul +index 25efdb6..8162c73 100644 +--- a/dom/ipc/test.xul ++++ b/dom/ipc/test.xul +@@ -299,6 +299,6 @@ + oncommand="document.getElementById('page').QueryInterface(Components.interfaces.nsIFrameLoaderOwner).frameLoader.delayRemoteDialogs = this.checked;"/> + </toolbar> + +- <browser type="content" src="http://www.google.com/" flex="1" id="page" remote="true"/> ++ <browser type="content" src="https://duckduckgo.com/html" flex="1" id="page" remote="true"/> + <label id="messageLog" value="" crop="center"/> + </window> +diff --git a/layout/ipc/test-ipcbrowser.xul b/layout/ipc/test-ipcbrowser.xul +index 237ba61..7603d7d 100644 +--- a/layout/ipc/test-ipcbrowser.xul ++++ b/layout/ipc/test-ipcbrowser.xul +@@ -73,6 +73,6 @@ + label="setViewportScale"/> + </toolbar> + +- <browser type="content" src="http://www.google.com/" flex="1" id="content" ++ <browser type="content" src="https://duckduckgo.com/html" flex="1" id="content" + remote="true"/> + </window> +diff --git a/modules/libpref/src/init/all.js b/modules/libpref/src/init/all.js +index 3b67260..29f7730 100644 +--- a/modules/libpref/src/init/all.js ++++ b/modules/libpref/src/init/all.js +@@ -4190,20 +4190,6 @@ pref("memory.ghost_window_timeout_seconds", 60); // Disable freeing dirty pages when minimizing memory. pref("memory.free_dirty_pages", false); |