Bug 1375002: Get rid of the omnibox_internal namespace. r=me a=jcristau
authorKris Maglione <maglione.k@gmail.com>
Tue, 04 Jul 2017 15:17:45 -0700
changeset 414192 0ad29e7311f85835a2329bacf0eecbd1ce193ccc
parent 414191 58d13a8d70b46b95179861406bcd50106ac38730
child 414193 d231d2ff17b13723fe84c358f11ec4b3fbb9cd07
push id1490
push usermtabara@mozilla.com
push dateMon, 31 Jul 2017 14:08:16 +0000
treeherdermozilla-release@70e32e6bf15e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersme, jcristau
bugs1375002
milestone55.0
Bug 1375002: Get rid of the omnibox_internal namespace. r=me a=jcristau This namespace has schema definitions which spuriously expose it to extension callers, and does not support lazy loading correctly, which breaks certain usage patterns. MozReview-Commit-ID: JODZ9NmGKlI
browser/components/extensions/ext-c-omnibox.js
browser/components/extensions/ext-omnibox.js
browser/components/extensions/schemas/omnibox.json
--- a/browser/components/extensions/ext-c-omnibox.js
+++ b/browser/components/extensions/ext-c-omnibox.js
@@ -7,23 +7,23 @@
 
 this.omnibox = class extends ExtensionAPI {
   getAPI(context) {
     return {
       omnibox: {
         onInputChanged: new SingletonEventManager(context, "omnibox.onInputChanged", fire => {
           let listener = (text, id) => {
             fire.asyncWithoutClone(text, suggestions => {
-              context.childManager.callParentFunctionNoReturn("omnibox_internal.addSuggestions", [
+              context.childManager.callParentFunctionNoReturn("omnibox.addSuggestions", [
                 id,
                 suggestions,
               ]);
             });
           };
-          context.childManager.getParentEvent("omnibox_internal.onInputChanged").addListener(listener);
+          context.childManager.getParentEvent("omnibox.onInputChanged").addListener(listener);
           return () => {
-            context.childManager.getParentEvent("omnibox_internal.onInputChanged").removeListener(listener);
+            context.childManager.getParentEvent("omnibox.onInputChanged").removeListener(listener);
           };
         }).api(),
       },
     };
   }
 };
--- a/browser/components/extensions/ext-omnibox.js
+++ b/browser/components/extensions/ext-omnibox.js
@@ -64,29 +64,28 @@ this.omnibox = class extends ExtensionAP
           let listener = (eventName, text, disposition) => {
             fire.sync(text, disposition);
           };
           extension.on(ExtensionSearchHandler.MSG_INPUT_ENTERED, listener);
           return () => {
             extension.off(ExtensionSearchHandler.MSG_INPUT_ENTERED, listener);
           };
         }).api(),
-      },
 
-      omnibox_internal: {
+        // Internal APIs.
         addSuggestions: (id, suggestions) => {
           try {
             ExtensionSearchHandler.addSuggestions(this.keyword, id, suggestions);
           } catch (e) {
             // Silently fail because the extension developer can not know for sure if the user
             // has already invalidated the callback when asynchronously providing suggestions.
           }
         },
 
-        onInputChanged: new SingletonEventManager(context, "omnibox_internal.onInputChanged", fire => {
+        onInputChanged: new SingletonEventManager(context, "omnibox.onInputChanged", fire => {
           let listener = (eventName, text, id) => {
             fire.sync(text, id);
           };
           extension.on(ExtensionSearchHandler.MSG_INPUT_CHANGED, listener);
           return () => {
             extension.off(ExtensionSearchHandler.MSG_INPUT_CHANGED, listener);
           };
         }).api(),
--- a/browser/components/extensions/schemas/omnibox.json
+++ b/browser/components/extensions/schemas/omnibox.json
@@ -192,57 +192,10 @@
       },
       {
         "name": "onInputCancelled",
         "type": "function",
         "description": "User has ended the keyword input session without accepting the input.",
         "parameters": []
       }
     ]
-  },
-  {
-    "namespace": "omnibox_internal",
-    "description": "The internal namespace used by the omnibox API.",
-    "defaultContexts": ["addon_parent_only"],
-    "functions": [
-      {
-        "name": "addSuggestions",
-        "type": "function",
-        "async": "callback",
-        "description": "Internal function used by omnibox.onInputChanged for adding search suggestions",
-        "parameters": [
-          {
-            "name": "id",
-            "type": "integer",
-            "description": "The ID of the callback received by onInputChangedInternal"
-          },
-          {
-            "name": "suggestResults",
-            "type": "array",
-            "description": "Array of suggest results",
-            "items": {
-              "$ref": "omnibox.SuggestResult"
-            }
-          },
-          {
-            "type": "function",
-            "name": "callback",
-            "optional": true,
-            "parameters": []
-          }
-        ]
-      }
-    ],
-    "events": [
-      {
-        "name": "onInputChanged",
-        "type": "function",
-        "description": "Identical to omnibox.onInputChanged except no 'suggest' callback is provided.",
-        "parameters": [
-          {
-            "type": "string",
-            "name": "text"
-          }
-        ]
-      }
-    ]
   }
-]
\ No newline at end of file
+]