Closed babastienne closed 5 years ago
Your thought about webRequest.onBeforeRequest was correct. The issue was that I completely forgot that it even existed in my code (background.js). Therefore the feature wasn't updated in like forever and in addition it wasn't implemented that well. I fixed it by basically rewriting background.js, which should make the recognition from the url bar much faster. (A consequence of this is that the custom search engine feature is now completely useless and has therefore been removed). It would be great if you could test it. (Oh and i followed your advice and created a development branch)
I just looked at your modifications. It's working very well now, congratulations on your work (and for your reactivity). In my opinion the issue is now solved.
However, some bugs has been introduced when you made your last modifications :
document.getElementById('save').addEventListener('click', save_options);
at the end of your file option.js
.document.getElementById('add_search').addEventListener('click', add_engine);
can also be removed in the same file (not a bug but more like an unused line of code)If I had more time I would have done a pull request but I'm kind of busy so sorry for this quick answer.
Yeah, i deleted the wrong line by accident. The bug should be fixed now.
Ok I did a test again, it seems to be working fine now.
Context :
I'm doing a research in the address bar of firefox. Example :
!g foo bar
My default search engine is ecosia.Expected behaviour :
The research is intercepted by the extension and the request is changed to search on google. The page displayed is the results of google.
Behaviour :
The request is not intercepted immediately. There is a first request made on ecosia instead of google. The ecosia result is displayed : Only after it is displayed the new request is made on google and the page is changing again to display the google results :
Problem : This multiply the requests made and create a small amount of time where firefox can't be used to do anything else. Because if I do my research and then promptly change to a second tab then the first tab will display the ecosia research and the google results will be displayed in the second tab.
I thought that the webRequest.onBeforeRequest would be able to intercept the initial request but when looking at your code you already used it so I'm not sure of how to solve this issue, otherwise I would have done a pull request. Not sure if the description is complete enough to understand the problem. Don't hesitate to ask for more informations in case of need.