Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | <!DOCTYPE HTML> |
michael@0 | 2 | <html> |
michael@0 | 3 | <!-- |
michael@0 | 4 | https://bugzilla.mozilla.org/show_bug.cgi?id=529328 |
michael@0 | 5 | --> |
michael@0 | 6 | <head> |
michael@0 | 7 | <title>Test for Bug 529328</title> |
michael@0 | 8 | <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 9 | <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> |
michael@0 | 10 | </head> |
michael@0 | 11 | <body> |
michael@0 | 12 | <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=529328">Mozilla Bug 529328</a> |
michael@0 | 13 | <p id="display"></p> |
michael@0 | 14 | <div id="content" style="display: none"> |
michael@0 | 15 | </div> |
michael@0 | 16 | <pre id="test"> |
michael@0 | 17 | <script type="application/javascript"> |
michael@0 | 18 | /** Test for Bug 529328 **/ |
michael@0 | 19 | function testDOMTokenList() { |
michael@0 | 20 | is(document.body.classList[-1], undefined, "Wrong value for out of bounds access (DOMTokenList)"); |
michael@0 | 21 | is(document.body.classList[0], undefined, "Wrong value for out of bounds access (DOMTokenList)"); |
michael@0 | 22 | is(document.body.classList[1], undefined, "Wrong value for out of bounds access (DOMTokenList)"); |
michael@0 | 23 | is(document.body.classList[2], undefined, "Wrong value for out of bounds access (DOMTokenList)"); |
michael@0 | 24 | is(document.body.classList.item(-1), null, "Wrong value for out of bounds access (DOMTokenList)"); |
michael@0 | 25 | is(document.body.classList.item(0), null, "Wrong value for out of bounds access (DOMTokenList)"); |
michael@0 | 26 | is(document.body.classList.item(1), null, "Wrong value for out of bounds access (DOMTokenList)"); |
michael@0 | 27 | is(document.body.classList.item(2), null, "Wrong value for out of bounds access (DOMTokenList)"); |
michael@0 | 28 | |
michael@0 | 29 | document.body.className = "a b"; |
michael@0 | 30 | is(document.body.classList[-1], undefined, "Wrong value for out of bounds access (DOMTokenList)"); |
michael@0 | 31 | is(document.body.classList[0], "a", "Wrong value for in bounds access (DOMTokenList)"); |
michael@0 | 32 | is(document.body.classList[1], "b", "Wrong value for in bounds access (DOMTokenList)"); |
michael@0 | 33 | is(document.body.classList[2], undefined, "Wrong value for out of bounds access (DOMTokenList)"); |
michael@0 | 34 | is(document.body.classList.item(-1), null, "Wrong value for out of bounds access (DOMTokenList)"); |
michael@0 | 35 | is(document.body.classList.item(0), "a", "Wrong value for in bounds access (DOMTokenList)"); |
michael@0 | 36 | is(document.body.classList.item(1), "b", "Wrong value for in bounds access (DOMTokenList)"); |
michael@0 | 37 | is(document.body.classList.item(2), null, "Wrong value for out of bounds access (DOMTokenList)"); |
michael@0 | 38 | } |
michael@0 | 39 | |
michael@0 | 40 | function testDOMStringList() { |
michael@0 | 41 | is(document.styleSheetSets[-1], undefined, "Wrong value for out of bounds access (DOMStringList)"); |
michael@0 | 42 | is(document.styleSheetSets[0], undefined, "Wrong value for out of bounds access (DOMStringList)"); |
michael@0 | 43 | is(document.styleSheetSets[1], undefined, "Wrong value for out of bounds access (DOMStringList)"); |
michael@0 | 44 | is(document.styleSheetSets[2], undefined, "Wrong value for out of bounds access (DOMStringList)"); |
michael@0 | 45 | is(document.styleSheetSets.item(-1), null, "Wrong value for out of bounds access (DOMStringList)"); |
michael@0 | 46 | is(document.styleSheetSets.item(0), null, "Wrong value for out of bounds access (DOMStringList)"); |
michael@0 | 47 | is(document.styleSheetSets.item(1), null, "Wrong value for out of bounds access (DOMStringList)"); |
michael@0 | 48 | is(document.styleSheetSets.item(2), null, "Wrong value for out of bounds access (DOMStringList)"); |
michael@0 | 49 | |
michael@0 | 50 | var s = document.createElement("style"); |
michael@0 | 51 | s.title = "a"; |
michael@0 | 52 | document.head.appendChild(s); |
michael@0 | 53 | s = document.createElement("style"); |
michael@0 | 54 | s.title = "b"; |
michael@0 | 55 | document.head.appendChild(s); |
michael@0 | 56 | |
michael@0 | 57 | is(document.styleSheetSets[-1], undefined, "Wrong value for out of bounds access (DOMStringList)"); |
michael@0 | 58 | is(document.styleSheetSets[0], "a", "Wrong value for in bounds access (DOMStringList)"); |
michael@0 | 59 | is(document.styleSheetSets[1], "b", "Wrong value for in bounds access (DOMStringList)"); |
michael@0 | 60 | is(document.styleSheetSets[2], undefined, "Wrong value for out of bounds access (DOMStringList)"); |
michael@0 | 61 | is(document.styleSheetSets.item(-1), null, "Wrong value for out of bounds access (DOMStringList)"); |
michael@0 | 62 | is(document.styleSheetSets.item(0), "a", "Wrong value for in bounds access (DOMStringList)"); |
michael@0 | 63 | is(document.styleSheetSets.item(1), "b", "Wrong value for in bounds access (DOMStringList)"); |
michael@0 | 64 | is(document.styleSheetSets.item(2), null, "Wrong value for out of bounds access (DOMStringList)"); |
michael@0 | 65 | } |
michael@0 | 66 | |
michael@0 | 67 | function testMediaList() { |
michael@0 | 68 | var s = document.createElement("style"); |
michael@0 | 69 | document.head.appendChild(s); |
michael@0 | 70 | is(s.sheet.media[-1], undefined, "Wrong value for out of bounds access (MediaList)"); |
michael@0 | 71 | is(s.sheet.media[0], undefined, "Wrong value for out of bounds access (MediaList)"); |
michael@0 | 72 | is(s.sheet.media[1], undefined, "Wrong value for out of bounds access (MediaList)"); |
michael@0 | 73 | is(s.sheet.media[2], undefined, "Wrong value for out of bounds access (MediaList) (MediaList)"); |
michael@0 | 74 | is(s.sheet.media.item(-1), null, "Wrong value for out of bounds access (MediaList)"); |
michael@0 | 75 | is(s.sheet.media.item(0), null, "Wrong value for out of bounds access (MediaList)"); |
michael@0 | 76 | is(s.sheet.media.item(1), null, "Wrong value for out of bounds access (MediaList)"); |
michael@0 | 77 | is(s.sheet.media.item(2), null, "Wrong value for out of bounds access (MediaList) (MediaList)"); |
michael@0 | 78 | |
michael@0 | 79 | s.setAttribute("media", "a, b"); |
michael@0 | 80 | |
michael@0 | 81 | is(s.sheet.media[-1], undefined, "Wrong value for out of bounds access (MediaList)"); |
michael@0 | 82 | is(s.sheet.media[0], "a", "Wrong value for in bounds access (MediaList)"); |
michael@0 | 83 | is(s.sheet.media[1], "b", "Wrong value for in bounds access (MediaList)"); |
michael@0 | 84 | is(s.sheet.media[2], undefined, "Wrong value for out of bounds access (MediaList) (MediaList)"); |
michael@0 | 85 | is(s.sheet.media.item(-1), null, "Wrong value for out of bounds access (MediaList)"); |
michael@0 | 86 | is(s.sheet.media.item(0), "a", "Wrong value for in bounds access (MediaList)"); |
michael@0 | 87 | is(s.sheet.media.item(1), "b", "Wrong value for in bounds access (MediaList)"); |
michael@0 | 88 | is(s.sheet.media.item(2), null, "Wrong value for out of bounds access (MediaList) (MediaList)"); |
michael@0 | 89 | } |
michael@0 | 90 | |
michael@0 | 91 | function testCSSStyleDeclaration() { |
michael@0 | 92 | var s = document.createElement("span"); |
michael@0 | 93 | |
michael@0 | 94 | is(s.style[-1], undefined, "Wrong value for out of bounds access (CSSStyleDeclaration)"); |
michael@0 | 95 | is(s.style[0], undefined, "Wrong value for out of bounds access (CSSStyleDeclaration)"); |
michael@0 | 96 | is(s.style[1], undefined, "Wrong value for out of bounds access (CSSStyleDeclaration)"); |
michael@0 | 97 | is(s.style[2], undefined, "Wrong value for out of bounds access (CSSStyleDeclaration)"); |
michael@0 | 98 | is(s.style.item(-1), "", "Wrong value for out of bounds access (CSSStyleDeclaration)"); |
michael@0 | 99 | is(s.style.item(0), "", "Wrong value for out of bounds access (CSSStyleDeclaration)"); |
michael@0 | 100 | is(s.style.item(1), "", "Wrong value for out of bounds access (CSSStyleDeclaration)"); |
michael@0 | 101 | is(s.style.item(2), "", "Wrong value for out of bounds access (CSSStyleDeclaration)"); |
michael@0 | 102 | |
michael@0 | 103 | s.setAttribute("style", "color: blue; z-index: 42;"); |
michael@0 | 104 | |
michael@0 | 105 | is(s.style[-1], undefined, "Wrong value for out of bounds access (CSSStyleDeclaration)"); |
michael@0 | 106 | is(s.style[0], "color", "Wrong value for in bounds access (CSSStyleDeclaration)"); |
michael@0 | 107 | is(s.style[1], "z-index", "Wrong value for in bounds access (CSSStyleDeclaration)"); |
michael@0 | 108 | is(s.style[2], undefined, "Wrong value for out of bounds access (CSSStyleDeclaration)"); |
michael@0 | 109 | is(s.style.item(-1), "", "Wrong value for out of bounds access (CSSStyleDeclaration)"); |
michael@0 | 110 | is(s.style.item(0), "color", "Wrong value for in bounds access (CSSStyleDeclaration)"); |
michael@0 | 111 | is(s.style.item(1), "z-index", "Wrong value for in bounds access (CSSStyleDeclaration)"); |
michael@0 | 112 | is(s.style.item(2), "", "Wrong value for out of bounds access (CSSStyleDeclaration)"); |
michael@0 | 113 | } |
michael@0 | 114 | |
michael@0 | 115 | testDOMTokenList(); |
michael@0 | 116 | testDOMStringList(); |
michael@0 | 117 | testMediaList(); |
michael@0 | 118 | testCSSStyleDeclaration(); |
michael@0 | 119 | </script> |
michael@0 | 120 | </pre> |
michael@0 | 121 | </body> |
michael@0 | 122 | </html> |