Fix context leaks when using Context.update().

Review Request #5763 — Created May 2, 2014 and submitted — Latest diff uploaded

Information

Djblets
master
d1c6d4c...

Reviewers

Context.update() implies a push(), which some of our code wasn't
accounting for, resulting in leaked state This mainly impacted
extensions, though datagrids were also doing this (not resulting in
leaks, but rather slightly slowing down rendering).

We now construct a Context as late as possible, instead of creating one
early and operating on it, and pop() when necessary.

Unit tests pass.

Tested that datagrids still work.

No longer saw any more leaks from TemplateHook.