Skip to content
This repository has been archived by the owner on Oct 5, 2022. It is now read-only.

UI freezes for the duration of NDT test #22

Open
critzo opened this issue Sep 28, 2014 · 7 comments
Open

UI freezes for the duration of NDT test #22

critzo opened this issue Sep 28, 2014 · 7 comments

Comments

@critzo
Copy link

critzo commented Sep 28, 2014

The NDT test performs an asynchronous callback indicating telling the control protocol that the server is ready to feed the test data back to the client. The NDT test calls for receiving data as fast as possible for 10 seconds. The tight receive loop at line 95 of https://github.com/opentechinstitute/mlab-browser-ext/blob/master/lib/plugins/NDT/S2CTest.js

Because of the restriction on doing XPI from only the main thread, when we are in this tight receive loop, we are blocking the UI. No navigation to other tabs or windows is possible during this time.

One possible workaround woudl be to use an implementation of WebSockets, based on the implementation in this ticket: https://bugzilla.mozilla.org/show_bug.cgi?id=733573#c33

@jgmize
Copy link

jgmize commented Oct 13, 2014

@critzo based on a later comment in the same bug you referred to, you may be able to use the newer TCPSocket API for this by enabling the dom.mozTCPSocket.enabled pref. Based on my understanding from reading the discussion in the bug and elsewhere, you might be able to use this new API from a web worker-- I haven't been able to find anything to confirm this one way or another, but if you give it a shot I'd be interested in finding out. I'm not sure exactly which versions of Firefox this would work on, but you could test for the API availability and fall back to the current XPCOM method for older versions.

@critzo
Copy link
Author

critzo commented Oct 13, 2014

@jgmize Thanks for taking a look at this. @hawkinswnaf @technosopher What do you think about the TCPSocketAPI idea?

@hawkinsw
Copy link

Hey @jgmize @critzo and @technosopher :

This definitely seems like a doable thing. The webworker/TCPSocketAPI was proposed to us as a possible workaround and it sounds reasonable. I just haven't had a chance to play around and see how it would work :-(

@collina
Copy link

collina commented Jan 6, 2015

@jgmize The TCPSocket API is Firefox OS only, correct?

@hawkinsw
Copy link

hawkinsw commented Jan 6, 2015

It would be Firefox extension only, I think.

@jgmize
Copy link

jgmize commented Jan 6, 2015

Yes, the TCPSocket API is only enabled by default on Firefox OS, so it cannot be used from a webpage on desktop Firefox, but I figured it may be possible to do from an extension. After doing a little more research I found http://stackoverflow.com/a/26359452/2965637, which indicates that you should be able to create a TCPSocket instance using the following:

var socket = Cc["@mozilla.org/tcp-socket;1"].createInstance(Ci.nsIDOMTCPSocket);

@hawkinsw
Copy link

hawkinsw commented Jan 6, 2015

Yup. That is a very familiar looking syntax :-)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants