Bug 1126738 - Use arrow functions in browser-data-submission-info-bar.js. r=dao
authorGiovanny Andres Gongora Granada <gioyik@gmail.com>
Wed, 28 Jan 2015 23:18:14 +0100
changeset 239731 5885bbf7c2e4cf413cc7a16d83dff1df8d25265f
parent 239730 0f93ca4a63a71d1db3f6a0d378e3b9e5799a6110
child 239732 7f684fa2c9d9e95e872dbab09a7d289aaef5641c
child 239783 6bfc0e1c4b292cf40dce0c09eb9ce8c5afb1046c
push id506
push usermleibovic@mozilla.com
push dateThu, 29 Jan 2015 12:40:10 +0000
reviewersdao
bugs1126738
milestone38.0a1
Bug 1126738 - Use arrow functions in browser-data-submission-info-bar.js. r=dao
browser/base/content/browser-data-submission-info-bar.js
--- a/browser/base/content/browser-data-submission-info-bar.js
+++ b/browser/base/content/browser-data-submission-info-bar.js
@@ -20,21 +20,21 @@ let gDataNotificationInfoBar = {
 
   get _log() {
     let Log = Cu.import("resource://gre/modules/Log.jsm", {}).Log;
     delete this._log;
     return this._log = Log.repository.getLogger("Services.DataReporting.InfoBar");
   },
 
   init: function() {
-    window.addEventListener("unload", function onUnload() {
+    window.addEventListener("unload", () => {
       for (let o of this._OBSERVERS) {
         Services.obs.removeObserver(this, o);
       }
-    }.bind(this), false);
+    }, false);
 
     for (let o of this._OBSERVERS) {
       Services.obs.addObserver(this, o, true);
     }
   },
 
   _getDataReportingNotification: function (name=this._DATA_REPORTING_NOTIFICATION) {
     return this._notificationBox.getNotificationWithValue(name);
@@ -54,34 +54,34 @@ let gDataNotificationInfoBar = {
       [appName, vendorName]);
 
     this._actionTaken = false;
 
     let buttons = [{
       label: gNavigatorBundle.getString("dataReportingNotification.button.label"),
       accessKey: gNavigatorBundle.getString("dataReportingNotification.button.accessKey"),
       popup: null,
-      callback: function () {
+      callback: () => {
         this._actionTaken = true;
         window.openAdvancedPreferences("dataChoicesTab");
-      }.bind(this),
+      },
     }];
 
     this._log.info("Creating data reporting policy notification.");
     let notification = this._notificationBox.appendNotification(
       message,
       this._DATA_REPORTING_NOTIFICATION,
       null,
       this._notificationBox.PRIORITY_INFO_HIGH,
       buttons,
-      function onEvent(event) {
+      event => {
         if (event == "removed") {
           Services.obs.notifyObservers(null, "datareporting:notify-data-policy:close", null);
         }
-      }.bind(this)
+      }
     );
     // It is important to defer calling onUserNotifyComplete() until we're
     // actually sure the notification was displayed. If we ever called
     // onUserNotifyComplete() without showing anything to the user, that
     // would be very good for user choice. It may also have legal impact.
     request.onUserNotifyComplete();
   },