Bug 1338497 - Incorporated review feedback. Used existing service as opposed to creating it and put a space in between comments, r?gijs draft
authorSteve Pfister <steveisok@gmail.com>
Fri, 12 Jan 2018 00:53:31 -0500
changeset 719420 0a7a861145adf4bd6e2c598f7cbe3b82598f1930
parent 719106 e6d6589b0eef2d132fa355d4a6b36d2c429004af
child 745790 e0d7dd7bb884db9d7b10d5ea6a2a94ed5208f782
push id95251
push userbmo:steveisok@gmail.com
push dateFri, 12 Jan 2018 05:53:59 +0000
reviewersgijs
bugs1338497
milestone59.0a1
Bug 1338497 - Incorporated review feedback. Used existing service as opposed to creating it and put a space in between comments, r?gijs MozReview-Commit-ID: EFchjtN9Wgv
browser/base/content/browser.js
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -8896,21 +8896,18 @@ var AboutPrivateBrowsingListener = {
   }
 };
 
 const SafeBrowsingNotificationBox = {
   _currentURIBaseDomain: null,
   show(title, buttons) {
     let uri = gBrowser.currentURI;
 
-    var eTLDService = Components.classes["@mozilla.org/network/effective-tld-service;1"]
-                          .createInstance(Components.interfaces.nsIEffectiveTLDService);
-
-    //start tracking host so that we know when we leave the domain
-    this._currentURIBaseDomain = eTLDService.getBaseDomain(uri);
+    // start tracking host so that we know when we leave the domain
+    this._currentURIBaseDomain = Services.eTLD.getBaseDomain(uri);
 
     let notificationBox = gBrowser.getNotificationBox();
     let value = "blocked-badware-page";
 
     let previousNotification = notificationBox.getNotificationWithValue(value);
     if (previousNotification) {
       notificationBox.removeNotification(previousNotification);
     }
@@ -8922,24 +8919,22 @@ const SafeBrowsingNotificationBox = {
       notificationBox.PRIORITY_CRITICAL_HIGH,
       buttons
     );
     // Persist the notification until the user removes so it
     // doesn't get removed on redirects.
     notification.persistence = -1;
   },
   onLocationChange(aLocationURI) {
-    //take this to represent that you haven't visited a bad place
+    // take this to represent that you haven't visited a bad place
     if (!this._currentURIBaseDomain) {
       return;
     }
 
-    let eTLDService = Components.classes["@mozilla.org/network/effective-tld-service;1"]
-                          .createInstance(Components.interfaces.nsIEffectiveTLDService);
-    let newURIBaseDomain = eTLDService.getBaseDomain(aLocationURI);
+    let newURIBaseDomain = Services.eTLD.getBaseDomain(aLocationURI);
 
     if (newURIBaseDomain !== this._currentURIBaseDomain) {
       let notificationBox = gBrowser.getNotificationBox();
       let notification = notificationBox.getNotificationWithValue("blocked-badware-page");
       if (notification) {
         notificationBox.removeNotification(notification, false);
       }