Feature detection is often a pain point when figuring out why a site
doesn't work in Servo -- regular JS errors are logged and detectable, but
feature detection is silent. JavaScript's awesome coercion rules cause
similar issues when a property evaluates to false when it's really
undefined.

To help find cases where feature detection is going on, I wrote a "feature
detector detector". Basically, it logs each time a property is accessed,
where that access evaluates to `undefined`.

Some results can be found here
<https://gist.github.com/Manishearth/d3534fb65c65e4ef86f2152cf3bd2c0f>,
both with and without spoofing the UA to be firefox.

To run, clone the "FDD" branch on my mozjs fork
<https://github.com/servo/mozjs/compare/master...Manishearth:FDD?expand=1>,
and set it as a path override (paths = ["/path/to/mozjs"] in
components/servo/.cargo/config). Building and running this on any site will
spew out tons of JSON output about each possible-feature-detection property
access. Run this output through parse.py
<https://gist.github.com/Manishearth/06583087c4001f45ed3a9e74c7848211#file-parse-py>
to filter it down to property accesses for properties that actually exist
in Firefox. The list of properties in parse.py is not 100% complete (see
the comment on gen.js. Also, Location is weird), but it's close enough.

Should be useful to help find and prioritize features to work on.

Firefox may also have interest in this, so I'm seeing if a cleaned-up
version of this might be something we can merge into the main codebase.

Let me know if there are sites you'd like to see this run against!

Thanks,
-Manish Goregaokar
_______________________________________________
dev-servo mailing list
dev-servo@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-servo

Reply via email to