1 description("Test to ensure that js constructors create objects with the correct constructor"); 2 3 var otherGlobal = document.getElementsByTagName("iframe")[0].contentWindow; 4 var constructors = ["Object", "Function", "Array", "Number", "String", "Boolean", "RegExp", "Date", "Error", "RangeError", "ReferenceError", "SyntaxError", "TypeError", "URIError", "Image"]; 5 6 for (var i = 0; i < constructors.length; i++) { 7 shouldBeTrue("new otherGlobal." + constructors[i] + "() instanceof otherGlobal." + constructors[i]); 8 try { 9 if ((typeof (otherGlobal[constructors[i]]())) === "object" || (typeof (otherGlobal[constructors[i]]())) === "function") 10 shouldBeTrue("otherGlobal." + constructors[i] + "() instanceof otherGlobal." + constructors[i]); 11 } catch(e) { 12 13 } 14 } 15 16 successfullyParsed = true; 17