This more or less backs out changeset ceb1b9ba4a5a (bug 1157197) which was really a backout of 69173cc17556 (bug 1155191)