browser_bug617076.js (1867B)
1 /** 2 * 1. load about:addons in a new tab and select that tab 3 * 2. insert a button with tooltiptext 4 * 3. create a new blank tab and select that tab 5 * 4. select the about:addons tab and hover the inserted button 6 * 5. remove the about:addons tab 7 * 6. remove the blank tab 8 * 9 * the test succeeds if it doesn't trigger any assertions 10 */ 11 12 add_task(async function test() { 13 // Open the test tab 14 let testTab = await BrowserTestUtils.openNewForegroundTab( 15 gBrowser, 16 "about:addons" 17 ); 18 19 // insert button into test page content 20 await SpecialPowers.spawn(gBrowser.selectedBrowser, [], async function () { 21 let doc = content.document; 22 let e = doc.createXULElement("button"); 23 e.setAttribute("label", "hello"); 24 e.setAttribute("tooltiptext", "world"); 25 e.setAttribute("id", "test-button"); 26 doc.documentElement.insertBefore(e, doc.documentElement.firstChild); 27 }); 28 29 // open a second tab and select it 30 let tab2 = await BrowserTestUtils.openNewForegroundTab( 31 gBrowser, 32 "about:blank", 33 true 34 ); 35 gBrowser.selectedTab = tab2; 36 37 // Select the testTab then perform mouse events on inserted button 38 gBrowser.selectedTab = testTab; 39 let browser = gBrowser.selectedBrowser; 40 EventUtils.disableNonTestMouseEvents(true); 41 try { 42 await BrowserTestUtils.synthesizeMouse( 43 "#test-button", 44 1, 45 1, 46 { type: "mouseover" }, 47 browser 48 ); 49 await BrowserTestUtils.synthesizeMouse( 50 "#test-button", 51 2, 52 6, 53 { type: "mousemove" }, 54 browser 55 ); 56 await BrowserTestUtils.synthesizeMouse( 57 "#test-button", 58 2, 59 4, 60 { type: "mousemove" }, 61 browser 62 ); 63 } finally { 64 EventUtils.disableNonTestMouseEvents(false); 65 } 66 67 // cleanup 68 BrowserTestUtils.removeTab(testTab); 69 BrowserTestUtils.removeTab(tab2); 70 ok(true, "pass if no assertions"); 71 });