[1845] prevent assets from being registered multiple times

JavaScript and CSS registrations are now stored inside a Set and a
Hash, respectively, to ensure that no duplicates are created.

For #1845