WebCrypto: fix crypto.getRandomValues() with non-buffer arguments
Previously, crypto.getRandomValues() obtained the destination bytes
with njs_vm_value_to_bytes(), which also accepts strings and does not
make a private copy of shared data. As a result:
- for a string argument the random bytes were written into the
string data, which may be shared with other strings, including
literals in the script;
- for r.requestBuffer in nginx the request body seen by subsequent
reads was modified.
Now, only typed arrays and DataView objects are accepted, and the
buffer is made writable before the write.
The issue was introduced in
7b2b7612 (0.7.0).