Bug 594180 - Use Function.prototype.bind instead of Util.bind [r=mfinkle]

This commit is contained in:
Matt Brubeck 2010-09-07 16:43:11 -07:00
parent 9d0f3b85f1
commit 76afac318b
4 changed files with 6 additions and 13 deletions

View File

@ -146,7 +146,7 @@ AnimatedZoom.prototype.startTimer = function() {
this.inc = 1.0 / Services.prefs.getIntPref("browser.ui.zoom.animationDuration");
this.timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
this.interval = 1000 / Services.prefs.getIntPref("browser.ui.zoom.animationFps");
this.timer.initWithCallback(Util.bind(this._callback, this), this.interval, this.timer.TYPE_REPEATING_PRECISE);
this.timer.initWithCallback(this._callback.bind(this), this.interval, this.timer.TYPE_REPEATING_PRECISE);
// force first update to be according to FPS even though first callback would take longer
this.lastTime = 0;

View File

@ -339,8 +339,8 @@ function MouseModule(owner, browserViewContainer) {
this._targetScrollInterface = null;
var self = this;
this._kinetic = new KineticController(Util.bind(this._dragBy, this),
Util.bind(this._kineticStop, this));
this._kinetic = new KineticController(this._dragBy.bind(this),
this._kineticStop.bind(this));
messageManager.addMessageListener("Browser:ContextMenu", this);
}

View File

@ -46,17 +46,10 @@
Cu.import("resource://gre/modules/Geometry.jsm");
let Util = {
bind: function bind(f, thisObj) {
return function() {
return f.apply(thisObj, arguments);
};
},
bindAll: function bindAll(instance) {
let bind = Util.bind;
for (let key in instance)
if (instance[key] instanceof Function)
instance[key] = bind(instance[key], instance);
instance[key] = instance[key].bind(instance);
},
/** printf-like dump function */

View File

@ -128,7 +128,7 @@ let WeaveGlue = {
sync.collapsed = !loggedIn;
// Check the lock on a timeout because it's set just after notifying
setTimeout(Weave.Utils.bind2(this, function() {
setTimeout(function() {
// Prevent certain actions when the service is locked
if (Weave.Service.locked) {
connect.firstChild.disabled = true;
@ -140,7 +140,7 @@ let WeaveGlue = {
sync.firstChild.disabled = false;
connect.setAttribute("title", syncStr.get("disconnected.label"));
}
}), 0);
}, 0);
// Move the disconnect and sync settings out to make connect the last item
let parent = connect.parentNode;