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

Commits:

10 changed files:

Changes:

  • browser/components/privatebrowsing/content/aboutPrivateBrowsing.html
    ... ... @@ -10,7 +10,7 @@
    10 10
         <meta charset="utf-8" />
    
    11 11
         <meta
    
    12 12
           http-equiv="Content-Security-Policy"
    
    13
    -      content="default-src chrome: blob:; object-src 'none'"
    
    13
    +      content="default-src chrome:; img-src chrome: blob:; object-src 'none';"
    
    14 14
         />
    
    15 15
         <meta name="color-scheme" content="light dark" />
    
    16 16
         <link rel="icon" href="chrome://browser/skin/privatebrowsing/favicon.svg" />
    

  • browser/components/protections/content/protections.html
    ... ... @@ -8,7 +8,7 @@
    8 8
         <meta charset="utf-8" />
    
    9 9
         <meta
    
    10 10
           http-equiv="Content-Security-Policy"
    
    11
    -      content="default-src chrome: blob:; object-src 'none'"
    
    11
    +      content="default-src chrome:; object-src 'none'"
    
    12 12
         />
    
    13 13
         <meta name="color-scheme" content="light dark" />
    
    14 14
         <link rel="localization" href="branding/brand.ftl" />
    

  • browser/components/protocolhandler/test/browser/browser_registerProtocolHandler_notification.js
    ... ... @@ -6,7 +6,16 @@ const TEST_PATH = getRootDirectory(gTestPath).replace(
    6 6
       "chrome://mochitests/content",
    
    7 7
       "https://example.com"
    
    8 8
     );
    
    9
    +
    
    10
    +const SECURITY_DELAY = 3000;
    
    11
    +
    
    9 12
     add_task(async function () {
    
    13
    +  // Set a custom, higher security delay for the test to avoid races on slow
    
    14
    +  // builds.
    
    15
    +  await SpecialPowers.pushPrefEnv({
    
    16
    +    set: [["security.notification_enable_delay", SECURITY_DELAY]],
    
    17
    +  });
    
    18
    +
    
    10 19
       let notificationValue = "Protocol Registration: web+testprotocol";
    
    11 20
       let testURI = TEST_PATH + "browser_registerProtocolHandler_notification.html";
    
    12 21
     
    
    ... ... @@ -58,4 +67,16 @@ add_task(async function () {
    58 67
       let button = buttons[0];
    
    59 68
       isnot(button.label, null, "We expect the add button to have a label.");
    
    60 69
       todo(button.accesskey, "We expect the add button to have a accesskey.");
    
    70
    +
    
    71
    +  ok(button.disabled, "We expect the button to be disabled initially.");
    
    72
    +
    
    73
    +  let timeoutMS = SECURITY_DELAY + 100;
    
    74
    +  info(`Wait ${timeoutMS}ms for the button to enable.`);
    
    75
    +  // eslint-disable-next-line mozilla/no-arbitrary-setTimeout
    
    76
    +  await new Promise(resolve => setTimeout(resolve, SECURITY_DELAY + 100));
    
    77
    +
    
    78
    +  ok(
    
    79
    +    !button.disabled,
    
    80
    +    "We expect the button to be enabled after the security delay."
    
    81
    +  );
    
    61 82
     });

  • toolkit/components/extensions/Extension.sys.mjs
    ... ... @@ -1367,6 +1367,17 @@ export class ExtensionData {
    1367 1367
         );
    
    1368 1368
       }
    
    1369 1369
     
    
    1370
    +  // AMO enforces a maximum length of 45 on the name since at least 2017, via
    
    1371
    +  // https://github.com/mozilla/addons-linter/blame/c4507688899aaafe29c522f1b1aec94b78b8a095/src/schema/updates/manifest.json#L111
    
    1372
    +  // added in https://github.com/mozilla/addons-linter/pull/1169
    
    1373
    +  // To avoid breaking add-ons that do not go through AMO (e.g. temporarily
    
    1374
    +  // loaded extensions), we enforce the limit by truncating and warning if
    
    1375
    +  // needed, instead enforcing a maxLength on "name" in schemas/manifest.json.
    
    1376
    +  //
    
    1377
    +  // We set the limit to 75, which is a safe limit that matches the CWS,
    
    1378
    +  // see https://bugzilla.mozilla.org/show_bug.cgi?id=1939087#c5
    
    1379
    +  static EXT_NAME_MAX_LEN = 75;
    
    1380
    +
    
    1370 1381
       async initializeAddonTypeAndID() {
    
    1371 1382
         if (this.type) {
    
    1372 1383
           // Already initialized.
    
    ... ... @@ -1486,6 +1497,14 @@ export class ExtensionData {
    1486 1497
           }
    
    1487 1498
         }
    
    1488 1499
     
    
    1500
    +    if (manifest.name.length > ExtensionData.EXT_NAME_MAX_LEN) {
    
    1501
    +      // Truncate and warn - see comment in EXT_NAME_MAX_LEN.
    
    1502
    +      manifest.name = manifest.name.slice(0, ExtensionData.EXT_NAME_MAX_LEN);
    
    1503
    +      this.manifestWarning(
    
    1504
    +        `Warning processing "name": must be shorter than ${ExtensionData.EXT_NAME_MAX_LEN}`
    
    1505
    +      );
    
    1506
    +    }
    
    1507
    +
    
    1489 1508
         if (
    
    1490 1509
           this.manifestVersion < 3 &&
    
    1491 1510
           manifest.background &&
    

  • toolkit/components/extensions/schemas/manifest.json
    ... ... @@ -29,6 +29,7 @@
    29 29
     
    
    30 30
               "name": {
    
    31 31
                 "type": "string",
    
    32
    +            "description": "Name must be at least 2, at should be at most 75 characters",
    
    32 33
                 "optional": false,
    
    33 34
                 "preprocess": "localize"
    
    34 35
               },
    

  • toolkit/components/extensions/test/xpcshell/test_ext_manifest.js
    ... ... @@ -156,6 +156,28 @@ add_task(
    156 156
       }
    
    157 157
     );
    
    158 158
     
    
    159
    +add_task(async function test_name_too_long() {
    
    160
    +  let extension = ExtensionTestUtils.loadExtension({
    
    161
    +    manifest: {
    
    162
    +      // This length is 80, which exceeds ExtensionData.EXT_NAME_MAX_LEN:
    
    163
    +      name: "123456789_".repeat(8),
    
    164
    +    },
    
    165
    +  });
    
    166
    +  await extension.startup();
    
    167
    +  equal(
    
    168
    +    extension.extension.name,
    
    169
    +    "123456789_123456789_123456789_123456789_123456789_123456789_123456789_12345",
    
    170
    +    "Name should be truncated"
    
    171
    +  );
    
    172
    +  Assert.deepEqual(
    
    173
    +    extension.extension.warnings,
    
    174
    +    ['Reading manifest: Warning processing "name": must be shorter than 75'],
    
    175
    +    "Expected error message when the name is too long"
    
    176
    +  );
    
    177
    +
    
    178
    +  await extension.unload();
    
    179
    +});
    
    180
    +
    
    159 181
     add_task(async function test_simpler_version_format() {
    
    160 182
       const TEST_CASES = [
    
    161 183
         // Valid cases
    

  • toolkit/mozapps/extensions/internal/XPIInstall.jsm
    ... ... @@ -560,6 +560,11 @@ async function loadManifestFromWebManifest(aPackage, aLocation) {
    560 560
           contributors: null,
    
    561 561
           locales: [aLocale],
    
    562 562
         };
    
    563
    +    if (result.name.length > lazy.ExtensionData.EXT_NAME_MAX_LEN) {
    
    564
    +      // See comment at EXT_NAME_MAX_LEN in Extension.sys.mjs.
    
    565
    +      logger.warn(`Truncating add-on name ${addon.id} for locale ${aLocale}`);
    
    566
    +      result.name = result.name.slice(0, lazy.ExtensionData.EXT_NAME_MAX_LEN);
    
    567
    +    }
    
    563 568
         return result;
    
    564 569
       }
    
    565 570
     
    

  • toolkit/mozapps/extensions/test/xpcshell/test_locale.js
    ... ... @@ -51,6 +51,13 @@ add_task(async function test_1() {
    51 51
               description: "name",
    
    52 52
             },
    
    53 53
           },
    
    54
    +      "_locales/es-ES/messages.json": {
    
    55
    +        name: {
    
    56
    +          // This length is 80, which exceeds ExtensionData.EXT_NAME_MAX_LEN:
    
    57
    +          message: "123456789_".repeat(8),
    
    58
    +          description: "name with 80 chars, should truncate to 75",
    
    59
    +        },
    
    60
    +      },
    
    54 61
         },
    
    55 62
       });
    
    56 63
     
    
    ... ... @@ -101,3 +108,18 @@ add_task(async function test_6() {
    101 108
     
    
    102 109
       await addon.enable();
    
    103 110
     });
    
    111
    +
    
    112
    +add_task(async function test_name_too_long() {
    
    113
    +  await restartWithLocales(["es-ES"]);
    
    114
    +
    
    115
    +  let addon = await AddonManager.getAddonByID("addon1@tests.mozilla.org");
    
    116
    +  Assert.notEqual(addon, null);
    
    117
    +
    
    118
    +  Assert.equal(
    
    119
    +    addon.name,
    
    120
    +    "123456789_123456789_123456789_123456789_123456789_123456789_123456789_12345",
    
    121
    +    "Name should be truncated"
    
    122
    +  );
    
    123
    +
    
    124
    +  await addon.enable();
    
    125
    +});

  • tools/profiler/gecko/ProfilerChild.cpp
    ... ... @@ -139,6 +139,12 @@ void ProfilerChild::SetupChunkManager() {
    139 139
           });
    
    140 140
     }
    
    141 141
     
    
    142
    +/* static */ void ProfilerChild::ClearPendingUpdate() {
    
    143
    +  auto lockedUpdate = sPendingChunkManagerUpdate.Lock();
    
    144
    +  lockedUpdate->mProfilerChild = nullptr;
    
    145
    +  lockedUpdate->mUpdate.Clear();
    
    146
    +}
    
    147
    +
    
    142 148
     void ProfilerChild::ResetChunkManager() {
    
    143 149
       if (!mChunkManager) {
    
    144 150
         return;
    
    ... ... @@ -149,9 +155,7 @@ void ProfilerChild::ResetChunkManager() {
    149 155
       mChunkManager->SetUpdateCallback({});
    
    150 156
     
    
    151 157
       // Clear the pending update.
    
    152
    -  auto lockedUpdate = sPendingChunkManagerUpdate.Lock();
    
    153
    -  lockedUpdate->mProfilerChild = nullptr;
    
    154
    -  lockedUpdate->mUpdate.Clear();
    
    158
    +  ClearPendingUpdate();
    
    155 159
       // And process a final update right now.
    
    156 160
       ProcessChunkManagerUpdate(
    
    157 161
           ProfileBufferControlledChunkManager::Update(nullptr));
    
    ... ... @@ -483,7 +487,7 @@ void ProfilerChild::ActorDestroy(ActorDestroyReason aActorDestroyReason) {
    483 487
     }
    
    484 488
     
    
    485 489
     void ProfilerChild::Destroy() {
    
    486
    -  ResetChunkManager();
    
    490
    +  ClearPendingUpdate();
    
    487 491
       if (!mDestroyed) {
    
    488 492
         Close();
    
    489 493
       }
    

  • tools/profiler/public/ProfilerChild.h
    ... ... @@ -81,6 +81,8 @@ class ProfilerChild final : public PProfilerChild,
    81 81
       void ProcessChunkManagerUpdate(
    
    82 82
           ProfileBufferControlledChunkManager::Update&& aUpdate);
    
    83 83
     
    
    84
    +  static void ClearPendingUpdate();
    
    85
    +
    
    84 86
       static void GatherProfileThreadFunction(void* already_AddRefedParameters);
    
    85 87
     
    
    86 88
       nsCOMPtr<nsIThread> mThread;