Bug 1305528 - Remove ignoreEvent from API events for which it is inappropriate. r?bsilverberg draft
authorTushar Saini (:shatur) <tushar.saini1285@gmail.com>
Thu, 02 Mar 2017 02:01:44 +0530
changeset 491141 d35202c495400ba8369d78f0d53fddddea21dd82
parent 490032 106a96755d3bcebe64bbbc3b521d65d262ba9c02
child 547473 fb8ff3b83aed041c537b9940b7329f3c22122052
push id47331
push userbmo:tushar.saini1285@gmail.com
push dateWed, 01 Mar 2017 20:40:26 +0000
reviewersbsilverberg
bugs1305528
milestone54.0a1
Bug 1305528 - Remove ignoreEvent from API events for which it is inappropriate. r?bsilverberg MozReview-Commit-ID: Cado1fxLYxr
browser/components/extensions/ext-tabs.js
mobile/android/components/extensions/ext-tabs.js
toolkit/components/extensions/ext-webNavigation.js
--- a/browser/components/extensions/ext-tabs.js
+++ b/browser/components/extensions/ext-tabs.js
@@ -14,17 +14,16 @@ XPCOMUtils.defineLazyModuleGetter(this, 
                                   "resource://gre/modules/PromiseUtils.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "Services",
                                   "resource://gre/modules/Services.jsm");
 
 Cu.import("resource://gre/modules/ExtensionUtils.jsm");
 
 var {
   SingletonEventManager,
-  ignoreEvent,
 } = ExtensionUtils;
 
 // This function is pretty tightly tied to Extension.jsm.
 // Its job is to fill in the |tab| property of the sender.
 function getSender(extension, target, sender) {
   let tabId;
   if ("tabId" in sender) {
     // The message came from a privileged extension page running in a tab. In
@@ -209,17 +208,19 @@ extensions.registerSchemaAPI("tabs", "ad
         };
 
         tabTracker.on("tab-removed", listener);
         return () => {
           tabTracker.off("tab-removed", listener);
         };
       }).api(),
 
-      onReplaced: ignoreEvent(context, "tabs.onReplaced"),
+      onReplaced: new SingletonEventManager(context, "tabs.onReplaced", fire => {
+        return () => {};
+      }).api(),
 
       onMoved: new SingletonEventManager(context, "tabs.onMoved", fire => {
         // There are certain circumstances where we need to ignore a move event.
         //
         // Namely, the first time the tab is moved after it's created, we need
         // to report the final position as the initial position in the tab's
         // onAttached or onCreated event. This is because most tabs are inserted
         // in a temporary location and then moved after the TabOpen event fires,
--- a/mobile/android/components/extensions/ext-tabs.js
+++ b/mobile/android/components/extensions/ext-tabs.js
@@ -14,17 +14,16 @@ XPCOMUtils.defineLazyModuleGetter(this, 
                                   "resource://gre/modules/PromiseUtils.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "Services",
                                   "resource://gre/modules/Services.jsm");
 
 Cu.import("resource://gre/modules/ExtensionUtils.jsm");
 
 var {
   SingletonEventManager,
-  ignoreEvent,
 } = ExtensionUtils;
 
 // This function is pretty tightly tied to Extension.jsm.
 // Its job is to fill in the |tab| property of the sender.
 function getSender(extension, target, sender) {
   let tabId;
   if ("tabId" in sender) {
     // The message came from a privileged extension page running in a tab. In
@@ -199,17 +198,19 @@ extensions.registerSchemaAPI("tabs", "ad
         };
 
         tabTracker.on("tab-removed", listener);
         return () => {
           tabTracker.off("tab-removed", listener);
         };
       }).api(),
 
-      onReplaced: ignoreEvent(context, "tabs.onReplaced"),
+      onReplaced: new SingletonEventManager(context, "tabs.onReplaced", fire => {
+        return () => {};
+      }).api(),
 
       onMoved: new SingletonEventManager(context, "tabs.onMoved", fire => {
         return () => {};
       }).api(),
 
       onUpdated: new SingletonEventManager(context, "tabs.onUpdated", fire => {
         const restricted = ["url", "favIconUrl", "title"];
 
--- a/toolkit/components/extensions/ext-webNavigation.js
+++ b/toolkit/components/extensions/ext-webNavigation.js
@@ -153,17 +153,19 @@ function convertGetFrameResult(tabId, da
   };
 }
 
 extensions.registerSchemaAPI("webNavigation", "addon_parent", context => {
   let {tabManager} = context.extension;
 
   return {
     webNavigation: {
-      onTabReplaced: ignoreEvent(context, "webNavigation.onTabReplaced"),
+      onTabReplaced: new SingletonEventManager(context, "webNavigation.onTabReplaced", fire => {
+        return () => {};
+      }).api(),
       onBeforeNavigate: new WebNavigationEventManager(context, "onBeforeNavigate").api(),
       onCommitted: new WebNavigationEventManager(context, "onCommitted").api(),
       onDOMContentLoaded: new WebNavigationEventManager(context, "onDOMContentLoaded").api(),
       onCompleted: new WebNavigationEventManager(context, "onCompleted").api(),
       onErrorOccurred: new WebNavigationEventManager(context, "onErrorOccurred").api(),
       onReferenceFragmentUpdated: new WebNavigationEventManager(context, "onReferenceFragmentUpdated").api(),
       onHistoryStateUpdated: new WebNavigationEventManager(context, "onHistoryStateUpdated").api(),
       onCreatedNavigationTarget: ignoreEvent(context, "webNavigation.onCreatedNavigationTarget"),