From f873d3213c6be8e041cf4d9de201834110247750 Mon Sep 17 00:00:00 2001 From: Josh Haberman Date: Wed, 8 Jun 2016 12:38:15 -0700 Subject: Added JavaScript conformance tests. All tests pass! --- js/binary/utils.js | 4 ++++ js/message.js | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'js') 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.} */(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 */ -- cgit v1.2.3