OLD | NEW |
| (Empty) |
1 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 c
hecks to make sure than any constructor attribute we expose has the expected con
structor type.") | |
2 | |
3 var constructorNames = []; | |
4 | |
5 for (var name in window) { | |
6 var value = window[name]; | |
7 var re = new RegExp("Constructor]$"); | |
8 var isConstructor = re.exec(value); | |
9 if (isConstructor) | |
10 constructorNames.push(name); | |
11 } | |
12 | |
13 constructorNames.sort(); | |
14 | |
15 for (var x in constructorNames) { | |
16 var name = constructorNames[x]; | |
17 var expectedConstructorName = "'[object " + name + "Constructor]'"; | |
18 | |
19 // Ignore these properties because they do not exist in all implementations.
They will be tested separately | |
20 if (name == "WebGLRenderingContext" || | |
21 name == "WebGLActiveInfo" || | |
22 name == "WebGLBuffer" || | |
23 name == "WebGLFramebuffer" || | |
24 name == "WebGLProgram" || | |
25 name == "WebGLRenderbuffer" || | |
26 name == "WebGLShader" || | |
27 name == "WebGLShaderPrecisionFormat" || | |
28 name == "WebGLTexture" || | |
29 name == "WebGLUniformLocation" || | |
30 name == "ArrayBuffer" || | |
31 name == "DataView" || | |
32 name == "Int8Array" || | |
33 name == "Uint8Array" || | |
34 name == "Uint8ClampedArray" || | |
35 name == "Int16Array" || | |
36 name == "Uint16Array" || | |
37 name == "Int32Array" || | |
38 name == "Uint32Array" || | |
39 name == "Float32Array" || | |
40 name == "Float64Array" || | |
41 name == "FileError" || | |
42 name == "FileReader" || | |
43 name == "AutocompleteErrorEvent") | |
44 continue; | |
45 | |
46 if (name == "XMLDocument") | |
47 // Gecko exposes an "XMLDocument" constructor, but we just use Document
for XML documents instead of a custom sub-type | |
48 expectedConstructorName = "'[object DocumentConstructor]'"; | |
49 | |
50 shouldBe("" + name + ".toString()", expectedConstructorName); | |
51 } | |
OLD | NEW |