On Tue, Feb 02, 2016 at 01:39:00AM +0300, Dmitry Gutov wrote:
On 02/02/2016 12:29 AM, Kris Maglione wrote:
That falls into the category of "unless it is calling browser code and
making it do something unsafe".

That's too bad. I'm just reusing a querying function from there, and a pretty small one.

It's not as small as you might think. In the best case, that function makes two CPOW calls, one for getElementsByTagName, and one to check its length. If any <meta> tags are returned, it makes as many as 5 calls for each one, and a sixth for the first one that matches.

In the cases where the content process isn't blocked on sync message, any or all of those requests might go out while the content process is in the middle of executing a slow script. The contents of those elements could change between each call. The browser could navigate to a different page.

Yes, that will add some complexity. It seems I can just copy getDescriptionFromDocument's definition until I get around to supporting E10s properly.

You could, but it would really be better not to. Unsafe CPOW usage is called unsafe for a reason.

Should be a plus, but the user's just waiting for the action to complete at this point, so it's not like there are many other things for the browser process to do.

You might be surprised. In your case, the difference between making simultaneous asynchronous requests to look up existing bookmarks and to get the description, and making blocking, synchronous calls for both, could easily be the difference between the action appearing to complete immediately, and it taking, at the very least, a noticeable amount of time.

In the mean time, since you're blocking the event loop on the requests, it means that the UI is essentially frozen. Animations and roll-over effects are stopped. If the content process is in the middle of a slow script, and the hard drive is busy, the UI could easily be completely unresponsive for seconds at a time.

There are definitely worse times to do synchronous bookmark queries and unsafe CPOW requests than in response to a user clicking a button, but that doesn't mean they don't cause problems.

--
Kris Maglione
Firefox Add-ons Engineer
Mozilla Corporation

If C gives you enough rope to hang yourself, C++ gives you enough rope
to bind and gag your neighbourhood, rig the sails in a small ship and
still have enough rope left to hang yourself from the yardarm.
        --Anonymous

_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to