Bug 991981 - Test for TypedObjectGet not being neutering-aware. r=nmatsakis
authorJeff Walden <jwalden@mit.edu>
Wed, 14 May 2014 17:05:22 -0700
changeset 234607 1ae70cece64666ec6a76d0b2dd9b2b02287b54c2
parent 234606 be9320beb260c8ad584f88b99c57cb35a6241380
child 234608 ef6465b02d0d15a0f29b4f0d8823994feb6658da
push id611
push userraliiev@mozilla.com
push dateMon, 05 Jan 2015 23:23:16 +0000
treeherdermozilla-release@345cd3b9c445 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnmatsakis
bugs991981
milestone35.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 991981 - Test for TypedObjectGet not being neutering-aware. r=nmatsakis
js/src/tests/ecma_6/TypedObject/map-neutered-midway.js
new file mode 100644
--- /dev/null
+++ b/js/src/tests/ecma_6/TypedObject/map-neutered-midway.js
@@ -0,0 +1,43 @@
+// |reftest| skip-if(!this.hasOwnProperty("TypedObject")||!xulRuntime.shell) -- needs TypedObject, neuter()
+/*
+ * Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/licenses/publicdomain/
+ */
+
+var BUGNUMBER = 991981;
+var summary =
+  "Behavior of mapping from an array neutered midway through mapping";
+
+function mapOneDimArrayOfUint8(dataHandling)
+{
+  var FourByteArray = TypedObject.uint8.array(4);
+  var FourByteArrayArray = FourByteArray.array(4);
+
+  var buf = new ArrayBuffer(16);
+  var arr = new FourByteArrayArray(buf);
+
+  var count = 0;
+  assertThrowsInstanceOf(function()
+  {
+    arr.map(function(v)
+    {
+      if (count++ > 0)
+        neuter(buf, dataHandling);
+      return new FourByteArray();
+    });
+  }, TypeError, "mapping of a neutered object worked?");
+}
+
+function runTests()
+{
+  print(BUGNUMBER + ": " + summary);
+
+  mapOneDimArrayOfUint8("change-data");
+  mapOneDimArrayOfUint8("same-data");
+
+  if (typeof reportCompare === "function")
+    reportCompare(true, true);
+  print("Tests complete");
+}
+
+runTests();