I'm trying to get something similar to a typo correction for the location bar on mozilla sdk. The user inputs a url on the locationbar and it gets changed before it is loaded. I've tried:
sdk/pagemod as seen here. The problem is it runs when the page starts rendering, not before it starts downloading it.
sdk/tabs => It doesn't have a event that gets called before it starts loading a website.
Above is what I've found that would catch websites the user is trying to enter into. I have also found sdk/system/events, but the only event I found I could use is http-on-modify-request, this does catch every http request. The problem is, you can't modify the url of that request.
To solve this I've seen 2 options:
This addon's way => Get the current tab and load there the new url. The problem is clear, the request may not be from a url the user is trying to load, but from a url inside a page's html. I tried comparing the request url to tabs.activeTab.url, but it gets set after the http-on-modify-request event is sent.
or the solution explained here that I am not sure could work (it is not for mozilla sdk).
So basically my problem right now could be solved with:
-a way to capture the url from the location bar before it starts loading & changing it (I haven't seen anything for this on the sdk) or -a way to know when a request corresponds to a website the user is trying to load in the location bar or -a way to modify the request (url)