[Pkg-mozext-commits] [adblock-plus] 10/74: Issue 2264 - Remove deprecated logic from Utils.runAsync()

David Prévot taffit at moszumanska.debian.org
Tue Aug 11 12:07:05 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository adblock-plus.

commit c04287dc23063986aff65f563256ca4c69031fe2
Author: Sebastian Noack <sebastian at adblockplus.org>
Date:   Thu Apr 2 12:16:02 2015 +0200

    Issue 2264 - Remove deprecated logic from Utils.runAsync()
---
 chrome/content/ui/filters-search.js              |  4 ++--
 chrome/content/ui/filters-subscriptionactions.js |  4 ++--
 chrome/content/ui/filters-subscriptionview.js    |  9 +++------
 chrome/content/ui/filters.js                     |  2 +-
 chrome/content/ui/filters.xul                    |  2 +-
 lib/contentPolicy.js                             |  4 ++--
 lib/elemHideHitRegistration.js                   |  4 ++--
 lib/utils.js                                     | 15 +++------------
 8 files changed, 16 insertions(+), 28 deletions(-)

diff --git a/chrome/content/ui/filters-search.js b/chrome/content/ui/filters-search.js
index 2d0c0cf..86df86f 100644
--- a/chrome/content/ui/filters-search.js
+++ b/chrome/content/ui/filters-search.js
@@ -127,10 +127,10 @@ var FilterSearch =
           if (oldFocus)
           {
             oldFocus.focus();
-            Utils.runAsync(oldFocus.focus, oldFocus);
+            Utils.runAsync(() => oldFocus.focus());
           }
 
-          Utils.runAsync(findText, null, text, direction, direction == 1 ? -1 : subscription.filters.length);
+          Utils.runAsync(() => findText(text, direction, direction == 1 ? -1 :  subscription.filters.length));
           return result;
         }
       }
diff --git a/chrome/content/ui/filters-subscriptionactions.js b/chrome/content/ui/filters-subscriptionactions.js
index 091a9f3..abef18d 100644
--- a/chrome/content/ui/filters-subscriptionactions.js
+++ b/chrome/content/ui/filters-subscriptionactions.js
@@ -68,7 +68,7 @@ var SubscriptionActions =
         node.parentNode.selectItem(node);
         if (!FilterActions.visible)
           E("subscription-showHideFilters-command").doCommand();
-        Utils.runAsync(FilterView.selectFilter, FilterView, filter);
+        Utils.runAsync(() => FilterView.selectFilter(filter));
       });
     }
   },
@@ -538,7 +538,7 @@ var SelectSubscription =
       // Show panel and focus list
       let position = (Utils.versionComparator.compare(Utils.platformVersion, "2.0") < 0 ? "after_end" : "bottomcenter topleft");
       panel.openPopup(E("selectSubscriptionButton"), position, 0, 0, false, false, event);
-      Utils.runAsync(list.focus, list);
+      Utils.runAsync(() => list.focus());
     };
     request.send();
   },
diff --git a/chrome/content/ui/filters-subscriptionview.js b/chrome/content/ui/filters-subscriptionview.js
index 8fc26e5..74e3265 100644
--- a/chrome/content/ui/filters-subscriptionview.js
+++ b/chrome/content/ui/filters-subscriptionview.js
@@ -91,10 +91,7 @@ ListManager.prototype =
         this.addSubscription(subscription, null);
 
       // Make sure first list item is selected after list initialization
-      Utils.runAsync(function()
-      {
-        this._list.selectItem(this._list.getItemAtIndex(this._list.getIndexOfFirstVisibleRow()));
-      }, this);
+      Utils.runAsync(() => this._list.selectItem(this._list.getItemAtIndex(this._list.getIndexOfFirstVisibleRow())));
     }
 
     this._deck.selectedIndex = (subscriptions.length ? 1 : 0);
@@ -177,7 +174,7 @@ ListManager.prototype =
       if (this._scheduledUpdateDisabled == null)
       {
         this._scheduledUpdateDisabled = Object.create(null);
-        Utils.runAsync(this.updateDisabled, this);
+        Utils.runAsync(() => this.updateDisabled());
       }
       for (let i = 0; i < item.subscriptions.length; i++)
         this._scheduledUpdateDisabled[item.subscriptions[i].url] = true;
@@ -274,7 +271,7 @@ ListManager.prototype =
         if (this._scheduledUpdateDisabled == null)
         {
           this._scheduledUpdateDisabled = Object.create(null);
-          Utils.runAsync(this.updateDisabled, this);
+          Utils.runAsync(() => this.updateDisabled());
         }
         this._scheduledUpdateDisabled[item.url] = true;
         break;
diff --git a/chrome/content/ui/filters.js b/chrome/content/ui/filters.js
index 29a2e31..9346ea9 100644
--- a/chrome/content/ui/filters.js
+++ b/chrome/content/ui/filters.js
@@ -24,7 +24,7 @@ function init()
   {
     let filter = window.arguments[0].wrappedJSObject;
     if (filter instanceof Filter)
-      Utils.runAsync(SubscriptionActions.selectFilter, SubscriptionActions, filter);
+      Utils.runAsync(() => SubscriptionActions.selectFilter(filter));
   }
 }
 
diff --git a/chrome/content/ui/filters.xul b/chrome/content/ui/filters.xul
index 4bbdb5f..053824d 100644
--- a/chrome/content/ui/filters.xul
+++ b/chrome/content/ui/filters.xul
@@ -383,7 +383,7 @@
       _backupError="&backup.error;" _restoreError="&restore.error;"
       _restoreCompleteWarning="&restore.complete.warning;" _restoreCustomWarning="&restore.custom.warning;"
       _restoreVersionWarning="&restore.minVersion.warning;"
-      oncommand="if (event.target == this) Utils.runAsync(function() this.open = true, this);">
+      oncommand="if (event.target == this) Utils.runAsync(() => this.open = true);">
     <menupopup onpopupshowing="Backup.fillRestorePopup();">
       <menuitem id="backup" key="backup-key" label="&backup.label;…" oncommand="Backup.backupToFile();"/>
       <menuseparator/>
diff --git a/lib/contentPolicy.js b/lib/contentPolicy.js
index 35f2f54..b1a49c1 100644
--- a/lib/contentPolicy.js
+++ b/lib/contentPolicy.js
@@ -318,7 +318,7 @@ let Policy = exports.Policy =
       return;
 
     for (let node of nodes)
-      Utils.runAsync(refilterNode, this, node, entry);
+      Utils.runAsync(() => refilterNode(node, entry));
   }
 };
 Policy.init();
@@ -460,7 +460,7 @@ let PolicyImplementation =
         if (!Policy.processNode(subject.opener, subject.opener.document, Policy.type.POPUP, uri, false))
         {
           subject.stop();
-          Utils.runAsync(subject.close, subject);
+          Utils.runAsync(() => subject.close());
         }
         else if (uri.spec == "about:blank")
         {
diff --git a/lib/elemHideHitRegistration.js b/lib/elemHideHitRegistration.js
index 74661a9..9d3f469 100644
--- a/lib/elemHideHitRegistration.js
+++ b/lib/elemHideHitRegistration.js
@@ -108,7 +108,7 @@ HitRegistrationChannel.prototype = {
   asyncOpen: function(listener, context)
   {
     let stream = this.open();
-    Utils.runAsync(function()
+    Utils.runAsync(() =>
     {
       try {
         listener.onStartRequest(this, context);
@@ -119,7 +119,7 @@ HitRegistrationChannel.prototype = {
       try {
         listener.onStopRequest(this, context, Cr.NS_OK);
       } catch(e) {}
-    }, this);
+    });
   },
 
   open: function()
diff --git a/lib/utils.js b/lib/utils.js
index 949460f..848125f 100644
--- a/lib/utils.js
+++ b/lib/utils.js
@@ -213,21 +213,12 @@ let Utils = exports.Utils =
 
   /**
    * Posts an action to the event queue of the current thread to run it
-   * asynchronously. Any additional parameters to this function are passed
-   * as parameters to the callback.
+   * asynchronously.
    * @param {function} callback
-   * @param {object} thisPtr
    */
-  runAsync: function(callback, thisPtr)
+  runAsync: function(callback)
   {
-    let params = Array.prototype.slice.call(arguments, 2);
-    let runnable = {
-      run: function()
-      {
-        callback.apply(thisPtr, params);
-      }
-    };
-    Services.tm.currentThread.dispatch(runnable, Ci.nsIEventTarget.DISPATCH_NORMAL);
+    Services.tm.currentThread.dispatch(callback, Ci.nsIEventTarget.DISPATCH_NORMAL);
   },
 
   /**

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/adblock-plus.git



More information about the Pkg-mozext-commits mailing list