Bug 830975, make sure to flush all the documents, yet keep the no-flush-needed case fast, r=mccr8,f=bz,a=lsblakk