morgan pushed to branch mullvad-browser-128.3.0esr-14.0-1 at The Tor Project / Applications / Mullvad Browser
Commits:
- 
bc8fd871
by Pier Angelo Vendrame at 2024-10-10T21:13:43+00:00
- 
2a2f50eb
by Pier Angelo Vendrame at 2024-10-10T21:13:44+00:00
3 changed files:
- toolkit/mozapps/update/tests/data/sharedUpdateXML.js
- + toolkit/mozapps/update/tests/unit_aus_update/mixedUnsupported.js
- toolkit/mozapps/update/tests/unit_aus_update/xpcshell.toml
Changes:
| ... | ... | @@ -141,6 +141,7 @@ function getRemoteUpdateString(aUpdateProps, aPatches) { | 
| 141 | 141 |      name: "App Update Test",
 | 
| 142 | 142 |      promptWaitTime: null,
 | 
| 143 | 143 |      type: "major",
 | 
| 144 | +    unsupported: false,
 | |
| 144 | 145 |    };
 | 
| 145 | 146 | |
| 146 | 147 |    for (let name in aUpdateProps) {
 | 
| ... | ... | @@ -346,6 +347,7 @@ function getUpdateString(aUpdateProps) { | 
| 346 | 347 |        aUpdateProps.disableBackgroundUpdates +
 | 
| 347 | 348 |        '" '
 | 
| 348 | 349 |      : "";
 | 
| 350 | +  let unsupported = aUpdateProps.unsupported ? 'unsupported="true" ' : "";
 | |
| 349 | 351 |    let custom1 = aUpdateProps.custom1 ? aUpdateProps.custom1 + " " : "";
 | 
| 350 | 352 |    let custom2 = aUpdateProps.custom2 ? aUpdateProps.custom2 + " " : "";
 | 
| 351 | 353 |    let buildID = 'buildID="' + aUpdateProps.buildID + '"';
 | 
| ... | ... | @@ -360,6 +362,7 @@ function getUpdateString(aUpdateProps) { | 
| 360 | 362 |      promptWaitTime +
 | 
| 361 | 363 |      disableBITS +
 | 
| 362 | 364 |      disableBackgroundUpdates +
 | 
| 365 | +    unsupported +
 | |
| 363 | 366 |      custom1 +
 | 
| 364 | 367 |      custom2 +
 | 
| 365 | 368 |      buildID
 | 
| 1 | +/* This Source Code Form is subject to the terms of the Mozilla Public
 | |
| 2 | + * License, v. 2.0. If a copy of the MPL was not distributed with this
 | |
| 3 | + * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 | |
| 4 | + */
 | |
| 5 | + | |
| 6 | +/**
 | |
| 7 | + * This tests that an older update is chosen over a more recent but unsupported
 | |
| 8 | + * update.
 | |
| 9 | + */
 | |
| 10 | + | |
| 11 | +async function run_test() {
 | |
| 12 | +  setupTestCommon();
 | |
| 13 | +  start_httpserver();
 | |
| 14 | +  setUpdateURL(gURLData + gHTTPHandlerPath);
 | |
| 15 | +  setUpdateChannel("test_channel");
 | |
| 16 | + | |
| 17 | +  let patchProps = {
 | |
| 18 | +    type: "complete",
 | |
| 19 | +    url: "http://complete/",
 | |
| 20 | +    size: "9856459",
 | |
| 21 | +  };
 | |
| 22 | +  let patches = getRemotePatchString(patchProps);
 | |
| 23 | +  patchProps = { type: "partial", url: "http://partial/", size: "1316138" };
 | |
| 24 | +  patches += getRemotePatchString(patchProps);
 | |
| 25 | + | |
| 26 | +  let oldAppVersion = "900000.0";
 | |
| 27 | +  let newAppVersion = "999999.0";
 | |
| 28 | +  let update1 = getRemoteUpdateString(
 | |
| 29 | +    { appVersion: newAppVersion, unsupported: true },
 | |
| 30 | +    patches
 | |
| 31 | +  );
 | |
| 32 | +  let update2 = getRemoteUpdateString({ appVersion: oldAppVersion }, patches);
 | |
| 33 | +  gResponseBody = getRemoteUpdatesXMLString(update1 + update2);
 | |
| 34 | + | |
| 35 | +  let checkResult = await waitForUpdateCheck(true, { updateCount: 2 });
 | |
| 36 | +  let bestUpdate = await gAUS.selectUpdate(checkResult.updates);
 | |
| 37 | +  bestUpdate.QueryInterface(Ci.nsIWritablePropertyBag);
 | |
| 38 | +  Assert.equal(
 | |
| 39 | +    bestUpdate.unsupported,
 | |
| 40 | +    false,
 | |
| 41 | +    "The unsupported update has been discarded."
 | |
| 42 | +  );
 | |
| 43 | +  Assert.equal(
 | |
| 44 | +    bestUpdate.appVersion,
 | |
| 45 | +    oldAppVersion,
 | |
| 46 | +    "Expected the older version to be chosen over the more recent but unsupported."
 | |
| 47 | +  );
 | |
| 48 | + | |
| 49 | +  stop_httpserver(doTestFinish);
 | |
| 50 | +} | 
| ... | ... | @@ -56,6 +56,8 @@ reason = "Feature is Firefox-specific and Windows-specific." | 
| 56 | 56 |  ["languagePackUpdates.js"]
 | 
| 57 | 57 |  skip-if = ["socketprocess_networking"] # Bug 1759035
 | 
| 58 | 58 | |
| 59 | +["mixedUnsupported.js"]
 | |
| 60 | + | |
| 59 | 61 |  ["multiUpdate.js"]
 | 
| 60 | 62 |  skip-if = ["socketprocess_networking"] # Bug 1759035
 | 
| 61 | 63 |