Backed out 5 changesets (bug 1419091) for reftest failure at tests/layout/reftests/bugs/1377447-1.html.
authorDaniel Varga <dvarga@mozilla.com>
Tue, 23 Oct 2018 01:08:26 +0300
changeset 490723 1bd4af34fe10ac308ace2115f21fbfa6f90a5747
parent 490722 6fcb74d1393cd5f6524e19a3b71208cf35ac5ec2
child 490724 b5d831c8d69c567921c24afd111e22bd42223e29
push id247
push userfmarier@mozilla.com
push dateSat, 27 Oct 2018 01:06:44 +0000
bugs1419091, 1377447
milestone65.0a1
backs out15811bce212a0bbe0603ff31f3f95934050afe95
2224ee809328bf70ded5648d0a2896d507def220
ac56492b6ed6f03cd61389db83a73e0fdf970089
72ccc94449163738199ec04886f2f5513bce5122
58d5a882493d491780115ebfe6c561866fc07dda
Backed out 5 changesets (bug 1419091) for reftest failure at tests/layout/reftests/bugs/1377447-1.html. Backed out changeset 15811bce212a (bug 1419091) Backed out changeset 2224ee809328 (bug 1419091) Backed out changeset ac56492b6ed6 (bug 1419091) Backed out changeset 72ccc9444916 (bug 1419091) Backed out changeset 58d5a882493d (bug 1419091)
dom/html/nsTextEditorState.cpp
dom/tests/mochitest/keyhandling/browsertest.html
dom/tests/mochitest/keyhandling/chrome.ini
dom/tests/mochitest/keyhandling/mochitest.ini
dom/tests/mochitest/keyhandling/test_browser.xul
dom/tests/mochitest/keyhandling/test_editor.xul
dom/tests/mochitest/keyhandling/test_input.html
dom/tests/mochitest/keyhandling/test_textarea.html
dom/tests/mochitest/keyhandling/test_windowed.xul
dom/tests/moz.build
dom/xbl/builtin/ShortcutKeyDefinitionsForBrowserCommon.h
dom/xbl/builtin/ShortcutKeyDefinitionsForEditorCommon.h
dom/xbl/builtin/ShortcutKeyDefinitionsForInputCommon.h
dom/xbl/builtin/ShortcutKeyDefinitionsForTextAreaCommon.h
dom/xbl/builtin/ShortcutKeys.cpp
dom/xbl/builtin/ShortcutKeys.h
dom/xbl/builtin/android/ShortcutKeyDefinitions.cpp
dom/xbl/builtin/android/jar.mn
dom/xbl/builtin/android/moz.build
dom/xbl/builtin/android/platformHTMLBindings.xml
dom/xbl/builtin/browser-base.inc
dom/xbl/builtin/editor-base.inc
dom/xbl/builtin/emacs/ShortcutKeyDefinitions.cpp
dom/xbl/builtin/emacs/jar.mn
dom/xbl/builtin/emacs/moz.build
dom/xbl/builtin/emacs/platformHTMLBindings.xml
dom/xbl/builtin/input-fields-base.inc
dom/xbl/builtin/mac/ShortcutKeyDefinitions.cpp
dom/xbl/builtin/mac/jar.mn
dom/xbl/builtin/mac/moz.build
dom/xbl/builtin/mac/platformHTMLBindings.xml
dom/xbl/builtin/moz.build
dom/xbl/builtin/textareas-base.inc
dom/xbl/builtin/unix/ShortcutKeyDefinitions.cpp
dom/xbl/builtin/unix/jar.mn
dom/xbl/builtin/unix/moz.build
dom/xbl/builtin/unix/platformHTMLBindings.xml
dom/xbl/builtin/win/ShortcutKeyDefinitions.cpp
dom/xbl/builtin/win/jar.mn
dom/xbl/builtin/win/moz.build
dom/xbl/builtin/win/platformHTMLBindings.xml
dom/xbl/moz.build
dom/xbl/nsXBLPrototypeHandler.cpp
dom/xbl/nsXBLPrototypeHandler.h
dom/xbl/nsXBLWindowKeyHandler.cpp
dom/xbl/nsXBLWindowKeyHandler.h
layout/style/res/forms.css
--- a/dom/html/nsTextEditorState.cpp
+++ b/dom/html/nsTextEditorState.cpp
@@ -40,19 +40,16 @@
 #include "mozilla/dom/ScriptSettings.h"
 #include "mozilla/dom/HTMLInputElement.h"
 #include "mozilla/dom/HTMLTextAreaElement.h"
 #include "mozilla/dom/Text.h"
 #include "nsNumberControlFrame.h"
 #include "nsFrameSelection.h"
 #include "mozilla/ErrorResult.h"
 #include "mozilla/Telemetry.h"
-#include "mozilla/ShortcutKeys.h"
-#include "nsXBLPrototypeHandler.h"
-#include "mozilla/dom/KeyboardEvent.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
 inline nsresult
 SetEditorFlagsIfNecessary(EditorBase& aEditorBase, uint32_t aFlags)
 {
   if (aEditorBase.Flags() == aFlags) {
@@ -955,77 +952,46 @@ TextInputListener::HandleEvent(Event* aE
   if (aEvent->DefaultPrevented()) {
     return NS_OK;
   }
 
   if (!aEvent->IsTrusted()) {
     return NS_OK;
   }
 
-  RefPtr<KeyboardEvent> keyEvent = aEvent->AsKeyboardEvent();
-  if (!keyEvent) {
-    return NS_ERROR_UNEXPECTED;
-  }
-
-  WidgetKeyboardEvent* widgetKeyEvent =
-      aEvent->WidgetEventPtr()->AsKeyboardEvent();
+  WidgetKeyboardEvent* keyEvent =
+    aEvent->WidgetEventPtr()->AsKeyboardEvent();
   if (!keyEvent) {
     return NS_ERROR_UNEXPECTED;
   }
 
-  nsXBLPrototypeHandler* keyHandlers =
-      ShortcutKeys::GetHandlers(mTxtCtrlElement->IsTextArea() ?
-                                HandlerType::eTextArea : HandlerType::eInput);
-
-  RefPtr<nsAtom> eventTypeAtom =
-    ShortcutKeys::ConvertEventToDOMEventType(widgetKeyEvent);
-  for (nsXBLPrototypeHandler* handler = keyHandlers;
-       handler;
-       handler = handler->GetNextHandler()) {
-    if (!handler->EventTypeEquals(eventTypeAtom)) {
-      continue;
-    }
-
-    if (!handler->KeyEventMatched(keyEvent, 0, IgnoreModifierState())) {
-      continue;
-    }
-
-    // XXX Do we execute only one handler even if the handler neither stops
-    //     propagation nor prevents default of the event?
-    nsCOMPtr<EventTarget> target = do_QueryInterface(mTxtCtrlElement);
-    nsresult rv = handler->ExecuteHandler(target, aEvent);
-    if (NS_SUCCEEDED(rv)) {
-      return rv;
-    }
-  }
-
-  if (widgetKeyEvent->mMessage != eKeyPress) {
+  if (keyEvent->mMessage != eKeyPress) {
     return NS_OK;
   }
 
   nsIWidget::NativeKeyBindingsType nativeKeyBindingsType =
     mTxtCtrlElement->IsTextArea() ?
       nsIWidget::NativeKeyBindingsForMultiLineEditor :
       nsIWidget::NativeKeyBindingsForSingleLineEditor;
 
-  nsIWidget* widget = widgetKeyEvent->mWidget;
+  nsIWidget* widget = keyEvent->mWidget;
   // If the event is created by chrome script, the widget is nullptr.
   if (!widget) {
     widget = mFrame->GetNearestWidget();
     NS_ENSURE_TRUE(widget, NS_OK);
   }
 
   // WidgetKeyboardEvent::ExecuteEditCommands() requires non-nullptr mWidget.
   // If the event is created by chrome script, it is nullptr but we need to
   // execute native key bindings.  Therefore, we need to set widget to
   // WidgetEvent::mWidget temporarily.
-  AutoRestore<nsCOMPtr<nsIWidget>> saveWidget(widgetKeyEvent->mWidget);
-  widgetKeyEvent->mWidget = widget;
-  if (widgetKeyEvent->ExecuteEditCommands(nativeKeyBindingsType,
-                                          DoCommandCallback, mFrame)) {
+  AutoRestore<nsCOMPtr<nsIWidget>> saveWidget(keyEvent->mWidget);
+  keyEvent->mWidget = widget;
+  if (keyEvent->ExecuteEditCommands(nativeKeyBindingsType,
+                                    DoCommandCallback, mFrame)) {
     aEvent->PreventDefault();
   }
   return NS_OK;
 }
 
 void
 TextInputListener::OnEditActionHandled()
 {
deleted file mode 100644
--- a/dom/tests/mochitest/keyhandling/browsertest.html
+++ /dev/null
@@ -1,108 +0,0 @@
-<!DOCTYPE html>
-
-<html>
-<body>
-<p style="white-space: nowrap">
-  A long paragraph to make a horizontal scrollbar.
-  A long paragraph to make a horizontal scrollbar.
-  A long paragraph to make a horizontal scrollbar.
-  A long paragraph to make a horizontal scrollbar.
-  A long paragraph to make a horizontal scrollbar.
-  A long paragraph to make a horizontal scrollbar.
-  A long paragraph to make a horizontal scrollbar.
-  A long paragraph to make a horizontal scrollbar.
-  A long paragraph to make a horizontal scrollbar.
-  A long paragraph to make a horizontal scrollbar.
-</p>
-<p id="paragraph">Lots of paragraphs to make a vertical scrollbar.</p>
-<p>Lots of paragraphs to make a vertical scrollbar.</p>
-<p>Lots of paragraphs to make a vertical scrollbar.</p>
-<p>Lots of paragraphs to make a vertical scrollbar.</p>
-<p>Lots of paragraphs to make a vertical scrollbar.</p>
-<p>Lots of paragraphs to make a vertical scrollbar.</p>
-<p>Lots of paragraphs to make a vertical scrollbar.</p>
-<p>Lots of paragraphs to make a vertical scrollbar.</p>
-<p>Lots of paragraphs to make a vertical scrollbar.</p>
-<p>Lots of paragraphs to make a vertical scrollbar.</p>
-<p>Lots of paragraphs to make a vertical scrollbar.</p>
-<p>Lots of paragraphs to make a vertical scrollbar.</p>
-<p>Lots of paragraphs to make a vertical scrollbar.</p>
-<p>Lots of paragraphs to make a vertical scrollbar.</p>
-<p>Lots of paragraphs to make a vertical scrollbar.</p>
-<p>Lots of paragraphs to make a vertical scrollbar.</p>
-<p>Lots of paragraphs to make a vertical scrollbar.</p>
-<p>Lots of paragraphs to make a vertical scrollbar.</p>
-<p>Lots of paragraphs to make a vertical scrollbar.</p>
-<p>Lots of paragraphs to make a vertical scrollbar.</p>
-<p>Lots of paragraphs to make a vertical scrollbar.</p>
-<p>Lots of paragraphs to make a vertical scrollbar.</p>
-<p>Lots of paragraphs to make a vertical scrollbar.</p>
-<p>Lots of paragraphs to make a vertical scrollbar.</p>
-<p>Lots of paragraphs to make a vertical scrollbar.</p>
-<p>Lots of paragraphs to make a vertical scrollbar.</p>
-<p>Lots of paragraphs to make a vertical scrollbar.</p>
-<p>Lots of paragraphs to make a vertical scrollbar.</p>
-<p>Lots of paragraphs to make a vertical scrollbar.</p>
-<p>Lots of paragraphs to make a vertical scrollbar.</p>
-<p>Lots of paragraphs to make a vertical scrollbar.</p>
-<p>Lots of paragraphs to make a vertical scrollbar.</p>
-<p>Lots of paragraphs to make a vertical scrollbar.</p>
-<p>Lots of paragraphs to make a vertical scrollbar.</p>
-<p>Lots of paragraphs to make a vertical scrollbar.</p>
-<p>Lots of paragraphs to make a vertical scrollbar.</p>
-<p>Lots of paragraphs to make a vertical scrollbar.</p>
-<p>Lots of paragraphs to make a vertical scrollbar.</p>
-<p>Lots of paragraphs to make a vertical scrollbar.</p>
-<p>Lots of paragraphs to make a vertical scrollbar.</p>
-<p>Lots of paragraphs to make a vertical scrollbar.</p>
-<p>Lots of paragraphs to make a vertical scrollbar.</p>
-<p>Lots of paragraphs to make a vertical scrollbar.</p>
-<p>Lots of paragraphs to make a vertical scrollbar.</p>
-<p>Lots of paragraphs to make a vertical scrollbar.</p>
-<p>Lots of paragraphs to make a vertical scrollbar.</p>
-<p>Lots of paragraphs to make a vertical scrollbar.</p>
-<p>Lots of paragraphs to make a vertical scrollbar.</p>
-<p>Lots of paragraphs to make a vertical scrollbar.</p>
-<p>Lots of paragraphs to make a vertical scrollbar.</p>
-<p>Lots of paragraphs to make a vertical scrollbar.</p>
-<p>Lots of paragraphs to make a vertical scrollbar.</p>
-<p>Lots of paragraphs to make a vertical scrollbar.</p>
-<p>Lots of paragraphs to make a vertical scrollbar.</p>
-<p>Lots of paragraphs to make a vertical scrollbar.</p>
-<p>Lots of paragraphs to make a vertical scrollbar.</p>
-<p>Lots of paragraphs to make a vertical scrollbar.</p>
-<p>Lots of paragraphs to make a vertical scrollbar.</p>
-<p>Lots of paragraphs to make a vertical scrollbar.</p>
-<p>Lots of paragraphs to make a vertical scrollbar.</p>
-<p>Lots of paragraphs to make a vertical scrollbar.</p>
-<p>Lots of paragraphs to make a vertical scrollbar.</p>
-<p>Lots of paragraphs to make a vertical scrollbar.</p>
-<p>Lots of paragraphs to make a vertical scrollbar.</p>
-<p>Lots of paragraphs to make a vertical scrollbar.</p>
-<p>Lots of paragraphs to make a vertical scrollbar.</p>
-<p>Lots of paragraphs to make a vertical scrollbar.</p>
-<p>Lots of paragraphs to make a vertical scrollbar.</p>
-<p>Lots of paragraphs to make a vertical scrollbar.</p>
-<p>Lots of paragraphs to make a vertical scrollbar.</p>
-<p>Lots of paragraphs to make a vertical scrollbar.</p>
-<p>Lots of paragraphs to make a vertical scrollbar.</p>
-<p>Lots of paragraphs to make a vertical scrollbar.</p>
-<p>Lots of paragraphs to make a vertical scrollbar.</p>
-<p>Lots of paragraphs to make a vertical scrollbar.</p>
-<p>Lots of paragraphs to make a vertical scrollbar.</p>
-<p>Lots of paragraphs to make a vertical scrollbar.</p>
-<p>Lots of paragraphs to make a vertical scrollbar.</p>
-<p>Lots of paragraphs to make a vertical scrollbar.</p>
-<p>Lots of paragraphs to make a vertical scrollbar.</p>
-<p>Lots of paragraphs to make a vertical scrollbar.</p>
-<p>Lots of paragraphs to make a vertical scrollbar.</p>
-<p>Lots of paragraphs to make a vertical scrollbar.</p>
-<p>Lots of paragraphs to make a vertical scrollbar.</p>
-<p>Lots of paragraphs to make a vertical scrollbar.</p>
-<p>Lots of paragraphs to make a vertical scrollbar.</p>
-<p>Lots of paragraphs to make a vertical scrollbar.</p>
-<p>Lots of paragraphs to make a vertical scrollbar.</p>
-<p>Lots of paragraphs to make a vertical scrollbar.</p>
-<p>Lots of paragraphs to make a vertical scrollbar.</p>
-</body>
-</html>
deleted file mode 100644
--- a/dom/tests/mochitest/keyhandling/chrome.ini
+++ /dev/null
@@ -1,12 +0,0 @@
-[DEFAULT]
-# nsIWidget::SynthesizeNativeKeyEvent() required (Bug 1410525 for headless)
-skip-if = os == 'linux' || os == 'android' || headless
-
-[test_browser.xul]
-support-files =
-  browsertest.html
-[test_editor.xul]
-[test_windowed.xul]
-support-files =
-  test_input.html
-  test_textarea.html
deleted file mode 100644
--- a/dom/tests/mochitest/keyhandling/mochitest.ini
+++ /dev/null
@@ -1,6 +0,0 @@
-[DEFAULT]
-# nsIWidget::SynthesizeNativeKeyEvent() required (Bug 1410525 for headless)
-skip-if = os == 'linux' || os == 'android' || headless
-
-[test_input.html]
-[test_textarea.html]
deleted file mode 100644
--- a/dom/tests/mochitest/keyhandling/test_browser.xul
+++ /dev/null
@@ -1,255 +0,0 @@
-<?xml version="1.0"?>
-
-<window title="Browser element keyhandling tests"
-        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
-        onload="test();">
-
-  <script type="application/javascript"
-          src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
-  <script type="application/javascript"
-          src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
-  <script type="application/javascript"
-          src="chrome://mochikit/content/tests/SimpleTest/NativeKeyCodes.js"/>
-
-  <script type="application/javascript">
-  <![CDATA[
-    SimpleTest.waitForExplicitFinish();
-
-    const IS_MAC = navigator.platform.indexOf("Mac") === 0;
-    const VK = {};
-    const CHARS = {};
-
-    // Copied values from NativeKeyCodes.js and EventUtils.js
-    if (IS_MAC) {
-      VK.LEFT = MAC_VK_LeftArrow;
-      CHARS.LEFT = "\uF702";
-      VK.RIGHT = MAC_VK_RightArrow;
-      CHARS.RIGHT = "\uF703";
-      VK.UP = MAC_VK_UpArrow;
-      CHARS.UP = "\uF700";
-      VK.DOWN = MAC_VK_DownArrow;
-      CHARS.DOWN = "\uF701";
-      VK.SPACE = MAC_VK_Space;
-      VK.PGDOWN = MAC_VK_PageDown;
-      CHARS.PGDOWN = "\uF72D";
-      VK.PGUP = MAC_VK_PageUp;
-      CHARS.PGUP = "\uF72C";
-      VK.C = MAC_VK_ANSI_C;
-      VK.HOME = MAC_VK_Home;
-      CHARS.HOME = "\uF729";
-      VK.END = MAC_VK_End;
-      CHARS.END = "\uF72B";
-    } else {
-      VK.LEFT = WIN_VK_LEFT;
-      CHARS.LEFT = "";
-      VK.RIGHT = WIN_VK_RIGHT;
-      CHARS.RIGHT = "";
-      VK.UP = WIN_VK_UP;
-      CHARS.UP = "";
-      VK.DOWN = WIN_VK_DOWN;
-      CHARS.DOWN = "";
-      VK.SPACE = WIN_VK_SPACE;
-      VK.PGDOWN = WIN_VK_NEXT;
-      CHARS.PGDOWN = "";
-      VK.PGUP = WIN_VK_PRIOR;
-      CHARS.PGUP = "";
-      VK.C = WIN_VK_C;
-      VK.HOME = WIN_VK_HOME;
-      CHARS.HOME = "";
-      VK.END = WIN_VK_END;
-      CHARS.END = "";
-    }
-
-    function waitForEvent(target, event) {
-      info(`Waiting for ${event} event.`);
-      return new Promise(resolve => {
-        browser.addEventListener(event, resolve, { once: true });
-      });
-    }
-
-    function synthesizeKey(keyCode, modifiers, chars) {
-      return new Promise((resolve, reject) => {
-        if (!synthesizeNativeKey(KEYBOARD_LAYOUT_EN_US, keyCode, modifiers, chars, chars, resolve)) {
-          reject();
-        }
-      });
-    }
-
-    function getWindowProperties(browser, properties) {
-      let results = {};
-      for (let prop of properties) {
-        results[prop] = browser.contentWindow[prop];
-      }
-
-      return results;
-    }
-
-    function getScrollPosition(browser) {
-      return getWindowProperties(browser, ["scrollX", "scrollY"]);
-    }
-
-    async function test() {
-      // Smooth scrolling makes scroll events take time and it's difficult to know
-      // when they've ended, so turn it off for this test.
-      await SpecialPowers.pushPrefEnv({"set": [["general.smoothScroll", false]] });
-
-      let browser = document.getElementById("browser");
-      browser.focus();
-      let { scrollX, scrollY } = await getScrollPosition(browser);
-      is(scrollX, 0, "Should not be scrolled");
-      is(scrollY, 0, "Should not be scrolled");
-
-      info("down");
-      await synthesizeKey(VK.DOWN, {}, CHARS.DOWN);
-      await waitForEvent(browser.contentWindow, "scroll");
-      let { scrollX: lineScrollX, scrollY: lineScrollY } = await getScrollPosition(browser);
-      is(lineScrollX, 0, "Should not be scrolled");
-      ok(lineScrollY > 0, "Should be scrolled");
-
-      info("up");
-      await synthesizeKey(VK.UP, {}, CHARS.UP);
-      await waitForEvent(browser.contentWindow, "scroll");
-      {
-        let { scrollX, scrollY } = await getScrollPosition(browser);
-        is(scrollX, 0, "Should not be scrolled");
-        is(scrollY, 0, "Should not be scrolled");
-      }
-
-      info("right");
-      await synthesizeKey(VK.RIGHT, {}, CHARS.RIGHT);
-      await waitForEvent(browser.contentWindow, "scroll");
-      let { scrollX: rightScrollX, scrollY: rightScrollY } = await getScrollPosition(browser);
-      ok(rightScrollX > 0, "Should be scrolled");
-      is(rightScrollY, 0, "Should not be scrolled");
-
-      info("left");
-      await synthesizeKey(VK.LEFT, {}, CHARS.LEFT);
-      await waitForEvent(browser.contentWindow, "scroll");
-      {
-        let { scrollX, scrollY } = await getScrollPosition(browser);
-        is(scrollX, 0, "Should not be scrolled");
-        is(scrollY, 0, "Should not be scrolled");
-      }
-
-      info("space");
-      await synthesizeKey(VK.SPACE, {}, " ");
-      await waitForEvent(browser.contentWindow, "scroll");
-      let { scrollX: pageScrollX, scrollY: pageScrollY } = await getScrollPosition(browser);
-      is(pageScrollX, 0, "Should not be scrolled");
-      ok(pageScrollY > lineScrollY, "Should be scrolled more than a single line");
-
-      info("shift+space");
-      await synthesizeKey(VK.SPACE, { shiftKey: true }, " ");
-      await waitForEvent(browser.contentWindow, "scroll");
-      {
-        let { scrollX, scrollY } = await getScrollPosition(browser);
-        is(scrollX, 0, "Should not be scrolled");
-        is(scrollY, 0, "Should not be scrolled");
-      }
-
-      info("page down");
-      await synthesizeKey(VK.PGDOWN, {}, CHARS.PGDOWN);
-      await waitForEvent(browser.contentWindow, "scroll");
-      {
-        let { scrollX, scrollY } = await getScrollPosition(browser);
-        is(scrollX, 0, "Should not be scrolled");
-        is(scrollY, pageScrollY, "Should be scrolled a page");
-      }
-
-      info("page up");
-      await synthesizeKey(VK.PGUP, {}, CHARS.PGUP);
-      await waitForEvent(browser.contentWindow, "scroll");
-      {
-        let { scrollX, scrollY } = await getScrollPosition(browser);
-        is(scrollX, 0, "Should not be scrolled");
-        is(scrollY, 0, "Should not be scrolled");
-      }
-
-      info("accel+down");
-      await synthesizeKey(VK.DOWN, { accelKey: true }, CHARS.DOWN);
-      await waitForEvent(browser.contentWindow, "scroll");
-      {
-        let { scrollX, scrollY, innerHeight } = await getWindowProperties(browser, ["scrollX", "scrollY", "innerHeight"]);
-        is(scrollX, 0, "Should not be scrolled");
-        // We can't know the scrollbar height so check that we're scrolled to within 100px of what we expect.
-        isfuzzy(scrollY, browser.contentDocument.body.clientHeight - innerHeight, 100, "Should be scrolled to the end.");
-      }
-
-      info("accel+up");
-      await synthesizeKey(VK.UP, { accelKey: true }, CHARS.UP);
-      await waitForEvent(browser.contentWindow, "scroll");
-      {
-        let { scrollX, scrollY } = await getScrollPosition(browser);
-        is(scrollX, 0, "Should not be scrolled");
-        is(scrollY, 0, "Should not be scrolled");
-      }
-
-      info("end");
-      await synthesizeKey(VK.END, {}, CHARS.END);
-      await waitForEvent(browser.contentWindow, "scroll");
-      {
-        let { scrollX, scrollY, innerHeight } = await getWindowProperties(browser, ["scrollX", "scrollY", "innerHeight"]);
-        is(scrollX, 0, "Should not be scrolled");
-        // We can't know the scrollbar height so check that we're scrolled to within 100px of what we expect.
-        isfuzzy(scrollY, browser.contentDocument.body.clientHeight - innerHeight, 100, "Should be scrolled to the end.");
-      }
-
-      info("home");
-      await synthesizeKey(VK.HOME, {}, CHARS.HOME);
-      await waitForEvent(browser.contentWindow, "scroll");
-      {
-        let { scrollX, scrollY } = await getScrollPosition(browser);
-        is(scrollX, 0, "Should not be scrolled");
-        is(scrollY, 0, "Should not be scrolled");
-      }
-
-      // Select the start of the first paragraph
-      let paragraph = browser.contentDocument.getElementById("paragraph");
-      let selection = browser.contentWindow.getSelection();
-      selection.setBaseAndExtent(paragraph.firstChild, 0, paragraph.firstChild, "Lots of".length);
-
-      info("copy");
-      await SimpleTest.promiseClipboardChange("Lots of", () => {
-        synthesizeKey(VK.C, { accelKey: true }, "c");
-      });
-
-      for (let i = 0; i < " paragraphs".length; i++) {
-        info("select right");
-        await synthesizeKey(VK.RIGHT, { shiftKey: true }, CHARS.RIGHT);
-      }
-
-      info("copy");
-      await SimpleTest.promiseClipboardChange("Lots of paragraphs", () => {
-        synthesizeKey(VK.C, { accelKey: true }, "c");
-      });
-
-      for (let i = 0; i < " paragraphs".length; i++) {
-        info("select left");
-        await synthesizeKey(VK.LEFT, { shiftKey: true }, CHARS.LEFT);
-      }
-
-      info("copy");
-      await SimpleTest.promiseClipboardChange("Lots of", () => {
-        synthesizeKey(VK.C, { accelKey: true }, "c");
-      });
-
-      info("select down");
-      await synthesizeKey(VK.DOWN, { shiftKey: true }, CHARS.DOWN);
-
-      info("copy");
-      await SimpleTest.promiseClipboardChange("Lots of paragraphs to make a vertical scrollbar.\n\nLots of", () => {
-        synthesizeKey(VK.C, { accelKey: true }, "c");
-      });
-
-      SimpleTest.finish();
-    }
-  ]]>
-  </script>
-
-  <body xmlns="http://www.w3.org/1999/xhtml">
-    <p id="display"></p>
-    <div id="content" style="display:none;"></div>
-    <pre id="test"></pre>
-  </body>
-  <browser id="browser" src="browsertest.html" style="height: 500px"/>
-</window>
deleted file mode 100644
--- a/dom/tests/mochitest/keyhandling/test_editor.xul
+++ /dev/null
@@ -1,271 +0,0 @@
-<?xml version="1.0"?>
-
-<window title="Browser element keyhandling tests"
-        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
-        onload="test();">
-
-  <script type="application/javascript"
-          src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
-  <script type="application/javascript"
-          src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
-  <script type="application/javascript"
-          src="chrome://mochikit/content/tests/SimpleTest/NativeKeyCodes.js"/>
-
-  <script type="application/javascript">
-  <![CDATA[
-    SimpleTest.waitForExplicitFinish();
-
-    const IS_MAC = navigator.platform.indexOf("Mac") === 0;
-    const VK = {};
-    const CHARS = {};
-
-    // Copied values from NativeKeyCodes.js and EventUtils.js
-    if (IS_MAC) {
-      VK.LEFT = MAC_VK_LeftArrow;
-      CHARS.LEFT = "\uF702";
-      VK.RIGHT = MAC_VK_RightArrow;
-      CHARS.RIGHT = "\uF703";
-      VK.UP = MAC_VK_UpArrow;
-      CHARS.UP = "\uF700";
-      VK.DOWN = MAC_VK_DownArrow;
-      CHARS.DOWN = "\uF701";
-      VK.SPACE = MAC_VK_Space;
-      VK.X = MAC_VK_ANSI_X;
-      VK.V = MAC_VK_ANSI_V;
-      VK.A = MAC_VK_ANSI_A;
-      VK.Z = MAC_VK_ANSI_Z;
-      VK.F = MAC_VK_ANSI_F;
-      VK.O = MAC_VK_ANSI_O;
-      VK.BACKSPACE = MAC_VK_PC_Backspace;
-      CHARS.BACKSPACE = "\u007F";
-    } else {
-      VK.LEFT = WIN_VK_LEFT;
-      CHARS.LEFT = "";
-      VK.RIGHT = WIN_VK_RIGHT;
-      CHARS.RIGHT = "";
-      VK.HOME = WIN_VK_HOME;
-      CHARS.HOME = "";
-      VK.END = WIN_VK_END;
-      CHARS.END = "";
-      VK.SPACE = WIN_VK_SPACE;
-      VK.X = WIN_VK_X;
-      VK.V = WIN_VK_V;
-      VK.A = WIN_VK_A;
-      VK.Z = WIN_VK_Z;
-      VK.Y = WIN_VK_Y;
-      VK.F = WIN_VK_F;
-      VK.O = WIN_VK_O;
-      VK.BACKSPACE = WIN_VK_BACK;
-      CHARS.BACKSPACE = "";
-    }
-
-    function waitForEvent(target, event) {
-      info(`Waiting for ${event} event.`);
-      return new Promise(resolve => {
-        browser.addEventListener(event, resolve, { once: true });
-      });
-    }
-
-    function synthesizeKey(keyCode, modifiers, chars) {
-      return new Promise((resolve, reject) => {
-        if (!synthesizeNativeKey(KEYBOARD_LAYOUT_EN_US, keyCode, modifiers, chars, chars, resolve)) {
-          reject();
-        }
-      });
-    }
-
-    function* nodes(element) {
-      let node = element.firstChild;
-      while (node) {
-        yield node;
-
-        if (node.nodeType === Node.ELEMENT_NODE) {
-          yield* nodes(node);
-        }
-
-        node = node.nextSibling;
-      }
-    }
-
-    async function checkElement(element, start, selectedText, content = "Test text") {
-      selectionPosition = (element, range) => {
-        let pos = 0;
-        for (let node of nodes(element)) {
-          if (node.nodeType === Node.TEXT_NODE) {
-            if (node === range.startContainer) {
-              return pos + range.startOffset;
-            } else {
-              pos += node.nodeValue.length;
-            }
-          } else if (node === range.startContainer) {
-            for (let i = 0; i < range.startOffset; i++) {
-              pos += node.childNodes[i].textContent.length;
-            }
-
-            return pos;
-          }
-        }
-
-        throw new Error("startContainer of range never found.");
-      }
-
-      isReady = () => {
-        let selection = element.contentWindow.getSelection();
-        let range = selection.getRangeAt(0);
-        let pos = selectionPosition(element.contentDocument.documentElement, range);
-
-        if (start != pos) {
-          return false;
-        }
-        if (selectedText != selection.toString()) {
-          return false;
-        }
-        if (content != element.contentDocument.documentElement.textContent) {
-          return false;
-        }
-        return true;
-      };
-
-      for (let i = 0; i < 10; i++) {
-        if (isReady()) {
-          return;
-        }
-
-        SimpleTest.requestFlakyTimeout("Polling for changes to apply");
-        await new Promise(resolve => setTimeout(resolve, 50));
-      }
-      ok(false, `Timed out waiting for state ${start} "${selectedText}" "${content}"`);
-      let selection = element.contentWindow.getSelection();
-      let range = selection.getRangeAt(0);
-      info(`${selectionPosition(element.contentDocument.documentElement, range)} "${selection.toString()}" "${element.contentDocument.documentElement.textContent}"`);
-    }
-
-    async function test() {
-      let editor = document.getElementById("editor");
-      editor.contentDocument.designMode = "on";
-      editor.contentWindow.focus();
-      let edit = editor.getEditor(editor.contentWindow);
-      edit.beginningOfDocument();
-
-      await checkElement(editor, 0, "");
-
-      info("right");
-      await synthesizeKey(VK.RIGHT, {}, CHARS.RIGHT);
-      await checkElement(editor, 1, "");
-
-      info("shift+right");
-      await synthesizeKey(VK.RIGHT, { shiftKey: true }, CHARS.RIGHT);
-      await checkElement(editor, 1, "e");
-
-      info("shift+right");
-      await synthesizeKey(VK.RIGHT, { shiftKey: true }, CHARS.RIGHT);
-      await checkElement(editor, 1, "es");
-
-      info("shift+left");
-      await synthesizeKey(VK.LEFT, { shiftKey: true }, CHARS.LEFT);
-      await checkElement(editor, 1, "e");
-
-      info("shift+left");
-      await synthesizeKey(VK.LEFT, { shiftKey: true }, CHARS.LEFT);
-      await checkElement(editor, 1, "");
-
-      info("shift+left");
-      await synthesizeKey(VK.LEFT, { shiftKey: true }, CHARS.LEFT);
-      await checkElement(editor, 0, "T");
-
-      info("shift+right");
-      await synthesizeKey(VK.RIGHT, { shiftKey: true }, CHARS.RIGHT);
-      await checkElement(editor, 1, "");
-
-      info("left");
-      await synthesizeKey(VK.LEFT, {}, CHARS.LEFT);
-      await checkElement(editor, 0, "");
-
-      if (IS_MAC) {
-        info("down");
-        await synthesizeKey(VK.DOWN, { shiftKey: true }, CHARS.DOWN);
-      } else {
-        info("end");
-        await synthesizeKey(VK.END, { shiftKey: true }, CHARS.END);
-      }
-      await checkElement(editor, 0, "Test text");
-
-      info("cut");
-      await synthesizeKey(VK.X, { accelKey: true }, "x");
-      await checkElement(editor, 0, "", "");
-      let text = SpecialPowers.getClipboardData("text/unicode");
-      is(text, "Test text", "Should have cut to the clipboard");
-      SpecialPowers.clipboardCopyString("New text");
-
-      info("paste");
-      await synthesizeKey(VK.V, { accelKey: true }, "v");
-      await checkElement(editor, 8, "", "New text");
-
-      if (IS_MAC) {
-        info("up");
-        await synthesizeKey(VK.UP, {}, CHARS.UP);
-      } else {
-        info("home");
-        await synthesizeKey(VK.HOME, {}, CHARS.HOME);
-      }
-      await checkElement(editor, 0, "", "New text");
-
-      info("select all");
-      await synthesizeKey(VK.A, { accelKey: true}, "a", "select");
-      await checkElement(editor, 0, "New text", "New text");
-
-      info("right");
-      await synthesizeKey(VK.RIGHT, {}, CHARS.RIGHT);
-      await checkElement(editor, 8, "", "New text");
-
-      info("word left");
-      if (IS_MAC) {
-        await synthesizeKey(VK.LEFT, { altKey: true }, CHARS.LEFT);
-      } else {
-        await synthesizeKey(VK.LEFT, { ctrlKey: true }, CHARS.LEFT);
-      }
-      await checkElement(editor, 4, "", "New text");
-
-      info("delete word left");
-      if (IS_MAC) {
-        await synthesizeKey(VK.BACKSPACE, { altKey: true }, CHARS.BACKSPACE);
-      } else {
-        await synthesizeKey(VK.BACKSPACE, { ctrlKey: true }, CHARS.BACKSPACE);
-      }
-      await checkElement(editor, 0, "", "text");
-
-      info("undo");
-      await synthesizeKey(VK.Z, { accelKey: true }, "z");
-      await checkElement(editor, 4, "", "New text");
-
-      info("redo");
-      if (IS_MAC) {
-        await synthesizeKey(VK.Z, { accelKey: true, shiftKey: true }, "z");
-      } else {
-        await synthesizeKey(VK.Y, { accelKey: true }, "y");
-      }
-      await checkElement(editor, 0, "", "text");
-
-      info("typing");
-      await synthesizeKey(VK.RIGHT, {}, CHARS.RIGHT);
-      await synthesizeKey(VK.RIGHT, {}, CHARS.RIGHT);
-      await synthesizeKey(VK.RIGHT, {}, CHARS.RIGHT);
-      await synthesizeKey(VK.RIGHT, {}, CHARS.RIGHT);
-      await synthesizeKey(VK.SPACE, {}, " ");
-      await synthesizeKey(VK.F, {}, "f");
-      await synthesizeKey(VK.O, {}, "o");
-      await synthesizeKey(VK.O, {}, "o");
-      await checkElement(editor, 8, "", "text foo");
-
-      SimpleTest.finish();
-    }
-  ]]>
-  </script>
-
-  <body xmlns="http://www.w3.org/1999/xhtml">
-    <p id="display"></p>
-    <div id="content" style="display:none;"></div>
-    <pre id="test"></pre>
-  </body>
-  <editor id="editor" editortype="text" src="data:text/plain,Test text" style="height: 500px"/>
-</window>
deleted file mode 100644
--- a/dom/tests/mochitest/keyhandling/test_input.html
+++ /dev/null
@@ -1,226 +0,0 @@
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<title>input key handling</title>
-
-<script type="text/javascript" src="http://mochi.test:8888/tests/SimpleTest/SimpleTest.js"></script>
-<script type="text/javascript" src="http://mochi.test:8888/tests/SimpleTest/EventUtils.js"></script>
-<script type="text/javascript" src="http://mochi.test:8888/tests/SimpleTest/NativeKeyCodes.js"></script>
-<link rel="stylesheet" type="text/css" href="http://mochi.test:8888/tests/SimpleTest/test.css" />
-
-<script type="text/javascript">
-const IS_MAC = navigator.platform.indexOf("Mac") == 0;
-const VK = {};
-const CHARS = {};
-
-if (IS_MAC) {
-  VK.LEFT = MAC_VK_LeftArrow;
-  CHARS.LEFT = "\uF702";
-  VK.RIGHT = MAC_VK_RightArrow;
-  CHARS.RIGHT = "\uF703";
-  VK.UP = MAC_VK_UpArrow;
-  CHARS.UP = "\uF700";
-  VK.DOWN = MAC_VK_DownArrow;
-  CHARS.DOWN = "\uF701";
-  VK.X = MAC_VK_ANSI_X;
-  VK.V = MAC_VK_ANSI_V;
-  VK.A = MAC_VK_ANSI_A;
-  VK.F = MAC_VK_ANSI_F;
-  VK.O = MAC_VK_ANSI_O;
-  VK.BACKSPACE = MAC_VK_PC_Backspace;
-  CHARS.BACKSPACE = "\u007F";
-  VK.Z = MAC_VK_ANSI_Z;
-  VK.SPACE = MAC_VK_Space;
-} else {
-  VK.LEFT = WIN_VK_LEFT;
-  CHARS.LEFT = "";
-  VK.RIGHT = WIN_VK_RIGHT;
-  CHARS.RIGHT = "";
-  VK.UP = WIN_VK_UP;
-  CHARS.UP = "";
-  VK.DOWN = WIN_VK_DOWN;
-  CHARS.DOWN = "";
-  VK.X = WIN_VK_X;
-  VK.V = WIN_VK_V;
-  VK.A = WIN_VK_A;
-  VK.F = WIN_VK_F;
-  VK.O = WIN_VK_O;
-  VK.END = WIN_VK_END;
-  CHARS.END = "";
-  VK.HOME = WIN_VK_HOME;
-  CHARS.HOME = "";
-  VK.BACKSPACE = WIN_VK_BACK;
-  CHARS.BACKSPACE = "";
-  VK.Z = WIN_VK_Z;
-  VK.SPACE = WIN_VK_SPACE;
-}
-
-if (window.opener) {
-  ok = window.opener.ok;
-  is = window.opener.is;
-}
-
-function synthesizeKey(keyCode, modifiers, chars, event = "keyup") {
-  return new Promise((resolve, reject) => {
-    window.addEventListener(event, resolve, { once: true });
-
-    if (!synthesizeNativeKey(KEYBOARD_LAYOUT_EN_US, keyCode, modifiers, chars, chars)) {
-      reject();
-    }
-  });
-}
-
-async function checkElement(element, start, end, content = "Test text") {
-  isReady = () => {
-    if (start != element.selectionStart) {
-      return false;
-    }
-    if (end != element.selectionEnd) {
-      return false;
-    }
-    if (content != element.value) {
-      return false;
-    }
-    return true;
-  };
-
-  for (let i = 0; i < 10; i++) {
-    if (isReady()) {
-      return;
-    }
-
-    SimpleTest.requestFlakyTimeout("Polling for changes to apply");
-    await new Promise(resolve => setTimeout(resolve, 50));
-  }
-  ok(false, "Timed out waiting for state");
-  is(element.selectionStart, start, "Should have the right selectionStart");
-  is(element.selectionEnd, end, "Should have the right selectionEnd");
-  is(element.value, content, "Should have the right value");
-}
-
-async function startTest() {
-  let input = document.getElementById("input");
-  input.focus();
-  await checkElement(input, 0, 0);
-
-  info("right");
-  await synthesizeKey(VK.RIGHT, {}, CHARS.RIGHT);
-  await checkElement(input, 1, 1);
-
-  info("shift+right");
-  await synthesizeKey(VK.RIGHT, { shiftKey: true }, CHARS.RIGHT);
-  await checkElement(input, 1, 2);
-
-  info("shift+right");
-  await synthesizeKey(VK.RIGHT, { shiftKey: true }, CHARS.RIGHT);
-  await checkElement(input, 1, 3);
-
-  info("shift+left");
-  await synthesizeKey(VK.LEFT, { shiftKey: true }, CHARS.LEFT);
-  await checkElement(input, 1, 2);
-
-  info("shift+left");
-  await synthesizeKey(VK.LEFT, { shiftKey: true }, CHARS.LEFT);
-  await checkElement(input, 1, 1);
-
-  info("shift+left");
-  await synthesizeKey(VK.LEFT, { shiftKey: true }, CHARS.LEFT);
-  await checkElement(input, 0, 1);
-
-  info("shift+right");
-  await synthesizeKey(VK.RIGHT, { shiftKey: true }, CHARS.RIGHT);
-  await checkElement(input, 1, 1);
-
-  info("left");
-  await synthesizeKey(VK.LEFT, {}, CHARS.LEFT);
-  await checkElement(input, 0, 0);
-
-  if (IS_MAC) {
-    info("down");
-    await synthesizeKey(VK.DOWN, { shiftKey: true }, CHARS.DOWN);
-  } else {
-    info("end");
-    await synthesizeKey(VK.END, { shiftKey: true }, CHARS.END);
-  }
-  await checkElement(input, 0, 9);
-
-  info("cut");
-  await synthesizeKey(VK.X, { accelKey: true }, "x", "input");
-  await checkElement(input, 0, 0, "");
-  let text = SpecialPowers.getClipboardData("text/unicode");
-  is(text, "Test text", "Should have cut to the clipboard");
-  SpecialPowers.clipboardCopyString("New text");
-
-  info("paste");
-  await synthesizeKey(VK.V, { accelKey: true }, "v", "input");
-  await checkElement(input, 8, 8, "New text");
-
-  if (IS_MAC) {
-    info("up");
-    await synthesizeKey(VK.UP, {}, CHARS.UP);
-  } else {
-    info("home");
-    await synthesizeKey(VK.HOME, {}, CHARS.HOME);
-  }
-  await checkElement(input, 0, 0, "New text");
-
-  info("select all");
-  await synthesizeKey(VK.A, { accelKey: true}, "a", "select");
-  await checkElement(input, 0, 8, "New text");
-
-  info("right");
-  await synthesizeKey(VK.RIGHT, {}, CHARS.RIGHT);
-  await checkElement(input, 8, 8, "New text");
-
-  info("word left");
-  if (IS_MAC) {
-    await synthesizeKey(VK.LEFT, { altKey: true }, CHARS.LEFT);
-  } else {
-    await synthesizeKey(VK.LEFT, { ctrlKey: true }, CHARS.LEFT);
-  }
-  await checkElement(input, 4, 4, "New text");
-
-  info("delete word left");
-  if (IS_MAC) {
-    await synthesizeKey(VK.BACKSPACE, { altKey: true }, CHARS.BACKSPACE);
-  } else {
-    await synthesizeKey(VK.BACKSPACE, { ctrlKey: true }, CHARS.BACKSPACE);
-  }
-  await checkElement(input, 0, 0, "text");
-
-  info("undo");
-  await synthesizeKey(VK.Z, { accelKey: true }, "", "input");
-  await checkElement(input, 4, 4, "New text");
-
-  info("redo");
-  await synthesizeKey(VK.Z, { accelKey: true, shiftKey: true }, "", "input");
-  await checkElement(input, 0, 0, "text");
-
-  info("typing");
-  await synthesizeKey(VK.RIGHT, {}, CHARS.RIGHT);
-  await synthesizeKey(VK.RIGHT, {}, CHARS.RIGHT);
-  await synthesizeKey(VK.RIGHT, {}, CHARS.RIGHT);
-  await synthesizeKey(VK.RIGHT, {}, CHARS.RIGHT);
-  await synthesizeKey(VK.SPACE, {}, " ");
-  await synthesizeKey(VK.F, {}, "f");
-  await synthesizeKey(VK.O, {}, "o");
-  await synthesizeKey(VK.O, {}, "o");
-  await checkElement(input, 8, 8, "text foo");
-}
-
-async function runTest() {
-  // When running in windowed mode the caller will start the test once we have
-  // focus.
-  if (window.opener) {
-    return;
-  }
-
-  SimpleTest.waitForExplicitFinish();
-  await startTest();
-  SimpleTest.finish();
-}
-</script>
-</head>
-<body onload="runTest();">
-<input id=input value="Test text"/>
-</body>
-</html>
deleted file mode 100644
--- a/dom/tests/mochitest/keyhandling/test_textarea.html
+++ /dev/null
@@ -1,226 +0,0 @@
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<title>input key handling</title>
-
-<script type="text/javascript" src="http://mochi.test:8888/tests/SimpleTest/SimpleTest.js"></script>
-<script type="text/javascript" src="http://mochi.test:8888/tests/SimpleTest/EventUtils.js"></script>
-<script type="text/javascript" src="http://mochi.test:8888/tests/SimpleTest/NativeKeyCodes.js"></script>
-<link rel="stylesheet" type="text/css" href="http://mochi.test:8888/tests/SimpleTest/test.css" />
-
-<script type="text/javascript">
-const IS_MAC = navigator.platform.indexOf("Mac") == 0;
-const VK = {};
-const CHARS = {};
-
-if (IS_MAC) {
-  VK.LEFT = MAC_VK_LeftArrow;
-  CHARS.LEFT = "\uF702";
-  VK.RIGHT = MAC_VK_RightArrow;
-  CHARS.RIGHT = "\uF703";
-  VK.UP = MAC_VK_UpArrow;
-  CHARS.UP = "\uF700";
-  VK.DOWN = MAC_VK_DownArrow;
-  CHARS.DOWN = "\uF701";
-  VK.X = MAC_VK_ANSI_X;
-  VK.V = MAC_VK_ANSI_V;
-  VK.A = MAC_VK_ANSI_A;
-  VK.F = MAC_VK_ANSI_F;
-  VK.O = MAC_VK_ANSI_O;
-  VK.BACKSPACE = MAC_VK_PC_Backspace;
-  CHARS.BACKSPACE = "\u007F";
-  VK.Z = MAC_VK_ANSI_Z;
-  VK.SPACE = MAC_VK_Space;
-} else {
-  VK.LEFT = WIN_VK_LEFT;
-  CHARS.LEFT = "";
-  VK.RIGHT = WIN_VK_RIGHT;
-  CHARS.RIGHT = "";
-  VK.UP = WIN_VK_UP;
-  CHARS.UP = "";
-  VK.DOWN = WIN_VK_DOWN;
-  CHARS.DOWN = "";
-  VK.X = WIN_VK_X;
-  VK.V = WIN_VK_V;
-  VK.A = WIN_VK_A;
-  VK.F = WIN_VK_F;
-  VK.O = WIN_VK_O;
-  VK.END = WIN_VK_END;
-  CHARS.END = "";
-  VK.HOME = WIN_VK_HOME;
-  CHARS.HOME = "";
-  VK.BACKSPACE = WIN_VK_BACK;
-  CHARS.BACKSPACE = "";
-  VK.Z = WIN_VK_Z;
-  VK.SPACE = WIN_VK_SPACE;
-}
-
-if (window.opener) {
-  ok = window.opener.ok;
-  is = window.opener.is;
-}
-
-function synthesizeKey(keyCode, modifiers, chars, event = "keyup") {
-  return new Promise((resolve, reject) => {
-    window.addEventListener(event, resolve, { once: true });
-
-    if (!synthesizeNativeKey(KEYBOARD_LAYOUT_EN_US, keyCode, modifiers, chars, chars)) {
-      reject();
-    }
-  });
-}
-
-async function checkElement(element, start, end, content = "Test text") {
-  isReady = () => {
-    if (start != element.selectionStart) {
-      return false;
-    }
-    if (end != element.selectionEnd) {
-      return false;
-    }
-    if (content != element.value) {
-      return false;
-    }
-    return true;
-  };
-
-  for (let i = 0; i < 10; i++) {
-    if (isReady()) {
-      return;
-    }
-
-    SimpleTest.requestFlakyTimeout("Polling for changes to apply");
-    await new Promise(resolve => setTimeout(resolve, 50));
-  }
-  ok(false, "Timed out waiting for state");
-  is(element.selectionStart, start, "Should have the right selectionStart");
-  is(element.selectionEnd, end, "Should have the right selectionEnd");
-  is(element.value, content, "Should have the right value");
-}
-
-async function startTest() {
-  let input = document.getElementById("input");
-  input.focus();
-  await checkElement(input, 0, 0);
-
-  info("right");
-  await synthesizeKey(VK.RIGHT, {}, CHARS.RIGHT);
-  await checkElement(input, 1, 1);
-
-  info("shift+right");
-  await synthesizeKey(VK.RIGHT, { shiftKey: true }, CHARS.RIGHT);
-  await checkElement(input, 1, 2);
-
-  info("shift+right");
-  await synthesizeKey(VK.RIGHT, { shiftKey: true }, CHARS.RIGHT);
-  await checkElement(input, 1, 3);
-
-  info("shift+left");
-  await synthesizeKey(VK.LEFT, { shiftKey: true }, CHARS.LEFT);
-  await checkElement(input, 1, 2);
-
-  info("shift+left");
-  await synthesizeKey(VK.LEFT, { shiftKey: true }, CHARS.LEFT);
-  await checkElement(input, 1, 1);
-
-  info("shift+left");
-  await synthesizeKey(VK.LEFT, { shiftKey: true }, CHARS.LEFT);
-  await checkElement(input, 0, 1);
-
-  info("shift+right");
-  await synthesizeKey(VK.RIGHT, { shiftKey: true }, CHARS.RIGHT);
-  await checkElement(input, 1, 1);
-
-  info("left");
-  await synthesizeKey(VK.LEFT, {}, CHARS.LEFT);
-  await checkElement(input, 0, 0);
-
-  if (IS_MAC) {
-    info("down");
-    await synthesizeKey(VK.DOWN, { shiftKey: true }, CHARS.DOWN);
-  } else {
-    info("end");
-    await synthesizeKey(VK.END, { shiftKey: true }, CHARS.END);
-  }
-  await checkElement(input, 0, 9);
-
-  info("cut");
-  await synthesizeKey(VK.X, { accelKey: true }, "x", "input");
-  await checkElement(input, 0, 0, "");
-  let text = SpecialPowers.getClipboardData("text/unicode");
-  is(text, "Test text", "Should have cut to the clipboard");
-  SpecialPowers.clipboardCopyString("New text");
-
-  info("paste");
-  await synthesizeKey(VK.V, { accelKey: true }, "v", "input");
-  await checkElement(input, 8, 8, "New text");
-
-  if (IS_MAC) {
-    info("up");
-    await synthesizeKey(VK.UP, {}, CHARS.UP);
-  } else {
-    info("home");
-    await synthesizeKey(VK.HOME, {}, CHARS.HOME);
-  }
-  await checkElement(input, 0, 0, "New text");
-
-  info("select all");
-  await synthesizeKey(VK.A, { accelKey: true}, "a", "select");
-  await checkElement(input, 0, 8, "New text");
-
-  info("right");
-  await synthesizeKey(VK.RIGHT, {}, CHARS.RIGHT);
-  await checkElement(input, 8, 8, "New text");
-
-  info("word left");
-  if (IS_MAC) {
-    await synthesizeKey(VK.LEFT, { altKey: true }, CHARS.LEFT);
-  } else {
-    await synthesizeKey(VK.LEFT, { ctrlKey: true }, CHARS.LEFT);
-  }
-  await checkElement(input, 4, 4, "New text");
-
-  info("delete word left");
-  if (IS_MAC) {
-    await synthesizeKey(VK.BACKSPACE, { altKey: true }, CHARS.BACKSPACE);
-  } else {
-    await synthesizeKey(VK.BACKSPACE, { ctrlKey: true }, CHARS.BACKSPACE);
-  }
-  await checkElement(input, 0, 0, "text");
-
-  info("undo");
-  await synthesizeKey(VK.Z, { accelKey: true }, "", "input");
-  await checkElement(input, 4, 4, "New text");
-
-  info("redo");
-  await synthesizeKey(VK.Z, { accelKey: true, shiftKey: true }, "", "input");
-  await checkElement(input, 0, 0, "text");
-
-  info("typing");
-  await synthesizeKey(VK.RIGHT, {}, CHARS.RIGHT);
-  await synthesizeKey(VK.RIGHT, {}, CHARS.RIGHT);
-  await synthesizeKey(VK.RIGHT, {}, CHARS.RIGHT);
-  await synthesizeKey(VK.RIGHT, {}, CHARS.RIGHT);
-  await synthesizeKey(VK.SPACE, {}, " ");
-  await synthesizeKey(VK.F, {}, "f");
-  await synthesizeKey(VK.O, {}, "o");
-  await synthesizeKey(VK.O, {}, "o");
-  await checkElement(input, 8, 8, "text foo");
-}
-
-async function runTest() {
-  // When running in windowed mode the caller will start the test once we have
-  // focus.
-  if (window.opener) {
-    return;
-  }
-
-  SimpleTest.waitForExplicitFinish();
-  await startTest();
-  SimpleTest.finish();
-}
-</script>
-</head>
-<body onload="runTest();">
-<textarea id=input>Test text</textarea>
-</body>
-</html>
deleted file mode 100644
--- a/dom/tests/mochitest/keyhandling/test_windowed.xul
+++ /dev/null
@@ -1,33 +0,0 @@
-<?xml version="1.0"?>
-
-<window title="Top-level window keyhandling tests"
-        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
-        onload="test();">
-
-  <script type="application/javascript"
-          src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
-
-  <script type="application/javascript">
-  <![CDATA[
-    SimpleTest.waitForExplicitFinish();
-
-    async function run_test(path) {
-      let win = window.openDialog(path, "_blank", "width=500,height=500");
-      await SimpleTest.promiseFocus(win);
-      await win.startTest();
-    }
-
-    async function test() {
-      await run_test("test_input.html");
-      await run_test("test_textarea.html");
-      SimpleTest.finish();
-    }
-  ]]>
-  </script>
-
-  <body xmlns="http://www.w3.org/1999/xhtml">
-    <p id="display"></p>
-    <div id="content" style="display:none;"></div>
-    <pre id="test"></pre>
-  </body>
-</window>
--- a/dom/tests/moz.build
+++ b/dom/tests/moz.build
@@ -157,33 +157,31 @@ MOCHITEST_MANIFESTS += [
     'mochitest/dom-level0/mochitest.ini',
     'mochitest/dom-level1-core/mochitest.ini',
     'mochitest/dom-level2-core/mochitest.ini',
     'mochitest/dom-level2-html/mochitest.ini',
     'mochitest/fetch/mochitest.ini',
     'mochitest/gamepad/mochitest.ini',
     'mochitest/general/mochitest.ini',
     'mochitest/geolocation/mochitest.ini',
-    'mochitest/keyhandling/mochitest.ini',
     'mochitest/localstorage/mochitest.ini',
     'mochitest/orientation/mochitest.ini',
     'mochitest/pointerlock/mochitest.ini',
     'mochitest/script/mochitest.ini',
     'mochitest/sessionstorage/mochitest.ini',
     'mochitest/storageevent/mochitest.ini',
     'mochitest/webcomponents/mochitest.ini',
     'mochitest/whatwg/mochitest.ini',
 ]
 
 MOCHITEST_CHROME_MANIFESTS += [
     'mochitest/beacon/chrome.ini',
     'mochitest/chrome/chrome.ini',
     'mochitest/general/chrome.ini',
     'mochitest/geolocation/chrome.ini',
-    'mochitest/keyhandling/chrome.ini',
     'mochitest/localstorage/chrome.ini',
     'mochitest/sessionstorage/chrome.ini',
     'mochitest/webcomponents/chrome.ini',
     'mochitest/webcomponents/chrome_disabled.ini',
     'mochitest/whatwg/chrome.ini',
 ]
 
 XPCSHELL_TESTS_MANIFESTS += ['unit/xpcshell.ini']
deleted file mode 100644
--- a/dom/xbl/builtin/ShortcutKeyDefinitionsForBrowserCommon.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-    { u"keypress", nullptr,         u" ",    u"shift",           u"cmd_scrollPageUp" },
-    { u"keypress", nullptr,         u" ",    nullptr,            u"cmd_scrollPageDown" },
-    { u"keypress", u"VK_UP",        nullptr, nullptr,            u"cmd_moveUp" },
-    { u"keypress", u"VK_DOWN",      nullptr, nullptr,            u"cmd_moveDown" },
-    { u"keypress", u"VK_LEFT",      nullptr, nullptr,            u"cmd_moveLeft" },
-    { u"keypress", u"VK_RIGHT",     nullptr, nullptr,            u"cmd_moveRight" },
-    { u"keypress", nullptr,         u"x",    u"accel",           u"cmd_cut" },
-    { u"keypress", nullptr,         u"c",    u"accel",           u"cmd_copy" },
-    { u"keypress", nullptr,         u"v",    u"accel",           u"cmd_paste" },
-    { u"keypress", nullptr,         u"z",    u"accel",           u"cmd_undo" },
-    { u"keypress", nullptr,         u"z",    u"accel,shift",     u"cmd_redo" },
-    { u"keypress", nullptr,         u"a",    u"accel",           u"cmd_selectAll" },
deleted file mode 100644
--- a/dom/xbl/builtin/ShortcutKeyDefinitionsForEditorCommon.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-    { u"keypress", nullptr,         u" ",    u"shift",           u"cmd_scrollPageUp" },
-    { u"keypress", nullptr,         u" ",    nullptr,            u"cmd_scrollPageDown" },
-    { u"keypress", u"VK_LEFT",      nullptr, nullptr,            u"cmd_moveLeft" },
-    { u"keypress", u"VK_RIGHT",     nullptr, nullptr,            u"cmd_moveRight" },
-    { u"keypress", u"VK_LEFT",      nullptr, u"shift",           u"cmd_selectLeft" },
-    { u"keypress", u"VK_RIGHT",     nullptr, u"shift",           u"cmd_selectRight" },
-    { u"keypress", u"VK_UP",        nullptr, nullptr,            u"cmd_moveUp" },
-    { u"keypress", u"VK_DOWN",      nullptr, nullptr,            u"cmd_moveDown" },
-    { u"keypress", u"VK_UP",        nullptr, u"shift",           u"cmd_selectUp" },
-    { u"keypress", u"VK_DOWN",      nullptr, u"shift",           u"cmd_selectDown" },
-    { u"keypress", nullptr,         u"z",    u"accel",           u"cmd_undo" },
-    { u"keypress", nullptr,         u"z",    u"accel,shift",     u"cmd_redo" },
-    { u"keypress", nullptr,         u"x",    u"accel",           u"cmd_cut" },
-    { u"keypress", nullptr,         u"c",    u"accel",           u"cmd_copy" },
-    { u"keypress", nullptr,         u"v",    u"accel",           u"cmd_paste" },
-    { u"keypress", nullptr,         u"v",    u"accel,shift",     u"cmd_pasteNoFormatting" },
deleted file mode 100644
--- a/dom/xbl/builtin/ShortcutKeyDefinitionsForInputCommon.h
+++ /dev/null
@@ -1,17 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-    { u"keypress", u"VK_LEFT",      nullptr, nullptr,            u"cmd_moveLeft" },
-    { u"keypress", u"VK_RIGHT",     nullptr, nullptr,            u"cmd_moveRight" },
-    { u"keypress", u"VK_LEFT",      nullptr, u"shift",           u"cmd_selectLeft" },
-    { u"keypress", u"VK_RIGHT",     nullptr, u"shift",           u"cmd_selectRight" },
-    { u"keypress", u"VK_UP",        nullptr, nullptr,            u"cmd_moveUp" },
-    { u"keypress", u"VK_DOWN",      nullptr, nullptr,            u"cmd_moveDown" },
-    { u"keypress", u"VK_UP",        nullptr, u"shift",           u"cmd_selectUp" },
-    { u"keypress", u"VK_DOWN",      nullptr, u"shift",           u"cmd_selectDown" },
-    { u"keypress", nullptr,         u"c",    u"accel",           u"cmd_copy" },
-    { u"keypress", nullptr,         u"x",    u"accel",           u"cmd_cut" },
-    { u"keypress", nullptr,         u"v",    u"accel",           u"cmd_paste" },
-    { u"keypress", nullptr,         u"z",    u"accel",           u"cmd_undo" },
-    { u"keypress", nullptr,         u"z",    u"accel,shift",     u"cmd_redo" },
deleted file mode 100644
--- a/dom/xbl/builtin/ShortcutKeyDefinitionsForTextAreaCommon.h
+++ /dev/null
@@ -1,17 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-    { u"keypress", u"VK_LEFT",      nullptr, nullptr,            u"cmd_moveLeft" },
-    { u"keypress", u"VK_RIGHT",     nullptr, nullptr,            u"cmd_moveRight" },
-    { u"keypress", u"VK_LEFT",      nullptr, u"shift",           u"cmd_selectLeft" },
-    { u"keypress", u"VK_RIGHT",     nullptr, u"shift",           u"cmd_selectRight" },
-    { u"keypress", u"VK_UP",        nullptr, nullptr,            u"cmd_moveUp" },
-    { u"keypress", u"VK_DOWN",      nullptr, nullptr,            u"cmd_moveDown" },
-    { u"keypress", u"VK_UP",        nullptr, u"shift",           u"cmd_selectUp" },
-    { u"keypress", u"VK_DOWN",      nullptr, u"shift",           u"cmd_selectDown" },
-    { u"keypress", nullptr,         u"c",    u"accel",           u"cmd_copy" },
-    { u"keypress", nullptr,         u"x",    u"accel",           u"cmd_cut" },
-    { u"keypress", nullptr,         u"v",    u"accel",           u"cmd_paste" },
-    { u"keypress", nullptr,         u"z",    u"accel",           u"cmd_undo" },
-    { u"keypress", nullptr,         u"z",    u"accel,shift",     u"cmd_redo" },
deleted file mode 100644
--- a/dom/xbl/builtin/ShortcutKeys.cpp
+++ /dev/null
@@ -1,118 +0,0 @@
-#include "mozilla/ShortcutKeys.h"
-#include "../nsXBLPrototypeHandler.h"
-#include "nsContentUtils.h"
-#include "nsAtom.h"
-#include "mozilla/TextEvents.h"
-
-namespace mozilla {
-
-NS_IMPL_ISUPPORTS(ShortcutKeys, nsIObserver);
-
-StaticRefPtr<ShortcutKeys> ShortcutKeys::sInstance;
-
-ShortcutKeys::ShortcutKeys()
-  : mBrowserHandlers(nullptr)
-  , mEditorHandlers(nullptr)
-  , mInputHandlers(nullptr)
-  , mTextAreaHandlers(nullptr)
-{
-  MOZ_ASSERT(!sInstance, "Attempt to instantiate a second ShortcutKeys.");
-  nsContentUtils::RegisterShutdownObserver(this);
-}
-
-ShortcutKeys::~ShortcutKeys()
-{
-  delete mBrowserHandlers;
-  delete mEditorHandlers;
-  delete mInputHandlers;
-  delete mTextAreaHandlers;
-}
-
-nsresult
-ShortcutKeys::Observe(nsISupports* aSubject, const char* aTopic, const char16_t* aData)
-{
-  // Clear our strong reference so we can clean up.
-  sInstance = nullptr;
-  return NS_OK;
-}
-
-/* static */ nsXBLPrototypeHandler*
-ShortcutKeys::GetHandlers(HandlerType aType)
-{
-  if (!sInstance) {
-    sInstance = new ShortcutKeys();
-  }
-
-  return sInstance->EnsureHandlers(aType);
-}
-
-/* static */ nsAtom*
-ShortcutKeys::ConvertEventToDOMEventType(const WidgetKeyboardEvent* aWidgetKeyboardEvent)
-{
-  if (aWidgetKeyboardEvent->IsKeyDownOrKeyDownOnPlugin()) {
-    return nsGkAtoms::keydown;
-  }
-  if (aWidgetKeyboardEvent->IsKeyUpOrKeyUpOnPlugin()) {
-    return nsGkAtoms::keyup;
-  }
-  // eAccessKeyNotFound event is always created from eKeyPress event and
-  // the original eKeyPress event has stopped its propagation before dispatched
-  // into the DOM tree in this process and not matched with remote content's
-  // access keys.  So, we should treat it as an eKeyPress event and execute
-  // a command if it's registered as a shortcut key.
-  if (aWidgetKeyboardEvent->mMessage == eKeyPress ||
-      aWidgetKeyboardEvent->mMessage == eAccessKeyNotFound) {
-    return nsGkAtoms::keypress;
-  }
-  MOZ_ASSERT_UNREACHABLE("All event messages relating to shortcut keys should be handled");
-  return nullptr;
-}
-
-nsXBLPrototypeHandler*
-ShortcutKeys::EnsureHandlers(HandlerType aType)
-{
-  ShortcutKeyData* keyData;
-  nsXBLPrototypeHandler** cache;
-
-  switch (aType) {
-    case HandlerType::eBrowser:
-      keyData = &sBrowserHandlers[0];
-      cache = &mBrowserHandlers;
-      break;
-    case HandlerType::eEditor:
-      keyData = &sEditorHandlers[0];
-      cache = &mEditorHandlers;
-      break;
-    case HandlerType::eInput:
-      keyData = &sInputHandlers[0];
-      cache = &mInputHandlers;
-      break;
-    case HandlerType::eTextArea:
-      keyData = &sTextAreaHandlers[0];
-      cache = &mTextAreaHandlers;
-      break;
-    default:
-      MOZ_ASSERT(false, "Unknown handler type requested.");
-  }
-
-  if (*cache) {
-    return *cache;
-  }
-
-  nsXBLPrototypeHandler* lastHandler = nullptr;
-  while (keyData->event) {
-    nsXBLPrototypeHandler* handler =
-      new nsXBLPrototypeHandler(keyData);
-    if (lastHandler) {
-      lastHandler->SetNextHandler(handler);
-    } else {
-      *cache = handler;
-    }
-    lastHandler = handler;
-    keyData++;
-  }
-
-  return *cache;
-}
-
-} // namespace mozilla
deleted file mode 100644
--- a/dom/xbl/builtin/ShortcutKeys.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef mozilla_dom_ShortcutKeys_h
-#define mozilla_dom_ShortcutKeys_h
-
-#include "nsIObserver.h"
-
-class nsXBLPrototypeHandler;
-class nsAtom;
-
-namespace mozilla {
-
-class WidgetKeyboardEvent;
-
-typedef struct
-{
-   const char16_t* event;
-   const char16_t* keycode;
-   const char16_t* key;
-   const char16_t* modifiers;
-   const char16_t* command;
-} ShortcutKeyData;
-
-enum class HandlerType
-{
-  eInput,
-  eTextArea,
-  eBrowser,
-  eEditor,
-};
-
-class ShortcutKeys : public nsIObserver
-{
-public:
-  NS_DECL_ISUPPORTS
-  NS_DECL_NSIOBSERVER
-
-  // Returns a pointer to the first handler for the given type.
-  static nsXBLPrototypeHandler* GetHandlers(HandlerType aType);
-
-  // Gets the event type for a widget keyboard event.
-  static nsAtom* ConvertEventToDOMEventType(const WidgetKeyboardEvent* aWidgetKeyboardEvent);
-
-protected:
-  ShortcutKeys();
-  virtual ~ShortcutKeys();
-
-  // Returns a pointer to the first handler for the given type.
-  nsXBLPrototypeHandler* EnsureHandlers(HandlerType aType);
-
-  // Maintains a strong reference to the only instance.
-  static StaticRefPtr<ShortcutKeys> sInstance;
-
-  // Shortcut keys for different elements.
-  static ShortcutKeyData sBrowserHandlers[];
-  static ShortcutKeyData sEditorHandlers[];
-  static ShortcutKeyData sInputHandlers[];
-  static ShortcutKeyData sTextAreaHandlers[];
-
-  // Cached event handlers generated from the above data.
-  nsXBLPrototypeHandler* mBrowserHandlers;
-  nsXBLPrototypeHandler* mEditorHandlers;
-  nsXBLPrototypeHandler* mInputHandlers;
-  nsXBLPrototypeHandler* mTextAreaHandlers;
-};
-
-} // namespace mozilla
-
-#endif // #ifndef mozilla_dom_ShortcutKeys_h
deleted file mode 100644
--- a/dom/xbl/builtin/android/ShortcutKeyDefinitions.cpp
+++ /dev/null
@@ -1,152 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "../ShortcutKeys.h"
-
-namespace mozilla {
-
-ShortcutKeyData ShortcutKeys::sInputHandlers[] =
-{
-#include "../ShortcutKeyDefinitionsForInputCommon.h"
-
-    { u"keypress", nullptr,         u"a",    u"accel",           u"cmd_selectAll" },
-    { u"keypress", u"VK_LEFT",      nullptr, u"control",         u"cmd_wordPrevious" },
-    { u"keypress", u"VK_RIGHT",     nullptr, u"control",         u"cmd_wordNext" },
-    { u"keypress", u"VK_LEFT",      nullptr, u"shift,control",   u"cmd_selectWordPrevious" },
-    { u"keypress", u"VK_RIGHT",     nullptr, u"shift,control",   u"cmd_selectWordNext" },
-    { u"keypress", u"VK_LEFT",      nullptr, u"alt",             u"cmd_beginLine" },
-    { u"keypress", u"VK_RIGHT",     nullptr, u"alt",             u"cmd_endLine" },
-    { u"keypress", u"VK_LEFT",      nullptr, u"shift,alt",       u"cmd_selectBeginLine" },
-    { u"keypress", u"VK_RIGHT",     nullptr, u"shift,alt",       u"cmd_selectEndLine" },
-    { u"keypress", u"VK_HOME",      nullptr, nullptr,            u"cmd_beginLine" },
-    { u"keypress", u"VK_END",       nullptr, nullptr,            u"cmd_endLine" },
-    { u"keypress", u"VK_HOME",      nullptr, u"shift",           u"cmd_selectBeginLine" },
-    { u"keypress", u"VK_END",       nullptr, u"shift",           u"cmd_selectEndLine" },
-    { u"keypress", u"VK_BACK",      nullptr, u"alt",             u"cmd_deleteToBeginningOfLine" },
-    { u"keypress", u"VK_DELETE",    nullptr, u"alt",             u"cmd_deleteToEndOfLine" },
-
-    { nullptr,     nullptr,         nullptr, nullptr,            nullptr }
-};
-
-ShortcutKeyData ShortcutKeys::sTextAreaHandlers[] =
-{
-#include "../ShortcutKeyDefinitionsForTextAreaCommon.h"
-
-    { u"keypress", nullptr,         u"a",    u"accel",           u"cmd_selectAll" },
-    { u"keypress", u"VK_LEFT",      nullptr, u"control",         u"cmd_wordPrevious" },
-    { u"keypress", u"VK_RIGHT",     nullptr, u"control",         u"cmd_wordNext" },
-    { u"keypress", u"VK_LEFT",      nullptr, u"shift,control",   u"cmd_selectWordPrevious" },
-    { u"keypress", u"VK_RIGHT",     nullptr, u"shift,control",   u"cmd_selectWordNext" },
-    { u"keypress", u"VK_LEFT",      nullptr, u"alt",             u"cmd_beginLine" },
-    { u"keypress", u"VK_RIGHT",     nullptr, u"alt",             u"cmd_endLine" },
-    { u"keypress", u"VK_LEFT",      nullptr, u"shift,alt",       u"cmd_selectBeginLine" },
-    { u"keypress", u"VK_RIGHT",     nullptr, u"shift,alt",       u"cmd_selectEndLine" },
-    { u"keypress", u"VK_UP",        nullptr, u"alt",             u"cmd_moveTop" },
-    { u"keypress", u"VK_DOWN",      nullptr, u"alt",             u"cmd_moveBottom" },
-    { u"keypress", u"VK_UP",        nullptr, u"shift,alt",       u"cmd_selectTop" },
-    { u"keypress", u"VK_DOWN",      nullptr, u"shift,alt",       u"cmd_selectBottom" },
-    { u"keypress", u"VK_PAGE_UP",   nullptr, nullptr,            u"cmd_movePageUp" },
-    { u"keypress", u"VK_PAGE_DOWN", nullptr, nullptr,            u"cmd_movePageDown" },
-    { u"keypress", u"VK_PAGE_UP",   nullptr, u"shift",           u"cmd_selectPageUp" },
-    { u"keypress", u"VK_PAGE_DOWN", nullptr, u"shift",           u"cmd_selectPageDown" },
-    { u"keypress", u"VK_PAGE_UP",   nullptr, u"alt",             u"cmd_moveTop" },
-    { u"keypress", u"VK_PAGE_DOWN", nullptr, u"alt",             u"cmd_moveBottom" },
-    { u"keypress", u"VK_PAGE_UP",   nullptr, u"shift,alt",       u"cmd_selectTop" },
-    { u"keypress", u"VK_PAGE_DOWN", nullptr, u"shift,alt",       u"cmd_selectBottom" },
-    { u"keypress", u"VK_HOME",      nullptr, nullptr,            u"cmd_beginLine" },
-    { u"keypress", u"VK_END",       nullptr, nullptr,            u"cmd_endLine" },
-    { u"keypress", u"VK_HOME",      nullptr, u"shift",           u"cmd_selectBeginLine" },
-    { u"keypress", u"VK_END",       nullptr, u"shift",           u"cmd_selectEndLine" },
-    { u"keypress", u"VK_HOME",      nullptr, u"control",         u"cmd_moveTop" },
-    { u"keypress", u"VK_END",       nullptr, u"control",         u"cmd_moveBottom" },
-    { u"keypress", u"VK_HOME",      nullptr, u"shift,control",   u"cmd_selectTop" },
-    { u"keypress", u"VK_END",       nullptr, u"shift,control",   u"cmd_selectBottom" },
-    { u"keypress", u"VK_BACK",      nullptr, u"alt",             u"cmd_deleteToBeginningOfLine" },
-    { u"keypress", u"VK_DELETE",    nullptr, u"alt",             u"cmd_deleteToEndOfLine" },
-
-    { nullptr,     nullptr,         nullptr, nullptr,            nullptr }
-};
-
-ShortcutKeyData ShortcutKeys::sBrowserHandlers[] =
-{
-#include "../ShortcutKeyDefinitionsForBrowserCommon.h"
-
-    { u"keypress", u"VK_LEFT",      nullptr, u"shift",           u"cmd_selectCharPrevious" },
-    { u"keypress", u"VK_RIGHT",     nullptr, u"shift",           u"cmd_selectCharNext" },
-    { u"keypress", u"VK_LEFT",      nullptr, u"control",         u"cmd_wordPrevious" },
-    { u"keypress", u"VK_RIGHT",     nullptr, u"control",         u"cmd_wordNext" },
-    { u"keypress", u"VK_LEFT",      nullptr, u"control,shift",   u"cmd_selectWordPrevious" },
-    { u"keypress", u"VK_RIGHT",     nullptr, u"control,shift",   u"cmd_selectWordNext" },
-    { u"keypress", u"VK_LEFT",      nullptr, u"alt",             u"cmd_beginLine" },
-    { u"keypress", u"VK_RIGHT",     nullptr, u"alt",             u"cmd_endLine" },
-    { u"keypress", u"VK_LEFT",      nullptr, u"shift,alt",       u"cmd_selectBeginLine" },
-    { u"keypress", u"VK_RIGHT",     nullptr, u"shift,alt",       u"cmd_selectEndLine" },
-    { u"keypress", u"VK_UP",        nullptr, u"shift",           u"cmd_selectLinePrevious" },
-    { u"keypress", u"VK_DOWN",      nullptr, u"shift",           u"cmd_selectLineNext" },
-    { u"keypress", u"VK_UP",        nullptr, u"alt",             u"cmd_moveTop" },
-    { u"keypress", u"VK_DOWN",      nullptr, u"alt",             u"cmd_moveBottom" },
-    { u"keypress", u"VK_UP",        nullptr, u"shift,alt",       u"cmd_selectTop" },
-    { u"keypress", u"VK_DOWN",      nullptr, u"shift,alt",       u"cmd_selectBottom" },
-    { u"keypress", u"VK_PAGE_UP",   nullptr, nullptr,            u"cmd_movePageUp" },
-    { u"keypress", u"VK_PAGE_DOWN", nullptr, nullptr,            u"cmd_movePageDown" },
-    { u"keypress", u"VK_PAGE_UP",   nullptr, u"shift",           u"cmd_selectPageUp" },
-    { u"keypress", u"VK_PAGE_DOWN", nullptr, u"shift",           u"cmd_selectPageDown" },
-    { u"keypress", u"VK_PAGE_UP",   nullptr, u"alt",             u"cmd_moveTop" },
-    { u"keypress", u"VK_PAGE_DOWN", nullptr, u"alt",             u"cmd_moveBottom" },
-    { u"keypress", u"VK_PAGE_UP",   nullptr, u"shift,alt",       u"cmd_selectTop" },
-    { u"keypress", u"VK_PAGE_DOWN", nullptr, u"shift,alt",       u"cmd_selectBottom" },
-    { u"keypress", u"VK_HOME",      nullptr, nullptr,            u"cmd_beginLine" },
-    { u"keypress", u"VK_END",       nullptr, nullptr,            u"cmd_endLine" },
-    { u"keypress", u"VK_HOME",      nullptr, u"shift",           u"cmd_selectBeginLine" },
-    { u"keypress", u"VK_END",       nullptr, u"shift",           u"cmd_selectEndLine" },
-    { u"keypress", u"VK_HOME",      nullptr, u"control",         u"cmd_moveTop" },
-    { u"keypress", u"VK_END",       nullptr, u"control",         u"cmd_moveBottom" },
-    { u"keypress", u"VK_HOME",      nullptr, u"shift,control",   u"cmd_selectTop" },
-    { u"keypress", u"VK_END",       nullptr, u"shift,control",   u"cmd_selectBottom" },
-    { u"keypress", u"VK_BACK",      nullptr, u"alt",             u"cmd_deleteToBeginningOfLine" },
-    { u"keypress", u"VK_DELETE",    nullptr, u"alt",             u"cmd_deleteToEndOfLine" },
-
-    { nullptr,     nullptr,         nullptr, nullptr,            nullptr }
-};
-
-ShortcutKeyData ShortcutKeys::sEditorHandlers[] =
-{
-#include "../ShortcutKeyDefinitionsForEditorCommon.h"
-
-    { u"keypress", nullptr,         u"a",    u"accel",           u"cmd_selectAll" },
-    { u"keypress", u"VK_LEFT",      nullptr, u"control",         u"cmd_wordPrevious" },
-    { u"keypress", u"VK_RIGHT",     nullptr, u"control",         u"cmd_wordNext" },
-    { u"keypress", u"VK_LEFT",      nullptr, u"shift,control",   u"cmd_selectWordPrevious" },
-    { u"keypress", u"VK_RIGHT",     nullptr, u"shift,control",   u"cmd_selectWordNext" },
-    { u"keypress", u"VK_LEFT",      nullptr, u"alt",             u"cmd_beginLine" },
-    { u"keypress", u"VK_RIGHT",     nullptr, u"alt",             u"cmd_endLine" },
-    { u"keypress", u"VK_LEFT",      nullptr, u"shift,alt",       u"cmd_selectBeginLine" },
-    { u"keypress", u"VK_RIGHT",     nullptr, u"shift,alt",       u"cmd_selectEndLine" },
-    { u"keypress", u"VK_UP",        nullptr, u"alt",             u"cmd_moveTop" },
-    { u"keypress", u"VK_DOWN",      nullptr, u"alt",             u"cmd_moveBottom" },
-    { u"keypress", u"VK_UP",        nullptr, u"shift,alt",       u"cmd_selectTop" },
-    { u"keypress", u"VK_DOWN",      nullptr, u"shift,alt",       u"cmd_selectBottom" },
-    { u"keypress", u"VK_PAGE_UP",   nullptr, nullptr,            u"cmd_movePageUp" },
-    { u"keypress", u"VK_PAGE_DOWN", nullptr, nullptr,            u"cmd_movePageDown" },
-    { u"keypress", u"VK_PAGE_UP",   nullptr, u"shift",           u"cmd_selectPageUp" },
-    { u"keypress", u"VK_PAGE_DOWN", nullptr, u"shift",           u"cmd_selectPageDown" },
-    { u"keypress", u"VK_PAGE_UP",   nullptr, u"alt",             u"cmd_moveTop" },
-    { u"keypress", u"VK_PAGE_DOWN", nullptr, u"alt",             u"cmd_moveBottom" },
-    { u"keypress", u"VK_PAGE_UP",   nullptr, u"shift,alt",       u"cmd_selectTop" },
-    { u"keypress", u"VK_PAGE_DOWN", nullptr, u"shift,alt",       u"cmd_selectBottom" },
-    { u"keypress", u"VK_HOME",      nullptr, nullptr,            u"cmd_beginLine" },
-    { u"keypress", u"VK_END",       nullptr, nullptr,            u"cmd_endLine" },
-    { u"keypress", u"VK_HOME",      nullptr, u"shift",           u"cmd_selectBeginLine" },
-    { u"keypress", u"VK_END",       nullptr, u"shift",           u"cmd_selectEndLine" },
-    { u"keypress", u"VK_HOME",      nullptr, u"control",         u"cmd_moveTop" },
-    { u"keypress", u"VK_END",       nullptr, u"control",         u"cmd_moveBottom" },
-    { u"keypress", u"VK_HOME",      nullptr, u"shift,control",   u"cmd_selectTop" },
-    { u"keypress", u"VK_END",       nullptr, u"shift,control",   u"cmd_selectBottom" },
-    { u"keypress", u"VK_BACK",      nullptr, u"alt",             u"cmd_deleteToBeginningOfLine" },
-    { u"keypress", u"VK_DELETE",    nullptr, u"alt",             u"cmd_deleteToEndOfLine" },
-
-    { nullptr,     nullptr,         nullptr, nullptr,            nullptr }
-};
-
-} // namespace mozilla
new file mode 100644
--- /dev/null
+++ b/dom/xbl/builtin/android/jar.mn
@@ -0,0 +1,6 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+toolkit.jar:
+* content/global/platformHTMLBindings.xml   (platformHTMLBindings.xml)
--- a/dom/xbl/builtin/android/moz.build
+++ b/dom/xbl/builtin/android/moz.build
@@ -1,9 +1,7 @@
 # -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-SOURCES += ['ShortcutKeyDefinitions.cpp']
-
-FINAL_LIBRARY = 'xul'
+JAR_MANIFESTS += ['jar.mn']
\ No newline at end of file
new file mode 100644
--- /dev/null
+++ b/dom/xbl/builtin/android/platformHTMLBindings.xml
@@ -0,0 +1,162 @@
+<?xml version="1.0"?>
+<!-- This Source Code Form is subject to the terms of the Mozilla Public
+   - License, v. 2.0. If a copy of the MPL was not distributed with this
+   - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
+
+
+<bindings id="htmlBindings"
+   xmlns="http://www.mozilla.org/xbl"
+   xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+  <binding id="inputFields" bindToUntrustedContent="true">
+    <handlers>
+#include ../input-fields-base.inc
+      <handler event="keypress" key="a" modifiers="accel" command="cmd_selectAll"/>
+
+      <handler event="keypress" keycode="VK_LEFT" modifiers="control" command="cmd_wordPrevious"/>
+      <handler event="keypress" keycode="VK_RIGHT" modifiers="control" command="cmd_wordNext"/>
+      <handler event="keypress" keycode="VK_LEFT" modifiers="shift,control" command="cmd_selectWordPrevious"/>
+      <handler event="keypress" keycode="VK_RIGHT" modifiers="shift,control" command="cmd_selectWordNext"/>
+      <handler event="keypress" keycode="VK_LEFT" modifiers="alt" command="cmd_beginLine"/>
+      <handler event="keypress" keycode="VK_RIGHT" modifiers="alt" command="cmd_endLine"/>
+      <handler event="keypress" keycode="VK_LEFT" modifiers="shift,alt" command="cmd_selectBeginLine"/>
+      <handler event="keypress" keycode="VK_RIGHT" modifiers="shift,alt" command="cmd_selectEndLine"/>
+
+      <handler event="keypress" keycode="VK_HOME" command="cmd_beginLine"/>
+      <handler event="keypress" keycode="VK_END" command="cmd_endLine"/>
+      <handler event="keypress" keycode="VK_HOME" modifiers="shift" command="cmd_selectBeginLine" />
+      <handler event="keypress" keycode="VK_END" modifiers="shift" command="cmd_selectEndLine" />
+
+      <handler event="keypress" keycode="VK_BACK" modifiers="alt" command="cmd_deleteToBeginningOfLine"/>
+      <handler event="keypress" keycode="VK_DELETE" modifiers="alt" command="cmd_deleteToEndOfLine"/>
+    </handlers>
+  </binding>
+
+  <binding id="textAreas" bindToUntrustedContent="true">
+    <handlers>
+#include ../textareas-base.inc
+      <handler event="keypress" key="a" modifiers="accel" command="cmd_selectAll"/>
+
+      <handler event="keypress" keycode="VK_LEFT" modifiers="control" command="cmd_wordPrevious"/>
+      <handler event="keypress" keycode="VK_RIGHT" modifiers="control" command="cmd_wordNext"/>
+      <handler event="keypress" keycode="VK_LEFT" modifiers="shift,control" command="cmd_selectWordPrevious"/>
+      <handler event="keypress" keycode="VK_RIGHT" modifiers="shift,control" command="cmd_selectWordNext"/>
+      <handler event="keypress" keycode="VK_LEFT" modifiers="alt" command="cmd_beginLine"/>
+      <handler event="keypress" keycode="VK_RIGHT" modifiers="alt" command="cmd_endLine"/>
+      <handler event="keypress" keycode="VK_LEFT" modifiers="shift,alt" command="cmd_selectBeginLine"/>
+      <handler event="keypress" keycode="VK_RIGHT" modifiers="shift,alt" command="cmd_selectEndLine"/>
+
+      <handler event="keypress" keycode="VK_UP" modifiers="alt" command="cmd_moveTop"/>
+      <handler event="keypress" keycode="VK_DOWN" modifiers="alt" command="cmd_moveBottom"/>
+      <handler event="keypress" keycode="VK_UP" modifiers="shift,alt" command="cmd_selectTop"/>
+      <handler event="keypress" keycode="VK_DOWN" modifiers="shift,alt" command="cmd_selectBottom"/>
+
+      <handler event="keypress" keycode="VK_PAGE_UP" command="cmd_movePageUp"/>
+      <handler event="keypress" keycode="VK_PAGE_DOWN" command="cmd_movePageDown"/>
+      <handler event="keypress" keycode="VK_PAGE_UP" modifiers="shift" command="cmd_selectPageUp"/>
+      <handler event="keypress" keycode="VK_PAGE_DOWN" modifiers="shift" command="cmd_selectPageDown"/>
+      <handler event="keypress" keycode="VK_PAGE_UP" modifiers="alt" command="cmd_moveTop"/>
+      <handler event="keypress" keycode="VK_PAGE_DOWN" modifiers="alt" command="cmd_moveBottom"/>
+      <handler event="keypress" keycode="VK_PAGE_UP" modifiers="shift,alt" command="cmd_selectTop"/>
+      <handler event="keypress" keycode="VK_PAGE_DOWN" modifiers="shift,alt" command="cmd_selectBottom"/>
+
+      <handler event="keypress" keycode="VK_HOME" command="cmd_beginLine"/>
+      <handler event="keypress" keycode="VK_END" command="cmd_endLine"/>
+      <handler event="keypress" keycode="VK_HOME" modifiers="shift" command="cmd_selectBeginLine" />
+      <handler event="keypress" keycode="VK_END" modifiers="shift" command="cmd_selectEndLine" />
+      <handler event="keypress" keycode="VK_HOME" modifiers="control" command="cmd_moveTop"/>
+      <handler event="keypress" keycode="VK_END" modifiers="control" command="cmd_moveBottom"/>
+      <handler event="keypress" keycode="VK_HOME" modifiers="shift,control" command="cmd_selectTop" />
+      <handler event="keypress" keycode="VK_END" modifiers="shift,control" command="cmd_selectBottom" />
+
+      <handler event="keypress" keycode="VK_BACK" modifiers="alt" command="cmd_deleteToBeginningOfLine"/>
+      <handler event="keypress" keycode="VK_DELETE" modifiers="alt" command="cmd_deleteToEndOfLine"/>
+    </handlers>
+  </binding>
+
+  <binding id="browser">
+    <handlers>
+#include ../browser-base.inc
+      <handler event="keypress" keycode="VK_LEFT" modifiers="shift" command="cmd_selectCharPrevious" />
+      <handler event="keypress" keycode="VK_RIGHT" modifiers="shift" command="cmd_selectCharNext" />
+      <handler event="keypress" keycode="VK_LEFT" modifiers="control" command="cmd_wordPrevious" />
+      <handler event="keypress" keycode="VK_RIGHT" modifiers="control" command="cmd_wordNext" />
+      <handler event="keypress" keycode="VK_LEFT" modifiers="control,shift" command="cmd_selectWordPrevious" />
+      <handler event="keypress" keycode="VK_RIGHT" modifiers="control,shift" command="cmd_selectWordNext" />
+      <handler event="keypress" keycode="VK_LEFT" modifiers="alt" command="cmd_beginLine"/>
+      <handler event="keypress" keycode="VK_RIGHT" modifiers="alt" command="cmd_endLine"/>
+      <handler event="keypress" keycode="VK_LEFT" modifiers="shift,alt" command="cmd_selectBeginLine"/>
+      <handler event="keypress" keycode="VK_RIGHT" modifiers="shift,alt" command="cmd_selectEndLine"/>
+
+      <handler event="keypress" keycode="VK_UP" modifiers="shift" command="cmd_selectLinePrevious" />
+      <handler event="keypress" keycode="VK_DOWN" modifiers="shift" command="cmd_selectLineNext" />
+      <handler event="keypress" keycode="VK_UP" modifiers="alt" command="cmd_moveTop"/>
+      <handler event="keypress" keycode="VK_DOWN" modifiers="alt" command="cmd_moveBottom"/>
+      <handler event="keypress" keycode="VK_UP" modifiers="shift,alt" command="cmd_selectTop"/>
+      <handler event="keypress" keycode="VK_DOWN" modifiers="shift,alt" command="cmd_selectBottom"/>
+
+      <handler event="keypress" keycode="VK_PAGE_UP" command="cmd_movePageUp"/>
+      <handler event="keypress" keycode="VK_PAGE_DOWN" command="cmd_movePageDown"/>
+      <handler event="keypress" keycode="VK_PAGE_UP" modifiers="shift" command="cmd_selectPageUp"/>
+      <handler event="keypress" keycode="VK_PAGE_DOWN" modifiers="shift" command="cmd_selectPageDown"/>
+      <handler event="keypress" keycode="VK_PAGE_UP" modifiers="alt" command="cmd_moveTop"/>
+      <handler event="keypress" keycode="VK_PAGE_DOWN" modifiers="alt" command="cmd_moveBottom"/>
+      <handler event="keypress" keycode="VK_PAGE_UP" modifiers="shift,alt" command="cmd_selectTop"/>
+      <handler event="keypress" keycode="VK_PAGE_DOWN" modifiers="shift,alt" command="cmd_selectBottom"/>
+
+      <handler event="keypress" keycode="VK_HOME" command="cmd_beginLine"/>
+      <handler event="keypress" keycode="VK_END" command="cmd_endLine"/>
+      <handler event="keypress" keycode="VK_HOME" modifiers="shift" command="cmd_selectBeginLine" />
+      <handler event="keypress" keycode="VK_END" modifiers="shift" command="cmd_selectEndLine" />
+      <handler event="keypress" keycode="VK_HOME" modifiers="control" command="cmd_moveTop"/>
+      <handler event="keypress" keycode="VK_END" modifiers="control" command="cmd_moveBottom"/>
+      <handler event="keypress" keycode="VK_HOME" modifiers="shift,control" command="cmd_selectTop" />
+      <handler event="keypress" keycode="VK_END" modifiers="shift,control" command="cmd_selectBottom" />
+
+      <handler event="keypress" keycode="VK_BACK" modifiers="alt" command="cmd_deleteToBeginningOfLine"/>
+      <handler event="keypress" keycode="VK_DELETE" modifiers="alt" command="cmd_deleteToEndOfLine"/>
+    </handlers>
+  </binding>
+
+  <binding id="editor">
+    <handlers>
+#include ../editor-base.inc
+      <handler event="keypress" key="a" modifiers="accel" command="cmd_selectAll"/>
+
+      <handler event="keypress" keycode="VK_LEFT" modifiers="control" command="cmd_wordPrevious"/>
+      <handler event="keypress" keycode="VK_RIGHT" modifiers="control" command="cmd_wordNext"/>
+      <handler event="keypress" keycode="VK_LEFT" modifiers="shift,control" command="cmd_selectWordPrevious"/>
+      <handler event="keypress" keycode="VK_RIGHT" modifiers="shift,control" command="cmd_selectWordNext"/>
+      <handler event="keypress" keycode="VK_LEFT" modifiers="alt" command="cmd_beginLine"/>
+      <handler event="keypress" keycode="VK_RIGHT" modifiers="alt" command="cmd_endLine"/>
+      <handler event="keypress" keycode="VK_LEFT" modifiers="shift,alt" command="cmd_selectBeginLine"/>
+      <handler event="keypress" keycode="VK_RIGHT" modifiers="shift,alt" command="cmd_selectEndLine"/>
+
+      <handler event="keypress" keycode="VK_UP" modifiers="alt" command="cmd_moveTop"/>
+      <handler event="keypress" keycode="VK_DOWN" modifiers="alt" command="cmd_moveBottom"/>
+      <handler event="keypress" keycode="VK_UP" modifiers="shift,alt" command="cmd_selectTop"/>
+      <handler event="keypress" keycode="VK_DOWN" modifiers="shift,alt" command="cmd_selectBottom"/>
+
+      <handler event="keypress" keycode="VK_PAGE_UP" command="cmd_movePageUp"/>
+      <handler event="keypress" keycode="VK_PAGE_DOWN" command="cmd_movePageDown"/>
+      <handler event="keypress" keycode="VK_PAGE_UP" modifiers="shift" command="cmd_selectPageUp"/>
+      <handler event="keypress" keycode="VK_PAGE_DOWN" modifiers="shift" command="cmd_selectPageDown"/>
+      <handler event="keypress" keycode="VK_PAGE_UP" modifiers="alt" command="cmd_moveTop"/>
+      <handler event="keypress" keycode="VK_PAGE_DOWN" modifiers="alt" command="cmd_moveBottom"/>
+      <handler event="keypress" keycode="VK_PAGE_UP" modifiers="shift,alt" command="cmd_selectTop"/>
+      <handler event="keypress" keycode="VK_PAGE_DOWN" modifiers="shift,alt" command="cmd_selectBottom"/>
+
+      <handler event="keypress" keycode="VK_HOME" command="cmd_beginLine"/>
+      <handler event="keypress" keycode="VK_END" command="cmd_endLine"/>
+      <handler event="keypress" keycode="VK_HOME" modifiers="shift" command="cmd_selectBeginLine" />
+      <handler event="keypress" keycode="VK_END" modifiers="shift" command="cmd_selectEndLine" />
+      <handler event="keypress" keycode="VK_HOME" modifiers="control" command="cmd_moveTop"/>
+      <handler event="keypress" keycode="VK_END" modifiers="control" command="cmd_moveBottom"/>
+      <handler event="keypress" keycode="VK_HOME" modifiers="shift,control" command="cmd_selectTop" />
+      <handler event="keypress" keycode="VK_END" modifiers="shift,control" command="cmd_selectBottom" />
+
+      <handler event="keypress" keycode="VK_BACK" modifiers="alt" command="cmd_deleteToBeginningOfLine"/>
+      <handler event="keypress" keycode="VK_DELETE" modifiers="alt" command="cmd_deleteToEndOfLine"/>
+    </handlers>
+  </binding>
+</bindings>
new file mode 100644
--- /dev/null
+++ b/dom/xbl/builtin/browser-base.inc
@@ -0,0 +1,14 @@
+      <handler event="keypress" key=" " modifiers="shift" command="cmd_scrollPageUp" />
+      <handler event="keypress" key=" " command="cmd_scrollPageDown" />
+
+      <handler event="keypress" keycode="VK_UP" command="cmd_moveUp" />
+      <handler event="keypress" keycode="VK_DOWN" command="cmd_moveDown" />
+      <handler event="keypress" keycode="VK_LEFT" command="cmd_moveLeft" />
+      <handler event="keypress" keycode="VK_RIGHT" command="cmd_moveRight" />
+
+      <handler event="keypress" key="x" command="cmd_cut" modifiers="accel"/>
+      <handler event="keypress" key="c" command="cmd_copy" modifiers="accel"/>
+      <handler event="keypress" key="v" command="cmd_paste" modifiers="accel"/>
+      <handler event="keypress" key="z" command="cmd_undo" modifiers="accel"/>
+      <handler event="keypress" key="z" command="cmd_redo" modifiers="accel,shift" />
+      <handler event="keypress" key="a" command="cmd_selectAll" modifiers="accel"/>
new file mode 100644
--- /dev/null
+++ b/dom/xbl/builtin/editor-base.inc
@@ -0,0 +1,19 @@
+      <handler event="keypress" key=" " modifiers="shift" command="cmd_scrollPageUp" />
+      <handler event="keypress" key=" " command="cmd_scrollPageDown" />
+
+      <handler event="keypress" keycode="VK_LEFT" command="cmd_moveLeft"/>
+      <handler event="keypress" keycode="VK_RIGHT" command="cmd_moveRight"/>
+      <handler event="keypress" keycode="VK_LEFT" modifiers="shift" command="cmd_selectLeft"/>
+      <handler event="keypress" keycode="VK_RIGHT" modifiers="shift" command="cmd_selectRight"/>
+
+      <handler event="keypress" keycode="VK_UP" command="cmd_moveUp"/>
+      <handler event="keypress" keycode="VK_DOWN" command="cmd_moveDown"/>
+      <handler event="keypress" keycode="VK_UP" modifiers="shift" command="cmd_selectUp"/>
+      <handler event="keypress" keycode="VK_DOWN" modifiers="shift" command="cmd_selectDown"/>
+
+      <handler event="keypress" key="z" command="cmd_undo" modifiers="accel"/>
+      <handler event="keypress" key="z" command="cmd_redo" modifiers="accel,shift" />
+      <handler event="keypress" key="x" command="cmd_cut" modifiers="accel"/>
+      <handler event="keypress" key="c" command="cmd_copy" modifiers="accel"/>
+      <handler event="keypress" key="v" command="cmd_paste" modifiers="accel"/>
+      <handler event="keypress" key="v" command="cmd_pasteNoFormatting" modifiers="accel,shift"/>
deleted file mode 100644
--- a/dom/xbl/builtin/emacs/ShortcutKeyDefinitions.cpp
+++ /dev/null
@@ -1,164 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "../ShortcutKeys.h"
-
-namespace mozilla {
-
-ShortcutKeyData ShortcutKeys::sInputHandlers[] =
-{
-#include "../ShortcutKeyDefinitionsForInputCommon.h"
-
-    { u"keypress", nullptr,         u"a",    u"control",         u"cmd_beginLine" },
-    { u"keypress", nullptr,         u"e",    u"control",         u"cmd_endLine" },
-    { u"keypress", nullptr,         u"b",    u"control",         u"cmd_charPrevious" },
-    { u"keypress", nullptr,         u"f",    u"control",         u"cmd_charNext" },
-    { u"keypress", nullptr,         u"h",    u"control",         u"cmd_deleteCharBackward" },
-    { u"keypress", nullptr,         u"d",    u"control",         u"cmd_deleteCharForward" },
-    { u"keypress", nullptr,         u"w",    u"control",         u"cmd_deleteWordBackward" },
-    { u"keypress", nullptr,         u"u",    u"control",         u"cmd_deleteToBeginningOfLine" },
-    { u"keypress", nullptr,         u"k",    u"control",         u"cmd_deleteToEndOfLine" },
-    { u"keypress", u"VK_DELETE",    nullptr, u"shift",           u"cmd_cutOrDelete" },
-    { u"keypress", u"VK_DELETE",    nullptr, u"control",         u"cmd_copyOrDelete" },
-    { u"keypress", u"VK_INSERT",    nullptr, u"control",         u"cmd_copy" },
-    { u"keypress", u"VK_INSERT",    nullptr, u"shift",           u"cmd_paste" },
-    { u"keypress", u"VK_HOME",      nullptr, nullptr,            u"cmd_beginLine" },
-    { u"keypress", u"VK_END",       nullptr, nullptr,            u"cmd_endLine" },
-    { u"keypress", u"VK_HOME",      nullptr, u"shift",           u"cmd_selectBeginLine" },
-    { u"keypress", u"VK_END",       nullptr, u"shift",           u"cmd_selectEndLine" },
-    { u"keypress", u"VK_HOME",      nullptr, u"control",         u"cmd_beginLine" },
-    { u"keypress", u"VK_END",       nullptr, u"control",         u"cmd_endLine" },
-    { u"keypress", u"VK_HOME",      nullptr, u"control,shift",   u"cmd_selectBeginLine" },
-    { u"keypress", u"VK_END",       nullptr, u"control,shift",   u"cmd_selectEndLine" },
-    { u"keypress", u"VK_BACK",      nullptr, u"control",         u"cmd_deleteWordBackward" },
-    { u"keypress", u"VK_LEFT",      nullptr, u"control",         u"cmd_wordPrevious" },
-    { u"keypress", u"VK_RIGHT",     nullptr, u"control",         u"cmd_wordNext" },
-    { u"keypress", u"VK_LEFT",      nullptr, u"shift,control",   u"cmd_selectWordPrevious" },
-    { u"keypress", u"VK_RIGHT",     nullptr, u"shift,control",   u"cmd_selectWordNext" },
-    { u"keypress", nullptr,         u"y",    u"accel",           u"cmd_redo" },
-    { u"keypress", nullptr,         u"a",    u"alt",             u"cmd_selectAll" },
-
-    { nullptr,     nullptr,         nullptr, nullptr,            nullptr }
-};
-
-ShortcutKeyData ShortcutKeys::sTextAreaHandlers[] =
-{
-#include "../ShortcutKeyDefinitionsForTextAreaCommon.h"
-
-    { u"keypress", nullptr,         u"a",    u"control",         u"cmd_beginLine" },
-    { u"keypress", nullptr,         u"e",    u"control",         u"cmd_endLine" },
-    { u"keypress", nullptr,         u"b",    u"control",         u"cmd_charPrevious" },
-    { u"keypress", nullptr,         u"f",    u"control",         u"cmd_charNext" },
-    { u"keypress", nullptr,         u"h",    u"control",         u"cmd_deleteCharBackward" },
-    { u"keypress", nullptr,         u"d",    u"control",         u"cmd_deleteCharForward" },
-    { u"keypress", nullptr,         u"w",    u"control",         u"cmd_deleteWordBackward" },
-    { u"keypress", nullptr,         u"u",    u"control",         u"cmd_deleteToBeginningOfLine" },
-    { u"keypress", nullptr,         u"k",    u"control",         u"cmd_deleteToEndOfLine" },
-    { u"keypress", u"VK_DELETE",    nullptr, u"shift",           u"cmd_cutOrDelete" },
-    { u"keypress", u"VK_DELETE",    nullptr, u"control",         u"cmd_copyOrDelete" },
-    { u"keypress", u"VK_INSERT",    nullptr, u"control",         u"cmd_copy" },
-    { u"keypress", u"VK_INSERT",    nullptr, u"shift",           u"cmd_paste" },
-    { u"keypress", nullptr,         u"n",    u"control",         u"cmd_lineNext" },
-    { u"keypress", nullptr,         u"p",    u"control",         u"cmd_linePrevious" },
-    { u"keypress", u"VK_HOME",      nullptr, nullptr,            u"cmd_beginLine" },
-    { u"keypress", u"VK_END",       nullptr, nullptr,            u"cmd_endLine" },
-    { u"keypress", u"VK_HOME",      nullptr, u"shift",           u"cmd_selectBeginLine" },
-    { u"keypress", u"VK_END",       nullptr, u"shift",           u"cmd_selectEndLine" },
-    { u"keypress", u"VK_HOME",      nullptr, u"control",         u"cmd_moveTop" },
-    { u"keypress", u"VK_END",       nullptr, u"control",         u"cmd_moveBottom" },
-    { u"keypress", u"VK_HOME",      nullptr, u"shift,control",   u"cmd_selectTop" },
-    { u"keypress", u"VK_END",       nullptr, u"shift,control",   u"cmd_selectBottom" },
-    { u"keypress", u"VK_PAGE_UP",   nullptr, nullptr,            u"cmd_movePageUp" },
-    { u"keypress", u"VK_PAGE_DOWN", nullptr, nullptr,            u"cmd_movePageDown" },
-    { u"keypress", u"VK_PAGE_UP",   nullptr, u"shift",           u"cmd_selectPageUp" },
-    { u"keypress", u"VK_PAGE_DOWN", nullptr, u"shift",           u"cmd_selectPageDown" },
-    { u"keypress", u"VK_LEFT",      nullptr, u"control",         u"cmd_wordPrevious" },
-    { u"keypress", u"VK_RIGHT",     nullptr, u"control",         u"cmd_wordNext" },
-    { u"keypress", u"VK_LEFT",      nullptr, u"shift,control",   u"cmd_selectWordPrevious" },
-    { u"keypress", u"VK_RIGHT",     nullptr, u"shift,control",   u"cmd_selectWordNext" },
-    { u"keypress", u"VK_BACK",      nullptr, u"control",         u"cmd_deleteWordBackward" },
-    { u"keypress", nullptr,         u"y",    u"accel",           u"cmd_redo" },
-    { u"keypress", nullptr,         u"a",    u"alt",             u"cmd_selectAll" },
-
-    { nullptr,     nullptr,         nullptr, nullptr,            nullptr }
-};
-
-ShortcutKeyData ShortcutKeys::sBrowserHandlers[] =
-{
-#include "../ShortcutKeyDefinitionsForBrowserCommon.h"
-
-    { u"keypress", u"VK_PAGE_UP",   nullptr, nullptr,            u"cmd_movePageUp" },
-    { u"keypress", u"VK_PAGE_DOWN", nullptr, nullptr,            u"cmd_movePageDown" },
-    { u"keypress", u"VK_PAGE_UP",   nullptr, u"shift",           u"cmd_selectPageUp" },
-    { u"keypress", u"VK_PAGE_DOWN", nullptr, u"shift",           u"cmd_selectPageDown" },
-    { u"keypress", u"VK_DELETE",    nullptr, u"shift",           u"cmd_cut" },
-    { u"keypress", u"VK_DELETE",    nullptr, u"control",         u"cmd_copy" },
-    { u"keypress", u"VK_INSERT",    nullptr, u"control",         u"cmd_copy" },
-    { u"keypress", u"VK_HOME",      nullptr, nullptr,            u"cmd_beginLine" },
-    { u"keypress", u"VK_END",       nullptr, nullptr,            u"cmd_endLine" },
-    { u"keypress", u"VK_HOME",      nullptr, u"control",         u"cmd_moveTop" },
-    { u"keypress", u"VK_END",       nullptr, u"control",         u"cmd_moveBottom" },
-    { u"keypress", u"VK_HOME",      nullptr, u"shift,control",   u"cmd_selectTop" },
-    { u"keypress", u"VK_END",       nullptr, u"shift,control",   u"cmd_selectBottom" },
-    { u"keypress", u"VK_LEFT",      nullptr, u"control",         u"cmd_wordPrevious" },
-    { u"keypress", u"VK_RIGHT",     nullptr, u"control",         u"cmd_wordNext" },
-    { u"keypress", u"VK_LEFT",      nullptr, u"control,shift",   u"cmd_selectWordPrevious" },
-    { u"keypress", u"VK_RIGHT",     nullptr, u"control,shift",   u"cmd_selectWordNext" },
-    { u"keypress", u"VK_LEFT",      nullptr, u"shift",           u"cmd_selectCharPrevious" },
-    { u"keypress", u"VK_RIGHT",     nullptr, u"shift",           u"cmd_selectCharNext" },
-    { u"keypress", u"VK_HOME",      nullptr, u"shift",           u"cmd_selectBeginLine" },
-    { u"keypress", u"VK_END",       nullptr, u"shift",           u"cmd_selectEndLine" },
-    { u"keypress", u"VK_UP",        nullptr, u"shift",           u"cmd_selectLinePrevious" },
-    { u"keypress", u"VK_DOWN",      nullptr, u"shift",           u"cmd_selectLineNext" },
-    { u"keypress", nullptr,         u"a",    u"alt",             u"cmd_selectAll" },
-
-    { nullptr,     nullptr,         nullptr, nullptr,            nullptr }
-};
-
-ShortcutKeyData ShortcutKeys::sEditorHandlers[] =
-{
-#include "../ShortcutKeyDefinitionsForEditorCommon.h"
-
-    { u"keypress", nullptr,         u"h",    u"control",         u"cmd_deleteCharBackward" },
-    { u"keypress", nullptr,         u"d",    u"control",         u"cmd_deleteCharForward" },
-    { u"keypress", nullptr,         u"k",    u"control",         u"cmd_deleteToEndOfLine" },
-    { u"keypress", nullptr,         u"u",    u"control",         u"cmd_deleteToBeginningOfLine" },
-    { u"keypress", nullptr,         u"a",    u"control",         u"cmd_beginLine" },
-    { u"keypress", nullptr,         u"e",    u"control",         u"cmd_endLine" },
-    { u"keypress", nullptr,         u"b",    u"control",         u"cmd_charPrevious" },
-    { u"keypress", nullptr,         u"f",    u"control",         u"cmd_charNext" },
-    { u"keypress", nullptr,         u"p",    u"control",         u"cmd_linePrevious" },
-    { u"keypress", nullptr,         u"n",    u"control",         u"cmd_lineNext" },
-    { u"keypress", nullptr,         u"x",    u"control",         u"cmd_cut" },
-    { u"keypress", nullptr,         u"c",    u"control",         u"cmd_copy" },
-    { u"keypress", nullptr,         u"v",    u"control",         u"cmd_paste" },
-    { u"keypress", nullptr,         u"z",    u"control",         u"cmd_undo" },
-    { u"keypress", nullptr,         u"y",    u"accel",           u"cmd_redo" },
-    { u"keypress", nullptr,         u"a",    u"alt",             u"cmd_selectAll" },
-    { u"keypress", u"VK_DELETE",    nullptr, u"shift",           u"cmd_cutOrDelete" },
-    { u"keypress", u"VK_DELETE",    nullptr, u"control",         u"cmd_copyOrDelete" },
-    { u"keypress", u"VK_INSERT",    nullptr, u"control",         u"cmd_copy" },
-    { u"keypress", u"VK_INSERT",    nullptr, u"shift",           u"cmd_paste" },
-    { u"keypress", u"VK_LEFT",      nullptr, u"control",         u"cmd_wordPrevious" },
-    { u"keypress", u"VK_RIGHT",     nullptr, u"control",         u"cmd_wordNext" },
-    { u"keypress", u"VK_LEFT",      nullptr, u"shift,control",   u"cmd_selectWordPrevious" },
-    { u"keypress", u"VK_RIGHT",     nullptr, u"shift,control",   u"cmd_selectWordNext" },
-    { u"keypress", u"VK_BACK",      nullptr, u"control",         u"cmd_deleteWordBackward" },
-    { u"keypress", u"VK_HOME",      nullptr, nullptr,            u"cmd_beginLine" },
-    { u"keypress", u"VK_END",       nullptr, nullptr,            u"cmd_endLine" },
-    { u"keypress", u"VK_HOME",      nullptr, u"shift",           u"cmd_selectBeginLine" },
-    { u"keypress", u"VK_END",       nullptr, u"shift",           u"cmd_selectEndLine" },
-    { u"keypress", u"VK_HOME",      nullptr, u"shift,control",   u"cmd_selectTop" },
-    { u"keypress", u"VK_END",       nullptr, u"shift,control",   u"cmd_selectBottom" },
-    { u"keypress", u"VK_HOME",      nullptr, u"control",         u"cmd_moveTop" },
-    { u"keypress", u"VK_END",       nullptr, u"control",         u"cmd_moveBottom" },
-    { u"keypress", u"VK_PAGE_UP",   nullptr, nullptr,            u"cmd_movePageUp" },
-    { u"keypress", u"VK_PAGE_DOWN", nullptr, nullptr,            u"cmd_movePageDown" },
-    { u"keypress", u"VK_PAGE_UP",   nullptr, u"shift",           u"cmd_selectPageUp" },
-    { u"keypress", u"VK_PAGE_DOWN", nullptr, u"shift",           u"cmd_selectPageDown" },
-
-    { nullptr,     nullptr,         nullptr, nullptr,            nullptr }
-};
-
-} // namespace mozilla
new file mode 100644
--- /dev/null
+++ b/dom/xbl/builtin/emacs/jar.mn
@@ -0,0 +1,6 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+toolkit.jar:
+* content/global/platformHTMLBindings.xml   (platformHTMLBindings.xml)
--- a/dom/xbl/builtin/emacs/moz.build
+++ b/dom/xbl/builtin/emacs/moz.build
@@ -1,9 +1,7 @@
 # -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-SOURCES += ['ShortcutKeyDefinitions.cpp']
-
-FINAL_LIBRARY = 'xul'
+JAR_MANIFESTS += ['jar.mn']
\ No newline at end of file
new file mode 100644
--- /dev/null
+++ b/dom/xbl/builtin/emacs/platformHTMLBindings.xml
@@ -0,0 +1,237 @@
+<?xml version="1.0"?>
+<!-- This Source Code Form is subject to the terms of the Mozilla Public
+   - License, v. 2.0. If a copy of the MPL was not distributed with this
+   - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
+
+
+<bindings id="htmlBindings"
+   xmlns="http://www.mozilla.org/xbl"
+   xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+ 
+  <binding id="inputFields" bindToUntrustedContent="true">
+    <handlers>
+#include ../input-fields-base.inc
+    <!-- Emacsish single-line motion and delete keys -->
+    <handler event="keypress" key="a" modifiers="control"
+        command="cmd_beginLine"/>
+    <handler event="keypress" key="e" modifiers="control"
+        command="cmd_endLine"/>
+    <handler event="keypress" key="b" modifiers="control"
+        command="cmd_charPrevious"/>
+    <handler event="keypress" key="f" modifiers="control"
+        command="cmd_charNext"/>
+    <handler event="keypress" key="h" modifiers="control"
+        command="cmd_deleteCharBackward"/>
+    <handler event="keypress" key="d" modifiers="control"
+        command="cmd_deleteCharForward"/>
+    <handler event="keypress" key="w" modifiers="control"
+        command="cmd_deleteWordBackward"/>
+    <handler event="keypress" key="u" modifiers="control"
+        command="cmd_deleteToBeginningOfLine"/>
+    <handler event="keypress" key="k" modifiers="control"
+        command="cmd_deleteToEndOfLine"/>
+
+    <!-- Alternate Windows copy/paste/undo/redo keys -->
+    <handler event="keypress" keycode="VK_DELETE" modifiers="shift"
+        command="cmd_cutOrDelete"/>
+    <handler event="keypress" keycode="VK_DELETE" modifiers="control"
+        command="cmd_copyOrDelete"/>
+    <handler event="keypress" keycode="VK_INSERT" modifiers="control" 
+        command="cmd_copy"/>
+    <handler event="keypress" keycode="VK_INSERT" modifiers="shift"
+        command="cmd_paste"/>
+
+    <!-- navigating by word keys -->
+    <handler event="keypress" keycode="VK_HOME" 
+        command="cmd_beginLine"/>
+    <handler event="keypress" keycode="VK_END" 
+        command="cmd_endLine"/>
+    <handler event="keypress" keycode="VK_HOME" modifiers="shift"
+        command="cmd_selectBeginLine"/>
+    <handler event="keypress" keycode="VK_END" modifiers="shift"
+        command="cmd_selectEndLine"/>
+    <handler event="keypress" keycode="VK_HOME" modifiers="control"
+        command="cmd_beginLine"/>
+    <handler event="keypress" keycode="VK_END" modifiers="control" 
+        command="cmd_endLine"/>
+    <handler event="keypress" keycode="VK_HOME" modifiers="control,shift"
+        command="cmd_selectBeginLine"/>
+    <handler event="keypress" keycode="VK_END" modifiers="control,shift"
+        command="cmd_selectEndLine"/>
+    <handler event="keypress" keycode="VK_BACK" modifiers="control"
+        command="cmd_deleteWordBackward"/>
+
+    <handler event="keypress" keycode="VK_LEFT" modifiers="control" 
+        command="cmd_wordPrevious"/>
+    <handler event="keypress" keycode="VK_RIGHT" modifiers="control"
+        command="cmd_wordNext"/>
+    <handler event="keypress" keycode="VK_LEFT" modifiers="shift,control" 
+        command="cmd_selectWordPrevious"/>
+    <handler event="keypress" keycode="VK_RIGHT" modifiers="shift,control" 
+        command="cmd_selectWordNext"/>
+    <handler event="keypress" key="y" modifiers="accel"
+        command="cmd_redo"/>
+    <handler event="keypress" key="a" modifiers="alt"
+        command="cmd_selectAll"/>
+    </handlers>
+  </binding>
+
+  <binding id="textAreas" bindToUntrustedContent="true">
+    <handlers>
+#include ../textareas-base.inc
+    <!-- Emacsish single-line motion and delete keys -->
+    <handler event="keypress" key="a" modifiers="control"
+        command="cmd_beginLine"/>
+    <handler event="keypress" key="e" modifiers="control"
+        command="cmd_endLine"/>
+    <handler event="keypress" id="key_left" key="b" modifiers="control"
+        command="cmd_charPrevious"/>
+    <handler event="keypress" id="key_right" key="f" modifiers="control"
+        command="cmd_charNext"/>
+    <handler event="keypress" id="key_delback" key="h" modifiers="control"
+        command="cmd_deleteCharBackward"/>
+    <handler event="keypress" id="key_delforw" key="d" modifiers="control"
+        command="cmd_deleteCharForward"/>
+    <handler event="keypress" id="key_delwback" key="w" modifiers="control"
+        command="cmd_deleteWordBackward"/>
+    <handler event="keypress" id="key_del_bol" key="u" modifiers="control"
+        command="cmd_deleteToBeginningOfLine"/>
+    <handler event="keypress" id="key_del_eol" key="k" modifiers="control"
+        command="cmd_deleteToEndOfLine"/>
+
+    <!-- Alternate Windows copy/paste/undo/redo keys -->
+    <handler event="keypress" keycode="VK_DELETE" modifiers="shift"
+        command="cmd_cutOrDelete"/>
+    <handler event="keypress" keycode="VK_DELETE" modifiers="control"
+        command="cmd_copyOrDelete"/>
+    <handler event="keypress" keycode="VK_INSERT" modifiers="control"
+        command="cmd_copy"/>
+    <handler event="keypress" keycode="VK_INSERT" modifiers="shift"
+        command="cmd_paste"/>
+
+    <!-- Emacsish multi-line motion and delete keys -->
+    <handler event="keypress" id="key_linedown" key="n" modifiers="control"
+        command="cmd_lineNext"/>
+    <handler event="keypress" id="key_lineup" key="p" modifiers="control"
+        command="cmd_linePrevious"/>
+
+    <!-- handle home/end/arrow keys and redo -->
+    <handler event="keypress" keycode="VK_HOME" 
+        command="cmd_beginLine"/>
+    <handler event="keypress" keycode="VK_END" 
+        command="cmd_endLine"/>
+    <handler event="keypress" keycode="VK_HOME" modifiers="shift"
+        command="cmd_selectBeginLine"/>
+    <handler event="keypress" keycode="VK_END" modifiers="shift"
+        command="cmd_selectEndLine"/>
+
+    <handler event="keypress" keycode="VK_HOME" modifiers="control" 
+        command="cmd_moveTop"/>
+    <handler event="keypress" keycode="VK_END" modifiers="control" 
+        command="cmd_moveBottom"/>
+    <handler event="keypress" keycode="VK_HOME" modifiers="shift,control"
+        command="cmd_selectTop"/>
+    <handler event="keypress" keycode="VK_END" modifiers="shift,control"
+        command="cmd_selectBottom"/>
+
+    <handler event="keypress" keycode="VK_PAGE_UP" 
+        command="cmd_movePageUp"/>
+    <handler event="keypress" keycode="VK_PAGE_DOWN" 
+        command="cmd_movePageDown"/>
+    <handler event="keypress" keycode="VK_PAGE_UP" modifiers="shift"
+        command="cmd_selectPageUp"/>
+    <handler event="keypress" keycode="VK_PAGE_DOWN" modifiers="shift"
+        command="cmd_selectPageDown"/>
+
+    <handler event="keypress" keycode="VK_LEFT" modifiers="control" 
+        command="cmd_wordPrevious"/>
+    <handler event="keypress" keycode="VK_RIGHT" modifiers="control" 
+        command="cmd_wordNext"/>
+    <handler event="keypress" keycode="VK_LEFT" modifiers="shift,control" 
+        command="cmd_selectWordPrevious"/>
+    <handler event="keypress" keycode="VK_RIGHT" modifiers="shift,control" 
+        command="cmd_selectWordNext"/>
+    <handler event="keypress" keycode="VK_BACK" modifiers="control"
+        command="cmd_deleteWordBackward"/>
+    <handler event="keypress" key="y" modifiers="accel"
+        command="cmd_redo"/>
+    <handler event="keypress" key="a" modifiers="alt"
+        command="cmd_selectAll"/>
+    </handlers>
+  </binding>
+
+  <binding id="browser">
+    <handlers>
+#include ../browser-base.inc
+      <handler event="keypress" keycode="VK_PAGE_UP" command="cmd_movePageUp"/>
+      <handler event="keypress" keycode="VK_PAGE_DOWN" command="cmd_movePageDown"/>
+      <handler event="keypress" keycode="VK_PAGE_UP" modifiers="shift" command="cmd_selectPageUp"/>
+      <handler event="keypress" keycode="VK_PAGE_DOWN" modifiers="shift" command="cmd_selectPageDown"/>
+
+      <handler event="keypress" keycode="VK_DELETE" modifiers="shift" command="cmd_cut" /> 
+      <handler event="keypress" keycode="VK_DELETE" modifiers="control" command="cmd_copy" /> 
+      <handler event="keypress" keycode="VK_INSERT" modifiers="control" command="cmd_copy" /> 
+      <handler event="keypress" keycode="VK_HOME" command="cmd_beginLine"/>
+      <handler event="keypress" keycode="VK_END" command="cmd_endLine"/>
+      <handler event="keypress" keycode="VK_HOME" modifiers="control" command="cmd_moveTop"/>
+      <handler event="keypress" keycode="VK_END" modifiers="control" command="cmd_moveBottom"/>
+      <handler event="keypress" keycode="VK_HOME" modifiers="shift,control" command="cmd_selectTop" /> 
+      <handler event="keypress" keycode="VK_END" modifiers="shift,control" command="cmd_selectBottom" /> 
+
+      <handler event="keypress" keycode="VK_LEFT" modifiers="control" command="cmd_wordPrevious" />
+      <handler event="keypress" keycode="VK_RIGHT" modifiers="control" command="cmd_wordNext" />
+      <handler event="keypress" keycode="VK_LEFT" modifiers="control,shift" command="cmd_selectWordPrevious" />
+      <handler event="keypress" keycode="VK_RIGHT" modifiers="control,shift" command="cmd_selectWordNext" />
+      <handler event="keypress" keycode="VK_LEFT" modifiers="shift" command="cmd_selectCharPrevious" />
+      <handler event="keypress" keycode="VK_RIGHT" modifiers="shift" command="cmd_selectCharNext" />
+      <handler event="keypress" keycode="VK_HOME" modifiers="shift" command="cmd_selectBeginLine" />
+      <handler event="keypress" keycode="VK_END" modifiers="shift" command="cmd_selectEndLine" />
+      <handler event="keypress" keycode="VK_UP" modifiers="shift" command="cmd_selectLinePrevious" />
+      <handler event="keypress" keycode="VK_DOWN" modifiers="shift" command="cmd_selectLineNext" />
+      <handler event="keypress" key="a" modifiers="alt" command="cmd_selectAll"/>
+    </handlers>
+  </binding>
+
+  <binding id="editor">
+    <handlers>
+#include ../editor-base.inc
+      <handler event="keypress" key="h" modifiers="control" command="cmd_deleteCharBackward"/>
+      <handler event="keypress" key="d" modifiers="control" command="cmd_deleteCharForward"/>
+      <handler event="keypress" key="k" modifiers="control" command="cmd_deleteToEndOfLine"/>
+      <handler event="keypress" key="u" modifiers="control" command="cmd_deleteToBeginningOfLine"/>
+      <handler event="keypress" key="a" modifiers="control" command="cmd_beginLine"/>
+      <handler event="keypress" key="e" modifiers="control" command="cmd_endLine"/>
+      <handler event="keypress" key="b" modifiers="control" command="cmd_charPrevious"/>
+      <handler event="keypress" key="f" modifiers="control" command="cmd_charNext"/>
+      <handler event="keypress" key="p" modifiers="control" command="cmd_linePrevious"/>
+      <handler event="keypress" key="n" modifiers="control" command="cmd_lineNext"/>
+      <handler event="keypress" key="x" modifiers="control" command="cmd_cut"/>
+      <handler event="keypress" key="c" modifiers="control" command="cmd_copy"/>
+      <handler event="keypress" key="v" modifiers="control" command="cmd_paste"/>
+      <handler event="keypress" key="z" modifiers="control" command="cmd_undo"/>
+      <handler event="keypress" key="y" modifiers="accel"   command="cmd_redo"/>
+      <handler event="keypress" key="a" modifiers="alt" command="cmd_selectAll"/>
+      <handler event="keypress" keycode="VK_DELETE" modifiers="shift" command="cmd_cutOrDelete"/>
+      <handler event="keypress" keycode="VK_DELETE" modifiers="control" command="cmd_copyOrDelete"/>
+      <handler event="keypress" keycode="VK_INSERT" modifiers="control" command="cmd_copy"/>
+      <handler event="keypress" keycode="VK_INSERT" modifiers="shift" command="cmd_paste"/>
+      <handler event="keypress" keycode="VK_LEFT" modifiers="control" command="cmd_wordPrevious"/>
+      <handler event="keypress" keycode="VK_RIGHT" modifiers="control" command="cmd_wordNext"/>
+      <handler event="keypress" keycode="VK_LEFT" modifiers="shift,control" command="cmd_selectWordPrevious"/>
+      <handler event="keypress" keycode="VK_RIGHT" modifiers="shift,control" command="cmd_selectWordNext"/>
+      <handler event="keypress" keycode="VK_BACK" modifiers="control" command="cmd_deleteWordBackward"/>
+      <handler event="keypress" keycode="VK_HOME" command="cmd_beginLine"/>
+      <handler event="keypress" keycode="VK_END" command="cmd_endLine"/>
+      <handler event="keypress" keycode="VK_HOME" modifiers="shift" command="cmd_selectBeginLine"/>
+      <handler event="keypress" keycode="VK_END" modifiers="shift" command="cmd_selectEndLine"/>
+      <handler event="keypress" keycode="VK_HOME" modifiers="shift,control" command="cmd_selectTop"/>
+      <handler event="keypress" keycode="VK_END" modifiers="shift,control" command="cmd_selectBottom"/>
+      <handler event="keypress" keycode="VK_HOME" modifiers="control" command="cmd_moveTop"/>
+      <handler event="keypress" keycode="VK_END" modifiers="control" command="cmd_moveBottom"/>
+      <handler event="keypress" keycode="VK_PAGE_UP" command="cmd_movePageUp"/>
+      <handler event="keypress" keycode="VK_PAGE_DOWN" command="cmd_movePageDown"/>
+      <handler event="keypress" keycode="VK_PAGE_UP" modifiers="shift" command="cmd_selectPageUp"/>
+      <handler event="keypress" keycode="VK_PAGE_DOWN" modifiers="shift" command="cmd_selectPageDown"/>
+    </handlers>
+  </binding>
+</bindings>
new file mode 100644
--- /dev/null
+++ b/dom/xbl/builtin/input-fields-base.inc
@@ -0,0 +1,17 @@
+    <handler event="keypress" keycode="VK_LEFT" command="cmd_moveLeft"/>
+    <handler event="keypress" keycode="VK_RIGHT" command="cmd_moveRight"/>
+    <handler event="keypress" keycode="VK_LEFT" modifiers="shift" command="cmd_selectLeft"/>
+    <handler event="keypress" keycode="VK_RIGHT" modifiers="shift" command="cmd_selectRight"/>
+
+    <handler event="keypress" keycode="VK_UP" command="cmd_moveUp"/>
+    <handler event="keypress" keycode="VK_DOWN" command="cmd_moveDown"/>
+    <handler event="keypress" keycode="VK_UP" modifiers="shift" command="cmd_selectUp"/>
+    <handler event="keypress" keycode="VK_DOWN" modifiers="shift" command="cmd_selectDown"/>
+
+    <!-- Cut/copy/paste/undo -->
+    <handler event="keypress" key="c" modifiers="accel" command="cmd_copy"/>
+    <handler event="keypress" key="x" modifiers="accel" command="cmd_cut"/>
+    <handler event="keypress" key="v" modifiers="accel" command="cmd_paste"/>
+    <handler event="keypress" key="z" modifiers="accel" command="cmd_undo"/>
+    <handler event="keypress" key="z" modifiers="accel,shift" command="cmd_redo" />
+
deleted file mode 100644
--- a/dom/xbl/builtin/mac/ShortcutKeyDefinitions.cpp
+++ /dev/null
@@ -1,73 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "../ShortcutKeys.h"
-
-namespace mozilla {
-
-ShortcutKeyData ShortcutKeys::sInputHandlers[] =
-{
-    { u"keypress", nullptr,         u"c",    u"accel",           u"cmd_copy" },
-    { u"keypress", nullptr,         u"x",    u"accel",           u"cmd_cut" },
-    { u"keypress", nullptr,         u"v",    u"accel",           u"cmd_paste" },
-    { u"keypress", nullptr,         u"z",    u"accel",           u"cmd_undo" },
-    { u"keypress", nullptr,         u"z",    u"accel,shift",     u"cmd_redo" },
-    { u"keypress", nullptr,         u"a",    u"accel",           u"cmd_selectAll" },
-
-    { nullptr,     nullptr,         nullptr, nullptr,            nullptr }
-};
-
-ShortcutKeyData ShortcutKeys::sTextAreaHandlers[] =
-{
-    { u"keypress", nullptr,         u"c",    u"accel",           u"cmd_copy" },
-    { u"keypress", nullptr,         u"x",    u"accel",           u"cmd_cut" },
-    { u"keypress", nullptr,         u"v",    u"accel",           u"cmd_paste" },
-    { u"keypress", nullptr,         u"z",    u"accel",           u"cmd_undo" },
-    { u"keypress", nullptr,         u"z",    u"accel,shift",     u"cmd_redo" },
-    { u"keypress", nullptr,         u"a",    u"accel",           u"cmd_selectAll" },
-
-    { nullptr,     nullptr,         nullptr, nullptr,            nullptr }
-};
-
-ShortcutKeyData ShortcutKeys::sBrowserHandlers[] =
-{
-#include "../ShortcutKeyDefinitionsForBrowserCommon.h"
-
-    { u"keypress", u"VK_PAGE_UP",   nullptr, nullptr,            u"cmd_scrollPageUp" },
-    { u"keypress", u"VK_PAGE_DOWN", nullptr, nullptr,            u"cmd_scrollPageDown" },
-    { u"keypress", u"VK_HOME",      nullptr, nullptr,            u"cmd_scrollTop" },
-    { u"keypress", u"VK_END",       nullptr, nullptr,            u"cmd_scrollBottom" },
-    { u"keypress", u"VK_LEFT",      nullptr, u"alt",             u"cmd_moveLeft2" },
-    { u"keypress", u"VK_RIGHT",     nullptr, u"alt",             u"cmd_moveRight2" },
-    { u"keypress", u"VK_LEFT",      nullptr, u"alt,shift",       u"cmd_selectLeft2" },
-    { u"keypress", u"VK_RIGHT",     nullptr, u"alt,shift",       u"cmd_selectRight2" },
-    { u"keypress", u"VK_LEFT",      nullptr, u"shift",           u"cmd_selectLeft" },
-    { u"keypress", u"VK_RIGHT",     nullptr, u"shift",           u"cmd_selectRight" },
-    { u"keypress", u"VK_UP",        nullptr, u"alt,shift",       u"cmd_selectUp2" },
-    { u"keypress", u"VK_DOWN",      nullptr, u"alt,shift",       u"cmd_selectDown2" },
-    { u"keypress", u"VK_UP",        nullptr, u"shift",           u"cmd_selectUp" },
-    { u"keypress", u"VK_DOWN",      nullptr, u"shift",           u"cmd_selectDown" },
-    { u"keypress", u"VK_UP",        nullptr, u"accel",           u"cmd_moveUp2" },
-    { u"keypress", u"VK_DOWN",      nullptr, u"accel",           u"cmd_moveDown2" },
-
-    { nullptr,     nullptr,         nullptr, nullptr,            nullptr }
-};
-
-ShortcutKeyData ShortcutKeys::sEditorHandlers[] =
-{
-    { u"keypress", nullptr,         u" ",    u"shift",           u"cmd_scrollPageUp" },
-    { u"keypress", nullptr,         u" ",    nullptr,            u"cmd_scrollPageDown" },
-    { u"keypress", nullptr,         u"z",    u"accel",           u"cmd_undo" },
-    { u"keypress", nullptr,         u"z",    u"accel,shift",     u"cmd_redo" },
-    { u"keypress", nullptr,         u"x",    u"accel",           u"cmd_cut" },
-    { u"keypress", nullptr,         u"c",    u"accel",           u"cmd_copy" },
-    { u"keypress", nullptr,         u"v",    u"accel",           u"cmd_paste" },
-    { u"keypress", nullptr,         u"v",    u"accel,shift",     u"cmd_pasteNoFormatting" },
-    { u"keypress", nullptr,         u"a",    u"accel",           u"cmd_selectAll" },
-    { u"keypress", nullptr,         u"v",    u"accel,alt,shift", u"cmd_pasteNoFormatting" },
-
-    { nullptr,     nullptr,         nullptr, nullptr,            nullptr }
-};
-
-} // namespace mozilla
new file mode 100644
--- /dev/null
+++ b/dom/xbl/builtin/mac/jar.mn
@@ -0,0 +1,6 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+toolkit.jar:
+* content/global/platformHTMLBindings.xml   (platformHTMLBindings.xml)
--- a/dom/xbl/builtin/mac/moz.build
+++ b/dom/xbl/builtin/mac/moz.build
@@ -1,9 +1,7 @@
 # -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-SOURCES += ['ShortcutKeyDefinitions.cpp']
-
-FINAL_LIBRARY = 'xul'
+JAR_MANIFESTS += ['jar.mn']
\ No newline at end of file
new file mode 100644
--- /dev/null
+++ b/dom/xbl/builtin/mac/platformHTMLBindings.xml
@@ -0,0 +1,72 @@
+<?xml version="1.0"?>
+<!-- This Source Code Form is subject to the terms of the Mozilla Public
+   - License, v. 2.0. If a copy of the MPL was not distributed with this
+   - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
+
+
+<bindings id="htmlBindings"
+   xmlns="http://www.mozilla.org/xbl"
+   xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+  <binding id="inputFields" bindToUntrustedContent="true">
+    <handlers>
+      <handler event="keypress" key="c" modifiers="accel" command="cmd_copy"/>
+      <handler event="keypress" key="x" modifiers="accel" command="cmd_cut"/>
+      <handler event="keypress" key="v" modifiers="accel" command="cmd_paste"/>
+      <handler event="keypress" key="z" modifiers="accel" command="cmd_undo"/>
+      <handler event="keypress" key="z" modifiers="accel,shift" command="cmd_redo"/>
+      <handler event="keypress" key="a" modifiers="accel" command="cmd_selectAll"/>
+    </handlers>
+  </binding>
+
+  <binding id="textAreas" bindToUntrustedContent="true">
+    <handlers>
+      <handler event="keypress" key="c" modifiers="accel" command="cmd_copy"/>
+      <handler event="keypress" key="x" modifiers="accel" command="cmd_cut"/>
+      <handler event="keypress" key="v" modifiers="accel" command="cmd_paste"/>
+      <handler event="keypress" key="z" modifiers="accel" command="cmd_undo"/>
+      <handler event="keypress" key="z" modifiers="accel,shift" command="cmd_redo"/>
+      <handler event="keypress" key="a" modifiers="accel" command="cmd_selectAll"/>
+    </handlers>
+  </binding>
+
+  <binding id="browser">
+    <handlers>
+#include ../browser-base.inc
+      <handler event="keypress" keycode="VK_PAGE_UP" command="cmd_scrollPageUp"/>
+      <handler event="keypress" keycode="VK_PAGE_DOWN" command="cmd_scrollPageDown"/>
+      <handler event="keypress" keycode="VK_HOME" command="cmd_scrollTop" /> 
+      <handler event="keypress" keycode="VK_END"  command="cmd_scrollBottom" /> 
+
+      <handler event="keypress" keycode="VK_LEFT" modifiers="alt" command="cmd_moveLeft2" />
+      <handler event="keypress" keycode="VK_RIGHT" modifiers="alt" command="cmd_moveRight2" />
+      <handler event="keypress" keycode="VK_LEFT" modifiers="alt,shift" command="cmd_selectLeft2" />
+      <handler event="keypress" keycode="VK_RIGHT" modifiers="alt,shift" command="cmd_selectRight2" />
+      <handler event="keypress" keycode="VK_LEFT" modifiers="shift" command="cmd_selectLeft" />
+      <handler event="keypress" keycode="VK_RIGHT" modifiers="shift" command="cmd_selectRight" />
+      <handler event="keypress" keycode="VK_UP" modifiers="alt,shift" command="cmd_selectUp2" />
+      <handler event="keypress" keycode="VK_DOWN" modifiers="alt,shift" command="cmd_selectDown2" />
+      <handler event="keypress" keycode="VK_UP" modifiers="shift" command="cmd_selectUp" />
+      <handler event="keypress" keycode="VK_DOWN" modifiers="shift" command="cmd_selectDown" />
+      <handler event="keypress" keycode="VK_UP" modifiers="accel" command="cmd_moveUp2"/>
+      <handler event="keypress" keycode="VK_DOWN" modifiers="accel" command="cmd_moveDown2"/>
+    </handlers>
+  </binding>
+
+  <binding id="editor">
+    <handlers>
+      <handler event="keypress" key=" " modifiers="shift" command="cmd_scrollPageUp" />
+      <handler event="keypress" key=" " command="cmd_scrollPageDown" />
+
+      <handler event="keypress" key="z" command="cmd_undo" modifiers="accel"/>
+      <handler event="keypress" key="z" command="cmd_redo" modifiers="accel,shift" />
+      <handler event="keypress" key="x" command="cmd_cut" modifiers="accel"/>
+      <handler event="keypress" key="c" command="cmd_copy" modifiers="accel"/>
+      <handler event="keypress" key="v" command="cmd_paste" modifiers="accel"/>
+      <handler event="keypress" key="v" command="cmd_pasteNoFormatting" modifiers="accel,shift"/>
+      <handler event="keypress" key="a" command="cmd_selectAll" modifiers="accel"/>
+      <handler event="keypress" key="v" command="cmd_pasteNoFormatting" modifiers="accel,alt,shift"/>
+    </handlers>
+  </binding>
+
+</bindings>
--- a/dom/xbl/builtin/moz.build
+++ b/dom/xbl/builtin/moz.build
@@ -10,13 +10,8 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'co
     DIRS += ['mac']
 elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android':
     DIRS += ['android']
 elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gtk3':
     DIRS += ['unix']
 else:
     DIRS += ['emacs']
 
-EXPORTS.mozilla += ['ShortcutKeys.h']
-
-SOURCES += ['ShortcutKeys.cpp']
-
-FINAL_LIBRARY = 'xul'
new file mode 100644
--- /dev/null
+++ b/dom/xbl/builtin/textareas-base.inc
@@ -0,0 +1,16 @@
+    <handler event="keypress" keycode="VK_LEFT" command="cmd_moveLeft"/>
+    <handler event="keypress" keycode="VK_RIGHT" command="cmd_moveRight"/>
+    <handler event="keypress" keycode="VK_LEFT" modifiers="shift" command="cmd_selectLeft"/>
+    <handler event="keypress" keycode="VK_RIGHT" modifiers="shift" command="cmd_selectRight"/>
+
+    <handler event="keypress" keycode="VK_UP" command="cmd_moveUp"/>
+    <handler event="keypress" keycode="VK_DOWN" command="cmd_moveDown"/>
+    <handler event="keypress" keycode="VK_UP" modifiers="shift" command="cmd_selectUp"/>
+    <handler event="keypress" keycode="VK_DOWN" modifiers="shift" command="cmd_selectDown"/>
+
+    <!-- Cut/copy/paste/undo -->
+    <handler event="keypress" key="c" modifiers="accel" command="cmd_copy"/>
+    <handler event="keypress" key="x" modifiers="accel" command="cmd_cut"/>
+    <handler event="keypress" key="v" modifiers="accel" command="cmd_paste"/>
+    <handler event="keypress" key="z" modifiers="accel" command="cmd_undo"/>
+    <handler event="keypress" key="z" modifiers="accel,shift" command="cmd_redo" />
deleted file mode 100644
--- a/dom/xbl/builtin/unix/ShortcutKeyDefinitions.cpp
+++ /dev/null
@@ -1,81 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "../ShortcutKeys.h"
-
-namespace mozilla {
-
-ShortcutKeyData ShortcutKeys::sInputHandlers[] =
-{
-#include "../ShortcutKeyDefinitionsForInputCommon.h"
-
-    { u"keypress", nullptr,         u"a",    u"alt",             u"cmd_selectAll" },
-    { u"keypress", nullptr,         u"y",    u"accel",           u"cmd_redo" },
-    { u"keypress", nullptr,         u"z",    u"accel,shift",     u"cmd_redo" },
-    { u"keypress", nullptr,         u"z",    u"accel",           u"cmd_undo" },
-
-    { nullptr,     nullptr,         nullptr, nullptr,            nullptr }
-};
-
-ShortcutKeyData ShortcutKeys::sTextAreaHandlers[] =
-{
-#include "../ShortcutKeyDefinitionsForTextAreaCommon.h"
-
-    { u"keypress", nullptr,         u"a",    u"alt",             u"cmd_selectAll" },
-    { u"keypress", nullptr,         u"y",    u"accel",           u"cmd_redo" },
-    { u"keypress", nullptr,         u"z",    u"accel",           u"cmd_undo" },
-    { u"keypress", nullptr,         u"z",    u"accel,shift",     u"cmd_redo" },
-
-    { nullptr,     nullptr,         nullptr, nullptr,            nullptr }
-};
-
-ShortcutKeyData ShortcutKeys::sBrowserHandlers[] =
-{
-#include "../ShortcutKeyDefinitionsForBrowserCommon.h"
-
-    { u"keypress", u"VK_PAGE_UP",   nullptr, nullptr,            u"cmd_movePageUp" },
-    { u"keypress", u"VK_PAGE_DOWN", nullptr, nullptr,            u"cmd_movePageDown" },
-    { u"keypress", u"VK_PAGE_UP",   nullptr, u"shift",           u"cmd_selectPageUp" },
-    { u"keypress", u"VK_PAGE_DOWN", nullptr, u"shift",           u"cmd_selectPageDown" },
-    { u"keypress", u"VK_DELETE",    nullptr, u"shift",           u"cmd_cut" },
-    { u"keypress", u"VK_DELETE",    nullptr, u"control",         u"cmd_copy" },
-    { u"keypress", u"VK_INSERT",    nullptr, u"control",         u"cmd_copy" },
-    { u"keypress", u"VK_HOME",      nullptr, nullptr,            u"cmd_beginLine" },
-    { u"keypress", u"VK_END",       nullptr, nullptr,            u"cmd_endLine" },
-    { u"keypress", u"VK_HOME",      nullptr, u"shift",           u"cmd_selectBeginLine" },
-    { u"keypress", u"VK_END",       nullptr, u"shift",           u"cmd_selectEndLine" },
-    { u"keypress", u"VK_HOME",      nullptr, u"control",         u"cmd_moveTop" },
-    { u"keypress", u"VK_END",       nullptr, u"control",         u"cmd_moveBottom" },
-    { u"keypress", u"VK_HOME",      nullptr, u"shift,control",   u"cmd_selectTop" },
-    { u"keypress", u"VK_END",       nullptr, u"shift,control",   u"cmd_selectBottom" },
-    { u"keypress", u"VK_LEFT",      nullptr, u"shift",           u"cmd_selectLeft" },
-    { u"keypress", u"VK_RIGHT",     nullptr, u"shift",           u"cmd_selectRight" },
-    { u"keypress", u"VK_LEFT",      nullptr, u"control",         u"cmd_moveLeft2" },
-    { u"keypress", u"VK_RIGHT",     nullptr, u"control",         u"cmd_moveRight2" },
-    { u"keypress", u"VK_LEFT",      nullptr, u"control,shift",   u"cmd_selectLeft2" },
-    { u"keypress", u"VK_RIGHT",     nullptr, u"control,shift",   u"cmd_selectRight2" },
-    { u"keypress", u"VK_UP",        nullptr, u"shift",           u"cmd_selectUp" },
-    { u"keypress", u"VK_DOWN",      nullptr, u"shift",           u"cmd_selectDown" },
-    { u"keypress", u"VK_UP",        nullptr, u"control",         u"cmd_moveUp2" },
-    { u"keypress", u"VK_DOWN",      nullptr, u"control",         u"cmd_moveDown2" },
-    { u"keypress", u"VK_UP",        nullptr, u"control,shift",   u"cmd_selectUp2" },
-    { u"keypress", u"VK_DOWN",      nullptr, u"control,shift",   u"cmd_selectDown2" },
-    { u"keypress", nullptr,         u"a",    u"alt",             u"cmd_selectAll" },
-
-    { nullptr,     nullptr,         nullptr, nullptr,            nullptr }
-};
-
-ShortcutKeyData ShortcutKeys::sEditorHandlers[] =
-{
-#include "../ShortcutKeyDefinitionsForEditorCommon.h"
-
-    { u"keypress", nullptr,         u"z",    u"accel",           u"cmd_undo" },
-    { u"keypress", nullptr,         u"z",    u"accel,shift",     u"cmd_redo" },
-    { u"keypress", nullptr,         u"y",    u"accel",           u"cmd_redo" },
-    { u"keypress", nullptr,         u"a",    u"alt",             u"cmd_selectAll" },
-
-    { nullptr,     nullptr,         nullptr, nullptr,            nullptr }
-};
-
-} // namespace mozilla
new file mode 100644
--- /dev/null
+++ b/dom/xbl/builtin/unix/jar.mn
@@ -0,0 +1,6 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+toolkit.jar:
+* content/global/platformHTMLBindings.xml   (platformHTMLBindings.xml)
--- a/dom/xbl/builtin/unix/moz.build
+++ b/dom/xbl/builtin/unix/moz.build
@@ -1,9 +1,7 @@
 # -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-SOURCES += ['ShortcutKeyDefinitions.cpp']
-
-FINAL_LIBRARY = 'xul'
+JAR_MANIFESTS += ['jar.mn']
\ No newline at end of file
new file mode 100644
--- /dev/null
+++ b/dom/xbl/builtin/unix/platformHTMLBindings.xml
@@ -0,0 +1,82 @@
+<?xml version="1.0"?>
+<!-- This Source Code Form is subject to the terms of the Mozilla Public
+   - License, v. 2.0. If a copy of the MPL was not distributed with this
+   - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
+
+
+<bindings id="htmlBindings"
+   xmlns="http://www.mozilla.org/xbl"
+   xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+ 
+  <binding id="inputFields" bindToUntrustedContent="true">
+    <handlers>
+#include ../input-fields-base.inc
+    <handler event="keypress" key="a" modifiers="alt"
+        command="cmd_selectAll"/>
+    <handler event="keypress" key="y" modifiers="accel"
+        command="cmd_redo"/>
+    <handler event="keypress" key="z" modifiers="accel,shift" command="cmd_redo"/>
+    <handler event="keypress" key="z" modifiers="accel" command="cmd_undo"/>
+    </handlers>
+  </binding>
+
+  <binding id="textAreas" bindToUntrustedContent="true">
+    <handlers>
+#include ../textareas-base.inc
+    <handler event="keypress" key="a" modifiers="alt"
+        command="cmd_selectAll"/>
+    <handler event="keypress" key="y" modifiers="accel"
+        command="cmd_redo"/>
+    <handler event="keypress" key="z" modifiers="accel" command="cmd_undo"/>
+    <handler event="keypress" key="z" modifiers="accel,shift" command="cmd_redo"/>
+    </handlers>
+  </binding>
+
+  <binding id="browser">
+    <handlers>
+#include ../browser-base.inc
+      <handler event="keypress" keycode="VK_PAGE_UP" command="cmd_movePageUp"/>
+      <handler event="keypress" keycode="VK_PAGE_DOWN" command="cmd_movePageDown"/>
+      <handler event="keypress" keycode="VK_PAGE_UP" modifiers="shift" command="cmd_selectPageUp"/>
+      <handler event="keypress" keycode="VK_PAGE_DOWN" modifiers="shift" command="cmd_selectPageDown"/>
+
+      <handler event="keypress" keycode="VK_DELETE" modifiers="shift" command="cmd_cut" /> 
+      <handler event="keypress" keycode="VK_DELETE" modifiers="control" command="cmd_copy" /> 
+      <handler event="keypress" keycode="VK_INSERT" modifiers="control" command="cmd_copy" /> 
+      <handler event="keypress" keycode="VK_HOME" command="cmd_beginLine"/>
+      <handler event="keypress" keycode="VK_END" command="cmd_endLine"/>
+      <handler event="keypress" keycode="VK_HOME" modifiers="shift" command="cmd_selectBeginLine" />
+      <handler event="keypress" keycode="VK_END" modifiers="shift" command="cmd_selectEndLine" />
+      <handler event="keypress" keycode="VK_HOME" modifiers="control" command="cmd_moveTop"/>
+      <handler event="keypress" keycode="VK_END" modifiers="control" command="cmd_moveBottom"/>
+      <handler event="keypress" keycode="VK_HOME" modifiers="shift,control" command="cmd_selectTop" /> 
+      <handler event="keypress" keycode="VK_END" modifiers="shift,control" command="cmd_selectBottom" /> 
+
+      <handler event="keypress" keycode="VK_LEFT" modifiers="shift" command="cmd_selectLeft" />
+      <handler event="keypress" keycode="VK_RIGHT" modifiers="shift" command="cmd_selectRight" />
+      <handler event="keypress" keycode="VK_LEFT" modifiers="control" command="cmd_moveLeft2" />
+      <handler event="keypress" keycode="VK_RIGHT" modifiers="control" command="cmd_moveRight2" />
+      <handler event="keypress" keycode="VK_LEFT" modifiers="control,shift" command="cmd_selectLeft2" />
+      <handler event="keypress" keycode="VK_RIGHT" modifiers="control,shift" command="cmd_selectRight2" />
+
+      <handler event="keypress" keycode="VK_UP" modifiers="shift" command="cmd_selectUp" />
+      <handler event="keypress" keycode="VK_DOWN" modifiers="shift" command="cmd_selectDown" />
+      <handler event="keypress" keycode="VK_UP" modifiers="control" command="cmd_moveUp2" />
+      <handler event="keypress" keycode="VK_DOWN" modifiers="control" command="cmd_moveDown2" />
+      <handler event="keypress" keycode="VK_UP" modifiers="control,shift" command="cmd_selectUp2" />
+      <handler event="keypress" keycode="VK_DOWN" modifiers="control,shift" command="cmd_selectDown2" />
+
+      <handler event="keypress" key="a" modifiers="alt" command="cmd_selectAll"/>
+    </handlers>
+  </binding>
+
+  <binding id="editor">
+    <handlers>
+#include ../editor-base.inc
+      <handler event="keypress" key="z" modifiers="accel" command="cmd_undo"/>
+      <handler event="keypress" key="z" modifiers="accel,shift" command="cmd_redo"/>
+      <handler event="keypress" key="y" modifiers="accel"   command="cmd_redo"/>
+      <handler event="keypress" key="a" modifiers="alt" command="cmd_selectAll"/>
+    </handlers>
+  </binding>
+</bindings>
deleted file mode 100644
--- a/dom/xbl/builtin/win/ShortcutKeyDefinitions.cpp
+++ /dev/null
@@ -1,152 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "../ShortcutKeys.h"
-
-namespace mozilla {
-
-ShortcutKeyData ShortcutKeys::sInputHandlers[] =
-{
-#include "../ShortcutKeyDefinitionsForInputCommon.h"
-
-    { u"keypress", u"VK_HOME",      nullptr, nullptr,            u"cmd_beginLine" },
-    { u"keypress", u"VK_END",       nullptr, nullptr,            u"cmd_endLine" },
-    { u"keypress", u"VK_HOME",      nullptr, u"shift",           u"cmd_selectBeginLine" },
-    { u"keypress", u"VK_END",       nullptr, u"shift",           u"cmd_selectEndLine" },
-    { u"keypress", u"VK_HOME",      nullptr, u"shift,control",   u"cmd_selectTop" },
-    { u"keypress", u"VK_END",       nullptr, u"shift,control",   u"cmd_selectBottom" },
-    { u"keypress", u"VK_HOME",      nullptr, u"control",         u"cmd_moveTop" },
-    { u"keypress", u"VK_END",       nullptr, u"control",         u"cmd_moveBottom" },
-    { u"keypress", u"VK_LEFT",      nullptr, u"control",         u"cmd_moveLeft2" },
-    { u"keypress", u"VK_RIGHT",     nullptr, u"control",         u"cmd_moveRight2" },
-    { u"keypress", u"VK_LEFT",      nullptr, u"shift,control",   u"cmd_selectLeft2" },
-    { u"keypress", u"VK_RIGHT",     nullptr, u"shift,control",   u"cmd_selectRight2" },
-    { u"keypress", u"VK_UP",        nullptr, u"control",         u"cmd_moveUp2" },
-    { u"keypress", u"VK_DOWN",      nullptr, u"control",         u"cmd_moveDown2" },
-    { u"keypress", u"VK_UP",        nullptr, u"shift,control",   u"cmd_selectUp2" },
-    { u"keypress", u"VK_DOWN",      nullptr, u"shift,control",   u"cmd_selectDown2" },
-    { u"keypress", u"VK_DELETE",    nullptr, u"shift",           u"cmd_cutOrDelete" },
-    { u"keypress", u"VK_DELETE",    nullptr, u"control",         u"cmd_deleteWordForward" },
-    { u"keypress", u"VK_INSERT",    nullptr, u"control",         u"cmd_copy" },
-    { u"keypress", u"VK_INSERT",    nullptr, u"shift",           u"cmd_paste" },
-    { u"keypress", u"VK_BACK",      nullptr, u"alt",             u"cmd_undo" },
-    { u"keypress", u"VK_BACK",      nullptr, u"alt,shift",       u"cmd_redo" },
-    { u"keypress", u"VK_BACK",      nullptr, u"control",         u"cmd_deleteWordBackward" },
-    { u"keypress", nullptr,         u"a",    u"accel",           u"cmd_selectAll" },
-    { u"keypress", nullptr,         u"y",    u"accel",           u"cmd_redo" },
-
-    { nullptr,     nullptr,         nullptr, nullptr,            nullptr }
-};
-
-ShortcutKeyData ShortcutKeys::sTextAreaHandlers[] =
-{
-#include "../ShortcutKeyDefinitionsForTextAreaCommon.h"
-
-    { u"keypress", u"VK_HOME",      nullptr, nullptr,            u"cmd_beginLine" },
-    { u"keypress", u"VK_END",       nullptr, nullptr,            u"cmd_endLine" },
-    { u"keypress", u"VK_HOME",      nullptr, u"shift",           u"cmd_selectBeginLine" },
-    { u"keypress", u"VK_END",       nullptr, u"shift",           u"cmd_selectEndLine" },
-    { u"keypress", u"VK_HOME",      nullptr, u"shift,control",   u"cmd_selectTop" },
-    { u"keypress", u"VK_END",       nullptr, u"shift,control",   u"cmd_selectBottom" },
-    { u"keypress", u"VK_HOME",      nullptr, u"control",         u"cmd_moveTop" },
-    { u"keypress", u"VK_END",       nullptr, u"control",         u"cmd_moveBottom" },
-    { u"keypress", u"VK_LEFT",      nullptr, u"control",         u"cmd_moveLeft2" },
-    { u"keypress", u"VK_RIGHT",     nullptr, u"control",         u"cmd_moveRight2" },
-    { u"keypress", u"VK_LEFT",      nullptr, u"shift,control",   u"cmd_selectLeft2" },
-    { u"keypress", u"VK_RIGHT",     nullptr, u"shift,control",   u"cmd_selectRight2" },
-    { u"keypress", u"VK_UP",        nullptr, u"control",         u"cmd_moveUp2" },
-    { u"keypress", u"VK_DOWN",      nullptr, u"control",         u"cmd_moveDown2" },
-    { u"keypress", u"VK_UP",        nullptr, u"shift,control",   u"cmd_selectUp2" },
-    { u"keypress", u"VK_DOWN",      nullptr, u"shift,control",   u"cmd_selectDown2" },
-    { u"keypress", u"VK_PAGE_UP",   nullptr, nullptr,            u"cmd_movePageUp" },
-    { u"keypress", u"VK_PAGE_DOWN", nullptr, nullptr,            u"cmd_movePageDown" },
-    { u"keypress", u"VK_PAGE_UP",   nullptr, u"shift",           u"cmd_selectPageUp" },
-    { u"keypress", u"VK_PAGE_DOWN", nullptr, u"shift",           u"cmd_selectPageDown" },
-    { u"keypress", u"VK_DELETE",    nullptr, u"shift",           u"cmd_cutOrDelete" },
-    { u"keypress", u"VK_DELETE",    nullptr, u"control",         u"cmd_deleteWordForward" },
-    { u"keypress", u"VK_INSERT",    nullptr, u"control",         u"cmd_copy" },
-    { u"keypress", u"VK_INSERT",    nullptr, u"shift",           u"cmd_paste" },
-    { u"keypress", u"VK_BACK",      nullptr, u"alt",             u"cmd_undo" },
-    { u"keypress", u"VK_BACK",      nullptr, u"alt,shift",       u"cmd_redo" },
-    { u"keypress", u"VK_BACK",      nullptr, u"control",         u"cmd_deleteWordBackward" },
-    { u"keypress", nullptr,         u"a",    u"accel",           u"cmd_selectAll" },
-    { u"keypress", nullptr,         u"y",    u"accel",           u"cmd_redo" },
-
-    { nullptr,     nullptr,         nullptr, nullptr,            nullptr }
-};
-
-ShortcutKeyData ShortcutKeys::sBrowserHandlers[] =
-{
-#include "../ShortcutKeyDefinitionsForBrowserCommon.h"
-
-    { u"keypress", u"VK_PAGE_UP",   nullptr, nullptr,            u"cmd_movePageUp" },
-    { u"keypress", u"VK_PAGE_DOWN", nullptr, nullptr,            u"cmd_movePageDown" },
-    { u"keypress", u"VK_PAGE_UP",   nullptr, u"shift",           u"cmd_selectPageUp" },
-    { u"keypress", u"VK_PAGE_DOWN", nullptr, u"shift",           u"cmd_selectPageDown" },
-    { u"keypress", u"VK_DELETE",    nullptr, u"shift",           u"cmd_cut" },
-    { u"keypress", u"VK_DELETE",    nullptr, u"control",         u"cmd_deleteWordForward" },
-    { u"keypress", u"VK_INSERT",    nullptr, u"control",         u"cmd_copy" },
-    { u"keypress", u"VK_HOME",      nullptr, nullptr,            u"cmd_beginLine" },
-    { u"keypress", u"VK_END",       nullptr, nullptr,            u"cmd_endLine" },
-    { u"keypress", u"VK_HOME",      nullptr, u"control",         u"cmd_moveTop" },
-    { u"keypress", u"VK_END",       nullptr, u"control",         u"cmd_moveBottom" },
-    { u"keypress", u"VK_HOME",      nullptr, u"shift,control",   u"cmd_selectTop" },
-    { u"keypress", u"VK_END",       nullptr, u"shift,control",   u"cmd_selectBottom" },
-    { u"keypress", u"VK_LEFT",      nullptr, u"control",         u"cmd_moveLeft2" },
-    { u"keypress", u"VK_RIGHT",     nullptr, u"control",         u"cmd_moveRight2" },
-    { u"keypress", u"VK_LEFT",      nullptr, u"control,shift",   u"cmd_selectLeft2" },
-    { u"keypress", u"VK_RIGHT",     nullptr, u"control,shift",   u"cmd_selectRight2" },
-    { u"keypress", u"VK_LEFT",      nullptr, u"shift",           u"cmd_selectLeft" },
-    { u"keypress", u"VK_RIGHT",     nullptr, u"shift",           u"cmd_selectRight" },
-    { u"keypress", u"VK_UP",        nullptr, u"control",         u"cmd_moveUp2" },
-    { u"keypress", u"VK_DOWN",      nullptr, u"control",         u"cmd_moveDown2" },
-    { u"keypress", u"VK_UP",        nullptr, u"control,shift",   u"cmd_selectUp2" },
-    { u"keypress", u"VK_DOWN",      nullptr, u"control,shift",   u"cmd_selectDown2" },
-    { u"keypress", u"VK_UP",        nullptr, u"shift",           u"cmd_selectUp" },
-    { u"keypress", u"VK_DOWN",      nullptr, u"shift",           u"cmd_selectDown" },
-    { u"keypress", u"VK_HOME",      nullptr, u"shift",           u"cmd_selectBeginLine" },
-    { u"keypress", u"VK_END",       nullptr, u"shift",           u"cmd_selectEndLine" },
-    { u"keypress", nullptr,         u"y",    u"accel",           u"cmd_redo" },
-
-    { nullptr,     nullptr,         nullptr, nullptr,            nullptr }
-};
-
-ShortcutKeyData ShortcutKeys::sEditorHandlers[] =
-{
-#include "../ShortcutKeyDefinitionsForEditorCommon.h"
-
-    { u"keypress", nullptr,         u"a",    u"accel",           u"cmd_selectAll" },
-    { u"keypress", u"VK_DELETE",    nullptr, u"shift",           u"cmd_cutOrDelete" },
-    { u"keypress", u"VK_DELETE",    nullptr, u"control",         u"cmd_deleteWordForward" },
-    { u"keypress", u"VK_INSERT",    nullptr, u"control",         u"cmd_copy" },
-    { u"keypress", u"VK_INSERT",    nullptr, u"shift",           u"cmd_paste" },
-    { u"keypress", u"VK_BACK",      nullptr, u"alt",             u"cmd_undo" },
-    { u"keypress", u"VK_BACK",      nullptr, u"alt,shift",       u"cmd_redo" },
-    { u"keypress", u"VK_LEFT",      nullptr, u"accel",           u"cmd_moveLeft2" },
-    { u"keypress", u"VK_RIGHT",     nullptr, u"accel",           u"cmd_moveRight2" },
-    { u"keypress", u"VK_LEFT",      nullptr, u"shift,accel",     u"cmd_selectLeft2" },
-    { u"keypress", u"VK_RIGHT",     nullptr, u"shift,accel",     u"cmd_selectRight2" },
-    { u"keypress", u"VK_UP",        nullptr, u"accel",           u"cmd_moveUp2" },
-    { u"keypress", u"VK_DOWN",      nullptr, u"accel",           u"cmd_moveDown2" },
-    { u"keypress", u"VK_UP",        nullptr, u"shift,accel",     u"cmd_selectUp2" },
-    { u"keypress", u"VK_DOWN",      nullptr, u"shift,accel",     u"cmd_selectDown2" },
-    { u"keypress", u"VK_HOME",      nullptr, u"shift,control",   u"cmd_selectTop" },
-    { u"keypress", u"VK_END",       nullptr, u"shift,control",   u"cmd_selectBottom" },
-    { u"keypress", u"VK_HOME",      nullptr, u"control",         u"cmd_moveTop" },
-    { u"keypress", u"VK_END",       nullptr, u"control",         u"cmd_moveBottom" },
-    { u"keypress", u"VK_BACK",      nullptr, u"control",         u"cmd_deleteWordBackward" },
-    { u"keypress", u"VK_HOME",      nullptr, nullptr,            u"cmd_beginLine" },
-    { u"keypress", u"VK_END",       nullptr, nullptr,            u"cmd_endLine" },
-    { u"keypress", u"VK_HOME",      nullptr, u"shift",           u"cmd_selectBeginLine" },
-    { u"keypress", u"VK_END",       nullptr, u"shift",           u"cmd_selectEndLine" },
-    { u"keypress", u"VK_PAGE_UP",   nullptr, nullptr,            u"cmd_movePageUp" },
-    { u"keypress", u"VK_PAGE_DOWN", nullptr, nullptr,            u"cmd_movePageDown" },
-    { u"keypress", u"VK_PAGE_UP",   nullptr, u"shift",           u"cmd_selectPageUp" },
-    { u"keypress", u"VK_PAGE_DOWN", nullptr, u"shift",           u"cmd_selectPageDown" },
-    { u"keypress", nullptr,         u"y",    u"accel",           u"cmd_redo" },
-
-    { nullptr,     nullptr,         nullptr, nullptr,            nullptr }
-};
-
-} // namespace mozilla
new file mode 100644
--- /dev/null
+++ b/dom/xbl/builtin/win/jar.mn
@@ -0,0 +1,6 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+toolkit.jar:
+* content/global/platformHTMLBindings.xml   (platformHTMLBindings.xml)
--- a/dom/xbl/builtin/win/moz.build
+++ b/dom/xbl/builtin/win/moz.build
@@ -1,9 +1,7 @@
 # -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-SOURCES += ['ShortcutKeyDefinitions.cpp']
-
-FINAL_LIBRARY = 'xul'
+JAR_MANIFESTS += ['jar.mn']
\ No newline at end of file
new file mode 100644
--- /dev/null
+++ b/dom/xbl/builtin/win/platformHTMLBindings.xml
@@ -0,0 +1,164 @@
+<?xml version="1.0"?>
+<!-- This Source Code Form is subject to the terms of the Mozilla Public
+   - License, v. 2.0. If a copy of the MPL was not distributed with this
+   - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
+
+
+<bindings id="htmlBindings"
+   xmlns="http://www.mozilla.org/xbl"
+   xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+ 
+  <binding id="inputFields" bindToUntrustedContent="true">
+    <handlers>
+#include ../input-fields-base.inc
+      <handler event="keypress" keycode="VK_HOME" command="cmd_beginLine"/>
+      <handler event="keypress" keycode="VK_END" command="cmd_endLine"/>
+      <handler event="keypress" keycode="VK_HOME" modifiers="shift" command="cmd_selectBeginLine"/>
+      <handler event="keypress" keycode="VK_END" modifiers="shift" command="cmd_selectEndLine"/>
+      <handler event="keypress" keycode="VK_HOME" modifiers="shift,control" command="cmd_selectTop"/>
+      <handler event="keypress" keycode="VK_END" modifiers="shift,control" command="cmd_selectBottom"/>
+      <handler event="keypress" keycode="VK_HOME" modifiers="control" command="cmd_moveTop"/>
+      <handler event="keypress" keycode="VK_END" modifiers="control" command="cmd_moveBottom"/>
+
+      <handler event="keypress" keycode="VK_LEFT" modifiers="control" command="cmd_moveLeft2"/>
+      <handler event="keypress" keycode="VK_RIGHT" modifiers="control" command="cmd_moveRight2"/>
+      <handler event="keypress" keycode="VK_LEFT" modifiers="shift,control" command="cmd_selectLeft2"/>
+      <handler event="keypress" keycode="VK_RIGHT" modifiers="shift,control" command="cmd_selectRight2"/>
+
+      <handler event="keypress" keycode="VK_UP" modifiers="control" command="cmd_moveUp2"/>
+      <handler event="keypress" keycode="VK_DOWN" modifiers="control" command="cmd_moveDown2"/>
+      <handler event="keypress" keycode="VK_UP" modifiers="shift,control" command="cmd_selectUp2"/>
+      <handler event="keypress" keycode="VK_DOWN" modifiers="shift,control" command="cmd_selectDown2"/>
+
+      <handler event="keypress" keycode="VK_DELETE" modifiers="shift" command="cmd_cutOrDelete"/>
+      <handler event="keypress" keycode="VK_DELETE" modifiers="control" command="cmd_deleteWordForward"/>
+      <handler event="keypress" keycode="VK_INSERT" modifiers="control" command="cmd_copy"/>
+      <handler event="keypress" keycode="VK_INSERT" modifiers="shift" command="cmd_paste"/>
+
+      <handler event="keypress" keycode="VK_BACK" modifiers="alt" command="cmd_undo"/>
+      <handler event="keypress" keycode="VK_BACK" modifiers="alt,shift" command="cmd_redo"/>
+      <handler event="keypress" keycode="VK_BACK" modifiers="control" command="cmd_deleteWordBackward"/>
+
+      <handler event="keypress" key="a" modifiers="accel" command="cmd_selectAll"/>
+      <handler event="keypress" key="y" modifiers="accel" command="cmd_redo"/>
+    </handlers>
+  </binding>
+
+  <binding id="textAreas" bindToUntrustedContent="true">
+    <handlers>
+#include ../textareas-base.inc
+      <handler event="keypress" keycode="VK_HOME" command="cmd_beginLine"/>
+      <handler event="keypress" keycode="VK_END" command="cmd_endLine"/>
+      <handler event="keypress" keycode="VK_HOME" modifiers="shift" command="cmd_selectBeginLine"/>
+      <handler event="keypress" keycode="VK_END" modifiers="shift" command="cmd_selectEndLine"/>
+      <handler event="keypress" keycode="VK_HOME" modifiers="shift,control" command="cmd_selectTop"/>
+      <handler event="keypress" keycode="VK_END" modifiers="shift,control" command="cmd_selectBottom"/>
+      <handler event="keypress" keycode="VK_HOME" modifiers="control" command="cmd_moveTop"/>
+      <handler event="keypress" keycode="VK_END" modifiers="control" command="cmd_moveBottom"/>
+
+      <handler event="keypress" keycode="VK_LEFT" modifiers="control" command="cmd_moveLeft2"/>
+      <handler event="keypress" keycode="VK_RIGHT" modifiers="control" command="cmd_moveRight2"/>
+      <handler event="keypress" keycode="VK_LEFT" modifiers="shift,control" command="cmd_selectLeft2"/>
+      <handler event="keypress" keycode="VK_RIGHT" modifiers="shift,control" command="cmd_selectRight2"/>
+
+      <handler event="keypress" keycode="VK_UP" modifiers="control" command="cmd_moveUp2"/>
+      <handler event="keypress" keycode="VK_DOWN" modifiers="control" command="cmd_moveDown2"/>
+      <handler event="keypress" keycode="VK_UP" modifiers="shift,control" command="cmd_selectUp2"/>
+      <handler event="keypress" keycode="VK_DOWN" modifiers="shift,control" command="cmd_selectDown2"/>
+
+      <handler event="keypress" keycode="VK_PAGE_UP" command="cmd_movePageUp"/>
+      <handler event="keypress" keycode="VK_PAGE_DOWN" command="cmd_movePageDown"/>
+      <handler event="keypress" keycode="VK_PAGE_UP" modifiers="shift" command="cmd_selectPageUp"/>
+      <handler event="keypress" keycode="VK_PAGE_DOWN" modifiers="shift" command="cmd_selectPageDown"/>
+
+      <handler event="keypress" keycode="VK_DELETE" modifiers="shift" command="cmd_cutOrDelete"/>
+      <handler event="keypress" keycode="VK_DELETE" modifiers="control" command="cmd_deleteWordForward"/>
+      <handler event="keypress" keycode="VK_INSERT" modifiers="control" command="cmd_copy"/>
+      <handler event="keypress" keycode="VK_INSERT" modifiers="shift" command="cmd_paste"/>
+
+      <handler event="keypress" keycode="VK_BACK" modifiers="alt" command="cmd_undo"/>
+      <handler event="keypress" keycode="VK_BACK" modifiers="alt,shift" command="cmd_redo"/>
+      <handler event="keypress" keycode="VK_BACK" modifiers="control" command="cmd_deleteWordBackward"/>
+
+      <handler event="keypress" key="a" modifiers="accel" command="cmd_selectAll"/>
+      <handler event="keypress" key="y" modifiers="accel" command="cmd_redo"/>
+     </handlers>
+  </binding>
+
+  <binding id="browser">
+    <handlers>
+#include ../browser-base.inc
+      <handler event="keypress" keycode="VK_PAGE_UP" command="cmd_movePageUp"/>
+      <handler event="keypress" keycode="VK_PAGE_DOWN" command="cmd_movePageDown"/>
+      <handler event="keypress" keycode="VK_PAGE_UP" modifiers="shift" command="cmd_selectPageUp"/>
+      <handler event="keypress" keycode="VK_PAGE_DOWN" modifiers="shift" command="cmd_selectPageDown"/>
+
+      <handler event="keypress" keycode="VK_DELETE" modifiers="shift" command="cmd_cut"/>
+      <handler event="keypress" keycode="VK_DELETE" modifiers="control" command="cmd_deleteWordForward"/>
+      <handler event="keypress" keycode="VK_INSERT" modifiers="control" command="cmd_copy"/>
+      <handler event="keypress" keycode="VK_HOME" command="cmd_beginLine"/>
+      <handler event="keypress" keycode="VK_END" command="cmd_endLine"/>
+      <handler event="keypress" keycode="VK_HOME" modifiers="control" command="cmd_moveTop"/>
+      <handler event="keypress" keycode="VK_END" modifiers="control" command="cmd_moveBottom"/>
+      <handler event="keypress" keycode="VK_HOME" modifiers="shift,control" command="cmd_selectTop" />
+      <handler event="keypress" keycode="VK_END" modifiers="shift,control" command="cmd_selectBottom" />
+
+      <handler event="keypress" keycode="VK_LEFT" modifiers="control" command="cmd_moveLeft2" />
+      <handler event="keypress" keycode="VK_RIGHT" modifiers="control" command="cmd_moveRight2" />
+      <handler event="keypress" keycode="VK_LEFT" modifiers="control,shift" command="cmd_selectLeft2" />
+      <handler event="keypress" keycode="VK_RIGHT" modifiers="control,shift" command="cmd_selectRight2" />
+      <handler event="keypress" keycode="VK_LEFT" modifiers="shift" command="cmd_selectLeft" />
+      <handler event="keypress" keycode="VK_RIGHT" modifiers="shift" command="cmd_selectRight" />
+
+      <handler event="keypress" keycode="VK_UP" modifiers="control" command="cmd_moveUp2" />
+      <handler event="keypress" keycode="VK_DOWN" modifiers="control" command="cmd_moveDown2" />
+      <handler event="keypress" keycode="VK_UP" modifiers="control,shift" command="cmd_selectUp2" />
+      <handler event="keypress" keycode="VK_DOWN" modifiers="control,shift" command="cmd_selectDown2" />
+      <handler event="keypress" keycode="VK_UP" modifiers="shift" command="cmd_selectUp" />
+      <handler event="keypress" keycode="VK_DOWN" modifiers="shift" command="cmd_selectDown" />
+
+      <handler event="keypress" keycode="VK_HOME" modifiers="shift" command="cmd_selectBeginLine" />
+      <handler event="keypress" keycode="VK_END" modifiers="shift" command="cmd_selectEndLine" />
+      <handler event="keypress" key="y" modifiers="accel" command="cmd_redo"/>
+    </handlers>
+  </binding>
+
+  <binding id="editor">
+    <handlers>
+#include ../editor-base.inc
+      <handler event="keypress" key="a" command="cmd_selectAll" modifiers="accel"/>
+      <handler event="keypress" keycode="VK_DELETE" modifiers="shift" command="cmd_cutOrDelete"/>
+      <handler event="keypress" keycode="VK_DELETE" modifiers="control" command="cmd_deleteWordForward"/>
+      <handler event="keypress" keycode="VK_INSERT" modifiers="control" command="cmd_copy"/>
+      <handler event="keypress" keycode="VK_INSERT" modifiers="shift" command="cmd_paste"/>
+      <handler event="keypress" keycode="VK_BACK" modifiers="alt" command="cmd_undo"/>
+      <handler event="keypress" keycode="VK_BACK" modifiers="alt,shift" command="cmd_redo"/>
+
+      <handler event="keypress" keycode="VK_LEFT" modifiers="accel" command="cmd_moveLeft2"/>
+      <handler event="keypress" keycode="VK_RIGHT" modifiers="accel" command="cmd_moveRight2"/>
+      <handler event="keypress" keycode="VK_LEFT" modifiers="shift,accel" command="cmd_selectLeft2"/>
+      <handler event="keypress" keycode="VK_RIGHT" modifiers="shift,accel" command="cmd_selectRight2"/>
+
+      <handler event="keypress" keycode="VK_UP" modifiers="accel" command="cmd_moveUp2"/>
+      <handler event="keypress" keycode="VK_DOWN" modifiers="accel" command="cmd_moveDown2"/>
+      <handler event="keypress" keycode="VK_UP" modifiers="shift,accel" command="cmd_selectUp2"/>
+      <handler event="keypress" keycode="VK_DOWN" modifiers="shift,accel" command="cmd_selectDown2"/>
+
+      <handler event="keypress" keycode="VK_HOME" modifiers="shift,control" command="cmd_selectTop"/>
+      <handler event="keypress" keycode="VK_END" modifiers="shift,control" command="cmd_selectBottom"/>
+      <handler event="keypress" keycode="VK_HOME" modifiers="control" command="cmd_moveTop"/>
+      <handler event="keypress" keycode="VK_END" modifiers="control" command="cmd_moveBottom"/>
+      <handler event="keypress" keycode="VK_BACK" modifiers="control" command="cmd_deleteWordBackward"/>
+
+      <handler event="keypress" keycode="VK_HOME" command="cmd_beginLine"/>
+      <handler event="keypress" keycode="VK_END" command="cmd_endLine"/>
+      <handler event="keypress" keycode="VK_HOME" command="cmd_selectBeginLine" modifiers="shift"/>
+      <handler event="keypress" keycode="VK_END" command="cmd_selectEndLine" modifiers="shift"/>
+      <handler event="keypress" keycode="VK_PAGE_UP" command="cmd_movePageUp"/>
+      <handler event="keypress" keycode="VK_PAGE_DOWN" command="cmd_movePageDown"/>
+      <handler event="keypress" keycode="VK_PAGE_UP" modifiers="shift" command="cmd_selectPageUp"/>
+      <handler event="keypress" keycode="VK_PAGE_DOWN" modifiers="shift" command="cmd_selectPageDown"/>
+      <handler event="keypress" key="y" modifiers="accel" command="cmd_redo"/>
+    </handlers>
+  </binding>
+</bindings>
--- a/dom/xbl/moz.build
+++ b/dom/xbl/moz.build
@@ -7,17 +7,16 @@
 with Files("**"):
     BUG_COMPONENT = ("Core", "XBL")
 
 DIRS += ['builtin']
 
 EXPORTS += [
     'nsBindingManager.h',
     'nsXBLBinding.h',
-    'nsXBLPrototypeHandler.h',
     'nsXBLService.h',
     'nsXBLWindowKeyHandler.h',
 ]
 
 EXPORTS.mozilla.dom += [
     'XBLChildrenElement.h',
 ]
 
--- a/dom/xbl/nsXBLPrototypeHandler.cpp
+++ b/dom/xbl/nsXBLPrototypeHandler.cpp
@@ -101,43 +101,28 @@ nsXBLPrototypeHandler::nsXBLPrototypeHan
   Init();
 
   ConstructPrototype(nullptr, aEvent, aPhase, aAction, aCommand, aKeyCode,
                      aCharCode, aModifiers, aButton, aClickCount,
                      aGroup, aPreventDefault, aAllowUntrusted);
 }
 
 nsXBLPrototypeHandler::nsXBLPrototypeHandler(Element* aHandlerElement, XBLReservedKey aReserved)
-  : mHandlerElement(nullptr)
-  , mLineNumber(0)
-  , mReserved(aReserved)
-  , mNextHandler(nullptr)
-  , mPrototypeBinding(nullptr)
+  : mHandlerElement(nullptr),
+    mLineNumber(0),
+    mReserved(aReserved),
+    mNextHandler(nullptr),
+    mPrototypeBinding(nullptr)
 {
   Init();
 
   // Make sure our prototype is initialized.
   ConstructPrototype(aHandlerElement);
 }
 
-nsXBLPrototypeHandler::nsXBLPrototypeHandler(ShortcutKeyData* aKeyData)
-  : mHandlerText(nullptr),
-    mLineNumber(0),
-    mReserved(XBLReservedKey_False),
-    mNextHandler(nullptr),
-    mPrototypeBinding(nullptr)
-{
-  Init();
-
-  ConstructPrototype(nullptr, aKeyData->event, nullptr, nullptr,
-                     aKeyData->command, aKeyData->keycode, aKeyData->key,
-                     aKeyData->modifiers, nullptr, nullptr, nullptr, nullptr,
-                     nullptr);
-}
-
 nsXBLPrototypeHandler::nsXBLPrototypeHandler(nsXBLPrototypeBinding* aBinding)
   : mHandlerText(nullptr),
     mLineNumber(0),
     mPhase(0),
     mType(0),
     mMisc(0),
     mReserved(XBLReservedKey_False),
     mKeyMask(0),
--- a/dom/xbl/nsXBLPrototypeHandler.h
+++ b/dom/xbl/nsXBLPrototypeHandler.h
@@ -13,17 +13,16 @@
 #include "nsString.h"
 #include "nsCOMPtr.h"
 #include "nsIController.h"
 #include "nsAutoPtr.h"
 #include "nsXBLEventHandler.h"
 #include "nsIWeakReference.h"
 #include "nsCycleCollectionParticipant.h"
 #include "js/TypeDecls.h"
-#include "mozilla/ShortcutKeys.h"
 
 class nsIContent;
 class nsIObjectInputStream;
 class nsIObjectOutputStream;
 class nsXBLPrototypeBinding;
 
 namespace mozilla {
 
@@ -89,20 +88,16 @@ public:
                         const char16_t* aPreventDefault,
                         const char16_t* aAllowUntrusted,
                         nsXBLPrototypeBinding* aBinding,
                         uint32_t aLineNumber);
 
   // This constructor is used only by XUL key handlers (e.g., <key>)
   explicit nsXBLPrototypeHandler(mozilla::dom::Element* aKeyElement, XBLReservedKey aReserved);
 
-  // This constructor is used for keyboard handlers for browser, editor, input
-  // and textarea elements.
-  explicit nsXBLPrototypeHandler(mozilla::ShortcutKeyData* aKeyData);
-
   // This constructor is used for handlers loaded from the cache
   explicit nsXBLPrototypeHandler(nsXBLPrototypeBinding* aBinding);
 
   ~nsXBLPrototypeHandler();
 
   /**
    * Try and convert this XBL handler into an APZ KeyboardShortcut for handling
    * key events on the compositor thread. This only works for XBL handlers that
--- a/dom/xbl/nsXBLWindowKeyHandler.cpp
+++ b/dom/xbl/nsXBLWindowKeyHandler.cpp
@@ -29,35 +29,141 @@
 #include "mozilla/Preferences.h"
 #include "mozilla/StaticPtr.h"
 #include "mozilla/TextEvents.h"
 #include "mozilla/dom/Element.h"
 #include "mozilla/dom/Event.h"
 #include "mozilla/dom/EventBinding.h"
 #include "mozilla/dom/KeyboardEvent.h"
 #include "mozilla/layers/KeyboardMap.h"
-#include "mozilla/ShortcutKeys.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 using namespace mozilla::layers;
 
+class nsXBLSpecialDocInfo : public nsIObserver
+{
+public:
+  RefPtr<nsXBLDocumentInfo> mHTMLBindings;
+
+  static const char sHTMLBindingStr[];
+  static const char sUserHTMLBindingStr[];
+
+  bool mInitialized;
+
+public:
+  NS_DECL_ISUPPORTS
+  NS_DECL_NSIOBSERVER
+
+  void LoadDocInfo();
+  void GetHandlers(const nsACString& aRef,
+                   nsXBLPrototypeHandler** handler);
+
+  nsXBLSpecialDocInfo() : mInitialized(false) {}
+
+protected:
+  virtual ~nsXBLSpecialDocInfo() {}
+
+};
+
+const char nsXBLSpecialDocInfo::sHTMLBindingStr[] =
+  "chrome://global/content/platformHTMLBindings.xml";
+
+NS_IMPL_ISUPPORTS(nsXBLSpecialDocInfo, nsIObserver)
+
+NS_IMETHODIMP
+nsXBLSpecialDocInfo::Observe(nsISupports* aSubject,
+                             const char* aTopic,
+                             const char16_t* aData)
+{
+  MOZ_ASSERT(!strcmp(aTopic, "xpcom-shutdown"), "wrong topic");
+
+  // On shutdown, clear our fields to avoid an extra cycle collection.
+  mHTMLBindings = nullptr;
+  mInitialized = false;
+  nsContentUtils::UnregisterShutdownObserver(this);
+
+  return NS_OK;
+}
+
+void nsXBLSpecialDocInfo::LoadDocInfo()
+{
+  if (mInitialized)
+    return;
+  mInitialized = true;
+  nsContentUtils::RegisterShutdownObserver(this);
+
+  nsXBLService* xblService = nsXBLService::GetInstance();
+  if (!xblService)
+    return;
+
+  // Obtain the platform doc info
+  nsCOMPtr<nsIURI> bindingURI;
+  NS_NewURI(getter_AddRefs(bindingURI), sHTMLBindingStr);
+  if (!bindingURI) {
+    return;
+  }
+  xblService->LoadBindingDocumentInfo(nullptr, nullptr,
+                                      bindingURI,
+                                      nullptr,
+                                      true,
+                                      getter_AddRefs(mHTMLBindings));
+}
+
+//
+// GetHandlers
+//
+//
+void
+nsXBLSpecialDocInfo::GetHandlers(const nsACString& aRef,
+                                 nsXBLPrototypeHandler** aHandler)
+{
+  if (mHTMLBindings) {
+    nsXBLPrototypeBinding* binding = mHTMLBindings->GetPrototypeBinding(aRef);
+
+    NS_ASSERTION(binding, "No binding found for the XBL window key handler.");
+    if (!binding)
+      return;
+
+    *aHandler = binding->GetPrototypeHandlers();
+  }
+}
+
+// Init statics
+static StaticRefPtr<nsXBLSpecialDocInfo> sXBLSpecialDocInfo;
+uint32_t nsXBLWindowKeyHandler::sRefCnt = 0;
+
+/* static */ void
+nsXBLWindowKeyHandler::EnsureSpecialDocInfo()
+{
+  if (!sXBLSpecialDocInfo) {
+    sXBLSpecialDocInfo = new nsXBLSpecialDocInfo();
+  }
+  sXBLSpecialDocInfo->LoadDocInfo();
+}
+
 nsXBLWindowKeyHandler::nsXBLWindowKeyHandler(Element* aElement,
                                              EventTarget* aTarget)
   : mTarget(aTarget),
     mHandler(nullptr)
 {
   mWeakPtrForElement = do_GetWeakReference(aElement);
+  ++sRefCnt;
 }
 
 nsXBLWindowKeyHandler::~nsXBLWindowKeyHandler()
 {
   // If mWeakPtrForElement is non-null, we created a prototype handler.
   if (mWeakPtrForElement)
     delete mHandler;
+
+  --sRefCnt;
+  if (!sRefCnt) {
+    sXBLSpecialDocInfo = nullptr;
+  }
 }
 
 NS_IMPL_ISUPPORTS(nsXBLWindowKeyHandler,
                   nsIDOMEventListener)
 
 static void
 BuildHandlerChain(nsIContent* aContent, nsXBLPrototypeHandler** aResult)
 {
@@ -119,30 +225,32 @@ nsXBLWindowKeyHandler::EnsureHandlers()
   NS_ENSURE_STATE(!mWeakPtrForElement || el);
   if (el) {
     // We are actually a XUL <keyset>.
     if (mHandler)
       return NS_OK;
 
     BuildHandlerChain(el, &mHandler);
   } else { // We are an XBL file of handlers.
+    EnsureSpecialDocInfo();
+
     // Now determine which handlers we should be using.
     if (IsHTMLEditableFieldFocused()) {
-      mHandler = ShortcutKeys::GetHandlers(HandlerType::eEditor);
+      sXBLSpecialDocInfo->GetHandlers(NS_LITERAL_CSTRING("editor"), &mHandler);
     }
     else {
-      mHandler = ShortcutKeys::GetHandlers(HandlerType::eBrowser);
+      sXBLSpecialDocInfo->GetHandlers(NS_LITERAL_CSTRING("browser"), &mHandler);
     }
   }
 
   return NS_OK;
 }
 
 nsresult
-nsXBLWindowKeyHandler::WalkHandlers(KeyboardEvent* aKeyEvent)
+nsXBLWindowKeyHandler::WalkHandlers(KeyboardEvent* aKeyEvent, nsAtom* aEventType)
 {
   if (aKeyEvent->DefaultPrevented()) {
     return NS_OK;
   }
 
   // Don't process the event if it was not dispatched from a trusted source
   if (!aKeyEvent->IsTrusted()) {
     return NS_OK;
@@ -154,17 +262,17 @@ nsXBLWindowKeyHandler::WalkHandlers(Keyb
   bool isDisabled;
   nsCOMPtr<Element> el = GetElement(&isDisabled);
 
   // skip keysets that are disabled
   if (el && isDisabled) {
     return NS_OK;
   }
 
-  WalkHandlersInternal(aKeyEvent, true);
+  WalkHandlersInternal(aKeyEvent, aEventType, true);
 
   return NS_OK;
 }
 
 void
 nsXBLWindowKeyHandler::InstallKeyboardEventListenersTo(
                          EventListenerManager* aEventListenerManager)
 {
@@ -283,17 +391,21 @@ nsXBLWindowKeyHandler::RemoveKeyboardEve
   aEventListenerManager->RemoveEventListenerByType(
                            this, NS_LITERAL_STRING("mozkeyuponplugin"),
                            TrustedEventsAtSystemGroupBubble());
 }
 
 /* static */ KeyboardMap
 nsXBLWindowKeyHandler::CollectKeyboardShortcuts()
 {
-  nsXBLPrototypeHandler* handlers = ShortcutKeys::GetHandlers(HandlerType::eBrowser);
+  // Load the XBL handlers
+  EnsureSpecialDocInfo();
+
+  nsXBLPrototypeHandler* handlers = nullptr;
+  sXBLSpecialDocInfo->GetHandlers(NS_LITERAL_CSTRING("browser"), &handlers);
 
   // Convert the handlers into keyboard shortcuts, using an AutoTArray with
   // the maximum amount of shortcuts used on any platform to minimize allocations
   AutoTArray<KeyboardShortcut, 48> shortcuts;
 
   // Append keyboard shortcuts for hardcoded actions like tab
   KeyboardShortcut::AppendHardcodedShortcuts(shortcuts);
 
@@ -304,16 +416,40 @@ nsXBLWindowKeyHandler::CollectKeyboardSh
     if (handler->TryConvertToKeyboardShortcut(&shortcut)) {
       shortcuts.AppendElement(shortcut);
     }
   }
 
   return KeyboardMap(std::move(shortcuts));
 }
 
+nsAtom*
+nsXBLWindowKeyHandler::ConvertEventToDOMEventType(
+                         const WidgetKeyboardEvent& aWidgetKeyboardEvent) const
+{
+  if (aWidgetKeyboardEvent.IsKeyDownOrKeyDownOnPlugin()) {
+    return nsGkAtoms::keydown;
+  }
+  if (aWidgetKeyboardEvent.IsKeyUpOrKeyUpOnPlugin()) {
+    return nsGkAtoms::keyup;
+  }
+  // eAccessKeyNotFound event is always created from eKeyPress event and
+  // the original eKeyPress event has stopped its propagation before dispatched
+  // into the DOM tree in this process and not matched with remote content's
+  // access keys.  So, we should treat it as an eKeyPress event and execute
+  // a command if it's registered as a shortcut key.
+  if (aWidgetKeyboardEvent.mMessage == eKeyPress ||
+      aWidgetKeyboardEvent.mMessage == eAccessKeyNotFound) {
+    return nsGkAtoms::keypress;
+  }
+  MOZ_ASSERT_UNREACHABLE(
+    "All event messages which this instance listens to should be handled");
+  return nullptr;
+}
+
 NS_IMETHODIMP
 nsXBLWindowKeyHandler::HandleEvent(Event* aEvent)
 {
   RefPtr<KeyboardEvent> keyEvent = aEvent->AsKeyboardEvent();
   NS_ENSURE_TRUE(keyEvent, NS_ERROR_INVALID_ARG);
 
   if (aEvent->EventPhase() == Event_Binding::CAPTURING_PHASE) {
     if (aEvent->WidgetEventPtr()->mFlags.mInSystemGroup) {
@@ -351,17 +487,19 @@ nsXBLWindowKeyHandler::HandleEvent(Event
 
   // If this event was handled by APZ then don't do the default action, and
   // preventDefault to prevent any other listeners from handling the event.
   if (widgetKeyboardEvent->mFlags.mHandledByAPZ) {
     aEvent->PreventDefault();
     return NS_OK;
   }
 
-  return WalkHandlers(keyEvent);
+  RefPtr<nsAtom> eventTypeAtom =
+    ConvertEventToDOMEventType(*widgetKeyboardEvent);
+  return WalkHandlers(keyEvent, eventTypeAtom);
 }
 
 void
 nsXBLWindowKeyHandler::HandleEventOnCaptureInDefaultEventGroup(
                          KeyboardEvent* aEvent)
 {
   WidgetKeyboardEvent* widgetKeyboardEvent =
     aEvent->WidgetEventPtr()->AsKeyboardEvent();
@@ -459,63 +597,65 @@ nsXBLWindowKeyHandler::IsHTMLEditableFie
 //
 // Given a particular DOM event and a pointer to the first handler in the list,
 // scan through the list to find something to handle the event. If aExecute = true,
 // the handler will be executed; otherwise just return an answer telling if a handler
 // for that event was found.
 //
 bool
 nsXBLWindowKeyHandler::WalkHandlersInternal(KeyboardEvent* aKeyEvent,
+                                            nsAtom* aEventType,
                                             bool aExecute,
                                             bool* aOutReservedForChrome)
 {
   WidgetKeyboardEvent* nativeKeyboardEvent =
     aKeyEvent->WidgetEventPtr()->AsKeyboardEvent();
   MOZ_ASSERT(nativeKeyboardEvent);
 
   AutoShortcutKeyCandidateArray shortcutKeys;
   nativeKeyboardEvent->GetShortcutKeyCandidates(shortcutKeys);
 
   if (shortcutKeys.IsEmpty()) {
-    return WalkHandlersAndExecute(aKeyEvent, 0, IgnoreModifierState(),
+    return WalkHandlersAndExecute(aKeyEvent, aEventType,
+                                  0, IgnoreModifierState(),
                                   aExecute, aOutReservedForChrome);
   }
 
   for (uint32_t i = 0; i < shortcutKeys.Length(); ++i) {
     ShortcutKeyCandidate& key = shortcutKeys[i];
     IgnoreModifierState ignoreModifierState;
     ignoreModifierState.mShift = key.mIgnoreShift;
-    if (WalkHandlersAndExecute(aKeyEvent, key.mCharCode, ignoreModifierState,
+    if (WalkHandlersAndExecute(aKeyEvent, aEventType,
+                               key.mCharCode, ignoreModifierState,
                                aExecute, aOutReservedForChrome)) {
       return true;
     }
   }
   return false;
 }
 
 bool
 nsXBLWindowKeyHandler::WalkHandlersAndExecute(
                          KeyboardEvent* aKeyEvent,
+                         nsAtom* aEventType,
                          uint32_t aCharCode,
                          const IgnoreModifierState& aIgnoreModifierState,
                          bool aExecute,
                          bool* aOutReservedForChrome)
 {
   if (aOutReservedForChrome) {
     *aOutReservedForChrome = false;
   }
 
   WidgetKeyboardEvent* widgetKeyboardEvent =
     aKeyEvent->WidgetEventPtr()->AsKeyboardEvent();
   if (NS_WARN_IF(!widgetKeyboardEvent)) {
     return false;
   }
 
-  nsAtom* eventType = ShortcutKeys::ConvertEventToDOMEventType(widgetKeyboardEvent);
-
   // Try all of the handlers until we find one that matches the event.
   for (nsXBLPrototypeHandler* handler = mHandler;
        handler;
        handler = handler->GetNextHandler()) {
     bool stopped = aKeyEvent->IsDispatchStopped();
     if (stopped) {
       // The event is finished, don't execute any more handlers
       return false;
@@ -527,33 +667,33 @@ nsXBLWindowKeyHandler::WalkHandlersAndEx
       // never followed by keypress events.
       if (widgetKeyboardEvent->mMessage == eKeyDownOnPlugin) {
         if (!handler->EventTypeEquals(nsGkAtoms::keydown) &&
             !handler->EventTypeEquals(nsGkAtoms::keypress)) {
           continue;
         }
       // The other event types should exactly be matched with the handler's
       // event type.
-      } else if (!handler->EventTypeEquals(eventType)) {
+      } else if (!handler->EventTypeEquals(aEventType)) {
         continue;
       }
     } else {
       if (handler->EventTypeEquals(nsGkAtoms::keypress)) {
         // If the handler is a keypress event handler, we also need to check
         // if coming keydown event is a preceding event of reserved key
         // combination because if default action of a keydown event is
         // prevented, following keypress event won't be fired.  However, if
         // following keypress event is reserved, we shouldn't allow web
         // contents to prevent the default of the preceding keydown event.
-        if (eventType != nsGkAtoms::keydown &&
-            eventType != nsGkAtoms::keypress) {
+        if (aEventType != nsGkAtoms::keydown &&
+            aEventType != nsGkAtoms::keypress) {
           continue;
         }
-      } else if (!handler->EventTypeEquals(eventType)) {
-        // Otherwise, eventType should exactly be matched.
+      } else if (!handler->EventTypeEquals(aEventType)) {
+        // Otherwise, aEventType should exactly be matched.
         continue;
       }
     }
 
     // Check if the keyboard event *may* execute the handler.
     if (!handler->KeyEventMatched(aKeyEvent, aCharCode, aIgnoreModifierState)) {
       continue;  // try the next one
     }
@@ -568,28 +708,28 @@ nsXBLWindowKeyHandler::WalkHandlersAndEx
 
     if (commandElement) {
       if (aExecute && !IsExecutableElement(commandElement)) {
         continue;
       }
     }
 
     if (!aExecute) {
-      if (handler->EventTypeEquals(eventType)) {
+      if (handler->EventTypeEquals(aEventType)) {
         if (aOutReservedForChrome) {
           *aOutReservedForChrome = IsReservedKey(widgetKeyboardEvent, handler);
         }
 
         return true;
       }
 
       // If the command is reserved and the event is keydown, check also if
       // the handler is for keypress because if following keypress event is
       // reserved, we shouldn't dispatch the event into web contents.
-      if (eventType == nsGkAtoms::keydown &&
+      if (aEventType == nsGkAtoms::keydown &&
           handler->EventTypeEquals(nsGkAtoms::keypress)) {
         if (IsReservedKey(widgetKeyboardEvent, handler)) {
           if (aOutReservedForChrome) {
             *aOutReservedForChrome = true;
           }
 
           return true;
         }
@@ -628,18 +768,18 @@ nsXBLWindowKeyHandler::WalkHandlersAndEx
 #ifdef XP_WIN
   // Windows native applications ignore Windows-Logo key state when checking
   // shortcut keys even if the key is pressed.  Therefore, if there is no
   // shortcut key which exactly matches current modifier state, we should
   // retry to look for a shortcut key without the Windows-Logo key press.
   if (!aIgnoreModifierState.mOS && widgetKeyboardEvent->IsOS()) {
     IgnoreModifierState ignoreModifierState(aIgnoreModifierState);
     ignoreModifierState.mOS = true;
-    return WalkHandlersAndExecute(aKeyEvent, aCharCode, ignoreModifierState,
-                                  aExecute);
+    return WalkHandlersAndExecute(aKeyEvent, aEventType,
+                                  aCharCode, ignoreModifierState, aExecute);
   }
 #endif
 
   return false;
 }
 
 bool
 nsXBLWindowKeyHandler::IsReservedKey(WidgetKeyboardEvent* aKeyEvent,
@@ -674,17 +814,20 @@ nsXBLWindowKeyHandler::HasHandlerForEven
   NS_ENSURE_SUCCESS(rv, false);
 
   bool isDisabled;
   nsCOMPtr<Element> el = GetElement(&isDisabled);
   if (el && isDisabled) {
     return false;
   }
 
-  return WalkHandlersInternal(aEvent, false, aOutReservedForChrome);
+  RefPtr<nsAtom> eventTypeAtom =
+    ConvertEventToDOMEventType(*widgetKeyboardEvent);
+  return WalkHandlersInternal(aEvent, eventTypeAtom, false,
+                              aOutReservedForChrome);
 }
 
 already_AddRefed<Element>
 nsXBLWindowKeyHandler::GetElement(bool* aIsDisabled)
 {
   nsCOMPtr<Element> element = do_QueryReferent(mWeakPtrForElement);
   if (element && aIsDisabled) {
     *aIsDisabled = element->AttrValueIs(kNameSpaceID_None, nsGkAtoms::disabled,
--- a/dom/xbl/nsXBLWindowKeyHandler.h
+++ b/dom/xbl/nsXBLWindowKeyHandler.h
@@ -45,26 +45,27 @@ public:
   static KeyboardMap CollectKeyboardShortcuts();
 
   NS_DECL_ISUPPORTS
   NS_DECL_NSIDOMEVENTLISTENER
 
 protected:
   virtual ~nsXBLWindowKeyHandler();
 
-  nsresult WalkHandlers(KeyboardEvent* aKeyEvent);
+  nsresult WalkHandlers(KeyboardEvent* aKeyEvent, nsAtom* aEventType);
 
   // walk the handlers, looking for one to handle the event
   bool WalkHandlersInternal(KeyboardEvent* aKeyEvent,
+                            nsAtom* aEventType,
                             bool aExecute,
                             bool* aOutReservedForChrome = nullptr);
 
   // walk the handlers for aEvent, aCharCode and aIgnoreModifierState. Execute
   // it if aExecute = true.
-  bool WalkHandlersAndExecute(KeyboardEvent* aKeyEvent,
+  bool WalkHandlersAndExecute(KeyboardEvent* aKeyEvent, nsAtom* aEventType,
                               uint32_t aCharCode,
                               const IgnoreModifierState& aIgnoreModifierState,
                               bool aExecute,
                               bool* aOutReservedForChrome = nullptr);
 
   // HandleEvent function for the capturing phase in the default event group.
   void HandleEventOnCaptureInDefaultEventGroup(KeyboardEvent* aEvent);
   // HandleEvent function for the capturing phase in the system event group.
@@ -76,16 +77,25 @@ protected:
   bool HasHandlerForEvent(KeyboardEvent* aEvent,
                           bool* aOutReservedForChrome = nullptr);
 
   // Returns true if the key would be reserved for the given handler. A reserved
   // key is not sent to a content process or single-process equivalent.
   bool IsReservedKey(mozilla::WidgetKeyboardEvent* aKeyEvent,
                      nsXBLPrototypeHandler* aHandler);
 
+  // Returns event type for matching between aWidgetKeyboardEvent and
+  // shortcut key handlers.  This is used for calling WalkHandlers(),
+  // WalkHandlersInternal() and WalkHandlersAndExecute().
+  nsAtom* ConvertEventToDOMEventType(
+             const mozilla::WidgetKeyboardEvent& aWidgetKeyboardEvent) const;
+
+  // lazily load the special doc info for loading handlers
+  static void EnsureSpecialDocInfo();
+
   // lazily load the handlers. Overridden to handle being attached
   // to a particular element rather than the document
   nsresult EnsureHandlers();
 
   // Is an HTML editable element focused
   bool IsHTMLEditableFieldFocused();
 
   // Returns the element which was passed as a parameter to the constructor,
@@ -111,16 +121,21 @@ protected:
    * Otherwise, false. aElement should be a command element or a key element.
    */
   bool IsExecutableElement(mozilla::dom::Element* aElement) const;
 
   // Using weak pointer to the DOM Element.
   nsWeakPtr              mWeakPtrForElement;
   mozilla::dom::EventTarget* mTarget; // weak ref
 
+  // these are not owning references; the prototype handlers are owned
+  // by the prototype bindings which are owned by the docinfo.
   nsXBLPrototypeHandler* mHandler;     // platform bindings
+
+  // holds reference count to document info about bindings
+  static uint32_t sRefCnt;
 };
 
 already_AddRefed<nsXBLWindowKeyHandler>
 NS_NewXBLWindowKeyHandler(mozilla::dom::Element* aElement,
                           mozilla::dom::EventTarget* aTarget);
 
 #endif
--- a/layout/style/res/forms.css
+++ b/layout/style/res/forms.css
@@ -97,16 +97,17 @@ input {
   font: -moz-field;
   text-rendering: optimizeLegibility;
   line-height: normal;
   text-align: start;
   text-transform: none;
   word-spacing: normal;
   letter-spacing: normal;
   cursor: text;
+  -moz-binding: url("chrome://global/content/platformHTMLBindings.xml#inputFields");
   text-indent: 0;
   -moz-user-select: text;
   text-shadow: none;
   overflow-clip-box: padding-box content-box;
 }
 
 input > .anonymous-div,
 input::placeholder {
@@ -128,16 +129,17 @@ textarea {
   text-rendering: optimizeLegibility;
   text-align: start;
   text-transform: none;
   word-spacing: normal;
   letter-spacing: normal;
   vertical-align: text-bottom;
   cursor: text;
   resize: both;
+  -moz-binding: url("chrome://global/content/platformHTMLBindings.xml#textAreas");
   -moz-appearance: textfield-multiline;
   text-indent: 0;
   -moz-user-select: text;
   text-shadow: none;
   white-space: pre-wrap;
   word-wrap: break-word;
   overflow-clip-box: content-box;
 }
@@ -441,27 +443,29 @@ optgroup:disabled {
 /* hidden inputs */
 input[type="hidden"] {
   -moz-appearance: none;
   display: none !important;
   padding: unset;
   border: 0;
   cursor: auto;
   -moz-user-focus: ignore;
+  -moz-binding: none;
 }
 
 /* image buttons */
 input[type="image"] {
   -moz-appearance: none;
   padding: unset;
   border: none;
   background-color: transparent;
   font-family: sans-serif;
   font-size: small;
   cursor: pointer;
+  -moz-binding: none;
 }
 
 input[type="image"]:disabled {
   cursor: unset;
 }
 
 input[type="image"]:-moz-focusring {
   /* Don't specify the outline-color, we should always use initial value. */
@@ -473,16 +477,17 @@ input[type="file"] {
   display: inline-block;
   white-space: nowrap !important;
   overflow: hidden;
   overflow-clip-box: padding-box;
   color: unset;
 
   /* Revert rules which apply on all inputs. */
   -moz-appearance: none;
+  -moz-binding: none;
   cursor: default;
 
   border: none;
   background-color: transparent;
   padding: unset;
 }
 
 input[type="file"] > label {
@@ -542,16 +547,17 @@ input[type="checkbox"] {
 /* common features of radio buttons and check boxes */
 
 input[type="radio"],
 input[type="checkbox"] {
   box-sizing: border-box;
   cursor: default;
   /* unset some values from the general 'input' rule above: */
   padding: unset;
+  -moz-binding: unset;
   border: unset;
   background-color: unset;
   color: unset;
 }
 
 input[type="radio"]:disabled,
 input[type="radio"]:disabled:active,
 input[type="radio"]:disabled:hover,
@@ -597,16 +603,17 @@ input[type="submit"] {
   padding-inline-end: 8px;
   padding-block-end: 0px;
   padding-inline-start: 8px;
   border: 2px outset ThreeDLightShadow;
   background-color: ButtonFace;
   cursor: default;
   box-sizing: border-box;
   -moz-user-select: none;
+  -moz-binding: none;
 }
 
 /* Text-related properties for buttons: these ones are not shared with
    input[type="color"] */
 button,
 input[type="reset"],
 input[type="button"],
 input[type="submit"] {
@@ -881,16 +888,17 @@ input[type=range] {
   margin-inline-start: 0.7em;
   margin-inline-end: 0.7em;
   margin-block-start: 0;
   margin-block-end: 0;
   /* Override some rules that apply on all input types: */
   cursor: default;
   background: none;
   border: none;
+  -moz-binding: none; /* we don't want any of platformHTMLBindings.xml#inputFields */
   /* Prevent nsFrame::HandlePress setting mouse capture to this element. */
   -moz-user-select: none ! important;
 }
 
 input[type=range][orient=block] {
   inline-size: 1.3em;
   block-size: 12em;
   margin-inline-start: 0;
@@ -1002,16 +1010,17 @@ input[type=range]::-moz-range-thumb {
   background-color: #F0F0F0;
   /* Prevent nsFrame::HandlePress setting mouse capture to this element. */
   -moz-user-select: none ! important;
 }
 
 input[type="number"] {
   -moz-appearance: number-input;
   /* Has to revert some properties applied by the generic input rule. */
+  -moz-binding: none;
   inline-size: 20ch; /* It'd be nice if this matched the default inline-size
                         of <input type=text>, but that's not easy to achieve
                         due to platform differences. */
 }
 
 input[type=number]::-moz-number-wrapper {
   /* Prevent styling that would change the type of frame we construct. */
   display: flex;