Bug 1381032 Ignore keypress events in about:addons when focus is in an embedded options browser draft
authorAndrew Swan <aswan@mozilla.com>
Mon, 24 Jul 2017 15:09:13 -0700
changeset 614733 bf94294cf277a772857a8c49d44ff8bfb067abd7
parent 614544 462d7561089c98e33382384896434861ad7bc491
child 638938 617ea2e173e779b6aba53a50b1c6b06dc0f5c582
push id70095
push useraswan@mozilla.com
push dateMon, 24 Jul 2017 22:09:42 +0000
bugs1381032
milestone56.0a1
Bug 1381032 Ignore keypress events in about:addons when focus is in an embedded options browser MozReview-Commit-ID: D3KqkYfXbri
toolkit/mozapps/extensions/content/extensions.js
--- a/toolkit/mozapps/extensions/content/extensions.js
+++ b/toolkit/mozapps/extensions/content/extensions.js
@@ -158,16 +158,23 @@ function initialize(event) {
   });
   addonPage.addEventListener("dragover", function(event) {
     gDragDrop.onDragOver(event);
   });
   addonPage.addEventListener("drop", function(event) {
     gDragDrop.onDrop(event);
   });
   addonPage.addEventListener("keypress", function(event) {
+    // If there is an embedded preferences <browser> running in a remote
+    // process, we will see the event here first before it gets a chance
+    // to bubble up through the embedded page.  To avoid stealing focus,
+    // we just ignore events when focus is in an options browser.
+    if (event.target.classList.contains("inline-options-browser")) {
+      return;
+    }
     gHeader.onKeyPress(event);
   });
 
   if (!isDiscoverEnabled()) {
     gViewDefault = "addons://list/extension";
   }
 
   gViewController.initialize();