Fix restoring saved diff fragments when the container is replaced.
Review Request #9473 — Created Jan. 8, 2018 and submitted
Diff fragment saving was implemented as part of Review Board 3.0. It
allowed the contents of a loaded diff fragment container to be recorded
prior to loading new diffs from the server, in order to avoid having to
load data it already had. It would then be restored back into a
The problem was that the container it was being restored to was expected
to be one already set up with the view for the diff fragment. If the
container was replaced, and that association lost, an assertion would be
hit during the load operation, breaking everything.
This change fixes this problem by enabling support for setting up a new
view when necessary. Instead of asserting the view exists, we assert
that the container exists (which is a requirement), and then we either
update and re-render the existing view or create a new one.
Unit tests were updated to handle this case for saved fragments.
Tested against a reproduceable failure case. No more assertions, and the
Unit tests pass. Verified they failed with the same failure before the fix.