alpheios-project / webextension

Alpheios Browser Extensions
ISC License
6 stars 2 forks source link

pop-up not cleared after removing webextension #113

Open monzug opened 6 years ago

monzug commented 6 years ago

tested in Chrome. latest build 2.0.3-5 remove the webextension and clear data, the look-up pop-up is still open. the site is http://www.poesialatina.it/_ns/Greek/testi/Homerus/Odyssea01.htm pop-up

More, webextension still works (I can double click a word and pop-up is generated) after been removed in the following sites:

https://it.wikibooks.org/wiki/Greco_antico/Aggettivi_della_seconda_classe https://www.lexilogos.com/english/greek_ancient_dictionary.htm http://www.poesialatina.it/_ns/Greek/testi/Homerus/Odyssea01.htm

balmas commented 6 years ago

Ah, that's interesting. We never added a listener on extension removal. It should only continue to work while the current page is still open. If you navigate to a new page does it keep working? A new tab definitely should not.

I think this is not a new issue and could probably wait until the next release. Do you agree @monzug ?

monzug commented 6 years ago

the functionality is gone only after reloading the page. yes, it can wait

monzug commented 5 years ago

@balmas should we add to one of the next releases?

balmas commented 5 years ago

yes we should. I think we could try to do this as part of the Safari code changes. Assigning to @irina060981 to investigate.

irina060981 commented 5 years ago

Bridget, Monica, I am sorry - I have missed somehow this issue - and found it only now. I think we need some flags - to filter real issues and discussions - now there are many of them and it becomes not so easy to track that issue's queue is empty :)

Ok, I have made some investigation - and I need to say that browsers capability is very poor in this field, as I could found in Google.

I haven't found any proper event for uninstalling extension. I have checked the behaviour of the page in Chrome, Firefox and Safari on uninstall/remove the extension from browser.

In Chrome the popup doesn't dissappear, double-click is still working (but for me it didn't return any data). In Firefox and Safari - popup dissapears and double-click stops working. But In all browsers all Html layout stays on the page and are not deleted.

So I have found two events in documentation:

runtime.onSuspend

management.onUninstalled

Both of them are supported only by Chrome, not Firefox. And I tried to use them in background part but I couldn't see any effect. It seems to me that script doesn't have enough time to do this before being removed. I don't know how to debug it - as Background debug page is closed at the same time as extension is removed.

I have searched on stackoverflow - and found only these explanations - https://stackoverflow.com/questions/38645274/firefox-webextension-how-do-i-run-code-prior-to-disable-uninstall

And here it discussed that it doesn't work properly and suggested some tricky uncommon decision for Firefox.

So finaly I am in a deadlock with it if to be honest. May be you, @balmas or @kirlat , have some ideas, suggestions?

kirlat commented 5 years ago

@irina060981, the link you've provided (an excellent one!) mentions the use of port.onDisconnect within a content script to catch the moment when a background script is gone. Here are some more information on this that I've found: https://discourse.mozilla.org/t/unload-content-scripts/13303. If this will work for us, it can be a relatively simple solution to deal with deactivation.

It is a Chrome thing only, but as FF and Safari, if I understand correctly, unload a content script on webexension deactivation, they do not require any special processing. Only Chrome leaves a content script running, and this might help us to deal with it. What do you think? Have you tried that one yet?

irina060981 commented 5 years ago

If to be honest I didn't point attention to it as I didn't find any other information first how to use it in a real project - document is very poor about it. And then I forgot about it. ok, I will try to use it, thank you for pointing attention to it :)

monzug commented 4 years ago

still valid. retested in chrome, build 3.0.1.82