Backport upstream patch to catch more extension errors
Extensions are temporarily disabled while the screen is locked;
when an extension throws an error when re-enabled, no further
extension is enabled after that.
Backport the upstream fix to address that.