Skip to content

Commit

Permalink
Bug 1779660 - Fix ephemeral background tasks tests on Thunderbird. r=…
Browse files Browse the repository at this point in the history
…nalexander

Differential Revision: https://phabricator.services.mozilla.com/D151887
  • Loading branch information
darktrojan committed Jul 15, 2022
1 parent c28df77 commit 4ca5dc8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ let condition = {
skip_if: () => !AppConstants.MOZ_BACKGROUNDTASKS,
};

// MOZ_APP_VENDOR is empty on Thunderbird.
let vendor = AppConstants.MOZ_APP_NAME == "thunderbird" ? "" : "Mozilla";

add_task(condition, async () => {
let hash = xreDirProvider.getInstallHash();

Expand Down Expand Up @@ -42,17 +45,19 @@ add_task(condition, async () => {

let saltedPath = profileData.backgroundTasksProfiles[0].path;
Assert.ok(
saltedPath.endsWith(`.MozillaBackgroundTask-${hash}-not_ephemeral_profile`),
`${saltedPath} ends with ".MozillaBackgroundTask-${hash}-not_ephemeral_profile"`
saltedPath.endsWith(
`.${vendor}BackgroundTask-${hash}-not_ephemeral_profile`
),
`${saltedPath} ends with ".${vendor}BackgroundTask-${hash}-not_ephemeral_profile"`
);
Assert.ok(
!saltedPath.startsWith(
`.MozillaBackgroundTask-${hash}-not_ephemeral_profile`
`.${vendor}BackgroundTask-${hash}-not_ephemeral_profile`
),
`${saltedPath} is really salted`
);
Assert.deepEqual(profileData.backgroundTasksProfiles[0], {
name: `MozillaBackgroundTask-${hash}-not_ephemeral_profile`,
name: `${vendor}BackgroundTask-${hash}-not_ephemeral_profile`,
path: saltedPath,
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,17 @@ let condition = {
skip_if: () => !AppConstants.MOZ_BACKGROUNDTASKS,
};

// MOZ_APP_VENDOR is empty on Thunderbird.
let vendor = AppConstants.MOZ_APP_NAME == "thunderbird" ? "" : "Mozilla";

add_task(condition, async () => {
let hash = xreDirProvider.getInstallHash();

let saltedPath = `saltSALT.MozillaBackgroundTask-${hash}-not_ephemeral_profile`;
let saltedPath = `saltSALT.${vendor}BackgroundTask-${hash}-not_ephemeral_profile`;

// See note about ordering below.
BACKGROUNDTASKS_PROFILE_DATA.backgroundTasksProfiles.splice(0, 0, {
name: `MozillaBackgroundTask-${hash}-not_ephemeral_profile`,
name: `${vendor}BackgroundTask-${hash}-not_ephemeral_profile`,
path: saltedPath,
});

Expand Down

0 comments on commit 4ca5dc8

Please sign in to comment.