aboutsummaryrefslogtreecommitdiffhomepage
path: root/js
diff options
context:
space:
mode:
authorGravatar Josh Haberman <jhaberman@gmail.com>2016-06-08 12:38:15 -0700
committerGravatar Josh Haberman <jhaberman@gmail.com>2017-03-06 10:42:27 -0800
commitf873d3213c6be8e041cf4d9de201834110247750 (patch)
tree67d98a0b35880b132f0e9fffc3c8a942b03133d8 /js
parent27b1f2b477b3d6ea4d6ee1fd492880818603382d (diff)
Added JavaScript conformance tests. All tests pass!
Diffstat (limited to 'js')
-rw-r--r--js/binary/utils.js4
-rw-r--r--js/message.js2
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
*/