summaryrefslogtreecommitdiff
path: root/js/src/tests/function-arguments-caller-changes.diff
blob: 5c9cc0cfcd0bdaf947fe1c22c89270695fc66cfb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
diff --git a/js/src/tests/test262/ch13/13.2/13.2-29-s.js b/js/src/tests/test262/ch13/13.2/13.2-29-s.js
--- a/js/src/tests/test262/ch13/13.2/13.2-29-s.js
+++ b/js/src/tests/test262/ch13/13.2/13.2-29-s.js
@@ -8,12 +8,12 @@
  * @description StrictMode - property named 'caller' of function objects is not configurable
  * @onlyStrict
  */
 
 
 
 function testcase() {
         function foo() {"use strict";}
-        return ! Object.getOwnPropertyDescriptor(foo, 
-                                                  "caller").configurable;
+        return Object.getOwnPropertyDescriptor(foo, 
+                                               "caller") === undefined;
 }
-runTestCase(testcase);
\ No newline at end of file
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch13/13.2/13.2-30-s.js b/js/src/tests/test262/ch13/13.2/13.2-30-s.js
--- a/js/src/tests/test262/ch13/13.2/13.2-30-s.js
+++ b/js/src/tests/test262/ch13/13.2/13.2-30-s.js
@@ -7,12 +7,12 @@
  * @path ch13/13.2/13.2-30-s.js
  * @description StrictMode - property named 'caller' of function objects is not configurable
  * @onlyStrict
  */
 
 
 
 function testcase() {
-        return ! Object.getOwnPropertyDescriptor(Function("'use strict';"), 
-                                                  "caller").configurable;
+        return Object.getOwnPropertyDescriptor(Function("'use strict';"), 
+                                               "caller") === undefined;
 }
-runTestCase(testcase);
\ No newline at end of file
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch13/13.2/13.2-31-s.js b/js/src/tests/test262/ch13/13.2/13.2-31-s.js
--- a/js/src/tests/test262/ch13/13.2/13.2-31-s.js
+++ b/js/src/tests/test262/ch13/13.2/13.2-31-s.js
@@ -7,12 +7,12 @@
  * @path ch13/13.2/13.2-31-s.js
  * @description StrictMode - property named 'caller' of function objects is not configurable
  * @onlyStrict
  */
 
 
 
 function testcase() {
-        return ! Object.getOwnPropertyDescriptor(new Function("'use strict';"), 
-                                                  "caller").configurable;
+        return Object.getOwnPropertyDescriptor(new Function("'use strict';"), 
+                                               "caller") === undefined;
 }
-runTestCase(testcase);
\ No newline at end of file
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch13/13.2/13.2-32-s.js b/js/src/tests/test262/ch13/13.2/13.2-32-s.js
--- a/js/src/tests/test262/ch13/13.2/13.2-32-s.js
+++ b/js/src/tests/test262/ch13/13.2/13.2-32-s.js
@@ -8,12 +8,12 @@
  * @description StrictMode - property named 'caller' of function objects is not configurable
  * @onlyStrict
  */
 
 
 
 function testcase() {
         var funcExpr = function () { "use strict";};
-        return ! Object.getOwnPropertyDescriptor(funcExpr, 
-                                                  "caller").configurable;
+        return Object.getOwnPropertyDescriptor(funcExpr, 
+                                                  "caller") === undefined;
 }
-runTestCase(testcase);
\ No newline at end of file
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch13/13.2/13.2-33-s.js b/js/src/tests/test262/ch13/13.2/13.2-33-s.js
--- a/js/src/tests/test262/ch13/13.2/13.2-33-s.js
+++ b/js/src/tests/test262/ch13/13.2/13.2-33-s.js
@@ -8,12 +8,12 @@
  * @description StrictMode - property named 'arguments' of function objects is not configurable
  * @onlyStrict
  */
 
 
 
 function testcase() {
         function foo() {"use strict";}
-        return ! Object.getOwnPropertyDescriptor(foo, 
-                                                  "arguments").configurable;
+        return Object.getOwnPropertyDescriptor(foo, 
+                                               "arguments") === undefined;
 }
-runTestCase(testcase);
\ No newline at end of file
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch13/13.2/13.2-34-s.js b/js/src/tests/test262/ch13/13.2/13.2-34-s.js
--- a/js/src/tests/test262/ch13/13.2/13.2-34-s.js
+++ b/js/src/tests/test262/ch13/13.2/13.2-34-s.js
@@ -7,12 +7,12 @@
  * @path ch13/13.2/13.2-34-s.js
  * @description StrictMode - property named 'arguments' of function objects is not configurable
  * @onlyStrict
  */
 
 
 
 function testcase() {
-        return ! Object.getOwnPropertyDescriptor(Function("'use strict';"), 
-                                                  "arguments").configurable;
+        return Object.getOwnPropertyDescriptor(Function("'use strict';"), 
+                                               "arguments") === undefined;
 }
-runTestCase(testcase);
\ No newline at end of file
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch13/13.2/13.2-35-s.js b/js/src/tests/test262/ch13/13.2/13.2-35-s.js
--- a/js/src/tests/test262/ch13/13.2/13.2-35-s.js
+++ b/js/src/tests/test262/ch13/13.2/13.2-35-s.js
@@ -7,12 +7,12 @@
  * @path ch13/13.2/13.2-35-s.js
  * @description StrictMode - property named 'arguments' of function objects is not configurable
  * @onlyStrict
  */
 
 
 
 function testcase() {
-        return ! Object.getOwnPropertyDescriptor(new Function("'use strict';"), 
-                                                  "arguments").configurable;
+        return Object.getOwnPropertyDescriptor(new Function("'use strict';"), 
+                                               "arguments") === undefined;
 }
-runTestCase(testcase);
\ No newline at end of file
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch13/13.2/13.2-36-s.js b/js/src/tests/test262/ch13/13.2/13.2-36-s.js
--- a/js/src/tests/test262/ch13/13.2/13.2-36-s.js
+++ b/js/src/tests/test262/ch13/13.2/13.2-36-s.js
@@ -8,12 +8,12 @@
  * @description StrictMode - property named 'arguments' of function objects is not configurable
  * @onlyStrict
  */
 
 
 
 function testcase() {
         var funcExpr = function () { "use strict";};
-        return ! Object.getOwnPropertyDescriptor(funcExpr, 
-                                                  "arguments").configurable;
+        return Object.getOwnPropertyDescriptor(funcExpr, 
+                                                "arguments") === undefined;
 }
-runTestCase(testcase);
\ No newline at end of file
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch13/13.2/S13.2.3_A1.js b/js/src/tests/test262/ch13/13.2/S13.2.3_A1.js
--- a/js/src/tests/test262/ch13/13.2/S13.2.3_A1.js
+++ b/js/src/tests/test262/ch13/13.2/S13.2.3_A1.js
@@ -1,49 +1,61 @@
 // Copyright 2011 Google Inc.  All rights reserved.
 // This code is governed by the BSD license found in the LICENSE file.
 
 /**
  * @path ch13/13.2/S13.2.3_A1.js
- * @description check that all poisoning use the [[ThrowTypeError]]
+ * @description check that strict mode functions/arguments have
+ *   [[ThrowTypeError]]-like behavior
  * function object.
  * @onlyStrict
  */
 
 "use strict";
-var poison = Object.getOwnPropertyDescriptor(function() {}, 'caller').get;
+var poison = Object.getOwnPropertyDescriptor(Function.prototype, 'caller').get;
 
 if (typeof poison !== 'function') {
   $ERROR("#1: A strict function's .caller should be poisoned with a function");
 }
 var threw = null;
 try {
-  poison();
+  poison.call(function() {});
 } catch (err) {
   threw = err;
 }
 if (!threw || !(threw instanceof TypeError)) {
   $ERROR("#2: Poisoned property should throw TypeError");
 }
 
+function checkNotPresent(obj, name) {
+  var desc = Object.getOwnPropertyDescriptor(obj, name);
+  if (desc !== undefined) {
+    $ERROR("#3: " + name + " should not appear as a descriptor");
+  }
+}
+
+var argumentsPoison =
+  Object.getOwnPropertyDescriptor(function() { return arguments; }(),
+                                  "callee").get;
+
 function checkPoison(obj, name) {
   var desc = Object.getOwnPropertyDescriptor(obj, name);
   if (desc.enumerable) {
     $ERROR("#3: Poisoned " + name + " should not be enumerable");
   }
   if (desc.configurable) {
     $ERROR("#4: Poisoned " + name + " should not be configurable");
   }
-  if (poison !== desc.get) {
+  if (argumentsPoison !== desc.get) {
     $ERROR("#5: " + name + "'s getter not poisoned with same poison");
   }
-  if (poison !== desc.set) {
+  if (argumentsPoison !== desc.set) {
     $ERROR("#6: " + name + "'s setter not poisoned with same poison");
   }
 }
 
-checkPoison(function() {}, 'caller');
-checkPoison(function() {}, 'arguments');
+checkNotPresent(function() {}, 'caller');
+checkNotPresent(function() {}, 'arguments');
 checkPoison((function() { return arguments; })(), 'caller');
 checkPoison((function() { return arguments; })(), 'callee');
-checkPoison((function() {}).bind(null), 'caller');
-checkPoison((function() {}).bind(null), 'arguments');
+checkNotPresent((function() {}).bind(null), 'caller');
+checkNotPresent((function() {}).bind(null), 'arguments');