From f58aa0a7d77aeafd5a5c73f8a3b83c70309acdbf Mon Sep 17 00:00:00 2001 From: Gian-Carlo Pascutto Date: Mon, 24 Sep 2012 22:34:27 +0200 Subject: [PATCH] Bug 741808 - Make using the URL classifier possible in Fennec. r=mfinkle --- mobile/android/app/mobile.js | 45 ++--- mobile/android/base/DoorHanger.java | 5 + .../base/resources/layout/doorhanger.xml | 3 +- .../android/chrome/content/blockedSite.xhtml | 6 +- mobile/android/chrome/content/browser.js | 66 +++++++ mobile/android/components/Makefile.in | 8 +- .../components/MobileComponents.manifest | 7 - mobile/android/components/SafeBrowsing.js | 168 ---------------- mobile/android/components/SafeBrowsing.jsm | 182 ++++++++++++++++++ mobile/android/confvars.sh | 2 +- mobile/android/installer/package-manifest.in | 4 +- .../locales/en-US/chrome/browser.properties | 3 + 12 files changed, 289 insertions(+), 210 deletions(-) delete mode 100644 mobile/android/components/SafeBrowsing.js create mode 100644 mobile/android/components/SafeBrowsing.jsm diff --git a/mobile/android/app/mobile.js b/mobile/android/app/mobile.js index 2599e9ba18fb..b9ce853e6cc0 100644 --- a/mobile/android/app/mobile.js +++ b/mobile/android/app/mobile.js @@ -534,33 +534,22 @@ pref("image.mem.min_discard_timeout_ms", 10000); pref("dom.w3c_touch_events.enabled", true); #ifdef MOZ_SAFE_BROWSING -// Safe browsing does nothing unless this pref is set -pref("browser.safebrowsing.enabled", true); +pref("browser.safebrowsing.enabled", false); +pref("browser.safebrowsing.malware.enabled", false); +pref("browser.safebrowsing.debug", false); -// Prevent loading of pages identified as malware -pref("browser.safebrowsing.malware.enabled", true); +pref("browser.safebrowsing.updateURL", "http://safebrowsing.clients.google.com/safebrowsing/downloads?client=SAFEBROWSING_ID&appver=%VERSION%&pver=2.2"); +pref("browser.safebrowsing.keyURL", "https://sb-ssl.google.com/safebrowsing/newkey?client=SAFEBROWSING_ID&appver=%VERSION%&pver=2.2"); +pref("browser.safebrowsing.gethashURL", "http://safebrowsing.clients.google.com/safebrowsing/gethash?client=SAFEBROWSING_ID&appver=%VERSION%&pver=2.2"); +pref("browser.safebrowsing.reportURL", "http://safebrowsing.clients.google.com/safebrowsing/report?"); +pref("browser.safebrowsing.reportGenericURL", "http://%LOCALE%.phish-generic.mozilla.com/?hl=%LOCALE%"); +pref("browser.safebrowsing.reportErrorURL", "http://%LOCALE%.phish-error.mozilla.com/?hl=%LOCALE%"); +pref("browser.safebrowsing.reportPhishURL", "http://%LOCALE%.phish-report.mozilla.com/?hl=%LOCALE%"); +pref("browser.safebrowsing.reportMalwareURL", "http://%LOCALE%.malware-report.mozilla.com/?hl=%LOCALE%"); +pref("browser.safebrowsing.reportMalwareErrorURL", "http://%LOCALE%.malware-error.mozilla.com/?hl=%LOCALE%"); -// Non-enhanced mode (local url lists) URL list to check for updates -pref("browser.safebrowsing.provider.0.updateURL", "http://safebrowsing.clients.google.com/safebrowsing/downloads?client={moz:client}&appver={moz:version}&pver=2.2"); - -pref("browser.safebrowsing.dataProvider", 0); - -// Does the provider name need to be localizable? -pref("browser.safebrowsing.provider.0.name", "Google"); -pref("browser.safebrowsing.provider.0.keyURL", "https://sb-ssl.google.com/safebrowsing/newkey?client={moz:client}&appver={moz:version}&pver=2.2"); -pref("browser.safebrowsing.provider.0.reportURL", "http://safebrowsing.clients.google.com/safebrowsing/report?"); -pref("browser.safebrowsing.provider.0.gethashURL", "http://safebrowsing.clients.google.com/safebrowsing/gethash?client={moz:client}&appver={moz:version}&pver=2.2"); - -// HTML report pages -pref("browser.safebrowsing.provider.0.reportGenericURL", "http://{moz:locale}.phish-generic.mozilla.com/?hl={moz:locale}"); -pref("browser.safebrowsing.provider.0.reportErrorURL", "http://{moz:locale}.phish-error.mozilla.com/?hl={moz:locale}"); -pref("browser.safebrowsing.provider.0.reportPhishURL", "http://{moz:locale}.phish-report.mozilla.com/?hl={moz:locale}"); -pref("browser.safebrowsing.provider.0.reportMalwareURL", "http://{moz:locale}.malware-report.mozilla.com/?hl={moz:locale}"); -pref("browser.safebrowsing.provider.0.reportMalwareErrorURL", "http://{moz:locale}.malware-error.mozilla.com/?hl={moz:locale}"); - -// FAQ URLs -pref("browser.safebrowsing.warning.infoURL", "http://www.mozilla.com/%LOCALE%/%APP%/phishing-protection/"); -pref("browser.geolocation.warning.infoURL", "http://www.mozilla.com/%LOCALE%/%APP%/geolocation/"); +pref("browser.safebrowsing.warning.infoURL", "http://www.mozilla.com/%LOCALE%/firefox/phishing-protection/"); +pref("browser.safebrowsing.malware.reportURL", "http://safebrowsing.clients.google.com/safebrowsing/diagnostic?client=%NAME%&hl=%LOCALE%&site="); // Name of the about: page contributed by safebrowsing to handle display of error // pages on phishing/malware hits. (bug 399233) @@ -569,6 +558,9 @@ pref("urlclassifier.alternate_error_page", "blocked"); // The number of random entries to send with a gethash request. pref("urlclassifier.gethashnoise", 4); +// Randomize all UrlClassifier data with a per-client key. +pref("urlclassifier.randomizeclient", true); + // The list of tables that use the gethash request to confirm partial results. pref("urlclassifier.gethashtables", "goog-phish-shavar,goog-malware-shavar"); @@ -576,9 +568,6 @@ pref("urlclassifier.gethashtables", "goog-phish-shavar,goog-malware-shavar"); // a gethash request will be forced to check that the result is still in // the database. pref("urlclassifier.confirm-age", 2700); - -// URL for checking the reason for a malware warning. -pref("browser.safebrowsing.malware.reportURL", "http://safebrowsing.clients.google.com/safebrowsing/diagnostic?client=%NAME%&hl=%LOCALE%&site="); #endif // True if this is the first time we are showing about:firstrun diff --git a/mobile/android/base/DoorHanger.java b/mobile/android/base/DoorHanger.java index da7cf5725aec..e5efb28fbaf9 100644 --- a/mobile/android/base/DoorHanger.java +++ b/mobile/android/base/DoorHanger.java @@ -86,6 +86,11 @@ public class DoorHanger extends LinearLayout implements Button.OnClickListener { } } + // Enable the button layout if we have buttons. + if (buttons.length() > 0) { + mChoicesLayout.setVisibility(LinearLayout.VISIBLE); + } + setOptions(options); } diff --git a/mobile/android/base/resources/layout/doorhanger.xml b/mobile/android/base/resources/layout/doorhanger.xml index cbe1f27bc249..8a375bac7ac1 100644 --- a/mobile/android/base/resources/layout/doorhanger.xml +++ b/mobile/android/base/resources/layout/doorhanger.xml @@ -24,6 +24,7 @@ style="@android:style/ButtonBar" android:layout_width="fill_parent" android:layout_height="wrap_content" - android:orientation="horizontal"/> + android:orientation="horizontal" + android:visibility="gone"/> diff --git a/mobile/android/chrome/content/blockedSite.xhtml b/mobile/android/chrome/content/blockedSite.xhtml index c0979ef08f6a..558a45a706f4 100644 --- a/mobile/android/chrome/content/blockedSite.xhtml +++ b/mobile/android/chrome/content/blockedSite.xhtml @@ -119,8 +119,6 @@ el = document.getElementById("errorLongDescText_malware"); el.parentNode.removeChild(el); - // Set sitename - document.getElementById("phishing_sitename").textContent = getHostString(); document.title = document.getElementById("errorTitleText_phishing") .innerHTML; } @@ -134,7 +132,6 @@ -moz-appearance: none; background: transparent; border: none; - color: white; /* Hard coded because netError.css forces this page's background to dark red */ text-decoration: underline; margin: 0; padding: 0; @@ -181,6 +178,9 @@ +
+ +