Bug 1264383 - makeFilteringListener breaks eventremoval with shims. r=mconley
authorGabor Krizsanits <gkrizsanits@mozilla.com>
Mon, 18 Apr 2016 10:40:26 +0200
changeset 331447 2e1fb077ecdbf1dc01333e4de6768ffbe23a003a
parent 331446 17deb7d01e4e368e9fc06935925eb50d892ebbb6
child 331448 765b22823c12f34161aa3c3def3ece3fc003409a
push id6048
push userkmoir@mozilla.com
push dateMon, 06 Jun 2016 19:02:08 +0000
treeherdermozilla-beta@46d72a56c57d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmconley
bugs1264383
milestone48.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1264383 - makeFilteringListener breaks eventremoval with shims. r=mconley
toolkit/components/addoncompat/RemoteAddonsParent.jsm
--- a/toolkit/components/addoncompat/RemoteAddonsParent.jsm
+++ b/toolkit/components/addoncompat/RemoteAddonsParent.jsm
@@ -582,27 +582,27 @@ EventTargetParent.init();
 
 // This function returns a listener that will not fire on events where
 // the target is a remote xul:browser element itself. We'd rather let
 // the child process handle the event and pass it up via
 // EventTargetParent.
 var filteringListeners = new WeakMap();
 function makeFilteringListener(eventType, listener)
 {
-  if (filteringListeners.has(listener)) {
-    return filteringListeners.get(listener);
-  }
-
   // Some events are actually targeted at the <browser> element
   // itself, so we only handle the ones where know that won't happen.
   let eventTypes = ["mousedown", "mouseup", "click"];
   if (eventTypes.indexOf(eventType) == -1) {
     return listener;
   }
 
+  if (filteringListeners.has(listener)) {
+    return filteringListeners.get(listener);
+  }
+
   function filter(event) {
     let target = event.originalTarget;
     if (target instanceof Ci.nsIDOMXULElement &&
         target.localName == "browser" &&
         target.isRemoteBrowser) {
       return;
     }