Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Context menu problems #151

Closed
nimbus2332 opened this issue Dec 2, 2021 · 6 comments
Closed

Context menu problems #151

nimbus2332 opened this issue Dec 2, 2021 · 6 comments

Comments

@nimbus2332
Copy link

System

  • OS name: Windows 10
  • OS version: 21H2
  • Browser name: Vivaldi
  • Browser version: 3.7.2218.58 (Stable channel) (64 bit)
  • Extension version: [4.3.1]

Bug description

Applications are constantly hibernating, constantly disappearing from the context menu.

Every time I have to open and switch the search method: URL or images, only after that I can select a picture through the context menu of the browser.

Fix the problem, the latest update is extremely annoying.

Logs

no errors

@dessant
Copy link
Owner

dessant commented Dec 2, 2021

What does "applications" mean? Are you referring to this extension only, or do you use other extensions too that disappear from the context menu?

Since when have you been using the extension, and when did you first notice this issue?

@mikamidd
Copy link

mikamidd commented Dec 4, 2021

I noticed this issue on Microsoft Edge too, but it also affects some other extensions like uBlock and Saucenao.
The way I fix it is by toggling "enable context menu" switch in Search By Image settings. Not only this brings up SBI back to the context menu but also other extensions missing from menu such as uBlock.
Absolutely no idea what's causing it though or if there's a way to reliably reproduce it. Can't remember when that's started happening, maybe a month ago? I haven't used this extension much prior to that.

Currently on Win 10 21H2 with Edge Canary 98.0.1093.0, SBI 4.3.1

@dessant
Copy link
Owner

dessant commented Dec 4, 2021

@mikamidd, thanks for sharing these details. It sounds like this is a Chromium bug indeed, extensions should not be able to remove context menu items belonging to other extensions. When you toggle the context menu option in Search by Image, I'm guessing it forces to recreate the entire context menu, and that brings back the menu items removed by the browser bug.

Please let me know if you find a way to trigger the issue.

@mikamidd
Copy link

mikamidd commented Dec 4, 2021

@dessant after fiddling with extensions some more it looks like Incognito window is what breaks context menus.
It seems that context menu breaks only for extensions that are allowed to run in Incognito mode, once you remove that permission, context menu for that particular extension works fine.

What happens is, if extension is allowed to run Incognito and you open Incognito window, context menu in the "main" window breaks. But sometimes Incognito window has working context menu, as in SBI is missing from main window but visible in Incognito context menu. Removing permissions from extension to run in Incognito mode fixes context menu issues, but it's not ideal since I'd like to have SDI in Incognito mode too.

Since this was happening to uBlock Origin too I went searching the UBO issue tracker and found a similar report: uBlockOrigin/uBlock-issues#1646 (comment)

Possibly some other extensions with context menus are affected too, but doesn't look like all extensions are affected since I run Windscribe in Incognito mode and its "debug log" context menu seems to never encounter this issue.

When you toggle the context menu option in Search by Image, I'm guessing it forces to recreate the entire context menu, and that brings back the menu items removed by the browser bug.

Could be, since toggling the context menu option fixes all the broken context menu items, not just SBI one.

@dessant
Copy link
Owner

dessant commented Dec 14, 2021

Thanks @mikamidd for your work, following your test case I was able to reproduce and hopefully fix the issue.

When the extension is configured to run in Incognito split mode and a regular and Incognito window is opened, two instances of the background script are started. Search by Image and uBlock Origin appear to configure the context menu in a similar way: contextMenus.removeAll() is called, then the menu items are created with contextMenus.create().

The problem is that contextMenus.removeAll() removes menu items from all extension instances, while contextMenus.create() will create menu items only for the current instance. So when contextMenus.removeAll() is called, for example when an Incognito window is opened, it also removes menu items from the regular browser window, but only creates them in the Incognito one.

We can solve this by calling contextMenus.removeAll() and notifying all instances that the menu items need to be created. Listening to storage changes and adding a storage item with storage.local.set() allows us to communicate between extension instances and create menu items for all instances whenever a change is initiated from one instance.

The other route is to not use contextMenus.removeAll() at all and act only at the instance level with contextMenus.create() and contextMenus.remove(), and synchronize changes between instances by passing events using storage.local.set() or just listening to configuration changes that were saved to storage and updating the context menu.

@neoOpus
Copy link

neoOpus commented Dec 20, 2021

I think this issue is finally fixed!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants