diff options
author | Josh Haberman <jhaberman@gmail.com> | 2016-06-08 12:38:15 -0700 |
---|---|---|
committer | Josh Haberman <jhaberman@gmail.com> | 2017-03-06 10:42:27 -0800 |
commit | f873d3213c6be8e041cf4d9de201834110247750 (patch) | |
tree | 67d98a0b35880b132f0e9fffc3c8a942b03133d8 /js | |
parent | 27b1f2b477b3d6ea4d6ee1fd492880818603382d (diff) | |
download | protobuf-f873d3213c6be8e041cf4d9de201834110247750.tar.gz protobuf-f873d3213c6be8e041cf4d9de201834110247750.tar.bz2 protobuf-f873d3213c6be8e041cf4d9de201834110247750.zip |
Added JavaScript conformance tests. All tests pass!
Diffstat (limited to 'js')
-rw-r--r-- | js/binary/utils.js | 4 | ||||
-rw-r--r-- | js/message.js | 2 |
2 files changed, 5 insertions, 1 deletions
diff --git a/js/binary/utils.js b/js/binary/utils.js index bbf99cdf..3ecd08e9 100644 --- a/js/binary/utils.js +++ b/js/binary/utils.js @@ -970,6 +970,10 @@ jspb.utils.byteSourceToUint8Array = function(data) { return /** @type {!Uint8Array} */(new Uint8Array(data)); } + if (data.constructor === Buffer) { + return /** @type {!Uint8Array} */(new Uint8Array(data)); + } + if (data.constructor === Array) { data = /** @type {!Array.<number>} */(data); return /** @type {!Uint8Array} */(new Uint8Array(data)); diff --git a/js/message.js b/js/message.js index 05d34e9d..b769cc2d 100644 --- a/js/message.js +++ b/js/message.js @@ -202,7 +202,7 @@ goog.define('jspb.Message.MINIMIZE_MEMORY_ALLOCATIONS', COMPILED); /** - * Does this browser support Uint8Aray typed arrays? + * Does this JavaScript environment support Uint8Aray typed arrays? * @type {boolean} * @private */ |