Index: test/mjsunit/array-constructor.js |
diff --git a/test/mjsunit/array-constructor.js b/test/mjsunit/array-constructor.js |
index bf5d3d611a9d5c845871d54ddff816656ca78582..c9707b965435b55183a95b5ddaca2251c6a4cd95 100644 |
--- a/test/mjsunit/array-constructor.js |
+++ b/test/mjsunit/array-constructor.js |
@@ -25,7 +25,6 @@ |
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
- |
var loop_count = 5 |
@@ -117,3 +116,23 @@ for (var i = 0; i < loop_count; i++) { |
assertThrows('new Array(3.14)'); |
assertThrows('Array(2.72)'); |
+ |
+// Make sure that throws occur in the context of the Array function. |
+var b = Realm.create(); |
+var bArray = Realm.eval(b, "Array"); |
+var bError = Realm.eval(b, "RangeError"); |
+ |
+function verifier(array, error) { |
+ try { |
+ new array(3.14); |
+ } catch(e) { |
+ return e.__proto__ === error.__proto__; |
+ } |
+ assertTrue(false); // should never get here. |
+} |
+ |
+ |
+assertTrue(verifier(Array, RangeError())); |
+assertTrue(verifier(bArray, bError())); |
+assertFalse(verifier(Array, bError())); |
+assertFalse(verifier(bArray, RangeError())); |