1// Copyright JS Foundation and other contributors, http://js.foundation
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15var test_failed = false;
16
17function verifyConfigurableAccessor (obj, name, string) {
18  let prop = Object.getOwnPropertyDescriptor (obj, name);
19  if (prop.get && !prop.configurable) {
20    print (string + " should be configurable, but wasn't");
21    test_failed = true;
22  }
23}
24
25for (let builtin_name of Reflect.ownKeys (this)) {
26  let builtin_obj = this[builtin_name];
27  if (builtin_name[0] === builtin_name[0].toUpperCase () && typeof builtin_obj == "function") {
28    for (let prop of Reflect.ownKeys (builtin_obj)) {
29      verifyConfigurableAccessor (builtin_obj, prop, builtin_name + "." + prop.toString ());
30    }
31
32    let builtin_proto = builtin_obj.prototype;
33    if (builtin_proto) {
34      for (let prop of Reflect.ownKeys (builtin_proto)) {
35        verifyConfigurableAccessor (builtin_proto, prop, builtin_name + ".prototype." + prop.toString ());
36      }
37    }
38
39    builtin_proto = Reflect.getPrototypeOf (builtin_obj);
40    if (builtin_proto !== Function.prototype) {
41      for (let prop of Reflect.ownKeys (builtin_proto.prototype)) {
42        verifyConfigurableAccessor (builtin_proto.prototype, prop, builtin_name + ".[[Prototype]].prototype." + prop.toString ());
43      }
44    }
45  }
46}
47
48assert (!test_failed);
49