blob: b9b1ff902b38adf0ddaad8a4f4fdc412851ab397 [file] [log] [blame]
description("This test documents our set of global constructors we expose on the window object (FF and Opera don't expose them on the window, btw). This also checks to make sure than any constructor attribute we expose has the expected constructor type.")
var constructorNames = [];
var windowProperties = Object.getOwnPropertyNames(window);
for (var i = 0; i < windowProperties.length; i++) {
var name = windowProperties[i];
var value = window[name];
var re = new RegExp("Constructor]$");
var isConstructor = re.exec(value);
if (isConstructor)
constructorNames.push(name);
}
constructorNames.sort();
for (var x in constructorNames) {
var name = constructorNames[x];
var expectedConstructorName = "'function " + name + "() { [native code] }'";
// Ignore these properties because they do not exist in all implementations. They will be tested separately
if (name == "WebGLRenderingContext" ||
name == "WebGLActiveInfo" ||
name == "WebGLBuffer" ||
name == "WebGLFramebuffer" ||
name == "WebGLProgram" ||
name == "WebGLRenderbuffer" ||
name == "WebGLShader" ||
name == "WebGLShaderPrecisionFormat" ||
name == "WebGLTexture" ||
name == "WebGLUniformLocation" ||
name == "ArrayBuffer" ||
name == "DataView" ||
name == "Int8Array" ||
name == "Uint8Array" ||
name == "Uint8ClampedArray" ||
name == "Int16Array" ||
name == "Uint16Array" ||
name == "Int32Array" ||
name == "Uint32Array" ||
name == "Float32Array" ||
name == "Float64Array" ||
name == "FileReader")
continue;
if (name == "XMLDocument")
// Gecko exposes an "XMLDocument" constructor, but we just use Document for XML documents instead of a custom sub-type
expectedConstructorName = "'function Document() { [native code] }'";
shouldBe("" + name + ".toString()", expectedConstructorName);
}