diff options
Diffstat (limited to 'LayoutTests/fast/js/resources/js-constructors-use-correct-global.js')
-rw-r--r-- | LayoutTests/fast/js/resources/js-constructors-use-correct-global.js | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/LayoutTests/fast/js/resources/js-constructors-use-correct-global.js b/LayoutTests/fast/js/resources/js-constructors-use-correct-global.js new file mode 100644 index 0000000..df8cb08 --- /dev/null +++ b/LayoutTests/fast/js/resources/js-constructors-use-correct-global.js @@ -0,0 +1,16 @@ +description("Test to ensure that js constructors create objects with the correct constructor"); + +var otherGlobal = document.getElementsByTagName("iframe")[0].contentWindow; +var constructors = ["Object", "Function", "Array", "Number", "String", "Boolean", "RegExp", "Date", "Error", "RangeError", "ReferenceError", "SyntaxError", "TypeError", "URIError", "Image"]; + +for (var i = 0; i < constructors.length; i++) { + shouldBeTrue("new otherGlobal." + constructors[i] + "() instanceof otherGlobal." + constructors[i]); + try { + if ((typeof (otherGlobal[constructors[i]]())) === "object" || (typeof (otherGlobal[constructors[i]]())) === "function") + shouldBeTrue("otherGlobal." + constructors[i] + "() instanceof otherGlobal." + constructors[i]); + } catch(e) { + + } +} + +successfullyParsed = true; |