Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / js / mozilla / strict / script-tests / 10.6.js
bloba90f48d175605b3bda56f90fe1bb789abbd9fe15
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 callFunctionBody(expr) {
9 return (
10 '(function f() {\n'
11 + 'Object.defineProperties(arguments, {1: { writable: false },\n'
12 + ' 2: { configurable: false },\n'
13 + ' 3: { writable: false,\n'
14 + ' configurable: false }});\n'
15 + 'return (' + expr + ');\n'
16 + '})(0, 1, 2, 3);');
19 assertEq(testLenientAndStrict(callFunctionBody('arguments[0] = 42'),
20 returns(42), returns(42)),
21 true);
23 assertEq(testLenientAndStrict(callFunctionBody('delete arguments[0]'),
24 returns(true), returns(true)),
25 true);
28 assertEq(testLenientAndStrict(callFunctionBody('arguments[1] = 42'),
29 returns(42), raisesException(TypeError)),
30 true);
32 assertEq(testLenientAndStrict(callFunctionBody('delete arguments[1]'),
33 returns(true), returns(true)),
34 true);
37 assertEq(testLenientAndStrict(callFunctionBody('arguments[2] = 42'),
38 returns(42), returns(42)),
39 true);
41 assertEq(testLenientAndStrict(callFunctionBody('delete arguments[2]'),
42 returns(false), raisesException(TypeError)),
43 true);
46 assertEq(testLenientAndStrict(callFunctionBody('arguments[3] = 42'),
47 returns(42), raisesException(TypeError)),
48 true);
50 assertEq(testLenientAndStrict(callFunctionBody('delete arguments[3]'),
51 returns(false), raisesException(TypeError)),
52 true);
55 reportCompare(true, true);
57 var successfullyParsed = true;