Rust bindings to SpiderMonkey on inbound

2017-09-01 Thread Nick Fitzgerald
(cc dev-servo, dev-platfrom; reply to js-engine-internals)

Hello everyone!

The Rust bindings to SpiderMonkey that Servo uses just landed in
mozilla-inbound[0]! You can monitor their test results on taskcluster as
the `SM-tc[tier-2](rust)` job.

If any of your patches break these tests, please ping me or Till
Schneidereit and we can get them passing again together.

This marks the beginning of the end of Servo forking SpiderMonkey and
applying custom patches to work around old bindgen bugs. That forking has
been making updating to new SpiderMonkey releases a terrible pain for
Servo. No more!

Thanks to everyone involved in getting this patch series landed!

Nick

[0]
https://treeherder.mozilla.org/#/jobs?repo=mozilla-inbound=a8ae266cd61eb004d4f74a989e4d9c6d2ceb5b93
___
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform


Rust logging with e10s

2017-09-01 Thread J. Ryan Stinnett
If you've used RUST_LOG to enable logging for Rust modules, but were hoping
you could filter down to child processes only, bug 1390736 now allows you
to use RUST_LOG_CHILD to target them. This has been helpful for several of
us working on Stylo.

To use, just replace RUST_LOG with RUST_LOG_CHILD and supply the same
filtering and log levels as usual.

In the process, I also wrote some notes about Rust logging in general on
the Gecko logging page[1].

If there are other env vars like this that would be helpful to target per
process / process type, let's discuss it! There might be a need for
something more general than this one-off addition.

[1]:
https://developer.mozilla.org/docs/Mozilla/Developer_guide/Gecko_Logging#Rust

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


Re: Web Platform Tests in Headless Mode

2017-09-01 Thread Michael Smith
(One addition you may want to make is passing the --no-pause-after-test 
option to ./mach web-platform-tests. The default behavior is to pause so 
that you can see the test output in the Firefox window; in headless mode 
this isn't so helpful. Thanks :bz!)


-Michael

On 9/1/2017 14:27, Michael Smith wrote:

Hi everyone,

This is a quick note to announce that the Web Platform Tests are 
headless mode compatible. (I say "announce", but this has really been 
the case since https://bugzil.la/1373739 was resolved.)


This means that you can run one or more web platform tests without 
having actual Firefox windows pop up and steal your focus. Just run 
with the "MOZ_HEADLESS=1" environment variable set, as well as 
MOZ_HEADLESS_WIDTH and MOZ_HEADLESS_HEIGHT set to an appropriate fake 
screen width and height. The Web Platform Tests expect a 1600x1200 
resolution on Linux and macOS and 1024x768 on Windows.


MOZ_HEADLESS=1 MOZ_HEADLESS_WIDTH=1600 MOZ_HEADLESS_HEIGHT=1200 ./mach 
web-platform-tests 
/html/dom/elements/global-attributes/dir_auto-textarea-script-N-EN.htm


Headless mode Web Platform Tests aren't being run automatically on CI 
yet, but as of https://bugzil.la/1373739 they should all produce 
equivalent outcomes to non-headless runs. If you do encounter any 
differences, please file bugs against the "Firefox: Headless" component.


-Michael Smith [:mismith]



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


Re: Stylesheet wait timeout?

2017-09-01 Thread Kris Maglione

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  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
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform


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


___
dev-platform mailing list
dev-platform@lists.mozilla.org
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
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform


Re: Stylesheet wait timeout?

2017-09-01 Thread Anthony Ricaud
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?

Another alternative, can we prevent extensions from injecting content in 
webpages before layout has started? 

> On 1 Sep 2017, at 22:57, Ehsan Akhgari  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
>> dev-platform@lists.mozilla.org
>> https://lists.mozilla.org/listinfo/dev-platform
> 
> ___
> dev-platform mailing list
> dev-platform@lists.mozilla.org
> https://lists.mozilla.org/listinfo/dev-platform

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


Web Platform Tests in Headless Mode

2017-09-01 Thread Michael Smith

Hi everyone,

This is a quick note to announce that the Web Platform Tests are 
headless mode compatible. (I say "announce", but this has really been 
the case since https://bugzil.la/1373739 was resolved.)


This means that you can run one or more web platform tests without 
having actual Firefox windows pop up and steal your focus. Just run with 
the "MOZ_HEADLESS=1" environment variable set, as well as 
MOZ_HEADLESS_WIDTH and MOZ_HEADLESS_HEIGHT set to an appropriate fake 
screen width and height. The Web Platform Tests expect a 1600x1200 
resolution on Linux and macOS and 1024x768 on Windows.


MOZ_HEADLESS=1 MOZ_HEADLESS_WIDTH=1600 MOZ_HEADLESS_HEIGHT=1200 ./mach 
web-platform-tests 
/html/dom/elements/global-attributes/dir_auto-textarea-script-N-EN.htm


Headless mode Web Platform Tests aren't being run automatically on CI 
yet, but as of https://bugzil.la/1373739 they should all produce 
equivalent outcomes to non-headless runs. If you do encounter any 
differences, please file bugs against the "Firefox: Headless" component.


-Michael Smith [:mismith]

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


Re: Stylesheet wait timeout?

2017-09-01 Thread Boris Zbarsky

On 9/1/17 10:15 AM, Dustin Mitchell wrote:

I can narrow that bisection down to two sets: [test-pilot] and [].


So test-pilot is causing the flash of unstyled content in your case?  I 
assume this is the addon at https://testpilot.firefox.com/ ?


What pages are you seeing the flash of unstyled content on?

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


Re: Eiminating nsIDOM* interfaces and brand checks

2017-09-01 Thread Boris Zbarsky

On 9/1/17 4:54 PM, Kris Maglione wrote:
The other 
potential issue is that the `instanceof Ci.nsIDOM...` checks tend to 
appear in places like JSMs, where we don't have direct access to 
constructors for DOM interfaces by default.


Right, if we used one of the things that use constructors, we'd have to 
import them into the JSM scope to do these checks.


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


Re: Stylesheet wait timeout?

2017-09-01 Thread Ehsan Akhgari
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
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform


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


Re: Eiminating nsIDOM* interfaces and brand checks

2017-09-01 Thread Kris Maglione

On Fri, Sep 01, 2017 at 04:43:31PM -0400, Ehsan Akhgari wrote:

On 09/01/2017 01:18 PM, Boris Zbarsky wrote:
That has the unfortunate side-effect of allocating a new JS string 
for every call, but we can probably optimize it if it becomes 
necessary.


We could add a hasClassName if we wanted.


I'm kind of missing what's better about this compared to the other 
suggestion of hasInstance() (thanks to Botond for catching my English 
mistake!)  I'm worried a bit because of the string compare that this 
involves.


I think for things like this, as micro-optimization-land as this may 
sound, we should keep performance in mind, and before making a call we 
should try to see which variant would be faster.  Where we're 
bikeshedding over the cosmetics of the API, we should consider letting 
the faster variant win.  It's easy to write this off as non-important 
right now but generic facilities like this are bound to be used some 
day in a hot loop somewhere and then fixing things may be too costly 
due to having to change all of the existing code.


Well, the main thing is that it already exists (well, the 
string-returning version), so it seemed worth mentioning. The other 
potential issue is that the `instanceof Ci.nsIDOM...` checks tend to 
appear in places like JSMs, where we don't have direct access to 
constructors for DOM interfaces by default.


In those cases, we tend to need something like `elem instanceof 
getGlobalForObject(elem).Element`, which is probably at least two orders 
of magnitude more expensive than the equivalent `hasClassName` call 
would be.

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


Re: Eiminating nsIDOM* interfaces and brand checks

2017-09-01 Thread Ehsan Akhgari

On 09/01/2017 01:18 PM, Boris Zbarsky wrote:
That has the unfortunate side-effect of allocating a new JS string 
for every call, but we can probably optimize it if it becomes necessary.


We could add a hasClassName if we wanted.


I'm kind of missing what's better about this compared to the other 
suggestion of hasInstance() (thanks to Botond for catching my English 
mistake!)  I'm worried a bit because of the string compare that this 
involves.


I think for things like this, as micro-optimization-land as this may 
sound, we should keep performance in mind, and before making a call we 
should try to see which variant would be faster.  Where we're 
bikeshedding over the cosmetics of the API, we should consider letting 
the faster variant win.  It's easy to write this off as non-important 
right now but generic facilities like this are bound to be used some day 
in a hot loop somewhere and then fixing things may be too costly due to 
having to change all of the existing code.


Cheers,
Ehsan
___
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform


Intent to unship: :-moz-empty-except-children-with-localname, :-moz-devtools-highlighted, and :-moz-styleeditor-transitioning from content documents.

2017-09-01 Thread Emilio Cobos Álvarez
Pretty much in the same spirit as my previous mail, I intend to unship
access to these pseudo-classes in content documents.

The idea would be, similarly, to do that for FF 58.

The reasoning behind is that there's no spec for them, and they're
implementation details, basically. In particular:

 * The devtools ones should be exposed only to UA sheets.
 * :-moz-empty-except-children-with-localname is only used for ,
is a super-slow selector, and we don't handle well dynamic changes to it
properly (nor is worth to try to do it, IMO).

I don't think I need to do a huge investigation to consider safe
unshipping these from content pages, but let me know if you think otherwise.

Feel free to reply here or in
, which I just
filed to this effect, if there are any concerns.

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


Intent to unship: :-moz-system-metric pseudo-class and media queries in content pages.

2017-09-01 Thread Emilio Cobos Álvarez
Hi dev-platform@,

I'd like to unship access to the :-moz-system-metric pseudo-class, and
the system metric media queries, from content pages. I just filed
 for that.

They're not in any spec, and they seem unused (I can't find anything
non-mozilla-related in Github code search). Furthermore they expose
system information, which can be a fingerprinting vector, and pretty
random stuff like "is a color picker available?".

According to Boris it predates Gecko's capacity to not expose stuff.

I think it should be pretty safe to unship, but let me know if you don't
think that way, or have data that indicates the opposite.

The intention is to do that in Firefox 58, given we don't want to add
extra risk to Stylo.

Thanks!

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


PSA: MOZ_TRY() now works with nsresult values and in nsresult-valued functions

2017-09-01 Thread Kris Maglione
As of the landing of bug 1366511, it's now possible to use MOZ_TRY with 
and from functions that return nsresult values. This means that, among 
other things, it's now easy to use mozilla::Result from XPCOM methods, 
and vice versa, as long as the Result error type is nsresult:


   #include "mozilla/ResultExtensions.h"

   Result
   OpenFile(const nsACtring& aPath)
   {
 nsCOMPtr file;
 MOZ_TRY(NS_NewLocalFile(aPath, false, getter_AddRefs(file)));
 return Move(file);
   }

   nsresult
   Thing::DoStuff()
   {
 nsCOMPtr file;
 MOZ_TRY_VAR(file, OpenFile(mPath));

 MOZ_TRY(file->GetNSPRFileDescriptor(...));
 ...

 return NS_OK;
   }

This works thanks to a mozilla::ToResult() helper, which MOZ_TRY calls 
to convert arbitrary types to Result (which incidentally also 
supports PRStatus by default), and GenericErrorResult type 
that auto-converts to nsresult.



As a side note, there's a particular optimization for the type 
Result so that it occupies the same amount of space as a 
bare nsresult, and code like this:


   Result MaybeThing();

   Result
   Thing()
   {
 MOZ_TRY(MaybeThing());
 return Ok();
   }

compiles to essentially the same machine code as:

   nsresult MaybeThing();

   nsresult
   Thing()
   {
 nsresult rv = MaybeThing();
 if (rv != NS_OK) {
 return rv;
 }
 return NS_OK;
   }

With the difference that the only success value MaybeThing() is allowed 
to return is NS_OK.

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


Re: Eiminating nsIDOM* interfaces and brand checks

2017-09-01 Thread Kris Maglione

On Fri, Sep 01, 2017 at 01:18:12PM -0400, Boris Zbarsky wrote:
That has the unfortunate side-effect of allocating a new JS string 
for every call, but we can probably optimize it if it becomes 
necessary.


We could add a hasClassName if we wanted.


That's an interesting idea. It would also remove the need to 
convert to UTF-16, since we could just use EqualsASCII.

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


Re: Eiminating nsIDOM* interfaces and brand checks

2017-09-01 Thread Boris Zbarsky

On 9/1/17 1:06 PM, Kris Maglione wrote:

  if (ChromeUtils.getClassName(element) == "HTMLEmbedElement")


Ah, that works.  Though I think spidermonkey wants to maybe get rid of 
classnames and on the flip side it's not clear whether 
HTMLEmbedElement.prototype will end up with the same classname as 
HTMLEmbedElement instances. :(


That has the unfortunate side-effect of allocating a new JS string for 
every call, but we can probably optimize it if it becomes necessary.


We could add a hasClassName if we wanted.

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


Re: Eiminating nsIDOM* interfaces and brand checks

2017-09-01 Thread Bobby Holley
On Fri, Sep 1, 2017 at 9:59 AM, Botond Ballo  wrote:

> On Fri, Sep 1, 2017 at 12:11 PM, Ehsan Akhgari 
> wrote:
> > How about this slight variation:
> >
> > HTMLEmbedElement.isInstanceOf(obj)
> >
> > instead of "is"?
>
> Isn't that backwards, though? HTMLEmbedElement isn't an instance of
> 'obj', 'obj' is an instance of HTMLEmbedElement :)
>

hasInstance?


> Cheers,
> Botond
> ___
> dev-platform mailing list
> dev-platform@lists.mozilla.org
> https://lists.mozilla.org/listinfo/dev-platform
>
___
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform


Re: Stylesheet wait timeout?

2017-09-01 Thread Kris Maglione

On Fri, Sep 01, 2017 at 10:52:30AM -0400, Ehsan Akhgari wrote:

On 09/01/2017 09:54 AM, Boris Zbarsky wrote:

On 9/1/17 7:02 AM, Gervase Markham wrote:

Restarting with no extensions causes my browser to feel a whole lot
faster (I'd love to know why that is, but that's a separate issue!)


Worth trying to bisect on the extensions to figure this out...


Or alternatively, install the Gecko Profiler from 
https://perf-html.io/, capture a few profiles and file bugs with them.  
Performance problems caused by add-ons are often easily visible in 
profiles.


But, alas, not always easy to trace to a particular extension as 
things stand now.


If you're looking at a local profile, though, you can at least 
figure out which extension a moz-extension: URL belongs to by 
opening about:debugging and looking at the internal UUIDs of 
installed add-ons.

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


Re: Eiminating nsIDOM* interfaces and brand checks

2017-09-01 Thread Kris Maglione

On Fri, Sep 01, 2017 at 11:01:51AM -0400, Boris Zbarsky wrote:
Now that we control all the code that can attempt to touch 
Components.interfaces.nsIDOM*, we can try to get rid of these 
interfaces and their corresponding bloat.


The main issue is that we have consumers that use these for testing 
what sort of object we have, like so:


 if (obj instanceof Ci.nsIDOMWhatever)

and we'd need to find ways to make that work.  In some cases various 
hacky workarounds are possible in terms of property names the object 
has and maybe their values, but they can end up pretty non-intuitive 
and fragile.  For example, this:


 element instanceof Components.interfaces.nsIDOMHTMLEmbedElement

becomes:

 element.localName === "embed" &&
 element.namespaceURI === "http://www.w3.org/1999/xhtml;


One possibility that should work, but is slightly ugly:

 if (ChromeUtils.getClassName(element) == "HTMLEmbedElement")

That has the unfortunate side-effect of allocating a new JS 
string for every call, but we can probably optimize it if it 
becomes necessary.

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


Re: Eiminating nsIDOM* interfaces and brand checks

2017-09-01 Thread Botond Ballo
On Fri, Sep 1, 2017 at 12:11 PM, Ehsan Akhgari  wrote:
> How about this slight variation:
>
> HTMLEmbedElement.isInstanceOf(obj)
>
> instead of "is"?

Isn't that backwards, though? HTMLEmbedElement isn't an instance of
'obj', 'obj' is an instance of HTMLEmbedElement :)

Cheers,
Botond
___
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform


Re: Eiminating nsIDOM* interfaces and brand checks

2017-09-01 Thread Michael Layzell
Accidentally sent this off-list.

On Fri, Sep 1, 2017 at 12:14 PM, Michael Layzell 
wrote:

> I personally like the style of (2) the most, The isWhatever style methods
> are too verbose, and I don't think that adding more code which depends on
> behavior we might want to remove from Firefox is a good idea.
>
> I'd probably not use the name `is` though, I'd be into ehsan's suggestion
> of `isInstanceOf` (or some variant on that) much more. If we make it wordy
> enough (e.g. isInstanceOf rather than is) then it'll be easier to change in
> the future if the web platform ever implements a good solution to the
> branding problem.
>
> On Fri, Sep 1, 2017 at 11:01 AM, Boris Zbarsky  wrote:
>
>> Now that we control all the code that can attempt to touch
>> Components.interfaces.nsIDOM*, we can try to get rid of these interfaces
>> and their corresponding bloat.
>>
>> The main issue is that we have consumers that use these for testing what
>> sort of object we have, like so:
>>
>>   if (obj instanceof Ci.nsIDOMWhatever)
>>
>> and we'd need to find ways to make that work.  In some cases various
>> hacky workarounds are possible in terms of property names the object has
>> and maybe their values, but they can end up pretty non-intuitive and
>> fragile.  For example, this:
>>
>>   element instanceof Components.interfaces.nsIDOMHTMLEmbedElement
>>
>> becomes:
>>
>>   element.localName === "embed" &&
>>   element.namespaceURI === "http://www.w3.org/1999/xhtml;
>>
>> and even that is only OK at the callsite in question because we know it
>> came from http://searchfox.org/mozilla-central/rev/51b3d67a5ec1758bd2f
>> e7d7b6e75ad6b6b5da223/dom/interfaces/xul/nsIDOMXULCommandDis
>> patcher.idl#17 and hence we know it really is an Element...
>>
>> Anyway, we need a replacement.  Some possible options:
>>
>> 1)  Use "obj instanceof Whatever".  The problem is that we'd like to
>> maybe kill off the cross-global instanceof behavior we have now for DOM
>> constructors.
>>
>> 2)  Introduce chromeonly "is" methods on all DOM constructors.  So
>> "HTMLEmbedElement.is(obj)".  Possibly with some nicer but uniform name.
>>
>> 3)  Introduce chromeonly "isWhatever" methods (akin to Array.isArray) on
>> DOM constructors.  So "HTMLEmbedElement.isHTMLEmbedElement(obj)".  Kinda
>> wordy and repetitive...
>>
>> 4)  Something else?
>>
>> Thoughts?  It really would be nice to get rid of some of this stuff going
>> forward.  And since the web platform seems to be punting on branding,
>> there's no existing solution we can use.
>>
>> -Boris
>> ___
>> dev-platform mailing list
>> dev-platform@lists.mozilla.org
>> https://lists.mozilla.org/listinfo/dev-platform
>>
>
>
___
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform


Re: Stylesheet wait timeout?

2017-09-01 Thread Boris Zbarsky

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
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform


Re: Eiminating nsIDOM* interfaces and brand checks

2017-09-01 Thread Ehsan Akhgari

On 09/01/2017 11:01 AM, Boris Zbarsky wrote:

Anyway, we need a replacement.  Some possible options:

1)  Use "obj instanceof Whatever".  The problem is that we'd like to 
maybe kill off the cross-global instanceof behavior we have now for 
DOM constructors.


2)  Introduce chromeonly "is" methods on all DOM constructors.  So 
"HTMLEmbedElement.is(obj)".  Possibly with some nicer but uniform name.


How about this slight variation:

HTMLEmbedElement.isInstanceOf(obj)

instead of "is"?

Also, is this something that we can codegen in WebIDL based on the 
presence of [HTMLConstructor] or something like that?


3) Introduce chromeonly "isWhatever" methods (akin to Array.isArray) 
on DOM constructors.  So "HTMLEmbedElement.isHTMLEmbedElement(obj)".  
Kinda wordy and repetitive...


4)  Something else?

Thoughts?  It really would be nice to get rid of some of this stuff 
going forward.  And since the web platform seems to be punting on 
branding, there's no existing solution we can use.


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


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


Eiminating nsIDOM* interfaces and brand checks

2017-09-01 Thread Boris Zbarsky
Now that we control all the code that can attempt to touch 
Components.interfaces.nsIDOM*, we can try to get rid of these interfaces 
and their corresponding bloat.


The main issue is that we have consumers that use these for testing what 
sort of object we have, like so:


  if (obj instanceof Ci.nsIDOMWhatever)

and we'd need to find ways to make that work.  In some cases various 
hacky workarounds are possible in terms of property names the object has 
and maybe their values, but they can end up pretty non-intuitive and 
fragile.  For example, this:


  element instanceof Components.interfaces.nsIDOMHTMLEmbedElement

becomes:

  element.localName === "embed" &&
  element.namespaceURI === "http://www.w3.org/1999/xhtml;

and even that is only OK at the callsite in question because we know it 
came from 
http://searchfox.org/mozilla-central/rev/51b3d67a5ec1758bd2fe7d7b6e75ad6b6b5da223/dom/interfaces/xul/nsIDOMXULCommandDispatcher.idl#17 
and hence we know it really is an Element...


Anyway, we need a replacement.  Some possible options:

1)  Use "obj instanceof Whatever".  The problem is that we'd like to 
maybe kill off the cross-global instanceof behavior we have now for DOM 
constructors.


2)  Introduce chromeonly "is" methods on all DOM constructors.  So 
"HTMLEmbedElement.is(obj)".  Possibly with some nicer but uniform name.


3)  Introduce chromeonly "isWhatever" methods (akin to Array.isArray) on 
DOM constructors.  So "HTMLEmbedElement.isHTMLEmbedElement(obj)".  Kinda 
wordy and repetitive...


4)  Something else?

Thoughts?  It really would be nice to get rid of some of this stuff 
going forward.  And since the web platform seems to be punting on 
branding, there's no existing solution we can use.


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


Re: Stylesheet wait timeout?

2017-09-01 Thread Ehsan Akhgari

On 09/01/2017 09:54 AM, Boris Zbarsky wrote:

On 9/1/17 7:02 AM, Gervase Markham wrote:

Restarting with no extensions causes my browser to feel a whole lot
faster (I'd love to know why that is, but that's a separate issue!)


Worth trying to bisect on the extensions to figure this out...
Or alternatively, install the Gecko Profiler from https://perf-html.io/, 
capture a few profiles and file bugs with them.  Performance problems 
caused by add-ons are often easily visible in profiles.



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


Re: Stylesheet wait timeout?

2017-09-01 Thread Dustin Mitchell
I can narrow that bisection down to two sets: [test-pilot] and [].

Dustin

2017-09-01 9:54 GMT-04:00 Boris Zbarsky :
> On 9/1/17 7:02 AM, Gervase Markham wrote:
>>
>> Restarting with no extensions causes my browser to feel a whole lot
>> faster (I'd love to know why that is, but that's a separate issue!)
>
>
> Worth trying to bisect on the extensions to figure this out...
>
>> but I can't reproduce the FOUC in a few minutes of trying. :-|
>
>
> Again, worth trying to bisect on the extensions.  The
> not-reliably-reproducible aspect makes this a bit annoying.  :(
>
> -Boris
>
> ___
> dev-platform mailing list
> dev-platform@lists.mozilla.org
> https://lists.mozilla.org/listinfo/dev-platform
___
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform


Re: Quantum Flow Engineering Newsletter #22

2017-09-01 Thread Ben Kelly
On Fri, Sep 1, 2017 at 10:06 AM, Ben Kelly  wrote:

> On Fri, Sep 1, 2017 at 1:59 AM, Ehsan Akhgari 
> wrote:
>
>>- Mike Conley made it so that background tabs are “warmed up” when
>>hovering the mouse cursor over them
>>. This should
>>improve tab switching perceived performance.
>>
>
> I just want to highlight that telemetry shows that the mean tab switch
> time dropped from ~30ms to ~3ms:
>
> https://mzl.la/2grbPB2
>

Sorry, this is median. I incorrectly said mean.
___
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform


Re: Quantum Flow Engineering Newsletter #22

2017-09-01 Thread Ben Kelly
On Fri, Sep 1, 2017 at 1:59 AM, Ehsan Akhgari 
wrote:

>- Mike Conley made it so that background tabs are “warmed up” when
>hovering the mouse cursor over them
>. This should
>improve tab switching perceived performance.
>

I just want to highlight that telemetry shows that the mean tab switch time
dropped from ~30ms to ~3ms:

https://mzl.la/2grbPB2

An order of magnitude improvement! \o/
___
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform


Re: Stylesheet wait timeout?

2017-09-01 Thread Boris Zbarsky

On 9/1/17 7:02 AM, Gervase Markham wrote:

Restarting with no extensions causes my browser to feel a whole lot
faster (I'd love to know why that is, but that's a separate issue!)


Worth trying to bisect on the extensions to figure this out...


but I can't reproduce the FOUC in a few minutes of trying. :-|


Again, worth trying to bisect on the extensions.  The 
not-reliably-reproducible aspect makes this a bit annoying.  :(


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


Re: New minimum Rust version policy for Firefox

2017-09-01 Thread Kartikaya Gupta
There was a bit of discussion on the PR I submitted yesterday:
https://github.com/servo/webrender/pull/1644#discussion_r136424367 -
we decided to just manually bump it once in a while instead of making
it track `stable`.

On Thu, Aug 31, 2017 at 5:54 PM, Mike Hommey  wrote:
> On Thu, Aug 31, 2017 at 10:27:55AM -0500, Jack Moffitt wrote:
>> Specifically for webrender (and anything else under the servo org on
>> GitHub), you can just file a bug and assign to edunham and we'll fix
>> that up.
>>
>> jack.
>
> Note that for webrender specifically, it used to build against stable,
> but back then Firefox required 1.15 and a webrender change broke that.
> To avoid the problem again, I added 1.15.1 to .travis.yml, but there
> were concerns about the number of travis jobs that incurred, so I
> removed stable at the same time
> (https://github.com/servo/webrender/pull/1334). Later that minimum
> version was bumped to 1.17 when Firefox bumped its requirement, but
> hasn't been bumped since.
>
> Now that Firefox nightly kinda sorta follows stable, I guess using
> stable instead of a hardcoded version again makes sense.
>
> Mike
___
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform


Testing & "Intent to Ship"

2017-09-01 Thread James Graham
Looking back over recent "Intent to Ship" emails for web platform 
exposed features, I notice that only half make any mention of 
accompanying tests.


Since cross-browser tests are one of the main ways we prevent today's 
exciting new feature being tomorrow's site-breaking compat nightmare, 
I'd like to encourage everyone to be more diligent about following the 
Intent to Ship template, and recording whether the feature they want to 
enable has adequate test coverage to demonstrate compatibility with 
other browsers' existing and future implementations.

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


PSA: symbol server now available via https

2017-09-01 Thread Ted Mielczarek
Just an FYI, yesterday the symbol server (symbols.mozilla.org) was moved
to a different server backend[1], and as a result it's now also
available via https. It should continue to work seamlessly at the
existing URL, but you can update your symbol server paths to
https://symbols.mozilla.org/ if you'd like to add end-to-end encryption
to your symbol server requests.

Thanks to peterbe and miles and the other folks for their hard work in
updating this useful piece of infrastructure!

-Ted

1. https://bugzilla.mozilla.org/show_bug.cgi?id=1389205
___
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform


Re: Stylesheet wait timeout?

2017-09-01 Thread Gervase Markham
On 31/08/17 19:08, Boris Zbarsky wrote:
> The symptoms you observe sound like (A) is happening, possible from an
> extension or our browser UI...  If you have a link to a specific url
> that reproduces for you, especially in a clean profile, that would be
> pretty useful.  This is usually pretty simple to debug when (A) happens:
> set a breakpoint on when we start layout and see what the JS stack is.
> The hard part is catching it happening.

Restarting with no extensions causes my browser to feel a whole lot
faster (I'd love to know why that is, but that's a separate issue!) but
I can't reproduce the FOUC in a few minutes of trying. :-|

I will try and gather more data.

Gerv

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


Re: Stylesheet wait timeout?

2017-09-01 Thread Gervase Markham
On 31/08/17 20:00, Michael Froman wrote:
> I’ve seen this behavior too on OSX.  I did a restart with all add-ons
> disabled and could not reproduce.  Restarted with all add-ons on, and
> can reproduce.  I narrowed it down to Ghostery.  If I disable
> Ghostery, it no long appears to happen for me.  YMMV.

I do not have Ghostery, although I do have quite a few other addons.

Gerv

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


Re: Stylesheet wait timeout?

2017-09-01 Thread Gervase Markham
On 31/08/17 18:45, Chris Peterson wrote:
> Gerv, do you have Stylo enabled? Even if you did not flip the pref
> (layout.css.servo.enabled), you might be in the Stylo experiment for
> Nightly users. Check about:support for "Stylo".

about:support says "Stylo: true (enabled by default)".

Gerv

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


Changing remote type of xpcshell Content processes from "" to "web"

2017-09-01 Thread Andrew Sutherland
Right now if you have an e10s xpcshell test, the remote type of the 
resulting child (content) process will be NO_DEFAULT_TYPE="". This is 
not a real type, this is not a type you should ever see in Firefox.  In 
https://bugzilla.mozilla.org/show_bug.cgi?id=1395827 I propose changing 
the type to DEFAULT_REMOTE_TYPE="web".  It's not a sure thing, but I 
figure if I make it sound likely to happen and you have an opinion on 
this, you're more likely to speak up. Please chime in on the bug.  Thanks!


Andrew

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


Quantum Flow Engineering Newsletter #22

2017-09-01 Thread Ehsan Akhgari
Hi everyone,

With around three weeks left in the development cycle for Firefox 57,
everyone seems to be busy getting the last fixes in to shape up this
long-awaited release.  On the Quantum Flow project, we have kept up with
the triage of the incoming bug reports that are tagged as [qf], and as
we're getting closer to the beta uplift date, the realistic opportunity for
fixing bugs is getting narrower, and as such the bar for prioritizing
incoming bug reports as [qf:p1] keeps getting higher.  This matches with
the overall shift in focus in the past few weeks towards getting all the
ongoing work that is targeting Firefox 57 under control to make sure we
manage to do as much of what we have planned to do for this release as
possible.

This past week we made more progress on optimizing the performance of
Firefox for the Speedometer V2
 benchmark.
Besides many of the usual optimizations, which you will read about in the
acknowledgement section of the newsletter, one noteworthy item was David
Major's investigation 
for adding this benchmark to the set of pages that we load to train the PGO
profile we use on Windows builds.  This allowed the MSVC code generator to
generate better optimized code using the profile information and bought us
a few benchmark score points.  Of course, earlier similar attempts
 hadn't really gained
us better performance, and it's unclear whether this change will stick or
get backed out due to PGO specific crashes or whatnot, but in the mean time
we're not stopping landing other
 improvements
 to Firefox for this
benchmark either!  At the time of this writing, the Firefox Health
Dashboard puts our benchmark score on Nightly at 4.07% of Chrome's.

Another news worthy of mention related to Speedometer is that recently
Speedometer tests with Stylo  were
enabled  on AWFY.  As
can be seen on the reference hardware
 score
page
,
Stylo builds are now a bit faster than normal Gecko when running
Speedometer.  This has been achieved by the hard work of many people on the
Stylo team and I'd like to take a moment to thank them, and especially call
out Bobby Holley who helped make sure that we have a great performance
story here.

In other performance related news, this past week the first implementation
of our cooperative preemptive scheduling of web page JavaScript
, more commonly known
as Quantum DOM, landed.  The design document

describes some of the background information which may be helpful if you
need to understand the details of how the new world looks like.  For now,
this feature is disabled by default while the ongoing work to iron out the
remaining issues continues.

The Quantum DOM project has been a massive overhaul of our codebase.  A
huge part of it has been the "labeling"
 project that Bevis Tseng
has been tirelessly leading for many months now.  The basic idea behind
this part of the project is to give each runnable a name and indicate which
tab or document the runnable is associated with (I'm simplifying a bit,
please see the wiki page 
for more details.)  Bill McCloskey had a great suggestion about some
performance lessons that we have learned through this project for the
performance story section of this newsletter, which was to highlight how
this project ended up uncovering some unexpected performance issues in
Firefox!

Bevis has some telemetry analysis

which measures the number of runnables of a certain type (to view the
interesting part, please scroll down to the "full runnable list" section).
This analysis has been used to prioritize which runnables need to be worked
on next for labeling purposes.  But as this list shows the relative
frequencies of runnables, we've ended up finding several surprises in where
some runnables are showing up on this list, which have uncovered
performance issues which would otherwise be very difficult to detect and
diagnose.  Here are a few examples (thanks to Bill for enumerating them!):

   - We used to send the DidComposite notification to every tab, regardless
   of whether it was in the foreground or background.  We tried to fix this
   once , but the fix
   actually only fixed a related issue involving multiple windows.