Bug 1474934 - Add support for POST search to WebExtensions r=mixedpuppy
authorMichael Kaply <mozilla@kaply.com>
Fri, 28 Sep 2018 22:03:04 +0000
changeset 487170 f70b8597ad1ddcc19625dd0754e37ce9c31e539a
parent 487169 410ea4b30b37d3e67f7419bdb0e887fdbd2eb97d
child 487171 2bb54a57856e9eb57aafd38d399ba9391f57dad9
push id246
push userfmarier@mozilla.com
push dateSat, 13 Oct 2018 00:15:40 +0000
reviewersmixedpuppy
bugs1474934
milestone64.0a1
Bug 1474934 - Add support for POST search to WebExtensions r=mixedpuppy Differential Revision: https://phabricator.services.mozilla.com/D4004
browser/components/extensions/parent/ext-chrome-settings-overrides.js
browser/components/extensions/schemas/chrome_settings_overrides.json
--- a/browser/components/extensions/parent/ext-chrome-settings-overrides.js
+++ b/browser/components/extensions/parent/ext-chrome-settings-overrides.js
@@ -282,16 +282,20 @@ this.chrome_settings_overrides = class e
       let params = {
         template: searchProvider.search_url,
         iconURL: searchProvider.favicon_url,
         alias: searchProvider.keyword,
         extensionID: extension.id,
         suggestURL: searchProvider.suggest_url,
         queryCharset: "UTF-8",
       };
+      if (searchProvider.search_url_post_params) {
+        params.method = "POST";
+        params.postData = searchProvider.search_url_post_params;
+      }
       Services.search.addEngineWithDetails(searchProvider.name.trim(), params);
       await ExtensionSettingsStore.addSetting(
         extension.id, DEFAULT_SEARCH_STORE_TYPE, ENGINE_ADDED_SETTING_NAME,
         searchProvider.name.trim());
       if (extension.startupReason === "ADDON_UPGRADE") {
         let engine = Services.search.getEngineByName(searchProvider.name.trim());
         if (isCurrent) {
           Services.search.currentEngine = engine;
--- a/browser/components/extensions/schemas/chrome_settings_overrides.json
+++ b/browser/components/extensions/schemas/chrome_settings_overrides.json
@@ -61,17 +61,17 @@
                     "format": "url",
                     "preprocess": "localize",
                     "deprecated": "Unsupported on Firefox at this time."
                   },
                   "search_url_post_params": {
                     "type": "string",
                     "optional": true,
                     "preprocess": "localize",
-                    "deprecated": "Unsupported on Firefox at this time."
+                    "description": "POST parameters to the search_url as a query string."
                   },
                   "instant_url_post_params": {
                     "type": "string",
                     "optional": true,
                     "preprocess": "localize",
                     "deprecated": "Unsupported on Firefox at this time."
                   },
                   "image_url_post_params": {