Improvements related to JS::RootedT types.

Avoids passing JS::RootedT as argument for some templated functions because that should/must not be done according to the rooting guide.
Changes some (but not yet all) JS conversions to the new syntax because the old one is deprecated.
Avoids some .get() calls for the rooted types because they actually support the functions directly.
Additional style improvements and replacement of deprecated API.

Adds some more rooting, but there's a lot missing (I'm going to leave that for the moment).
Replaces some deprecated API.
Reverts some unrelated changes.