Bug 932854 - Temporary test workaround for test_keycodes.xul. r=jimm, a=lsblakk
authorBenjamin Smedberg <benjamin@smedbergs.us>
Thu, 14 Nov 2013 08:23:09 -0500
changeset 167505 f3a99bcfe01b6205510c4a87e08dd9e88b6c899e
parent 167504 598daa4e76e13e1a5393d14b57c293cc458a4838
child 167506 97325de07f0086c247dcbacceb1527567f9bc242
push id428
push userbbajaj@mozilla.com
push dateTue, 28 Jan 2014 00:16:25 +0000
treeherdermozilla-release@cd72a7ff3a75 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjimm, lsblakk
bugs932854
milestone27.0a2
Bug 932854 - Temporary test workaround for test_keycodes.xul. r=jimm, a=lsblakk
widget/tests/test_keycodes.xul
--- a/widget/tests/test_keycodes.xul
+++ b/widget/tests/test_keycodes.xul
@@ -38,16 +38,34 @@
 </body>
 
 <script class="testbody" type="application/javascript">
 <![CDATA[
 
 const IS_MAC = navigator.platform.indexOf("Mac") == 0;
 const IS_WIN = navigator.platform.indexOf("Win") == 0;
 
+/**
+ * Firefox infobar UI can have access keys which conflict with this test. Really
+ * stupid workaround until we can move this test into its own chrome window.
+ */
+function clearInfobars()
+{
+  var Ci = Components.interfaces;
+
+  var browser = window.top.QueryInterface(Ci.nsIInterfaceRequestor)
+                  .getInterface(Ci.nsIWebNavigation)
+                  .QueryInterface(Ci.nsIDocShell).chromeEventHandler;
+  var chromeWin = browser.ownerDocument.defaultView;
+  var nb = chromeWin.gBrowser.getNotificationBox(browser);
+  for (let n of nb.allNotifications) {
+    nb.removeNotification(n, true);
+  }
+}
+
 function synthesizeNativeKey(aLayout, aKeyCode, aModifiers, aSystemChars,
                              aSystemUnmodifiedChars, aWindow)
 {
   if (!aWindow)
     aWindow = window;
 
   var utils = aWindow.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
                       getInterface(Components.interfaces.nsIDOMWindowUtils);
@@ -2366,16 +2384,18 @@ function runTest()
 {
   if (!IS_MAC && !IS_WIN) {
     todo(false, "This test is supported on MacOSX and Windows only. (Bug 431503)");
     return;
   }
 
   SimpleTest.waitForExplicitFinish();
 
+  clearInfobars();
+
   runKeyEventTests();
   runAccessKeyTests();
   runXULKeyTests();
   runTextInputTests();
 
   SimpleTest.finish();
 }