Bug 1287007 - Enable proxying of most APIs. draft
authorRob Wu <rob@robwu.nl>
Mon, 12 Sep 2016 21:19:53 -0700
changeset 428444 a86fd1c2502d51b36d7e9d8b6c4e788002d205d7
parent 428443 126af076764d9fc8a24210d54af12adc47426811
child 428445 99e88e15e92d273d05b411b92efd51fe7d7eb9bb
push id33305
push userbmo:rob@robwu.nl
push dateSun, 23 Oct 2016 20:56:25 +0000
bugs1287007
milestone52.0a1
Bug 1287007 - Enable proxying of most APIs. MozReview-Commit-ID: KrI42XrsVVG
toolkit/components/extensions/ExtensionChild.jsm
--- a/toolkit/components/extensions/ExtensionChild.jsm
+++ b/toolkit/components/extensions/ExtensionChild.jsm
@@ -107,21 +107,24 @@ class WannabeChildAPIManager extends Chi
     proxyContext.setContentWindow(this.context.contentWindow);
 
     // Synchronously unload the ProxyContext because we synchronously create it.
     this.context.callOnClose({close: proxyContext.unload.bind(proxyContext)});
   }
 
   getFallbackImplementation(namespace, name) {
     // This is gross and should be removed ASAP.
-    let shouldSynchronouslyUseParentAPI = true;
-    // The test API is known to be fully compatible with webext-oop,
-    // except for events due to bugzil.la/1300234
-    if (namespace == "test" && name != "onMessage") {
-      shouldSynchronouslyUseParentAPI = false;
+    let shouldSynchronouslyUseParentAPI = false;
+    // Incompatible APIs are listed here.
+    if (namespace == "runtime" && name == "connectNative" || // Returns a custom Port.
+        namespace == "runtime" && name == "sendNativeMessage" || // Fix together with connectNative.
+        namespace == "tabs" && name == "onRemoved" || // bugzil.la/1300234
+        namespace == "webNavigation" || // ChildAPIManager is oblivious to filters.
+        namespace == "webRequest") { // Incompatible by design (synchronous).
+      shouldSynchronouslyUseParentAPI = true;
     }
     if (shouldSynchronouslyUseParentAPI) {
       let proxyContext = ParentAPIManager.proxyContexts.get(this.id);
       let apiObj = findPathInObject(proxyContext.apiObj, namespace, false);
       if (apiObj && name in apiObj) {
         return new LocalAPIImplementation(apiObj, name, this.context);
       }
       // If we got here, then it means that the JSON schema claimed that the API