browser_bug1163304.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536
  1. function test() {
  2. waitForExplicitFinish();
  3. let searchBar = BrowserSearch.searchBar;
  4. searchBar.focus();
  5. let DOMWindowUtils = EventUtils._getDOMWindowUtils();
  6. is(DOMWindowUtils.IMEStatus, DOMWindowUtils.IME_STATUS_ENABLED,
  7. "IME should be available when searchbar has focus");
  8. let searchPopup = document.getElementById("PopupSearchAutoComplete");
  9. searchPopup.addEventListener("popupshown", function (aEvent) {
  10. searchPopup.removeEventListener("popupshown", arguments.callee);
  11. setTimeout(function () {
  12. is(DOMWindowUtils.IMEStatus, DOMWindowUtils.IME_STATUS_ENABLED,
  13. "IME should be available even when the popup of searchbar is open");
  14. searchPopup.addEventListener("popuphidden", function (aEvent) {
  15. searchPopup.removeEventListener("popuphidden", arguments.callee);
  16. setTimeout(function () {
  17. is(DOMWindowUtils.IMEStatus, DOMWindowUtils.IME_STATUS_DISABLED,
  18. "IME should not be available when menubar is active");
  19. // Inactivate the menubar (and restore the focus to the searchbar
  20. EventUtils.synthesizeKey("VK_ESCAPE", {});
  21. is(DOMWindowUtils.IMEStatus, DOMWindowUtils.IME_STATUS_ENABLED,
  22. "IME should be available after focus is back to the searchbar");
  23. finish();
  24. }, 0);
  25. });
  26. // Activate the menubar, then, the popup should be closed
  27. EventUtils.synthesizeKey("VK_ALT", {});
  28. }, 0);
  29. });
  30. // Open popup of the searchbar
  31. EventUtils.synthesizeKey("VK_F4", {});
  32. }