diff options
author | André Fabian Silva Delgado <emulatorman@parabola.nu> | 2013-12-19 20:23:23 -0200 |
---|---|---|
committer | André Fabian Silva Delgado <emulatorman@parabola.nu> | 2013-12-19 20:23:23 -0200 |
commit | dd97a8c366fc9178bb585f353fc969997843ac9a (patch) | |
tree | 5ea612f80ad8d195f5a53c99e87db1e97dcac500 | |
parent | dfdf480822f3993dee8951ef603ed4b28ab2b9f8 (diff) |
iceweasel-libre: add regression on aboutHome.js from libre.patch
-rw-r--r-- | libre/iceweasel-libre/PKGBUILD | 2 | ||||
-rw-r--r-- | libre/iceweasel-libre/libre.patch | 90 |
2 files changed, 76 insertions, 16 deletions
diff --git a/libre/iceweasel-libre/PKGBUILD b/libre/iceweasel-libre/PKGBUILD index 69abce460..1f2094626 100644 --- a/libre/iceweasel-libre/PKGBUILD +++ b/libre/iceweasel-libre/PKGBUILD @@ -63,7 +63,7 @@ md5sums=('219cf21e0642e8a364365286f23d0624' '2001d0477bcefd0eeaab584402133691' '023120a970670dc85cea19393f0b94b6' 'df08eaa1ac3bc6c2356be4fbf8ec8932' - '74b5e9d9d16cfe9dc7d08fabf1f52c7c' + 'd6ba6f348d408ea490c4371c6c0e00d2' '7b9e5996dd9fe0b186a43a297db1c6b5' '6620e724ec9a1be74e65089d81d802f7' '816013881cfc9a1f4f0ede72b014f8b3' diff --git a/libre/iceweasel-libre/libre.patch b/libre/iceweasel-libre/libre.patch index a4eb23831..7a1d1a22e 100644 --- a/libre/iceweasel-libre/libre.patch +++ b/libre/iceweasel-libre/libre.patch @@ -114,10 +114,10 @@ index c270318..8a647c7 100644 #aboutMozilla::before { transform: scale(.5); diff --git a/browser/base/content/abouthome/aboutHome.js b/browser/base/content/abouthome/aboutHome.js -index 432fcdc..0d81017 100644 +index 432fcdc..7ae28d2 100644 --- a/browser/base/content/abouthome/aboutHome.js +++ b/browser/base/content/abouthome/aboutHome.js -@@ -3,152 +3,44 @@ +@@ -3,160 +3,51 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ const SEARCH_ENGINES = { @@ -304,8 +304,9 @@ index 432fcdc..0d81017 100644 // 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") { + for (let mutation of mutations) { +- if (mutation.attributeName == "searchEngineName") { ++ if (mutation.attributeName == "searchEngineURL") { setupSearchEngine(); if (!gInitialized) { - ensureSnippetsMapThen(loadSnippets); @@ -323,7 +324,7 @@ index 432fcdc..0d81017 100644 }); window.addEventListener("pagehide", function() { -@@ -181,117 +68,6 @@ window.addEventListener("pagehide", function() { +@@ -181,132 +68,56 @@ window.addEventListener("pagehide", function() { window.removeEventListener("resize", fitToWidth); }); @@ -342,7 +343,8 @@ index 432fcdc..0d81017 100644 - * it may change inadvertently. - */ -function ensureSnippetsMapThen(aCallback) --{ ++function onSearchSubmit(aEvent) + { - if (gSnippetsMap) { - aCallback(gSnippetsMap); - return; @@ -403,14 +405,32 @@ index 432fcdc..0d81017 100644 - - cursorRequest.onsuccess = function(event) { - let cursor = event.target.result; -- ++ let searchTerms = document.getElementById("searchText").value; ++ let searchURL = document.documentElement.getAttribute("searchEngineURL"); ++ ++ if (searchURL && searchTerms.length > 0) { ++ // Send an event that a search was performed. This was originally ++ // added so Firefox Health Report could record that a search from ++ // about:home had occurred. ++ let engineName = document.documentElement.getAttribute("searchEngineName"); ++ let event = new CustomEvent("AboutHomeSearchEvent", {detail: engineName}); ++ document.dispatchEvent(event); + - // Populate the cache from the persistent storage. - if (cursor) { - cache.set(cursor.key, cursor.value); - cursor.continue(); - return; -- } -- ++ const SEARCH_TOKEN = "_searchTerms_"; ++ let searchPostData = document.documentElement.getAttribute("searchEnginePostData"); ++ if (searchPostData) { ++ // Check if a post form already exists. If so, remove it. ++ const POST_FORM_NAME = "searchFormPost"; ++ let form = document.forms[POST_FORM_NAME]; ++ if (form) { ++ form.parentNode.removeChild(form); + } + - // The cache has been filled up, create the snippets map. - gSnippetsMap = Object.freeze({ - get: function (aKey) cache.get(aKey), @@ -434,14 +454,54 @@ index 432fcdc..0d81017 100644 - }); - - setTimeout(invokeCallbacks, 0); -- } -- } ++ // Create a new post form. ++ form = document.body.appendChild(document.createElement("form")); ++ form.setAttribute("name", POST_FORM_NAME); ++ // Set the URL to submit the form to. ++ form.setAttribute("action", searchURL.replace(SEARCH_TOKEN, searchTerms)); ++ form.setAttribute("method", "post"); ++ ++ // Create new <input type=hidden> elements for search param. ++ searchPostData = searchPostData.split("&"); ++ for (let postVar of searchPostData) { ++ let [name, value] = postVar.split("="); ++ if (value == SEARCH_TOKEN) { ++ value = searchTerms; ++ } ++ let input = document.createElement("input"); ++ input.setAttribute("type", "hidden"); ++ input.setAttribute("name", name); ++ input.setAttribute("value", value); ++ form.appendChild(input); ++ } ++ // Submit the form. ++ form.submit(); ++ } else { ++ searchURL = searchURL.replace(SEARCH_TOKEN, encodeURIComponent(searchTerms)); ++ window.location.href = searchURL; + } + } -} - - 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"); +- +- 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); +- } + + aEvent.preventDefault(); + } +@@ -341,156 +152,6 @@ function setupSearchEngine() } |