revised patch to apply over https://hg.mozilla.org/mozilla-central/rev/3da6a0ba66ff