3731: Make it possible to selectively activate and deactivate ExtensionHooks

mconley
chipx86
chipx86
What version are you running?

2.0.12


What's the URL of the page this enhancement relates to, if any?

N/A

Describe the enhancement and the motivation for it.

We have a rather complicated extension, and there are bits of it that we'll be able to turn on and off in the configuration page for the extension. It'd be nice if we could make it simple to take a series of ExtensionHooks and disable them, and then re-enable them when later. Right now, I believe if an ExtensionHook has had shutdown called on it before an extension shuts down, the hook will not be removed from the Extension's hook set. If the Extension shuts down, it will attempt to shutdown an already shutdown ExtensionHook, and I believe that will cause an assertion failure (shutdown asserts that self.initialized is True).

There's also not a great way to turn the ExtensionHook back on once shutdown.


What operating system are you using? What browser?

OS X 10.9, Firefox 38


Please provide any additional information below.
chipx86
#1 chipx86
Most things have an applies_to() that, at least for Power Pack, we use to test if the extension should be currently used. I think that's the way to go, ideally, since you sometimes need something more fine-grained than on/off.
chipx86
#2 chipx86
  • -Accepted
    +PendingReview
  • -reviewboard
    +djblets
  • +Component:Extensions
  • +chipx86
chipx86
#3 chipx86

Added API for this in Djblets release-0.10.x (7648acc52b78773423c93d94ce8460f518b1d942).

  • -PendingReview
    +Fixed
  • +Release-0.10.x
    +reviewboard:Release-2.6.x