I think it's not clear what is happening here, just reading the code. Could you please add a comment in a similar way you have done here: https://github.com/erikvold/addon-sdk/blob/2bc0d47ff3f9fde423f36ba862d62ef65901635e/lib/sdk/ui/sidebar.js#L133 ?