Bug 1436926 - part 2: Remove unnecessary KeyboardEvent.code specification of callers of EventUtils.synthesizeKey() r=smaug
authorMasayuki Nakano <masayuki@d-toybox.com>
Fri, 09 Feb 2018 19:17:26 +0900
changeset 448202 b1aba58ebcddae563f4b949d357c9193b2d78897
parent 448201 b6768ec01e5a081fe99ba1d005f61d36571b5847
child 448203 c7b77328d11f9d840067b1dd680bc828893a4735
push id137
push userfmarier@mozilla.com
push dateThu, 15 Feb 2018 20:52:22 +0000
reviewerssmaug
bugs1436926, 551434
milestone60.0a1
Bug 1436926 - part 2: Remove unnecessary KeyboardEvent.code specification of callers of EventUtils.synthesizeKey() r=smaug Now, callers of EventUtils.synthesizeKey() don't need to specify KeyboardEvent.code value anymore if they assume that active keyboard layout is US keyboard layout. Note that this patch changes the meaning of only test_bug551434.html. Some callers in it don't match the key value and code value but that looks like that they don't checking such odd keyboard events. So, they must be bug of the test. MozReview-Commit-ID: Itxo7yZ9rkK
browser/base/content/test/forms/browser_selectpopup.js
browser/base/content/test/forms/browser_selectpopup_colors.js
browser/base/content/test/forms/head.js
browser/base/content/test/general/browser_bug1261299.js
browser/base/content/test/general/browser_clipboard.js
browser/base/content/test/permissions/browser_reservedkey.js
browser/base/content/test/urlbar/browser_urlbarAddonIframe.js
browser/components/customizableui/test/browser_panel_keyboard_navigation.js
browser/components/places/tests/browser/browser_stayopenmenu.js
browser/components/sessionstore/test/browser_formdata.js
browser/extensions/formautofill/test/mochitest/formautofill_common.js
browser/extensions/formautofill/test/mochitest/test_autofocus_form.html
browser/extensions/formautofill/test/mochitest/test_basic_autocomplete_form.html
browser/extensions/formautofill/test/mochitest/test_basic_creditcard_autocomplete_form.html
browser/extensions/formautofill/test/mochitest/test_clear_form.html
browser/extensions/formautofill/test/mochitest/test_creditcard_autocomplete_off.html
browser/extensions/formautofill/test/mochitest/test_form_changes.html
browser/extensions/formautofill/test/mochitest/test_formautofill_preview_highlight.html
browser/extensions/formautofill/test/mochitest/test_multi_locale_CA_address_form.html
browser/extensions/formautofill/test/mochitest/test_multiple_forms.html
browser/extensions/formautofill/test/mochitest/test_on_address_submission.html
devtools/client/responsive.html/test/browser/browser_device_width.js
devtools/client/shared/test/browser_treeWidget_keyboard_interaction.js
dom/events/test/browser_shortcutkey_modifier_conflicts_with_content_accesskey_modifier.js
dom/events/test/test_bug226361.xhtml
dom/events/test/test_bug238987.html
dom/events/test/test_bug409604.html
dom/events/test/test_bug450876.html
dom/events/test/test_bug493251.html
dom/events/test/test_bug545268.html
dom/events/test/window_bug1369072.html
dom/html/test/forms/test_formnovalidate_attribute.html
dom/html/test/forms/test_input_event.html
dom/html/test/forms/test_novalidate_attribute.html
dom/html/test/test_bug1295719_event_sequence_for_arrow_keys.html
dom/html/test/test_bug561636.html
dom/tests/browser/browser_bug1316330.js
editor/libeditor/tests/test_bug1315065.html
editor/libeditor/tests/test_bug1316302.html
editor/libeditor/tests/test_bug1318312.html
editor/libeditor/tests/test_bug1330796.html
editor/libeditor/tests/test_bug1385905.html
editor/libeditor/tests/test_bug1390562.html
editor/libeditor/tests/test_bug1397412.xul
editor/libeditor/tests/test_inline_style_cache.html
layout/base/tests/chrome/test_bug551434.html
layout/forms/test/test_bug348236.html
layout/forms/test/test_bug402198.html
layout/forms/test/test_bug411236.html
layout/forms/test/test_bug935876.html
layout/style/test/test_flexbox_focus_order.html
toolkit/components/extensions/test/mochitest/test_chrome_ext_downloads_open.html
toolkit/components/extensions/test/mochitest/test_chrome_ext_permissions.html
toolkit/components/passwordmgr/test/chrome/subtst_privbrowsing_4.html
toolkit/components/passwordmgr/test/mochitest/test_autocomplete_https_upgrade.html
toolkit/components/passwordmgr/test/mochitest/test_autofocus_js.html
toolkit/components/passwordmgr/test/mochitest/test_basic_form_autocomplete.html
toolkit/components/passwordmgr/test/mochitest/test_case_differences.html
toolkit/components/passwordmgr/test/mochitest/test_insecure_form_field_autocomplete.html
toolkit/components/passwordmgr/test/mochitest/test_insecure_form_field_no_saved_login.html
toolkit/components/passwordmgr/test/mochitest/test_password_field_autocomplete.html
toolkit/components/prompts/test/chromeScript.js
toolkit/components/satchel/test/test_bug_511615.html
toolkit/components/satchel/test/test_bug_787624.html
toolkit/components/satchel/test/test_datalist_with_caching.html
toolkit/components/satchel/test/test_form_autocomplete.html
toolkit/components/satchel/test/test_form_autocomplete_with_list.html
toolkit/components/satchel/test/test_password_autocomplete.html
toolkit/components/satchel/test/test_popup_direction.html
toolkit/components/satchel/test/test_popup_enter_event.html
toolkit/content/tests/chrome/test_richlist_direction.xul
toolkit/content/tests/mochitest/test_bug1407085.html
toolkit/mozapps/extensions/test/browser/browser_file_xpi_no_process_switch.js
widget/tests/window_composition_text_querycontent.xul
--- a/browser/base/content/test/forms/browser_selectpopup.js
+++ b/browser/base/content/test/forms/browser_selectpopup.js
@@ -100,17 +100,17 @@ function openSelectPopup(selectPopup, mo
       mousePromise = BrowserTestUtils.synthesizeMouseAtCenter(selector, { }, win.gBrowser.selectedBrowser);
     } else {
       mousePromise = BrowserTestUtils.synthesizeMouse(selector, 5, 5, { type: "mousedown" }, win.gBrowser.selectedBrowser);
     }
 
     return Promise.all([popupShownPromise, mousePromise]);
   }
 
-  EventUtils.synthesizeKey("KEY_ArrowDown", { altKey: true, code: "ArrowDown" }, win);
+  EventUtils.synthesizeKey("KEY_ArrowDown", {altKey: true}, win);
   return popupShownPromise;
 }
 
 function getInputEvents() {
   return ContentTask.spawn(gBrowser.selectedBrowser, {}, function() {
     return content.wrappedJSObject.gInputEvents;
   });
 }
@@ -139,36 +139,36 @@ async function doSelectTests(contentType
   let isWindows = navigator.platform.includes("Win");
 
   is(menulist.selectedIndex, 1, "Initial selection");
   is(selectPopup.firstChild.localName, "menucaption", "optgroup is caption");
   is(selectPopup.firstChild.getAttribute("label"), "First Group", "optgroup label");
   is(selectPopup.childNodes[1].localName, "menuitem", "option is menuitem");
   is(selectPopup.childNodes[1].getAttribute("label"), "One", "option label");
 
-  EventUtils.synthesizeKey("KEY_ArrowDown", { code: "ArrowDown" });
+  EventUtils.synthesizeKey("KEY_ArrowDown", {});
   is(menulist.menuBoxObject.activeChild, menulist.getItemAtIndex(2), "Select item 2");
   is(menulist.selectedIndex, isWindows ? 2 : 1, "Select item 2 selectedIndex");
 
-  EventUtils.synthesizeKey("KEY_ArrowDown", { code: "ArrowDown" });
+  EventUtils.synthesizeKey("KEY_ArrowDown", {});
   is(menulist.menuBoxObject.activeChild, menulist.getItemAtIndex(3), "Select item 3");
   is(menulist.selectedIndex, isWindows ? 3 : 1, "Select item 3 selectedIndex");
 
-  EventUtils.synthesizeKey("KEY_ArrowDown", { code: "ArrowDown" });
+  EventUtils.synthesizeKey("KEY_ArrowDown", {});
 
   // On Windows, one can navigate on disabled menuitems
   is(menulist.menuBoxObject.activeChild, menulist.getItemAtIndex(9),
      "Skip optgroup header and disabled items select item 7");
   is(menulist.selectedIndex, isWindows ? 9 : 1, "Select or skip disabled item selectedIndex");
 
   for (let i = 0; i < 10; i++) {
     is(menulist.getItemAtIndex(i).disabled, i >= 4 && i <= 7, "item " + i + " disabled");
   }
 
-  EventUtils.synthesizeKey("KEY_ArrowUp", { code: "ArrowUp" });
+  EventUtils.synthesizeKey("KEY_ArrowUp", {});
   is(menulist.menuBoxObject.activeChild, menulist.getItemAtIndex(3), "Select item 3 again");
   is(menulist.selectedIndex, isWindows ? 3 : 1, "Select item 3 selectedIndex");
 
   is((await getInputEvents()), 0, "Before closed - number of input events");
   is((await getChangeEvents()), 0, "Before closed - number of change events");
   is((await getClickEvents()), 0, "Before closed - number of click events");
 
   EventUtils.synthesizeKey("a", { accelKey: true });
@@ -200,17 +200,17 @@ async function doSelectTests(contentType
   is((await getClickEvents()), 1, "Open and close with no change - number of click events");
   EventUtils.synthesizeKey("VK_TAB", { });
   EventUtils.synthesizeKey("VK_TAB", { shiftKey: true });
   is((await getInputEvents()), 1, "Tab away from select with no change - number of input events");
   is((await getChangeEvents()), 1, "Tab away from select with no change - number of change events");
   is((await getClickEvents()), 1, "Tab away from select with no change - number of click events");
 
   await openSelectPopup(selectPopup, "click");
-  EventUtils.synthesizeKey("KEY_ArrowDown", { code: "ArrowDown" });
+  EventUtils.synthesizeKey("KEY_ArrowDown", {});
   await hideSelectPopup(selectPopup, "escape");
   is((await getInputEvents()), isWindows ? 2 : 1, "Open and close with change - number of input events");
   is((await getChangeEvents()), isWindows ? 2 : 1, "Open and close with change - number of change events");
   is((await getClickEvents()), 2, "Open and close with change - number of click events");
   EventUtils.synthesizeKey("VK_TAB", { });
   EventUtils.synthesizeKey("VK_TAB", { shiftKey: true });
   is((await getInputEvents()), isWindows ? 2 : 1, "Tab away from select with change - number of input events");
   is((await getChangeEvents()), isWindows ? 2 : 1, "Tab away from select with change - number of change events");
@@ -430,17 +430,17 @@ add_task(async function test_event_order
 
           let select = content.document.getElementById(contentMode == "enter" ? "one" : "two");
           for (let event of ["input", "change", "mousedown", "mouseup", "click"]) {
             select.addEventListener(event, onEvent);
           }
         });
       });
 
-      EventUtils.synthesizeKey("KEY_ArrowDown", { code: "ArrowDown" });
+      EventUtils.synthesizeKey("KEY_ArrowDown", {});
       await hideSelectPopup(selectPopup, mode);
       await eventsPromise;
     }
   });
 });
 
 async function performLargePopupTests(win) {
   let browser = win.gBrowser.selectedBrowser;
--- a/browser/base/content/test/forms/browser_selectpopup_colors.js
+++ b/browser/base/content/test/forms/browser_selectpopup_colors.js
@@ -198,17 +198,17 @@ function testOptionColors(index, item, m
     if (color.toLowerCase().includes("color") &&
         !expected[color].startsWith("rgb")) {
       expected[color] = getSystemColor(expected[color]);
     }
   }
 
   // Press Down to move the selected item to the next item in the
   // list and check the colors of this item when it's not selected.
-  EventUtils.synthesizeKey("KEY_ArrowDown", { code: "ArrowDown" });
+  EventUtils.synthesizeKey("KEY_ArrowDown", {});
 
   if (expected.end) {
     return;
   }
 
   if (expected.unstyled) {
     ok(!item.hasAttribute("customoptionstyling"),
       `Item ${index} should not have any custom option styling`);
--- a/browser/base/content/test/forms/head.js
+++ b/browser/base/content/test/forms/head.js
@@ -1,17 +1,17 @@
 function hideSelectPopup(selectPopup, mode = "enter", win = window) {
   let browser = win.gBrowser.selectedBrowser;
   let selectClosedPromise = ContentTask.spawn(browser, null, async function() {
     ChromeUtils.import("resource://gre/modules/SelectContentHelper.jsm");
     return ContentTaskUtils.waitForCondition(() => !SelectContentHelper.open);
   });
 
   if (mode == "escape") {
-    EventUtils.synthesizeKey("KEY_Escape", { code: "Escape" }, win);
+    EventUtils.synthesizeKey("KEY_Escape", {}, win);
   } else if (mode == "enter") {
-    EventUtils.synthesizeKey("KEY_Enter", { code: "Enter" }, win);
+    EventUtils.synthesizeKey("KEY_Enter", {}, win);
   } else if (mode == "click") {
     EventUtils.synthesizeMouseAtCenter(selectPopup.lastChild, { }, win);
   }
 
   return selectClosedPromise;
 }
--- a/browser/base/content/test/general/browser_bug1261299.js
+++ b/browser/base/content/test/general/browser_bug1261299.js
@@ -14,24 +14,24 @@ add_task(async function test_content_and
     "data:text/html," +
     '<textarea id="textarea">Write something here</textarea>';
   let DOMWindowUtils = EventUtils._getDOMWindowUtils(window);
   let selectedText;
 
   let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, testPage);
   await BrowserTestUtils.synthesizeMouse("#textarea", 0, 0, {}, gBrowser.selectedBrowser);
   await BrowserTestUtils.synthesizeKey("KEY_ArrowRight",
-      {shiftKey: true, ctrlKey: true, code: "ArrowRight"}, gBrowser.selectedBrowser);
+      {shiftKey: true, ctrlKey: true}, gBrowser.selectedBrowser);
   selectedText = DOMWindowUtils.GetSelectionAsPlaintext();
   is(selectedText, "Write something here", "The macOS services got the selected content text");
 
   gURLBar.value = "test.mozilla.org";
   await gURLBar.focus();
   await BrowserTestUtils.synthesizeKey("KEY_ArrowRight",
-      {shiftKey: true, ctrlKey: true, code: "ArrowRight"}, gBrowser.selectedBrowser);
+      {shiftKey: true, ctrlKey: true}, gBrowser.selectedBrowser);
   selectedText = DOMWindowUtils.GetSelectionAsPlaintext();
   is(selectedText, "test.mozilla.org", "The macOS services got the selected chrome text");
 
   await BrowserTestUtils.removeTab(tab);
 });
 
 // Test switching active selection.
 // Each tab has a content selection and when you switch to that tab, its selection becomes
@@ -46,22 +46,22 @@ add_task(async function test_active_sele
     "data:text/html," +
     '<textarea id="textarea">Nothing available</textarea>';
   let DOMWindowUtils = EventUtils._getDOMWindowUtils(window);
   let selectedText;
 
   let tab1 = await BrowserTestUtils.openNewForegroundTab(gBrowser, testPage1);
   await BrowserTestUtils.synthesizeMouse("#textarea", 0, 0, {}, gBrowser.selectedBrowser);
   await BrowserTestUtils.synthesizeKey("KEY_ArrowRight",
-      {shiftKey: true, ctrlKey: true, code: "ArrowRight"}, gBrowser.selectedBrowser);
+      {shiftKey: true, ctrlKey: true}, gBrowser.selectedBrowser);
 
   let tab2 = await BrowserTestUtils.openNewForegroundTab(gBrowser, testPage2);
   await BrowserTestUtils.synthesizeMouse("#textarea", 0, 0, {}, gBrowser.selectedBrowser);
   await BrowserTestUtils.synthesizeKey("KEY_ArrowRight",
-      {shiftKey: true, ctrlKey: true, code: "ArrowRight"}, gBrowser.selectedBrowser);
+      {shiftKey: true, ctrlKey: true}, gBrowser.selectedBrowser);
 
   await BrowserTestUtils.switchTab(gBrowser, tab1);
   selectedText = DOMWindowUtils.GetSelectionAsPlaintext();
   is(selectedText, "Write something here", "The macOS services got the selected content text");
 
   await BrowserTestUtils.switchTab(gBrowser, tab2);
   selectedText = DOMWindowUtils.GetSelectionAsPlaintext();
   is(selectedText, "Nothing available", "The macOS services got the selected content text");
--- a/browser/base/content/test/general/browser_clipboard.js
+++ b/browser/base/content/test/general/browser_clipboard.js
@@ -49,17 +49,17 @@ add_task(async function() {
     await new Promise((resolve, reject) => {
       addEventListener("copy", function copyEvent(event) {
         removeEventListener("copy", copyEvent, true);
         // The data is empty as the selection is copied during the event default phase.
         Assert.equal(event.clipboardData.mozItemCount, 0, "Zero items on clipboard");
         resolve();
       }, true);
 
-      sendAsyncMessage("Test:SendKey", { key: "c", code: "KeyC" });
+      sendAsyncMessage("Test:SendKey", {key: "c"});
     });
 
     selection.modify("move", "right", "line");
 
     await new Promise((resolve, reject) => {
       addEventListener("paste", function copyEvent(event) {
         removeEventListener("paste", copyEvent, true);
         let clipboardData = event.clipboardData;
@@ -68,17 +68,17 @@ add_task(async function() {
         Assert.equal(clipboardData.types[0], "text/html", "text/html on clipboard");
         Assert.equal(clipboardData.types[1], "text/plain", "text/plain on clipboard");
         Assert.equal(clipboardData.getData("text/html"), arg.htmlPrefix +
           "t <b>Bold</b>" + arg.htmlPostfix, "text/html value");
         Assert.equal(clipboardData.getData("text/plain"), "t Bold", "text/plain value");
         resolve();
       }, true);
 
-      sendAsyncMessage("Test:SendKey", {key: "v", code: "KeyV"});
+      sendAsyncMessage("Test:SendKey", {key: "v"});
     });
 
     Assert.equal(main.innerHTML, "Test <b>Bold</b> After Textt <b>Bold</b>", "Copy and paste html");
 
     selection.modify("extend", "left", "word");
     selection.modify("extend", "left", "word");
     selection.modify("extend", "left", "character");
 
@@ -87,17 +87,17 @@ add_task(async function() {
         removeEventListener("cut", copyEvent, true);
         event.clipboardData.setData("text/plain", "Some text");
         event.clipboardData.setData("text/html", "<i>Italic</i> ");
         selection.deleteFromDocument();
         event.preventDefault();
         resolve();
       }, true);
 
-      sendAsyncMessage("Test:SendKey", {key: "x", code: "KeyX"});
+      sendAsyncMessage("Test:SendKey", {key: "x"});
     });
 
     selection.modify("move", "left", "line");
 
     await new Promise((resolve, reject) => {
       addEventListener("paste", function copyEvent(event) {
         removeEventListener("paste", copyEvent, true);
         let clipboardData = event.clipboardData;
@@ -106,17 +106,17 @@ add_task(async function() {
         Assert.equal(clipboardData.types[0], "text/html", "text/html on clipboard 2");
         Assert.equal(clipboardData.types[1], "text/plain", "text/plain on clipboard 2");
         Assert.equal(clipboardData.getData("text/html"), arg.htmlPrefix +
           "<i>Italic</i> " + arg.htmlPostfix, "text/html value 2");
         Assert.equal(clipboardData.getData("text/plain"), "Some text", "text/plain value 2");
         resolve();
       }, true);
 
-      sendAsyncMessage("Test:SendKey", {key: "v", code: "KeyV"});
+      sendAsyncMessage("Test:SendKey", {key: "v"});
     });
 
     Assert.equal(main.innerHTML, "<i>Italic</i> Test <b>Bold</b> After<b></b>",
       "Copy and paste html 2");
   });
 
   // Next, check that the Copy Image command works.
 
@@ -150,17 +150,17 @@ add_task(async function() {
         if (clipboardData.getData("text/html") !== arg.htmlPrefix +
             '<img id="img" tabindex="1" src="http://example.org/browser/browser/base/content/test/general/moz.png">' +
             arg.htmlPostfix) {
           reject("Clipboard Data did not contain an image, was " + clipboardData.getData("text/html"));
         }
         resolve();
       }, true);
 
-      sendAsyncMessage("Test:SendKey", {key: "v", code: "KeyV"});
+      sendAsyncMessage("Test:SendKey", {key: "v"});
     });
 
     // The new content should now include an image.
     Assert.equal(main.innerHTML, '<i>Italic</i> <img id="img" tabindex="1" ' +
       'src="http://example.org/browser/browser/base/content/test/general/moz.png">' +
       "Test <b>Bold</b> After<b></b>", "Paste after copy image");
   });
 
--- a/browser/base/content/test/permissions/browser_reservedkey.js
+++ b/browser/base/content/test/permissions/browser_reservedkey.js
@@ -72,17 +72,17 @@ if (!navigator.platform.includes("Mac"))
     let menubar = document.getElementById("main-menubar");
     let menubarActive = BrowserTestUtils.waitForEvent(menubar, "DOMMenuBarActive");
     EventUtils.sendKey("F10");
     await menubarActive;
 
     let filePopup = document.getElementById("menu_FilePopup");
     popupShown = BrowserTestUtils.waitForEvent(filePopup, "popupshown");
     if (navigator.platform.includes("Win")) {
-      EventUtils.synthesizeKey("KEY_ArrowDown", { code: "ArrowDown" });
+      EventUtils.synthesizeKey("KEY_ArrowDown", {});
     }
     await popupShown;
 
     ok(true, "File menu opened");
 
     popupHidden = BrowserTestUtils.waitForEvent(filePopup, "popuphidden");
     filePopup.hidePopup();
     await popupHidden;
--- a/browser/base/content/test/urlbar/browser_urlbarAddonIframe.js
+++ b/browser/base/content/test/urlbar/browser_urlbarAddonIframe.js
@@ -117,20 +117,17 @@ add_task(async function() {
   Assert.equal(result.type, "action searchengine heuristic", "result.type");
   Assert.equal(result.text, value, "result.text");
 
   // keydown event.  promiseEvent sends an async message to the iframe, but
   // synthesizeKey is sync, so we need to wait until the content JS receives
   // the message and adds its event listener before synthesizing the key.
   let keydownPromises = promiseEvent("keydown");
   await keydownPromises[0];
-  EventUtils.synthesizeKey("KEY_ArrowDown", {
-    type: "keydown",
-    code: "ArrowDown",
-  });
+  EventUtils.synthesizeKey("KEY_ArrowDown", {type: "keydown"});
   await keydownPromises[1];
 
   // urlbar.getPanelHeight
   let height = iframe.getBoundingClientRect().height;
   let readHeight = await promiseUrlbarFunctionCall("getPanelHeight");
   Assert.equal(readHeight, height, "getPanelHeight");
 
   // urlbar.setPanelHeight
--- a/browser/components/customizableui/test/browser_panel_keyboard_navigation.js
+++ b/browser/components/customizableui/test/browser_panel_keyboard_navigation.js
@@ -12,30 +12,30 @@ add_task(async function testUpDownKeys()
   PanelUI.show();
   await promise;
 
   let buttons = PanelView.forNode(PanelUI.mainView).getNavigableElements();
 
   for (let button of buttons) {
     if (button.disabled)
       continue;
-    EventUtils.synthesizeKey("KEY_ArrowDown", { code: "ArrowDown" });
+    EventUtils.synthesizeKey("KEY_ArrowDown", {});
     Assert.equal(document.commandDispatcher.focusedElement, button,
       "The correct button should be focused after navigating downward");
   }
 
-  EventUtils.synthesizeKey("KEY_ArrowDown", { code: "ArrowDown" });
+  EventUtils.synthesizeKey("KEY_ArrowDown", {});
   Assert.equal(document.commandDispatcher.focusedElement, buttons[0],
     "Pressing upwards should cycle around and select the first button again");
 
   for (let i = buttons.length - 1; i >= 0; --i) {
     let button = buttons[i];
     if (button.disabled)
       continue;
-    EventUtils.synthesizeKey("KEY_ArrowUp", { code: "ArrowUp" });
+    EventUtils.synthesizeKey("KEY_ArrowUp", {});
     Assert.equal(document.commandDispatcher.focusedElement, button,
       "The first button should be focused after navigating upward");
   }
 
   promise = promisePanelHidden(window);
   PanelUI.hide();
   await promise;
 });
@@ -43,94 +43,94 @@ add_task(async function testUpDownKeys()
 add_task(async function testEnterKeyBehaviors() {
   let promise = promisePanelShown(window);
   PanelUI.show();
   await promise;
 
   let buttons = PanelView.forNode(PanelUI.mainView).getNavigableElements();
 
   // Navigate to the 'Help' button, which points to a subview.
-  EventUtils.synthesizeKey("KEY_ArrowUp", { code: "ArrowUp" });
+  EventUtils.synthesizeKey("KEY_ArrowUp", {});
   let focusedElement = document.commandDispatcher.focusedElement;
   Assert.equal(focusedElement, buttons[buttons.length - 1],
     "The last button should be focused after navigating upward");
 
   promise = BrowserTestUtils.waitForEvent(PanelUI.helpView, "ViewShown");
   // Make sure the Help button is in focus.
   while (!focusedElement || !focusedElement.id || focusedElement.id != kHelpButtonId) {
-    EventUtils.synthesizeKey("KEY_ArrowUp", { code: "ArrowUp" });
+    EventUtils.synthesizeKey("KEY_ArrowUp", {});
     focusedElement = document.commandDispatcher.focusedElement;
   }
-  EventUtils.synthesizeKey("VK_RETURN", { code: "Enter" });
+  EventUtils.synthesizeKey("KEY_Enter", {});
   await promise;
 
   let helpButtons = PanelView.forNode(PanelUI.helpView).getNavigableElements();
   Assert.ok(helpButtons[0].classList.contains("subviewbutton-back"),
     "First button in help view should be a back button");
 
   // For posterity, check navigating the subview using up/ down arrow keys as well.
   for (let i = helpButtons.length - 1; i >= 0; --i) {
     let button = helpButtons[i];
     if (button.disabled)
       continue;
-    EventUtils.synthesizeKey("KEY_ArrowUp", { code: "ArrowUp" });
+    EventUtils.synthesizeKey("KEY_ArrowUp", {});
     focusedElement = document.commandDispatcher.focusedElement;
     Assert.equal(focusedElement, button, "The first button should be focused after navigating upward");
   }
 
   // Make sure the back button is in focus again.
   while (focusedElement != helpButtons[0]) {
-    EventUtils.synthesizeKey("KEY_ArrowDown", { code: "ArrowDown" });
+    EventUtils.synthesizeKey("KEY_ArrowDown", {});
     focusedElement = document.commandDispatcher.focusedElement;
   }
 
   // The first button is the back button. Hittin Enter should navigate us back.
   promise = BrowserTestUtils.waitForEvent(PanelUI.mainView, "ViewShown");
-  EventUtils.synthesizeKey("VK_RETURN", { code: "Enter" });
+  EventUtils.synthesizeKey("KEY_Enter", {});
   await promise;
 
   // Let's test a 'normal' command button.
   focusedElement = document.commandDispatcher.focusedElement;
   const kFindButtonId = "appMenu-find-button";
   while (!focusedElement || !focusedElement.id || focusedElement.id != kFindButtonId) {
-    EventUtils.synthesizeKey("KEY_ArrowUp", { code: "ArrowUp" });
+    EventUtils.synthesizeKey("KEY_ArrowUp", {});
     focusedElement = document.commandDispatcher.focusedElement;
   }
   Assert.equal(focusedElement.id, kFindButtonId, "Find button should be selected");
 
   promise = promisePanelHidden(window);
-  EventUtils.synthesizeKey("VK_RETURN", { code: "Enter" });
+  EventUtils.synthesizeKey("KEY_Enter", {});
   await promise;
 
   Assert.ok(!gFindBar.hidden, "Findbar should have opened");
   gFindBar.close();
 });
 
 add_task(async function testLeftRightKeys() {
   let promise = promisePanelShown(window);
   PanelUI.show();
   await promise;
 
   // Navigate to the 'Help' button, which points to a subview.
   let focusedElement = document.commandDispatcher.focusedElement;
   while (!focusedElement || !focusedElement.id || focusedElement.id != kHelpButtonId) {
-    EventUtils.synthesizeKey("KEY_ArrowUp", { code: "ArrowUp" });
+    EventUtils.synthesizeKey("KEY_ArrowUp", {});
     focusedElement = document.commandDispatcher.focusedElement;
   }
   Assert.equal(focusedElement.id, kHelpButtonId, "The last button should be focused after navigating upward");
 
   // Hitting ArrowRight on a button that points to a subview should navigate us
   // there.
   promise = BrowserTestUtils.waitForEvent(PanelUI.helpView, "ViewShown");
-  EventUtils.synthesizeKey("KEY_ArrowRight", { code: "ArrowRight" });
+  EventUtils.synthesizeKey("KEY_ArrowRight", {});
   await promise;
 
   // Hitting ArrowLeft should navigate us back.
   promise = BrowserTestUtils.waitForEvent(PanelUI.mainView, "ViewShown");
-  EventUtils.synthesizeKey("KEY_ArrowLeft", { code: "ArrowLeft" });
+  EventUtils.synthesizeKey("KEY_ArrowLeft", {});
   await promise;
 
   focusedElement = document.commandDispatcher.focusedElement;
   Assert.equal(focusedElement.id, kHelpButtonId,
                "Help button should be focused again now that we're back in the main view");
 
   promise = promisePanelHidden(window);
   PanelUI.hide();
@@ -142,35 +142,35 @@ add_task(async function testTabKey() {
   PanelUI.show();
   await promise;
 
   let buttons = PanelView.forNode(PanelUI.mainView).getNavigableElements();
 
   for (let button of buttons) {
     if (button.disabled)
       continue;
-    EventUtils.synthesizeKey("KEY_Tab", { code: "Tab" });
+    EventUtils.synthesizeKey("KEY_Tab", {});
     Assert.equal(document.commandDispatcher.focusedElement, button,
       "The correct button should be focused after tabbing");
   }
 
-  EventUtils.synthesizeKey("KEY_Tab", { code: "Tab" });
+  EventUtils.synthesizeKey("KEY_Tab", {});
   Assert.equal(document.commandDispatcher.focusedElement, buttons[0],
     "Pressing tab should cycle around and select the first button again");
 
   for (let i = buttons.length - 1; i >= 0; --i) {
     let button = buttons[i];
     if (button.disabled)
       continue;
-    EventUtils.synthesizeKey("Tab", { code: "Tab", shiftKey: true });
+    EventUtils.synthesizeKey("Tab", {shiftKey: true});
     Assert.equal(document.commandDispatcher.focusedElement, button,
       "The correct button should be focused after shift + tabbing");
   }
 
-  EventUtils.synthesizeKey("KEY_Tab", { code: "Tab", shiftKey: true });
+  EventUtils.synthesizeKey("KEY_Tab", {shiftKey: true});
   Assert.equal(document.commandDispatcher.focusedElement, buttons[buttons.length - 1],
     "Pressing shift + tab should cycle around and select the last button again");
 
   promise = promisePanelHidden(window);
   PanelUI.hide();
   await promise;
 });
 
@@ -181,19 +181,19 @@ add_task(async function testInterleavedT
 
   let buttons = PanelView.forNode(PanelUI.mainView).getNavigableElements();
   let tab = false;
 
   for (let button of buttons) {
     if (button.disabled)
       continue;
     if (tab) {
-      EventUtils.synthesizeKey("KEY_Tab", { code: "Tab" });
+      EventUtils.synthesizeKey("KEY_Tab", {});
     } else {
-      EventUtils.synthesizeKey("KEY_ArrowDown", { code: "ArrowDown" });
+      EventUtils.synthesizeKey("KEY_ArrowDown", {});
     }
     tab = !tab;
   }
 
   Assert.equal(document.commandDispatcher.focusedElement, buttons[buttons.length - 1],
     "The last button should be focused after a mix of Tab and ArrowDown");
 
   promise = promisePanelHidden(window);
@@ -207,27 +207,27 @@ add_task(async function testSpaceDownAft
   await promise;
 
   let buttons = PanelView.forNode(PanelUI.mainView).getNavigableElements();
   let button;
 
   for (button of buttons) {
     if (button.disabled)
       continue;
-    EventUtils.synthesizeKey("KEY_Tab", { code: "Tab" });
+    EventUtils.synthesizeKey("KEY_Tab", {});
     if (button.id == kHelpButtonId) {
       break;
     }
   }
 
   Assert.equal(document.commandDispatcher.focusedElement, button,
                "Help button should be focused after tabbing to it.");
 
   // Pressing down space on a button that points to a subview should navigate us
   // there, before keyup.
   promise = BrowserTestUtils.waitForEvent(PanelUI.helpView, "ViewShown");
-  EventUtils.synthesizeKey(" ", { code: "Space", type: "keydown" });
+  EventUtils.synthesizeKey(" ", {type: "keydown"});
   await promise;
 
   promise = promisePanelHidden(window);
   PanelUI.hide();
   await promise;
 });
--- a/browser/components/places/tests/browser/browser_stayopenmenu.js
+++ b/browser/components/places/tests/browser/browser_stayopenmenu.js
@@ -17,19 +17,19 @@ async function locateBookmarkAndTestCtrl
 
 async function testContextmenu(menuitem) {
   let doc = menuitem.ownerDocument;
   let cm = doc.getElementById("placesContext");
   let promiseEvent = BrowserTestUtils.waitForEvent(cm, "popupshown");
   EventUtils.synthesizeMouseAtCenter(menuitem, {type: "contextmenu", button: 2});
   await promiseEvent;
   let promiseTabOpened = BrowserTestUtils.waitForNewTab(gBrowser, null);
-  EventUtils.synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+  EventUtils.synthesizeKey("KEY_ArrowDown", {});
   BrowserTestUtils.waitForEvent(menuitem, "DOMMenuItemActive");
-  EventUtils.synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+  EventUtils.synthesizeKey("KEY_ArrowDown", {});
   BrowserTestUtils.waitForEvent(menuitem, "DOMMenuItemActive");
   EventUtils.sendKey("return");
   let newTab = await promiseTabOpened;
   return newTab;
 }
 
 add_task(async function test_setup() {
   // Ensure BMB is available in UI.
--- a/browser/components/sessionstore/test/browser_formdata.js
+++ b/browser/components/sessionstore/test/browser_formdata.js
@@ -109,17 +109,17 @@ add_task(async function test_nested() {
   };
 
   // Create a tab with an iframe containing an input field.
   let tab = gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser, URL);
   let browser = tab.linkedBrowser;
   await promiseBrowserLoaded(browser);
 
   // Modify the input field's value.
-  await BrowserTestUtils.synthesizeKey("m", {code: "KeyM"}, browser);
+  await BrowserTestUtils.synthesizeKey("m", {}, browser);
 
   // Remove the tab and check that we stored form data correctly.
   await promiseRemoveTab(tab);
   let [{state: {formdata}}] = JSON.parse(ss.getClosedTabData(window));
   is(JSON.stringify(formdata), JSON.stringify(FORM_DATA),
     "formdata for iframe stored correctly");
 
   // Restore the closed tab.
@@ -146,17 +146,17 @@ add_task(async function test_design_mode
               "<script>document.designMode='on'</script>";
 
   // Load a tab with an editable document.
   let tab = gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser, URL);
   let browser = tab.linkedBrowser;
   await promiseBrowserLoaded(browser);
 
   // Modify the document content.
-  await BrowserTestUtils.synthesizeKey("m", {code: "KeyM"}, browser);
+  await BrowserTestUtils.synthesizeKey("m", {}, browser);
 
   // Close and restore the tab.
   await promiseRemoveTab(tab);
   tab = ss.undoCloseTab(window, 0);
   browser = tab.linkedBrowser;
   await promiseTabRestored(tab);
 
   // Check that the innerHTML value was restored.
--- a/browser/extensions/formautofill/test/mochitest/formautofill_common.js
+++ b/browser/extensions/formautofill/test/mochitest/formautofill_common.js
@@ -114,17 +114,17 @@ function triggerAutofillAndCheckProfile(
     const checkFieldAutofilled = Promise.all([
       new Promise(resolve => element.addEventListener("input", resolve, {once: true})),
       new Promise(resolve => element.addEventListener(expectingEvent, resolve, {once: true})),
     ]).then(() => checkFieldValue(element, value));
 
     promises.push(checkFieldAutofilled);
   }
   // Press Enter key and trigger form autofill.
-  synthesizeKey("KEY_Enter", {code: "Enter"});
+  synthesizeKey("KEY_Enter", {});
 
   return Promise.all(promises);
 }
 
 async function onStorageChanged(type) {
   info(`expecting the storage changed: ${type}`);
   return new Promise(resolve => {
     formFillChromeScript.addMessageListener("formautofill-storage-changed", function onChanged(data) {
@@ -238,20 +238,20 @@ function popupShownListener() {
 }
 
 function initPopupListener() {
   registerPopupShownListener(popupShownListener);
 }
 
 async function triggerPopupAndHoverItem(fieldSelector, selectIndex) {
   await focusAndWaitForFieldsIdentified(fieldSelector);
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+  synthesizeKey("KEY_ArrowDown", {});
   await expectPopup();
   for (let i = 0; i <= selectIndex; i++) {
-    synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+    synthesizeKey("KEY_ArrowDown", {});
   }
   await notifySelectedIndex(selectIndex);
 }
 
 function formAutoFillCommonSetup() {
   let chromeURL = SimpleTest.getTestFileURL("formautofill_parent_utils.js");
   formFillChromeScript = SpecialPowers.loadChromeScript(chromeURL);
   formFillChromeScript.addMessageListener("onpopupshown", ({results}) => {
--- a/browser/extensions/formautofill/test/mochitest/test_autofocus_form.html
+++ b/browser/extensions/formautofill/test/mochitest/test_autofocus_form.html
@@ -34,17 +34,17 @@ initPopupListener();
 
 async function setupAddressStorage() {
   await addAddress(MOCK_STORAGE[0]);
   await addAddress(MOCK_STORAGE[1]);
 }
 
 add_task(async function check_autocomplete_on_autofocus_field() {
   await setupAddressStorage();
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+  synthesizeKey("KEY_ArrowDown", {});
   await expectPopup();
   checkMenuEntries(MOCK_STORAGE.map(address =>
     JSON.stringify({primary: address.organization, secondary: address["street-address"]})
   ));
 });
 
 </script>
 
--- a/browser/extensions/formautofill/test/mochitest/test_basic_autocomplete_form.html
+++ b/browser/extensions/formautofill/test/mochitest/test_basic_autocomplete_form.html
@@ -49,134 +49,134 @@ async function setupFormHistory() {
 
 initPopupListener();
 
 // Form with history only.
 add_task(async function history_only_menu_checking() {
   await setupFormHistory();
 
   await setInput("#tel", "");
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+  synthesizeKey("KEY_ArrowDown", {});
   await expectPopup();
   checkMenuEntries(["+1234567890"], false);
 });
 
 // Display history search result if less than 3 inputs are covered by all saved
 // fields in the storage.
 add_task(async function all_saved_fields_less_than_threshold() {
   await addAddress({
     email: "test@test.com",
   });
 
   await setInput("#email", "");
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+  synthesizeKey("KEY_ArrowDown", {});
   await expectPopup();
   checkMenuEntries(["foo@mozilla.com"], false);
 
   await cleanUpAddresses();
 });
 
 // Form with both history and address storage.
 add_task(async function check_menu_when_both_existed() {
   await setupAddressStorage();
 
   await setInput("#organization", "");
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+  synthesizeKey("KEY_ArrowDown", {});
   await expectPopup();
   checkMenuEntries(MOCK_STORAGE.map(address =>
     JSON.stringify({
       primary: address.organization,
       secondary: FormAutofillUtils.toOneLineAddress(address["street-address"]),
     })
   ));
 
   await setInput("#street-address", "");
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+  synthesizeKey("KEY_ArrowDown", {});
   await expectPopup();
   checkMenuEntries(MOCK_STORAGE.map(address =>
     JSON.stringify({
       primary: FormAutofillUtils.toOneLineAddress(address["street-address"]),
       secondary: address.organization,
     })
   ));
 
   await setInput("#tel", "");
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+  synthesizeKey("KEY_ArrowDown", {});
   await expectPopup();
   checkMenuEntries(MOCK_STORAGE.map(address =>
     JSON.stringify({
       primary: address.tel,
       secondary: FormAutofillUtils.toOneLineAddress(address["street-address"]),
     })
   ));
 
   await setInput("#address-line1", "");
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+  synthesizeKey("KEY_ArrowDown", {});
   await expectPopup();
   checkMenuEntries(MOCK_STORAGE.map(address =>
     JSON.stringify({
       primary: FormAutofillUtils.toOneLineAddress(address["street-address"]),
       secondary: address.organization,
     })
   ));
 });
 
 // Display history search result if no matched data in addresses.
 add_task(async function check_fallback_for_mismatched_field() {
   await setInput("#email", "");
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+  synthesizeKey("KEY_ArrowDown", {});
   await expectPopup();
   checkMenuEntries(["foo@mozilla.com"], false);
 });
 
 // Display history search result if address autofill is disabled.
 add_task(async function check_search_result_for_pref_off() {
   await SpecialPowers.pushPrefEnv({
     set: [["extensions.formautofill.addresses.enabled", false]],
   });
 
   await setInput("#tel", "");
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+  synthesizeKey("KEY_ArrowDown", {});
   await expectPopup();
   checkMenuEntries(["+1234567890"], false);
 
   await SpecialPowers.popPrefEnv();
 });
 
 // Autofill the address from dropdown menu.
 add_task(async function check_fields_after_form_autofill() {
   const focusedInput = await setInput("#organization", "Moz");
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+  synthesizeKey("KEY_ArrowDown", {});
   await expectPopup();
   checkMenuEntries(MOCK_STORAGE.map(address =>
     JSON.stringify({
       primary: address.organization,
       secondary: FormAutofillUtils.toOneLineAddress(address["street-address"]),
     })
   ).slice(1));
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+  synthesizeKey("KEY_ArrowDown", {});
   await triggerAutofillAndCheckProfile(MOCK_STORAGE[1]);
-  synthesizeKey("KEY_Escape", {code: "Escape"});
+  synthesizeKey("KEY_Escape", {});
   is(focusedInput.value, "Mozilla", "Filled field shouldn't be reverted by ESC key");
 });
 
 // Fallback to history search after autofill address.
 add_task(async function check_fallback_after_form_autofill() {
   await setInput("#tel", "", true);
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+  synthesizeKey("KEY_ArrowDown", {});
   await expectPopup();
   checkMenuEntries(["+1234567890"], false);
 });
 
 // Resume form autofill once all the autofilled fileds are changed.
 add_task(async function check_form_autofill_resume() {
   document.querySelector("#tel").blur();
   document.querySelector("#form1").reset();
   await setInput("#tel", "");
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+  synthesizeKey("KEY_ArrowDown", {});
   await expectPopup();
   checkMenuEntries(MOCK_STORAGE.map(address =>
     JSON.stringify({
       primary: address.tel,
       secondary: FormAutofillUtils.toOneLineAddress(address["street-address"]),
     })
   ));
 });
--- a/browser/extensions/formautofill/test/mochitest/test_basic_creditcard_autocomplete_form.html
+++ b/browser/extensions/formautofill/test/mochitest/test_basic_creditcard_autocomplete_form.html
@@ -57,134 +57,134 @@ add_task(async function history_only_men
   // timing to start.
   //
   // After test process was re-spawning to https scheme. Wait 2 secs
   // to ensure the environment is ready to do storage setup.
   await sleep(2000);
   await setupFormHistory();
 
   await setInput("#cc-exp-year", "");
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+  synthesizeKey("KEY_ArrowDown", {});
   await expectPopup();
   checkMenuEntries(["2023"], false);
 });
 
 // Display credit card result even if the number of fillable fields is less than the threshold.
 add_task(async function all_saved_fields_less_than_threshold() {
   await addCreditCard(reducedMockRecord);
 
   await setInput("#cc-name", "");
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+  synthesizeKey("KEY_ArrowDown", {});
   await expectPopup();
   checkMenuEntries([reducedMockRecord].map(patchRecordCCNumber).map(cc => JSON.stringify({
     primary: cc["cc-name"],
     secondary: cc.ccNumberFmt.affix + cc.ccNumberFmt.label,
   })));
 
   await cleanUpCreditCards();
 });
 
 // Form with both history and credit card storage.
 add_task(async function check_menu_when_both_existed() {
   await setupCreditCardStorage();
 
   await setInput("#cc-number", "");
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+  synthesizeKey("KEY_ArrowDown", {});
   await expectPopup();
   checkMenuEntries(MOCK_STORAGE.map(patchRecordCCNumber).map(cc => JSON.stringify({
     primaryAffix: cc.ccNumberFmt.affix,
     primary: cc.ccNumberFmt.label,
     secondary: cc["cc-name"],
   })));
 
   await setInput("#cc-name", "");
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+  synthesizeKey("KEY_ArrowDown", {});
   await expectPopup();
   checkMenuEntries(MOCK_STORAGE.map(patchRecordCCNumber).map(cc => JSON.stringify({
     primary: cc["cc-name"],
     secondary: cc.ccNumberFmt.affix + cc.ccNumberFmt.label,
   })));
 
   await setInput("#cc-exp-year", "");
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+  synthesizeKey("KEY_ArrowDown", {});
   await expectPopup();
   checkMenuEntries(MOCK_STORAGE.map(patchRecordCCNumber).map(cc => JSON.stringify({
     primary: cc["cc-exp-year"],
     secondary: cc.ccNumberFmt.affix + cc.ccNumberFmt.label,
   })));
 
   await setInput("#cc-exp-month", "");
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+  synthesizeKey("KEY_ArrowDown", {});
   await expectPopup();
   checkMenuEntries(MOCK_STORAGE.map(patchRecordCCNumber).map(cc => JSON.stringify({
     primary: cc["cc-exp-month"],
     secondary: cc.ccNumberFmt.affix + cc.ccNumberFmt.label,
   })));
 
   await cleanUpCreditCards();
 });
 
 // Display history search result if no matched data in credit card.
 add_task(async function check_fallback_for_mismatched_field() {
   await addCreditCard(reducedMockRecord);
 
   await setInput("#cc-exp-year", "");
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+  synthesizeKey("KEY_ArrowDown", {});
   await expectPopup();
   checkMenuEntries(["2023"], false);
 
   await cleanUpCreditCards();
 });
 
 // Display history search result if credit card autofill is disabled.
 add_task(async function check_search_result_for_pref_off() {
   await setupCreditCardStorage();
 
   await SpecialPowers.pushPrefEnv({
     set: [["extensions.formautofill.creditCards.enabled", false]],
   });
 
   await setInput("#cc-name", "");
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+  synthesizeKey("KEY_ArrowDown", {});
   await expectPopup();
   checkMenuEntries(["John Smith"], false);
 
   await SpecialPowers.popPrefEnv();
 });
 
 // Autofill the credit card from dropdown menu.
 add_task(async function check_fields_after_form_autofill() {
   await setInput("#cc-exp-year", 202);
 
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+  synthesizeKey("KEY_ArrowDown", {});
   await expectPopup();
   checkMenuEntries(MOCK_STORAGE.slice(1).map(patchRecordCCNumber).map(cc => JSON.stringify({
     primary: cc["cc-exp-year"],
     secondary: cc.ccNumberFmt.affix + cc.ccNumberFmt.label,
   })));
 
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+  synthesizeKey("KEY_ArrowDown", {});
   await triggerAutofillAndCheckProfile(MOCK_STORAGE[1]);
 });
 
 // Fallback to history search after autofill address.
 add_task(async function check_fallback_after_form_autofill() {
   await setInput("#cc-name", "", true);
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+  synthesizeKey("KEY_ArrowDown", {});
   await expectPopup();
   checkMenuEntries(["John Smith"], false);
 });
 
 // Resume form autofill once all the autofilled fileds are changed.
 add_task(async function check_form_autofill_resume() {
   document.querySelector("#cc-name").blur();
   document.querySelector("#form1").reset();
 
   await setInput("#cc-name", "");
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+  synthesizeKey("KEY_ArrowDown", {});
   await expectPopup();
   checkMenuEntries(MOCK_STORAGE.map(patchRecordCCNumber).map(cc => JSON.stringify({
     primary: cc["cc-name"],
     secondary: cc.ccNumberFmt.affix + cc.ccNumberFmt.label,
   })));
 });
 
 </script>
--- a/browser/extensions/formautofill/test/mochitest/test_clear_form.html
+++ b/browser/extensions/formautofill/test/mochitest/test_clear_form.html
@@ -66,61 +66,61 @@ function checkIsFormCleared(patch = {}) 
   }
 }
 
 add_task(async function simple_clear() {
   await triggerPopupAndHoverItem("#organization", 0);
   await triggerAutofillAndCheckProfile(MOCK_ADDR_STORAGE[0]);
 
   await triggerPopupAndHoverItem("#tel", 0);
-  synthesizeKey("KEY_Enter", {code: "Enter"});
+  synthesizeKey("KEY_Enter", {});
   checkIsFormCleared();
 });
 
 add_task(async function clear_adapted_record() {
   await triggerPopupAndHoverItem("#street-address", 0);
   await triggerAutofillAndCheckProfile(MOCK_ADDR_STORAGE[0]);
 
   await triggerPopupAndHoverItem("#street-address", 0);
-  synthesizeKey("KEY_Enter", {code: "Enter"});
+  synthesizeKey("KEY_Enter", {});
   checkIsFormCleared();
 });
 
 add_task(async function clear_modified_form() {
   await triggerPopupAndHoverItem("#organization", 0);
   await triggerAutofillAndCheckProfile(MOCK_ADDR_STORAGE[0]);
 
   await setInput("#tel", "+1111111111", true);
 
   await triggerPopupAndHoverItem("#street-address", 0);
-  synthesizeKey("KEY_Enter", {code: "Enter"});
+  synthesizeKey("KEY_Enter", {});
   checkIsFormCleared({tel: "+1111111111"});
 });
 
 add_task(async function clear_distinct_section() {
   document.getElementById("form1").reset();
   await triggerPopupAndHoverItem("#cc-name", 0);
   await triggerAutofillAndCheckProfile(MOCK_CC_STORAGE[0]);
 
   await triggerPopupAndHoverItem("#organization", 0);
   await triggerAutofillAndCheckProfile(MOCK_ADDR_STORAGE[0]);
   await triggerPopupAndHoverItem("#street-address", 0);
-  synthesizeKey("KEY_Enter", {code: "Enter"});
+  synthesizeKey("KEY_Enter", {});
 
   for (const [id, val] of Object.entries(MOCK_CC_STORAGE[0])) {
     const element = document.getElementById(id);
     if (!element) {
       return;
     }
     checkFieldValue(element, val);
     checkFieldHighlighted(element, true);
   }
 
   await triggerPopupAndHoverItem("#cc-name", 0);
-  synthesizeKey("KEY_Enter", {code: "Enter"});
+  synthesizeKey("KEY_Enter", {});
   checkIsFormCleared();
 });
 
 </script>
 
 <p id="display"></p>
 
 <div id="content">
--- a/browser/extensions/formautofill/test/mochitest/test_creditcard_autocomplete_off.html
+++ b/browser/extensions/formautofill/test/mochitest/test_creditcard_autocomplete_off.html
@@ -46,40 +46,40 @@ async function setupFormHistory() {
 
 initPopupListener();
 
 // Show Form History popup for non-autocomplete="off" field only
 add_task(async function history_only_menu_checking() {
   await setupFormHistory();
 
   await setInput("#cc-number", "");
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+  synthesizeKey("KEY_ArrowDown", {});
   await expectPopup();
   checkMenuEntries(["1234000056780000"], false);
 
   await setInput("#cc-name", "");
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+  synthesizeKey("KEY_ArrowDown", {});
   await notExpectPopup();
 });
 
 // Show Form Autofill popup for the credit card fields.
 add_task(async function check_menu_when_both_with_autocomplete_off() {
   await setupCreditCardStorage();
 
   await setInput("#cc-number", "");
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+  synthesizeKey("KEY_ArrowDown", {});
   await expectPopup();
   checkMenuEntries(MOCK_STORAGE.map(patchRecordCCNumber).map(cc => JSON.stringify({
     primaryAffix: cc.ccNumberFmt.affix,
     primary: cc.ccNumberFmt.label,
     secondary: cc["cc-name"],
   })));
 
   await setInput("#cc-name", "");
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+  synthesizeKey("KEY_ArrowDown", {});
   await expectPopup();
   checkMenuEntries(MOCK_STORAGE.map(patchRecordCCNumber).map(cc => JSON.stringify({
     primary: cc["cc-name"],
     secondary: cc.ccNumberFmt.affix + cc.ccNumberFmt.label,
   })));
 });
 
 </script>
--- a/browser/extensions/formautofill/test/mochitest/test_form_changes.html
+++ b/browser/extensions/formautofill/test/mochitest/test_form_changes.html
@@ -45,38 +45,38 @@ function addInputField(form, className) 
   newElem.autocomplete = className;
   newElem.type = "text";
   form.appendChild(newElem);
 }
 
 async function checkFormChangeHappened(formId) {
   info("expecting form changed");
   await focusAndWaitForFieldsIdentified(`#${formId} input[name=tel]`);
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+  synthesizeKey("KEY_ArrowDown", {});
   await expectPopup();
   checkMenuEntries(MOCK_STORAGE.map(address =>
     JSON.stringify({primary: address.tel, secondary: address.name})
   ));
 
   // This is for checking the changes of element count.
   addInputField(document.querySelector(`#${formId}`), "address-level2");
 
   await focusAndWaitForFieldsIdentified(`#${formId} input[name=name]`);
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+  synthesizeKey("KEY_ArrowDown", {});
   await expectPopup();
   checkMenuEntries(MOCK_STORAGE.map(address =>
     JSON.stringify({primary: address.name, secondary: address["address-level2"]})
   ));
 
   // This is for checking the changes of element removed and added then.
   document.querySelector(`#${formId} input[name=address-level2]`).remove();
   addInputField(document.querySelector(`#${formId}`), "address-level2");
 
   await focusAndWaitForFieldsIdentified(`#${formId} input[name=address-level2]`, true);
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+  synthesizeKey("KEY_ArrowDown", {});
   await expectPopup();
   checkMenuEntries(MOCK_STORAGE.map(address =>
     JSON.stringify({primary: address["address-level2"], secondary: address.name})
   ));
 }
 
 add_task(async function init_storage() {
   await setupAddressStorage();
--- a/browser/extensions/formautofill/test/mochitest/test_formautofill_preview_highlight.html
+++ b/browser/extensions/formautofill/test/mochitest/test_formautofill_preview_highlight.html
@@ -50,32 +50,32 @@ add_task(async function setup_storage() 
   await addAddress(MOCK_STORAGE[0]);
   await addAddress(MOCK_STORAGE[1]);
   await addAddress(MOCK_STORAGE[2]);
 });
 
 add_task(async function check_preview() {
   const focusedInput = await setInput("#organization", "");
 
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+  synthesizeKey("KEY_ArrowDown", {});
   await expectPopup();
   checkFormFieldsStyle(null);
 
   for (let i = 0; i < MOCK_STORAGE.length; i++) {
-    synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+    synthesizeKey("KEY_ArrowDown", {});
     await notifySelectedIndex(i);
     checkFormFieldsStyle(MOCK_STORAGE[i]);
   }
 
   // Navigate to the footer
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+  synthesizeKey("KEY_ArrowDown", {});
   await notifySelectedIndex(MOCK_STORAGE.length);
   checkFormFieldsStyle(null);
 
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+  synthesizeKey("KEY_ArrowDown", {});
   await notifySelectedIndex(-1);
   checkFormFieldsStyle(null);
 
   focusedInput.blur();
 });
 
 add_task(async function check_filled_highlight() {
   await triggerPopupAndHoverItem("#organization", 0);
--- a/browser/extensions/formautofill/test/mochitest/test_multi_locale_CA_address_form.html
+++ b/browser/extensions/formautofill/test/mochitest/test_multi_locale_CA_address_form.html
@@ -84,69 +84,69 @@ function checkFormFilled(selector, addre
     } else {
       let converted = address[prop];
       if (prop == "street-address") {
         converted = FormAutofillUtils.toOneLineAddress(converted);
       }
       promises.push(...checkElementFilled(element, converted));
     }
   }
-  synthesizeKey("KEY_Enter", {code: "Enter"});
+  synthesizeKey("KEY_Enter", {});
   return Promise.all(promises);
 }
 
 async function setupAddressStorage() {
   for (let address of MOCK_STORAGE) {
     await addAddress(address);
   }
 }
 
 initPopupListener();
 
 // Autofill the address with address level 1 code.
 add_task(async function autofill_with_level1_code() {
   await setupAddressStorage();
 
   await setInput("#organization-en", "Mozilla Toronto");
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+  synthesizeKey("KEY_ArrowDown", {});
   await expectPopup();
 
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+  synthesizeKey("KEY_ArrowDown", {});
   // Replace address level 1 code with full name in English for test result
   let result = Object.assign({}, MOCK_STORAGE[1], {"address-level1": "Ontario"});
   await checkFormFilled("#form-en", result);
 
   await setInput("#organization-fr", "Mozilla Vancouver");
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+  synthesizeKey("KEY_ArrowDown", {});
   await expectPopup();
 
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+  synthesizeKey("KEY_ArrowDown", {});
   // Replace address level 1 code with full name in French for test result
   result = Object.assign({}, MOCK_STORAGE[0], {"address-level1": "Colombie-Britannique"});
   await checkFormFilled("#form-fr", result);
   document.querySelector("#form-en").reset();
   document.querySelector("#form-fr").reset();
 });
 
 // Autofill the address with address level 1 full name.
 add_task(async function autofill_with_level1_full_name() {
   await setInput("#organization-en", "ExpoCité");
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+  synthesizeKey("KEY_ArrowDown", {});
   await expectPopup();
 
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+  synthesizeKey("KEY_ArrowDown", {});
   // Replace address level 1 code with full name in French for test result
   let result = Object.assign({}, MOCK_STORAGE[3], {"address-level1": "Quebec"});
   await checkFormFilled("#form-en", result);
 
   await setInput("#organization-fr", "Prince of Wales Northern Heritage");
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+  synthesizeKey("KEY_ArrowDown", {});
   await expectPopup();
 
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+  synthesizeKey("KEY_ArrowDown", {});
   // Replace address level 1 code with full name in English for test result
   result = Object.assign({}, MOCK_STORAGE[2], {"address-level1": "Territoires du Nord-Ouest"});
   await checkFormFilled("#form-fr", result);
 });
 
 </script>
 
 <p id="display"></p>
--- a/browser/extensions/formautofill/test/mochitest/test_multiple_forms.html
+++ b/browser/extensions/formautofill/test/mochitest/test_multiple_forms.html
@@ -28,29 +28,29 @@ let MOCK_STORAGE = [{
 initPopupListener();
 
 add_task(async function setupStorage() {
   await addAddress(MOCK_STORAGE[0]);
 });
 
 add_task(async function check_switch_form_popup() {
   await setInput("#additional-name", "");
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+  synthesizeKey("KEY_ArrowDown", {});
   await expectPopup();
 
   // We need an intentional wait here before switching form.
   await sleep();
   await setInput("#organization", "");
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+  synthesizeKey("KEY_ArrowDown", {});
   const {open: popupOpen} = await getPopupState();
   is(popupOpen, false);
 
   await sleep();
   await setInput("#given-name", "");
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+  synthesizeKey("KEY_ArrowDown", {});
   await expectPopup();
 });
 
 </script>
 
 <div>
 
   <form>
--- a/browser/extensions/formautofill/test/mochitest/test_on_address_submission.html
+++ b/browser/extensions/formautofill/test/mochitest/test_on_address_submission.html
@@ -70,17 +70,17 @@ add_task(async function check_storage_af
   addressesInMenu.push(TEST_ADDRESSES[0]);
 
   // let expectedAddresses = TEST_ADDRESSES.slice(0);
   await onStorageChanged("add");
   let matching = await checkAddresses(TEST_ADDRESSES);
   ok(matching, "New address saved as expected");
 
   await setInput("#organization", "");
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+  synthesizeKey("KEY_ArrowDown", {});
   await expectPopup();
   checkMenuEntries(addressesInMenu.map(address =>
     JSON.stringify({primary: address.organization, secondary: address["street-address"]})
   ));
 });
 
 // Submit another new address that is mergeable.
 add_task(async function new_address_submitted_and_merged() {
@@ -105,20 +105,20 @@ add_task(async function new_address_subm
 // Submit an updated autofill address and merge.
 add_task(async function check_storage_after_form_submitted() {
   document.querySelector("form").reset();
   // Add country to second address in storage
   await setInput("#country", "US");
   TEST_ADDRESSES[1].country = "US";
 
   await setInput("#organization", "Moz");
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+  synthesizeKey("KEY_ArrowDown", {});
   await expectPopup();
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-  synthesizeKey("KEY_Enter", {code: "Enter"});
+  synthesizeKey("KEY_ArrowDown", {});
+  synthesizeKey("KEY_Enter", {});
   clickOnElement("input[type=submit]");
 
   let expectedAddresses = TEST_ADDRESSES.slice(0);
   await onStorageChanged("update");
   let matching = await checkAddresses(expectedAddresses);
   ok(matching, "Updated address merged as expected");
 });
 
--- a/devtools/client/responsive.html/test/browser/browser_device_width.js
+++ b/devtools/client/responsive.html/test/browser/browser_device_width.js
@@ -40,38 +40,38 @@ async function setViewportSizeWithInputK
   await resized;
 
   let dimensions = ui.toolWindow.document.querySelectorAll(".viewport-dimension-input");
 
   // Increase width value to 420 by using the Up arrow key
   resized = waitForViewportResizeTo(ui, 420, height);
   dimensions[0].focus();
   for (let i = 1; i <= 100; i++) {
-    EventUtils.synthesizeKey("KEY_ArrowUp", { code: "ArrowUp" });
+    EventUtils.synthesizeKey("KEY_ArrowUp", {});
   }
   await resized;
 
   // Resetting width value back to 320 using `Shift + Down` arrow
   resized = waitForViewportResizeTo(ui, width, height);
   dimensions[0].focus();
   for (let i = 1; i <= 10; i++) {
-    EventUtils.synthesizeKey("KEY_ArrowDown", { shiftKey: true, code: "ArrowDown" });
+    EventUtils.synthesizeKey("KEY_ArrowDown", {shiftKey: true});
   }
   await resized;
 
   // Increase height value to 600 by using `PageUp + Shift` key
   resized = waitForViewportResizeTo(ui, width, 600);
   dimensions[1].focus();
-  EventUtils.synthesizeKey("VK_PAGE_UP", { shiftKey: true });
+  EventUtils.synthesizeKey("VK_PAGE_UP", {shiftKey: true});
   await resized;
 
   // Resetting height value back to 500 by using `PageDown + Shift` key
   resized = waitForViewportResizeTo(ui, width, height);
   dimensions[1].focus();
-  EventUtils.synthesizeKey("VK_PAGE_DOWN", { shiftKey: true });
+  EventUtils.synthesizeKey("VK_PAGE_DOWN", {shiftKey: true});
   await resized;
 }
 
 async function doInitialChecks(ui) {
   let { innerWidth, matchesMedia } = await grabContentInfo(ui);
   is(innerWidth, 110, "initial width should be 110px");
   ok(!matchesMedia, "media query shouldn't match.");
 }
--- a/devtools/client/shared/test/browser_treeWidget_keyboard_interaction.js
+++ b/devtools/client/shared/test/browser_treeWidget_keyboard_interaction.js
@@ -103,129 +103,129 @@ async function testKeyboardInteraction(t
   node = tree.root.children.firstChild.nextSibling.firstChild;
   // node should not have selected class
   ok(!node.classList.contains("theme-selected"), "Node should not have selected class");
   ok(!node.hasAttribute("expanded"), "Node is not expanded");
 
   info("Pressing down key to select next item");
   event = defer();
   tree.once("select", pass);
-  EventUtils.synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}, win);
+  EventUtils.synthesizeKey("KEY_ArrowDown", {}, win);
   let [name, data, attachment] = await event.promise;
   is(name, "select", "Select event was fired after pressing down");
   is(data[0], "level1", "Correct item was selected after pressing down");
   ok(!attachment, "null attachment was emitted");
   ok(node.classList.contains("theme-selected"), "Node has selected class");
   ok(node.hasAttribute("expanded"), "Node is expanded now");
 
   info("Pressing down key again to select next item");
   event = defer();
   tree.once("select", pass);
-  EventUtils.synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}, win);
+  EventUtils.synthesizeKey("KEY_ArrowDown", {}, win);
   [name, data, attachment] = await event.promise;
   is(data.length, 2, "Correct level item was selected after second down keypress");
   is(data[0], "level1", "Correct parent level");
   is(data[1], "level2", "Correct second level");
 
   info("Pressing down key again to select next item");
   event = defer();
   tree.once("select", pass);
-  EventUtils.synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}, win);
+  EventUtils.synthesizeKey("KEY_ArrowDown", {}, win);
   [name, data, attachment] = await event.promise;
   is(data.length, 3, "Correct level item was selected after third down keypress");
   is(data[0], "level1", "Correct parent level");
   is(data[1], "level2", "Correct second level");
   is(data[2], "level3", "Correct third level");
 
   info("Pressing down key again to select next item");
   event = defer();
   tree.once("select", pass);
-  EventUtils.synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}, win);
+  EventUtils.synthesizeKey("KEY_ArrowDown", {}, win);
   [name, data, attachment] = await event.promise;
   is(data.length, 2, "Correct level item was selected after fourth down keypress");
   is(data[0], "level1", "Correct parent level");
   is(data[1], "level2-1", "Correct second level");
 
   // pressing left to check expand collapse feature.
   // This does not emit any event, so listening for keypress
   const eventToListen = kStrictKeyPressEvents ? "keydown" : "keypress";
   tree.root.children.addEventListener(eventToListen, () => {
     // executeSoon so that other listeners on the same method are executed first
     executeSoon(() => event.resolve(null));
   }, {once: true});
   info("Pressing left key to collapse the item");
   event = defer();
   node = tree._selectedLabel;
   ok(node.hasAttribute("expanded"), "Item is expanded before left keypress");
-  EventUtils.synthesizeKey("KEY_ArrowLeft", {code: "ArrowLeft"}, win);
+  EventUtils.synthesizeKey("KEY_ArrowLeft", {}, win);
   await event.promise;
 
   ok(!node.hasAttribute("expanded"), "Item is not expanded after left keypress");
 
   // pressing left on collapsed item should select the previous item
 
   info("Pressing left key on collapsed item to select previous");
   tree.once("select", pass);
   event = defer();
   // parent node should have no effect of this keypress
   node = tree.root.children.firstChild.nextSibling.firstChild;
   ok(node.hasAttribute("expanded"), "Parent is expanded");
-  EventUtils.synthesizeKey("KEY_ArrowLeft", {code: "ArrowLeft"}, win);
+  EventUtils.synthesizeKey("KEY_ArrowLeft", {}, win);
   [name, data] = await event.promise;
   is(data.length, 3, "Correct level item was selected after second left keypress");
   is(data[0], "level1", "Correct parent level");
   is(data[1], "level2", "Correct second level");
   is(data[2], "level3", "Correct third level");
   ok(node.hasAttribute("expanded"), "Parent is still expanded after left keypress");
 
   // pressing down again
 
   info("Pressing down key to select next item");
   event = defer();
   tree.once("select", pass);
-  EventUtils.synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}, win);
+  EventUtils.synthesizeKey("KEY_ArrowDown", {}, win);
   [name, data, attachment] = await event.promise;
   is(data.length, 2, "Correct level item was selected after fifth down keypress");
   is(data[0], "level1", "Correct parent level");
   is(data[1], "level2-1", "Correct second level");
 
   // collapsing the item to check expand feature.
 
   tree.root.children.addEventListener(eventToListen, () => {
     executeSoon(() => event.resolve(null));
   }, {once: true});
   info("Pressing left key to collapse the item");
   event = defer();
   node = tree._selectedLabel;
   ok(node.hasAttribute("expanded"), "Item is expanded before left keypress");
-  EventUtils.synthesizeKey("KEY_ArrowLeft", {code: "ArrowLeft"}, win);
+  EventUtils.synthesizeKey("KEY_ArrowLeft", {}, win);
   await event.promise;
   ok(!node.hasAttribute("expanded"), "Item is collapsed after left keypress");
 
   // pressing right should expand this now.
 
   tree.root.children.addEventListener(eventToListen, () => {
     executeSoon(() => event.resolve(null));
   }, {once: true});
   info("Pressing right key to expend the collapsed item");
   event = defer();
   node = tree._selectedLabel;
   ok(!node.hasAttribute("expanded"), "Item is collapsed before right keypress");
-  EventUtils.synthesizeKey("KEY_ArrowRight", {code: "ArrowRight"}, win);
+  EventUtils.synthesizeKey("KEY_ArrowRight", {}, win);
   await event.promise;
   ok(node.hasAttribute("expanded"), "Item is expanded after right keypress");
 
   // selecting last item node to test edge navigation case
 
   tree.selectedItem = ["level1.1", "level2", "level3"];
   node = tree._selectedLabel;
   // pressing down again should not change selection
   event = defer();
   tree.root.children.addEventListener(eventToListen, () => {
     executeSoon(() => event.resolve(null));
   }, {once: true});
   info("Pressing down key on last item of the tree");
-  EventUtils.synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}, win);
+  EventUtils.synthesizeKey("KEY_ArrowDown", {}, win);
   await event.promise;
 
   ok(tree.isSelected(["level1.1", "level2", "level3"]),
      "Last item is still selected after pressing down on last item of the tree");
 }
--- a/dom/events/test/browser_shortcutkey_modifier_conflicts_with_content_accesskey_modifier.js
+++ b/dom/events/test/browser_shortcutkey_modifier_conflicts_with_content_accesskey_modifier.js
@@ -57,26 +57,26 @@ add_task(async function() {
         resolve();
       }
       SimpleTest.executeSoon(tryToCheckItLater);
     });
   }
 
   // Alt + D is a shortcut key to move focus to the URL bar and selects its text.
   info("Pressing Alt + D in the search bar...");
-  EventUtils.synthesizeKey("d", {code: "KeyD", altKey: true});
+  EventUtils.synthesizeKey("d", {altKey: true});
 
   await promiseURLBarHasFocus();
   await promiseURLBarSelectsAllText();
 
   // Alt + D in the URL bar should select all text in it.
   await gURLBar.focus();
   await promiseURLBarHasFocus();
   gURLBar.inputField.selectionStart = gURLBar.inputField.selectionEnd =
     gURLBar.inputField.value.length;
 
   info("Pressing Alt + D in the URL bar...");
-  EventUtils.synthesizeKey("d", {code: "KeyD", altKey: true});
+  EventUtils.synthesizeKey("d", {altKey: true});
   await promiseURLBarHasFocus();
   await promiseURLBarSelectsAllText();
 
   gBrowser.removeCurrentTab();
 });
--- a/dom/events/test/test_bug226361.xhtml
+++ b/dom/events/test/test_bug226361.xhtml
@@ -33,17 +33,17 @@ https://bugzilla.mozilla.org/show_bug.cg
 function setTabFocus() {
   SpecialPowers.pushPrefEnv({ set: [[ "accessibility.tabfocus", 7 ]] }, doTest);
 }
 
 // =================================
 
 var doc = document;
 function tab_to(id) {
-  synthesizeKey("KEY_Tab", {code: "Tab"});
+  synthesizeKey("KEY_Tab", {});
   is(doc.activeElement.id, id, "element with id=" + id + " should have focus");
 }
 
 function tab_iframe() {
   doc = document;
   tab_to('iframe');
 
   // inside iframe
--- a/dom/events/test/test_bug238987.html
+++ b/dom/events/test/test_bug238987.html
@@ -87,17 +87,17 @@ https://bugzilla.mozilla.org/show_bug.cg
       s = s + ", id=\"" + e.target.id + "\"";
     }
     ok(e.eventPhase == Components.interfaces.nsIDOMEvent.CAPTURING_PHASE,
        "|window| should not have got a blur event, " + s);
   }
 
   function tab() {
     // Send tab key events.
-    synthesizeKey("KEY_Tab", {code: "Tab", shiftKey: activateShift});
+    synthesizeKey("KEY_Tab", {shiftKey: activateShift});
     if (shouldStop) {
       // Did focus handling succeed
       is(forwardFocusArray.length, 0,
          "Not all forward tabbing focus tests were run, " +
          forwardFocusArray.toString());
       is(backwardFocusArray.length, 0,
          "Not all backward tabbing focus tests were run, " +
          backwardFocusArray.toString());
--- a/dom/events/test/test_bug409604.html
+++ b/dom/events/test/test_bug409604.html
@@ -114,26 +114,26 @@ https://bugzilla.mozilla.org/show_bug.cg
 
   function handleInvalid(e) {
     ok("accessKey" in e, "(invalid) accesskey property not found on element");
     ok(false, "(invalid) accesskey should not have any effect on this element: " +
        e.localName);
   }
 
   function pressAccessKey(key) {
-    synthesizeKey(key.key, {code: key.code, altKey: true, shiftKey: true});
+    synthesizeKey(key.key, {altKey: true, shiftKey: true});
   }
 
   function testFocusableElements() {
     for (var code = "a".charCodeAt(0); code <= "y".charCodeAt(0); ++ code) {
       // XXX the "map" test is causing trouble, see bug 433089
       if (code == "b".charCodeAt(0))
         continue;
       var accessChar = String.fromCharCode(code).toUpperCase();
-      pressAccessKey({key: accessChar, code: "Key" + accessChar});
+      pressAccessKey({key: accessChar});
     }
     ok(focusArray.length == 0, "(focus) unhandled elements remaining: " + focusArray.join(","));
   }
 
   function createUnfocusableElement(elem, accesskey) {
     ok("tag" in elem, "invalid object passed to createUnfocusableElement: " + elem.toString());
     var e = document.createElement(elem.tag);
     if ("content" in elem) {
@@ -182,26 +182,26 @@ https://bugzilla.mozilla.org/show_bug.cg
     el.remove();
     ok(document.getElementById(unfocusableElementId) == null, "unfocusable element not properly removed");
   }
 
   function testUnfocusableElements() {
     var i, e;
     for (i = 0; i < unfocusableTags.length; ++ i) {
       createUnfocusableElement(unfocusableTags[i], "z");
-      pressAccessKey({key: "Z", code:"KeyZ"});
+      pressAccessKey({key: "Z"});
       destroyUnfocusableElement();
     }
     for (i = 0; i < invalidElements.length; ++ i) {
       e = document.getElementById(invalidElements[i]);
       ok(e != null, "element with ID " + invalidElements[i] + " not found");
       e.setAttribute("accesskey", "z");
       e.setAttribute("onclick", "handleClick(event.target); event.preventDefault();");
       e.setAttribute("onfocus", "handleInvalid(event.target);");
-      pressAccessKey({key: "Z", code:"KeyZ"});
+      pressAccessKey({key: "Z"});
       e.removeAttribute("accesskey");
       e.removeAttribute("onclick");
       e.removeAttribute("onfocus");
     }
   }
 
   function start() {
     testFocusableElements();
--- a/dom/events/test/test_bug450876.html
+++ b/dom/events/test/test_bug450876.html
@@ -20,17 +20,17 @@ https://bugzilla.mozilla.org/show_bug.cg
 
 /** Test for Bug 450876 **/
 
 function doTest() {
   is(document.activeElement, document.body, "body element should be focused");
   document.getElementById('a').focus();
   is(document.activeElement, document.getElementById('a'), "link should have focus");
   is(document.hasFocus(), true, "document should be focused");
-  synthesizeKey("KEY_Tab", {code: "Tab"});
+  synthesizeKey("KEY_Tab", {});
   is(document.activeElement, document.getElementById('a'), "body element should be focused");
   is(document.hasFocus(), false, "document should not be focused");
 
   SimpleTest.finish();
 }
 
 SimpleTest.waitForExplicitFinish();
 addLoadEvent(doTest);
--- a/dom/events/test/test_bug493251.html
+++ b/dom/events/test/test_bug493251.html
@@ -93,39 +93,39 @@ https://bugzilla.mozilla.org/show_bug.cg
     win.addEventListener("mousedown",
                          function(e) { dumpEvent(e); ++mouseDown; }, true);
     win.addEventListener("mouseup",
                          function(e) { dumpEvent(e); ++mouseUp; }, true);
     win.addEventListener("click",
                          function(e) { dumpEvent(e); ++mouseClick; }, true);
 
     ok(true, "doTest #1...");
-    synthesizeKey("a", {code: "KeyA"}, win);
+    synthesizeKey("a", {}, win);
     is(keyDown, 1, "Wrong number events (1)");
     is(keyPress, 1, "Wrong number events (2)");
     is(keyUp, 1, "Wrong number events (3)");
 
     ok(true, "doTest #2...");
     suppressEventHandling(true);
-    synthesizeKey("a", {code: "KeyA"}, win);
+    synthesizeKey("a", {}, win);
     is(keyDown, 1, "Wrong number events (4)");
     is(keyPress, 1, "Wrong number events (5)");
     is(keyUp, 1, "Wrong number events (6)");
     suppressEventHandling(false);
     is(keyDown, 1, "Wrong number events (7)");
     is(keyPress, 1, "Wrong number events (8)");
     is(keyUp, 1, "Wrong number events (9)");
 
     setTimeout(continueTest1, 0);
     }
 
   function continueTest1() {
     ok(true, "continueTest1...");
     win.addEventListener("keydown", () => { suppressEventHandling(true); }, {once: true});
-    synthesizeKey("a", {code: "KeyA"}, win);
+    synthesizeKey("a", {}, win);
     is(keyDown, 2, "Wrong number events (10)");
     is(keyPress, 1, "Wrong number events (11)");
     is(keyUp, 1, "Wrong number events (12)");
     suppressEventHandling(false);
     setTimeout(continueTest2, 0);
   }
 
   function continueTest2() {
--- a/dom/events/test/test_bug545268.html
+++ b/dom/events/test/test_bug545268.html
@@ -41,40 +41,40 @@ https://bugzilla.mozilla.org/show_bug.cg
     subwin.document.getElementsByTagName("input")[0].focus();
     subwin.addEventListener("keydown", function(e) { ++keyDown; }, true);
     subwin.addEventListener("keypress", function(e) { ++keyPress; }, true);
     subwin.addEventListener("keyup", function(e) { ++keyUp; }, true);
     subwin.addEventListener("mousedown", function(e) { ++mouseDown; }, true);
     subwin.addEventListener("mouseup", function(e) { ++mouseUp; }, true);
     subwin.addEventListener("click", function(e) { ++mouseClick; }, true);
 
-    synthesizeKey("a", {code: "KeyA"}, subwin);
+    synthesizeKey("a", {}, subwin);
     is(keyDown, 1, "Wrong number events (1)");
     is(keyPress, 1, "Wrong number events (2)");
     is(keyUp, 1, "Wrong number events (3)");
 
     // Test that suppressing events on the parent window prevents key
     // events in the subdocument window
     utils.suppressEventHandling(true);
-    synthesizeKey("a", {code: "KeyA"}, subwin);
+    synthesizeKey("a", {}, subwin);
     is(keyDown, 1, "Wrong number events (4)");
     is(keyPress, 1, "Wrong number events (5)");
     is(keyUp, 1, "Wrong number events (6)");
     utils.suppressEventHandling(false);
     is(keyDown, 1, "Wrong number events (7)");
     is(keyPress, 1, "Wrong number events (8)");
     is(keyUp, 1, "Wrong number events (9)");
 
     setTimeout(continueTest1, 0);
     }
 
   function continueTest1() {
     var utils = SpecialPowers.getDOMWindowUtils(win);
     subwin.addEventListener("keydown", () => { utils.suppressEventHandling(true); }, {once: true});
-    synthesizeKey("a", {code: "KeyA"}, subwin);
+    synthesizeKey("a", {}, subwin);
     is(keyDown, 2, "Wrong number events (10)");
     is(keyPress, 1, "Wrong number events (11)");
     is(keyUp, 1, "Wrong number events (12)");
     utils.suppressEventHandling(false);
     setTimeout(continueTest2, 0);
   }
 
   function continueTest2() {
--- a/dom/events/test/window_bug1369072.html
+++ b/dom/events/test/window_bug1369072.html
@@ -79,19 +79,19 @@ async function runTests()
       // Wait scroll event
       function onScroll() {
         SimpleTest.executeSoon(resolve);
       }
       window.addEventListener("scroll", onScroll, { once: true });
       iframe.contentWindow.addEventListener("scroll", onScroll, { once: true });
 
       if (aVertical) {
-        synthesizeKey("KEY_ArrowDown", { code: "ArrowDown" });
+        synthesizeKey("KEY_ArrowDown", {});
       } else {
-        synthesizeKey("KEY_ArrowRight", { code: "ArrowRight" });
+        synthesizeKey("KEY_ArrowRight", {});
       }
     });
   }
 
   // When iframe element has focus and the iframe document isn't scrollable, the parent document should be scrolled instead.
   document.body.focus();
   iframe.focus();
   await tryToScrollWithKey(true);
--- a/dom/html/test/forms/test_formnovalidate_attribute.html
+++ b/dom/html/test/forms/test_formnovalidate_attribute.html
@@ -68,17 +68,17 @@ if (observers.hasMoreElements()) {
   });
 
   document.getElementById('bv').addEventListener("invalid", function(aEvent) {
     aEvent.target.removeAttribute("invalid", arguments.callee, false);
     ok(true, "formnovalidate should not apply on if not set on the submit " +
              "control used for the submission");
     var c = document.getElementById('c');
     c.focus();
-    synthesizeKey("KEY_Enter", { code: "Enter" });
+    synthesizeKey("KEY_Enter", {});
   });
 
   document.getElementById('c').addEventListener("invalid", function(aEvent) {
     aEvent.target.removeAttribute("invalid", arguments.callee, false);
     ok(true, "formnovalidate should only apply on submit controls");
     document.getElementById('d').click();
   });
 
--- a/dom/html/test/forms/test_input_event.html
+++ b/dom/html/test/forms/test_input_event.html
@@ -205,21 +205,21 @@ https://bugzilla.mozilla.org/show_bug.cg
     // Tests for type='number'.
     // We only test key events here since input events for mouse event changes
     // are tested in test_input_number_mouse_events.html
     var number = document.getElementById("input_number");
 
     if (isDesktop) { // up/down arrow keys not supported on android/b2g
       number.value = "";
       number.focus();
-      synthesizeKey("KEY_ArrowUp", { code: "ArrowUp" });
+      synthesizeKey("KEY_ArrowUp", {});
       is(numberInput, 1, "input event should be dispatched for up/down arrow key keypress");
       is(number.value, "1", "sanity check value of number control after keypress");
 
-      synthesizeKey("KEY_ArrowDown", { code: "ArrowDown", repeat: 3 });
+      synthesizeKey("KEY_ArrowDown", {repeat: 3});
       is(numberInput, 4, "input event should be dispatched for each up/down arrow key keypress event, even when rapidly repeated");
       is(number.value, "-2", "sanity check value of number control after multiple keydown events");
 
       number.blur();
       is(numberInput, 4, "input event shouldn't be dispatched on blur");
     }
 
     MockFilePicker.cleanup();
--- a/dom/html/test/forms/test_novalidate_attribute.html
+++ b/dom/html/test/forms/test_novalidate_attribute.html
@@ -42,17 +42,17 @@ document.forms[0].addEventListener("subm
   ok(true, "novalidate has been correctly used for first form");
   document.getElementById('b').click();
 }, {once: true});
 
 document.forms[1].addEventListener("submit", function(aEvent) {
   ok(true, "novalidate has been correctly used for second form");
   var c = document.getElementById('c');
   c.focus();
-  synthesizeKey("KEY_Enter", { code: "Enter" });
+  synthesizeKey("KEY_Enter", {});
 }, {once: true});
 
 document.forms[2].addEventListener("submit", function(aEvent) {
   ok(true, "novalidate has been correctly used for third form");
   SimpleTest.executeSoon(SimpleTest.finish);
 }, {once: true});
 
 /**
--- a/dom/html/test/test_bug1295719_event_sequence_for_arrow_keys.html
+++ b/dom/html/test/test_bug1295719_event_sequence_for_arrow_keys.html
@@ -49,24 +49,24 @@ function runTests() {
     range.addEventListener(eventType, (event) => {
       let waiting_event = waiting_event_sequence[waiting_event_idx];
       is(waiting_event, eventType, "Waiting " + waiting_event + " get " + eventType);
       waiting_event_idx = waiting_event_idx == waiting_event_sequence.length - 1 ? 0 : waiting_event_idx + 1;
     });
   });
 
   number.focus();
-  synthesizeKey("KEY_ArrowDown", {type: "keydown", code: "ArrowDown"});
-  synthesizeKey("KEY_ArrowDown", {type: "keydown", code: "ArrowDown"});
-  synthesizeKey("KEY_ArrowDown", {type: "keyup", code: "ArrowDown"});
+  synthesizeKey("KEY_ArrowDown", {type: "keydown"});
+  synthesizeKey("KEY_ArrowDown", {type: "keydown"});
+  synthesizeKey("KEY_ArrowDown", {type: "keyup"});
   number.blur();
   range.focus();
   waiting_event_idx = 0;
-  synthesizeKey("KEY_ArrowDown", {type: "keydown", code: "ArrowDown"});
-  synthesizeKey("KEY_ArrowDown", {type: "keydown", code: "ArrowDown"});
-  synthesizeKey("KEY_ArrowDown", {type: "keyup", code: "ArrowDown"});
+  synthesizeKey("KEY_ArrowDown", {type: "keydown"});
+  synthesizeKey("KEY_ArrowDown", {type: "keydown"});
+  synthesizeKey("KEY_ArrowDown", {type: "keyup"});
 
   SimpleTest.finish();
 }
 
 </script>
 </body>
 </html>
--- a/dom/html/test/test_bug561636.html
+++ b/dom/html/test/test_bug561636.html
@@ -96,16 +96,16 @@ function runTest()
       SimpleTest.finish();
     });
   }, {once: true});
 
   document.getElementById('a').click();
   document.getElementById('b').click();
   var c = document.getElementById('c');
   c.focus();
-  synthesizeKey("KEY_Enter", { code: "Enter" });
+  synthesizeKey("KEY_Enter", {});
   document.getElementById('s2').click();
 }
 
 </script>
 </pre>
 </body>
 </html>
--- a/dom/tests/browser/browser_bug1316330.js
+++ b/dom/tests/browser/browser_bug1316330.js
@@ -13,24 +13,24 @@ const URL =
   "  if (e.charCode == 'p'.charCodeAt(0)) while (Date.now() - startTime < 500) {}" +
   "};" +
   "</script>";
 
 add_task(async function() {
   let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, URL);
   let browser = tab.linkedBrowser;
 
-  await EventUtils.synthesizeAndWaitKey("d", { code: "KeyD", repeat: 3 });
+  await EventUtils.synthesizeAndWaitKey("d", {repeat: 3});
 
   await ContentTask.spawn(browser, null, async function() {
     is(content.document.body.getAttribute("data-down"), "2", "Correct number of events");
     is(content.document.body.getAttribute("data-press"), "2", "Correct number of events");
   });
 
-  await EventUtils.synthesizeAndWaitKey("p", { code: "KeyP", repeat: 3 });
+  await EventUtils.synthesizeAndWaitKey("p", {repeat: 3});
 
   await ContentTask.spawn(browser, null, async function() {
     is(content.document.body.getAttribute("data-down"), "4", "Correct number of events");
     is(content.document.body.getAttribute("data-press"), "4", "Correct number of events");
   });
 
   gBrowser.removeCurrentTab();
 });
--- a/editor/libeditor/tests/test_bug1315065.html
+++ b/editor/libeditor/tests/test_bug1315065.html
@@ -55,17 +55,17 @@ SimpleTest.waitForFocus(()=>{
     }
   }
 
   for (var i = 0; i < 4; i++) {
     const kDescription = i == 0 ? "Backspace from immediately after the last character" :
                                   "Backspace from " + i + "th empty text node";
     editor.focus();
     initForBackspace(i);
-    synthesizeKey("KEY_Backspace", { code: "Backspace" });
+    synthesizeKey("KEY_Backspace", {});
     var p = document.getElementById("p");
     ok(p, kDescription + ": <p> element shouldn't be removed by Backspace key press");
     is(p.tagName.toLowerCase(), "p", kDescription + ": <p> element shouldn't be removed by Backspace key press");
     // When Backspace key is pressed even in empty text nodes, Gecko should not remove empty text nodes for now
     // because we should keep our traditional behavior (same as Edge) for backward compatibility as far as possible.
     // In this case, Chromium removes all empty text nodes, but Edge doesn't remove any empty text nodes.
     is(p.childNodes.length, 5, kDescription + ": <p> should have 5 children after pressing Backspace key");
     is(p.childNodes.item(0).textContent, "ab", kDescription + ": 'c' should be removed by pressing Backspace key");
@@ -112,17 +112,17 @@ SimpleTest.waitForFocus(()=>{
     }
   }
 
   for (var i = 0; i < 4; i++) {
     const kDescription = i == 0 ? "Delete from immediately before the first character" :
                                   "Delete from " + i + "th empty text node";
     editor.focus();
     initForDelete(i);
-    synthesizeKey("KEY_Delete", { code: "Delete" });
+    synthesizeKey("KEY_Delete", {});
     var p = document.getElementById("p");
     ok(p, kDescription + ": <p> element shouldn't be removed by Delete key press");
     is(p.tagName.toLowerCase(), "p", kDescription + ": <p> element shouldn't be removed by Delete key press");
     if (i == 0) {
       // If Delete key is pressed in non-empty text node, only the text node should be modified.
       // This is same behavior as Chromium, but different from Edge.  Edge removes all empty text nodes in this case.
       is(p.childNodes.length, 5, kDescription + ": <p> should have only 2 children after pressing Delete key (empty text nodes should be removed");
       is(p.childNodes.item(0).textContent, "", kDescription + ": 1st empty text node should not be removed by pressing Delete key");
--- a/editor/libeditor/tests/test_bug1316302.html
+++ b/editor/libeditor/tests/test_bug1316302.html
@@ -26,25 +26,25 @@ SimpleTest.waitForFocus(()=>{
   editor.focus();
 
   // Try to remove the last character from the end of the <blockquote>
   selection.collapse(blockquote, blockquote.childNodes.length);
   var range = selection.getRangeAt(0);
   ok(range.collapsed, "range should be collapsed at the end of <blockquote>");
   is(range.startContainer, blockquote, "range should be collapsed in the <blockquote>");
   is(range.startOffset, blockquote.childNodes.length, "range should be collapsed at the end");
-  synthesizeKey("KEY_Backspace", { code: "Backspace" });
+  synthesizeKey("KEY_Backspace", {});
   is(blockquote.innerHTML, "<p>ab</p>", "Pressing Backspace key at the end of <blockquote> should remove the last character in the <p>");
 
   // Try to remove the first character from the start of the <blockquote>
   selection.collapse(blockquote, 0);
   range = selection.getRangeAt(0);
   ok(range.collapsed, "range should be collapsed at the start of <blockquote>");
   is(range.startContainer, blockquote, "range should be collapsed in the <blockquote>");
   is(range.startOffset, 0, "range should be collapsed at the start");
-  synthesizeKey("KEY_Delete", { code: "Delete" });
+  synthesizeKey("KEY_Delete", {});
   is(blockquote.innerHTML, "<p>b</p>", "Pressing Delete key at the start of <blockquote> should remove the first character in the <p>");
 
   SimpleTest.finish();
 });
 </script>
 </body>
 </html>
--- a/editor/libeditor/tests/test_bug1318312.html
+++ b/editor/libeditor/tests/test_bug1318312.html
@@ -24,69 +24,69 @@ function runTests()
      "outerEditor should have focus");
 
   // Move cursor into the innerEditor with ArrowDown key.  Then, focus shouldn't
   // be moved to innerEditor from outerEditor.
   // Note that Chrome moves focus in this case.  However, we should do that
   // at least for now because user can move focus with ArrowUp key even from
   // innerEditor to outerEditor but we don't allow such navigation.
   // FYI: Edge behaves same as us.
-  synthesizeKey("KEY_ArrowDown", { code: "ArrowDown" });
+  synthesizeKey("KEY_ArrowDown", {});
   is(document.activeElement, outerEditor,
      "outerEditor should still have focus because focus shouldn't be moved by moving caret");
   is(document.getSelection().focusNode, document.getElementById("innerEditor").firstChild.firstChild,
      "focus node of selection should be the text node in the innerEditor");
   is(document.getSelection().focusOffset, 0,
      "focus offset of selection should be 0");
 
-  synthesizeKey("a", { code: "KeyA" });
+  synthesizeKey("a", {});
   is(document.activeElement, outerEditor,
      "outerEditor should still have focus because focus shouldn't be moved by typing a character");
   is(document.getSelection().focusNode, document.getElementById("innerEditor").firstChild.firstChild,
      "focus node of selection should be the text node in the innerEditor");
   is(document.getSelection().focusOffset, 1,
      "focus offset of selection should be 1");
 
-  synthesizeKey("KEY_Enter", { code: "Enter" });
+  synthesizeKey("KEY_Enter", {});
   is(document.activeElement, outerEditor,
      "outerEditor should still have focus because focus shouldn't be moved by typing Enter");
   is(document.getSelection().focusNode, document.getElementById("innerEditor").childNodes.item(1).firstChild,
      "focus node of selection should be the text node in the second paragraph in the innerEditor");
   is(document.getSelection().focusOffset, 0,
      "focus offset of selection should be 0");
 
-  synthesizeKey("KEY_Backspace", { code: "Backspace" });
+  synthesizeKey("KEY_Backspace", {});
   is(document.activeElement, outerEditor,
      "outerEditor should still have focus because focus shouldn't be moved by typing Backspace (removing the line breaker)");
   is(document.getSelection().focusNode, document.getElementById("innerEditor").firstChild.firstChild,
      "focus node of selection should be the text node in the innerEditor");
   is(document.getSelection().focusOffset, 1,
      "focus offset of selection should be 1");
 
-  synthesizeKey("KEY_ArrowLeft", { code: "ArrowLeft", shiftKey: true });
+  synthesizeKey("KEY_ArrowLeft", {shiftKey: true});
   is(document.activeElement, outerEditor,
      "outerEditor should still have focus because focus shouldn't be moved by typing Shift+ArrowLeft (selecting 'a')");
   is(document.getSelection().focusNode, document.getElementById("innerEditor").firstChild.firstChild,
      "focus node of selection should be the text node in the innerEditor");
   is(document.getSelection().focusOffset, 0,
      "focus offset of selection should be 0");
   is(document.getSelection().anchorNode, document.getElementById("innerEditor").firstChild.firstChild,
      "anchor node of selection should be the text node in the innerEditor");
   is(document.getSelection().anchorOffset, 1,
      "anchor offset of selection should be 1");
 
-  synthesizeKey("KEY_Delete", { code: "Delete" });
+  synthesizeKey("KEY_Delete", {});
   is(document.activeElement, outerEditor,
      "outerEditor should still have focus because focus shouldn't be moved by typing Delete (removing the 'a')");
   is(document.getSelection().focusNode, document.getElementById("innerEditor").firstChild.firstChild,
      "focus node of selection should be the text node in the innerEditor");
   is(document.getSelection().focusOffset, 0,
      "focus offset of selection should be 0");
 
-  synthesizeKey("KEY_ArrowUp", { code: "ArrowUp" });
+  synthesizeKey("KEY_ArrowUp", {});
   is(document.activeElement, outerEditor,
      "outerEditor should still have focus because focus shouldn't be moved by moving caret from innerEditor to outerEditor");
   is(document.getSelection().focusNode, document.getElementById("outerEditor").firstChild.firstChild,
      "focus node of selection should be the text node in the outerEditor");
   is(document.getSelection().focusOffset, 0,
      "focus offset of selection should be 0");
 
   // However, clicking in innerEditor should move focus.
--- a/editor/libeditor/tests/test_bug1330796.html
+++ b/editor/libeditor/tests/test_bug1330796.html
@@ -70,18 +70,18 @@ SimpleTest.waitForFocus(function() {
 
   for (i = 0; i < tests.length; i++) {
     theEdit.innerHTML = tests[i][0];
     theEdit.focus();
     var theText = theEdit.firstChild.firstChild;
     // Position set at the beginning , middle and end of the text.
     sel.collapse(theText, tests[i][1]);
 
-    synthesizeKey("KEY_Enter", { code: "Enter" });
-    synthesizeKey("x", { code: "KeyX" });
+    synthesizeKey("KEY_Enter", {});
+    synthesizeKey("x", {});
     is(theEdit.innerHTML, tests[i][2], "unexpected HTML for test " + i.toString());
   }
 
   SimpleTest.finish();
 
 });
 
 function makeMailEditor() {
--- a/editor/libeditor/tests/test_bug1385905.html
+++ b/editor/libeditor/tests/test_bug1385905.html
@@ -23,29 +23,29 @@ SimpleTest.waitForFocus(() => {
       isnot(br.getAttribute("type"), "_moz",
             "mozBR shouldn't be used with this test");
     }
   }
   document.execCommand("defaultparagraphseparator", false, "div");
   var editor = document.getElementById("editor");
   // Click the left blank area of the first line to set cursor to the start of "contents".
   synthesizeMouse(editor, 3, 10, {});
-  synthesizeKey("KEY_Enter", { code: "Enter" });
+  synthesizeKey("KEY_Enter", {});
   is(editor.innerHTML, "<div><br></div><div>contents</div>",
      "Typing Enter at start of the <div> element should split the <div> element");
-  synthesizeKey("KEY_ArrowUp", { code: "ArrowUp" });
-  synthesizeKey("x", { code: "KeyX" });
+  synthesizeKey("KEY_ArrowUp", {});
+  synthesizeKey("x", {});
   is(editor.innerHTML, "<div>x<br></div><div>contents</div>",
      "Typing 'x' at the empty <div> element should just insert 'x' into the <div> element");
   ensureNoMozBR();
-  synthesizeKey("KEY_Enter", { code: "Enter" });
+  synthesizeKey("KEY_Enter", {});
   is(editor.innerHTML, "<div>x</div><div><br></div><div>contents</div>",
      "Typing Enter next to 'x' in the first <div> element should split the <div> element and inserts <br> element to a new <div> element");
   ensureNoMozBR();
-  synthesizeKey("KEY_Enter", { code: "Enter" });
+  synthesizeKey("KEY_Enter", {});
   is(editor.innerHTML, "<div>x</div><div><br></div><div><br></div><div>contents</div>",
      "Typing Enter in the empty <div> should split the <div> element and inserts <br> element to a new <div> element");
   ensureNoMozBR();
   SimpleTest.finish();
 });
 </script>
 </body>
 </html>
--- a/editor/libeditor/tests/test_bug1390562.html
+++ b/editor/libeditor/tests/test_bug1390562.html
@@ -32,33 +32,33 @@ SimpleTest.waitForFocus(function() {
 
   // Collapse selection at the end of the first text node.
   window.getSelection().collapse(editor.firstChild.firstChild, 3);
 
   // Then, typing Enter should insert <br> for <div> container.
   // This is necessary for backward compatibility.  When we change default
   // value of "defaultParagraphSeparator" to "div" or "p", it may be possible
   // to remove this hack.
-  synthesizeKey("KEY_Enter", { code: "Enter" });
+  synthesizeKey("KEY_Enter", {});
 
   is(editor.innerHTML,
      "<div>abc<br><br><br></div>def",
      "Enter key press at end of a text node followed by a visible <br> shouldn't split <div> container when defaultParagraphSeparator is 'br'");
 
   // Check also the case of <p> as container.
   editor.innerHTML = "<p>abc<br><br></p>def";
 
   // Collapse selection at the end of the first text node.
   window.getSelection().collapse(editor.firstChild.firstChild, 3);
 
   // Then, typing Enter should splitting <p> container and remove the visible
   // <br> element next to the caret position.
   // This is not consistent with <div> container, but this is better behavior
   // and keep using this behavior.
-  synthesizeKey("KEY_Enter", { code: "Enter" });
+  synthesizeKey("KEY_Enter", {});
 
   is(editor.innerHTML,
      "<p>abc</p><p><br></p>def",
      "Enter key press at end of a text node followed by a visible <br> should split <p> container and remove the visible <br> when defaultParagraphSeparator is 'br'");
 
   SimpleTest.finish();
 });
 </script>
--- a/editor/libeditor/tests/test_bug1397412.xul
+++ b/editor/libeditor/tests/test_bug1397412.xul
@@ -44,24 +44,24 @@ function runTest() {
   doc.designMode = "on";
   doc.defaultView.focus();
   var selection = doc.defaultView.getSelection();
   var body = doc.body;
 
   // Test 1.
   body.innerHTML = initialHTML1;
   selection.collapse(body, 2);
-  synthesizeKey("t", { code: "KeyT" });
+  synthesizeKey("t", {});
   var actualHTML = body.innerHTML;
   is(actualHTML, expectedHTML1, "'t' should be inserted between <br>s");
 
   // Test 2.
   body.innerHTML = initialHTML2;
   selection.collapse(body, 2);
-  synthesizeKey("t", { code: "KeyT" });
+  synthesizeKey("t", {});
   actualHTML = body.innerHTML;
   is(actualHTML, expectedHTML2, "'t' should be inserted between <br>s");
 
   SimpleTest.finish();
 }
 
 SimpleTest.waitForExplicitFinish();
 ]]>
--- a/editor/libeditor/tests/test_inline_style_cache.html
+++ b/editor/libeditor/tests/test_inline_style_cache.html
@@ -26,251 +26,251 @@ SimpleTest.waitForFocus(function() {
   var selection = window.getSelection();
 
   // #01-01 Typing something after setting some styles should insert some nodes to insert text.
   editor.innerHTML = "beforeafter";
   selection.collapse(editor.firstChild, "before".length);
   document.execCommand("bold");
   document.execCommand("italic");
   document.execCommand("strikethrough");
-  synthesizeKey("t", { code: "KeyT" });
-  synthesizeKey("e", { code: "KeyE" });
-  synthesizeKey("s", { code: "KeyS" });
-  synthesizeKey("t", { code: "KeyT" });
+  synthesizeKey("t", {});
+  synthesizeKey("e", {});
+  synthesizeKey("s", {});
+  synthesizeKey("t", {});
 
   is(editor.innerHTML, "before<strike><i><b>test</b></i></strike>after",
      "#01-01 At typing something after setting some styles, should cause inserting some nodes to apply the style");
 
   // #01-02 Typing something after removing some characters after setting some styles should work as without removing some character.
   // XXX This behavior is different from Chromium.
   editor.innerHTML = "beforeafter";
   selection.collapse(editor.firstChild, "before".length);
   document.execCommand("bold");
   document.execCommand("italic");
   document.execCommand("strikethrough");
-  synthesizeKey("KEY_Delete", { code: "Delete" });
-  synthesizeKey("t", { code: "KeyT" });
-  synthesizeKey("e", { code: "KeyE" });
-  synthesizeKey("s", { code: "KeyS" });
-  synthesizeKey("t", { code: "KeyT" });
+  synthesizeKey("KEY_Delete", {});
+  synthesizeKey("t", {});
+  synthesizeKey("e", {});
+  synthesizeKey("s", {});
+  synthesizeKey("t", {});
 
   is(editor.innerHTML, "before<strike><i><b>test</b></i></strike>fter",
      "#01-02-1 At typing something after Delete after setting style, should cause inserting some nodes to apply the style");
 
   editor.innerHTML = "beforeafter";
   selection.collapse(editor.firstChild, "before".length);
   document.execCommand("bold");
   document.execCommand("italic");
   document.execCommand("strikethrough");
-  synthesizeKey("KEY_Backspace", { code: "Backspace" });
-  synthesizeKey("t", { code: "KeyT" });
-  synthesizeKey("e", { code: "KeyE" });
-  synthesizeKey("s", { code: "KeyS" });
-  synthesizeKey("t", { code: "KeyT" });
+  synthesizeKey("KEY_Backspace", {});
+  synthesizeKey("t", {});
+  synthesizeKey("e", {});
+  synthesizeKey("s", {});
+  synthesizeKey("t", {});
 
   is(editor.innerHTML, "befor<strike><i><b>test</b></i></strike>after",
      "#01-02-2 At typing something after Backspace after setting style, should cause inserting some nodes to apply the style");
 
   // #01-03 Typing Enter after setting some styles should not ignore the styles.
   editor.innerHTML = "beforeafter";
   selection.collapse(editor.firstChild, "before".length);
   document.execCommand("bold");
   document.execCommand("italic");
   document.execCommand("strikethrough");
-  synthesizeKey("KEY_Enter", { code: "Enter" });
-  synthesizeKey("t", { code: "KeyT" });
-  synthesizeKey("e", { code: "KeyE" });
-  synthesizeKey("s", { code: "KeyS" });
-  synthesizeKey("t", { code: "KeyT" });
+  synthesizeKey("KEY_Enter", {});
+  synthesizeKey("t", {});
+  synthesizeKey("e", {});
+  synthesizeKey("s", {});
+  synthesizeKey("t", {});
 
   is(editor.innerHTML, "<div>before</div><div><strike><i><b>test</b></i></strike>after</div>",
      "#01-03-1 Typing Enter after setting style should not ignore the styles");
 
   editor.innerHTML = "<p>beforeafter</p>";
   selection.collapse(editor.firstChild.firstChild, "before".length);
   document.execCommand("bold");
   document.execCommand("italic");
   document.execCommand("strikethrough");
-  synthesizeKey("KEY_Enter", { code: "Enter" });
-  synthesizeKey("t", { code: "KeyT" });
-  synthesizeKey("e", { code: "KeyE" });
-  synthesizeKey("s", { code: "KeyS" });
-  synthesizeKey("t", { code: "KeyT" });
+  synthesizeKey("KEY_Enter", {});
+  synthesizeKey("t", {});
+  synthesizeKey("e", {});
+  synthesizeKey("s", {});
+  synthesizeKey("t", {});
 
   is(editor.innerHTML, "<p>before</p><p><strike><i><b>test</b></i></strike>after</p>",
      "#01-03-2 Typing Enter after setting style should not ignore the styles");
 
   // #02-01 Replacing text with typing some text after setting some styles should work as just inserting text.
   // XXX Chromium works as expected.
   editor.innerHTML = "beforeselectionafter";
   selection.collapse(editor.firstChild, "before".length);
   selection.extend(editor.firstChild, "beforeselection".length);
   document.execCommand("bold");
   document.execCommand("italic");
   document.execCommand("strikethrough");
-  synthesizeKey("t", { code: "KeyT" });
-  synthesizeKey("e", { code: "KeyE" });
-  synthesizeKey("s", { code: "KeyS" });
-  synthesizeKey("t", { code: "KeyT" });
+  synthesizeKey("t", {});
+  synthesizeKey("e", {});
+  synthesizeKey("s", {});
+  synthesizeKey("t", {});
 
   // XXX <strike> is not handled correctly in this case.
   todo_is(editor.innerHTML, "before<strike><i><b>test</b></i></strike>after",
           "#02-01 At replacing \"selection\" after setting some styles, should keep the styles at inserting text");
   // XXX For testing current (buggy) behavior for now.
   is(editor.innerHTML, "before<i><b>test</b></i><strike><i><b></b></i></strike>after",
      "#02-01 At replacing \"selection\" after setting some styles, should keep the styles");
 
   // #02-02 Inserting text after removing selected text after setting some styles should not keep the styles.
   // XXX Chromium keeps the style.
   editor.innerHTML = "beforeselectionafter";
   selection.collapse(editor.firstChild, "before".length);
   selection.extend(editor.firstChild, "beforeselection".length);
   document.execCommand("bold");
   document.execCommand("italic");
   document.execCommand("strikethrough");
-  synthesizeKey("KEY_Backspace", { code: "Backspace" });
-  synthesizeKey("t", { code: "KeyT" });
-  synthesizeKey("e", { code: "KeyE" });
-  synthesizeKey("s", { code: "KeyS" });
-  synthesizeKey("t", { code: "KeyT" });
+  synthesizeKey("KEY_Backspace", {});
+  synthesizeKey("t", {});
+  synthesizeKey("e", {});
+  synthesizeKey("s", {});
+  synthesizeKey("t", {});
 
   is(editor.innerHTML, "beforetestafter",
      "#02-02 After removing \"selection\" after setting some styles, should not keep the styles");
 
   // #02-03 Inserting text after replacing selected text after setting some styles should keep the styles.
   editor.innerHTML = "beforeselectionafter";
   selection.collapse(editor.firstChild, "before".length);
   selection.extend(editor.firstChild, "beforeselection".length);
   document.execCommand("bold");
   document.execCommand("italic");
   document.execCommand("strikethrough");
-  synthesizeKey("KEY_Enter", { code: "Enter" });
-  synthesizeKey("t", { code: "KeyT" });
-  synthesizeKey("e", { code: "KeyE" });
-  synthesizeKey("s", { code: "KeyS" });
-  synthesizeKey("t", { code: "KeyT" });
+  synthesizeKey("KEY_Enter", {});
+  synthesizeKey("t", {});
+  synthesizeKey("e", {});
+  synthesizeKey("s", {});
+  synthesizeKey("t", {});
 
   // XXX <strike> is not handled correctly in this case.
   todo_is(editor.innerHTML, "<div>before</div><div><strike><i><b>test</b></i></strike>after</div>",
           "#02-03-1 Typing Enter after setting style to selected text should keep the styles");
   // XXX For testing current (buggy) behavior for now.
   is(editor.innerHTML, "<div>before</div><div><i><b>test</b></i>after</div>",
      "#02-03-1 Typing Enter after setting style to selected text should keep the styles");
 
   editor.innerHTML = "<p>beforeselectionafter</p>";
   selection.collapse(editor.firstChild.firstChild, "before".length);
   selection.extend(editor.firstChild.firstChild, "beforeselection".length);
   document.execCommand("bold");
   document.execCommand("italic");
   document.execCommand("strikethrough");
-  synthesizeKey("KEY_Enter", { code: "Enter" });
-  synthesizeKey("t", { code: "KeyT" });
-  synthesizeKey("e", { code: "KeyE" });
-  synthesizeKey("s", { code: "KeyS" });
-  synthesizeKey("t", { code: "KeyT" });
+  synthesizeKey("KEY_Enter", {});
+  synthesizeKey("t", {});
+  synthesizeKey("e", {});
+  synthesizeKey("s", {});
+  synthesizeKey("t", {});
 
   is(editor.innerHTML, "<p>before</p><p><strike><i><b>test</b></i></strike>after</p>",
      "#02-03-2 Typing Enter after setting style to selected text should keep the styles");
 
   // #03-01 Replacing in <b style="font-weight: normal;"> shouldn't cause new <b>.
   editor.innerHTML = "<b style=\"font-weight: normal;\">beforeselectionafter</b>";
   selection.collapse(editor.firstChild.firstChild, "before".length);
   selection.extend(editor.firstChild.firstChild, "beforeselection".length);
-  synthesizeKey("t", { code: "KeyT" });
-  synthesizeKey("e", { code: "KeyE" });
-  synthesizeKey("s", { code: "KeyS" });
-  synthesizeKey("t", { code: "KeyT" });
+  synthesizeKey("t", {});
+  synthesizeKey("e", {});
+  synthesizeKey("s", {});
+  synthesizeKey("t", {});
 
   is(editor.innerHTML, "<b style=\"font-weight: normal;\">beforetestafter</b>",
      "#03-01 Replacing text in styled inline elements should respect the styles");
 
   // #03-02 Typing something after removing selected text in <b style="font-weight: normal;"> shouldn't cause new <b>.
   editor.innerHTML = "<b style=\"font-weight: normal;\">beforeselectionafter</b>";
   selection.collapse(editor.firstChild.firstChild, "before".length);
   selection.extend(editor.firstChild.firstChild, "beforeselection".length);
-  synthesizeKey("KEY_Backspace", { code: "Backspace" });
-  synthesizeKey("t", { code: "KeyT" });
-  synthesizeKey("e", { code: "KeyE" });
-  synthesizeKey("s", { code: "KeyS" });
-  synthesizeKey("t", { code: "KeyT" });
+  synthesizeKey("KEY_Backspace", {});
+  synthesizeKey("t", {});
+  synthesizeKey("e", {});
+  synthesizeKey("s", {});
+  synthesizeKey("t", {});
 
   is(editor.innerHTML, "<b style=\"font-weight: normal;\">beforetestafter</b>",
      "#03-02 Inserting text after removing text in styled inline elements should respect the styles");
 
   // #03-03 Typing something after typing Enter at selected text in <b style="font-weight: normal;"> shouldn't cause new <b>.
   editor.innerHTML = "<b style=\"font-weight: normal;\">beforeselectionafter</b>";
   selection.collapse(editor.firstChild.firstChild, "before".length);
   selection.extend(editor.firstChild.firstChild, "beforeselection".length);
-  synthesizeKey("KEY_Enter", { code: "Enter" });
-  synthesizeKey("t", { code: "KeyT" });
-  synthesizeKey("e", { code: "KeyE" });
-  synthesizeKey("s", { code: "KeyS" });
-  synthesizeKey("t", { code: "KeyT" });
+  synthesizeKey("KEY_Enter", {});
+  synthesizeKey("t", {});
+  synthesizeKey("e", {});
+  synthesizeKey("s", {});
+  synthesizeKey("t", {});
 
   is(editor.innerHTML, "<div><b style=\"font-weight: normal;\">before</b></div><div><b style=\"font-weight: normal;\">testafter</b></div>",
      "#03-03-1 Inserting text after typing Enter at selected text in styled inline elements should respect the styles");
 
   editor.innerHTML = "<p><b style=\"font-weight: normal;\">beforeselectionafter</b></p>";
   selection.collapse(editor.firstChild.firstChild.firstChild, "before".length);
   selection.extend(editor.firstChild.firstChild.firstChild, "beforeselection".length);
-  synthesizeKey("KEY_Enter", { code: "Enter" });
-  synthesizeKey("t", { code: "KeyT" });
-  synthesizeKey("e", { code: "KeyE" });
-  synthesizeKey("s", { code: "KeyS" });
-  synthesizeKey("t", { code: "KeyT" });
+  synthesizeKey("KEY_Enter", {});
+  synthesizeKey("t", {});
+  synthesizeKey("e", {});
+  synthesizeKey("s", {});
+  synthesizeKey("t", {});
 
   is(editor.innerHTML, "<p><b style=\"font-weight: normal;\">before</b></p><p><b style=\"font-weight: normal;\">testafter</b></p>",
      "#03-03-2 Inserting text after typing Enter at selected text in styled inline elements should respect the styles");
 
   // #04-01 Replacing in some styled inline elements shouldn't cause new same elements.
   editor.innerHTML = "<strike style=\"text-decoration: none;\"><i style=\"font-style: normal;\"><b style=\"font-weight: normal;\">beforeselectionafter</b></i></strike>";
   selection.collapse(editor.firstChild.firstChild.firstChild.firstChild, "before".length);
   selection.extend(editor.firstChild.firstChild.firstChild.firstChild, "beforeselection".length);
-  synthesizeKey("t", { code: "KeyT" });
-  synthesizeKey("e", { code: "KeyE" });
-  synthesizeKey("s", { code: "KeyS" });
-  synthesizeKey("t", { code: "KeyT" });
+  synthesizeKey("t", {});
+  synthesizeKey("e", {});
+  synthesizeKey("s", {});
+  synthesizeKey("t", {});
 
   is(editor.innerHTML, "<strike style=\"text-decoration: none;\"><i style=\"font-style: normal;\"><b style=\"font-weight: normal;\">beforetestafter</b></i></strike>",
      "#04-01 Replacing text in styled inline elements should respect the styles");
 
   // #04-02 Typing something after removing selected text in some styled inline elements shouldn't cause new same elements.
   editor.innerHTML = "<strike style=\"text-decoration: none;\"><i style=\"font-style: normal;\"><b style=\"font-weight: normal;\">beforeselectionafter</b>";
   selection.collapse(editor.firstChild.firstChild.firstChild.firstChild, "before".length);
   selection.extend(editor.firstChild.firstChild.firstChild.firstChild, "beforeselection".length);
-  synthesizeKey("KEY_Backspace", { code: "Backspace" });
-  synthesizeKey("t", { code: "KeyT" });
-  synthesizeKey("e", { code: "KeyE" });
-  synthesizeKey("s", { code: "KeyS" });
-  synthesizeKey("t", { code: "KeyT" });
+  synthesizeKey("KEY_Backspace", {});
+  synthesizeKey("t", {});
+  synthesizeKey("e", {});
+  synthesizeKey("s", {});
+  synthesizeKey("t", {});
 
   is(editor.innerHTML, "<strike style=\"text-decoration: none;\"><i style=\"font-style: normal;\"><b style=\"font-weight: normal;\">beforetestafter</b></i></strike>",
      "#04-02 Inserting text after removing text in styled inline elements should respect the styles");
 
   // #04-03 Typing something after typing Enter at selected text in some styled inline elements shouldn't cause new same elements.
   editor.innerHTML = "<strike style=\"text-decoration: none;\"><i style=\"font-style: normal;\"><b style=\"font-weight: normal;\">beforeselectionafter</b>";
   selection.collapse(editor.firstChild.firstChild.firstChild.firstChild, "before".length);
   selection.extend(editor.firstChild.firstChild.firstChild.firstChild, "beforeselection".length);
-  synthesizeKey("KEY_Enter", { code: "Enter" });
-  synthesizeKey("t", { code: "KeyT" });
-  synthesizeKey("e", { code: "KeyE" });
-  synthesizeKey("s", { code: "KeyS" });
-  synthesizeKey("t", { code: "KeyT" });
+  synthesizeKey("KEY_Enter", {});
+  synthesizeKey("t", {});
+  synthesizeKey("e", {});
+  synthesizeKey("s", {});
+  synthesizeKey("t", {});
 
   is(editor.innerHTML, "<div><strike style=\"text-decoration: none;\"><i style=\"font-style: normal;\"><b style=\"font-weight: normal;\">before</b></i></strike></div><div><strike style=\"text-decoration: none;\"><i style=\"font-style: normal;\"><b style=\"font-weight: normal;\">testafter</b></i></strike></div>",
      "#04-03-1 Inserting text after typing Enter at selected text in styled inline elements should respect the styles");
 
   editor.innerHTML = "<p><strike style=\"text-decoration: none;\"><i style=\"font-style: normal;\"><b style=\"font-weight: normal;\">beforeselectionafter</b></p>";
   selection.collapse(editor.firstChild.firstChild.firstChild.firstChild.firstChild, "before".length);
   selection.extend(editor.firstChild.firstChild.firstChild.firstChild.firstChild, "beforeselection".length);
-  synthesizeKey("KEY_Enter", { code: "Enter" });
-  synthesizeKey("t", { code: "KeyT" });
-  synthesizeKey("e", { code: "KeyE" });
-  synthesizeKey("s", { code: "KeyS" });
-  synthesizeKey("t", { code: "KeyT" });
+  synthesizeKey("KEY_Enter", {});
+  synthesizeKey("t", {});
+  synthesizeKey("e", {});
+  synthesizeKey("s", {});
+  synthesizeKey("t", {});
 
   is(editor.innerHTML, "<p><strike style=\"text-decoration: none;\"><i style=\"font-style: normal;\"><b style=\"font-weight: normal;\">before</b></i></strike></p><p><strike style=\"text-decoration: none;\"><i style=\"font-style: normal;\"><b style=\"font-weight: normal;\">testafter</b></i></strike></p>",
      "#04-03-2 Inserting text after typing Enter at selected text in styled inline elements should respect the styles");
 
   SimpleTest.finish();
 });
 </script>
 </pre>
--- a/layout/base/tests/chrome/test_bug551434.html
+++ b/layout/base/tests/chrome/test_bug551434.html
@@ -26,20 +26,20 @@ var gKeyDown2 = 0, gKeyPress2 = 0, gKeyU
 var gKeyDown3 = 0, gKeyPress3 = 0, gKeyUp3 = 0;
 
 function runTest()
 {
   $("i1").focus();
 
   // key events should not be retargeted when the focus changes to an
   // element in the same document.
-  synthesizeKey("a", { type: "keydown", code: "KeyA", keyCode: KeyboardEvent.DOM_VK_B });
+  synthesizeKey("a", {type: "keydown"});
   is(document.activeElement, $("i2"), "input 2 in focused");
 
-  synthesizeKey("a", { type: "keyup", code: "KeyA", keyCode: KeyboardEvent.DOM_VK_B });
+  synthesizeKey("a", {type: "keyup"});
 
   is(gKeyDown1, 1, "keydown on input 1");
   is(gKeyPress1, 0, "keypress on input 1");
   is(gKeyUp1, 0, "keyup on input 1");
   is(gKeyDown2, 0, "keydown on input 2");
   is(gKeyPress2, 1, "keypress on input 2");
   is(gKeyUp2, 1, "keyup on input 2");
 
@@ -47,17 +47,17 @@ function runTest()
   is($("i2").value, "a", "input 2 value");
 
   // key events should however be retargeted when the focus changes to an
   // element in the a content document from a chrome document.
   $("i3").focus();
 
   var childWinObj = frames[0].wrappedJSObject;
 
-  synthesizeKey("b", { code: "KeyB", keyCode: KeyboardEvent.DOM_VK_B });
+  synthesizeKey("b", {});
   is(gKeyDown3, 1, "keydown on input 3");
   is(gKeyPress3, 1, "keypress on input 3");
   is(gKeyUp3, 1, "keyup on input 3");
   is(childWinObj.gKeyDownChild, 0, "keydown on input 4");
   is(childWinObj.gKeyPressChild, 0, "keypress on input 4");
   is(childWinObj.gKeyUpChild, 0, "keyup on input 4");
 
   var i4 = frames[0].document.getElementById("i4");
@@ -66,17 +66,17 @@ function runTest()
 
   is(document.activeElement, $("iframe"), "parent focus");
   is(frames[0].document.activeElement, i4, "child focus");
 
   // key events should also be retargeted when the focus changes to an
   // element in a chrome document from a content document.
   i4.addEventListener("keydown", () => $("i3").focus());
 
-  synthesizeKey("c", { code: "KeyC", keyCode: KeyboardEvent.DOM_VK_C });
+  synthesizeKey("c", {});
 
   is(gKeyDown3, 1, "keydown on input 3");
   is(gKeyPress3, 1, "keypress on input 3");
   is(gKeyUp3, 1, "keyup on input 3");
   is(childWinObj.gKeyDownChild, 1, "keydown on input 4");
   is(childWinObj.gKeyPressChild, 1, "keypress on input 4");
   is(childWinObj.gKeyUpChild, 1, "keyup on input 4");
 
--- a/layout/forms/test/test_bug348236.html
+++ b/layout/forms/test/test_bug348236.html
@@ -41,17 +41,17 @@ addLoadEvent(function test() {
         CI = SpecialPowers.Components.interfaces,
         WinUtils = SpecialPowers.getDOMWindowUtils(window),
         sec = netscape.security,
         eSelect = $("eSelect"),
         timeout = 0 // Choose a larger value like 500 ms if you want to see what's happening.
 
     function keypressOnSelect(key) {
         eSelect.focus();
-        synthesizeKey(key.key, {code: key.code, altKey: key.altKey});
+        synthesizeKey(key.key, {altKey: key.altKey});
     }
 
     function testKey(key, keyString, functionToContinue) {
         var selectGotClick
         function clickListener() { selectGotClick = true }
         eSelect.selectedIndex = 0
         eSelect.onchangeCount = 0
 
@@ -88,29 +88,29 @@ addLoadEvent(function test() {
     }
 
 
     // Quick sanity checks.
     is(eSelect.value, "1", "SELECT value should be 1 after load.")
     is(eSelect.selectedIndex, 0, "SELECT selectedIndex should be 0 after load.")
 
     // Check if sending key events works.
-    keypressOnSelect({key: "KEY_ArrowDown", code: "ArrowDown"});
+    keypressOnSelect({key: "KEY_ArrowDown"});
     is(eSelect.value, "2", "SELECT value should be 2 after pressing Down.")
       
     // Test ALT-Down.
-    testKey({key: "KEY_ArrowDown", code: "ArrowDown", altKey: true}, "ALT-Down", nextKey1)
+    testKey({key: "KEY_ArrowDown", altKey: true}, "ALT-Down", nextKey1)
     function nextKey1() {
         // Test ALT-Up.
-        testKey({key: "KEY_ArrowUp", code: "ArrowUp", altKey: true}, "ALT-Up", nextKey2)
+        testKey({key: "KEY_ArrowUp", altKey: true}, "ALT-Up", nextKey2)
     }
     function nextKey2() {
         // Test the F4 key on Windows.
         if (/Win/i.test(navigator.platform))
-            testKey({key: "KEY_F4", code: "F4"}, "F4", finished)
+            testKey({key: "KEY_F4"}, "F4", finished)
         else
             finished()
     }
     function finished() {
     // Reset value to get the expected value if we reload the page.
         eSelect.selectedIndex = 0
         SimpleTest.finish()
     }
--- a/layout/forms/test/test_bug402198.html
+++ b/layout/forms/test/test_bug402198.html
@@ -48,17 +48,17 @@ function doe3() {
   document.documentElement.style.display = 'none';
   document.body.offsetHeight;
   document.documentElement.style.display = '';
   document.body.offsetHeight;
 
   document.getElementById('a').focus();
   document.body.style.display = 'none';
 
-  synthesizeKey('KEY_Tab', { code: "Tab", shiftKey: true });
+  synthesizeKey('KEY_Tab', {shiftKey: true});
 
   is(0, 0, "this is a crash/assertion test, so we're ok if we survived this far");
   setTimeout(function() {document.body.style.display = ''; SimpleTest.finish();}, 0);
 }
 
 function do_test() {
   setTimeout(doe3,300);
 }
--- a/layout/forms/test/test_bug411236.html
+++ b/layout/forms/test/test_bug411236.html
@@ -25,17 +25,17 @@ https://bugzilla.mozilla.org/show_bug.cg
 window.oTarget = null;
 window.fileInputGotClick = false;
 
 function test() {
   // Try to find the 'Browse...' using tabbing.
   var i = 0;
   while (!window.oTarget && i < 100) {
     ++i;
-    synthesizeKey("KEY_Tab", {code: "Tab"});
+    synthesizeKey("KEY_Tab", {});
   }
 
   if (i >= 100) {
     ok(false, "Couldn't find an input element!");
     SimpleTest.finish();
     return;
   }
 
--- a/layout/forms/test/test_bug935876.html
+++ b/layout/forms/test/test_bug935876.html
@@ -122,76 +122,76 @@ function runTests()
   SpecialPowers.addSystemEventListener(listbox, "keydown", onkeydownInSystemEventGroup, false);
 
   listbox.focus();
 
   [ false, true ].forEach(function (consume) {
     doPreventDefault = consume;
     for (var i = 0; i < listbox.options.length + 1; i++) {
       reset()
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+      synthesizeKey("KEY_ArrowDown", {});
       check(true, false, "DownArrow key on listbox #" + i);
     }
 
     for (var i = 0; i < listbox.options.length + 1; i++) {
       reset()
-      synthesizeKey("KEY_ArrowUp", {code: "ArrowUp"});
+      synthesizeKey("KEY_ArrowUp", {});
       check(true, false, "'ArrowUp' key on listbox #" + i);
     }
 
     for (var i = 0; i < listbox.options.length + 1; i++) {
       reset()
-      synthesizeKey("KEY_ArrowRight", {code: "ArrowRight"});
+      synthesizeKey("KEY_ArrowRight", {});
       check(true, false, "'ArrowRight' key on listbox #" + i);
     }
 
     for (var i = 0; i < listbox.options.length + 1; i++) {
       reset()
-      synthesizeKey("KEY_ArrowLeft", {code: "ArrowLeft"});
+      synthesizeKey("KEY_ArrowLeft", {});
       check(true, false, "'ArrowLeft' key on listbox #" + i);
     }
 
     for (var i = 0; i < 4; i++) {
       reset()
-      synthesizeKey("KEY_PageDown", {code: "PageDown"});
+      synthesizeKey("KEY_PageDown", {});
       check(true, false, "'PageDown' key on listbox #" + i);
     }
 
     for (var i = 0; i < 4; i++) {
       reset()
-      synthesizeKey("KEY_PageUp", {code: "PageUp"});
+      synthesizeKey("KEY_PageUp", {});
       check(true, false, "'PageUp' key on listbox #" + i);
     }
 
     for (var i = 0; i < 2; i++) {
       reset()
-      synthesizeKey("KEY_End", {code: "End"});
+      synthesizeKey("KEY_End", {});
       check(true, false, "'End' key on listbox #" + i);
     }
 
     for (var i = 0; i < 2; i++) {
       reset()
-      synthesizeKey("KEY_Home", {code: "Home"});
+      synthesizeKey("KEY_Home", {});
       check(true, false, "'Home' key on listbox #" + i);
     }
 
     reset()
-    synthesizeKey("KEY_Enter", {code: "Enter"});
+    synthesizeKey("KEY_Enter", {});
     check(false, true, "'Enter' key on listbox");
 
     reset()
-    synthesizeKey("KEY_Escape", {code: "Escape"});
+    synthesizeKey("KEY_Escape", {});
     check(false, false, "'Escape' key on listbox");
 
     reset()
-    synthesizeKey("KEY_F4", {code: "F4"});
+    synthesizeKey("KEY_F4", {});
     check(false, false, "F4 key on listbox");
 
     reset()
-    synthesizeKey("a", {code: "KeyA"});
+    synthesizeKey("a", {});
     check(false, true, "'A' key on listbox");
   });
 
   listbox.removeEventListener("keydown", onKeydown);
   listbox.removeEventListener("keypress", onKeypress);
   SpecialPowers.removeSystemEventListener(listbox, "keydown", onkeydownInSystemEventGroup, false);
 
 
@@ -202,76 +202,76 @@ function runTests()
   SpecialPowers.addSystemEventListener(multipleListbox, "keydown", onkeydownInSystemEventGroup, false);
 
   multipleListbox.focus();
 
   [ false, true ].forEach(function (consume) {
     doPreventDefault = consume;
     for (var i = 0; i < multipleListbox.options.length + 1; i++) {
       reset()
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+      synthesizeKey("KEY_ArrowDown", {});
       check(true, false, "'ArrowDown' key on multiple listbox #" + i);
     }
 
     for (var i = 0; i < multipleListbox.options.length + 1; i++) {
       reset()
-      synthesizeKey("KEY_ArrowUp", {code: "ArrowUp"});
+      synthesizeKey("KEY_ArrowUp", {});
       check(true, false, "'ArrowUp' key on multiple listbox #" + i);
     }
 
     for (var i = 0; i < multipleListbox.options.length + 1; i++) {
       reset()
-      synthesizeKey("KEY_ArrowRight", {code: "ArrowRight"});
+      synthesizeKey("KEY_ArrowRight", {});
       check(true, false, "'ArrowRight' key on multiple listbox #" + i);
     }
 
     for (var i = 0; i < multipleListbox.options.length + 1; i++) {
       reset()
-      synthesizeKey("KEY_ArrowLeft", {code: "ArrowLeft"});
+      synthesizeKey("KEY_ArrowLeft", {});
       check(true, false, "'ArrowLeft' key on multiple listbox #" + i);
     }
 
     for (var i = 0; i < 4; i++) {
       reset()
-      synthesizeKey("KEY_PageDown", {code: "PageDown"});
+      synthesizeKey("KEY_PageDown", {});
       check(true, false, "'PageDown' key on multiple listbox #" + i);
     }
 
     for (var i = 0; i < 4; i++) {
       reset()
-      synthesizeKey("KEY_PageUp", {code: "PageUp"});
+      synthesizeKey("KEY_PageUp", {});
       check(true, false, "'PageUp' key on multiple listbox #" + i);
     }
 
     for (var i = 0; i < 2; i++) {
       reset()
-      synthesizeKey("KEY_End", {code: "End"});
+      synthesizeKey("KEY_End", {});
       check(true, false, "'End' key on multiple listbox #" + i);
     }
 
     for (var i = 0; i < 2; i++) {
       reset()
-      synthesizeKey("KEY_Home", {code: "Home"});
+      synthesizeKey("KEY_Home", {});
       check(true, false, "'Home' key on multiple listbox #" + i);
     }
 
     reset()
-    synthesizeKey("KEY_Enter", {code: "Enter"});
+    synthesizeKey("KEY_Enter", {});
     check(true, true, "'Enter' key on multiple listbox");
 
     reset()
-    synthesizeKey("KEY_Escape", {code: "Escape"});
+    synthesizeKey("KEY_Escape", {});
     check(false, false, "'Escape' key on multiple listbox");
 
     reset()
-    synthesizeKey("KEY_F4", {code: "F4"});
+    synthesizeKey("KEY_F4", {});
     check(false, false, "'F4' key on multiple listbox");
 
     reset()
-    synthesizeKey("a", {code: "KeyA"});
+    synthesizeKey("a", {});
     check(false, true, "'A' key on multiple listbox");
   });
 
   multipleListbox.removeEventListener("keydown", onKeydown);
   multipleListbox.removeEventListener("keypress", onKeypress);
   SpecialPowers.removeSystemEventListener(multipleListbox, "keydown", onkeydownInSystemEventGroup, false);
 
 
@@ -283,81 +283,81 @@ function runTests()
 
   combobox.focus();
 
   [ false, true ].forEach(function (consume) {
     doPreventDefault = consume;
     if (!kIsMac) {
       for (var i = 0; i < combobox.options.length + 1; i++) {
         reset()
-        synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+        synthesizeKey("KEY_ArrowDown", {});
         check(true, false, "'ArrowDown' key on combobox #" + i);
       }
 
       for (var i = 0; i < combobox.options.length + 1; i++) {
         reset()
-        synthesizeKey("KEY_ArrowUp", {code: "ArrowUp"});
+        synthesizeKey("KEY_ArrowUp", {});
         check(true, false, "'ArrowUp' key on combobox #" + i);
       }
     } else {
       todo(false, "Make this test work on OSX");
     }
 
     for (var i = 0; i < combobox.options.length + 1; i++) {
       reset()
-      synthesizeKey("KEY_ArrowRight", {code: "ArrowRight"});
+      synthesizeKey("KEY_ArrowRight", {});
       check(true, false, "'ArrowRight' key on combobox #" + i);
     }
 
     for (var i = 0; i < combobox.options.length + 1; i++) {
       reset()
-      synthesizeKey("KEY_ArrowLeft", {code: "ArrowLeft"});
+      synthesizeKey("KEY_ArrowLeft", {});
       check(true, false, "'ArrowLeft' key on combobox #" + i);
     }
 
     for (var i = 0; i < 4; i++) {
       reset()
-      synthesizeKey("KEY_PageDown", {code: "PageDown"});
+      synthesizeKey("KEY_PageDown", {});
       check(true, false, "'PageDown' key on combobox #" + i);
     }
 
     for (var i = 0; i < 4; i++) {
       reset()
-      synthesizeKey("KEY_PageUp", {code: "PageUp"});
+      synthesizeKey("KEY_PageUp", {});
       check(true, false, "'PageUp' key on combobox #" + i);
     }
 
     for (var i = 0; i < 2; i++) {
       reset()
-      synthesizeKey("KEY_End", {code: "End"});
+      synthesizeKey("KEY_End", {});
       check(true, false, "'End' key on combobox #" + i);
     }
 
     for (var i = 0; i < 2; i++) {
       reset()
-      synthesizeKey("KEY_Home", {code: "Home"});
+      synthesizeKey("KEY_Home", {});
       check(true, false, "'Home' key on combobox #" + i);
     }
 
     reset()
-    synthesizeKey("KEY_Enter", {code: "Enter"});
+    synthesizeKey("KEY_Enter", {});
     check(false, true, "'Enter' key on combobox");
 
     reset()
-    synthesizeKey("KEY_Escape", {code: "Escape"});
+    synthesizeKey("KEY_Escape", {});
     check(true, false, "'Escape' key on combobox");
 
     if (!kIsWin) {
       reset()
-      synthesizeKey("KEY_F4", {code: "F4"});
+      synthesizeKey("KEY_F4", {});
       check(false, false, "'F4' key on combobox");
     }
 
     reset()
-    synthesizeKey("a", {code: "KeyA"});
+    synthesizeKey("a", {});
     check(false, true, "'A' key on combobox");
   });
 
   function finish()
   {
     combobox.removeEventListener("keydown", onKeydown);
     combobox.removeEventListener("keypress", onKeypress);
     SpecialPowers.removeSystemEventListener(combobox, "keydown", onkeydownInSystemEventGroup, false);
@@ -371,101 +371,101 @@ function runTests()
     finish();
     return;
   }
 
   function testDropDown(aCallback)
   {
     testOpenDropDown(function () {
       reset()
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown", altKey: true});
+      synthesizeKey("KEY_ArrowDown", {altKey: true});
     }, function () {
       check(true, false, "Alt + DownArrow key on combobox at opening dropdown");
 
       for (var i = 0; i < combobox.options.length + 1; i++) {
         reset()
-        synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+        synthesizeKey("KEY_ArrowDown", {});
         check(true, false, "'ArrowDown' key on combobox during dropdown open #" + i);
       }
 
       for (var i = 0; i < combobox.options.length + 1; i++) {
         reset()
-        synthesizeKey("KEY_ArrowUp", {code: "ArrowUp"});
+        synthesizeKey("KEY_ArrowUp", {});
         check(true, false, "'ArrowUp' key on combobox during dropdown open #" + i);
       }
 
       for (var i = 0; i < combobox.options.length + 1; i++) {
         reset()
-        synthesizeKey("KEY_ArrowRight", {code: "ArrowRight"});
+        synthesizeKey("KEY_ArrowRight", {});
         check(true, false, "'ArrowRight' key on combobox during dropdown open #" + i);
       }
 
       for (var i = 0; i < combobox.options.length + 1; i++) {
         reset()
-        synthesizeKey("KEY_ArrowLeft", {code: "ArrowLeft"});
+        synthesizeKey("KEY_ArrowLeft", {});
         check(true, false, "'ArrowLeft' key on combobox during dropdown open #" + i);
       }
 
       for (var i = 0; i < 4; i++) {
         reset()
-        synthesizeKey("KEY_PageDown", {code: "PageDown"});
+        synthesizeKey("KEY_PageDown", {});
         check(true, false, "'PageDown' key on combobox during dropdown open #" + i);
       }
 
       for (var i = 0; i < 4; i++) {
         reset()
-        synthesizeKey("KEY_PageUp", {code: "PageUp"});
+        synthesizeKey("KEY_PageUp", {});
         check(true, false, "'PageUp' key on combobox during dropdown open #" + i);
       }
 
       for (var i = 0; i < 2; i++) {
         reset()
-        synthesizeKey("KEY_End", {code: "End"});
+        synthesizeKey("KEY_End", {});
         check(true, false, "'End' key on combobox during dropdown open #" + i);
       }
 
       for (var i = 0; i < 2; i++) {
         reset()
-        synthesizeKey("KEY_Home", {code: "Home"});
+        synthesizeKey("KEY_Home", {});
         check(true, false, "'Home' key on combobox during dropdown open #" + i);
       }
 
       testCloseDropDown(function () {
         reset()
-        synthesizeKey("KEY_Enter", {code: "Enter"});
+        synthesizeKey("KEY_Enter", {});
       }, function () {
         testOpenDropDown(function () {
           check(true, true, "'Enter' key on combobox at closing dropdown");
 
-          synthesizeKey("KEY_ArrowUp", {code: "ArrowUp", altKey: true});
+          synthesizeKey("KEY_ArrowUp", {altKey: true});
         }, function () {
           check(true, false, "'Alt' + 'ArrowUp' key on combobox at opening dropdown");
 
           testCloseDropDown(function () {
             reset()
-            synthesizeKey("KEY_Escape", {code: "Escape"});
+            synthesizeKey("KEY_Escape", {});
           }, function () {
             check(true, false, "'Escape' key on combobox at closing dropdown");
 
             // F4 key opens/closes dropdown only on Windows. So, other platforms
             // don't need to do anymore.
             if (!kIsWin) {
               aCallback();
               return;
             }
 
             testOpenDropDown(function () {
               reset()
-              synthesizeKey("KEY_F4", {code: "F4"});
+              synthesizeKey("KEY_F4", {});
             }, function () {
               check(true, false, "'F4' key on combobox at opening dropdown on Windows");
 
               testCloseDropDown(function () {
                 reset()
-                synthesizeKey("KEY_F4", {code: "F4"});
+                synthesizeKey("KEY_F4", {});
               }, function () {
                 check(true, false, "'F4' key on combobox at closing dropdown on Windows");
 
                 aCallback();
                 return;
               });
             });
           });
--- a/layout/style/test/test_flexbox_focus_order.html
+++ b/layout/style/test/test_flexbox_focus_order.html
@@ -55,17 +55,17 @@ function doTest() {
   // First, we focus something just before the flex container:
   document.getElementById('beforeContainer').focus();
   is(document.activeElement, document.getElementById('beforeContainer'),
      "explicitly-focused link should gain focus");
 
   // And then we advance focus across the focusable things in the flex container
   // and check that we traverse them in the expected order:
   for (let expectedId of gExpectedFocusedIds) {
-    synthesizeKey("KEY_Tab", {code: "Tab"});
+    synthesizeKey("KEY_Tab", {});
     is(document.activeElement, document.getElementById(expectedId),
        "expecting element '#" + expectedId + "' to be focused");
   }
 
   SimpleTest.finish();
 }
 
 // Before we start, we have to bump Mac to make its 'tab'-key focus behavior
--- a/toolkit/components/extensions/test/mochitest/test_chrome_ext_downloads_open.html
+++ b/toolkit/components/extensions/test/mochitest/test_chrome_ext_downloads_open.html
@@ -96,17 +96,17 @@ add_task(async function downloads_open_i
 
   let extension = ExtensionTestUtils.loadExtension(extensionData);
   await extension.startup();
 
   let url = await extension.awaitMessage("ready");
   let win = window.open(url);
   await extension.awaitMessage("page-ready");
 
-  synthesizeKey("a", {code: "KeyA"}, win);
+  synthesizeKey("a", {}, win);
   let result = await extension.awaitMessage("download-open.result");
 
   is(result.success, false, "Opening download fails.");
   is(result.error, "Invalid download id 10", "The error is informative.");
 
 
   await extension.unload();
 });
--- a/toolkit/components/extensions/test/mochitest/test_chrome_ext_permissions.html
+++ b/toolkit/components/extensions/test/mochitest/test_chrome_ext_permissions.html
@@ -117,17 +117,17 @@ function makeTest(manifestPermissions, o
     }
 
     // Making a cross-origin request from a content script should fail
     if (checkFetch) {
       result = await testContentScript();
       is(result, false, "fetch() failed from content script due to lack of host permission");
     }
 
-    synthesizeKey("a", {code: "KeyA"}, win);
+    synthesizeKey("a", {}, win);
     result = await extension.awaitMessage("request.result");
     is(result, true, "permissions.request() succeeded");
 
     // Using the cookies API from an extension page should succeed
     result = await call("set-cookie");
     is(result.success, true, "setting cookie succeeded");
 
     // Making a cross-origin request from a content script should succeed
--- a/toolkit/components/passwordmgr/test/chrome/subtst_privbrowsing_4.html
+++ b/toolkit/components/passwordmgr/test/chrome/subtst_privbrowsing_4.html
@@ -16,23 +16,23 @@
   <input id="user" name="user" type="text">
   <input id="pass" name="pass" type="password">
   <button type='submit'>Submit</button>
 </form>
 
 <script>
 function startAutocomplete() {
   userField.focus();
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+  synthesizeKey("KEY_ArrowDown", {});
   setTimeout(submitForm, 100);
 }
 
 function submitForm() {
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-  synthesizeKey("KEY_Enter", {code: "Enter"});
+  synthesizeKey("KEY_ArrowDown", {});
+  synthesizeKey("KEY_Enter", {});
   setTimeout(function() { form.submit(); }, 100);
 }
 
 var form      = document.getElementById("form");
 var userField = document.getElementById("user");
 
 window.addEventListener("message", () => { startAutocomplete(); });
 
--- a/toolkit/components/passwordmgr/test/mochitest/test_autocomplete_https_upgrade.html
+++ b/toolkit/components/passwordmgr/test/mochitest/test_autocomplete_https_upgrade.html
@@ -92,123 +92,123 @@ add_task(async function setup() {
 add_task(async function test_empty_first_entry() {
   // Make sure initial form is empty.
   checkACForm("", "");
   // Trigger autocomplete popup
   restoreForm();
   let popupState = await getPopupState();
   is(popupState.open, false, "Check popup is initially closed");
   let shownPromise = promiseACShown();
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+  synthesizeKey("KEY_ArrowDown", {});
   let results = await shownPromise;
   popupState = await getPopupState();
   is(popupState.selectedIndex, -1, "Check no entries are selected");
   checkArrayValues(results, ["name", "name1", "name2"], "initial");
 
   // Check first entry
   let index0Promise = notifySelectedIndex(0);
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+  synthesizeKey("KEY_ArrowDown", {});
   await index0Promise;
   checkACForm("", ""); // value shouldn't update
-  synthesizeKey("KEY_Enter", {code: "Enter"});
+  synthesizeKey("KEY_Enter", {});
   await promiseFormsProcessed();
   checkACForm("name", "pass");
 });
 
 add_task(async function test_empty_second_entry() {
   restoreForm();
   let shownPromise = promiseACShown();
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // open
+  synthesizeKey("KEY_ArrowDown", {}); // open
   await shownPromise;
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // first
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // second
-  synthesizeKey("KEY_Enter", {code: "Enter"});
+  synthesizeKey("KEY_ArrowDown", {}); // first
+  synthesizeKey("KEY_ArrowDown", {}); // second
+  synthesizeKey("KEY_Enter", {});
   await promiseFormsProcessed();
   checkACForm("name1", "pass1");
 });
 
 add_task(async function test_search() {
   restoreForm();
   let shownPromise = promiseACShown();
   // We need to blur for the autocomplete controller to notice the forced value below.
   uname.blur();
   uname.value = "name";
   uname.focus();
   sendChar("1");
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // open
+  synthesizeKey("KEY_ArrowDown", {}); // open
   let results = await shownPromise;
   checkArrayValues(results, ["name1"], "check result deduping for 'name1'");
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // first
-  synthesizeKey("KEY_Enter", {code: "Enter"});
+  synthesizeKey("KEY_ArrowDown", {}); // first
+  synthesizeKey("KEY_Enter", {});
   await promiseFormsProcessed();
   checkACForm("name1", "pass1");
 
   let popupState = await getPopupState();
   is(popupState.open, false, "Check popup is now closed");
 });
 
 add_task(async function test_delete_first_entry() {
   restoreForm();
   uname.focus();
   let shownPromise = promiseACShown();
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+  synthesizeKey("KEY_ArrowDown", {});
   await shownPromise;
 
   let index0Promise = notifySelectedIndex(0);
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+  synthesizeKey("KEY_ArrowDown", {});
   await index0Promise;
 
   let deletionPromise = promiseStorageChanged(["removeLogin"]);
   // On OS X, shift-backspace and shift-delete work, just delete does not.
   // On Win/Linux, shift-backspace does not work, delete and shift-delete do.
-  synthesizeKey("KEY_Delete", {code: "Delete", shiftKey: true});
+  synthesizeKey("KEY_Delete", {shiftKey: true});
   await deletionPromise;
   checkACForm("", "");
 
   let results = await notifyMenuChanged(2, "name1");
 
   checkArrayValues(results, ["name1", "name2"], "two should remain after deleting the first");
   let popupState = await getPopupState();
   is(popupState.open, true, "Check popup stays open after deleting");
-  synthesizeKey("KEY_Escape", {code: "Escape"});
+  synthesizeKey("KEY_Escape", {});
   popupState = await getPopupState();
   is(popupState.open, false, "Check popup closed upon ESC");
 });
 
 add_task(async function test_delete_duplicate_entry() {
   restoreForm();
   uname.focus();
   let shownPromise = promiseACShown();
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+  synthesizeKey("KEY_ArrowDown", {});
   await shownPromise;
 
   let index0Promise = notifySelectedIndex(0);
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+  synthesizeKey("KEY_ArrowDown", {});
   await index0Promise;
 
   let deletionPromise = promiseStorageChanged(["removeLogin"]);
   // On OS X, shift-backspace and shift-delete work, just delete does not.
   // On Win/Linux, shift-backspace does not work, delete and shift-delete do.
-  synthesizeKey("KEY_Delete", {code: "Delete", shiftKey: true});
+  synthesizeKey("KEY_Delete", {shiftKey: true});
   await deletionPromise;
   checkACForm("", "");
 
   is(LoginManager.countLogins("http://example.org", "http://example.org", null), 1,
      "Check that the HTTP login remains");
   is(LoginManager.countLogins("https://example.org", "https://example.org", null), 0,
      "Check that the HTTPS login was deleted");
 
   // Two menu items should remain as the HTTPS login should have been deleted but
   // the HTTP would remain.
   let results = await notifyMenuChanged(1, "name2");
 
   checkArrayValues(results, ["name2"], "one should remain after deleting the HTTPS name1");
   let popupState = await getPopupState();
   is(popupState.open, true, "Check popup stays open after deleting");
-  synthesizeKey("KEY_Escape", {code: "Escape"});
+  synthesizeKey("KEY_Escape", {});
   popupState = await getPopupState();
   is(popupState.open, false, "Check popup closed upon ESC");
 });
 
 </script>
 </pre>
 </body>
 </html>
--- a/toolkit/components/passwordmgr/test/mochitest/test_autofocus_js.html
+++ b/toolkit/components/passwordmgr/test/mochitest/test_autofocus_js.html
@@ -57,18 +57,18 @@ add_task(async function setup() {
   iframeDoc = iframe.contentDocument;
 
   SimpleTest.requestFlakyTimeout("Giving a chance for the unexpected popupshown to occur");
 });
 
 add_task(async function test_initial_focus() {
   let results = await notifyMenuChanged(2, "name");
   checkArrayValues(results, ["name", "name1"], "Two results");
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-  synthesizeKey("KEY_Enter", {code: "Enter"});
+  synthesizeKey("KEY_ArrowDown", {});
+  synthesizeKey("KEY_Enter", {});
   await promiseFormsProcessed();
   is(iframeDoc.getElementById("form-basic-password").value, "pass", "Check first password filled");
   let popupState = await getPopupState();
   is(popupState.open, false, "Check popup is now closed");
 });
 
 // This depends on the filling from the previous test.
 add_task(async function test_not_reopened_if_filled() {
--- a/toolkit/components/passwordmgr/test/mochitest/test_basic_form_autocomplete.html
+++ b/toolkit/components/passwordmgr/test/mochitest/test_basic_form_autocomplete.html
@@ -223,214 +223,214 @@ add_task(async function test_form1_initi
   is(popupState.open, false, "Check popup is initially closed");
 });
 
 add_task(async function test_form1_menuitems() {
   await SimpleTest.promiseFocus(window);
   // Trigger autocomplete popup
   restoreForm();
   let shownPromise = promiseACShown();
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // open
+  synthesizeKey("KEY_ArrowDown", {}); // open
   let results = await shownPromise;
 
   let popupState = await getPopupState();
   is(popupState.selectedIndex, -1, "Check no entries are selected upon opening");
 
   let expectedMenuItems = ["tempuser1",
                            "testuser2",
                            "testuser3",
                            "zzzuser4"];
   checkArrayValues(results, expectedMenuItems, "Check all menuitems are displayed correctly.");
 
   checkACForm("", ""); // value shouldn't update just by selecting
-  synthesizeKey("KEY_Enter", {code: "Enter"});
+  synthesizeKey("KEY_Enter", {});
   await spinEventLoop(); // let focus happen
   checkACForm("", "");
 });
 
 add_task(async function test_form1_first_entry() {
   await SimpleTest.promiseFocus(window);
   // Trigger autocomplete popup
   restoreForm();
   let shownPromise = promiseACShown();
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // open
+  synthesizeKey("KEY_ArrowDown", {}); // open
   await shownPromise;
 
   let popupState = await getPopupState();
   is(popupState.selectedIndex, -1, "Check no entries are selected upon opening");
 
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // first
+  synthesizeKey("KEY_ArrowDown", {}); // first
   checkACForm("", ""); // value shouldn't update just by selecting
-  synthesizeKey("KEY_Enter", {code: "Enter"});
+  synthesizeKey("KEY_Enter", {});
   await promiseFormsProcessed();
   checkACForm("tempuser1", "temppass1");
 });
 
 add_task(async function test_form1_second_entry() {
   // Trigger autocomplete popup
   restoreForm();
   let shownPromise = promiseACShown();
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // open
+  synthesizeKey("KEY_ArrowDown", {}); // open
   await shownPromise;
 
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // first
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // second
-  synthesizeKey("KEY_Enter", {code: "Enter"});
+  synthesizeKey("KEY_ArrowDown", {}); // first
+  synthesizeKey("KEY_ArrowDown", {}); // second
+  synthesizeKey("KEY_Enter", {});
   await promiseFormsProcessed();
   checkACForm("testuser2", "testpass2");
 });
 
 add_task(async function test_form1_third_entry() {
   // Trigger autocomplete popup
   restoreForm();
   let shownPromise = promiseACShown();
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // open
+  synthesizeKey("KEY_ArrowDown", {}); // open
   await shownPromise;
 
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // first
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // second
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // third
-  synthesizeKey("KEY_Enter", {code: "Enter"});
+  synthesizeKey("KEY_ArrowDown", {}); // first
+  synthesizeKey("KEY_ArrowDown", {}); // second
+  synthesizeKey("KEY_ArrowDown", {}); // third
+  synthesizeKey("KEY_Enter", {});
   await promiseFormsProcessed();
   checkACForm("testuser3", "testpass3");
 });
 
 add_task(async function test_form1_fourth_entry() {
   // Trigger autocomplete popup
   restoreForm();
   let shownPromise = promiseACShown();
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // open
+  synthesizeKey("KEY_ArrowDown", {}); // open
   await shownPromise;
 
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // first
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // second
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // third
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // fourth
-  synthesizeKey("KEY_Enter", {code: "Enter"});
+  synthesizeKey("KEY_ArrowDown", {}); // first
+  synthesizeKey("KEY_ArrowDown", {}); // second
+  synthesizeKey("KEY_ArrowDown", {}); // third
+  synthesizeKey("KEY_ArrowDown", {}); // fourth
+  synthesizeKey("KEY_Enter", {});
   await promiseFormsProcessed();
   checkACForm("zzzuser4", "zzzpass4");
 });
 
 add_task(async function test_form1_wraparound_first_entry() {
   // Trigger autocomplete popup
   restoreForm();
   await spinEventLoop(); // let focus happen
   let shownPromise = promiseACShown();
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // open
+  synthesizeKey("KEY_ArrowDown", {}); // open
   await shownPromise;
 
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // first
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // second
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // third
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // fourth
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // deselects
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // first
-  synthesizeKey("KEY_Enter", {code: "Enter"});
+  synthesizeKey("KEY_ArrowDown", {}); // first
+  synthesizeKey("KEY_ArrowDown", {}); // second
+  synthesizeKey("KEY_ArrowDown", {}); // third
+  synthesizeKey("KEY_ArrowDown", {}); // fourth
+  synthesizeKey("KEY_ArrowDown", {}); // deselects
+  synthesizeKey("KEY_ArrowDown", {}); // first
+  synthesizeKey("KEY_Enter", {});
   await promiseFormsProcessed();
   checkACForm("tempuser1", "temppass1");
 });
 
 add_task(async function test_form1_wraparound_up_last_entry() {
   // Trigger autocomplete popup
   restoreForm();
   let shownPromise = promiseACShown();
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // open
+  synthesizeKey("KEY_ArrowDown", {}); // open
   await shownPromise;
 
-  synthesizeKey("KEY_ArrowUp", {code: "ArrowUp"}); // last (fourth)
-  synthesizeKey("KEY_Enter", {code: "Enter"});
+  synthesizeKey("KEY_ArrowUp", {}); // last (fourth)
+  synthesizeKey("KEY_Enter", {});
   await promiseFormsProcessed();
   checkACForm("zzzuser4", "zzzpass4");
 });
 
 add_task(async function test_form1_wraparound_down_up_up() {
   // Trigger autocomplete popup
   restoreForm();
   let shownPromise = promiseACShown();
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // open
+  synthesizeKey("KEY_ArrowDown", {}); // open
   await shownPromise;
 
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // select first entry
-  synthesizeKey("KEY_ArrowUp", {code: "ArrowUp"}); // selects nothing!
-  synthesizeKey("KEY_ArrowUp", {code: "ArrowUp"}); // select last entry
-  synthesizeKey("KEY_Enter", {code: "Enter"});
+  synthesizeKey("KEY_ArrowDown", {}); // select first entry
+  synthesizeKey("KEY_ArrowUp", {}); // selects nothing!
+  synthesizeKey("KEY_ArrowUp", {}); // select last entry
+  synthesizeKey("KEY_Enter", {});
   await promiseFormsProcessed();
   checkACForm("zzzuser4", "zzzpass4");
 });
 
 add_task(async function test_form1_wraparound_up_last() {
   restoreForm();
   let shownPromise = promiseACShown();
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // open
+  synthesizeKey("KEY_ArrowDown", {}); // open
   await shownPromise;
 
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-  synthesizeKey("KEY_ArrowUp", {code: "ArrowUp"}); // deselects
-  synthesizeKey("KEY_ArrowUp", {code: "ArrowUp"}); // last entry
-  synthesizeKey("KEY_ArrowUp", {code: "ArrowUp"});
-  synthesizeKey("KEY_ArrowUp", {code: "ArrowUp"});
-  synthesizeKey("KEY_ArrowUp", {code: "ArrowUp"}); // first entry
-  synthesizeKey("KEY_ArrowUp", {code: "ArrowUp"}); // deselects
-  synthesizeKey("KEY_ArrowUp", {code: "ArrowUp"}); // last entry
-  synthesizeKey("KEY_Enter", {code: "Enter"});
+  synthesizeKey("KEY_ArrowDown", {});
+  synthesizeKey("KEY_ArrowUp", {}); // deselects
+  synthesizeKey("KEY_ArrowUp", {}); // last entry
+  synthesizeKey("KEY_ArrowUp", {});
+  synthesizeKey("KEY_ArrowUp", {});
+  synthesizeKey("KEY_ArrowUp", {}); // first entry
+  synthesizeKey("KEY_ArrowUp", {}); // deselects
+  synthesizeKey("KEY_ArrowUp", {}); // last entry
+  synthesizeKey("KEY_Enter", {});
   await promiseFormsProcessed();
   checkACForm("zzzuser4", "zzzpass4");
 });
 
 add_task(async function test_form1_fill_username_without_autofill_right() {
   restoreForm();
   let shownPromise = promiseACShown();
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // open
+  synthesizeKey("KEY_ArrowDown", {}); // open
   await shownPromise;
 
   // Set first entry w/o triggering autocomplete
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // first
-  synthesizeKey("KEY_ArrowRight", {code: "ArrowRight"});
+  synthesizeKey("KEY_ArrowDown", {}); // first
+  synthesizeKey("KEY_ArrowRight", {});
   await spinEventLoop();
   checkACForm("tempuser1", ""); // empty password
 });
 
 add_task(async function test_form1_fill_username_without_autofill_left() {
   restoreForm();
   let shownPromise = promiseACShown();
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // open
+  synthesizeKey("KEY_ArrowDown", {}); // open
   await shownPromise;
 
   // Set first entry w/o triggering autocomplete
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // first
-  synthesizeKey("KEY_ArrowLeft", {code: "ArrowLeft"});
+  synthesizeKey("KEY_ArrowDown", {}); // first
+  synthesizeKey("KEY_ArrowLeft", {});
   checkACForm("tempuser1", ""); // empty password
 });
 
 add_task(async function test_form1_pageup_first() {
   restoreForm();
   let shownPromise = promiseACShown();
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // open
+  synthesizeKey("KEY_ArrowDown", {}); // open
   await shownPromise;
 
   // Check first entry (page up)
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // first
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // second
-  synthesizeKey("KEY_PageUp", {code: "PageUp"}); // first
-  synthesizeKey("KEY_Enter", {code: "Enter"});
+  synthesizeKey("KEY_ArrowDown", {}); // first
+  synthesizeKey("KEY_ArrowDown", {}); // second
+  synthesizeKey("KEY_PageUp", {}); // first
+  synthesizeKey("KEY_Enter", {});
   await promiseFormsProcessed();
   checkACForm("tempuser1", "temppass1");
 });
 
 add_task(async function test_form1_pagedown_last() {
   restoreForm();
   let shownPromise = promiseACShown();
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // open
+  synthesizeKey("KEY_ArrowDown", {}); // open
   await shownPromise;
 
   /* test 13 */
   // Check last entry (page down)
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // first
-  synthesizeKey("KEY_PageDown", {code: "PageDown"}); // last
-  synthesizeKey("KEY_Enter", {code: "Enter"});
+  synthesizeKey("KEY_ArrowDown", {}); // first
+  synthesizeKey("KEY_PageDown", {}); // last
+  synthesizeKey("KEY_Enter", {});
   await promiseFormsProcessed();
   checkACForm("zzzuser4", "zzzpass4");
 });
 
 add_task(async function test_form1_untrusted_event() {
   restoreForm();
   await spinEventLoop();
 
@@ -440,132 +440,132 @@ add_task(async function test_form1_untru
   sendFakeAutocompleteEvent(uname);
   await spinEventLoop();
   checkACForm("zzzuser4", "");
 });
 
 add_task(async function test_form1_delete() {
   restoreForm();
   let shownPromise = promiseACShown();
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // open
+  synthesizeKey("KEY_ArrowDown", {}); // open
   await shownPromise;
 
   // XXX tried sending character "t" before/during dropdown to test
   // filtering, but had no luck. Seemed like the character was getting lost.
   // Setting uname.value didn't seem to work either. This works with a human
   // driver, so I'm not sure what's up.
 
   // Delete the first entry (of 4), "tempuser1"
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+  synthesizeKey("KEY_ArrowDown", {});
   var numLogins;
   numLogins = LoginManager.countLogins("http://mochi.test:8888", "http://autocomplete:8888", null);
   is(numLogins, 5, "Correct number of logins before deleting one");
 
   let countChangedPromise = notifyMenuChanged(3);
   var deletionPromise = promiseStorageChanged(["removeLogin"]);
   // On OS X, shift-backspace and shift-delete work, just delete does not.
   // On Win/Linux, shift-backspace does not work, delete and shift-delete do.
-  synthesizeKey("KEY_Delete", {code: "Delete", shiftKey: true});
+  synthesizeKey("KEY_Delete", {shiftKey: true});
   await deletionPromise;
 
   checkACForm("", "");
   numLogins = LoginManager.countLogins("http://mochi.test:8888", "http://autocomplete:8888", null);
   is(numLogins, 4, "Correct number of logins after deleting one");
   await countChangedPromise;
-  synthesizeKey("KEY_Enter", {code: "Enter"});
+  synthesizeKey("KEY_Enter", {});
   await promiseFormsProcessed();
   checkACForm("testuser2", "testpass2");
 });
 
 add_task(async function test_form1_first_after_deletion() {
   restoreForm();
   let shownPromise = promiseACShown();
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // open
+  synthesizeKey("KEY_ArrowDown", {}); // open
   await shownPromise;
 
   // Check the new first entry (of 3)
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-  synthesizeKey("KEY_Enter", {code: "Enter"});
+  synthesizeKey("KEY_ArrowDown", {});
+  synthesizeKey("KEY_Enter", {});
   await promiseFormsProcessed();
   checkACForm("testuser2", "testpass2");
 });
 
 add_task(async function test_form1_delete_second() {
   restoreForm();
   let shownPromise = promiseACShown();
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // open
+  synthesizeKey("KEY_ArrowDown", {}); // open
   await shownPromise;
 
   // Delete the second entry (of 3), "testuser3"
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-  synthesizeKey("KEY_Delete", {code: "Delete", shiftKey: true});
+  synthesizeKey("KEY_ArrowDown", {});
+  synthesizeKey("KEY_ArrowDown", {});
+  synthesizeKey("KEY_Delete", {shiftKey: true});
   checkACForm("", "");
   numLogins = LoginManager.countLogins("http://mochi.test:8888", "http://autocomplete:8888", null);
   is(numLogins, 3, "Correct number of logins after deleting one");
-  synthesizeKey("KEY_Enter", {code: "Enter"});
+  synthesizeKey("KEY_Enter", {});
   await promiseFormsProcessed();
   checkACForm("zzzuser4", "zzzpass4");
 });
 
 add_task(async function test_form1_first_after_deletion2() {
   restoreForm();
   let shownPromise = promiseACShown();
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // open
+  synthesizeKey("KEY_ArrowDown", {}); // open
   await shownPromise;
 
   // Check the new first entry (of 2)
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-  synthesizeKey("KEY_Enter", {code: "Enter"});
+  synthesizeKey("KEY_ArrowDown", {});
+  synthesizeKey("KEY_Enter", {});
   await promiseFormsProcessed();
   checkACForm("testuser2", "testpass2");
 });
 
 add_task(async function test_form1_delete_last() {
   restoreForm();
   let shownPromise = promiseACShown();
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // open
+  synthesizeKey("KEY_ArrowDown", {}); // open
   await shownPromise;
 
   /* test 54 */
   // Delete the last entry (of 2), "zzzuser4"
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-  synthesizeKey("KEY_Delete", {code: "Delete", shiftKey: true});
+  synthesizeKey("KEY_ArrowDown", {});
+  synthesizeKey("KEY_ArrowDown", {});
+  synthesizeKey("KEY_Delete", {shiftKey: true});
   checkACForm("", "");
   numLogins = LoginManager.countLogins("http://mochi.test:8888", "http://autocomplete:8888", null);
   is(numLogins, 2, "Correct number of logins after deleting one");
-  synthesizeKey("KEY_Enter", {code: "Enter"});
+  synthesizeKey("KEY_Enter", {});
   await promiseFormsProcessed();
   checkACForm("testuser2", "testpass2");
 });
 
 add_task(async function test_form1_first_after_3_deletions() {
   restoreForm();
   let shownPromise = promiseACShown();
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // open
+  synthesizeKey("KEY_ArrowDown", {}); // open
   await shownPromise;
 
   // Check the only remaining entry
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-  synthesizeKey("KEY_Enter", {code: "Enter"});
+  synthesizeKey("KEY_ArrowDown", {});
+  synthesizeKey("KEY_Enter", {});
   await promiseFormsProcessed();
   checkACForm("testuser2", "testpass2");
 });
 
 add_task(async function test_form1_check_only_entry_remaining() {
   restoreForm();
   let shownPromise = promiseACShown();
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // open
+  synthesizeKey("KEY_ArrowDown", {}); // open
   await shownPromise;
 
   /* test 56 */
   // Delete the only remaining entry, "testuser2"
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-  synthesizeKey("KEY_Delete", {code: "Delete", shiftKey: true});
+  synthesizeKey("KEY_ArrowDown", {});
+  synthesizeKey("KEY_Delete", {shiftKey: true});
   checkACForm("", "");
   numLogins = LoginManager.countLogins("http://mochi.test:8888", "http://autocomplete:8888", null);
   is(numLogins, 1, "Correct number of logins after deleting one");
 
   // remove the login that's not shown in the list.
   setupScript.sendSyncMessage("removeLogin", "login0");
 });
 
@@ -573,92 +573,92 @@ add_task(async function test_form1_check
 add_task(async function test_form2() {
   // Turn our attention to form2
   uname = $_(2, "uname");
   pword = $_(2, "pword");
   checkACForm("singleuser5", "singlepass5");
 
   restoreForm();
   let shownPromise = promiseACShown();
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // open
+  synthesizeKey("KEY_ArrowDown", {}); // open
   await shownPromise;
 
   // Check first entry
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+  synthesizeKey("KEY_ArrowDown", {});
   checkACForm("", ""); // value shouldn't update
-  synthesizeKey("KEY_Enter", {code: "Enter"});
+  synthesizeKey("KEY_Enter", {});
   await promiseFormsProcessed();
   checkACForm("singleuser5", "singlepass5");
 });
 
 add_task(async function test_form3() {
   uname = $_(3, "uname");
   pword = $_(3, "pword");
   checkACForm("singleuser5", "singlepass5");
   restoreForm();
   let shownPromise = promiseACShown();
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // open
+  synthesizeKey("KEY_ArrowDown", {}); // open
   await shownPromise;
 
   // Check first entry
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+  synthesizeKey("KEY_ArrowDown", {});
   checkACForm("", ""); // value shouldn't update
-  synthesizeKey("KEY_Enter", {code: "Enter"});
+  synthesizeKey("KEY_Enter", {});
   await promiseFormsProcessed();
   checkACForm("singleuser5", "singlepass5");
 });
 
 add_task(async function test_form4() {
   uname = $_(4, "uname");
   pword = $_(4, "pword");
   checkACForm("singleuser5", "singlepass5");
   restoreForm();
   let shownPromise = promiseACShown();
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // open
+  synthesizeKey("KEY_ArrowDown", {}); // open
   await shownPromise;
 
   // Check first entry
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+  synthesizeKey("KEY_ArrowDown", {});
   checkACForm("", ""); // value shouldn't update
-  synthesizeKey("KEY_Enter", {code: "Enter"});
+  synthesizeKey("KEY_Enter", {});
   await promiseFormsProcessed();
   checkACForm("singleuser5", "singlepass5");
 });
 
 add_task(async function test_form5() {
   uname = $_(5, "uname");
   pword = $_(5, "pword");
   checkACForm("singleuser5", "singlepass5");
   restoreForm();
   let shownPromise = promiseACShown();
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // open
+  synthesizeKey("KEY_ArrowDown", {}); // open
   await shownPromise;
 
   // Check first entry
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+  synthesizeKey("KEY_ArrowDown", {});
   checkACForm("", ""); // value shouldn't update
-  synthesizeKey("KEY_Enter", {code: "Enter"});
+  synthesizeKey("KEY_Enter", {});
   await promiseFormsProcessed();
   checkACForm("singleuser5", "singlepass5");
 });
 
 add_task(async function test_form6() {
   // (this is a control, w/o autocomplete=off, to ensure the login
   // that was being suppressed would have been filled in otherwise)
   uname = $_(6, "uname");
   pword = $_(6, "pword");
   checkACForm("singleuser5", "singlepass5");
 });
 
 add_task(async function test_form6_changeUsername() {
   // Test that the password field remains filled in after changing
   // the username.
   uname.focus();
-  synthesizeKey("KEY_ArrowRight", {code: "ArrowRight"});
-  synthesizeKey("X", {code: "KeyX", shiftKey: true});
+  synthesizeKey("KEY_ArrowRight", {});
+  synthesizeKey("X", {shiftKey: true});
   // Trigger the 'blur' event on uname
   pword.focus();
   await spinEventLoop();
   checkACForm("singleuser5X", "singlepass5");
 
   setupScript.sendSyncMessage("removeLogin", "login5");
 });
 
@@ -679,23 +679,23 @@ add_task(async function test_form7() {
   // automatically, removing it makes it more likely that we'll catch a
   // future regression with form filling here.
   setupScript.sendSyncMessage("removeLogin", "login6B");
 });
 
 add_task(async function test_form7_2() {
   restoreForm();
   let shownPromise = promiseACShown();
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // open
+  synthesizeKey("KEY_ArrowDown", {}); // open
   await shownPromise;
 
   // Check first entry
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+  synthesizeKey("KEY_ArrowDown", {});
   checkACForm("", ""); // value shouldn't update
-  synthesizeKey("KEY_Enter", {code: "Enter"});
+  synthesizeKey("KEY_Enter", {});
   // The form changes, so we expect the old username field to get the
   // selected autocomplete value, but neither the new username field nor
   // the password field should have any values filled in.
   await spinEventLoop();
   checkACForm("form7user1", "");
   is($_(7, "uname2").value, "", "Verifying empty uname2");
   restoreForm(); // clear field, so reloading test doesn't fail
 
@@ -731,64 +731,64 @@ add_task(async function test_form9_filte
   pword = $_(9, "pword");
   uname.focus();
   let shownPromise = promiseACShown();
   sendString("form9userAB");
   await shownPromise;
 
   checkACForm("form9userAB", "");
   uname.focus();
-  synthesizeKey("KEY_ArrowLeft", {code: "ArrowLeft"});
+  synthesizeKey("KEY_ArrowLeft", {});
   shownPromise = promiseACShown();
-  synthesizeKey("A", {code: "KeyA", shiftKey: true});
+  synthesizeKey("A", {shiftKey: true});
   let results = await shownPromise;
 
   checkACForm("form9userAAB", "");
   checkArrayValues(results, ["form9userAAB"], "Check dropdown is updated after inserting 'A'");
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-  synthesizeKey("KEY_Enter", {code: "Enter"});
+  synthesizeKey("KEY_ArrowDown", {});
+  synthesizeKey("KEY_Enter", {});
   await promiseFormsProcessed();
   checkACForm("form9userAAB", "form9pass");
 });
 
 add_task(async function test_form9_autocomplete_cache() {
   // Note that this addLogin call will only be seen by the autocomplete
   // attempt for the synthesizeKey if we do not successfully cache the
   // autocomplete results.
   setupScript.sendSyncMessage("addLogin", "login8C");
   uname.focus();
   let promise0 = notifyMenuChanged(0);
-  synthesizeKey("z", {code: "KeyZ"});
+  synthesizeKey("z", {});
   await promise0;
   let popupState = await getPopupState();
   is(popupState.open, false, "Check popup shouldn't open");
 
   // check that empty results are cached - bug 496466
   promise0 = notifyMenuChanged(0);
-  synthesizeKey("z", {code: "KeyZ"});
+  synthesizeKey("z", {});
   await promise0;
   popupState = await getPopupState();
   is(popupState.open, false, "Check popup stays closed due to cached empty result");
 });
 
 add_task(async function test_form11_formless() {
   // Test form-less autocomplete
   uname = $_(11, "uname");
   pword = $_(11, "pword");
   restoreForm();
   checkACForm("", "");
   let shownPromise = promiseACShown();
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // open
+  synthesizeKey("KEY_ArrowDown", {}); // open
   await shownPromise;
 
   // Trigger autocomplete
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+  synthesizeKey("KEY_ArrowDown", {});
   checkACForm("", ""); // value shouldn't update
   let processedPromise = promiseFormsProcessed();
-  synthesizeKey("KEY_Enter", {code: "Enter"});
+  synthesizeKey("KEY_Enter", {});
   await processedPromise;
   checkACForm("testuser", "testpass");
 });
 
 add_task(async function test_form11_open_on_trusted_focus() {
   uname = $_(11, "uname");
   pword = $_(11, "pword");
   uname.value = "";
@@ -803,19 +803,19 @@ add_task(async function test_form11_open
       ok(e.isTrusted, "Ensure event is trusted");
       resolve();
     });
   });
   const shownPromise = promiseACShown();
   synthesizeMouseAtCenter(uname, {});
   await firePrivEventPromise;
   await shownPromise;
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+  synthesizeKey("KEY_ArrowDown", {});
   const processedPromise = promiseFormsProcessed();
-  synthesizeKey("KEY_Enter", {code: "Enter"});
+  synthesizeKey("KEY_Enter", {});
   await processedPromise;
   checkACForm("testuser", "testpass");
 });
 
 add_task(async function test_form12_recipes() {
   await loadRecipes({
     siteRecipes: [{
       "hosts": ["mochi.test:8888"],
@@ -829,31 +829,31 @@ add_task(async function test_form12_reci
   // First test DOMAutocomplete
   // Switch the password field to type=password so _fillForm marks the username
   // field for autocomplete.
   pword.type = "password";
   await promiseFormsProcessed();
   restoreForm();
   checkACForm("", "");
   let shownPromise = promiseACShown();
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // open
+  synthesizeKey("KEY_ArrowDown", {}); // open
   await shownPromise;
 
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+  synthesizeKey("KEY_ArrowDown", {});
   checkACForm("", ""); // value shouldn't update
-  synthesizeKey("KEY_Enter", {code: "Enter"});
+  synthesizeKey("KEY_Enter", {});
   await promiseFormsProcessed();
   checkACForm("testuser10", "testpass10");
 
   // Now test recipes with blur on the username field.
   restoreForm();
   checkACForm("", "");
   uname.value = "testuser10";
   checkACForm("testuser10", "");
-  synthesizeKey("KEY_Tab", {code: "Tab"});
+  synthesizeKey("KEY_Tab", {});
   await promiseFormsProcessed();
   checkACForm("testuser10", "testpass10");
   await resetRecipes();
 });
 </script>
 </pre>
 </body>
 </html>
--- a/toolkit/components/passwordmgr/test/mochitest/test_case_differences.html
+++ b/toolkit/components/passwordmgr/test/mochitest/test_case_differences.html
@@ -81,66 +81,66 @@ add_task(async function test_empty_first
   /* test 1 */
   // Make sure initial form is empty.
   checkACForm("", "");
   // Trigger autocomplete popup
   restoreForm();
   let popupState = await getPopupState();
   is(popupState.open, false, "Check popup is initially closed");
   let shownPromise = promiseACShown();
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+  synthesizeKey("KEY_ArrowDown", {});
   let results = await shownPromise;
   popupState = await getPopupState();
   is(popupState.selectedIndex, -1, "Check no entries are selected");
   checkArrayValues(results, ["name", "Name", "USER"], "initial");
 
   // Check first entry
   let index0Promise = notifySelectedIndex(0);
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+  synthesizeKey("KEY_ArrowDown", {});
   await index0Promise;
   checkACForm("", ""); // value shouldn't update
-  synthesizeKey("KEY_Enter", {code: "Enter"});
+  synthesizeKey("KEY_Enter", {});
   await promiseFormsProcessed();
   checkACForm("name", "pass");
 });
 
 add_task(async function test_empty_second_entry() {
   restoreForm();
   let shownPromise = promiseACShown();
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // open
+  synthesizeKey("KEY_ArrowDown", {}); // open
   await shownPromise;
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // first
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // second
-  synthesizeKey("KEY_Enter", {code: "Enter"});
+  synthesizeKey("KEY_ArrowDown", {}); // first
+  synthesizeKey("KEY_ArrowDown", {}); // second
+  synthesizeKey("KEY_Enter", {});
   await promiseFormsProcessed();
   checkACForm("Name", "Pass");
 });
 
 add_task(async function test_empty_third_entry() {
   restoreForm();
   let shownPromise = promiseACShown();
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // open
+  synthesizeKey("KEY_ArrowDown", {}); // open
   await shownPromise;
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // first
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // second
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // third
-  synthesizeKey("KEY_Enter", {code: "Enter"});
+  synthesizeKey("KEY_ArrowDown", {}); // first
+  synthesizeKey("KEY_ArrowDown", {}); // second
+  synthesizeKey("KEY_ArrowDown", {}); // third
+  synthesizeKey("KEY_Enter", {});
   await promiseFormsProcessed();
   checkACForm("USER", "PASS");
 });
 
 add_task(async function test_preserve_matching_username_case() {
   restoreForm();
   uname.value = "user";
   let shownPromise = promiseACShown();
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // open
+  synthesizeKey("KEY_ArrowDown", {}); // open
   await shownPromise;
 
   // Check that we don't clobber user-entered text when tabbing away
   // (even with no autocomplete entry selected)
-  synthesizeKey("KEY_Tab", {code: "Tab"});
+  synthesizeKey("KEY_Tab", {});
   await promiseFormsProcessed();
   checkACForm("user", "PASS");
 });
 </script>
 </pre>
 </body>
 </html>
--- a/toolkit/components/passwordmgr/test/mochitest/test_insecure_form_field_autocomplete.html
+++ b/toolkit/components/passwordmgr/test/mochitest/test_insecure_form_field_autocomplete.html
@@ -222,226 +222,226 @@ add_task(async function test_form1_initi
   is(popupState.open, false, "Check popup is initially closed");
 });
 
 add_task(async function test_form1_warning_entry() {
   await SimpleTest.promiseFocus(window);
   // Trigger autocomplete popup
   restoreForm();
   let shownPromise = promiseACShown();
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // open
+  synthesizeKey("KEY_ArrowDown", {}); // open
   let results = await shownPromise;
 
   let popupState = await getPopupState();
   is(popupState.selectedIndex, -1, "Check no entries are selected upon opening");
 
   let expectedMenuItems = ["This connection is not secure. Logins entered here could be compromised. Learn More",
                            "tempuser1",
                            "testuser2",
                            "testuser3",
                            "zzzuser4"];
   checkArrayValues(results, expectedMenuItems, "Check all menuitems are displayed correctly.");
 
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // select insecure warning
+  synthesizeKey("KEY_ArrowDown", {}); // select insecure warning
   checkACForm("", ""); // value shouldn't update just by selecting
-  synthesizeKey("KEY_Enter", {code: "Enter"});
+  synthesizeKey("KEY_Enter", {});
   await spinEventLoop(); // let focus happen
   checkACForm("", "");
 });
 
 add_task(async function test_form1_first_entry() {
   await SimpleTest.promiseFocus(window);
   // Trigger autocomplete popup
   restoreForm();
   let shownPromise = promiseACShown();
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // open
+  synthesizeKey("KEY_ArrowDown", {}); // open
   await shownPromise;
 
   let popupState = await getPopupState();
   is(popupState.selectedIndex, -1, "Check no entries are selected upon opening");
 
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // skip insecure warning
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // first
+  synthesizeKey("KEY_ArrowDown", {}); // skip insecure warning
+  synthesizeKey("KEY_ArrowDown", {}); // first
   checkACForm("", ""); // value shouldn't update just by selecting
-  synthesizeKey("KEY_Enter", {code: "Enter"});
+  synthesizeKey("KEY_Enter", {});
   await promiseFormsProcessed();
   checkACForm("tempuser1", "temppass1");
 });
 
 add_task(async function test_form1_second_entry() {
   // Trigger autocomplete popup
   restoreForm();
   let shownPromise = promiseACShown();
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // open
+  synthesizeKey("KEY_ArrowDown", {}); // open
   await shownPromise;
 
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // skip insecure warning
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // first
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // second
-  synthesizeKey("KEY_Enter", {code: "Enter"});
+  synthesizeKey("KEY_ArrowDown", {}); // skip insecure warning
+  synthesizeKey("KEY_ArrowDown", {}); // first
+  synthesizeKey("KEY_ArrowDown", {}); // second
+  synthesizeKey("KEY_Enter", {});
   await promiseFormsProcessed();
   checkACForm("testuser2", "testpass2");
 });
 
 add_task(async function test_form1_third_entry() {
   // Trigger autocomplete popup
   restoreForm();
   let shownPromise = promiseACShown();
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // open
+  synthesizeKey("KEY_ArrowDown", {}); // open
   await shownPromise;
 
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // skip insecure warning
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // first
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // second
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // third
-  synthesizeKey("KEY_Enter", {code: "Enter"});
+  synthesizeKey("KEY_ArrowDown", {}); // skip insecure warning
+  synthesizeKey("KEY_ArrowDown", {}); // first
+  synthesizeKey("KEY_ArrowDown", {}); // second
+  synthesizeKey("KEY_ArrowDown", {}); // third
+  synthesizeKey("KEY_Enter", {});
   await promiseFormsProcessed();
   checkACForm("testuser3", "testpass3");
 });
 
 add_task(async function test_form1_fourth_entry() {
   // Trigger autocomplete popup
   restoreForm();
   let shownPromise = promiseACShown();
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // open
+  synthesizeKey("KEY_ArrowDown", {}); // open
   await shownPromise;
 
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // skip insecure warning
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // first
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // second
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // third
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // fourth
-  synthesizeKey("KEY_Enter", {code: "Enter"});
+  synthesizeKey("KEY_ArrowDown", {}); // skip insecure warning
+  synthesizeKey("KEY_ArrowDown", {}); // first
+  synthesizeKey("KEY_ArrowDown", {}); // second
+  synthesizeKey("KEY_ArrowDown", {}); // third
+  synthesizeKey("KEY_ArrowDown", {}); // fourth
+  synthesizeKey("KEY_Enter", {});
   await promiseFormsProcessed();
   checkACForm("zzzuser4", "zzzpass4");
 });
 
 add_task(async function test_form1_wraparound_first_entry() {
   // Trigger autocomplete popup
   restoreForm();
   await spinEventLoop(); // let focus happen
   let shownPromise = promiseACShown();
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // open
+  synthesizeKey("KEY_ArrowDown", {}); // open
   await shownPromise;
 
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // skip insecure warning
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // first
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // second
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // third
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // fourth
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // deselects
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // skip insecure warning
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // first
-  synthesizeKey("KEY_Enter", {code: "Enter"});
+  synthesizeKey("KEY_ArrowDown", {}); // skip insecure warning
+  synthesizeKey("KEY_ArrowDown", {}); // first
+  synthesizeKey("KEY_ArrowDown", {}); // second
+  synthesizeKey("KEY_ArrowDown", {}); // third
+  synthesizeKey("KEY_ArrowDown", {}); // fourth
+  synthesizeKey("KEY_ArrowDown", {}); // deselects
+  synthesizeKey("KEY_ArrowDown", {}); // skip insecure warning
+  synthesizeKey("KEY_ArrowDown", {}); // first
+  synthesizeKey("KEY_Enter", {});
   await promiseFormsProcessed();
   checkACForm("tempuser1", "temppass1");
 });
 
 add_task(async function test_form1_wraparound_up_last_entry() {
   // Trigger autocomplete popup
   restoreForm();
   let shownPromise = promiseACShown();
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // open
+  synthesizeKey("KEY_ArrowDown", {}); // open
   await shownPromise;
 
-  synthesizeKey("KEY_ArrowUp", {code: "ArrowUp"}); // last (fourth)
-  synthesizeKey("KEY_Enter", {code: "Enter"});
+  synthesizeKey("KEY_ArrowUp", {}); // last (fourth)
+  synthesizeKey("KEY_Enter", {});
   await promiseFormsProcessed();
   checkACForm("zzzuser4", "zzzpass4");
 });
 
 add_task(async function test_form1_wraparound_down_up_up() {
   // Trigger autocomplete popup
   restoreForm();
   let shownPromise = promiseACShown();
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // open
+  synthesizeKey("KEY_ArrowDown", {}); // open
   await shownPromise;
 
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // select first entry
-  synthesizeKey("KEY_ArrowUp", {code: "ArrowUp"}); // selects nothing!
-  synthesizeKey("KEY_ArrowUp", {code: "ArrowUp"}); // select last entry
-  synthesizeKey("KEY_Enter", {code: "Enter"});
+  synthesizeKey("KEY_ArrowDown", {}); // select first entry
+  synthesizeKey("KEY_ArrowUp", {}); // selects nothing!
+  synthesizeKey("KEY_ArrowUp", {}); // select last entry
+  synthesizeKey("KEY_Enter", {});
   await promiseFormsProcessed();
   checkACForm("zzzuser4", "zzzpass4");
 });
 
 add_task(async function test_form1_wraparound_up_last() {
   restoreForm();
   let shownPromise = promiseACShown();
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // open
+  synthesizeKey("KEY_ArrowDown", {}); // open
   await shownPromise;
 
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-  synthesizeKey("KEY_ArrowUp", {code: "ArrowUp"}); // deselects
-  synthesizeKey("KEY_ArrowUp", {code: "ArrowUp"}); // last entry
-  synthesizeKey("KEY_ArrowUp", {code: "ArrowUp"});
-  synthesizeKey("KEY_ArrowUp", {code: "ArrowUp"});
-  synthesizeKey("KEY_ArrowUp", {code: "ArrowUp"}); // skip insecure warning
-  synthesizeKey("KEY_ArrowUp", {code: "ArrowUp"}); // first entry
-  synthesizeKey("KEY_ArrowUp", {code: "ArrowUp"}); // deselects
-  synthesizeKey("KEY_ArrowUp", {code: "ArrowUp"}); // last entry
-  synthesizeKey("KEY_Enter", {code: "Enter"});
+  synthesizeKey("KEY_ArrowDown", {});
+  synthesizeKey("KEY_ArrowUp", {}); // deselects
+  synthesizeKey("KEY_ArrowUp", {}); // last entry
+  synthesizeKey("KEY_ArrowUp", {});
+  synthesizeKey("KEY_ArrowUp", {});
+  synthesizeKey("KEY_ArrowUp", {}); // skip insecure warning
+  synthesizeKey("KEY_ArrowUp", {}); // first entry
+  synthesizeKey("KEY_ArrowUp", {}); // deselects
+  synthesizeKey("KEY_ArrowUp", {}); // last entry
+  synthesizeKey("KEY_Enter", {});
   await promiseFormsProcessed();
   checkACForm("zzzuser4", "zzzpass4");
 });
 
 add_task(async function test_form1_fill_username_without_autofill_right() {
   restoreForm();
   let shownPromise = promiseACShown();
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // open
+  synthesizeKey("KEY_ArrowDown", {}); // open
   await shownPromise;
 
   // Set first entry w/o triggering autocomplete
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // skip insecure warning
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // first
-  synthesizeKey("KEY_ArrowRight", {code: "ArrowRight"});
+  synthesizeKey("KEY_ArrowDown", {}); // skip insecure warning
+  synthesizeKey("KEY_ArrowDown", {}); // first
+  synthesizeKey("KEY_ArrowRight", {});
   await spinEventLoop();
   checkACForm("tempuser1", ""); // empty password
 });
 
 add_task(async function test_form1_fill_username_without_autofill_left() {
   restoreForm();
   let shownPromise = promiseACShown();
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // open
+  synthesizeKey("KEY_ArrowDown", {}); // open
   await shownPromise;
 
   // Set first entry w/o triggering autocomplete
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // skip insecure warning
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // first
-  synthesizeKey("KEY_ArrowLeft", {code: "ArrowLeft"});
+  synthesizeKey("KEY_ArrowDown", {}); // skip insecure warning
+  synthesizeKey("KEY_ArrowDown", {}); // first
+  synthesizeKey("KEY_ArrowLeft", {});
   checkACForm("tempuser1", ""); // empty password
 });
 
 add_task(async function test_form1_pageup_first() {
   restoreForm();
   let shownPromise = promiseACShown();
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // open
+  synthesizeKey("KEY_ArrowDown", {}); // open
   await shownPromise;
 
   // Check first entry (page up)
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // first
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // second
-  synthesizeKey("KEY_PageUp", {code: "PageUp"}); // first
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // skip insecure warning
-  synthesizeKey("KEY_Enter", {code: "Enter"});
+  synthesizeKey("KEY_ArrowDown", {}); // first
+  synthesizeKey("KEY_ArrowDown", {}); // second
+  synthesizeKey("KEY_PageUp", {}); // first
+  synthesizeKey("KEY_ArrowDown", {}); // skip insecure warning
+  synthesizeKey("KEY_Enter", {});
   await promiseFormsProcessed();
   checkACForm("tempuser1", "temppass1");
 });
 
 add_task(async function test_form1_pagedown_last() {
   restoreForm();
   let shownPromise = promiseACShown();
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // open
+  synthesizeKey("KEY_ArrowDown", {}); // open
   await shownPromise;
 
   // test 13
   // Check last entry (page down)
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // first
-  synthesizeKey("KEY_PageDown", {code: "PageDown"}); // last
-  synthesizeKey("KEY_Enter", {code: "Enter"});
+  synthesizeKey("KEY_ArrowDown", {}); // first
+  synthesizeKey("KEY_PageDown", {}); // last
+  synthesizeKey("KEY_Enter", {});
   await promiseFormsProcessed();
   checkACForm("zzzuser4", "zzzpass4");
 });
 
 add_task(async function test_form1_untrusted_event() {
   restoreForm();
   await spinEventLoop();
 
@@ -451,139 +451,139 @@ add_task(async function test_form1_untru
   sendFakeAutocompleteEvent(uname);
   await spinEventLoop();
   checkACForm("zzzuser4", "");
 });
 
 add_task(async function test_form1_delete() {
   restoreForm();
   let shownPromise = promiseACShown();
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // open
+  synthesizeKey("KEY_ArrowDown", {}); // open
   await shownPromise;
 
   // XXX tried sending character "t" before/during dropdown to test
   // filtering, but had no luck. Seemed like the character was getting lost.
   // Setting uname.value didn't seem to work either. This works with a human
   // driver, so I'm not sure what's up.
 
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // skip insecure warning
+  synthesizeKey("KEY_ArrowDown", {}); // skip insecure warning
   // Delete the first entry (of 4), "tempuser1"
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+  synthesizeKey("KEY_ArrowDown", {});
   var numLogins;
   numLogins = LoginManager.countLogins("http://mochi.test:8888", "http://autocomplete:8888", null);
   is(numLogins, 5, "Correct number of logins before deleting one");
 
   let countChangedPromise = notifyMenuChanged(4);
   var deletionPromise = promiseStorageChanged(["removeLogin"]);
   // On OS X, shift-backspace and shift-delete work, just delete does not.
   // On Win/Linux, shift-backspace does not work, delete and shift-delete do.
-  synthesizeKey("KEY_Delete", {code: "Delete", shiftKey: true});
+  synthesizeKey("KEY_Delete", {shiftKey: true});
   await deletionPromise;
 
   checkACForm("", "");
   numLogins = LoginManager.countLogins("http://mochi.test:8888", "http://autocomplete:8888", null);
   is(numLogins, 4, "Correct number of logins after deleting one");
   await countChangedPromise;
-  synthesizeKey("KEY_Enter", {code: "Enter"});
+  synthesizeKey("KEY_Enter", {});
   await promiseFormsProcessed();
   checkACForm("testuser2", "testpass2");
 });
 
 add_task(async function test_form1_first_after_deletion() {
   restoreForm();
   let shownPromise = promiseACShown();
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // open
+  synthesizeKey("KEY_ArrowDown", {}); // open
   await shownPromise;
 
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // skip insecure warning
+  synthesizeKey("KEY_ArrowDown", {}); // skip insecure warning
   // Check the new first entry (of 3)
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-  synthesizeKey("KEY_Enter", {code: "Enter"});
+  synthesizeKey("KEY_ArrowDown", {});
+  synthesizeKey("KEY_Enter", {});
   await promiseFormsProcessed();
   checkACForm("testuser2", "testpass2");
 });
 
 add_task(async function test_form1_delete_second() {
   restoreForm();
   let shownPromise = promiseACShown();
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // open
+  synthesizeKey("KEY_ArrowDown", {}); // open
   await shownPromise;
 
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // skip insecure warning
+  synthesizeKey("KEY_ArrowDown", {}); // skip insecure warning
   // Delete the second entry (of 3), "testuser3"
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-  synthesizeKey("KEY_Delete", {code: "Delete", shiftKey: true});
+  synthesizeKey("KEY_ArrowDown", {});
+  synthesizeKey("KEY_ArrowDown", {});
+  synthesizeKey("KEY_Delete", {shiftKey: true});
   checkACForm("", "");
   numLogins = LoginManager.countLogins("http://mochi.test:8888", "http://autocomplete:8888", null);
   is(numLogins, 3, "Correct number of logins after deleting one");
-  synthesizeKey("KEY_Enter", {code: "Enter"});
+  synthesizeKey("KEY_Enter", {});
   await promiseFormsProcessed();
   checkACForm("zzzuser4", "zzzpass4");
 });
 
 add_task(async function test_form1_first_after_deletion2() {
   restoreForm();
   let shownPromise = promiseACShown();
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // open
+  synthesizeKey("KEY_ArrowDown", {}); // open
   await shownPromise;
 
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // skip insecure warning
+  synthesizeKey("KEY_ArrowDown", {}); // skip insecure warning
   // Check the new first entry (of 2)
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-  synthesizeKey("KEY_Enter", {code: "Enter"});
+  synthesizeKey("KEY_ArrowDown", {});
+  synthesizeKey("KEY_Enter", {});
   await promiseFormsProcessed();
   checkACForm("testuser2", "testpass2");
 });
 
 add_task(async function test_form1_delete_last() {
   restoreForm();
   let shownPromise = promiseACShown();
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // open
+  synthesizeKey("KEY_ArrowDown", {}); // open
   await shownPromise;
 
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // skip insecure warning
+  synthesizeKey("KEY_ArrowDown", {}); // skip insecure warning
   // test 54
   // Delete the last entry (of 2), "zzzuser4"
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-  synthesizeKey("KEY_Delete", {code: "Delete", shiftKey: true});
+  synthesizeKey("KEY_ArrowDown", {});
+  synthesizeKey("KEY_ArrowDown", {});
+  synthesizeKey("KEY_Delete", {shiftKey: true});
   checkACForm("", "");
   numLogins = LoginManager.countLogins("http://mochi.test:8888", "http://autocomplete:8888", null);
   is(numLogins, 2, "Correct number of logins after deleting one");
-  synthesizeKey("KEY_Enter", {code: "Enter"});
+  synthesizeKey("KEY_Enter", {});
   await promiseFormsProcessed();
   checkACForm("testuser2", "testpass2");
 });
 
 add_task(async function test_form1_first_after_3_deletions() {
   restoreForm();
   let shownPromise = promiseACShown();
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // open
+  synthesizeKey("KEY_ArrowDown", {}); // open
   await shownPromise;
 
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // skip insecure warning
+  synthesizeKey("KEY_ArrowDown", {}); // skip insecure warning
   // Check the only remaining entry
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-  synthesizeKey("KEY_Enter", {code: "Enter"});
+  synthesizeKey("KEY_ArrowDown", {});
+  synthesizeKey("KEY_Enter", {});
   await promiseFormsProcessed();
   checkACForm("testuser2", "testpass2");
 });
 
 add_task(async function test_form1_check_only_entry_remaining() {
   restoreForm();
   let shownPromise = promiseACShown();
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // open
+  synthesizeKey("KEY_ArrowDown", {}); // open
   await shownPromise;
 
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // skip insecure warning
+  synthesizeKey("KEY_ArrowDown", {}); // skip insecure warning
   // test 56
   // Delete the only remaining entry, "testuser2"
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-  synthesizeKey("KEY_Delete", {code: "Delete", shiftKey: true});
+  synthesizeKey("KEY_ArrowDown", {});
+  synthesizeKey("KEY_Delete", {shiftKey: true});
   checkACForm("", "");
   numLogins = LoginManager.countLogins("http://mochi.test:8888", "http://autocomplete:8888", null);
   is(numLogins, 1, "Correct number of logins after deleting one");
 
   // remove the login that's not shown in the list.
   setupScript.sendSyncMessage("removeLogin", "login0");
 });
 
@@ -591,96 +591,96 @@ add_task(async function test_form1_check
 add_task(async function test_form2() {
   // Turn our attention to form2
   uname = $_(2, "uname");
   pword = $_(2, "pword");
   checkACForm("singleuser5", "singlepass5");
 
   restoreForm();
   let shownPromise = promiseACShown();
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // open
+  synthesizeKey("KEY_ArrowDown", {}); // open
   await shownPromise;
 
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // skip insecure warning
+  synthesizeKey("KEY_ArrowDown", {}); // skip insecure warning
   // Check first entry
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+  synthesizeKey("KEY_ArrowDown", {});
   checkACForm("", ""); // value shouldn't update
-  synthesizeKey("KEY_Enter", {code: "Enter"});
+  synthesizeKey("KEY_Enter", {});
   await promiseFormsProcessed();
   checkACForm("singleuser5", "singlepass5");
 });
 
 add_task(async function test_form3() {
   uname = $_(3, "uname");
   pword = $_(3, "pword");
   checkACForm("singleuser5", "singlepass5");
   restoreForm();
   let shownPromise = promiseACShown();
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // open
+  synthesizeKey("KEY_ArrowDown", {}); // open
   await shownPromise;
 
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // skip insecure warning
+  synthesizeKey("KEY_ArrowDown", {}); // skip insecure warning
   // Check first entry
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+  synthesizeKey("KEY_ArrowDown", {});
   checkACForm("", ""); // value shouldn't update
-  synthesizeKey("KEY_Enter", {code: "Enter"});
+  synthesizeKey("KEY_Enter", {});
   await promiseFormsProcessed();
   checkACForm("singleuser5", "singlepass5");
 });
 
 add_task(async function test_form4() {
   uname = $_(4, "uname");
   pword = $_(4, "pword");
   checkACForm("singleuser5", "singlepass5");
   restoreForm();
   let shownPromise = promiseACShown();
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // open
+  synthesizeKey("KEY_ArrowDown", {}); // open
   await shownPromise;
 
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // skip insecure warning
+  synthesizeKey("KEY_ArrowDown", {}); // skip insecure warning
   // Check first entry
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+  synthesizeKey("KEY_ArrowDown", {});
   checkACForm("", ""); // value shouldn't update
-  synthesizeKey("KEY_Enter", {code: "Enter"});
+  synthesizeKey("KEY_Enter", {});
   await promiseFormsProcessed();
   checkACForm("singleuser5", "singlepass5");
 });
 
 add_task(async function test_form5() {
   uname = $_(5, "uname");
   pword = $_(5, "pword");
   checkACForm("singleuser5", "singlepass5");
   restoreForm();
   let shownPromise = promiseACShown();
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // open
+  synthesizeKey("KEY_ArrowDown", {}); // open
   await shownPromise;
 
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // skip insecure warning
+  synthesizeKey("KEY_ArrowDown", {}); // skip insecure warning
   // Check first entry
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+  synthesizeKey("KEY_ArrowDown", {});
   checkACForm("", ""); // value shouldn't update
-  synthesizeKey("KEY_Enter", {code: "Enter"});
+  synthesizeKey("KEY_Enter", {});
   await promiseFormsProcessed();
   checkACForm("singleuser5", "singlepass5");
 });
 
 add_task(async function test_form6() {
   // (this is a control, w/o autocomplete=off, to ensure the login
   // that was being suppressed would have been filled in otherwise)
   uname = $_(6, "uname");
   pword = $_(6, "pword");
   checkACForm("singleuser5", "singlepass5");
 });
 
 add_task(async function test_form6_changeUsername() {
   // Test that the password field remains filled in after changing
   // the username.
   uname.focus();
-  synthesizeKey("KEY_ArrowRight", {code: "ArrowRight"});
-  synthesizeKey("X", {code: "KeyX", shiftKey: true});
+  synthesizeKey("KEY_ArrowRight", {});
+  synthesizeKey("X", {shiftKey: true});
   // Trigger the 'blur' event on uname
   pword.focus();
   await spinEventLoop();
   checkACForm("singleuser5X", "singlepass5");
 
   setupScript.sendSyncMessage("removeLogin", "login5");
 });
 
@@ -701,24 +701,24 @@ add_task(async function test_form7() {
   // automatically, removing it makes it more likely that we'll catch a
   // future regression with form filling here.
   setupScript.sendSyncMessage("removeLogin", "login6B");
 });
 
 add_task(async function test_form7_2() {
   restoreForm();
   let shownPromise = promiseACShown();
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // open
+  synthesizeKey("KEY_ArrowDown", {}); // open
   await shownPromise;
 
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // skip insecure warning
+  synthesizeKey("KEY_ArrowDown", {}); // skip insecure warning
   // Check first entry
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+  synthesizeKey("KEY_ArrowDown", {});
   checkACForm("", ""); // value shouldn't update
-  synthesizeKey("KEY_Enter", {code: "Enter"});
+  synthesizeKey("KEY_Enter", {});
   // The form changes, so we expect the old username field to get the
   // selected autocomplete value, but neither the new username field nor
   // the password field should have any values filled in.
   await spinEventLoop();
   checkACForm("form7user1", "");
   is($_(7, "uname2").value, "", "Verifying empty uname2");
   restoreForm(); // clear field, so reloading test doesn't fail
 
@@ -754,48 +754,48 @@ add_task(async function test_form9_filte
   pword = $_(9, "pword");
   uname.focus();
   let shownPromise = promiseACShown();
   sendString("form9userAB");
   await shownPromise;
 
   checkACForm("form9userAB", "");
   uname.focus();
-  synthesizeKey("KEY_ArrowLeft", {code: "ArrowLeft"});
+  synthesizeKey("KEY_ArrowLeft", {});
   shownPromise = promiseACShown();
-  synthesizeKey("A", {code: "KeyA", shiftKey: true});
+  synthesizeKey("A", {shiftKey: true});
   let results = await shownPromise;
 
   checkACForm("form9userAAB", "");
   checkArrayValues(results, ["This connection is not secure. Logins entered here could be compromised. Learn More", "form9userAAB"],
                             "Check dropdown is updated after inserting 'A'");
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // skip insecure warning
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-  synthesizeKey("KEY_Enter", {code: "Enter"});
+  synthesizeKey("KEY_ArrowDown", {}); // skip insecure warning
+  synthesizeKey("KEY_ArrowDown", {});
+  synthesizeKey("KEY_Enter", {});
   await promiseFormsProcessed();
   checkACForm("form9userAAB", "form9pass");
 });
 
 add_task(async function test_form9_autocomplete_cache() {
   // Note that this addLogin call will only be seen by the autocomplete
   // attempt for the synthesizeKey if we do not successfully cache the
   // autocomplete results.
   setupScript.sendSyncMessage("addLogin", "login8C");
   uname.focus();
   let promise0 = notifyMenuChanged(1);
   let shownPromise = promiseACShown();
-  synthesizeKey("z", {code: "KeyZ"});
+  synthesizeKey("z", {});
   await promise0;
   await shownPromise;
   let popupState = await getPopupState();
   is(popupState.open, true, "Check popup should open");
 
   // check that empty results are cached - bug 496466
   promise0 = notifyMenuChanged(1);
-  synthesizeKey("z", {code: "KeyZ"});
+  synthesizeKey("z", {});
   await promise0;
   popupState = await getPopupState();
   is(popupState.open, true, "Check popup stays opened due to cached empty result");
 });
 
 add_task(async function test_form11_recipes() {
   await loadRecipes({
     siteRecipes: [{
@@ -810,52 +810,52 @@ add_task(async function test_form11_reci
   // First test DOMAutocomplete
   // Switch the password field to type=password so _fillForm marks the username
   // field for autocomplete.
   pword.type = "password";
   await promiseFormsProcessed();
   restoreForm();
   checkACForm("", "");
   let shownPromise = promiseACShown();
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // open
+  synthesizeKey("KEY_ArrowDown", {}); // open
   await shownPromise;
 
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // skip insecure warning
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+  synthesizeKey("KEY_ArrowDown", {}); // skip insecure warning
+  synthesizeKey("KEY_ArrowDown", {});
   checkACForm("", ""); // value shouldn't update
-  synthesizeKey("KEY_Enter", {code: "Enter"});
+  synthesizeKey("KEY_Enter", {});
   await promiseFormsProcessed();
   checkACForm("testuser10", "testpass10");
 
   // Now test recipes with blur on the username field.
   restoreForm();
   checkACForm("", "");
   uname.value = "testuser10";
   checkACForm("testuser10", "");
-  synthesizeKey("KEY_Tab", {code: "Tab"});
+  synthesizeKey("KEY_Tab", {});
   await promiseFormsProcessed();
   checkACForm("testuser10", "testpass10");
   await resetRecipes();
 });
 
 add_task(async function test_form12_formless() {
   // Test form-less autocomplete
   uname = $_(12, "uname");
   pword = $_(12, "pword");
   restoreForm();
   checkACForm("", "");
   let shownPromise = promiseACShown();
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // open
+  synthesizeKey("KEY_ArrowDown", {}); // open
   await shownPromise;
 
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // skip insecure warning
+  synthesizeKey("KEY_ArrowDown", {}); // skip insecure warning
   // Trigger autocomplete
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+  synthesizeKey("KEY_ArrowDown", {});
   checkACForm("", ""); // value shouldn't update
   let processedPromise = promiseFormsProcessed();
-  synthesizeKey("KEY_Enter", {code: "Enter"});
+  synthesizeKey("KEY_Enter", {});
   await processedPromise;
   checkACForm("testuser", "testpass");
 });
 </script>
 </pre>
 </body>
 </html>
--- a/toolkit/components/passwordmgr/test/mochitest/test_insecure_form_field_no_saved_login.html
+++ b/toolkit/components/passwordmgr/test/mochitest/test_insecure_form_field_no_saved_login.html
@@ -77,26 +77,26 @@ add_task(async function test_form1_initi
   is(popupState.open, false, "Check popup is initially closed");
 });
 
 add_task(async function test_form1_warning_entry() {
   await SimpleTest.promiseFocus(window);
   // Trigger autocomplete popup
   restoreForm();
   let shownPromise = promiseACShown();
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // open
+  synthesizeKey("KEY_ArrowDown", {}); // open
   await shownPromise;
 
   let popupState = await getPopupState();
   is(popupState.open, true, "Check popup is opened");
   is(popupState.selectedIndex, -1, "Check no entries are selected upon opening");
 
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // select insecure warning
+  synthesizeKey("KEY_ArrowDown", {}); // select insecure warning
   checkACForm("", ""); // value shouldn't update just by selecting
-  synthesizeKey("KEY_Enter", {code: "Enter"});
+  synthesizeKey("KEY_Enter", {});
   await spinEventLoop(); // let focus happen
   checkACForm("", "");
 });
 
 </script>
 </pre>
 </body>
 </html>
--- a/toolkit/components/passwordmgr/test/mochitest/test_password_field_autocomplete.html
+++ b/toolkit/components/passwordmgr/test/mochitest/test_password_field_autocomplete.html
@@ -165,131 +165,131 @@ add_task(async function test_form1_initi
 add_task(async function test_form2_password_readonly() {
   await SpecialPowers.pushPrefEnv({"set": [
                                             ["security.insecure_field_warning.contextual.enabled", true],
                                             ["signon.autofillForms.http", true]
                                           ]});
   await reinitializeForm(2);
 
   // Trigger autocomplete popup
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // open
+  synthesizeKey("KEY_ArrowDown", {}); // open
   let popupState = await getPopupState();
   is(popupState.open, false, "Check popup is closed for a readonly field.");
 });
 
 add_task(async function test_form3_password_disabled() {
   await SpecialPowers.pushPrefEnv({"set": [
                                             ["security.insecure_field_warning.contextual.enabled", true],
                                             ["signon.autofillForms.http", true]
                                           ]});
   await reinitializeForm(3);
 
   // Trigger autocomplete popup
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // open
+  synthesizeKey("KEY_ArrowDown", {}); // open
   let popupState = await getPopupState();
   is(popupState.open, false, "Check popup is closed for a disabled field.");
 });
 
 add_task(async function test_form1_enabledInsecureFieldWarning_enabledInsecureAutoFillForm() {
   await SpecialPowers.pushPrefEnv({"set": [
                                             ["security.insecure_field_warning.contextual.enabled", true],
                                             ["signon.autofillForms.http", true]
                                           ]});
   await reinitializeForm(1);
   // Trigger autocomplete popup
   let shownPromise = promiseACShown();
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // open
+  synthesizeKey("KEY_ArrowDown", {}); // open
   let results = await shownPromise;
 
   let popupState = await getPopupState();
   is(popupState.selectedIndex, -1, "Check no entries are selected upon opening");
 
   let expectedMenuItems = ["This connection is not secure. Logins entered here could be compromised. Learn More",
                            "No username (" + DATE_NOW_STRING + ")",
                            "tempuser1",
                            "testuser2",
                            "testuser3",
                            "zzzuser4"];
   checkArrayValues(results, expectedMenuItems, "Check all menuitems are displayed correctly.");
 
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // select insecure warning
+  synthesizeKey("KEY_ArrowDown", {}); // select insecure warning
   checkACFormPasswordField(""); // value shouldn't update just by selecting
-  synthesizeKey("KEY_Enter", {code: "Enter"});
+  synthesizeKey("KEY_Enter", {});
   await spinEventLoop(); // let focus happen
   checkACFormPasswordField("");
 });
 
 add_task(async function test_form1_disabledInsecureFieldWarning_enabledInsecureAutoFillForm() {
   await SpecialPowers.pushPrefEnv({"set": [
                                             ["security.insecure_field_warning.contextual.enabled", false],
                                             ["signon.autofillForms.http", true]
                                           ]});
   await reinitializeForm(1);
 
   // Trigger autocomplete popup
   let shownPromise = promiseACShown();
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // open
+  synthesizeKey("KEY_ArrowDown", {}); // open
   let results = await shownPromise;
 
   let popupState = await getPopupState();
   is(popupState.selectedIndex, -1, "Check no entries are selected upon opening");
 
   let expectedMenuItems = ["No username (" + DATE_NOW_STRING + ")",
                            "tempuser1",
                            "testuser2",
                            "testuser3",
                            "zzzuser4"];
   checkArrayValues(results, expectedMenuItems, "Check all menuitems are displayed correctly.");
 
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // select first item
+  synthesizeKey("KEY_ArrowDown", {}); // select first item
   checkACFormPasswordField(""); // value shouldn't update just by selecting
-  synthesizeKey("KEY_Enter", {code: "Enter"});
+  synthesizeKey("KEY_Enter", {});
   await spinEventLoop(); // let focus happen
   checkACFormPasswordField("user0pass");
 });
 
 add_task(async function test_form1_enabledInsecureFieldWarning_disabledInsecureAutoFillForm() {
   await SpecialPowers.pushPrefEnv({"set": [
                                             ["security.insecure_field_warning.contextual.enabled", true],
                                             ["signon.autofillForms.http", false]
                                           ]});
   await reinitializeForm(1);
 
   // Trigger autocomplete popup
   let shownPromise = promiseACShown();
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // open
+  synthesizeKey("KEY_ArrowDown", {}); // open
   let results = await shownPromise;
 
   let popupState = await getPopupState();
   is(popupState.selectedIndex, -1, "Check no entries are selected upon opening");
 
   let expectedMenuItems = ["This connection is not secure. Logins entered here could be compromised. Learn More",
                            "No username (" + DATE_NOW_STRING + ")",
                            "tempuser1",
                            "testuser2",
                            "testuser3",
                            "zzzuser4"];
   checkArrayValues(results, expectedMenuItems, "Check all menuitems are displayed correctly.");
 
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // select insecure warning
+  synthesizeKey("KEY_ArrowDown", {}); // select insecure warning
   checkACFormPasswordField(""); // value shouldn't update just by selecting
-  synthesizeKey("KEY_Enter", {code: "Enter"});
+  synthesizeKey("KEY_Enter", {});
   await spinEventLoop(); // let focus happen
   checkACFormPasswordField("");
 });
 
 add_task(async function test_form1_disabledInsecureFieldWarning_disabledInsecureAutoFillForm() {
   await SpecialPowers.pushPrefEnv({"set": [
                                             ["security.insecure_field_warning.contextual.enabled", false],
                                             ["signon.autofillForms.http", false]
                                           ]});
   await reinitializeForm(1);
 
   // Trigger autocomplete popup
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // open
+  synthesizeKey("KEY_ArrowDown", {}); // open
   let popupState = await getPopupState();
   is(popupState.open, false, "Check popup is closed with no AutoFillForms.");
 });
 
 </script>
 </pre>
 </body>
 </html>
--- a/toolkit/components/prompts/test/chromeScript.js
+++ b/toolkit/components/prompts/test/chromeScript.js
@@ -172,17 +172,17 @@ function dismissPrompt(ui, action) {
       ui.button1.click();
       break;
     case 2:
       ui.button2.click();
       break;
     case "ESC":
       // XXX This is assuming tab-modal.
       let browserWin = Services.wm.getMostRecentWindow("navigator:browser");
-      EventUtils.synthesizeKey("KEY_Escape", { code: "Escape" }, browserWin);
+      EventUtils.synthesizeKey("KEY_Escape", {}, browserWin);
       break;
     case "pollOK":
       // Buttons are disabled at the moment, poll until they're reenabled.
       // Can't use setInterval here, because the window's in a modal state
       // and thus DOM events are suppressed.
       let interval = setInterval(() => {
         if (ui.button0.disabled)
           return;
--- a/toolkit/components/satchel/test/test_bug_511615.html
+++ b/toolkit/components/satchel/test/test_bug_511615.html
@@ -159,31 +159,31 @@ add_task(async function test_untrusted_e
   ]) {
     // We must wait for the entire timeout for each individual test, because the
     // next event in the list might prevent the popup from opening.
     await expectPopupDoesNotOpen(triggerFn);
   }
 
   // A privileged key press will actually open the popup.
   let popupShown = waitForNextPopup();
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+  synthesizeKey("KEY_ArrowDown", {});
   await popupShown;
 
   // The selected autocomplete item should not change from untrusted events.
   for (let triggerFn of [
     () => doKeyUnprivileged("down"),
     () => doKeyUnprivileged("page_down"),
   ]) {
     triggerFn();
     await checkSelectedIndexAfterResponseTime(-1);
   }
 
   // A privileged key press will actually change the selected index.
   let indexChanged = new Promise(resolve => notifySelectedIndex(0, resolve));
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+  synthesizeKey("KEY_ArrowDown", {});
   await indexChanged;
 
   // The selected autocomplete item should not change and it should not be
   // possible to use it from untrusted events.
   for (let triggerFn of [
     () => doKeyUnprivileged("down"),
     () => doKeyUnprivileged("page_down"),
     () => doKeyUnprivileged("right"),
--- a/toolkit/components/satchel/test/test_bug_787624.html
+++ b/toolkit/components/satchel/test/test_bug_787624.html
@@ -69,17 +69,17 @@ add_task(async function test_popup_not_m
   await new Promise(resolve => updateFormHistory([
     { op: "remove" },
     { op: "add", fieldname: "field1", value: "value1" },
     { op: "add", fieldname: "field1", value: "value2" },
   ], resolve));
 
   let popupShown = waitForNextPopup();
   input.focus();
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+  synthesizeKey("KEY_ArrowDown", {});
   await popupShown;
 
   let newRect = input.getBoundingClientRect();
   is(newRect.left, rect.left,
      "autocomplete popup does not disturb the input position");
   is(newRect.top, rect.top,
      "autocomplete popup does not disturb the input position");
 });
--- a/toolkit/components/satchel/test/test_datalist_with_caching.html
+++ b/toolkit/components/satchel/test/test_datalist_with_caching.html
@@ -98,39 +98,39 @@ function checkMenuEntries(expectedValues
   for (let i = 0; i < expectedValues.length; i++) {
     is(actualValues[i], expectedValues[i], testNum + " Checking menu entry #" + i);
   }
 }
 
 async function runTests() {
   testNum++;
   restoreForm();
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+  synthesizeKey("KEY_ArrowDown", {});
   await expectPopup();
 
   checkMenuEntries(["Sec", "First", "Second", "Secomundo"]);
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-  synthesizeKey("KEY_Enter", {code: "Enter"});
+  synthesizeKey("KEY_ArrowDown", {});
+  synthesizeKey("KEY_Enter", {});
   checkForm("Sec");
 
   testNum++;
   restoreForm();
   sendString("Sec");
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+  synthesizeKey("KEY_ArrowDown", {});
   await expectPopup();
 
   testNum++;
   checkMenuEntries(["Sec", "Second", "Secomundo"]);
   sendString("o");
   await waitForMenuChange(2);
 
   testNum++;
   checkMenuEntries(["Second", "Secomundo"]);
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-  synthesizeKey("KEY_Enter", {code: "Enter"});
+  synthesizeKey("KEY_ArrowDown", {});
+  synthesizeKey("KEY_Enter", {});
   checkForm("Second");
   SimpleTest.finish();
 }
 
 function startTest() {
   setupFormHistory(runTests);
 }
 
--- a/toolkit/components/satchel/test/test_form_autocomplete.html
+++ b/toolkit/components/satchel/test/test_form_autocomplete.html
@@ -246,203 +246,203 @@ function runTest() { // eslint-disable-l
 
   switch (testNum) {
     case 1:
       // Make sure initial form is empty.
       checkForm("");
       // Trigger autocomplete popup
       expectPopup();
       restoreForm();
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+      synthesizeKey("KEY_ArrowDown", {});
       break;
 
     case 2:
       checkMenuEntries(["value1", "value2", "value3", "value4"], testNum);
       // Check first entry
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+      synthesizeKey("KEY_ArrowDown", {});
       checkForm(""); // value shouldn't update
-      synthesizeKey("KEY_Enter", {code: "Enter"});
+      synthesizeKey("KEY_Enter", {});
       checkForm("value1");
 
       // Trigger autocomplete popup
       expectPopup();
       restoreForm();
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+      synthesizeKey("KEY_ArrowDown", {});
       break;
 
     case 3:
       // Check second entry
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-      synthesizeKey("KEY_Enter", {code: "Enter"});
+      synthesizeKey("KEY_ArrowDown", {});
+      synthesizeKey("KEY_ArrowDown", {});
+      synthesizeKey("KEY_Enter", {});
       checkForm("value2");
 
       // Trigger autocomplete popup
       expectPopup();
       restoreForm();
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+      synthesizeKey("KEY_ArrowDown", {});
       break;
 
     case 4:
       // Check third entry
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-      synthesizeKey("KEY_Enter", {code: "Enter"});
+      synthesizeKey("KEY_ArrowDown", {});
+      synthesizeKey("KEY_ArrowDown", {});
+      synthesizeKey("KEY_ArrowDown", {});
+      synthesizeKey("KEY_Enter", {});
       checkForm("value3");
 
       // Trigger autocomplete popup
       expectPopup();
       restoreForm();
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+      synthesizeKey("KEY_ArrowDown", {});
       break;
 
     case 5:
       // Check fourth entry
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-      synthesizeKey("KEY_Enter", {code: "Enter"});
+      synthesizeKey("KEY_ArrowDown", {});
+      synthesizeKey("KEY_ArrowDown", {});
+      synthesizeKey("KEY_ArrowDown", {});
+      synthesizeKey("KEY_ArrowDown", {});
+      synthesizeKey("KEY_Enter", {});
       checkForm("value4");
 
       // Trigger autocomplete popup
       expectPopup();
       restoreForm();
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+      synthesizeKey("KEY_ArrowDown", {});
       break;
 
     case 6:
       // Check first entry (wraparound)
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // deselects
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-      synthesizeKey("KEY_Enter", {code: "Enter"});
+      synthesizeKey("KEY_ArrowDown", {});
+      synthesizeKey("KEY_ArrowDown", {});
+      synthesizeKey("KEY_ArrowDown", {});
+      synthesizeKey("KEY_ArrowDown", {});
+      synthesizeKey("KEY_ArrowDown", {}); // deselects
+      synthesizeKey("KEY_ArrowDown", {});
+      synthesizeKey("KEY_Enter", {});
       checkForm("value1");
 
       // Trigger autocomplete popup
       expectPopup();
       restoreForm();
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+      synthesizeKey("KEY_ArrowDown", {});
       break;
 
     case 7:
       // Check the last entry via arrow-up
-      synthesizeKey("KEY_ArrowUp", {code: "ArrowUp"});
-      synthesizeKey("KEY_Enter", {code: "Enter"});
+      synthesizeKey("KEY_ArrowUp", {});
+      synthesizeKey("KEY_Enter", {});
       checkForm("value4");
 
       // Trigger autocomplete popup
       expectPopup();
       restoreForm();
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+      synthesizeKey("KEY_ArrowDown", {});
       break;
 
     case 8:
       // Check the last entry via arrow-up
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}); // select first entry
-      synthesizeKey("KEY_ArrowUp", {code: "ArrowUp"}); // selects nothing!
-      synthesizeKey("KEY_ArrowUp", {code: "ArrowUp"}); // select last entry
-      synthesizeKey("KEY_Enter", {code: "Enter"});
+      synthesizeKey("KEY_ArrowDown", {}); // select first entry
+      synthesizeKey("KEY_ArrowUp", {}); // selects nothing!
+      synthesizeKey("KEY_ArrowUp", {}); // select last entry
+      synthesizeKey("KEY_Enter", {});
       checkForm("value4");
 
       // Trigger autocomplete popup
       expectPopup();
       restoreForm();
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+      synthesizeKey("KEY_ArrowDown", {});
       break;
 
     case 9:
       // Check the last entry via arrow-up (wraparound)
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-      synthesizeKey("KEY_ArrowUp", {code: "ArrowUp"}); // deselects
-      synthesizeKey("KEY_ArrowUp", {code: "ArrowUp"}); // last entry
-      synthesizeKey("KEY_ArrowUp", {code: "ArrowUp"});
-      synthesizeKey("KEY_ArrowUp", {code: "ArrowUp"});
-      synthesizeKey("KEY_ArrowUp", {code: "ArrowUp"}); // first entry
-      synthesizeKey("KEY_ArrowUp", {code: "ArrowUp"}); // deselects
-      synthesizeKey("KEY_ArrowUp", {code: "ArrowUp"}); // last entry
-      synthesizeKey("KEY_Enter", {code: "Enter"});
+      synthesizeKey("KEY_ArrowDown", {});
+      synthesizeKey("KEY_ArrowUp", {}); // deselects
+      synthesizeKey("KEY_ArrowUp", {}); // last entry
+      synthesizeKey("KEY_ArrowUp", {});
+      synthesizeKey("KEY_ArrowUp", {});
+      synthesizeKey("KEY_ArrowUp", {}); // first entry
+      synthesizeKey("KEY_ArrowUp", {}); // deselects
+      synthesizeKey("KEY_ArrowUp", {}); // last entry
+      synthesizeKey("KEY_Enter", {});
       checkForm("value4");
 
       // Trigger autocomplete popup
       expectPopup();
       restoreForm();
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+      synthesizeKey("KEY_ArrowDown", {});
       break;
 
     case 10:
       // Set first entry w/o triggering autocomplete
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-      synthesizeKey("KEY_ArrowRight", {code: "ArrowRight"});
+      synthesizeKey("KEY_ArrowDown", {});
+      synthesizeKey("KEY_ArrowRight", {});
       checkForm("value1");
 
       // Trigger autocomplete popup
       expectPopup();
       restoreForm();
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+      synthesizeKey("KEY_ArrowDown", {});
       break;
 
     case 11:
       // Set first entry w/o triggering autocomplete
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-      synthesizeKey("KEY_ArrowLeft", {code: "ArrowLeft"});
+      synthesizeKey("KEY_ArrowDown", {});
+      synthesizeKey("KEY_ArrowLeft", {});
       checkForm("value1");
 
       // Trigger autocomplete popup
       expectPopup();
       restoreForm();
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+      synthesizeKey("KEY_ArrowDown", {});
       break;
 
     case 12:
       // Check first entry (page up)
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-      synthesizeKey("KEY_PageUp", {code: "PageUp"});
-      synthesizeKey("KEY_Enter", {code: "Enter"});
+      synthesizeKey("KEY_ArrowDown", {});
+      synthesizeKey("KEY_ArrowDown", {});
+      synthesizeKey("KEY_PageUp", {});
+      synthesizeKey("KEY_Enter", {});
       checkForm("value1");
 
       // Trigger autocomplete popup
       expectPopup();
       restoreForm();
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+      synthesizeKey("KEY_ArrowDown", {});
       break;
 
     case 13:
       // Check last entry (page down)
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-      synthesizeKey("KEY_PageDown", {code: "PageDown"});
-      synthesizeKey("KEY_Enter", {code: "Enter"});
+      synthesizeKey("KEY_ArrowDown", {});
+      synthesizeKey("KEY_PageDown", {});
+      synthesizeKey("KEY_Enter", {});
       checkForm("value4");
 
       // Trigger autocomplete popup
       testNum = 49;
       expectPopup();
       restoreForm();
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+      synthesizeKey("KEY_ArrowDown", {});
       break;
 
     /* Test removing entries from the dropdown */
 
     case 50:
       checkMenuEntries(["value1", "value2", "value3", "value4"], testNum);
       // Delete the first entry (of 4)
       setForm("value");
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+      synthesizeKey("KEY_ArrowDown", {});
 
       // On OS X, shift-backspace and shift-delete work, just delete does not.
       // On Win/Linux, shift-backspace does not work, delete and shift-delete do.
       if (SpecialPowers.OS == "Darwin") {
-        synthesizeKey("KEY_Backspace", {code: "Backspace", shiftKey: true});
+        synthesizeKey("KEY_Backspace", {shiftKey: true});
       } else {
-        synthesizeKey("KEY_Delete", {code: "Delete", shiftKey: true});
+        synthesizeKey("KEY_Delete", {shiftKey: true});
       }
 
       // This tests that on OS X shift-backspace didn't delete the last character
       // in the input (bug 480262).
       waitForMenuChange(3);
       break;
 
     case 51:
@@ -450,122 +450,122 @@ function runTest() { // eslint-disable-l
       countEntries("field1", "value1",
                    function(num) {
                      ok(!num, testNum + " checking that f1/v1 was deleted");
                      runTest();
                    });
       break;
 
     case 52:
-      synthesizeKey("KEY_Enter", {code: "Enter"});
+      synthesizeKey("KEY_Enter", {});
       checkForm("value2");
 
       // Trigger autocomplete popup
       expectPopup();
       restoreForm();
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+      synthesizeKey("KEY_ArrowDown", {});
       break;
 
     case 53:
       checkMenuEntries(["value2", "value3", "value4"], testNum);
       // Check the new first entry (of 3)
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-      synthesizeKey("KEY_Enter", {code: "Enter"});
+      synthesizeKey("KEY_ArrowDown", {});
+      synthesizeKey("KEY_Enter", {});
       checkForm("value2");
 
       // Trigger autocomplete popup
       expectPopup();
       restoreForm();
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+      synthesizeKey("KEY_ArrowDown", {});
       break;
 
     case 54:
       // Delete the second entry (of 3)
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-      synthesizeKey("KEY_Delete", {code: "Delete", shiftKey: true});
+      synthesizeKey("KEY_ArrowDown", {});
+      synthesizeKey("KEY_ArrowDown", {});
+      synthesizeKey("KEY_Delete", {shiftKey: true});
       waitForMenuChange(2);
       break;
 
     case 55:
       checkForm("");
       countEntries("field1", "value3",
                    function(num) {
                      ok(!num, testNum + " checking that f1/v3 was deleted");
                      runTest();
                    });
       break;
 
     case 56:
-      synthesizeKey("KEY_Enter", {code: "Enter"});
+      synthesizeKey("KEY_Enter", {});
       checkForm("value4");
 
       // Trigger autocomplete popup
       expectPopup();
       restoreForm();
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+      synthesizeKey("KEY_ArrowDown", {});
       break;
 
     case 57:
       checkMenuEntries(["value2", "value4"], testNum);
       // Check the new first entry (of 2)
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-      synthesizeKey("KEY_Enter", {code: "Enter"});
+      synthesizeKey("KEY_ArrowDown", {});
+      synthesizeKey("KEY_Enter", {});
       checkForm("value2");
 
       // Trigger autocomplete popup
       expectPopup();
       restoreForm();
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+      synthesizeKey("KEY_ArrowDown", {});
       break;
 
     case 58:
       // Delete the last entry (of 2)
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-      synthesizeKey("KEY_Delete", {code: "Delete", shiftKey: true});
+      synthesizeKey("KEY_ArrowDown", {});
+      synthesizeKey("KEY_ArrowDown", {});
+      synthesizeKey("KEY_Delete", {shiftKey: true});
       checkForm("");
       waitForMenuChange(1);
       break;
 
     case 59:
       countEntries("field1", "value4",
                    function(num) {
                      ok(!num, testNum + " checking that f1/v4 was deleted");
                      runTest();
                    });
       break;
 
     case 60:
-      synthesizeKey("KEY_Enter", {code: "Enter"});
+      synthesizeKey("KEY_Enter", {});
       checkForm("value2");
 
       // Trigger autocomplete popup
       expectPopup();
       restoreForm();
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+      synthesizeKey("KEY_ArrowDown", {});
       break;
 
     case 61:
       checkMenuEntries(["value2"], testNum);
       // Check the new first entry (of 1)
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-      synthesizeKey("KEY_Enter", {code: "Enter"});
+      synthesizeKey("KEY_ArrowDown", {});
+      synthesizeKey("KEY_Enter", {});
       checkForm("value2");
 
       // Trigger autocomplete popup
       expectPopup();
       restoreForm();
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+      synthesizeKey("KEY_ArrowDown", {});
       break;
 
     case 62:
       // Delete the only remaining entry
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-      synthesizeKey("KEY_Delete", {code: "Delete", shiftKey: true});
+      synthesizeKey("KEY_ArrowDown", {});
+      synthesizeKey("KEY_Delete", {shiftKey: true});
       waitForMenuChange(0);
       break;
 
     case 63:
       checkForm("");
       countEntries("field1", "value2",
                    function(num) {
                      ok(!num, testNum + " checking that f1/v2 was deleted");
@@ -574,54 +574,54 @@ function runTest() { // eslint-disable-l
       break;
 
     case 64:
       // Look at form 2, trigger autocomplete popup
       input = $_(2, "field2");
       testNum = 99;
       expectPopup();
       restoreForm();
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+      synthesizeKey("KEY_ArrowDown", {});
       break;
 
     /* Test entries with autocomplete=off */
 
     case 100:
       // Select first entry
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-      synthesizeKey("KEY_Enter", {code: "Enter"});
+      synthesizeKey("KEY_ArrowDown", {});
+      synthesizeKey("KEY_Enter", {});
       checkForm("value1");
 
       // Look at form 3, try to trigger autocomplete popup
       input = $_(3, "field2");
       restoreForm();
       // Sometimes, this will fail if scrollTo(0, 0) is called, so that doesn't
       // happen here. Fortunately, a different input is used from the last test,
       // so a scroll should still occur.
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+      synthesizeKey("KEY_ArrowDown", {});
       waitForScroll();
       break;
 
     case 101:
       // Ensure there's no autocomplete dropdown (autocomplete=off is present)
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-      synthesizeKey("KEY_Enter", {code: "Enter"});
+      synthesizeKey("KEY_ArrowDown", {});
+      synthesizeKey("KEY_Enter", {});
       checkForm("");
 
       // Look at form 4, try to trigger autocomplete popup
       input = $_(4, "field2");
       restoreForm();
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+      synthesizeKey("KEY_ArrowDown", {});
       waitForMenuChange(0);
       break;
 
     case 102:
       // Ensure there's no autocomplete dropdown (autocomplete=off is present)
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-      synthesizeKey("KEY_Enter", {code: "Enter"});
+      synthesizeKey("KEY_ArrowDown", {});
+      synthesizeKey("KEY_Enter", {});
       checkForm("");
 
       // Look at form 5, try to trigger autocomplete popup
       input = $_(5, "field3");
       restoreForm();
       testNum = 199;
       expectPopup();
       input.focus();
@@ -641,51 +641,51 @@ function runTest() { // eslint-disable-l
       checkMenuEntries(["aa", "aaz", "aa\xe6"], testNum);
       input.focus();
       sendChar("\xc6");
       waitForMenuChange(1);
       break;
 
     case 202:
       checkMenuEntries(["aa\xe6"], testNum);
-      synthesizeKey("KEY_Backspace", {code: "Backspace"});
+      synthesizeKey("KEY_Backspace", {});
       waitForMenuChange(3);
       break;
 
     case 203:
       checkMenuEntries(["aa", "aaz", "aa\xe6"], testNum);
-      synthesizeKey("KEY_Backspace", {code: "Backspace"});
+      synthesizeKey("KEY_Backspace", {});
       waitForMenuChange(5);
       break;
 
     case 204:
       checkMenuEntries(["a", "aa", "aaz", "aa\xe6", "az"], testNum);
       input.focus();
       sendChar("z");
       waitForMenuChange(2);
       break;
 
     case 205:
       checkMenuEntries(["az", "aaz"], testNum);
       input.focus();
-      synthesizeKey("KEY_ArrowLeft", {code: "ArrowLeft"});
+      synthesizeKey("KEY_ArrowLeft", {});
       expectPopup();
       // Check case-insensitivity.
       sendChar("A");
       break;
 
     case 206:
       checkMenuEntries(["aaz"], testNum);
       addEntry("field3", "aazq");
       break;
 
     case 207:
       // check that results were cached
       input.focus();
-      synthesizeKey("KEY_ArrowRight", {code: "ArrowRight"});
+      synthesizeKey("KEY_ArrowRight", {});
       sendChar("q");
       waitForMenuChange(0);
       break;
 
     case 208:
       // check that results were cached
       checkMenuEntries([], testNum);
       addEntry("field3", "aazqq");
@@ -696,17 +696,17 @@ function runTest() { // eslint-disable-l
       window.scrollTo(0, 0);
       sendChar("q");
       waitForMenuChange(0);
       break;
 
     case 210:
       // check that empty results were cached - bug 496466
       checkMenuEntries([], testNum);
-      synthesizeKey("KEY_Escape", {code: "Escape"});
+      synthesizeKey("KEY_Escape", {});
 
       // Look at form 6, try to trigger autocomplete popup
       input = $_(6, "field4");
       restoreForm();
       testNum = 249;
       expectPopup();
       input.focus();
       sendChar("a");
@@ -749,17 +749,17 @@ function runTest() { // eslint-disable-l
       waitForMenuChange(2);
       break;
 
     case 254:
       // check multi-word substring matches
       checkMenuEntries(["bc d\xe6", "aba\xe6"]);
       input.focus();
       expectPopup();
-      synthesizeKey("KEY_ArrowLeft", {code: "ArrowLeft"});
+      synthesizeKey("KEY_ArrowLeft", {});
       sendChar("d");
       break;
 
     case 255:
       // check inserting in multi-word searches
       checkMenuEntries(["bc d\xe6"], testNum);
       input.focus();
       sendChar("z");
@@ -769,142 +769,142 @@ function runTest() { // eslint-disable-l
     case 256:
       checkMenuEntries([], testNum);
 
       // Look at form 7, try to trigger autocomplete popup
       input = $_(7, "field5");
       testNum = 299;
       expectPopup();
       restoreForm();
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+      synthesizeKey("KEY_ArrowDown", {});
       break;
 
     case 300:
       checkMenuEntries(["1", "12", "123", "1234"], testNum);
       input.maxLength = 4;
       expectPopup();
-      synthesizeKey("KEY_Escape", {code: "Escape"});
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+      synthesizeKey("KEY_Escape", {});
+      synthesizeKey("KEY_ArrowDown", {});
       break;
 
     case 301:
       checkMenuEntries(["1", "12", "123", "1234"], testNum);
       input.maxLength = 3;
       expectPopup();
-      synthesizeKey("KEY_Escape", {code: "Escape"});
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+      synthesizeKey("KEY_Escape", {});
+      synthesizeKey("KEY_ArrowDown", {});
       break;
 
     case 302:
       checkMenuEntries(["1", "12", "123"], testNum);
       input.maxLength = 2;
       expectPopup();
-      synthesizeKey("KEY_Escape", {code: "Escape"});
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+      synthesizeKey("KEY_Escape", {});
+      synthesizeKey("KEY_ArrowDown", {});
       break;
 
     case 303:
       checkMenuEntries(["1", "12"], testNum);
       input.maxLength = 1;
       expectPopup();
-      synthesizeKey("KEY_Escape", {code: "Escape"});
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+      synthesizeKey("KEY_Escape", {});
+      synthesizeKey("KEY_ArrowDown", {});
       break;
 
     case 304:
       checkMenuEntries(["1"], testNum);
       input.maxLength = 0;
-      synthesizeKey("KEY_Escape", {code: "Escape"});
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+      synthesizeKey("KEY_Escape", {});
+      synthesizeKey("KEY_ArrowDown", {});
       waitForMenuChange(0);
       break;
 
     case 305:
       checkMenuEntries([], testNum);
       input.maxLength = 4;
 
       // now again with a character typed
       input.focus();
       sendChar("1");
       expectPopup();
-      synthesizeKey("KEY_Escape", {code: "Escape"});
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+      synthesizeKey("KEY_Escape", {});
+      synthesizeKey("KEY_ArrowDown", {});
       break;
 
     case 306:
       checkMenuEntries(["1", "12", "123", "1234"], testNum);
       input.maxLength = 3;
       expectPopup();
-      synthesizeKey("KEY_Escape", {code: "Escape"});
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+      synthesizeKey("KEY_Escape", {});
+      synthesizeKey("KEY_ArrowDown", {});
       break;
 
     case 307:
       checkMenuEntries(["1", "12", "123"], testNum);
       input.maxLength = 2;
       expectPopup();
-      synthesizeKey("KEY_Escape", {code: "Escape"});
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+      synthesizeKey("KEY_Escape", {});
+      synthesizeKey("KEY_ArrowDown", {});
       break;
 
     case 308:
       checkMenuEntries(["1", "12"], testNum);
       input.maxLength = 1;
       expectPopup();
-      synthesizeKey("KEY_Escape", {code: "Escape"});
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+      synthesizeKey("KEY_Escape", {});
+      synthesizeKey("KEY_ArrowDown", {});
       break;
 
     case 309:
       checkMenuEntries(["1"], testNum);
       input.maxLength = 0;
-      synthesizeKey("KEY_Escape", {code: "Escape"});
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+      synthesizeKey("KEY_Escape", {});
+      synthesizeKey("KEY_ArrowDown", {});
       waitForMenuChange(0);
       break;
 
     case 310:
       checkMenuEntries([], testNum);
 
       input = $_(8, "field6");
       testNum = 399;
       expectPopup();
       restoreForm();
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+      synthesizeKey("KEY_ArrowDown", {});
       break;
 
     case 400:
     case 401:
     case 402:
     case 403:
       checkMenuEntries(["value"], testNum);
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-      synthesizeKey("KEY_Enter", {code: "Enter"});
+      synthesizeKey("KEY_ArrowDown", {});
+      synthesizeKey("KEY_Enter", {});
       checkForm("value");
 
       if (testNum == 400) {
         input = $_(9, "field7");
       } else if (testNum == 401) {
         input = $_(10, "field8");
       } else if (testNum == 402) {
         input = $_(11, "field9");
       } else if (testNum == 403) {
         todo(false, "Fix input type=number");
         input = $_(12, "field10");
       }
 
       expectPopup();
       restoreForm();
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+      synthesizeKey("KEY_ArrowDown", {});
       break;
 
     case 404:
       checkMenuEntries(["42"], testNum);
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-      synthesizeKey("KEY_Enter", {code: "Enter"});
+      synthesizeKey("KEY_ArrowDown", {});
+      synthesizeKey("KEY_Enter", {});
       checkForm("42");
 
       input = $_(14, "field11");
       restoreForm();
       waitForMenuChange(0);
       break;
 
     case 405:
@@ -919,108 +919,108 @@ function runTest() { // eslint-disable-l
 
     case 406:
       checkMenuEntries([]); // type=time with it's own control frame does not
       // have a drop down menu for now
       checkForm("");
 
       input = $_(16, "field13");
       restoreForm();
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+      synthesizeKey("KEY_ArrowDown", {});
       waitForMenuChange(0);
       break;
 
     case 407:
       checkMenuEntries([]); // type=range does not have a drop down menu
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-      synthesizeKey("KEY_Enter", {code: "Enter"});
+      synthesizeKey("KEY_ArrowDown", {});
+      synthesizeKey("KEY_Enter", {});
       checkForm("30"); // default (midway between minimum (0) and maximum (64)) - step
 
       input = $_(17, "field14");
       restoreForm();
       waitForMenuChange(0);
       break;
 
     case 408:
       checkMenuEntries([]); // type=color does not have a drop down menu
       checkForm("#000000"); // default color value
 
       input = $_(18, "field15");
       restoreForm();
       expectPopup();
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+      synthesizeKey("KEY_ArrowDown", {});
       break;
 
     case 409:
       checkMenuEntries(["2016-08"]);
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-      synthesizeKey("KEY_Enter", {code: "Enter"});
+      synthesizeKey("KEY_ArrowDown", {});
+      synthesizeKey("KEY_Enter", {});
       checkForm("2016-08");
 
       input = $_(19, "field16");
       restoreForm();
       expectPopup();
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+      synthesizeKey("KEY_ArrowDown", {});
       break;
 
     case 410:
       checkMenuEntries(["2016-W32"]);
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-      synthesizeKey("KEY_Enter", {code: "Enter"});
+      synthesizeKey("KEY_ArrowDown", {});
+      synthesizeKey("KEY_Enter", {});
       checkForm("2016-W32");
 
       input = $_(20, "field17");
       restoreForm();
       expectPopup();
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+      synthesizeKey("KEY_ArrowDown", {});
       break;
 
     case 411:
       checkMenuEntries(["2016-10-21T10:10"]);
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-      synthesizeKey("KEY_Enter", {code: "Enter"});
+      synthesizeKey("KEY_ArrowDown", {});
+      synthesizeKey("KEY_Enter", {});
       checkForm("2016-10-21T10:10");
 
       addEntry("field1", "value1");
       break;
 
     case 412:
       input = $_(1, "field1");
       // Go to test 500.
       testNum = 499;
 
       expectPopup();
       restoreForm();
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+      synthesizeKey("KEY_ArrowDown", {});
       break;
 
     // Check that the input event is fired.
     case 500:
       input.addEventListener("input", function(event) {
         ok(true, testNum + " oninput should have been received");
         ok(event.bubbles, testNum + " input event should bubble");
         ok(event.cancelable, testNum + " input event should be cancelable");
       }, {once: true});
 
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+      synthesizeKey("KEY_ArrowDown", {});
       checkForm("");
-      synthesizeKey("KEY_Enter", {code: "Enter"});
+      synthesizeKey("KEY_Enter", {});
       checkForm("value1");
       testNum = 599;
       setTimeout(runTest, 100);
       break;
 
     case 600:
       // check we don't show autocomplete for searchbar-history
       input = $_(13, "searchbar-history");
 
       // Trigger autocomplete popup
       checkForm("");
       restoreForm();
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+      synthesizeKey("KEY_ArrowDown", {});
       waitForMenuChange(0);
       break;
 
     case 601:
       checkMenuEntries([], testNum);
       input.blur();
       SimpleTest.finish();
       return;
--- a/toolkit/components/satchel/test/test_form_autocomplete_with_list.html
+++ b/toolkit/components/satchel/test/test_form_autocomplete_with_list.html
@@ -111,260 +111,260 @@ function runTest() {
 
   switch (testNum) {
     case 1:
       // Make sure initial form is empty.
       checkForm("");
       // Trigger autocomplete popup
       expectPopup();
       restoreForm();
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+      synthesizeKey("KEY_ArrowDown", {});
       break;
     case 2:
       checkMenuEntries(["historyvalue", "PASS1", "PASS2", "final"], testNum);
       // Check first entry
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+      synthesizeKey("KEY_ArrowDown", {});
       checkForm(""); // value shouldn't update
-      synthesizeKey("KEY_Enter", {code: "Enter"});
+      synthesizeKey("KEY_Enter", {});
       checkForm("historyvalue");
 
       // Trigger autocomplete popup
       expectPopup();
       restoreForm();
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+      synthesizeKey("KEY_ArrowDown", {});
       break;
 
     case 3:
       // Check second entry
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-      synthesizeKey("KEY_Enter", {code: "Enter"});
+      synthesizeKey("KEY_ArrowDown", {});
+      synthesizeKey("KEY_ArrowDown", {});
+      synthesizeKey("KEY_Enter", {});
       checkForm("Google");
 
       // Trigger autocomplete popup
       expectPopup();
       restoreForm();
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+      synthesizeKey("KEY_ArrowDown", {});
       break;
 
     case 4:
       // Check third entry
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-      synthesizeKey("KEY_Enter", {code: "Enter"});
+      synthesizeKey("KEY_ArrowDown", {});
+      synthesizeKey("KEY_ArrowDown", {});
+      synthesizeKey("KEY_ArrowDown", {});
+      synthesizeKey("KEY_Enter", {});
       checkForm("Reddit");
 
       // Trigger autocomplete popup
       expectPopup();
       restoreForm();
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+      synthesizeKey("KEY_ArrowDown", {});
       break;
 
     case 5:
       // Check fourth entry
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-      synthesizeKey("KEY_Enter", {code: "Enter"});
+      synthesizeKey("KEY_ArrowDown", {});
+      synthesizeKey("KEY_ArrowDown", {});
+      synthesizeKey("KEY_ArrowDown", {});
+      synthesizeKey("KEY_ArrowDown", {});
+      synthesizeKey("KEY_Enter", {});
       checkForm("final");
       expectPopup();
       restoreForm();
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+      synthesizeKey("KEY_ArrowDown", {});
       break;
 
     case 6:
       // Delete the first entry (of 3)
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-      synthesizeKey("KEY_Delete", {code: "Delete", shiftKey: true});
+      synthesizeKey("KEY_ArrowDown", {});
+      synthesizeKey("KEY_Delete", {shiftKey: true});
       waitForMenuChange(3);
       break;
 
     case 7:
       checkForm("");
       countEntries("field1", "historyvalue",
                    function(num) {
                      ok(!num, testNum + " checking that form history value was deleted");
                      runTest();
                    });
       break;
 
     case 8:
-      synthesizeKey("KEY_Enter", {code: "Enter"});
+      synthesizeKey("KEY_Enter", {});
       checkForm("Google");
 
       // Trigger autocomplete popup
       expectPopup();
       restoreForm();
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+      synthesizeKey("KEY_ArrowDown", {});
       break;
 
     case 9:
       // Test deletion
       checkMenuEntries(["PASS1", "PASS2", "final"], testNum);
       // Check the new first entry (of 3)
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-      synthesizeKey("KEY_Enter", {code: "Enter"});
+      synthesizeKey("KEY_ArrowDown", {});
+      synthesizeKey("KEY_Enter", {});
       checkForm("Google");
 
       expectPopup();
       restoreForm();
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+      synthesizeKey("KEY_ArrowDown", {});
       break;
 
     case 10:
       // Test autocompletion of datalists with cached results.
       sendString("PAS");
       waitForMenuChange(2);
       break;
 
     case 11:
       // Continuation of test 10
       sendString("S1");
       waitForMenuChange(1);
       break;
 
     case 12:
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-      synthesizeKey("KEY_Enter", {code: "Enter"});
+      synthesizeKey("KEY_ArrowDown", {});
+      synthesizeKey("KEY_Enter", {});
       checkForm("Google");
 
       // Trigger autocomplete popup
       // Look at form 3, try to trigger autocomplete popup
       input.value = "";
       input = $_(3, "field2");
       testNum = 99;
       expectPopup();
       restoreForm();
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+      synthesizeKey("KEY_ArrowDown", {});
       break;
 
     case 100:
       checkMenuEntries(["PASS1", "PASS2", "final"], testNum);
       // Check first entry
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+      synthesizeKey("KEY_ArrowDown", {});
       checkForm(""); // value shouldn't update
-      synthesizeKey("KEY_Enter", {code: "Enter"});
+      synthesizeKey("KEY_Enter", {});
       checkForm("Google");
 
       // Trigger autocomplete popup
       expectPopup();
       restoreForm();
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+      synthesizeKey("KEY_ArrowDown", {});
       break;
 
     case 101:
       // Check second entry
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-      synthesizeKey("KEY_Enter", {code: "Enter"});
+      synthesizeKey("KEY_ArrowDown", {});
+      synthesizeKey("KEY_ArrowDown", {});
+      synthesizeKey("KEY_Enter", {});
       checkForm("Reddit");
 
       // Trigger autocomplete popup
       expectPopup();
       restoreForm();
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+      synthesizeKey("KEY_ArrowDown", {});
       break;
 
     case 102:
       // Check third entry
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-      synthesizeKey("KEY_Enter", {code: "Enter"});
+      synthesizeKey("KEY_ArrowDown", {});
+      synthesizeKey("KEY_ArrowDown", {});
+      synthesizeKey("KEY_ArrowDown", {});
+      synthesizeKey("KEY_Enter", {});
       checkForm("final");
 
       // Trigger autocomplete popup
       expectPopup();
       restoreForm();
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+      synthesizeKey("KEY_ArrowDown", {});
       break;
 
     case 103:
       checkMenuEntries(["PASS1", "PASS2", "final"], testNum);
       // Check first entry
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+      synthesizeKey("KEY_ArrowDown", {});
       checkForm(""); // value shouldn't update
-      synthesizeKey("KEY_Enter", {code: "Enter"});
+      synthesizeKey("KEY_Enter", {});
       checkForm("Google");
 
       // Trigger autocomplete popup
       expectPopup();
       restoreForm();
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+      synthesizeKey("KEY_ArrowDown", {});
       break;
 
     case 104:
       // Check second entry
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-      synthesizeKey("KEY_Enter", {code: "Enter"});
+      synthesizeKey("KEY_ArrowDown", {});
+      synthesizeKey("KEY_ArrowDown", {});
+      synthesizeKey("KEY_Enter", {});
       checkForm("Reddit");
 
       // Trigger autocomplete popup
       expectPopup();
       restoreForm();
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+      synthesizeKey("KEY_ArrowDown", {});
       break;
 
     case 105:
       // Check third entry
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-      synthesizeKey("KEY_Enter", {code: "Enter"});
+      synthesizeKey("KEY_ArrowDown", {});
+      synthesizeKey("KEY_ArrowDown", {});
+      synthesizeKey("KEY_ArrowDown", {});
+      synthesizeKey("KEY_Enter", {});
       checkForm("final");
 
       testNum = 199;
       expectPopup();
       restoreForm();
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+      synthesizeKey("KEY_ArrowDown", {});
       break;
 
     // Test dynamic updates.
     // For some reasons, when there is an update of the list, the selection is
     // lost so we need to go down like if we were at the beginning of the list
     // again.
     case 200:
       // Removing the second element while on the first then going down and
       // push enter. Value should be one from the third suggesion.
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+      synthesizeKey("KEY_ArrowDown", {});
       datalist = document.getElementById("suggest");
       let toRemove = datalist.children[1];
       datalist.removeChild(toRemove);
 
       SimpleTest.executeSoon(function() {
-        synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-        synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-        synthesizeKey("KEY_Enter", {code: "Enter"});
+        synthesizeKey("KEY_ArrowDown", {});
+        synthesizeKey("KEY_ArrowDown", {});
+        synthesizeKey("KEY_Enter", {});
         checkForm("final");
 
         // Restore the element.
         datalist.insertBefore(toRemove, datalist.children[1]);
         expectPopup();
         restoreForm();
-        synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+        synthesizeKey("KEY_ArrowDown", {});
       });
       break;
 
     case 201:
       // Adding an attribute after the first one while on the first then going
       // down and push enter. Value should be the on from the new suggestion.
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+      synthesizeKey("KEY_ArrowDown", {});
       datalist = document.getElementById("suggest");
       let added = new Option("Foo");
       datalist.insertBefore(added, datalist.children[1]);
       waitForMenuChange(4);
       break;
 
     case 202:
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-      synthesizeKey("KEY_Enter", {code: "Enter"});
+      synthesizeKey("KEY_ArrowDown", {});
+      synthesizeKey("KEY_ArrowDown", {});
+      synthesizeKey("KEY_Enter", {});
       checkForm("Foo");
 
       // Remove the element.
       datalist = document.getElementById("suggest");
       datalist.removeChild(datalist.children[1]);
       waitForMenuChange(0);
       break;
 
@@ -373,18 +373,18 @@ function runTest() {
       restoreForm();
       datalist = document.getElementById("suggest");
       prevValue = datalist.children[0].value;
       datalist.children[0].value = "foo";
       expectPopup();
       break;
 
     case 204:
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-      synthesizeKey("KEY_Enter", {code: "Enter"});
+      synthesizeKey("KEY_ArrowDown", {});
+      synthesizeKey("KEY_Enter", {});
       checkForm("foo");
 
       datalist = document.getElementById("suggest");
       datalist.children[0].value = prevValue;
       waitForMenuChange(0);
       break;
 
     case 205:
@@ -393,93 +393,93 @@ function runTest() {
       datalist = document.getElementById("suggest");
       prevValue = datalist.children[0].getAttribute("value");
       datalist.children[0].removeAttribute("value");
       datalist.children[0].textContent = "foobar";
       expectPopup();
       break;
 
     case 206:
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-      synthesizeKey("KEY_Enter", {code: "Enter"});
+      synthesizeKey("KEY_ArrowDown", {});
+      synthesizeKey("KEY_Enter", {});
       checkForm("foobar");
 
       datalist = document.getElementById("suggest");
       datalist.children[0].setAttribute("value", prevValue);
       testNum = 299;
       waitForMenuChange(0);
       break;
 
     // Tests for filtering (or not).
     case 300:
       // Filters with first letter of the word.
       restoreForm();
-      synthesizeKey("f", {code: "KeyF"});
+      synthesizeKey("f", {});
       expectPopup();
       break;
 
     case 301:
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-      synthesizeKey("KEY_Enter", {code: "Enter"});
+      synthesizeKey("KEY_ArrowDown", {});
+      synthesizeKey("KEY_Enter", {});
       checkForm("final");
       expectPopup();
       restoreForm();
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+      synthesizeKey("KEY_ArrowDown", {});
       break;
 
     case 302:
       // Filter with a letter in the middle of the word.
-      synthesizeKey("i", {code: "KeyI"});
-      synthesizeKey("n", {code: "KeyN"});
+      synthesizeKey("i", {});
+      synthesizeKey("n", {});
       waitForMenuChange(1);
       break;
 
     case 303:
       // Continuation of test 302.
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-      synthesizeKey("KEY_Enter", {code: "Enter"});
+      synthesizeKey("KEY_ArrowDown", {});
+      synthesizeKey("KEY_Enter", {});
       checkForm("final");
       expectPopup();
       restoreForm();
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+      synthesizeKey("KEY_ArrowDown", {});
       break;
 
     case 304:
       // Filter is disabled with mozNoFilter.
       input.setAttribute("mozNoFilter", "true");
-      synthesizeKey("f", {code: "KeyF"});
+      synthesizeKey("f", {});
       waitForMenuChange(3); // no change
       break;
 
     case 305:
       // Continuation of test 304.
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-      synthesizeKey("KEY_Enter", {code: "Enter"});
+      synthesizeKey("KEY_ArrowDown", {});
+      synthesizeKey("KEY_Enter", {});
       checkForm("Google");
       input.removeAttribute("mozNoFilter");
       testNum = 399;
       expectPopup();
       restoreForm();
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+      synthesizeKey("KEY_ArrowDown", {});
       break;
 
     case 400:
       // Check that the input event is fired.
       input.addEventListener("input", function(event) {
         ok(true, "oninput should have been received");
         ok(event.bubbles, "input event should bubble");
         ok(event.cancelable, "input event should be cancelable");
         checkForm("Google");
         input.blur();
         SimpleTest.finish();
       }, {once: true});
 
-      synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+      synthesizeKey("KEY_ArrowDown", {});
       checkForm("");
-      synthesizeKey("KEY_Enter", {code: "Enter"});
+      synthesizeKey("KEY_Enter", {});
       break;
 
     default:
       ok(false, "Unexpected invocation of test #" + testNum);
       SimpleTest.finish();
   }
 }
 
--- a/toolkit/components/satchel/test/test_password_autocomplete.html
+++ b/toolkit/components/satchel/test/test_password_autocomplete.html
@@ -102,22 +102,22 @@ add_task(async function test_initialize(
 add_task(async function test_secure_noFormHistoryOrWarning() {
   let input = $_(1, "field1");
 
   // The autocomplete popup should not open under any circumstances on
   // type=password with password manager disabled.
   for (let triggerFn of [
     () => input.focus(),
     () => input.click(),
-    () => synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"}),
-    () => synthesizeKey("KEY_PageDown", {code: "PageDown"}),
-    () => synthesizeKey("KEY_Enter", {code: "Enter"}),
-    () => synthesizeKey("v", {code: "KeyV"}),
-    () => synthesizeKey(" ", {code: "Space"}),
-    () => synthesizeKey("KEY_Backspace", {code: "Backspace"}),
+    () => synthesizeKey("KEY_ArrowDown", {}),
+    () => synthesizeKey("KEY_PageDown", {}),
+    () => synthesizeKey("KEY_Enter", {}),
+    () => synthesizeKey("v", {}),
+    () => synthesizeKey(" ", {}),
+    () => synthesizeKey("KEY_Backspace", {}),
   ]) {
     ok(true, "Testing: " + triggerFn.toString());
     // We must wait for the entire timeout for each individual test, because the
     // next event in the list might prevent the popup from opening.
     await expectPopupDoesNotOpen(triggerFn);
   }
 
   // Close the popup.
--- a/toolkit/components/satchel/test/test_popup_direction.html
+++ b/toolkit/components/satchel/test/test_popup_direction.html
@@ -41,17 +41,17 @@ add_task(async function test_popup_direc
     { op: "add", fieldname: "field1", value: "value2" },
   ], resolve));
 
   for (let direction of ["ltr", "rtl"]) {
     document.getElementById("content").style.direction = direction;
 
     let popupShown = waitForNextPopup();
     input.focus();
-    synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+    synthesizeKey("KEY_ArrowDown", {});
     await popupShown;
 
     let popupState = await new Promise(resolve => getPopupState(resolve));
     is(popupState.direction, direction, "Direction should match.");
 
     // Close the popup.
     input.blur();
   }
--- a/toolkit/components/satchel/test/test_popup_enter_event.html
+++ b/toolkit/components/satchel/test/test_popup_enter_event.html
@@ -47,19 +47,19 @@ function handleEnter(evt) {
     is(input.value, expectedValue, "Check input value when enter is pressed the 2nd time");
     info("form should submit with the default handler");
   } else {
     ok(false, "RETURN keypress shouldn't have been received when a popup item is selected");
   }
 }
 
 function popupShownListener(evt) {
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
-  synthesizeKey("KEY_Enter", {code: "Enter"}); // select the first entry in the popup
-  synthesizeKey("KEY_Enter", {code: "Enter"}); // try to submit the form with the filled value
+  synthesizeKey("KEY_ArrowDown", {});
+  synthesizeKey("KEY_Enter", {}); // select the first entry in the popup
+  synthesizeKey("KEY_Enter", {}); // try to submit the form with the filled value
 }
 
 function runTest() {
   input.addEventListener("keypress", handleEnter, true);
   form.addEventListener("submit", function submitCallback(evt) {
     is(input.value, expectedValue, "Check input value in the submit handler");
     evt.preventDefault();
 
@@ -69,17 +69,17 @@ function runTest() {
     SimpleTest.finish();
   });
 
   // Focus the input before adjusting.value so that the caret goes to the end
   // (since OS X doesn't show the dropdown otherwise).
   input.focus();
   input.value = "value";
   input.focus();
-  synthesizeKey("KEY_ArrowDown", {code: "ArrowDown"});
+  synthesizeKey("KEY_ArrowDown", {});
 }
 
 function startTest() {
   setupFormHistory(function() {
     runTest();
   });
 }
 
--- a/toolkit/content/tests/chrome/test_richlist_direction.xul
+++ b/toolkit/content/tests/chrome/test_richlist_direction.xul
@@ -64,17 +64,17 @@ function test_richlistbox()
   sendKey("END");
   currentIndex = richListBox.currentIndex;
   index = getScrollIndexAmount(1);
   sendKey("PAGE_UP");
   is(richListBox.currentIndex, index, "Selection should move to one page up");
   ok(richListBox.currentIndex > currentIndex, "Selection should move upwards");
   richListBox.selectedItem = richListBox.lastChild;
   richListBox.focus();
-  synthesizeKey("KEY_ArrowDown", { shiftKey: true, code: "ArrowDown" }, window);
+  synthesizeKey("KEY_ArrowDown", {shiftKey: true}, window);
   let items = [richListBox.selectedItems[0],
                richListBox.selectedItems[1]];
   is(items[0], richListBox.lastChild, "The last element should still be selected");
   is(items[1], richListBox.lastChild.previousSibling, "Both elements should now be selected");
   richListBox.clearSelection();
   richListBox.selectedItem = richListBox.lastChild;
   sendMouseEvent({type: "click", shiftKey: true, clickCount: 1},
                  "list-box-last",
@@ -110,17 +110,17 @@ function test_richlistbox()
   sendKey("END");
   currentIndex = richListBox.currentIndex;
   index = richListBox.scrollOnePage(-1) + richListBox.currentIndex;
   sendKey("PAGE_UP");
   is(richListBox.currentIndex, index, "Selection should move to one page up");
   ok(richListBox.currentIndex < currentIndex, "Selection should move upwards");
   richListBox.selectedItem = richListBox.firstChild;
   richListBox.focus();
-  synthesizeKey("KEY_ArrowDown", { shiftKey: true, code: "ArrowDown" }, window);
+  synthesizeKey("KEY_ArrowDown", {shiftKey: true}, window);
   items = [richListBox.selectedItems[0],
            richListBox.selectedItems[1]];
   is(items[0], richListBox.firstChild, "The last element should still be selected");
   is(items[1], richListBox.firstChild.nextSibling, "Both elements should now be selected");
   richListBox.clearSelection();
   richListBox.selectedItem = richListBox.firstChild;
   sendMouseEvent({type: "click", shiftKey: true, clickCount: 1},
                  "list-box-first",
--- a/toolkit/content/tests/mochitest/test_bug1407085.html
+++ b/toolkit/content/tests/mochitest/test_bug1407085.html
@@ -20,17 +20,17 @@ SimpleTest.waitForExplicitFinish();
 SimpleTest.waitForFocus(runTests);
 
 function runTests() {
   let input = document.getElementById("input");
   input.focus();
   input.addEventListener("keydown", () => {
     input.value = "new value";
   }, { once: true });
-  synthesizeKey("KEY_Escape", { code: "Escape" });
+  synthesizeKey("KEY_Escape", {});
   is(input.value, "new value",
      "New <input> value changed by an Escape key event listener shouldn't be " +
      "overwritten by original value even if Escape key is pressed");
   SimpleTest.finish();
 }
 
 </script>
 </pre>
--- a/toolkit/mozapps/extensions/test/browser/browser_file_xpi_no_process_switch.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_file_xpi_no_process_switch.js
@@ -50,17 +50,17 @@ async function testOpenedAndDraggedXPI(a
     return Services.appinfo.processID;
   });
 
   // No process switch for XPI file:// URI in the urlbar.
   let promiseNotification = promiseInstallNotification(aBrowser);
   let urlbar = document.getElementById("urlbar");
   urlbar.value = fileurl1.spec;
   urlbar.focus();
-  EventUtils.synthesizeKey("KEY_Enter", { code: "Enter" });
+  EventUtils.synthesizeKey("KEY_Enter", {});
   await promiseNotification;
   await CheckBrowserInPid(aBrowser, browserPid,
                           "Check that browser has not switched process.");
 
   // No process switch for XPI file:// URI dragged to tab.
   let tab = gBrowser.getTabForBrowser(aBrowser);
   promiseNotification = promiseInstallNotification(aBrowser);
   let effect = EventUtils.synthesizeDrop(tab, tab,
--- a/widget/tests/window_composition_text_querycontent.xul
+++ b/widget/tests/window_composition_text_querycontent.xul
@@ -7062,22 +7062,22 @@ function* runEditorReframeTests()
           synthesizeComposition({ type: "compositioncommitasis" });
         },
         check: function () {
           is(getValue(aEditor), "ABCdef", description + "Commit 'def' without convert");
         },
       },
       { test: function () {
           // Select "Cd"
-          synthesizeKey("KEY_ArrowLeft", { code: "ArrowLeft" });
-          synthesizeKey("KEY_ArrowLeft", { code: "ArrowLeft" });
-          synthesizeKey("KEY_Shift", { type: "keydown", code: "ShiftLeft", shiftKey: true });
-          synthesizeKey("KEY_ArrowLeft", { code: "ArrowLeft", shiftKey: true });
-          synthesizeKey("KEY_ArrowLeft", { code: "ArrowLeft", shiftKey: true });
-          synthesizeKey("KEY_Shift", { type: "keyup", code: "ShiftLeft" });
+          synthesizeKey("KEY_ArrowLeft", {});
+          synthesizeKey("KEY_ArrowLeft", {});
+          synthesizeKey("KEY_Shift", {type: "keydown", shiftKey: true});
+          synthesizeKey("KEY_ArrowLeft", {shiftKey: true});
+          synthesizeKey("KEY_ArrowLeft", {shiftKey: true});
+          synthesizeKey("KEY_Shift", {type: "keyup"});
         },
         check: function () {
         },
       },
       { test: function () {
           synthesizeCompositionChange(
             { "composition":
               { "string": "g",
@@ -7343,269 +7343,269 @@ function* runIMEContentObserverTest()
     var doc = aElement.ownerDocument;
     var win = doc.defaultView;
     aElement.focus();
     yield flushNotifications();
 
     // "a[]"
     var description = aDescription + "typing 'a'";
     notifications = [];
-    synthesizeKey("a", { code: "KeyA" }, win, callback);
+    synthesizeKey("a", {}, win, callback);
     yield waitUntilNotificationsReceived();
     ensureToRemovePrecedingPositionChangeNotification();
     checkTextChangeNotification(notifications[0], description, { offset: 0, removedLength: 0, addedLength: 1 });
     checkSelectionChangeNotification(notifications[1], description, { offset: 1, text: "" });
     checkPositionChangeNotification(notifications[2], description);
     ensureToRemovePostPositionChangeNotification(description, 3);
     dumpUnexpectedNotifications(description, 3);
 
     // "ab[]"
     description = aDescription + "typing 'b'";
     notifications = [];
-    synthesizeKey("b", { code: "KeyB" }, win, callback);
+    synthesizeKey("b", {}, win, callback);
     yield waitUntilNotificationsReceived();
     ensureToRemovePrecedingPositionChangeNotification();
     checkTextChangeNotification(notifications[0], description, { offset: 1, removedLength: 0, addedLength: 1 });
     checkSelectionChangeNotification(notifications[1], description, { offset: 2, text: "" });
     checkPositionChangeNotification(notifications[2], description);
     ensureToRemovePostPositionChangeNotification(description, 3);
     dumpUnexpectedNotifications(description, 3);
 
     // "abc[]"
     description = aDescription + "typing 'c'";
     notifications = [];
-    synthesizeKey("c", { code: "KeyC" }, win, callback);
+    synthesizeKey("c", {}, win, callback);
     yield waitUntilNotificationsReceived();
     ensureToRemovePrecedingPositionChangeNotification();
     checkTextChangeNotification(notifications[0], description, { offset: 2, removedLength: 0, addedLength: 1 });
     checkSelectionChangeNotification(notifications[1], description, { offset: 3, text: "" });
     checkPositionChangeNotification(notifications[2], description);
     ensureToRemovePostPositionChangeNotification(description, 3);
     dumpUnexpectedNotifications(description, 3);
 
     // "ab[c]"
     description = aDescription + "selecting 'c' with pressing Shift+ArrowLeft";
     notifications = [];
-    synthesizeKey("KEY_ArrowLeft", { code: "ArrowLeft", shiftKey: true }, win, callback);
+    synthesizeKey("KEY_ArrowLeft", {shiftKey: true}, win, callback);
     yield waitUntilNotificationsReceived();
     ensureToRemovePrecedingPositionChangeNotification();
     checkSelectionChangeNotification(notifications[0], description, { offset: 2, text: "c", reversed: true });
     ensureToRemovePostPositionChangeNotification(description, 1);
     dumpUnexpectedNotifications(description, 1);
 
     // "a[bc]"
     description = aDescription + "selecting 'bc' with pressing Shift+ArrowLeft";
     notifications = [];
-    synthesizeKey("KEY_ArrowLeft", { code: "ArrowLeft", shiftKey: true }, win, callback);
+    synthesizeKey("KEY_ArrowLeft", {shiftKey: true}, win, callback);
     yield waitUntilNotificationsReceived();
     ensureToRemovePrecedingPositionChangeNotification();
     checkSelectionChangeNotification(notifications[0], description, { offset: 1, text: "bc", reversed: true });
     ensureToRemovePostPositionChangeNotification(description, 1);
     dumpUnexpectedNotifications(description, 1);
 
     // "[abc]"
     description = aDescription + "selecting 'bc' with pressing Shift+ArrowLeft";
     notifications = [];
-    synthesizeKey("KEY_ArrowLeft", { code: "ArrowLeft", shiftKey: true }, win, callback);
+    synthesizeKey("KEY_ArrowLeft", {shiftKey: true}, win, callback);
     yield waitUntilNotificationsReceived();
     ensureToRemovePrecedingPositionChangeNotification();
     checkSelectionChangeNotification(notifications[0], description, { offset: 0, text: "abc", reversed: true });
     ensureToRemovePostPositionChangeNotification(description, 1);
     dumpUnexpectedNotifications(description, 1);
 
     // "[]abc"
     description = aDescription + "collapsing selection to the left-most with pressing ArrowLeft";
     notifications = [];
-    synthesizeKey("KEY_ArrowLeft", { code: "ArrowLeft" }, win, callback);
+    synthesizeKey("KEY_ArrowLeft", {}, win, callback);
     yield waitUntilNotificationsReceived();
     ensureToRemovePrecedingPositionChangeNotification();
     checkSelectionChangeNotification(notifications[0], description, { offset: 0, text: "" });
     ensureToRemovePostPositionChangeNotification(description, 1);
     dumpUnexpectedNotifications(description, 1);
 
     // "[a]bc"
     description = aDescription + "selecting 'a' with pressing Shift+ArrowRight";
     notifications = [];
-    synthesizeKey("KEY_ArrowRight", { code: "ArrowRight", shiftKey: true }, win, callback);
+    synthesizeKey("KEY_ArrowRight", {shiftKey: true}, win, callback);
     yield waitUntilNotificationsReceived();
     ensureToRemovePrecedingPositionChangeNotification();
     checkSelectionChangeNotification(notifications[0], description, { offset: 0, text: "a" });
     ensureToRemovePostPositionChangeNotification(description, 1);
     dumpUnexpectedNotifications(description, 1);
 
     // "[ab]c"
     description = aDescription + "selecting 'ab' with pressing Shift+ArrowRight";
     notifications = [];
-    synthesizeKey("KEY_ArrowRight", { code: "ArrowRight", shiftKey: true }, win, callback);
+    synthesizeKey("KEY_ArrowRight", {shiftKey: true}, win, callback);
     yield waitUntilNotificationsReceived();
     ensureToRemovePrecedingPositionChangeNotification();
     checkSelectionChangeNotification(notifications[0], description, { offset: 0, text: "ab" });
     ensureToRemovePostPositionChangeNotification(description, 1);
     dumpUnexpectedNotifications(description, 1);
 
     // "[]c"
     description = aDescription + "deleting 'ab' with pressing Delete";
     notifications = [];
-    synthesizeKey("KEY_Delete", { code: "Delete" }, win, callback);
+    synthesizeKey("KEY_Delete", {}, win, callback);
     yield waitUntilNotificationsReceived();
     ensureToRemovePrecedingPositionChangeNotification();
     checkTextChangeNotification(notifications[0], description, { offset: 0, removedLength: 2, addedLength: 0 });
     checkSelectionChangeNotification(notifications[1], description, { offset: 0, text: "" });
     checkPositionChangeNotification(notifications[2], description);
     ensureToRemovePostPositionChangeNotification(description, 3);
     dumpUnexpectedNotifications(description, 3);
 
     // "[]"
     description = aDescription + "deleting following 'c' with pressing Delete";
     notifications = [];
-    synthesizeKey("KEY_Delete", { code: "Delete" }, win, callback);
+    synthesizeKey("KEY_Delete", {}, win, callback);
     yield waitUntilNotificationsReceived();
     ensureToRemovePrecedingPositionChangeNotification();
     checkTextChangeNotification(notifications[0], description, { offset: 0, removedLength: 1, addedLength: 0 });
     checkPositionChangeNotification(notifications[1], description);
     ensureToRemovePostPositionChangeNotification(description, 2);
     dumpUnexpectedNotifications(description, 2);
 
     // "abc[]"
-    synthesizeKey("a", { code: "KeyA" }, win, callback);
-    synthesizeKey("b", { code: "KeyB" }, win, callback);
-    synthesizeKey("c", { code: "KeyC" }, win, callback);
+    synthesizeKey("a", {}, win, callback);
+    synthesizeKey("b", {}, win, callback);
+    synthesizeKey("c", {}, win, callback);
     yield flushNotifications();
 
     // "ab[]"
     description = aDescription + "deleting 'c' with pressing Backspace";
     notifications = [];
-    synthesizeKey("KEY_Backspace", { code: "Backspace" }, win, callback);
+    synthesizeKey("KEY_Backspace", {}, win, callback);
     yield waitUntilNotificationsReceived();
     ensureToRemovePrecedingPositionChangeNotification();
     checkTextChangeNotification(notifications[0], description, { offset: 2, removedLength: 1, addedLength: 0 });
     checkSelectionChangeNotification(notifications[1], description, { offset: 2, text: "" });
     checkPositionChangeNotification(notifications[2], description);
     ensureToRemovePostPositionChangeNotification(description, 3);
     dumpUnexpectedNotifications(description, 3);
 
     // "[ab]"
-    synthesizeKey("KEY_ArrowLeft", { code: "ArrowLeft", shiftKey: true }, win, callback);
-    synthesizeKey("KEY_ArrowLeft", { code: "ArrowLeft", shiftKey: true }, win, callback);
+    synthesizeKey("KEY_ArrowLeft", {shiftKey: true}, win, callback);
+    synthesizeKey("KEY_ArrowLeft", {shiftKey: true}, win, callback);
     yield flushNotifications();
 
     // "[]"
     description = aDescription + "deleting 'ab' with pressing Backspace";
     notifications = [];
-    synthesizeKey("KEY_Backspace", { code: "Backspace" }, win, callback);
+    synthesizeKey("KEY_Backspace", {}, win, callback);
     yield waitUntilNotificationsReceived();
     ensureToRemovePrecedingPositionChangeNotification();
     checkTextChangeNotification(notifications[0], description, { offset: 0, removedLength: 2, addedLength: 0 });
     checkSelectionChangeNotification(notifications[1], description, { offset: 0, text: "" });
     checkPositionChangeNotification(notifications[2], description);
     ensureToRemovePostPositionChangeNotification(description, 3);
     dumpUnexpectedNotifications(description, 3);
 
     // "abcd[]"
-    synthesizeKey("a", { code: "KeyA" }, win, callback);
-    synthesizeKey("b", { code: "KeyB" }, win, callback);
-    synthesizeKey("c", { code: "KeyC" }, win, callback);
-    synthesizeKey("d", { code: "KeyD" }, win, callback);
+    synthesizeKey("a", {}, win, callback);
+    synthesizeKey("b", {}, win, callback);
+    synthesizeKey("c", {}, win, callback);
+    synthesizeKey("d", {}, win, callback);
     yield flushNotifications();
 
     // "a[bc]d"
-    synthesizeKey("KEY_ArrowLeft", { code: "ArrowLeft", }, win, callback);
-    synthesizeKey("KEY_ArrowLeft", { code: "ArrowLeft", shiftKey: true }, win, callback);
-    synthesizeKey("KEY_ArrowLeft", { code: "ArrowLeft", shiftKey: true }, win, callback);
+    synthesizeKey("KEY_ArrowLeft", {}, win, callback);
+    synthesizeKey("KEY_ArrowLeft", {shiftKey: true}, win, callback);
+    synthesizeKey("KEY_ArrowLeft", {shiftKey: true}, win, callback);
     yield flushNotifications();
 
     // "a[]d"
     description = aDescription + "deleting 'bc' with pressing Backspace";
     notifications = [];
-    synthesizeKey("KEY_Backspace", { code: "Backspace" }, win, callback);
+    synthesizeKey("KEY_Backspace", {}, win, callback);
     yield waitUntilNotificationsReceived();
     ensureToRemovePrecedingPositionChangeNotification();
     checkTextChangeNotification(notifications[0], description, { offset: 1, removedLength: 2, addedLength: 0 });
     checkSelectionChangeNotification(notifications[1], description, { offset: 1, text: "" });
     checkPositionChangeNotification(notifications[2], description);
     ensureToRemovePostPositionChangeNotification(description, 3);
     dumpUnexpectedNotifications(description, 3);
 
     // "a[bc]d"
-    synthesizeKey("b", { code: "KeyB" }, win, callback);
-    synthesizeKey("c", { code: "KeyC" }, win, callback);
-    synthesizeKey("KEY_ArrowLeft", { code: "ArrowLeft", shiftKey: true }, win, callback);
-    synthesizeKey("KEY_ArrowLeft", { code: "ArrowLeft", shiftKey: true }, win, callback);
+    synthesizeKey("b", {}, win, callback);
+    synthesizeKey("c", {}, win, callback);
+    synthesizeKey("KEY_ArrowLeft", {shiftKey: true}, win, callback);
+    synthesizeKey("KEY_ArrowLeft", {shiftKey: true}, win, callback);
     yield flushNotifications();
 
     // "aB[]d"
     description = aDescription + "replacing 'bc' with 'B' with pressing Shift+B";
     notifications = [];
-    synthesizeKey("B", { code: "KeyB", shiftKey: true }, win, callback);
+    synthesizeKey("B", {shiftKey: true}, win, callback);
     yield waitUntilNotificationsReceived();
     ensureToRemovePrecedingPositionChangeNotification();
     checkTextChangeNotification(notifications[0], description, { offset: 1, removedLength: 2, addedLength: 1 });
     checkSelectionChangeNotification(notifications[1], description, { offset: 2, text: "" });
     checkPositionChangeNotification(notifications[2], description);
     ensureToRemovePostPositionChangeNotification(description, 3);
     dumpUnexpectedNotifications(description, 3);
 
     if (!aTestLineBreaker) {
       return;
     }
 
     // "aB\n[]d"
     description = aDescription + "inserting a line break after 'B' with pressing Enter";
     notifications = [];
-    synthesizeKey("KEY_Enter", { code: "Enter" }, win, callback);
+    synthesizeKey("KEY_Enter", {}, win, callback);
     yield waitUntilNotificationsReceived();
     ensureToRemovePrecedingPositionChangeNotification();
     checkTextChangeNotification(notifications[0], description, { offset: 2, removedLength: 0, addedLength: kLFLen });
     checkSelectionChangeNotification(notifications[1], description, { offset: getNativeText("aB\n").length, text: "" });
     checkPositionChangeNotification(notifications[2], description);
     ensureToRemovePostPositionChangeNotification(description, 3);
     dumpUnexpectedNotifications(description, 3);
 
     // "aB[]d"
     description = aDescription + "removing a line break after 'B' with pressing Backspace";
     notifications = [];
-    synthesizeKey("KEY_Backspace", { code: "Backspace" }, win, callback);
+    synthesizeKey("KEY_Backspace", {}, win, callback);
     yield waitUntilNotificationsReceived();
     ensureToRemovePrecedingPositionChangeNotification();
     checkTextChangeNotification(notifications[0], description, { offset: 2, removedLength: kLFLen, addedLength: 0 });
     checkSelectionChangeNotification(notifications[1], description, { offset: 2, text: "" });
     checkPositionChangeNotification(notifications[2], description);
     ensureToRemovePostPositionChangeNotification(description, 3);
     dumpUnexpectedNotifications(description, 3);
 
     // "a[B]d"
-    synthesizeKey("KEY_ArrowLeft", { code: "ArrowLeft", shiftKey: true }, win, callback);
+    synthesizeKey("KEY_ArrowLeft", {shiftKey: true}, win, callback);
     yield flushNotifications();
 
     // "a\n[]d"
     description = aDescription + "replacing 'B' with a line break with pressing Enter";
     notifications = [];
-    synthesizeKey("KEY_Enter", { code: "Enter" }, win, callback);
+    synthesizeKey("KEY_Enter", {}, win, callback);
     yield waitUntilNotificationsReceived();
     ensureToRemovePrecedingPositionChangeNotification();
     checkTextChangeNotification(notifications[0], description, { offset: 1, removedLength: 1, addedLength: kLFLen });
     checkSelectionChangeNotification(notifications[1], description, { offset: getNativeText("a\n").length, text: "" });
     checkPositionChangeNotification(notifications[2], description);
     ensureToRemovePostPositionChangeNotification(description, 3);
     dumpUnexpectedNotifications(description, 3);
 
     // "a[\n]d"
     description = aDescription + "selecting '\n' with pressing Shift+ArrowLeft";
     notifications = [];
-    synthesizeKey("KEY_ArrowLeft", { code: "ArrowLeft", shiftKey: true }, win, callback);
+    synthesizeKey("KEY_ArrowLeft", {shiftKey: true}, win, callback);
     yield waitUntilNotificationsReceived();
     ensureToRemovePrecedingPositionChangeNotification();
     checkSelectionChangeNotification(notifications[0], description, { offset: 1, text: kLF, reversed: true });
     ensureToRemovePostPositionChangeNotification(description, 1);
     dumpUnexpectedNotifications(description, 1);
 
     // "a[]d"
     description = aDescription + "removing selected '\n' with pressing Delete";
     notifications = [];
-    synthesizeKey("KEY_Delete", { code: "Delete", shiftKey: true }, win, callback);
+    synthesizeKey("KEY_Delete", {shiftKey: true}, win, callback);
     yield waitUntilNotificationsReceived();
     ensureToRemovePrecedingPositionChangeNotification();
     checkTextChangeNotification(notifications[0], description, { offset: 1, removedLength: kLFLen, addedLength: 0 });
     checkSelectionChangeNotification(notifications[1], description, { offset: 1, text: "" });
     checkPositionChangeNotification(notifications[2], description);
     ensureToRemovePostPositionChangeNotification(description, 3);
     dumpUnexpectedNotifications(description, 3);
 
@@ -7668,265 +7668,265 @@ function* runIMEContentObserverTest()
     } else {
       aElement.focus();
     }
     yield flushNotifications();
 
     // "a[]"
     var description = aDescription + "typing 'a'";
     notifications = [];
-    synthesizeKey("a", { code: "KeyA" }, win, callback);
+    synthesizeKey("a", {}, win, callback);
     yield waitUntilNotificationsReceived();
     ensureToRemovePrecedingPositionChangeNotification();
     checkTextChangeNotification(notifications[0], description, { offset: 0 + offsetAtContainer, removedLength: 0, addedLength: 1 });
     checkSelectionChangeNotification(notifications[1], description, { offset: 1 + offsetAtContainer, text: "" });
     checkPositionChangeNotification(notifications[2], description);
     dumpUnexpectedNotifications(description, 3);
 
     // "ab[]"
     description = aDescription + "typing 'b'";
     notifications = [];
-    synthesizeKey("b", { code: "KeyB" }, win, callback);
+    synthesizeKey("b", {}, win, callback);
     yield waitUntilNotificationsReceived();
     ensureToRemovePrecedingPositionChangeNotification();
     checkTextChangeNotification(notifications[0], description, { offset: 1 + offsetAtContainer, removedLength: 0, addedLength: 1 });
     checkSelectionChangeNotification(notifications[1], description, { offset: 2 + offsetAtContainer, text: "" });
     checkPositionChangeNotification(notifications[2], description);
     dumpUnexpectedNotifications(description, 3);
 
     // "abc[]"
     description = aDescription + "typing 'c'";
     notifications = [];
-    synthesizeKey("c", { code: "KeyC" }, win, callback);
+    synthesizeKey("c", {}, win, callback);
     yield waitUntilNotificationsReceived();
     ensureToRemovePrecedingPositionChangeNotification();
     checkTextChangeNotification(notifications[0], description, { offset: 2 + offsetAtContainer, removedLength: 0, addedLength: 1 });
     checkSelectionChangeNotification(notifications[1], description, { offset: 3 + offsetAtContainer, text: "" });
     checkPositionChangeNotification(notifications[2], description);
     dumpUnexpectedNotifications(description, 3);
 
     // "ab[c]"
     description = aDescription + "selecting 'c' with pressing Shift+ArrowLeft";
     notifications = [];
-    synthesizeKey("KEY_ArrowLeft", { code: "ArrowLeft", shiftKey: true }, win, callback);
+    synthesizeKey("KEY_ArrowLeft", {shiftKey: true}, win, callback);
     yield waitUntilNotificationsReceived();
     ensureToRemovePrecedingPositionChangeNotification();
     checkSelectionChangeNotification(notifications[0], description, { offset: 2 + offsetAtContainer, text: "c", reversed: true });
     dumpUnexpectedNotifications(description, 1);
 
     // "a[bc]"
     description = aDescription + "selecting 'bc' with pressing Shift+ArrowLeft";
     notifications = [];
-    synthesizeKey("KEY_ArrowLeft", { code: "ArrowLeft", shiftKey: true }, win, callback);
+    synthesizeKey("KEY_ArrowLeft", {shiftKey: true}, win, callback);
     yield waitUntilNotificationsReceived();
     ensureToRemovePrecedingPositionChangeNotification();
     checkSelectionChangeNotification(notifications[0], description, { offset: 1 + offsetAtContainer, text: "bc", reversed: true });
     dumpUnexpectedNotifications(description, 1);
 
     // "[abc]"
     description = aDescription + "selecting 'bc' with pressing Shift+ArrowLeft";
     notifications = [];
-    synthesizeKey("KEY_ArrowLeft", { code: "ArrowLeft", shiftKey: true }, win, callback);
+    synthesizeKey("KEY_ArrowLeft", {shiftKey: true}, win, callback);
     yield waitUntilNotificationsReceived();
     ensureToRemovePrecedingPositionChangeNotification();
     checkSelectionChangeNotification(notifications[0], description, { offset: 0 + offsetAtContainer, text: "abc", reversed: true });
     dumpUnexpectedNotifications(description, 1);
 
     // "[]abc"
     description = aDescription + "collapsing selection to the left-most with pressing ArrowLeft";
     notifications = [];
-    synthesizeKey("KEY_ArrowLeft", { code: "ArrowLeft" }, win, callback);
+    synthesizeKey("KEY_ArrowLeft", {}, win, callback);
     yield waitUntilNotificationsReceived();
     ensureToRemovePrecedingPositionChangeNotification();
     checkSelectionChangeNotification(notifications[0], description, { offset: 0 + offsetAtContainer, text: "" });
     dumpUnexpectedNotifications(description, 1);
 
     // "[a]bc"
     description = aDescription + "selecting 'a' with pressing Shift+ArrowRight";
     notifications = [];
-    synthesizeKey("KEY_ArrowRight", { code: "ArrowRight", shiftKey: true }, win, callback);
+    synthesizeKey("KEY_ArrowRight", {shiftKey: true}, win, callback);
     yield waitUntilNotificationsReceived();
     ensureToRemovePrecedingPositionChangeNotification();
     checkSelectionChangeNotification(notifications[0], description, { offset: 0 + offsetAtContainer, text: "a" });
     dumpUnexpectedNotifications(description, 1);
 
     // "[ab]c"
     description = aDescription + "selecting 'ab' with pressing Shift+ArrowRight";
     notifications = [];
-    synthesizeKey("KEY_ArrowRight", { code: "ArrowRight", shiftKey: true }, win, callback);
+    synthesizeKey("KEY_ArrowRight", {shiftKey: true}, win, callback);
     yield waitUntilNotificationsReceived();
     ensureToRemovePrecedingPositionChangeNotification();
     checkSelectionChangeNotification(notifications[0], description, { offset: 0 + offsetAtContainer, text: "ab" });
     dumpUnexpectedNotifications(description, 1);
 
     // "[]c"
     description = aDescription + "deleting 'ab' with pressing Delete";
     notifications = [];
-    synthesizeKey("KEY_Delete", { code: "Delete" }, win, callback);
+    synthesizeKey("KEY_Delete", {}, win, callback);
     yield waitUntilNotificationsReceived();
     ensureToRemovePrecedingPositionChangeNotification();
     checkTextChangeNotification(notifications[0], description, { offset: 0 + offsetAtContainer, removedLength: 2, addedLength: 0 });
     checkSelectionChangeNotification(notifications[1], description, { offset: 0 + offsetAtContainer, text: "" });
     checkPositionChangeNotification(notifications[2], description);
     dumpUnexpectedNotifications(description, 3);
 
     // "[]"
     description = aDescription + "deleting following 'c' with pressing Delete";
     notifications = [];
-    synthesizeKey("KEY_Delete", { code: "Delete" }, win, callback);
+    synthesizeKey("KEY_Delete", {}, win, callback);
     yield waitUntilNotificationsReceived();
     ensureToRemovePrecedingPositionChangeNotification();
     checkTextChangeNotification(notifications[0], description, { offset: 0 + offsetAtContainer, removedLength: 1, addedLength: kLFLen });
     checkPositionChangeNotification(notifications[1], description);
     dumpUnexpectedNotifications(description, 2);
 
     // "abc[]"
-    synthesizeKey("a", { code: "KeyA" }, win, callback);
-    synthesizeKey("b", { code: "KeyB" }, win, callback);
-    synthesizeKey("c", { code: "KeyC" }, win, callback);
+    synthesizeKey("a", {}, win, callback);
+    synthesizeKey("b", {}, win, callback);
+    synthesizeKey("c", {}, win, callback);
     yield flushNotifications();
 
     // "ab[]"
     description = aDescription + "deleting 'c' with pressing Backspace";
     notifications = [];
-    synthesizeKey("KEY_Backspace", { code: "Backspace" }, win, callback);
+    synthesizeKey("KEY_Backspace", {}, win, callback);
     yield waitUntilNotificationsReceived();
     ensureToRemovePrecedingPositionChangeNotification();
     checkTextChangeNotification(notifications[0], description, { offset: 2 + offsetAtContainer, removedLength: 1, addedLength: 0 });
     checkSelectionChangeNotification(notifications[1], description, { offset: 2 + offsetAtContainer, text: "" });
     checkPositionChangeNotification(notifications[2], description);
     dumpUnexpectedNotifications(description, 3);
 
     // "[ab]"
-    synthesizeKey("KEY_ArrowLeft", { code: "ArrowLeft", shiftKey: true }, win, callback);
-    synthesizeKey("KEY_ArrowLeft", { code: "ArrowLeft", shiftKey: true }, win, callback);
+    synthesizeKey("KEY_ArrowLeft", {shiftKey: true}, win, callback);
+    synthesizeKey("KEY_ArrowLeft", {shiftKey: true}, win, callback);
     yield flushNotifications();
 
     // "[]"
     description = aDescription + "deleting 'ab' with pressing Backspace";
     notifications = [];
-    synthesizeKey("KEY_Backspace", { code: "Backspace" }, win, callback);
+    synthesizeKey("KEY_Backspace", {}, win, callback);
     yield waitUntilNotificationsReceived();
     ensureToRemovePrecedingPositionChangeNotification();
     checkTextChangeNotification(notifications[0], description, { offset: 0 + offsetAtContainer, removedLength: 2, addedLength: 0 });
     checkSelectionChangeNotification(notifications[1], description, { offset: 0 + offsetAtContainer, text: "" });
     checkPositionChangeNotification(notifications[2], description);
     dumpUnexpectedNotifications(description, 3);
 
     // "abcd[]"
-    synthesizeKey("a", { code: "KeyA" }, win, callback);
-    synthesizeKey("b", { code: "KeyB" }, win, callback);
-    synthesizeKey("c", { code: "KeyC" }, win, callback);
-    synthesizeKey("d", { code: "KeyD" }, win, callback);
+    synthesizeKey("a", {}, win, callback);
+    synthesizeKey("b", {}, win, callback);
+    synthesizeKey("c", {}, win, callback);
+    synthesizeKey("d", {}, win, callback);
     yield flushNotifications();
 
     // "a[bc]d"
-    synthesizeKey("KEY_ArrowLeft", { code: "ArrowLeft", }, win, callback);
-    synthesizeKey("KEY_ArrowLeft", { code: "ArrowLeft", shiftKey: true }, win, callback);
-    synthesizeKey("KEY_ArrowLeft", { code: "ArrowLeft", shiftKey: true }, win, callback);
+    synthesizeKey("KEY_ArrowLeft", {}, win, callback);
+    synthesizeKey("KEY_ArrowLeft", {shiftKey: true}, win, callback);
+    synthesizeKey("KEY_ArrowLeft", {shiftKey: true}, win, callback);
     yield flushNotifications();
 
     // "a[]d"
     description = aDescription + "deleting 'bc' with pressing Backspace";
     notifications = [];
-    synthesizeKey("KEY_Backspace", { code: "Backspace" }, win, callback);
+    synthesizeKey("KEY_Backspace", {}, win, callback);
     yield waitUntilNotificationsReceived();
     ensureToRemovePrecedingPositionChangeNotification();
     checkTextChangeNotification(notifications[0], description, { offset: 1 + offsetAtContainer, removedLength: 2, addedLength: 0 });
     checkSelectionChangeNotification(notifications[1], description, { offset: 1 + offsetAtContainer, text: "" });
     checkPositionChangeNotification(notifications[2], description);
     dumpUnexpectedNotifications(description, 3);
 
     // "a[bc]d"
-    synthesizeKey("b", { code: "KeyB" }, win, callback);
-    synthesizeKey("c", { code: "KeyC" }, win, callback);
-    synthesizeKey("KEY_ArrowLeft", { code: "ArrowLeft", shiftKey: true }, win, callback);
-    synthesizeKey("KEY_ArrowLeft", { code: "ArrowLeft", shiftKey: true }, win, callback);
+    synthesizeKey("b", {}, win, callback);
+    synthesizeKey("c", {}, win, callback);
+    synthesizeKey("KEY_ArrowLeft", {shiftKey: true}, win, callback);
+    synthesizeKey("KEY_ArrowLeft", {shiftKey: true}, win, callback);
     yield flushNotifications();
 
     // "aB[]d"
     description = aDescription + "replacing 'bc' with 'B' with pressing Shift+B";
     notifications = [];
-    synthesizeKey("B", { code: "KeyB", shiftKey: true }, win, callback);
+    synthesizeKey("B", {shiftKey: true}, win, callback);
     yield waitUntilNotificationsReceived();
     ensureToRemovePrecedingPositionChangeNotification();
     checkTextChangeNotification(notifications[0], description, { offset: 1 + offsetAtContainer, removedLength: 2, addedLength: 1 });
     checkSelectionChangeNotification(notifications[1], description, { offset: 2 + offsetAtContainer, text: "" });
     checkPositionChangeNotification(notifications[2], description);
     dumpUnexpectedNotifications(description, 3);
 
     // "aB<br>[]d" or "<block>ab</block><block>[]d</block>"
     description = aDescription + "inserting a line break after 'B' with pressing Enter";
     notifications = [];
-    synthesizeKey("KEY_Enter", { code: "Enter" }, win, callback);
+    synthesizeKey("KEY_Enter", {}, win, callback);
     yield waitUntilNotificationsReceived();
     ensureToRemovePrecedingPositionChangeNotification();
     if (isDefaultParagraphSeparatorBlock) {
       // Splitting current block causes removing "<block>aB" and inserting "<block>aB</block><block>".
       checkTextChangeNotification(notifications[0], description, { offset: 0 + offsetAtContainer - kLFLen, removedLength: getNativeText("\naB").length, addedLength: getNativeText("\naB\n").length });
     } else {
       // Oddly, inserting <br> causes removing "aB" and inserting "ab<br>".
       checkTextChangeNotification(notifications[0], description, { offset: 0 + offsetAtContainer, removedLength: 2, addedLength: getNativeText("ab\n").length });
     }
     checkSelectionChangeNotification(notifications[1], description, { offset: getNativeText("aB\n").length + offsetAtContainer, text: "" });
     checkPositionChangeNotification(notifications[2], description);
     dumpUnexpectedNotifications(description, 3);
 
     // "aB[]d"
     description = aDescription + "removing a line break after 'B' with pressing Backspace";
     notifications = [];
-    synthesizeKey("KEY_Backspace", { code: "Backspace" }, win, callback);
+    synthesizeKey("KEY_Backspace", {}, win, callback);
     yield waitUntilNotificationsReceived();
     ensureToRemovePrecedingPositionChangeNotification();
     if (isDefaultParagraphSeparatorBlock) {
       // Joining two blocks causes removing both block elements and inserting new block element.
       checkTextChangeNotification(notifications[0], description, { offset: offsetAtContainer - kLFLen, removedLength: getNativeText("\naB\nd").length, addedLength: getNativeText("\naBd").length });
       checkSelectionChangeNotification(notifications[1], description, { offset: 2 + offsetAtContainer, text: "" });
       checkPositionChangeNotification(notifications[2], description);
       dumpUnexpectedNotifications(description, 3);
     } else {
       checkTextChangeNotification(notifications[0], description, { offset: 2 + offsetAtContainer, removedLength: kLFLen, addedLength: 0 });
       is(notifications.length, 3, description + " should cause 3 notifications");
       is(notifications[1] && notifications[1].type, "notify-selection-change", description + " should cause selection change notification");
       is(notifications[2] && notifications[2].type, "notify-position-change", description + " should cause position change notification");
     }
 
     // "a[B]d"
-    synthesizeKey("KEY_ArrowLeft", { code: "ArrowLeft", shiftKey: true }, win, callback);
+    synthesizeKey("KEY_ArrowLeft", {shiftKey: true}, win, callback);
     yield flushNotifications();
 
     // "a<br>[]d" or "<block>a</block><block>[]d</block>"
     description = aDescription + "replacing 'B' with a line break with pressing Enter";
     notifications = [];
-    synthesizeKey("KEY_Enter", { code: "Enter" }, win, callback);
+    synthesizeKey("KEY_Enter", {}, win, callback);
     yield waitUntilNotificationsReceived();
     ensureToRemovePrecedingPositionChangeNotification();
     if (isDefaultParagraphSeparatorBlock) {
       // Splitting current block causes removing "<block>aB" and inserting "<block>aB</block><block>".
       checkTextChangeNotification(notifications[0], description, { offset: 0 + offsetAtContainer - kLFLen, removedLength: getNativeText("\naB").length, addedLength: getNativeText("\na\n").length });
     } else {
       checkTextChangeNotification(notifications[0], description, { offset: 1 + offsetAtContainer, removedLength: 1, addedLength: kLFLen });
     }
     checkSelectionChangeNotification(notifications[1], description, { offset: getNativeText("a\n").length + offsetAtContainer, text: "" });
     checkPositionChangeNotification(notifications[2], description);
     dumpUnexpectedNotifications(description, 3);
 
     // "a[<br>]d" or "<block>a[</block><block>]d</block>"
     description = aDescription + "selecting '\\n' with pressing Shift+ArrowLeft";
     notifications = [];
-    synthesizeKey("KEY_ArrowLeft", { code: "ArrowLeft", shiftKey: true }, win, callback);
+    synthesizeKey("KEY_ArrowLeft", {shiftKey: true}, win, callback);
     yield waitUntilNotificationsReceived();
     ensureToRemovePrecedingPositionChangeNotification();
     checkSelectionChangeNotification(notifications[0], description, { offset: 1 + offsetAtContainer, text: kLF, reversed: true });
     dumpUnexpectedNotifications(description, 1);
 
     // "a[]d"
     description = aDescription + "removing selected '\\n' with pressing Delete";
     notifications = [];
-    synthesizeKey("KEY_Delete", { code: "Delete" }, win, callback);
+    synthesizeKey("KEY_Delete", {}, win, callback);
     yield waitUntilNotificationsReceived();
     ensureToRemovePrecedingPositionChangeNotification();
     if (isDefaultParagraphSeparatorBlock) {
       // Joining the blocks causes removing "<block>a</block><block>d</block>" and inserting "<block>ad</block>".
       checkTextChangeNotification(notifications[0], description, { offset: 0 + offsetAtContainer - kLFLen, removedLength: getNativeText("\na\nd").length, addedLength: getNativeText("\nad").length });
     } else {
       checkTextChangeNotification(notifications[0], description, { offset: 1 + offsetAtContainer, removedLength: kLFLen, addedLength: 0 });
     }
@@ -7950,64 +7950,64 @@ function* runIMEContentObserverTest()
     checkPositionChangeNotification(notifications[2], description);
     dumpUnexpectedNotifications(description, 3);
 
     // "<div>1[<div>2<div>3</div>4</div>]5</div>" and removing selection
     sel.setBaseAndExtent(aElement.firstChild.firstChild, 1, aElement.firstChild.childNodes.item(2), 0);
     yield flushNotifications();
     description = aDescription + "deleting child nodes with pressing Delete key";
     notifications = [];
-    synthesizeKey("KEY_Delete", { code: "Delete" }, win, callback);
+    synthesizeKey("KEY_Delete", {}, win, callback);
     yield waitUntilNotificationsReceived();
     ensureToRemovePrecedingPositionChangeNotification();
     is(aElement.innerHTML, "<div>15</div>", description + " should remove '<div>2<div>3</div>4</div>'");
     checkTextChangeNotification(notifications[0], description, { offset: getNativeText("\n1").length + offsetAtStart, removedLength: getNativeText("\n2\n34").length, addedLength: 0 });
     checkSelectionChangeNotification(notifications[1], description, { offset: getNativeText("\n1").length + offsetAtStart, text: "" });
     checkPositionChangeNotification(notifications[2], description);
     dumpUnexpectedNotifications(description, 3);
 
     // "<div>1[<div>2<div>3</div>]4</div>5</div>" and removing selection
     aElement.innerHTML = "<div>1<div>2<div>3</div>4</div>5</div>";
     sel.setBaseAndExtent(aElement.firstChild.firstChild, 1, aElement.firstChild.childNodes.item(1).childNodes.item(2), 0);
     yield flushNotifications();
     description = aDescription + "deleting child nodes (partially #1) with pressing Delete key";
     notifications = [];
-    synthesizeKey("KEY_Delete", { code: "Delete" }, win, callback);
+    synthesizeKey("KEY_Delete", {}, win, callback);
     yield waitUntilNotificationsReceived();
     ensureToRemovePrecedingPositionChangeNotification();
     is(aElement.innerHTML, "<div>145</div>", description + " should remove '<div>2<div>3</div></div>'");
     // It causes removing '<div>2<div>3</div>4</div>' and inserting '4'.
     checkTextChangeNotification(notifications[0], description, { offset: getNativeText("\n1").length + offsetAtStart, removedLength: getNativeText("\n2\n34").length, addedLength: 1 });
     checkSelectionChangeNotification(notifications[1], description, { offset: getNativeText("\n1").length + offsetAtStart, text: "" });
     checkPositionChangeNotification(notifications[2], description);
     dumpUnexpectedNotifications(description, 3);
 
     // "<div>1[<div>2<div>]3</div>4</div>5</div>" and removing selection
     aElement.innerHTML = "<div>1<div>2<div>3</div>4</div>5</div>";
     sel.setBaseAndExtent(aElement.firstChild.firstChild, 1, aElement.firstChild.childNodes.item(1).childNodes.item(1).firstChild, 0);
     yield flushNotifications();
     description = aDescription + "deleting child nodes (partially #2) with pressing Delete key";
     notifications = [];
-    synthesizeKey("KEY_Delete", { code: "Delete" }, win, callback);
+    synthesizeKey("KEY_Delete", {}, win, callback);
     yield waitUntilNotificationsReceived();
     ensureToRemovePrecedingPositionChangeNotification();
     is(aElement.innerHTML, "<div>13<div>4</div>5</div>", description + " should remove '<div>2</div>'");
     // It causes removing '1<div>2<div>3</div></div>' and inserting '13<div>'.
     checkTextChangeNotification(notifications[0], description, { offset: kLFLen + offsetAtStart, removedLength: getNativeText("1\n2\n3").length, addedLength: getNativeText("13\n").length });
     checkSelectionChangeNotification(notifications[1], description, { offset: getNativeText("\n1").length + offsetAtStart, text: "" });
     checkPositionChangeNotification(notifications[2], description);
     dumpUnexpectedNotifications(description, 3);
 
     // "<div>1<div>2<div>3[</div>4</div>]5</div>" and removing selection
     aElement.innerHTML = "<div>1<div>2<div>3</div>4</div>5</div>";
     sel.setBaseAndExtent(aElement.firstChild.childNodes.item(1).childNodes.item(1).firstChild, 1, aElement.firstChild.childNodes.item(2), 0);
     yield flushNotifications();
     description = aDescription + "deleting child nodes (partially #3) with pressing Delete key";
     notifications = [];
-    synthesizeKey("KEY_Delete", { code: "Delete" }, win, callback);
+    synthesizeKey("KEY_Delete", {}, win, callback);
     yield waitUntilNotificationsReceived();
     ensureToRemovePrecedingPositionChangeNotification();
     is(aElement.innerHTML, "<div>1<div>2<div>35</div></div></div>", description + " should remove '4'");
     // It causes removing '45' and inserting '5'.
     checkTextChangeNotification(notifications[0], description, { offset: getNativeText("\n1\n2\n3").length + offsetAtStart, removedLength: 2, addedLength: 1 });
     checkSelectionChangeNotification(notifications[1], description, { offset: getNativeText("\n1\n2\n3").length + offsetAtStart, text: "" });
     checkPositionChangeNotification(notifications[2], description);
     dumpUnexpectedNotifications(description, 3);
@@ -8023,81 +8023,81 @@ function* runIMEContentObserverTest()
     checkPositionChangeNotification(notifications[2], description);
     dumpUnexpectedNotifications(description, 3);
 
     // "<div>1<div>2<div>3[</div>4</div>5<div>6<div>]7</div>8</div>9</div>" and removing selection
     sel.setBaseAndExtent(aElement.firstChild.childNodes.item(1).childNodes.item(1).firstChild, 1, aElement.firstChild.childNodes.item(3).childNodes.item(1).firstChild, 0);
     yield flushNotifications();
     description = aDescription + "deleting child nodes (between same level descendants) with pressing Delete key";
     notifications = [];
-    synthesizeKey("KEY_Delete", { code: "Delete" }, win, callback);
+    synthesizeKey("KEY_Delete", {}, win, callback);
     yield waitUntilNotificationsReceived();
     ensureToRemovePrecedingPositionChangeNotification();
     is(aElement.innerHTML, "<div>1<div>2<div>37</div></div><div>8</div>9</div>", description + " should remove '456<div>7'");
     // It causes removing '<div>3</div>4</div>5<div>6<div>7</div>' and inserting '<div>37</div><div>'.
     checkTextChangeNotification(notifications[0], description, { offset: getNativeText("\n1\n2").length + offsetAtStart, removedLength: getNativeText("\n345\n6\n7").length, addedLength: getNativeText("\n37\n").length });
     checkSelectionChangeNotification(notifications[1], description, { offset: getNativeText("\n1\n2\n3").length + offsetAtStart, text: "" });
     checkPositionChangeNotification(notifications[2], description);
     dumpUnexpectedNotifications(description, 3);
 
     // "<div>1<div>2[<div>3</div>4</div>5<div>6<div>]7</div>8</div>9</div>" and removing selection
     aElement.innerHTML = "<div>1<div>2<div>3</div>4</div>5<div>6<div>7</div>8</div>9</div>";
     sel.setBaseAndExtent(aElement.firstChild.childNodes.item(1).firstChild, 1, aElement.firstChild.childNodes.item(3).childNodes.item(1).firstChild, 0);
     yield flushNotifications();
     description = aDescription + "deleting child nodes (between different level descendants #1) with pressing Delete key";
     notifications = [];
-    synthesizeKey("KEY_Delete", { code: "Delete" }, win, callback);
+    synthesizeKey("KEY_Delete", {}, win, callback);
     yield waitUntilNotificationsReceived();
     ensureToRemovePrecedingPositionChangeNotification();
     is(aElement.innerHTML, "<div>1<div>27</div><div>8</div>9</div>", description + " should remove '<div>2<div>3</div>4</div>5<div>6<div>7</div>'");
     // It causes removing '<div>2<div>3</div>4</div>5<div>6<div>7</div>' and inserting '<div>27</div>'.
     checkTextChangeNotification(notifications[0], description, { offset: getNativeText("\n1").length + offsetAtStart, removedLength: getNativeText("\n2\n345\n6\n7").length, addedLength: getNativeText("\n27\n").length });
     checkSelectionChangeNotification(notifications[1], description, { offset: getNativeText("\n1\n2").length + offsetAtStart, text: "" });
     checkPositionChangeNotification(notifications[2], description);
     dumpUnexpectedNotifications(description, 3);
 
     // "<div>1<div>2[<div>3</div>4</div>5<div>6<div>7</div>8</div>]9</div>" and removing selection
     aElement.innerHTML = "<div>1<div>2<div>3</div>4</div>5<div>6<div>7</div>8</div>9</div>";
     sel.setBaseAndExtent(aElement.firstChild.childNodes.item(1).firstChild, 1, aElement.firstChild.childNodes.item(4), 0);
     yield flushNotifications();
     description = aDescription + "deleting child nodes (between different level descendants #2) with pressing Delete key";
     notifications = [];
-    synthesizeKey("KEY_Delete", { code: "Delete" }, win, callback);
+    synthesizeKey("KEY_Delete", {}, win, callback);
     yield waitUntilNotificationsReceived();
     ensureToRemovePrecedingPositionChangeNotification();
     is(aElement.innerHTML, "<div>1<div>29</div></div>", description + " should remove '<div>3</div>4</div>5<div>6<div>7</div>8</div>'");
     // It causes removing '<div>3</div>4</div>5</div>6<div>7</div>8</div>9' and inserting '9</div>'.
     checkTextChangeNotification(notifications[0], description, { offset: getNativeText("\n1\n2").length + offsetAtStart, removedLength: getNativeText("\n345\n6\n789").length, addedLength: 1 });
     checkSelectionChangeNotification(notifications[1], description, { offset: getNativeText("\n1\n2").length + offsetAtStart, text: "" });
     checkPositionChangeNotification(notifications[2], description);
     dumpUnexpectedNotifications(description, 3);
 
     // "<div>1<div>2<div>3[</div>4</div>5<div>]6<div>7</div>8</div>9</div>" and removing selection
     aElement.innerHTML = "<div>1<div>2<div>3</div>4</div>5<div>6<div>7</div>8</div>9</div>";
     sel.setBaseAndExtent(aElement.firstChild.childNodes.item(1).childNodes.item(1).firstChild, 1, aElement.firstChild.childNodes.item(3).firstChild, 0);
     yield flushNotifications();
     description = aDescription + "deleting child nodes (between different level descendants #3) with pressing Delete key";
     notifications = [];
-    synthesizeKey("KEY_Delete", { code: "Delete" }, win, callback);
+    synthesizeKey("KEY_Delete", {}, win, callback);
     yield waitUntilNotificationsReceived();
     ensureToRemovePrecedingPositionChangeNotification();
     is(aElement.innerHTML, "<div>1<div>2<div>36<div>7</div>8</div></div>9</div>", description + " should remove '<div>36<div>7</div>8</div>'");
     // It causes removing '<div>3</div>4</div>5<div>6<div>7</div>8</div>' and inserting '<div>36<div>7</div>8</div>'.
     checkTextChangeNotification(notifications[0], description, { offset: getNativeText("\n1\n2").length + offsetAtStart, removedLength: getNativeText("\n345\n6\n78").length, addedLength: getNativeText("\n36\n78").length });
     checkSelectionChangeNotification(notifications[1], description, { offset: getNativeText("\n1\n2\n3").length + offsetAtStart, text: "" });
     checkPositionChangeNotification(notifications[2], description);
     dumpUnexpectedNotifications(description, 3);
 
     // "<div>1<div>2<div>3[</div>4</div>5<div>6<div>7</div>8</div>]9</div>" and removing selection
     aElement.innerHTML = "<div>1<div>2<div>3</div>4</div>5<div>6<div>7</div>8</div>9</div>";
     sel.setBaseAndExtent(aElement.firstChild.childNodes.item(1).childNodes.item(1).firstChild, 1, aElement.firstChild.childNodes.item(4), 0);
     yield flushNotifications();
     description = aDescription + "deleting child nodes (between different level descendants #4) with pressing Delete key";
     notifications = [];
-    synthesizeKey("KEY_Delete", { code: "Delete" }, win, callback);
+    synthesizeKey("KEY_Delete", {}, win, callback);
     yield waitUntilNotificationsReceived();
     ensureToRemovePrecedingPositionChangeNotification();
     is(aElement.innerHTML, "<div>1<div>2<div>39</div></div></div>", description + " should remove '</div>4</div>5<div>6<div>7</div>8</div>'");
     // It causes removing '</div>4</div>5<div>6<div>7</div>8</div>' and inserting '<div>36<div>7</div>8</div>'.
     checkTextChangeNotification(notifications[0], description, { offset: getNativeText("\n1\n2\n3").length + offsetAtStart, removedLength: getNativeText("45\n6\n789").length, addedLength: getNativeText("9").length });
     checkSelectionChangeNotification(notifications[1], description, { offset: getNativeText("\n1\n2\n3").length + offsetAtStart, text: "" });
     checkPositionChangeNotification(notifications[2], description);
     dumpUnexpectedNotifications(description, 3);