Patch by leper, refs #3708 See also https://bugzilla.mozilla.org/show_bug.cgi?id=1069694 This was SVN commit r18580.