CanisLupus / swift-selection-search

Swift Selection Search (SSS) is a simple Firefox add-on that lets you quickly search for some text in a page using your favorite search engines.
https://addons.mozilla.org/firefox/addon/swift-selection-search/
MIT License
213 stars 27 forks source link

Context search fails to open a website #225

Closed BubiBalboa closed 3 years ago

BubiBalboa commented 3 years ago

Describe the problem Since the latest update (3.47.0) the search from the context menu sometimes fails to complete a search. The tab will be opened but there's no URL in the address bar.

How to reproduce the problem Steps to reproduce the behavior:

  1. Go to a random page
  2. Highlight a word or phrase
  3. Open the context menu and select a search engine
  4. A new tab will open but there's no URL in the address bar and the page is just the normal new tab page

Anything else you'd like to include It seems to be random whether it works or not and it doesn't matter which search engine you choose.

System info:

CanisLupus commented 3 years ago

Hey, thanks for reporting this. Can you tell me which click behaviour(s) you are using for the mouse button? Among these:

image

Does it happen like 50% of the time for you? More? Less? Just a very rough estimate. I couldn't get the problem to happen here.

Cheers! Daniel

BubiBalboa commented 3 years ago

Yeah, something like 50%. It should be very obvious to you if you had the same issue. My left-click (what I usually use) behaviour is "open in new background tab next to current tab".

BubiBalboa commented 3 years ago

I think it happens when I'm too fast. When I'm taking my time and do a three-count between each step it reliably opens the search page.

E: Well, almost reliably after checking some more. It's working better when I'm slow, let's put it that way.

E2: I think I was seeing a pattern that isn't actually there. So unless you make the same observation please ignore this.

CanisLupus commented 3 years ago

Thanks a lot for the extra info. Unfortunately it's not happening here, with that (or any) context menu click behaviour. 🤔

If it was not happening to you before this version, it's most definitely a new problem. We did change the way tabs are opened internally but everything seemed to work well (and still does here).

Are you using the popup as well or only the context menu? If you have some time can you please check if the engines in the popup have the same problem? They should, as they run the exact same code to open tabs.

NOTE: the popup uses different settings for click behaviours: image

BubiBalboa commented 3 years ago

I don't usually use the pop-up. Yes, it's the same problem.

It looks like it only happens with new background tabs specifically. Open in new tab seems to work.

CanisLupus commented 3 years ago

Thanks! I really want to know what causes this but there's something that I'm not seeing. I'm not using Firefox Beta, though. Maybe I can try that tomorrow.

rado84-github commented 3 years ago

Thanks! I really want to know what causes this but there's something that I'm not seeing. I'm not using Firefox Beta, though. Maybe I can try that tomorrow.

I think the cause of this is browser update. Earlier today Firefox was updated to 84.0.1 and that's when the problems with SSS began. Whatever text I select, clicking a search engine icon simply opens up a new empty tab with no search engines. I could downgrade and try 83.0.1 again but I'm pretty sure the new browser version is the cause of these problems.

seascape commented 3 years ago

I was going to write this up earlier. I got it in both FF83 and FF84 with the latest SSS update. It's weird because it works on some pages, but on others it just opens a new tab when I click an icon on the search palette.

rado84-github commented 3 years ago

I was going to write this up earlier. I got it in both FF83 and FF84 with the latest SSS update. It's weird because it works on some pages, but on others it just opens a new tab when I click an icon on the search palette.

I tried downgrading FF to 83.0.1 but that caused SSS to be just listed as an installed addon but no settings whatsoever. IDK how you managed to get it working on FF 83 now.

@CanisLupus, do you think you can push the previous version back until you get this fixed?

pflosch commented 3 years ago

Hi, Thanks for producing this add on. Wouldn't wanna miss it.

I noticed following (FF84.0/64bit, SSS 3.47.0)

It works with most search engines, but the search in DuckDuckGo fails with a.m. behavior. If after SS fails, I open DuckDuckGo in another tab (even in another FF Window) and then do the same SSS search again (from wherever I was), it works, i.e. it opens a new DDG tab and searches.

francis707 commented 3 years ago

Hi, same problem here, I use Windows 10 64 bit, Firefox 84.0 (64-bit), SSS 3.47.0

open in "this tab" is normal, but open in "new tab/new window" will open a new tab/window with no URL in address bar.

after reinstall SSS 3.46.0 (SSS addon versions), the problem goes away.

igorofc commented 3 years ago

It's working normally here, but I could reproduce this in two situations and only with engines managed by the browser:

1 - If the engine's name was changed in the settings page; or 2 - If the engine only exists in SSS and cannot be seen in the Search Shortcuts table in Edit > Preferences > Search > Search Shortcuts.

@CanisLupus, I only noticed it now but importing those browser engines from a file into a new Firefox profile would render them useless in case they are not installed there.

CanisLupus commented 3 years ago

Hey folks, seems like lots of you are experiencing this. :( Thanks for the info. I still haven't been able to reproduce this, which makes it very hard to fix.

IMPORTANT!

  1. Can anyone provide an exported settings file that includes at least one engine that causes the problem? Feel free to delete any engines, as long as at least one has the problem.
  2. If you open both the console (Ctrl+Shift+K) and the Browser Console (Ctrl+Shift+J) in Firefox do you see any errors when you click an engine in the popup or context menu?

Replying to the questions:

@CanisLupus, do you think you can push the previous version back until you get this fixed?

I disabled the version just now, so new users will get the old one. But Mozilla probably won't downgrade whomever got the update already. In fact it may cause problems to downgrade due to new settings that the previous version doesn't recognize. ESPECIALLY if you created any group engines.

It's working normally here, but I could reproduce this in two situations and only with engines managed by the browser:

1 - If the engine's name was changed in the settings page; or 2 - If the engine only exists in SSS and cannot be seen in the Search Shortcuts table in Edit > Preferences > Search > Search Shortcuts.

@CanisLupus, I only noticed it now but importing those browser engines from a file into a new Firefox profile would render them useless in case they are not installed there.

You are completely correct! Browser imported engines should probably have an unchangeable name. Apparently this was already a bug before but I hadn't thought of that. Nice catch. Likewise, browser-managed engines that were removed from the browser will fail, yes. I guess we should add a new issue for that.

But all these reports seem to be different, since they all started happening now.

CanisLupus commented 3 years ago

Also, can anyone please disable this option image and then click many times in an engine in the popup (not the context menu) and tell me if it opens the search on only some of the clicks? Or all? Or none?

CanisLupus commented 3 years ago

One more: does the opened tab have activity? Like it's trying to open the link but not really? Or is it just a blank "New Tab"?

BubiBalboa commented 3 years ago

Here's my settings file. I deleted some engines but kept some that made problems. But pretty much all of them did anyway.

There are no errors on the consoles related to SSS, as far as I can tell.

The popup multi-click test opened the searches only on some clicks, not all of them. It's possible the first few clicks are more likely to fail but I'm not sure it's a pattern.

It looks like when it fails there is not activity in the new tab at all. It just opens my new tab page which is a speed dial add-on.

CanisLupus commented 3 years ago

Thanks a lot for your help, @BubiBalboa! For all intents and purposes I still could not see it happening here. Sigh...

With your settings and engines, I tried clicking popup engines, context menu engines, and spamming the shortcut keys, then I tried multiple click/shortcut behaviours, tried Firefox beta and Firefox 63 (earliest version still supported by SSS), tried custom engines and browser-managed engines, etc, to no avail.

So this has probably nothing to do with the settings or engines used. It could be an execution-time based bug, such as things running differently on some computers. In this case it could happen if the task for browser.tabs.create finishes but never says that it has finished, hence the following search never happens. That would be a bug in Firefox, however, and we are all using similar versions...

This is very puzzling and I'd really like to solve it, but I really need to reproduce this.

CanisLupus commented 3 years ago

If anyone having problems could do this it would be greatly appreciated.

This is a build of SSS with a few logs enabled. Please download it:

swift_selection_search-3.47.1.zip

Then install it as a temporary addon. Please go here in the Firefox settings page, and press "Debug Add-ons":

image

In here, press "Load Temporary Add-on":

image

Select the swift_selection_search-3.47.1.zip file. This will install this version over the "official" one but this is only valid until you either remove it here or restart the browser (the official one will return after that).

You should see this. Press "Inspect":

image

It will open the browser console for SSS logs.

Now select text in a page and press an engine in the SSS popup or context menu. In this case it has to be a "normal" engine (ones you create with "Add engine"), not a browser managed engine.

You should see some logs. This is an example from a successful opening of a search (ignore the errors, they are not from SSS):

image

Could I see what is logged when a search fails?

BubiBalboa commented 3 years ago

I think I found the culprit. My new tab page is managed by a speed dial add-on called New Tab Tools. Once I deactivate NTT everything works as expected. Can you try to reproduce this?

CanisLupus commented 3 years ago

Interesting. Yes, I can reproduce it! With this addon it seems to never search at all. It still logs all the normal things, so the tasks actually seem to finish without errors (doesn't mean the search URL goes through, though).

To everyone here: do you have some kind of special new tab setting? (i.e. not the default of Firefox Home or a blank page)

rado84-github commented 3 years ago

Interesting. Yes, I can reproduce it! With this addon it seems to never search at all. It still logs all the normal things, so the tasks actually seem to finish without errors (doesn't mean the search URL goes through, though).

To everyone here: do you have some kind of special new tab setting? (i.e. not the default of Firefox Home or a blank page)

I'm using GroupSpeedDial addon. The only setting for New Tab is from the browser itself: a new tab to be opened with GSD as a home page, where this is the address for the home page: moz-extension://e1aa2611-c5a0-4a6e-9ea7-fbc0ec014a9d/dial.html

Also, on my side it seems SSS is not working ONLY for Google Translate to translate selected text with the method I showed you in my feedback topic. If I search selected text for any other of the engines I've set, it all works normal.

seascape commented 3 years ago

In case it's relevant, I do not use a new tab add-on but do experience the bug in question. Here are my (very typical) new tab / home page settings: Clip 002186 DR 557  Options — Mozilla Firefox

DrSchnagels commented 3 years ago

Im using Tabliss (A beautiful New Tab page with many customisable backgrounds and widgets that does not require any permissions.). Have the same problem that Google, Amazon and other search engines only show an empty new tab and now search result now. Im using Firefox 85 beta.

rado84-github commented 3 years ago

Edit to my previous post. I tested them all one by one and these are the not working ones (the ones that open up a blank new tab instead of the search engine with results):

https://translate.google.bg/?hl=bg&sl=auto&tl=en&text={searchTerms}&op=translate https://www.imdb.com/find?s=all&q={searchTerms} https://www.metal-archives.com/search?searchString={searchTerms}&type=band_name https://duckduckgo.com/?q={searchTerms}&t=h_&ia=web https://zamunda.net/bananas?c4=1&c21=1&search={searchTerms}&gotonext=1&incldead=&field=name (for this one you're gonna need to register in order to test it) https://yts.mx/browse-movies/{searchTerms}/all/all/0/latest/0/all and https://www.skytorrents.lol/?query={searchTerms}

Here are my settings, in case you need them: SSS settings backup (2020-12-16T23.14.54.065Z).json.txt

hkockerbeck commented 3 years ago

The lead about add-ons that change the new tab page seems to be promising. I experience the problem as well, and I use the add-on Group Speed Dial in parallel with SSS. When Group Speed Dial is deactivated, SSS seems to work fine. When Group Speed Dial is active, SSS fails quite often (at least 40% or 50% of the time, maybe more) as described above.

When SSS fails, I get the following errors in the console (Ctrl-Shift-K)

Uncaught Error: Permission denied to access property "parentNode"
    i event.js:9
    i event.js:4
    <anonymous> sharing.js:39
    Webpack 7
event.js:9:6
Uncaught Error: Permission denied to access property "parentNode"
    o event.js:9
    o event.js:4
    71 sharing.js:39
    Webpack 7
event.js:9:6

The browser console (Ctrl-Shift-J) says

DataCloneError: The object could not be cloned. ExtensionChild.jsm:813
Error: Could not establish connection. Receiving end does not exist. background.js:203:40
Unchecked lastError value: Error: isPlaying is not defined background.js:365

The problem occurs with different search services, in my case with the dictionary site leo.org.

With the debugging add-on linked above the pop-up isn't working at all. When I use SSS from the context menu, no output is written to the console. The browser console says

Unchecked lastError value: Error: isPlaying is not defined background.js:365
    <anonym> moz-extension://bcc6bdac-39cb-47cb-9860-7e066c01030d/background.js:365
CanisLupus commented 3 years ago

So, I've been away for 2 hours and got to look at this again now. Thank you for all the info and engines. :)

For most of you, what I'm suspecting is that both the "new tab" addons and SSS try to update the tab at the "same time", and whichever runs first gets overridden by the second, thus causing the problem. No proof yet, but that would make sense. It never occurred to me that it could be addons because so many people were seeing this, but this is a common customization.

In that case, what I don't know is why @seascape experiences this without such addons (maybe something else acts on a new page too?) and why @IvoAndonov only gets the behaviour for some engines but not others. Could have to do with time to load a page, but I'm just guessing. The errors @hkockerbeck is seeing don't seem related to SSS. For that they'd usually be related to .js files in SSS, like "swift-selection-search.js", "page-script.js" or "settings.js". (It's common for that console to have many errors, from other parts of the browser, other addons, etc)

Delaying the tab search after creation by a few dozen milliseconds works most of the time but it's a "fix" that I absolutely don't like, and still won't work sometimes, depending on the browser's/machine performance. This needs more time, and if I don't get a fix in the next 15 minutes I'll have to postpone to tomorrow, sorry! :(

CanisLupus commented 3 years ago

Just leaving a build here that waits 50ms before trying to search using the new tab: swift_selection_search-3.47.1-non-final.zip

It's a very quick workaround that won't be the final fix but could solve/reduce the problem for some of you in the meantime (I tested with New Tab Tools and works on my end unless many many things are going on in the browser). Please see above how to install a temporary addon if you wish to try it.

Must look at this again tomorrow! 🙁

seascape commented 3 years ago

Perhaps that I have have over 500 tabs open right now is a factor in tab creation speed. Machine is an overclocked 2010 hexacore Xeon w/ 18GB RAM, normally has no trouble w/ this level of load.

The new temp build still fails a lot (just creates blank new tabs) but I didn't do methodical testing before it to know if the success rate's changed for the better. Seems that any given icon on my search palette can succeed or fail; fail seems twice as common.

In any case, I appreciate you striving to fix this so quickly!

AlexFundorin commented 3 years ago

I'm using FVD Speed Dial. The issue started back with 83 and continued to 84. Disabling FVD helps. Since the issue was detected, I'll wait for the official SSS update, then. Thanks for figuring it out.

rado84-github commented 3 years ago

Just leaving a build here that waits 50ms before trying to search using the new tab: swift_selection_search-3.47.1-non-final.zip

It's a very quick workaround that won't be the final fix but could solve/reduce the problem for some of you in the meantime (I tested with New Tab Tools and works on my end unless many many things are going on in the browser). Please see above how to install a temporary addon if you wish to try it.

Must look at this again tomorrow! slightly_frowning_face

I will download the non-final fix just in case but I fixed the issue on my side for FF 84 after "playing" with extensions in the last 5 hours. By removing 2 extensions that weren't updated for a long time and both created a conflict with SSS in FF84. The first extension was "Popup blocker (strict)" and the other was "Enable right click and absolute mode". After deleting these and restarting the browser, for the moment everything seems to be working properly with 3.47.0.

I've also set the maximum allowed number of popups in about:config to be just 1 in order to naturally fill the shoes of the popup blocker. :P

pflosch commented 3 years ago

To everyone here: do you have some kind of special new tab setting? (i.e. not the default of Firefox Home or a blank page)

I am using "new tab tools", and yes, if I deactivate it, SSS seems to work normally. 4.7.1 does not resolve the problem for me.

I did not figure how to get those logs from the console, I only see:

Uncaught (in promise) Error: Could not establish connection. Receiving end does not exist. handleActivated moz-extension://53492379-1ed1-4fa8-9995-6e77c00fc96f/ytmp3bg.js:10 ytmp3bg.js:10:15

AlexFundorin commented 3 years ago

"Enable right click and absolute mode".

I also have this addon. Disabling it and restarting FF helped. I need that addon, too. The only alternative to it is "Happy Right-Click", but it stays in the address bar, instead of the overflow menu.

rado84-github commented 3 years ago

"Enable right click and absolute mode".

I also have this addon. Disabling it and restarting FF helped. I need that addon, too. The only alternative to it is "Happy Right-Click", but it stays in the address bar, instead of the overflow menu.

That's even older than "Enable right click" and I personally don't want outdated extensions. Plus I doubt it would still work, cuz the last update of it was in 2017.

BubiBalboa commented 3 years ago

You guys can simply use shift+right click to force the right click menu in pages that disallow this. One add-on less to worry about.

opav commented 3 years ago

Same issue, open a new tab instead of search site. I have NewTabTools installed also.

FYI, similar to SSS, another addon - 'SelectionSK' is working fine with latest FF 84.0. I'd be using SelectionSK until SSS is fixed. It has its pros except no editable search field.

CanisLupus commented 3 years ago

Alright, thanks for the extra info in the meantime. :) Sorry for the wait.

I got a release candidate for a final 3.47.1. To make sure this is the right way, can anyone please please please test this build in debug mode as described before and confirm if the problem never happens?

swift_selection_search-3.47.1.zip

CanisLupus commented 3 years ago

To document the changes:

I changed the 3.47.0 approach of open tab and then open URL to be more similar to the way it was in 3.46.0, which was something like open tab at URL. The problem with that is that browser-managed engines will go back to their previous limitation of only being able to use "this tab" or "new tab" as behaviours because the WebExtensions API doesn't support anything else.

I also locked the names of browser-managed engines. This was a bug (that existed before 3.47.0) because they weren't supposed to be changeable!

BubiBalboa commented 3 years ago

The new version works well for me. No blank pages anymore. Thanks for fixing this so quickly.

seascape commented 3 years ago

Seems to work great here.

Really appreciate the quick fix! I would like to point out @CanisLupus' PayPal donation link to anyone who may find it relevant.

rado84-github commented 3 years ago

@CanisLupus , you'll have to release the .1 version as an update bc FF refuses to install it. I disabled signature checking in about:config but it still refuses to install from file.

CanisLupus commented 3 years ago

Awesome, thanks! 🙏 And thanks a lot for the nod, @seascape :)

@IvoAndonov Are you trying to use "Install Add-on from File" menu? Maybe that's it. That has never worked for me either, you must use the "Debug Add-ons" menu.

Well, if this is working, I'll submit this version to Mozilla! :) I'll work on that now. I had to make it so that browser-managed engines cannot be included in groups because they would cause really weird tab openings among the other, more "normal", engines.

CanisLupus commented 3 years ago

OK, submitted! It should be available as 3.47.2 tomorrow or in a few days, when someone reviews the version.

Thanks for all the help, everyone. :)

The fix involved bringing back some limitations on browser managed engines, but that is not extremely problematic, and maybe something can be done about that later. Better than not being able to search!

rado84-github commented 3 years ago

Awesome, thanks! pray And thanks a lot for the nod, @seascape :)

@IvoAndonov Are you trying to use "Install Add-on from File" menu? Maybe that's it. That has never worked for me either, you must use the "Debug Add-ons" menu.

Well, if this is working, I'll submit this version to Mozilla! :) I'll work on that now. I had to make it so that browser-managed engines cannot be included in groups because they would cause really weird tab openings among the other, more "normal", engines.

"Install from file" used to work with Waterfox which is basically 64-bit Firefox with minor differences, so I assumed it would work with Firefox as well. On Waterfox I simply had to disable extensions signature check for that option to work and I was surprised to see it doesn't work in the original Firefox. That's the only way I know of with which to manually update an extension.

3.47.2 just came to me and on first test seems to be working fine, even for the websites that previously didn't work.

CanisLupus commented 3 years ago

@IvoAndonov Maybe I could sign the addon next time, or check whatever else is needed to work with that menu. Since this was only temporary I figured using "Debug Add-ons" was enough.

In any case, glad to hear that the new version is working for you! :) I'll be closing this issue then. Seems like everything is set.

Thanks again, everyone! Daniel