Object.getOwnPropertyNames includes "arguments" and "caller" for bound functions
[WebKit-https.git] / LayoutTests / js / script-tests / strict-throw-type-error.js
1 description("ThrowTypeError is a singleton object");
2
3 function getter(object, name)
4 {
5     Object.getOwnPropertyDescriptor(object, name).get;
6 }
7
8 function strictArgumentsFunction1()
9 {
10     "use strict";
11     return arguments;
12 }
13 var strictArguments1 = strictArgumentsFunction1();
14 var boundFunction1 = strictArgumentsFunction1.bind();
15 var functionCaller1 = getter(strictArgumentsFunction1.__proto__, "caller");
16 var functionArguments1 = getter(strictArgumentsFunction1.__proto__, "arguments");
17 var argumentsCaller1 = Object.getOwnPropertyDescriptor(strictArguments1, "caller");
18 var argumentsCallee1 = getter(strictArguments1, "callee");
19 var boundCaller1 = Object.getOwnPropertyDescriptor(boundFunction1, "caller");
20 var boundArguments1 = Object.getOwnPropertyDescriptor(boundFunction1, "arguments");
21
22 function strictArgumentsFunction2()
23 {
24     "use strict";
25     return arguments;
26 }
27 var strictArguments2 = strictArgumentsFunction2();
28 var boundFunction2 = strictArgumentsFunction2.bind();
29 var functionCaller2 = getter(strictArgumentsFunction2.__proto__, "caller");
30 var functionArguments2 = getter(strictArgumentsFunction2.__proto__, "arguments");
31 var argumentsCaller2 = Object.getOwnPropertyDescriptor(strictArguments2, "caller");
32 var argumentsCallee2 = getter(strictArguments2, "callee");
33 var boundCaller2 = Object.getOwnPropertyDescriptor(boundFunction2, "caller");
34 var boundArguments2 = Object.getOwnPropertyDescriptor(boundFunction2, "arguments");
35
36 shouldBeTrue('functionCaller1 === functionCaller2');
37
38 shouldBeTrue('functionCaller1 === functionArguments1');
39 shouldBe('argumentsCaller1', 'undefined');
40 shouldBeTrue('functionCaller1 === argumentsCallee1');
41 shouldBe('boundCaller1', 'undefined');
42 shouldBe('boundArguments1', 'undefined');
43
44 shouldBeTrue('functionCaller2 === functionArguments2');
45 shouldBe('argumentsCaller2', 'undefined');
46 shouldBeTrue('functionCaller2 === argumentsCallee2');
47 shouldBe('boundCaller2', 'undefined');
48 shouldBe('boundArguments2', 'undefined');
49
50 successfullyParsed = true;