Index: test/mjsunit/delete-non-configurable.js |
diff --git a/test/mjsunit/regress/regress-crbug-142218.js b/test/mjsunit/delete-non-configurable.js |
similarity index 55% |
copy from test/mjsunit/regress/regress-crbug-142218.js |
copy to test/mjsunit/delete-non-configurable.js |
index 373f83bca34d915ca06cc9c6a52875a30b7ec3e5..8991f43f530a04b8fdf2b07e861a09f01407d095 100644 |
--- a/test/mjsunit/regress/regress-crbug-142218.js |
+++ b/test/mjsunit/delete-non-configurable.js |
@@ -25,20 +25,50 @@ |
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
-// Flags: --allow-natives-syntax |
+// Delete elements of a String object. |
+var TIPLI = "tipli" |
+var so = new String(TIPLI); |
+var length = so.length; |
-length = 1 << 16; |
-a = new Array(length); |
+for (var i = 0; i < length; i++) { |
+ assertFalse(delete so[i]); |
+ assertThrows("'use strict'; delete so[i];", TypeError); |
+ assertFalse(delete so[i.toString()]); |
+ assertThrows("'use strict'; delete so[i.toString()];", TypeError); |
+} |
+ |
+assertEquals(length, so.length); |
+assertEquals(new String(TIPLI), so); |
-function insert_element(key) { |
- a[key] = 42; |
+// Delete elements of an Array. |
+var arr = new Array(length); |
+ |
+for (var i = 0; i < length; i++) { |
+ arr[i] = i; |
+ Object.defineProperty(arr, i, { configurable: false }); |
} |
-insert_element(1); |
-%OptimizeFunctionOnNextCall(insert_element); |
-insert_element(new Object()); |
-count = 0; |
for (var i = 0; i < length; i++) { |
- if (a[i] != undefined) count++; |
+ assertFalse(delete arr[i]); |
+ assertThrows("'use strict'; delete arr[i];", TypeError); |
+ assertFalse(delete arr[i.toString()]); |
+ assertThrows("'use strict'; delete arr[i.toString()];", TypeError); |
+ assertEquals(i, arr[i]); |
} |
-assertEquals(1, count); |
+ |
+assertEquals(length, arr.length); |
+assertTrue(delete arr[length]); |
+ |
+// Delete an element of an Object. |
+var INDEX = 28; |
+var obj = new Object(); |
+ |
+obj[INDEX] = TIPLI; |
+Object.defineProperty(obj, INDEX, { configurable: false }); |
+ |
+assertFalse(delete obj[INDEX]); |
+assertThrows("'use strict'; delete obj[INDEX];", TypeError); |
+assertFalse(delete obj[INDEX.toString()]); |
+assertThrows("'use strict'; delete obj[INDEX.toString()];", TypeError); |
+assertEquals(TIPLI, obj[INDEX]); |
+assertTrue(delete arr[INDEX+1]); |