[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [Git][tpo/applications/tor-browser][tor-browser-115.5.0esr-13.5-1] fixup! Bug 40597: Implement TorSettings module



Title: GitLab

richard pushed to branch tor-browser-115.5.0esr-13.5-1 at The Tor Project / Applications / Tor Browser

Commits:

  • 27e45bc9
    by Pier Angelo Vendrame at 2023-11-30T12:14:32+00:00
    fixup! Bug 40597: Implement TorSettings module
    
    Bug 40856: Add defaults to preference getters
    
    During testing sometimes we might delete some preferences related to
    TorSettings. Since this module did not have defaults to handle these
    cases, sometimes we risked of ending in broken situations.
    

1 changed file:

Changes:

  • toolkit/modules/TorSettings.sys.mjs
    ... ... @@ -327,11 +327,13 @@ export const TorSettings = (() => {
    327 327
     
    
    328 328
           /* Quickstart */
    
    329 329
           settings.quickstart.enabled = Services.prefs.getBoolPref(
    
    330
    -        TorSettingsPrefs.quickstart.enabled
    
    330
    +        TorSettingsPrefs.quickstart.enabled,
    
    331
    +        false
    
    331 332
           );
    
    332 333
           /* Bridges */
    
    333 334
           settings.bridges.enabled = Services.prefs.getBoolPref(
    
    334
    -        TorSettingsPrefs.bridges.enabled
    
    335
    +        TorSettingsPrefs.bridges.enabled,
    
    336
    +        false
    
    335 337
           );
    
    336 338
           settings.bridges.source = Services.prefs.getIntPref(
    
    337 339
             TorSettingsPrefs.bridges.source,
    
    ... ... @@ -339,13 +341,17 @@ export const TorSettings = (() => {
    339 341
           );
    
    340 342
           if (settings.bridges.source == TorBridgeSource.BuiltIn) {
    
    341 343
             const builtinType = Services.prefs.getStringPref(
    
    342
    -          TorSettingsPrefs.bridges.builtin_type
    
    344
    +          TorSettingsPrefs.bridges.builtin_type,
    
    345
    +          ""
    
    343 346
             );
    
    344 347
             settings.bridges.builtin_type = builtinType;
    
    345 348
             settings.bridges.bridge_strings = getBuiltinBridgeStrings(builtinType);
    
    346 349
             if (!settings.bridges.bridge_strings.length) {
    
    347 350
               // in this case the user is using a builtin bridge that is no longer supported,
    
    348 351
               // reset to settings to default values
    
    352
    +          console.warn(
    
    353
    +            `[TorSettings] Cannot find any bridge line for the configured bridge type ${builtinType}`
    
    354
    +          );
    
    349 355
               settings.bridges.source = TorBridgeSource.Invalid;
    
    350 356
               settings.bridges.builtin_type = null;
    
    351 357
             }
    
    ... ... @@ -363,23 +369,29 @@ export const TorSettings = (() => {
    363 369
           }
    
    364 370
           /* Proxy */
    
    365 371
           settings.proxy.enabled = Services.prefs.getBoolPref(
    
    366
    -        TorSettingsPrefs.proxy.enabled
    
    372
    +        TorSettingsPrefs.proxy.enabled,
    
    373
    +        false
    
    367 374
           );
    
    368 375
           if (settings.proxy.enabled) {
    
    369 376
             settings.proxy.type = Services.prefs.getIntPref(
    
    370
    -          TorSettingsPrefs.proxy.type
    
    377
    +          TorSettingsPrefs.proxy.type,
    
    378
    +          TorProxyType.Invalid
    
    371 379
             );
    
    372 380
             settings.proxy.address = Services.prefs.getStringPref(
    
    373
    -          TorSettingsPrefs.proxy.address
    
    381
    +          TorSettingsPrefs.proxy.address,
    
    382
    +          ""
    
    374 383
             );
    
    375 384
             settings.proxy.port = Services.prefs.getIntPref(
    
    376
    -          TorSettingsPrefs.proxy.port
    
    385
    +          TorSettingsPrefs.proxy.port,
    
    386
    +          0
    
    377 387
             );
    
    378 388
             settings.proxy.username = Services.prefs.getStringPref(
    
    379
    -          TorSettingsPrefs.proxy.username
    
    389
    +          TorSettingsPrefs.proxy.username,
    
    390
    +          ""
    
    380 391
             );
    
    381 392
             settings.proxy.password = Services.prefs.getStringPref(
    
    382
    -          TorSettingsPrefs.proxy.password
    
    393
    +          TorSettingsPrefs.proxy.password,
    
    394
    +          ""
    
    383 395
             );
    
    384 396
           } else {
    
    385 397
             settings.proxy.type = TorProxyType.Invalid;
    
    ... ... @@ -391,11 +403,13 @@ export const TorSettings = (() => {
    391 403
     
    
    392 404
           /* Firewall */
    
    393 405
           settings.firewall.enabled = Services.prefs.getBoolPref(
    
    394
    -        TorSettingsPrefs.firewall.enabled
    
    406
    +        TorSettingsPrefs.firewall.enabled,
    
    407
    +        false
    
    395 408
           );
    
    396 409
           if (settings.firewall.enabled) {
    
    397 410
             const portList = Services.prefs.getStringPref(
    
    398
    -          TorSettingsPrefs.firewall.allowed_ports
    
    411
    +          TorSettingsPrefs.firewall.allowed_ports,
    
    412
    +          ""
    
    399 413
             );
    
    400 414
             settings.firewall.allowed_ports = parsePortList(portList);
    
    401 415
           } else {
    

  • _______________________________________________
    tor-commits mailing list
    tor-commits@xxxxxxxxxxxxxxxxxxxx
    https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits