greasemonkey/greasemonkey — pull request #2005 by Ventero (2014-08-30 03:24:36+00:00)
Title: Various strict mode fixes

This pull request contains some minor fixes for things that currently generate warnings in strict mode (`javascript.options.strict` in about:config). Feel free to cherry pick only some (or even none) of these commits, as they really are only nitpicks.

- d261011 removes a redeclaration of a function argument as `var`, and at the same time simplifies the regular expression a bit (`m` is not required as it only affects the behavior of `^` and `$`, and `\u0000` is identical to `\0`)
- 4afb79a moves a declaration of an inner function out of a conditional block, which apparently isn't allowed in strict mode
- 593df64 silences a warning of the kind `test for equality (==) mistyped as assignment (=)?`
- 48eec5e modifies the way the timer object is stored to prevent it from being garbage collected before it fires. As https://bugzilla.mozilla.org/show_bug.cgi?id=640629#c9 suggests, simply referencing the object inside a closure might not be enough to prevent garbage collection - it currently already creates warning about a "useless expression" - so instead it's now explicitly kept alive as a property of the observer. This commit also removes the `aType` argument to `timeout`, which was unused (and creating a repeating timer using this function would currently lead to the timer being impossible to cancel anyway). This mess can be removed once https://bugzilla.mozilla.org/show_bug.cgi?id=647998 is fixed upstream.