Implement WebIDL union support.

Seven hours on a train without internet will do this to you. Fixes #541.