| Index: mojo/public/js/codec_unittests.js
|
| diff --git a/mojo/public/js/codec_unittests.js b/mojo/public/js/codec_unittests.js
|
| index 5d6950763ee5fbd2d33ab1d0144d2c5c15f6f54c..82e7c5e3314da64140514f8d0bde85eb06a5f300 100644
|
| --- a/mojo/public/js/codec_unittests.js
|
| +++ b/mojo/public/js/codec_unittests.js
|
| @@ -15,6 +15,7 @@ define([
|
| testTypes();
|
| testAlign();
|
| testUtf8();
|
| + testArrayPointerValidation();
|
| this.result = "PASS";
|
|
|
| function testBar() {
|
| @@ -255,4 +256,18 @@ define([
|
| var str2 = reader.decoder.decodeStringPointer();
|
| expect(str2).toEqual(str);
|
| }
|
| +
|
| + function testArrayPointerValidation() {
|
| + function DummyClass() {};
|
| + var builder = new codec.MessageBuilder(42, 24);
|
| + var encoder = builder.createEncoder(8);
|
| + expect(function() {
|
| + // Pass something that is not an array it should throw.
|
| + encoder.encodeArrayPointer(DummyClass, 75);
|
| + }).toThrow();
|
| +
|
| + // An empty array or null should do nothing and be fine.
|
| + encoder.encodeArrayPointer(DummyClass, []);
|
| + encoder.encodeArrayPointer(DummyClass, null);
|
| + }
|
| });
|
|
|