Bug 1362112 - Add missing string in aboutUrlClassifier.properties. r=francois
authordimi <dlee@mozilla.com>
Fri, 05 May 2017 12:42:31 +0800
changeset 391199 35f1edbebb525881adf1533cc747dcf44c1868bd
parent 391198 61af8ff774fe00ae51be731ac882da90c1b41868
child 391200 4c79f09831e75cabc6837dd391184b7a9932df24
push id53
push userfmarier@mozilla.com
push dateMon, 15 May 2017 17:28:28 +0000
reviewersfrancois
bugs1362112
milestone55.0a1
Bug 1362112 - Add missing string in aboutUrlClassifier.properties. r=francois MozReview-Commit-ID: HXptt8ElxSX
toolkit/components/url-classifier/content/listmanager.js
toolkit/content/aboutUrlClassifier.js
toolkit/locales/en-US/chrome/global/aboutUrlClassifier.properties
--- a/toolkit/components/url-classifier/content/listmanager.js
+++ b/toolkit/components/url-classifier/content/listmanager.js
@@ -575,17 +575,17 @@ PROT_ListManager.prototype.updateError_ 
   log("update error for " + table + " from " + updateUrl + ": " + result + "\n");
   // There was some trouble applying the updates. Don't try again for at least
   // updateInterval milliseconds.
   this.updateCheckers_[updateUrl] =
     new G_Alarm(BindToObject(this.checkForUpdates, this, updateUrl),
                 this.updateInterval, false);
 
   Services.obs.notifyObservers(null, "safebrowsing-update-finished",
-                               "update error(" + result + ")");
+                               "update error: " + result);
 }
 
 /**
  * Callback function when the download failed
  * @param status String http status or an empty string if connection refused.
  */
 PROT_ListManager.prototype.downloadError_ = function(table, updateUrl, status) {
   log("download error for " + table + ": " + status + "\n");
@@ -603,17 +603,17 @@ PROT_ListManager.prototype.downloadError
   } else {
     log("Got non error status for error callback?!");
   }
   this.updateCheckers_[updateUrl] =
     new G_Alarm(BindToObject(this.checkForUpdates, this, updateUrl),
                 delay, false);
 
   Services.obs.notifyObservers(null, "safebrowsing-update-finished",
-                               "download error(" + status + ")");
+                               "download error: " + status);
 }
 
 PROT_ListManager.prototype.QueryInterface = function(iid) {
   if (iid.equals(Ci.nsISupports) ||
       iid.equals(Ci.nsIUrlListManager) ||
       iid.equals(Ci.nsITimerCallback))
     return this;
 
--- a/toolkit/content/aboutUrlClassifier.js
+++ b/toolkit/content/aboutUrlClassifier.js
@@ -80,17 +80,27 @@ var Provider = {
       return;
     }
 
     this.refresh([p]);
 
     document.getElementById("update-" + p).disabled = false;
 
     let elem = document.getElementById(p + "-col-lastupdateresult");
-    elem.childNodes[0].nodeValue = aData;
+    if (aData.startsWith("success")) {
+      elem.childNodes[0].nodeValue = bundle.GetStringFromName("success");
+    } else if (aData.startsWith("update error")) {
+      elem.childNodes[0].nodeValue =
+        bundle.formatStringFromName("updateError", [aData.split(": ")[1]], 1);
+    } else if (aData.startsWith("download error")) {
+      elem.childNodes[0].nodeValue =
+        bundle.formatStringFromName("downloadError", [aData.split(": ")[1]], 1);
+    } else {
+      elem.childNodes[0].nodeValue = aData;
+    }
   },
 
   register() {
     // Handle begin update
     this.onBeginUpdate = this.onBeginUpdate.bind(this);
     Services.obs.addObserver(this.onBeginUpdate, UPDATE_BEGIN);
 
     // Handle finish update
--- a/toolkit/locales/en-US/chrome/global/aboutUrlClassifier.properties
+++ b/toolkit/locales/en-US/chrome/global/aboutUrlClassifier.properties
@@ -12,8 +12,14 @@ EnableSBJSLog = Enable Safe Browsing JS 
 
 Enabled = Enabled
 
 Disabled = Disabled
 
 Updating = updating
 
 CannotUpdate = cannot update
+
+success = success
+
+updateError = update error (%S)
+
+downloadError = download error (%S)
\ No newline at end of file