We don't have a repro for this.
Keeping a reference to a PresShell for an arbitrary amount of time is
error prone, because the pres shell could've been detached and even
though the code tried to handle it didn't seem to do it a 100% of the
time.
Also, calling PresShell::FlushPendingNotifications directly is not the
right thing to do anyways because it won't flush ancestor documents as
needed.
This patch fixes both issues by keeping a reference to the subdocument
we're searching rather than to the shell.
Differential Revision: https://phabricator.services.mozilla.com/D92378