On Fri, Sep 01, 2017 at 11:32:43PM +0200, Anthony Ricaud wrote:
I have no idea if this is feasible but could we prevent
extensions from performing synchronous layout flushes before
layout has started? If this is possible, extensions that need
to perform them could require a new permission?
It's possible, to some extent (extensions could get around it by
just executing code in the page context rather than their
sandbox), but not exactly trivial. It would also probably break
too many extensions to be feasible.
Another alternative, can we prevent extensions from injecting
content in webpages before layout has started?
No. A lot of extensions depend on being able to run code before
any page scripts have executed (and we hear from them when that
doesn't work the way they expect). We could do this for
content scripts that ask to run with idle dispatch, but that
wouldn't help with (for example) Ghostery.
On 1 Sep 2017, at 22:57, Ehsan Akhgari <[email protected]> wrote:
FWIW I filed https://bugzil.la/1396097 for adding a console warning which would
have warned about this specific case.
On 09/01/2017 12:37 PM, Boris Zbarsky wrote:
On 8/31/17 3:00 PM, Michael Froman wrote:
If I disable Ghostery, it no long appears to happen for me. YMMV.
Michael,
Thank you. So with Ghostery installed, I managed to reproduce a flash of
unstyled content when doing a force-reload of https://github.com/servo/servo
That's because Ghostery does a .clientHeight get with this stack:
0 setBoxHeights()
["moz-extension://8ecb1f2d-060f-ce44-96ed-44895f11ca4b/dist/purplebox.js":128]
1 handleMessages(request = [object Object], sender = [object Object])
["moz-extension://8ecb1f2d-060f-ce44-96ed-44895f11ca4b/dist/purplebox.js":448]
(the rest is less important).
I reported this issue to them (copy/paste of my report below) through the form
at https://ghostery.zendesk.com/hc/en-us/requests/new but if someone has better
contact info that might be nice.
-Boris
Report I sent:
STEPS TO REPRODUCE:
1) Install Ghostery in Firefox.
2) Load https://github.com/servo/servo/
3) Force-reload a few times.
ACTUAL RESULTS: Eventually you get a flash of unstyled content: content being
rendered before the stylesheets are loaded.
EXPECTED RESULTS: No flashes of unstyled content.
DETAILS: The flash of unstyled content is due to Ghostery forcing a layout
before the stylesheets are loaded. This happens when the setBoxHeights()
function, in purplebox.js is called from handleMessages(), which is handling
the 'createBox' message.
setBoxHeights does this:
windowHeight = doc.documentElement.clientHeight * 0.85 - 35;
which forces layout of "doc" which in this case is the webpage being loaded. If all you want is
the height of the window that document is in, possibly with some adjustments, you could use
`doc.defaultView.innerHeight`, or `win.innerHeight` if "win" is the window for "doc".
The innerHeight getter doesn't need to perform layout within the window itself, and won't cause this problem.
It might also be possible to not do 'createBox' until layout has started on the
page. I'm not sure that point in time is exposed to extensions at the moment,
but we might be able to add a notification that exposes it. What I don't know
whether that's a viable option in your case; it's possible that you need
'createBox' to happen before that point.
_______________________________________________
dev-platform mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-platform
_______________________________________________
dev-platform mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-platform
_______________________________________________
dev-platform mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-platform
--
Kris Maglione
Senior Firefox Add-ons Engineer
Mozilla Corporation
It is the mark of an educated mind to be able to entertain a thought
without accepting it.
--Aristotle
_______________________________________________
dev-platform mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-platform