Bug 1592687 - Expose ftp protocol enabled/disabled via browserSettings, r=mixedpuppy
authorAndrea Marchesini <amarchesini@mozilla.com>
Wed, 30 Oct 2019 19:29:19 +0000
changeset 499950 c4f8fe60e4d1093a706756dc537adcd7996af9bd
parent 499949 577ec3e72df23f1f7918d8e748c67106bb6ce745
child 499951 ec461bb743879113bbacf991e27719725c5837bf
push id36750
push usercsabou@mozilla.com
push dateThu, 31 Oct 2019 16:25:50 +0000
treeherdermozilla-central@9a2e7d38cb07 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmixedpuppy
bugs1592687
milestone72.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1592687 - Expose ftp protocol enabled/disabled via browserSettings, r=mixedpuppy Differential Revision: https://phabricator.services.mozilla.com/D51146
toolkit/components/extensions/parent/ext-browserSettings.js
toolkit/components/extensions/schemas/browser_settings.json
toolkit/components/extensions/test/xpcshell/test_ext_browserSettings.js
--- a/toolkit/components/extensions/parent/ext-browserSettings.js
+++ b/toolkit/components/extensions/parent/ext-browserSettings.js
@@ -73,16 +73,24 @@ ExtensionPreferencesManager.addSetting("
 ExtensionPreferencesManager.addSetting("contextMenuShowEvent", {
   prefNames: ["ui.context_menus.after_mouseup"],
 
   setCallback(value) {
     return { [this.prefNames[0]]: value === "mouseup" };
   },
 });
 
+ExtensionPreferencesManager.addSetting("ftpProtocolEnabled", {
+  prefNames: ["network.ftp.enabled"],
+
+  setCallback(value) {
+    return { [this.prefNames[0]]: value };
+  },
+});
+
 ExtensionPreferencesManager.addSetting("imageAnimationBehavior", {
   prefNames: ["image.animation_mode"],
 
   setCallback(value) {
     return { [this.prefNames[0]]: value };
   },
 });
 
@@ -214,16 +222,23 @@ this.browserSettings = class extends Ext
               return ExtensionPreferencesManager.setSetting(
                 extension.id,
                 "contextMenuShowEvent",
                 details.value
               );
             },
           }
         ),
+        ftpProtocolEnabled: getSettingsAPI(
+          extension.id,
+          "ftpProtocolEnabled",
+          () => {
+            return Services.prefs.getBoolPref("network.ftp.enabled");
+          }
+        ),
         homepageOverride: getSettingsAPI(
           extension.id,
           HOMEPAGE_OVERRIDE_SETTING,
           () => {
             return Services.prefs.getStringPref(HOMEPAGE_URL_PREF);
           },
           undefined,
           true
--- a/toolkit/components/extensions/schemas/browser_settings.json
+++ b/toolkit/components/extensions/schemas/browser_settings.json
@@ -49,16 +49,20 @@
       "closeTabsByDoubleClick": {
         "$ref": "types.Setting",
         "description": "This boolean setting controls whether the selected tab can be closed with a double click."
       },
       "contextMenuShowEvent": {
         "$ref": "types.Setting",
         "description": "Controls after which mouse event context menus popup. This setting's value is of type ContextMenuMouseEvent, which has possible values of <code>mouseup</code> and <code>mousedown</code>."
       },
+      "ftpProtocolEnabled": {
+        "$ref": "types.Setting",
+        "description": "This boolean setting controls whether the FTP protocol is enabled."
+      },
       "homepageOverride": {
         "$ref": "types.Setting",
         "description": "Returns the value of the overridden home page. Read-only."
       },
       "imageAnimationBehavior": {
         "$ref": "types.Setting",
         "description": "Controls the behaviour of image animation in the browser. This setting's value is of type ImageAnimationBehavior, defaulting to <code>normal</code>."
       },
--- a/toolkit/components/extensions/test/xpcshell/test_ext_browserSettings.js
+++ b/toolkit/components/extensions/test/xpcshell/test_ext_browserSettings.js
@@ -169,16 +169,23 @@ add_task(async function test_browser_set
     await testSetting("closeTabsByDoubleClick", true, {
       "browser.tabs.closeTabByDblclick": true,
     });
     await testSetting("closeTabsByDoubleClick", false, {
       "browser.tabs.closeTabByDblclick": false,
     });
   }
 
+  await testSetting("ftpProtocolEnabled", true, {
+    "network.ftp.enabled": true,
+  });
+  await testSetting("ftpProtocolEnabled", false, {
+    "network.ftp.enabled": false,
+  });
+
   await testSetting("newTabPosition", "afterCurrent", {
     "browser.tabs.insertRelatedAfterCurrent": false,
     "browser.tabs.insertAfterCurrent": true,
   });
   await testSetting("newTabPosition", "atEnd", {
     "browser.tabs.insertRelatedAfterCurrent": false,
     "browser.tabs.insertAfterCurrent": false,
   });