Back out the remainder of 3f6ee18b1e9d (bug 1038357), most of which was backed out in 8da875b402fe (backout of bug 1020416).