Thu, 15 Jan 2015 21:03:48 +0100
Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)
michael@0 | 1 | <!DOCTYPE HTML> |
michael@0 | 2 | <html> |
michael@0 | 3 | <!-- |
michael@0 | 4 | https://bugzilla.mozilla.org/show_bug.cgi?id=337631 |
michael@0 | 5 | --> |
michael@0 | 6 | <head> |
michael@0 | 7 | <title>Test for Bug 337631</title> |
michael@0 | 8 | <script type="text/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=337631">Mozilla Bug 337631</a> |
michael@0 | 13 | <p id="display"></p> |
michael@0 | 14 | <div id="content"> |
michael@0 | 15 | |
michael@0 | 16 | <a href="foo" id="test4">foo</a> |
michael@0 | 17 | <input id="test1" value="test"> |
michael@0 | 18 | <p id="test2">adsf<a href="#" id="test3">asdf</a><input id="test5"></p> |
michael@0 | 19 | |
michael@0 | 20 | </div> |
michael@0 | 21 | <pre id="test"> |
michael@0 | 22 | <script class="testbody" type="text/javascript"> |
michael@0 | 23 | |
michael@0 | 24 | /** Test for Bug 337631 **/ |
michael@0 | 25 | |
michael@0 | 26 | function getActiveElement() |
michael@0 | 27 | { |
michael@0 | 28 | var rv; |
michael@0 | 29 | |
michael@0 | 30 | var el = document.activeElement; |
michael@0 | 31 | if (!el) { |
michael@0 | 32 | rv = "none"; |
michael@0 | 33 | return rv; |
michael@0 | 34 | } |
michael@0 | 35 | |
michael@0 | 36 | if (el && el != document.documentElement) { |
michael@0 | 37 | var nt; |
michael@0 | 38 | try { |
michael@0 | 39 | nt = el.nodeType; |
michael@0 | 40 | } catch (e) { |
michael@0 | 41 | rv = "[no permission]"; |
michael@0 | 42 | return rv; |
michael@0 | 43 | } |
michael@0 | 44 | if (!nt) { |
michael@0 | 45 | rv = "[unknown]"; |
michael@0 | 46 | } else if (nt == 1) { |
michael@0 | 47 | rv = el.tagName; |
michael@0 | 48 | } else if (nt == 3) { |
michael@0 | 49 | rv = "textnode" |
michael@0 | 50 | } else { |
michael@0 | 51 | rv = nt; |
michael@0 | 52 | } |
michael@0 | 53 | |
michael@0 | 54 | el = el.parentNode; |
michael@0 | 55 | while (el && el != document.documentElement) { |
michael@0 | 56 | rv += " in "; |
michael@0 | 57 | try { |
michael@0 | 58 | nt = el.nodeType; |
michael@0 | 59 | } catch (e) { |
michael@0 | 60 | rv += "[no permission]"; |
michael@0 | 61 | return rv; |
michael@0 | 62 | } |
michael@0 | 63 | if (!nt) { |
michael@0 | 64 | rv += "[unknown]"; |
michael@0 | 65 | } else if (nt == 1) { |
michael@0 | 66 | rv += el.tagName; |
michael@0 | 67 | } else if (nt == 3) { |
michael@0 | 68 | rv += "textnode" |
michael@0 | 69 | } else { |
michael@0 | 70 | rv += nt; |
michael@0 | 71 | } |
michael@0 | 72 | |
michael@0 | 73 | el = el.parentNode; |
michael@0 | 74 | } |
michael@0 | 75 | } |
michael@0 | 76 | |
michael@0 | 77 | return rv; |
michael@0 | 78 | } |
michael@0 | 79 | |
michael@0 | 80 | $('test1').focus(); |
michael@0 | 81 | is(getActiveElement(), "INPUT in DIV in BODY", "getActiveElement tests"); |
michael@0 | 82 | |
michael@0 | 83 | $('test2').focus(); |
michael@0 | 84 | is(getActiveElement(), "INPUT in DIV in BODY", "getActiveElement tests"); |
michael@0 | 85 | |
michael@0 | 86 | $('test3').focus(); |
michael@0 | 87 | is(getActiveElement(), "A in P in DIV in BODY", "getActiveElement tests"); |
michael@0 | 88 | |
michael@0 | 89 | $('test4').focus(); |
michael@0 | 90 | is(getActiveElement(), "A in DIV in BODY", "getActiveElement tests"); |
michael@0 | 91 | |
michael@0 | 92 | $('test5').focus(); |
michael@0 | 93 | is(getActiveElement(), "INPUT in P in DIV in BODY", "getActiveElement tests"); |
michael@0 | 94 | |
michael@0 | 95 | </script> |
michael@0 | 96 | </pre> |
michael@0 | 97 | </body> |
michael@0 | 98 | </html> |
michael@0 | 99 |