test(): add conditional testing for prototypes

Previously, tests failed due to Firefox not allowing patching of
certain prototypes. With conditional implementation, the tests
do not run if the prototypes cannot be patched. Hence, they are
tested only in the browsers that allow patching.