[Bug 845828] Make code testable [r=crdlc]

https://bugzilla.mozilla.org/show_bug.cgi?id=845828