If I understand correctly, from the description it looks like sometimes on Firefox `performRedraw` will be called before the `requestAnimationFrame` request is executed.
Since you directly execute the callback provided by the argument here, it may happen that said callbacks will be called twice, once when you force-execute with `perfomRedraw()` - which unregisters the callback - and once when Firefox decides to actually run `requestAnimationFrame`'s function.

Therefore this code should be:
```
var id = runtime.requestAnimationFrame(function () {
    if (callbacks[id]) {
        callbacks[id]();
        delete callbacks[id];
    }
});
```