Perspectives icon indicating copy to clipboard operation
Perspectives copied to clipboard

Start the notary query when the tab loads

Open daveschaefer opened this issue 13 years ago • 5 comments

It looks like some queries actually don't start until the user views the tab? Verify if this is or isn't the case. If we're not starting the query right away we should try to - that will save time and make the extension more snappy/have a better UI.

daveschaefer avatar Jul 19 '12 14:07 daveschaefer

From MDN: "[using addProgressListener on a tabbrowser] will only get events from the browser [tab] that is currently displayed at the time the event occurs. In order to listen to events from all browsers, including those not currently being displayed [you must use gBrowser.addTabsProgressListener on the global browser]".

"The progress listener should be based on the nsIWebProgressListener interface with an additional "browser" argument as the first argument of every method, which is the browser (not = gBrowser) where the event occurred." ref

daveschaefer avatar Feb 21 '14 04:02 daveschaefer

If you look at this gist: https://gist.github.com/lambdor/8824a4e04ad91373fda2

Yes, we could start the querying in onLocationChange. This should be an easy change.

But we could start querying even sooner on the first onStateChange call (if the user's preference is set to "contact notaries for all HTTPS sites"). However, this would require some restructuring in the query-callback-process functionality because updateStatus requires the certificate already. The restructuring I have in mind would involve two asynchronous calls waiting for each other: one for querying the notaries and one for retrieving the certificate. These then will be merged together and finally do the comparison. I already started with some restructuring and parameter reducing in the lambdor/Perspectives@a3d3acbbd471b930a8fea22e2f729adcc8446294 branch. Also see #85.

ghost avatar Jun 19 '14 20:06 ghost

I implemented this now, but it's still work in progress, see the tabinfo_restructuring branch.

ghost avatar Jun 22 '14 10:06 ghost

Btw: I think we should split up the functionality even more. One file dealing with Perspectives core functionality and one file dealing with the client interaction. core functionality: queryNotaries, querySingleNotary, notaryAjaxCallback, notaryQueriesComplete, updateStatus client functionality: set notifications and favicon, manage tabinfos, fetch certificates etc. Some of these have to be extracted and returned as a result from the core functionality.

This would also allow for easier testing.

ghost avatar Jun 22 '14 15:06 ghost

Please try the new commit in tabinfo_restructuring! It should immediately start querying, handle redirects correctly (www.github.com -> github.com), respect "only contact on certificate security error" preference and update states when selecting a different tab. Whew!

ghost avatar Jun 28 '14 12:06 ghost