Bug878485

This fixes https://bugzilla.mozilla.org/show_bug.cgi?id=878485 fully.