[X2Go-Commits] [pale-moon] 254/294: Issue #991 Part 4: Network and URILoader

git-admin at x2go.org git-admin at x2go.org
Sat Apr 27 08:58:25 CEST 2019


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch upstream/28.5.0
in repository pale-moon.

commit c7796280a9b5600fb15a4c170ca3d3f4d4d9e535
Author: Ascrod <32915892+Ascrod at users.noreply.github.com>
Date:   Mon Apr 8 20:36:18 2019 -0400

    Issue #991 Part 4: Network and URILoader
---
 netwerk/test/unit/test_bug650995.js      | 14 ++------------
 netwerk/test/unit/test_idn_blacklist.js  |  7 +------
 netwerk/test/unit/test_idn_urls.js       |  7 +------
 uriloader/exthandler/nsHandlerService.js | 16 +++++-----------
 4 files changed, 9 insertions(+), 35 deletions(-)

diff --git a/netwerk/test/unit/test_bug650995.js b/netwerk/test/unit/test_bug650995.js
index 3c1ea8d..bf2e9fa 100644
--- a/netwerk/test/unit/test_bug650995.js
+++ b/netwerk/test/unit/test_bug650995.js
@@ -78,24 +78,14 @@ function InitializeCacheDevices(memDevice, diskDevice) {
     this.start = function() {
         prefService.setBoolPref("browser.cache.memory.enable", memDevice);
         if (memDevice) {
-            try {
-                cap = prefService.getIntPref("browser.cache.memory.capacity");
-            }
-            catch(ex) {
-                cap = 0;
-            }
+            cap = prefService.getIntPref("browser.cache.memory.capacity", 0);
             if (cap == 0) {
                 prefService.setIntPref("browser.cache.memory.capacity", 1024);
             }
         }
         prefService.setBoolPref("browser.cache.disk.enable", diskDevice);
         if (diskDevice) {
-            try {
-                cap = prefService.getIntPref("browser.cache.disk.capacity");
-            }
-            catch(ex) {
-                cap = 0;
-            }
+            cap = prefService.getIntPref("browser.cache.disk.capacity", 0);
             if (cap == 0) {
                 prefService.setIntPref("browser.cache.disk.capacity", 1024);
             }
diff --git a/netwerk/test/unit/test_idn_blacklist.js b/netwerk/test/unit/test_idn_blacklist.js
index 5ca0173..aea45d7 100644
--- a/netwerk/test/unit/test_idn_blacklist.js
+++ b/netwerk/test/unit/test_idn_blacklist.js
@@ -121,12 +121,7 @@ const testcases = [
 function run_test() {
     var pbi = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch);
     var oldProfile = pbi.getCharPref("network.IDN.restriction_profile", "moderate");
-    var oldWhiteListCom;
-    try {
-        oldWhitelistCom = pbi.getBoolPref("network.IDN.whitelist.com");
-    } catch(e) {
-        oldWhitelistCom = false;
-    }
+    var oldWhitelistCom = pbi.getBoolPref("network.IDN.whitelist.com", false);
     var idnService = Cc["@mozilla.org/network/idn-service;1"].getService(Ci.nsIIDNService);
 
     pbi.setCharPref("network.IDN.restriction_profile", "moderate");
diff --git a/netwerk/test/unit/test_idn_urls.js b/netwerk/test/unit/test_idn_urls.js
index 06a5303..3588540 100644
--- a/netwerk/test/unit/test_idn_urls.js
+++ b/netwerk/test/unit/test_idn_urls.js
@@ -295,12 +295,7 @@ const profiles = ["ASCII", "high", "moderate"];
 function run_test() {
     var pbi = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch);
     var oldProfile = pbi.getCharPref("network.IDN.restriction_profile", "moderate");
-    var oldWhiteListCom;
-    try {
-        oldWhitelistCom = pbi.getBoolPref("network.IDN.whitelist.com");
-    } catch(e) {
-        oldWhitelistCom = false;
-    }
+    var oldWhitelistCom = pbi.getBoolPref("network.IDN.whitelist.com", false);
     var idnService = Cc["@mozilla.org/network/idn-service;1"].getService(Ci.nsIIDNService);
 
     for (var i = 0; i < profiles.length; ++i) {
diff --git a/uriloader/exthandler/nsHandlerService.js b/uriloader/exthandler/nsHandlerService.js
index c932f9f..5e6356a 100644
--- a/uriloader/exthandler/nsHandlerService.js
+++ b/uriloader/exthandler/nsHandlerService.js
@@ -352,17 +352,11 @@ HandlerService.prototype = {
       var prefSvc = Cc["@mozilla.org/preferences-service;1"].
                     getService(Ci.nsIPrefService);
       var prefBranch = prefSvc.getBranch("network.protocol-handler.");
-      try {
-        alwaysAsk = prefBranch.getBoolPref("warn-external." + type);
-      } catch (e) {
-        // will throw if pref didn't exist.
-        try {
-          alwaysAsk = prefBranch.getBoolPref("warn-external-default");
-        } catch (e) {
-          // Nothing to tell us what to do, so be paranoid and prompt.
-          alwaysAsk = true;
-        }
-      }
+      // If neither of the prefs exists, be paranoid and prompt.
+      alwaysAsk =
+        prefBranch.getBoolPref("warn-external." + type,
+                               prefBranch.getBoolPref("warn-external-default",
+                                                      true));
     }
     aHandlerInfo.alwaysAskBeforeHandling = alwaysAsk;
 

--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/pale-moon.git


More information about the x2go-commits mailing list