Fixes #374

Changes:
- Implementation of `setJavaScript()` and `getJavaScript()` added for manipulating document-level JavaScript.
- Additionally, `resetJavaScript()` and `addJavaScript()` methods added.

See the docblocks for all four methods for the description of their operations.

#374 fixed.
Typo: should be testGetJavaScript.