Bug 1362112 - Add missing string in aboutUrlClassifier.properties. r?francois draft
authordimi <dlee@mozilla.com>
Fri, 05 May 2017 12:42:31 +0800
changeset 573002 e129c775cad19c034c971120a91c420122ad835e
parent 572730 0b255199db9d6a6f189b89b7906f99155bde3726
child 627192 a9f0e29d9cdb50d53b3d071633cd5f2f25ff367e
push id57261
push userdlee@mozilla.com
push dateFri, 05 May 2017 04:43:49 +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