dmlls / yang

Yang! - Yet Another Bangs anywhere Firefox extension
https://addons.mozilla.org/addon/yang-addon/
GNU General Public License v3.0
21 stars 3 forks source link

Regression: extension fails to intercept search requests #20

Closed robinmetral closed 2 months ago

robinmetral commented 2 months ago

Describe the bug The extension occasionally fails to intercept search requests since 0.9.24.

An example: just now, my request !wiki Robert Wyatt (from the Firefox lookup bar) was not intercepted and was handled by my default search engine (priv.au), instead of redirecting to Wikipedia.

image

To Reproduce Unortunately, I haven't been able to reproduce this consistently :confused:

I wasn't sure whether this vague issue was even worth reporting, but I thought that if others are running into the same issue it might help us find the root cause.

Of course, I'm happy to provide more details, or to debug myself (would need pointers on how to proceed).

Expected behavior Before the latest version, bangs worked consistently, intercepting search requests as expected.

Screenshots n/a

Desktop (please complete the following information):

Smartphone (please complete the following information): n/a

Additional context I've been noticing this for roughly a week, which is why I think that this is related to the new version.

I'm noticing the issue when using bangs from the lookup bar in a new tab: the search request is not intercepted, and the search query (prefixed by the bang) is sent to my default search engine instead (priv.au). Retrying usually works.

TinfoilSubmarine commented 2 months ago

I'm experiencing a similar bug, but I think it can be reproduced reliably as you hinted at in your additional context.

Steps to reproduce:

  1. Open new tab.
  2. Do search (in my case !r test search) which gets handled by the search engine.
  3. Do search again in same tab, which will get handled by Yang correctly this time.

Desktop (please complete the following information): OS: Android 14 (LineageOS) Browser: Firefox Version: 129.0.2 Search engine: DuckDuckGo

dmlls commented 2 months ago

Hi @robinmetral and @TinfoilSubmarine, thank you for the detailed reports!

This issue could be related to this comment. Back then I thought it might have been a Chromium-related problem, but after digging a bit into how the new Manifest V3 works, it seems that now background scripts are stopped more frequently than before.

My bet so far is that, since the bangs were stored in a global variable (something that is now discouraged), this variable was being erased every now and then, and therefore there were no bangs to match the query against.

I'm already migrating the bangs to be stored in storage.session, and hopefully this will solve the issue.

robinmetral commented 2 months ago

Thanks a lot @dmlls, this would make sense! Let me know if you need help testing. I think that @TinfoilSubmarine is right and I can also pretty much reproduce this consistently, so it should be easy to verify a fix.

dmlls commented 2 months ago

Release is out https://github.com/dmlls/yang/releases/tag/v0.9.26.

You can manually update the add-on by going to "Manage Extension", turning off the automatic updates and clicking on "Check for Updates".

@robinmetral, @TinfoilSubmarine we can leave the issue open for a couple of days and see if the issue is resolved.

robinmetral commented 2 months ago

Fixed on my end! Thanks for the fast release :rocket: Happy to leave this open for an extra couple of days

TinfoilSubmarine commented 2 months ago

The issue with it not working on new tabs is mostly fixed for me as well. However, I'm still seeing the issue when opening a new tab after starting Firefox. Steps:

  1. Open Firefox.
  2. Open new tab.
  3. Try using bang, but it passes through to DDG instead of getting intercepted by yang.
dmlls commented 2 months ago

@TinfoilSubmarine I was able to reproduce on Firefox Android 130.0, but interestingly not on Firefox Android Nightly 132.0a1. I wonder if anything relevant changed on Firefox itself in between those versions...

In any case, https://github.com/dmlls/yang/releases/tag/v0.9.28 is out. I tested it on Firefox Android 130.0 and the issue is fixed. Please, tell me it's also fixed on your side! 🤞🏻😁

TinfoilSubmarine commented 2 months ago

Yes, updated and fixed for me, thanks!

robinmetral commented 2 months ago

I'll close this as resolved by #22 and #23.

If someone else runs into this issue:

  1. make sure you're on the latest yang version (see the comment above)
  2. if the bug still occurs, report it here and we can reopen the issue