test_bug1175913.html (2866B)
1 <html> 2 3 <head> 4 <title>Test hide/show events on event listener changes</title> 5 <link rel="stylesheet" type="text/css" 6 href="chrome://mochikit/content/tests/SimpleTest/test.css" /> 7 8 <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> 9 10 <script type="application/javascript" 11 src="../common.js"></script> 12 <script type="application/javascript" 13 src="../role.js"></script> 14 <script type="application/javascript" 15 src="../events.js"></script> 16 17 <script type="application/javascript"> 18 19 function dummyListener() {} 20 21 function testAddListener() { 22 this.eventSeq = [ 23 new invokerChecker(EVENT_SHOW, getNode("parent")), 24 ]; 25 26 this.invoke = function testAddListener_invoke() { 27 is(getAccessible("parent", null, null, DONOTFAIL_IF_NO_ACC), null, "Check that parent is not accessible."); 28 is(getAccessible("child", null, null, DONOTFAIL_IF_NO_ACC), null, "Check that child is not accessible."); 29 getNode("parent").addEventListener("click", dummyListener); 30 }; 31 32 this.finalCheck = function testAddListener_finalCheck() { 33 var tree = { TEXT: [] }; 34 testAccessibleTree("parent", tree); 35 }; 36 37 this.getID = function testAddListener_getID() { 38 return "Test that show event is sent when click listener is added"; 39 }; 40 } 41 42 function testRemoveListener() { 43 this.eventSeq = [ 44 new unexpectedInvokerChecker(EVENT_HIDE, getNode("parent")), 45 ]; 46 47 this.invoke = function testRemoveListener_invoke() { 48 getNode("parent").removeEventListener("click", dummyListener); 49 }; 50 51 this.finalCheck = function testRemoveListener_finalCheck() { 52 ok(getAccessible("parent", null, null, DONOTFAIL_IF_NO_ACC), 53 "Parent stays accessible after click event listener is removed"); 54 ok(!getAccessible("child", null, null, DONOTFAIL_IF_NO_ACC), 55 "Child stays inaccessible"); 56 }; 57 58 this.getID = function testRemoveListener_getID() { 59 return "Test that hide event is sent when click listener is removed"; 60 }; 61 } 62 63 var gQueue = null; 64 function doTest() { 65 gQueue = new eventQueue(); 66 gQueue.push(new testAddListener()); 67 gQueue.push(new testRemoveListener()); 68 gQueue.invoke(); // SimpleTest.finish(); 69 } 70 71 SimpleTest.waitForExplicitFinish(); 72 addA11yLoadEvent(doTest); 73 </script> 74 75 </head> 76 77 <body> 78 79 <a target="_blank" 80 href="https://bugzilla.mozilla.org/show_bug.cgi?id=1175913" 81 title="Crash in mozilla::a11y::DocAccessibleParent::RemoveAccessible(ProxyAccessible* aAccessible)"> 82 Mozilla Bug 1175913 83 </a> 84 <p id="display"></p> 85 <div id="content" style="display: none"></div> 86 <pre id="test"> 87 </pre> 88 89 <span id="parent"> 90 <span id="child"> 91 </span> 92 </span> 93 94 </body> 95 </html>