Backed out changeset 05c206c4311b (bug 1305217)
authorSebastian Hengst <archaeopteryx@coole-files.de>
Sat, 12 Nov 2016 13:43:26 +0100
changeset 352377 6cbde9c5e058999ba95319391b59a7d67649ca53
parent 352376 9381a00d19f81c21114f9d24cafee791fa0d9dbe
child 352378 217ae1d5285328611de99e2e48042b19751dbb54
push id6795
push userjlund@mozilla.com
push dateMon, 23 Jan 2017 14:19:46 +0000
treeherdermozilla-esr52@76101b503191 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1305217
milestone52.0a1
backs out05c206c4311bc4d6e727f89243aea2b5139fca61
Backed out changeset 05c206c4311b (bug 1305217)
toolkit/components/extensions/ExtensionChild.jsm
toolkit/components/extensions/ext-webNavigation.js
toolkit/components/extensions/test/mochitest/test_ext_webnavigation_filters.html
--- a/toolkit/components/extensions/ExtensionChild.jsm
+++ b/toolkit/components/extensions/ExtensionChild.jsm
@@ -756,19 +756,20 @@ class PseudoChildAPIManager extends Chil
 
     this.parentContext = ParentAPIManager.proxyContexts.get(this.id);
 
     // Synchronously unload the ProxyContext because we synchronously create it.
     this.context.callOnClose(this.parentContext);
   }
 
   getFallbackImplementation(namespace, name) {
+    // This is gross and should be removed ASAP.
     let useDirectParentAPI = (
       // Incompatible APIs are listed here.
-      false
+      namespace == "webNavigation" // ChildAPIManager is oblivious to filters.
     );
 
     if (useDirectParentAPI) {
       let apiObj = findPathInObject(this.parentContext.apiObj, namespace, false);
 
       if (apiObj && name in apiObj) {
         return new LocalAPIImplementation(apiObj, name, this.context);
       }
--- a/toolkit/components/extensions/ext-webNavigation.js
+++ b/toolkit/components/extensions/ext-webNavigation.js
@@ -10,16 +10,17 @@ XPCOMUtils.defineLazyModuleGetter(this, 
                                   "resource://gre/modules/MatchPattern.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "WebNavigation",
                                   "resource://gre/modules/WebNavigation.jsm");
 
 Cu.import("resource://gre/modules/ExtensionUtils.jsm");
 var {
   SingletonEventManager,
   ignoreEvent,
+  runSafe,
 } = ExtensionUtils;
 
 const defaultTransitionTypes = {
   topFrame: "link",
   subFrame: "auto_subframe",
 };
 
 const frameTransitions = {
@@ -122,17 +123,17 @@ function WebNavigationEventManager(conte
       // Fills in tabId typically.
       extensions.emit("fill-browser-data", data.browser, data2);
       if (data2.tabId < 0) {
         return;
       }
 
       fillTransitionProperties(eventName, data, data2);
 
-      context.runSafe(callback, data2);
+      runSafe(context, callback, data2);
     };
 
     WebNavigation[eventName].addListener(listener, filters);
     return () => {
       WebNavigation[eventName].removeListener(listener);
     };
   };
 
--- a/toolkit/components/extensions/test/mochitest/test_ext_webnavigation_filters.html
+++ b/toolkit/components/extensions/test/mochitest/test_ext_webnavigation_filters.html
@@ -183,26 +183,23 @@ add_task(function* test_webnav_unresolve
         },
       ],
     },
   ];
 
   function* runTestScenario(event, {url, filters}) {
     for (let testFilters of filters) {
       let {okFilter, failFilter} = testFilters;
-
       info(`Prepare the new test scenario: ${event} ${url} ${JSON.stringify(testFilters)}`);
       win.location = "about:blank";
-
       extension.sendMessage("test-filter", event, {url: okFilter}, {url: failFilter});
       yield extension.awaitMessage("test-filter-ready");
 
       info(`Loading the test url: ${url}`);
       win.location = url;
-
       yield extension.awaitMessage("test-filter-next");
 
       info("Test scenario completed. Moving to the next test scenario.");
     }
   }
 
   const BASE_WEBNAV_EVENTS = [
     "onBeforeNavigate",
@@ -225,24 +222,22 @@ add_task(function* test_webnav_unresolve
   let url = BASE + "/file_WebNavigation_page3.html";
 
   let okFilter = [{urlContains: "_page3.html"}];
   let failFilter = [{ports: [444]}];
   let event = "onCompleted";
 
   info(`Loading the initial test url: ${url}`);
   extension.sendMessage("test-filter", event, {url: okFilter}, {url: failFilter});
-
   yield extension.awaitMessage("test-filter-ready");
   win.location = url;
   yield extension.awaitMessage("test-filter-next");
 
   event = "onReferenceFragmentUpdated";
   extension.sendMessage("test-filter", event, {url: okFilter}, {url: failFilter});
-
   yield extension.awaitMessage("test-filter-ready");
   win.location = url + "#ref1";
   yield extension.awaitMessage("test-filter-next");
 
   info("WebNavigation event filters test onHistoryStateUpdated scenario starting...");
 
   event = "onHistoryStateUpdated";
   extension.sendMessage("test-filter", event, {url: okFilter}, {url: failFilter});