OLD | NEW |
| (Empty) |
1 <html> | |
2 <head></head> | |
3 <body> | |
4 | |
5 <p>This test checks that all but a handful of dom constructors throw | |
6 exceptions, and the rest return reasonable objects</p> | |
7 | |
8 <script> | |
9 if (window.layoutTestController) layoutTestController.dumpAsText(); | |
10 | |
11 var nodes = [ | |
12 'Attr', 'CharacterData', 'CDATASection', 'Comment', 'Document', | |
13 'DocumentFragment', 'DocumentType', 'Element', 'Entity', | |
14 'EntityReference', 'EventTargetNode', 'HTMLDocument', 'Node', | |
15 'Notation', 'ProcessingInstruction', 'Text', 'HTMLAnchorElement', | |
16 'HTMLAppletElement', 'HTMLAreaElement', 'HTMLBaseElement', | |
17 'HTMLBaseFontElement', 'HTMLBlockquoteElement', 'HTMLBodyElement', | |
18 'HTMLBRElement', 'HTMLButtonElement', 'HTMLCanvasElement', | |
19 'HTMLDirectoryElement', 'HTMLDivElement', 'HTMLDListElement', | |
20 'HTMLEmbedElement', 'HTMLFieldSetElement', 'HTMLFontElement', | |
21 'HTMLFormElement', 'HTMLFrameElement', 'HTMLFrameSetElement', | |
22 'HTMLHeadingElement', 'HTMLHeadElement', 'HTMLHRElement', | |
23 'HTMLHtmlElement', 'HTMLIFrameElement', 'HTMLImageElement', | |
24 'HTMLInputElement', 'HTMLIsIndexElement', 'HTMLLabelElement', | |
25 'HTMLLegendElement', 'HTMLLIElement', 'HTMLLinkElement', | |
26 'HTMLMapElement', 'HTMLMarqueeElement', 'HTMLMenuElement', | |
27 'HTMLMetaElement', 'HTMLModElement', 'HTMLObjectElement', | |
28 'HTMLOListElement', 'HTMLOptGroupElement', 'HTMLOptionElement', | |
29 'HTMLParagraphElement', 'HTMLParamElement', 'HTMLPreElement', | |
30 'HTMLQuoteElement', 'HTMLScriptElement', 'HTMLSelectElement', | |
31 'HTMLStyleElement', 'HTMLTableCaptionElement', | |
32 'HTMLTableColElement', 'HTMLTableElement', | |
33 'HTMLTableSectionElement', 'HTMLTableCellElement', | |
34 'HTMLTableRowElement', 'HTMLTextAreaElement', 'HTMLTitleElement', | |
35 'HTMLUListElement', 'HTMLElement', 'BarInfo', 'CanvasGradient', | |
36 'CanvasPattern', 'CanvasRenderingContext2D', 'Clipboard', 'Console', | |
37 'Counter', 'CSSCharsetRule', 'CSSFontFaceRule', 'CSSImportRule', | |
38 'CSSMediaRule', 'CSSPageRule', 'CSSPrimitiveValue', 'CSSRule', | |
39 'CSSRuleList', 'CSSStyleDeclaration', 'CSSStyleRule', | |
40 'CSSStyleSheet', 'CSSValue', 'CSSValueList', 'DOMImplementation', | |
41 'DOMParser', 'DOMSelection', 'DOMWindow', 'Event', 'History', | |
42 'UndetectableHTMLCollection', 'HTMLCollection', | |
43 'HTMLOptionsCollection', 'InspectorController', 'KeyboardEvent', | |
44 'Location', 'MediaList', 'MimeType', 'MimeTypeArray', 'MouseEvent', | |
45 'MutationEvent', 'NamedNodeMap', 'Navigator', 'NodeFilter', | |
46 'NodeIterator', 'NodeList', 'OverflowEvent', 'Plugin', | |
47 'PluginArray', 'Range', 'Rect', 'RGBColor', 'Screen', 'StyleSheet', | |
48 'StyleSheetList', 'TextEvent', 'TreeWalker', 'UIEvent', | |
49 'WheelEvent', 'XMLHttpRequest', 'XMLSerializer', | |
50 'XPathEvaluator', 'XPathExpression', 'XPathNSResolver', | |
51 'XPathResult', 'XSLTProcessor', 'EventTarget', 'EventListener', | |
52 'NPObject', 'Console' | |
53 ]; | |
54 | |
55 function TryAllocate(node) { | |
56 var Cons = this[node]; | |
57 if (!Cons) return 'no constructor'; | |
58 try { return new Cons(); } | |
59 catch (e) { return 'exception'; } | |
60 } | |
61 | |
62 for (var i = 0; i < nodes.length; i++) { | |
63 var node = nodes[i]; | |
64 document.write(node + ': ' + TryAllocate(node) + '</br>'); | |
65 } | |
66 | |
67 </script> | |
68 </body> | |
69 </html> | |
OLD | NEW |