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 15function getProperties(obj) 16{ 17 var str = ""; 18 for (name in obj) 19 { 20 if (str) 21 { 22 str += " " + name; 23 } 24 else 25 { 26 str = name; 27 } 28 } 29 return str; 30} 31 32var prototype_obj = { dummy:1, length:1, caller:null, 33 arguments:null, prototype:null }; 34 35var func = function() {}; 36 37Object.setPrototypeOf(func, prototype_obj); 38assert(getProperties(func) == "dummy"); 39 40var bound_func = (function() {}).bind(null); 41Object.setPrototypeOf(bound_func, prototype_obj); 42assert(getProperties(bound_func) == "dummy prototype"); 43 44// 'print' is an external function 45Object.setPrototypeOf(print, prototype_obj); 46assert(getProperties(print) == "dummy length caller arguments"); 47