Remove main.js requirement for themes

This is for #8626.
You can just use `metadata` here instead of re-parsing it.  (Unless `metadata` is falsy, in which case you should skip the check since the data is unreadable anyway).

So, something like this: `var isTheme = metadata && metadata.theme;`