Closed Bug 954017 Opened 10 years ago Closed 10 years ago

Replace self-hack on callbacks - use Function.bind

Categories

(Instantbird Graveyard :: Other, defect)

defect
Not set
minor

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: benediktp, Assigned: florian)

Details

*** Original post on bio 580 at 2010-11-12 15:21:00 UTC ***

bind allows to set a custom this for functions and makes the self = this; hack obsolete.

See https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Function/bind for details.

Task: look through http://lxr.instantbird.org/instantbird/search?string=%3D+this\%3B&regexp=on (or http://lxr.instantbird.org/instantbird/search?string=%3D+this if you're ambitious) to find palces where this is assigned to a temporary variable to be used later in a callback or another function that has 'this'-problems.
Summary: Replace self-hack on callbacks → Replace self-hack on callbacks - use Function.bind
Whiteboard: [good first bug]
*** Original post on bio 580 at 2011-05-26 17:44:56 UTC ***

I used Function.bind in https://hg.instantbird.org/instantbird/rev/0dab142aefef to remove self variables and getBindingParent calls. I haven't removed the self hack from the applications.js file as it's some code that we have copied from the Firefox preference window and I doesn't make much sense to add differences with the original file without a good reason to do so.
Assignee: nobody → florian
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Whiteboard: [good first bug]
Target Milestone: --- → 0.3b1
You need to log in before you can comment on or make changes to this bug.