[Bug Report] PubSub listeners not triggering on iframe reload

Found a bug while testing PubSub in my extension.
If the iframe of the extension is reloaded, the PubSub listener(s) will stop working.

To reproduce:

  1. Listen to a PubSub topic with window.Twitch.ext.listen(target, callback)
  2. Refresh the iframe by right clicking inside it and select “Reload frame”
  3. Now the listener is like “unbound” and won’t trigger when a PubSub message is sent

Using Google Chrome v66.0.3359.170, on Windows 10 build 16299.

Reload the whole page. Reloading the iframe skips/prevents twitch’s supervisor triggering

It’s a won’t fix from twitch [citation missing]

Why is it a won’t fix?

As Barry alluded, PubSub messages are marshalled through another JS layer that sits outside of the extension iframe. When you reload the iframe, that binding is lost/destroyed; i.e. helper isn’t bound to anything.

1 Like

Okay, I see. Thanks.

And reloading the iframe “manually”, isn’t “normal work flow” of an extension. It’s not an action a viewer is gonna do when using an extension “normally”

You might wanna check out the extension rig

https://github.com/twitchdev/developer-rig