Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / js / mozilla / strict / script-tests / 15.4.5.1.js
blob6277c234b331ec64c2e767f9dfd80a61501acd23
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
3 /*
4 * Any copyright is dedicated to the Public Domain.
5 * http://creativecommons.org/licenses/publicdomain/
6 */
8 function arr() {
9 return Object.defineProperty([1, 2, 3, 4], 2, {configurable: false});
12 assertEq(testLenientAndStrict('var a = arr(); a.length = 2; a',
13 returnsCopyOf([1, 2, 3]),
14 raisesException(TypeError)),
15 true);
17 // Internally, SpiderMonkey has two representations for arrays:
18 // fast-but-inflexible, and slow-but-flexible. Adding a non-index property
19 // to an array turns it into the latter. We should test on both kinds.
20 function addx(obj) {
21 obj.x = 5;
22 return obj;
25 assertEq(testLenientAndStrict('var a = addx(arr()); a.length = 2; a',
26 returnsCopyOf(addx([1, 2, 3])),
27 raisesException(TypeError)),
28 true);
30 reportCompare(true, true);
32 var successfullyParsed = true;