revert-bug-808217.patch. r=wtc. Inclues fixes for bug 869262, bug 863947, bug 866362, and bug 863871.