In my testing, this appears to work fine.
Created attachment 26661 [details] proposed patch
Comment on attachment 26661 [details] proposed patch r=me
Committed revision 39883.