mac-cain13 / xdebug-helper-for-chrome

Easily activate PHP debugging, profiling and tracing with this Xdebug Chrome extension
https://chrome.google.com/webstore/detail/eadndfjplgieldjbigjakmdgkmoaaaoc
307 stars 97 forks source link

Check status on every tab switch #84

Open rudiedirkx opened 7 years ago

rudiedirkx commented 7 years ago

I don't understand the early return in chrome.tabs.onUpdated, because I always want to know the status. When you're loading a tab, you don't know it Xdebug is on. That's strange.

This PR doesn't fix that, because you probably have your reasons, but it does add a chrome.tabs.onActivated to status check for every tab switch. Currently, you can only see the actual status inside the popup, because the icon doesn't update after a tab switch.

I think the whole thing can be much simpler with webRequest, but this is a start.

rudiedirkx commented 7 years ago

Simpler like this: https://github.com/rudiedirkx/xdebug-helper-for-chrome2/blob/master/xdebug2.background.js

mac-cain13 commented 7 years ago

Once up on a time the icons of extensions could be in the addressbar, at that time the state was stored with the tab. So we didn't have to do anything to get the behaviour you describe.

The early return was to prevent issues with;

Now that we're pushed out of the addressbar this issue did indeed arise, I think the onActivated is a nice solution for this.

rudiedirkx commented 7 years ago

Maybe add chrome.windows.onFocusChanged too, for same origins in separate windows. I did it like this but yours will be different.