buttercup / buttercup-browser-extension

:earth_asia: Buttercup browser extension
https://buttercup.pw
MIT License
231 stars 42 forks source link

[Chrome] TypeError: Cannot read properties of undefined (reading 'length') when Site access is set to "On click" #486

Open Oxalin opened 6 months ago

Oxalin commented 6 months ago

Extension v3.1.0

Under Chrome, go under Menu > Add-ons and themes > Extensions > Buttercup > Manage There, under "Site access", you will find "Allow this extension to read and change all your data on websites you visit:". Set it to "On click"

For the Buttercup extension to be accessible, you will need to click on the icon in your Extension bar to let it read and change data so it can integrate itself next to username and password fields and be accessible.

Now, if you click on the extension icon to access its menu, it will fail and throw: Unexpected Application Error! Cannot read properties of undefined (reading 'length') TypeError: Cannot read properties of undefined (reading 'length') image

After changing the "Site access" option back to "On all sites", the extension will stop throwing error and it will work as expected.

This feature is not available under Firefox, so it is not reproducible. Default config will prevent this error from happening (set to "On all sites"), so it may not be a high priority. It may affect other Chromium derivatives.

Oxalin commented 6 months ago

Full console log image

perry-mitchell commented 6 months ago

Didn't realise such a chrome feature existed. I'd be surprised if it's a large amount of users that have this enabled, but that's just a guess.

I wouldn't want supporting this to complicate the extension code too much. If it's a benign change then ok. Depends on what needs to be added to the following areas:

As of now this is an unsupported feature, until further notice.

Oxalin commented 6 months ago

No problem. If I'm able to give more insight, I'll do it.

I began using this feature after discovering Buttercup was interfering with a website used here in Quebec during the pandemic. It is the only website that I've ever experienced trouble with Buttercup. I've kept it that way ever since.

doublemarket commented 6 months ago

This is not a request for the support but just a report to let you know there's another user who encountered the same issue. I spent some time to investigate the error until I came up with this GitHub issue as I've set "On click" enabled. Same with @Oxalin I enabled it to prevent unexpected behavior of the extension on some sites and to minimize security risks in general.

perry-mitchell commented 6 months ago

Happy to have someone contribute a PR for this, so long as it's as clean as possible and tested in every browser we support currently (chrome/edge/firefox).