WIP-6 Bug 921417 - rewrite build/variant.py in javascript