dmlls / yang

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

Startpage redirection weirdness with host_permissions #30

Open jahtnamas opened 4 days ago

jahtnamas commented 4 days ago

Describe the bug Using a bang with Startpage as the browser's default search engine either: doesn't immediately redirect (this is new since I reported it, idk what exactly is up there) or only redirects when another link still on Startpage's domain is interacted with. I'm noticing now that the latter happens with my custom fixed speedrun.com bang specifically.

To Reproduce Steps to reproduce the behavior:

  1. Bang search in browser's searchbar with Startpage as the default and hit enter.
  2. You are now on Startpage's results.

Expected behavior Yang redirects to the requested search engine.

Desktop (please complete the following information):

Additional context I'll be quoting @dmlls' comment from #20

The problem lies in my misinterpretation of the host_permissions in the manifest.json. I always though they would match exactly the specified pattern, but obviously enough, they only match the host. This means that Yang will also be active in https://www.startpage.com/do/settings.

In the settings page, the search query is still included as a query parameter and since Yang is active, the bang is triggered.

anyway i hope i did okay with filing this issue :+1:

dmlls commented 3 days ago

Hi @jahtnamas, and thank you for opening a new issue.

Unfortunately, I haven't been able to reproduce this issue neither on Firefox ESR, nor on Firefox, Zen Browser, or Firefox Android. Could you try on any other search engine and see if the issue is still there? I'm trying to figure out if this is specific to Startpage.

Also, the fact that it could take a second to redirect is likely caused by the migration to Manifest V3, in which blocking requests are no longer supported, which prevents us from blocking the request to the search engine while we "find" the bang and redirect to it. However, this usually happens so fast that the search engine is not even loaded.