dhowe / AdNauseam

AdNauseam: Fight back against advertising surveillance
GNU General Public License v3.0
4.53k stars 189 forks source link

Type error in onPortDisconnect function #2195

Closed mneunomne closed 11 months ago

mneunomne commented 1 year ago

There is this minor bug occurring which I didn't find the reason for it yet, but I can't detect any consequences of it yet:

Error in event handler: TypeError: Cannot read properties of null (reading 'name')

https://github.com/dhowe/AdNauseam/blob/f075a907f9247719ac0059261bc156cf349e2038/platform/common/vapi-background.js#L855-L857

dhowe commented 1 year ago

in any case, we should always be checking for undefined before accessing properties/functions

mneunomne commented 1 year ago

This is not AdNauseam code, so the issue is more like there is something in our code that is not adapted well to the way in which uBlock closes the ports.

mneunomne commented 1 year ago

It seems that this is just happening when opening the menu, and no issues seems to arise from that. I handled the exception with a message when debugging is enabled. I'll close once merged.

mneunomne commented 1 year ago

Closing

mneunomne commented 1 year ago

Finally found out why this was happening. Using the debugger was not helping so I just had to use many consolelog to eventually figure out it was a case switch with a break instead of a return in the getCostPerClick function implemented on https://github.com/dhowe/AdNauseam/pull/2162.

mneunomne commented 11 months ago

Fixed, closing.