From d048b3dfe17f48ae36cc5a44006d5109b98fd2de Mon Sep 17 00:00:00 2001 From: André Fabian Silva Delgado Date: Fri, 20 Dec 2013 23:15:04 -0200 Subject: iceweasel-libre: add abouthome scripts changes like icecat on libre.patch, put gnu_headshadow.png on about:home instead of mozilla.png --- libre/iceweasel-libre/PKGBUILD | 6 +- libre/iceweasel-libre/gnu_headshadow.png | Bin 0 -> 6785 bytes libre/iceweasel-libre/libre.patch | 348 ++++++++++++++++++++++++++----- 3 files changed, 303 insertions(+), 51 deletions(-) create mode 100644 libre/iceweasel-libre/gnu_headshadow.png (limited to 'libre') diff --git a/libre/iceweasel-libre/PKGBUILD b/libre/iceweasel-libre/PKGBUILD index 69abce460..6b7ee920d 100644 --- a/libre/iceweasel-libre/PKGBUILD +++ b/libre/iceweasel-libre/PKGBUILD @@ -53,6 +53,7 @@ source=("$_debrepo/`debfile $_debname`_$_debver.orig.tar.bz2" mozconfig mozconfig.pgo libre.patch + gnu_headshadow.png iceweasel.desktop iceweasel-install-dir.patch vendor.js @@ -63,7 +64,8 @@ md5sums=('219cf21e0642e8a364365286f23d0624' '2001d0477bcefd0eeaab584402133691' '023120a970670dc85cea19393f0b94b6' 'df08eaa1ac3bc6c2356be4fbf8ec8932' - '74b5e9d9d16cfe9dc7d08fabf1f52c7c' + '0debcc1c5515ce174cf3d3c8e934b42c' + 'b03a979a78484503ba8dddad4f2c96d1' '7b9e5996dd9fe0b186a43a297db1c6b5' '6620e724ec9a1be74e65089d81d802f7' '816013881cfc9a1f4f0ede72b014f8b3' @@ -92,6 +94,8 @@ prepare() { quilt push -av + install -m644 "$srcdir/gnu_headshadow.png" browser/base/content/abouthome # Put gnu_headshadow.png on the source code + patch -Np1 -i "$srcdir/Bug-756390-Make-the-Reset-Firefox-feature-more-gener.patch" # Adding fixed Bug-756390-Make-the-Reset-Firefox-feature-more-gener.patch patch -Np1 -i "$srcdir/Fixup-Reset-Firefox-after-bad-merge.patch" patch -Np1 -i "$srcdir/iceweasel-install-dir.patch" # install to /usr/lib/$_pkgname diff --git a/libre/iceweasel-libre/gnu_headshadow.png b/libre/iceweasel-libre/gnu_headshadow.png new file mode 100644 index 000000000..e0f73a3bf Binary files /dev/null and b/libre/iceweasel-libre/gnu_headshadow.png differ diff --git a/libre/iceweasel-libre/libre.patch b/libre/iceweasel-libre/libre.patch index a4eb23831..aca8983b9 100644 --- a/libre/iceweasel-libre/libre.patch +++ b/libre/iceweasel-libre/libre.patch @@ -18,7 +18,7 @@ index 331edc8..e18bd20 100644 pref("security.csp.speccompliant", true); diff --git a/browser/base/content/abouthome/aboutHome.css b/browser/base/content/abouthome/aboutHome.css -index c270318..8a647c7 100644 +index c270318..c67d112 100644 --- a/browser/base/content/abouthome/aboutHome.css +++ b/browser/base/content/abouthome/aboutHome.css @@ -49,11 +49,6 @@ a { @@ -92,7 +92,45 @@ index c270318..8a647c7 100644 #launcher { display: -moz-box; -moz-box-align: center; -@@ -366,20 +318,6 @@ body[narrow] #restorePreviousSession::before { +@@ -335,28 +287,23 @@ body[narrow] #restorePreviousSession::before { + width: 32px; + } + +-#aboutMozilla { ++#aboutGNU { ++ background: url("chrome://browser/content/abouthome/gnu_headshadow.png"); + display: block; +- position: relative; /* pin wordmark to edge of document, not of viewport */ ++ position: absolute; ++ top: 12px; ++ right: 12px; ++ width: 200px; ++ height: 110px; + -moz-box-ordinal-group: 0; + opacity: .5; +- transition: opacity 150ms; ++ transition:opacity 150ms; + } + +-#aboutMozilla:hover { ++#aboutGNU:hover { + opacity: 1; + } + +-#aboutMozilla::before { +- content: url("chrome://browser/content/abouthome/mozilla.png"); +- display: block; +- position: absolute; +- top: 12px; +- right: 12px; +- width: 69px; +- height: 19px; +-} +- + /* [HiDPI] + * At resolutions above 1dppx, prefer downscaling the 2x Retina graphics + * rather than upscaling the original-size ones (bug 818940). +@@ -366,26 +313,7 @@ body[narrow] #restorePreviousSession::before { background-image: url("chrome://branding/content/about-logo@2x.png"); } @@ -111,13 +149,29 @@ index c270318..8a647c7 100644 - } - .launchButton::before, - #aboutMozilla::before { - transform: scale(.5); +- #aboutMozilla::before { +- transform: scale(.5); +- transform-origin: 0 0; +- } +- + #downloads::before { + content: url("chrome://browser/content/abouthome/downloads@2x.png"); + } +@@ -421,9 +349,5 @@ body[narrow] #restorePreviousSession::before { + body[narrow] #restorePreviousSession::before { + content: url("chrome://browser/content/abouthome/restore@2x.png"); + } +- +- #aboutMozilla::before { +- content: url("chrome://browser/content/abouthome/mozilla@2x.png"); +- } + } + diff --git a/browser/base/content/abouthome/aboutHome.js b/browser/base/content/abouthome/aboutHome.js -index 432fcdc..0d81017 100644 +index 432fcdc..8e85f1f 100644 --- a/browser/base/content/abouthome/aboutHome.js +++ b/browser/base/content/abouthome/aboutHome.js -@@ -3,152 +3,44 @@ +@@ -3,317 +3,99 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ const SEARCH_ENGINES = { @@ -293,46 +347,59 @@ index 432fcdc..0d81017 100644 - "https://www.mozilla.org/firefox/features/?utm_source=snippet&utm_medium=snippet&utm_campaign=default+feature+snippet" -, "https://addons.mozilla.org/firefox/?utm_source=snippet&utm_medium=snippet&utm_campaign=addons" -]; -- + -const SNIPPETS_UPDATE_INTERVAL_MS = 86400000; // 1 Day. -- ++// Bug with dom.storage.enabled set as false ++// We are using DDG as a default in this case. ++let gSearchEngine = {"name": "DuckDuckGo HTML", "searchUrl": "https://duckduckgo.com/html/?t=iceweasel&q=_searchTerms_"}; + -// IndexedDB storage constants. -const DATABASE_NAME = "abouthome"; -const DATABASE_VERSION = 1; -const SNIPPETS_OBJECTSTORE_NAME = "snippets"; - - // This global tracks if the page has been set up before, to prevent double inits - let gInitialized = false; - let gObserver = new MutationObserver(function (mutations) { -@@ -156,7 +48,6 @@ let gObserver = new MutationObserver(function (mutations) { - if (mutation.attributeName == "searchEngineName") { - setupSearchEngine(); - if (!gInitialized) { +-// This global tracks if the page has been set up before, to prevent double inits +-let gInitialized = false; +-let gObserver = new MutationObserver(function (mutations) { +- for (let mutation of mutations) { +- if (mutation.attributeName == "searchEngineName") { +- setupSearchEngine(); +- if (!gInitialized) { - ensureSnippetsMapThen(loadSnippets); - gInitialized = true; - } - return; -@@ -170,10 +61,6 @@ window.addEventListener("pageshow", function () { - window.gObserver.observe(document.documentElement, { attributes: true }); - fitToWidth(); - window.addEventListener("resize", fitToWidth); +- gInitialized = true; +- } +- return; +- } +- } +-}); +- +-window.addEventListener("pageshow", function () { +- // Delay search engine setup, cause browser.js::BrowserOnAboutPageLoad runs +- // later and may use asynchronous getters. +- window.gObserver.observe(document.documentElement, { attributes: true }); +- fitToWidth(); +- window.addEventListener("resize", fitToWidth); - - // Ask chrome to update snippets. - var event = new CustomEvent("AboutHomeLoad", {bubbles:true}); - document.dispatchEvent(event); +-}); +- +-window.addEventListener("pagehide", function() { +- window.gObserver.disconnect(); +- window.removeEventListener("resize", fitToWidth); ++document.addEventListener("DOMContentLoaded", function init() { ++ setupSearchEngine(); }); - - window.addEventListener("pagehide", function() { -@@ -181,117 +68,6 @@ window.addEventListener("pagehide", function() { - window.removeEventListener("resize", fitToWidth); - }); ++window.addEventListener("load", fitToWidth); ++window.addEventListener("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. - * @@ -342,7 +409,8 @@ index 432fcdc..0d81017 100644 - * it may change inadvertently. - */ -function ensureSnippetsMapThen(aCallback) --{ ++function onSearchSubmit(aEvent) + { - if (gSnippetsMap) { - aCallback(gSnippetsMap); - return; @@ -358,30 +426,44 @@ index 432fcdc..0d81017 100644 - let invokeCallbacks = function () { - if (!gSnippetsMap) { - gSnippetsMap = Object.freeze(new Map()); -- } ++ let searchTerms = document.getElementById("searchText").value; ++ if (gSearchEngine && searchTerms.length > 0) { ++ const SEARCH_TOKENS = { ++ "_searchTerms_": encodeURIComponent(searchTerms) + } - - for (let callback of gSnippetsMapCallbacks) { - callback(gSnippetsMap); -- } ++ let url = gSearchEngine.searchUrl; ++ for (let key in SEARCH_TOKENS) { ++ url = url.replace(key, SEARCH_TOKENS[key]); + } - gSnippetsMapCallbacks.length = 0; -- } -- ++ window.location.href = url; + } + - let openRequest = indexedDB.open(DATABASE_NAME, DATABASE_VERSION); -- ++ aEvent.preventDefault(); ++} + - openRequest.onerror = function (event) { - // Try to delete the old database so that we can start this process over - // next time. - indexedDB.deleteDatabase(DATABASE_NAME); - invokeCallbacks(); - }; -- + - openRequest.onupgradeneeded = function (event) { - let db = event.target.result; - if (!db.objectStoreNames.contains(SNIPPETS_OBJECTSTORE_NAME)) { - db.createObjectStore(SNIPPETS_OBJECTSTORE_NAME); - } -- } -- ++function setupSearchEngine() ++{ ++ if (localStorage && localStorage["search-engine"]) { ++ gSearchEngine = JSON.parse(localStorage["search-engine"]); + } + - openRequest.onsuccess = function (event) { - let db = event.target.result; - @@ -435,16 +517,71 @@ index 432fcdc..0d81017 100644 - - setTimeout(invokeCallbacks, 0); - } -- } ++ ++ // Look for extended information, like logo and links. ++ var searchEngineInfo = SEARCH_ENGINES[gSearchEngine.name]; ++ if (searchEngineInfo) { ++ for (let prop in searchEngineInfo) ++ gSearchEngine[prop] = searchEngineInfo[prop]; + } -} -- - function onSearchSubmit(aEvent) - { - let searchTerms = document.getElementById("searchText").value; -@@ -341,156 +117,6 @@ function setupSearchEngine() - } +-function onSearchSubmit(aEvent) +-{ +- let searchTerms = document.getElementById("searchText").value; +- let engineName = document.documentElement.getAttribute("searchEngineName"); ++ // Enqueue additional params if required by the engine definition. ++ if (gSearchEngine.params) ++ gSearchEngine.searchUrl += "&" + gSearchEngine.params; + +- if (engineName && searchTerms.length > 0) { +- // Send an event that will perform a search and Firefox Health Report will +- // record that a search from about:home has occurred. +- let eventData = JSON.stringify({ +- engineName: engineName, +- searchTerms: searchTerms +- }); +- let event = new CustomEvent("AboutHomeSearchEvent", {detail: eventData}); +- document.dispatchEvent(event); ++ // Add search engine logo. ++ if (gSearchEngine.image) { ++ let logoElt = document.getElementById("searchEngineLogo"); ++ logoElt.src = gSearchEngine.image; ++ logoElt.alt = gSearchEngine.name; + } +- aEvent.preventDefault(); +-} +- +- +-function setupSearchEngine() +-{ + // The "autofocus" attribute doesn't focus the form element + // immediately when the element is first drawn, so the + // attribute is also used for styling when the page first loads. +@@ -322,173 +104,6 @@ function setupSearchEngine() + searchText.removeEventListener("blur", searchText_onBlur); + searchText.removeAttribute("autofocus"); + }); +- +- let searchEngineName = document.documentElement.getAttribute("searchEngineName"); +- let searchEngineInfo = SEARCH_ENGINES[searchEngineName]; +- let logoElt = document.getElementById("searchEngineLogo"); +- +- // Add search engine logo. +- if (searchEngineInfo && searchEngineInfo.image) { +- logoElt.parentNode.hidden = false; +- logoElt.src = searchEngineInfo.image; +- logoElt.alt = searchEngineName; +- searchText.placeholder = ""; +- } +- else { +- logoElt.parentNode.hidden = true; +- searchText.placeholder = searchEngineName; +- } +- +-} +- -/** - * Inform the test harness that we're done loading the page. - */ @@ -593,16 +730,14 @@ index 432fcdc..0d81017 100644 - } - // 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 1d03d38..e3cd254 100644 +index 1d03d38..5555f72 100644 --- a/browser/base/content/abouthome/aboutHome.xhtml +++ b/browser/base/content/abouthome/aboutHome.xhtml -@@ -43,15 +43,6 @@ +@@ -43,19 +43,10 @@ @@ -618,6 +753,21 @@ index 1d03d38..e3cd254 100644
+-
++
+ + + +@@ -66,7 +57,7 @@ +
+ +
+- +- ++ Help GNU and FSF: Help add free addons to the directory! ++ + + diff --git a/browser/locales/en-US/chrome/browser-region/region.properties b/browser/locales/en-US/chrome/browser-region/region.properties index 087cc50..5654eb9 100644 --- a/browser/locales/en-US/chrome/browser-region/region.properties @@ -700,6 +850,104 @@ index e925c1e..5101035 100644 +
h-node

+diff --git a/browser/modules/AboutHome.jsm b/browser/modules/AboutHome.jsm +index 98c443d..0173762 100644 +--- a/browser/modules/AboutHome.jsm ++++ b/browser/modules/AboutHome.jsm +@@ -8,7 +8,7 @@ let Cc = Components.classes; + let Ci = Components.interfaces; + let Cu = Components.utils; + +-this.EXPORTED_SYMBOLS = [ "AboutHomeUtils", "AboutHome" ]; ++this.EXPORTED_SYMBOLS = [ "AboutHome" ]; + + Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); + Components.utils.import("resource://gre/modules/Services.jsm"); +@@ -16,66 +16,6 @@ Components.utils.import("resource://gre/modules/Services.jsm"); + XPCOMUtils.defineLazyModuleGetter(this, "PrivateBrowsingUtils", + "resource://gre/modules/PrivateBrowsingUtils.jsm"); + +-// Url to fetch snippets, in the urlFormatter service format. +-const SNIPPETS_URL_PREF = "browser.aboutHomeSnippets.updateUrl"; +- +-// Should be bumped up if the snippets content format changes. +-const STARTPAGE_VERSION = 4; +- +-this.AboutHomeUtils = { +- get snippetsVersion() STARTPAGE_VERSION, +- +- /* +- * showKnowYourRights - Determines if the user should be shown the +- * about:rights notification. The notification should *not* be shown if +- * we've already shown the current version, or if the override pref says to +- * never show it. The notification *should* be shown if it's never been seen +- * before, if a newer version is available, or if the override pref says to +- * always show it. +- */ +- get showKnowYourRights() { +- // Look for an unconditional override pref. If set, do what it says. +- // (true --> never show, false --> always show) +- try { +- return !Services.prefs.getBoolPref("browser.rights.override"); +- } catch (e) { } +- // Ditto, for the legacy EULA pref. +- try { +- return !Services.prefs.getBoolPref("browser.EULA.override"); +- } catch (e) { } +- +-#ifndef MOZILLA_OFFICIAL +- // Non-official builds shouldn't show the notification. +- return false; +-#endif +- +- // Look to see if the user has seen the current version or not. +- var currentVersion = Services.prefs.getIntPref("browser.rights.version"); +- try { +- return !Services.prefs.getBoolPref("browser.rights." + currentVersion + ".shown"); +- } catch (e) { } +- +- // Legacy: If the user accepted a EULA, we won't annoy them with the +- // equivalent about:rights page until the version changes. +- try { +- return !Services.prefs.getBoolPref("browser.EULA." + currentVersion + ".accepted"); +- } catch (e) { } +- +- // We haven't shown the notification before, so do so now. +- return true; +- } +-}; +- +-/** +- * Returns the URL to fetch snippets from, in the urlFormatter service format. +- */ +-XPCOMUtils.defineLazyGetter(AboutHomeUtils, "snippetsURL", function() { +- let updateURL = Services.prefs +- .getCharPref(SNIPPETS_URL_PREF) +- .replace("%STARTPAGE_VERSION%", STARTPAGE_VERSION); +- return Services.urlFormatter.formatURL(updateURL); +-}); +- + /** + * This code provides services to the about:home page. Whenever + * about:home needs to do something chrome-privileged, it sends a +@@ -185,17 +125,8 @@ let AboutHome = { + ss.promiseInitialized.then(function() { + let data = { + showRestoreLastSession: ss.canRestoreLastSession, +- snippetsURL: AboutHomeUtils.snippetsURL, +- showKnowYourRights: AboutHomeUtils.showKnowYourRights, +- snippetsVersion: AboutHomeUtils.snippetsVersion + }; + +- if (AboutHomeUtils.showKnowYourRights) { +- // Set pref to indicate we've shown the notification. +- let currentVersion = Services.prefs.getIntPref("browser.rights.version"); +- Services.prefs.setBoolPref("browser.rights." + currentVersion + ".shown", true); +- } +- + if (target) { + target.messageManager.sendAsyncMessage("AboutHome:Update", data); + } else { diff --git a/dom/ipc/test.xul b/dom/ipc/test.xul index 3eede17..1b47a70 100644 --- a/dom/ipc/test.xul -- cgit v1.2.3