I'm not totally sure what you're doing here, I think a comment that explain the flow would be nice.
And use `document.defaultView` instead of `unsafeWindow`, as the [documentation](https://addons.mozilla.org/en-US/developers/docs/sdk/latest/dev-guide/guides/content-scripts/communicating-with-other-scripts.html) suggests.