Don't redefine function parameter as local variable.
Move function declaration out of conditional block.
Add parentheses around assignment in while().
Use more robust way to keep the timer reference alive.

Strict mode generates a warning about |timer;| being a useless
expression, which suggest that this might be optimized away at some
point (see also https://bugzil.la/640629#c9). Instead, explicitly
store the timer in the observer object.
Merge pull request #2005 from Ventero/various_fixes

Various strict mode fixes.