OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <title>Historical DOM features must be removed</title> |
| 3 <script src="../../../resources/testharness.js"></script> |
| 4 <script src="../../../resources/testharnessreport.js"></script> |
| 5 <div id=log></div> |
| 6 <script> |
| 7 function isInterfaceNuked(name) { |
| 8 test(function() { |
| 9 assert_equals(window[name], undefined) |
| 10 }, "Historical DOM features must be removed: " + name) |
| 11 } |
| 12 var nukedInterfaces = [ |
| 13 "CDATASection", |
| 14 "DOMConfiguration", |
| 15 "DOMError", |
| 16 "DOMErrorHandler", |
| 17 "DOMImplementationList", |
| 18 "DOMImplementationSource", |
| 19 "DOMLocator", |
| 20 "DOMObject", |
| 21 "DOMUserData", |
| 22 "Entity", |
| 23 "EntityReference", |
| 24 "EventException", // DOM Events |
| 25 "NameList", |
| 26 "Notation", |
| 27 "TypeInfo", |
| 28 "UserDataHandler", |
| 29 "RangeException" // DOM Range |
| 30 ] |
| 31 nukedInterfaces.forEach(isInterfaceNuked) |
| 32 |
| 33 function isNukedFromDocument(name) { |
| 34 test(function() { |
| 35 var doc = document.implementation.createDocument(null,null,null) |
| 36 assert_equals(document[name], undefined) |
| 37 assert_equals(doc[name], undefined) |
| 38 }, "Historical DOM features must be removed: " + name) |
| 39 } |
| 40 var documentNuked = [ |
| 41 "createCDATASection", |
| 42 "createEntityReference", |
| 43 "xmlEncoding", |
| 44 "xmlStandalone", |
| 45 "xmlVersion", |
| 46 "strictErrorChecking", |
| 47 "domConfig", |
| 48 "normalizeDocument", |
| 49 "renameNode", |
| 50 "defaultCharset", |
| 51 "height", |
| 52 "width" |
| 53 ] |
| 54 documentNuked.forEach(isNukedFromDocument) |
| 55 |
| 56 test(function() { |
| 57 assert_equals(document.implementation["getFeature"], undefined) |
| 58 }, "DOMImplementation.getFeature() must be nuked.") |
| 59 |
| 60 function isNukedFromElement(name) { |
| 61 test(function() { |
| 62 var ele = document.createElementNS("test", "test") |
| 63 assert_equals(document.body[name], undefined) |
| 64 assert_equals(ele[name], undefined) |
| 65 }, "Historical DOM features must be removed: " + name) |
| 66 } |
| 67 var elementNuked = [ |
| 68 "schemaTypeInfo", |
| 69 "setIdAttribute", |
| 70 "setIdAttributeNS", |
| 71 "setIdAttributeNode" |
| 72 ] |
| 73 elementNuked.forEach(isNukedFromElement) |
| 74 |
| 75 function isNukedFromDoctype(name) { |
| 76 test(function() { |
| 77 var doctype = document.implementation.createDocumentType("test", "", "") |
| 78 assert_equals(doctype[name], undefined) |
| 79 }, "DocumentType member must be nuked: " + name) |
| 80 } |
| 81 var doctypeNuked = [ |
| 82 "entities", |
| 83 "notations", |
| 84 "internalSubset" |
| 85 ] |
| 86 doctypeNuked.forEach(isNukedFromDoctype) |
| 87 |
| 88 function isNukedFromText(name) { |
| 89 test(function() { |
| 90 var text = document.createTextNode("test") |
| 91 assert_equals(text[name], undefined) |
| 92 }, "Text member must be nuked: " + name) |
| 93 } |
| 94 var textNuked = [ |
| 95 "isElementContentWhitespace", |
| 96 "replaceWholeText" |
| 97 ] |
| 98 textNuked.forEach(isNukedFromText) |
| 99 |
| 100 function isNukedFromNode(name) { |
| 101 test(function() { |
| 102 var doc = document.implementation.createDocument(null,null,null) |
| 103 var doctype = document.implementation.createDocumentType("test", "", "") |
| 104 var text = document.createTextNode("test") |
| 105 assert_equals(doc[name], undefined) |
| 106 assert_equals(doctype[name], undefined) |
| 107 assert_equals(text[name], undefined) |
| 108 }, "Node member must be nuked: " + name) |
| 109 } |
| 110 var nodeNuked = [ |
| 111 "hasAttributes", |
| 112 "attributes", |
| 113 "namespaceURI", |
| 114 "prefix", |
| 115 "localName", |
| 116 "isSupported", |
| 117 "getFeature", |
| 118 "getUserData", |
| 119 "setUserData" |
| 120 ] |
| 121 nodeNuked.forEach(isNukedFromNode) |
| 122 |
| 123 function isNukedFromWindow(name) { |
| 124 test(function() { |
| 125 assert_equals(window[name], undefined) |
| 126 }, "Window member must be nuked: " + name) |
| 127 } |
| 128 var windowNuked = [ |
| 129 "attachEvent" |
| 130 ] |
| 131 windowNuked.forEach(isNukedFromWindow) |
| 132 </script> |
OLD | NEW |