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
--- 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);
}