Broken off from bug 14868.
Created attachment 16653 [details] Patch
Comment on attachment 16653 [details] Patch r=me
Committed revision 26617.