зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1557963. Stop using [array] in nsIUpdateService. r=rstrong
Differential Revision: https://phabricator.services.mozilla.com/D34278 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
5431ebd7d7
Коммит
bb35ab7a20
|
@ -264,10 +264,10 @@ appUpdater.prototype =
|
|||
/**
|
||||
* See nsIUpdateService.idl
|
||||
*/
|
||||
onCheckComplete(aRequest, aUpdates, aUpdateCount) {
|
||||
onCheckComplete(aRequest, aUpdates) {
|
||||
gAppUpdater.isChecking = false;
|
||||
gAppUpdater.update = gAppUpdater.aus.
|
||||
selectUpdate(aUpdates, aUpdates.length);
|
||||
selectUpdate(aUpdates);
|
||||
if (!gAppUpdater.update) {
|
||||
gAppUpdater.selectPanel("noUpdatesFound");
|
||||
return;
|
||||
|
|
|
@ -81,8 +81,8 @@ function CheckBrowserNeedsUpdate(updateInterval = FRECENT_SITES_UPDATE_INTERVAL)
|
|||
return new Promise((resolve, reject) => {
|
||||
const now = Date.now();
|
||||
const updateServiceListener = {
|
||||
onCheckComplete(request, updates, updateCount) {
|
||||
checker._value = updateCount > 0;
|
||||
onCheckComplete(request, updates) {
|
||||
checker._value = updates.length > 0;
|
||||
resolve(checker._value);
|
||||
},
|
||||
onError(request, update) {
|
||||
|
|
|
@ -2252,7 +2252,7 @@ UpdateService.prototype = {
|
|||
this._attemptResume();
|
||||
},
|
||||
|
||||
onCheckComplete: function AUS_onCheckComplete(request, updates, updateCount) {
|
||||
onCheckComplete: function AUS_onCheckComplete(request, updates) {
|
||||
this._selectAndInstallUpdate(updates);
|
||||
},
|
||||
|
||||
|
@ -2613,7 +2613,7 @@ UpdateService.prototype = {
|
|||
return;
|
||||
}
|
||||
|
||||
var update = this.selectUpdate(updates, updates.length);
|
||||
var update = this.selectUpdate(updates);
|
||||
if (!update || update.elevationFailure) {
|
||||
return;
|
||||
}
|
||||
|
@ -3541,7 +3541,7 @@ Checker.prototype = {
|
|||
}
|
||||
|
||||
// Tell the callback about the updates
|
||||
this._callback.onCheckComplete(event.target, updates, updates.length);
|
||||
this._callback.onCheckComplete(event.target, updates);
|
||||
} catch (e) {
|
||||
LOG("Checker:onLoad - there was a problem checking for updates. " +
|
||||
"Exception: " + e);
|
||||
|
|
|
@ -240,12 +240,8 @@ interface nsIUpdateCheckListener : nsISupports
|
|||
* The XMLHttpRequest handling the update check.
|
||||
* @param updates
|
||||
* An array of nsIUpdate objects listing available updates.
|
||||
* @param updateCount
|
||||
* The size of the |updates| array.
|
||||
*/
|
||||
void onCheckComplete(in jsval request,
|
||||
[array, size_is(updateCount)] in nsIUpdate updates,
|
||||
in unsigned long updateCount);
|
||||
void onCheckComplete(in jsval request, in Array<nsIUpdate> updates);
|
||||
|
||||
/**
|
||||
* An error occurred while loading the remote update service file.
|
||||
|
@ -309,11 +305,8 @@ interface nsIApplicationUpdateService : nsISupports
|
|||
* Selects the best update to install from a list of available updates.
|
||||
* @param updates
|
||||
* An array of updates that are available
|
||||
* @param updateCount
|
||||
* The length of the |updates| array
|
||||
*/
|
||||
nsIUpdate selectUpdate([array, size_is(updateCount)] in nsIUpdate updates,
|
||||
in unsigned long updateCount);
|
||||
nsIUpdate selectUpdate(in Array<nsIUpdate> updates);
|
||||
|
||||
/**
|
||||
* Adds a listener that receives progress and state information about the
|
||||
|
|
|
@ -3425,13 +3425,13 @@ function waitForUpdateCheck(aSuccess, aExpectedValues = {}) {
|
|||
return new Promise(resolve => gUpdateChecker.checkForUpdates({
|
||||
onProgress: (aRequest, aPosition, aTotalSize) => {
|
||||
},
|
||||
onCheckComplete: (request, updates, updateCount) => {
|
||||
onCheckComplete: (request, updates) => {
|
||||
Assert.ok(aSuccess, "the update check should succeed");
|
||||
if (aExpectedValues.updateCount) {
|
||||
Assert.equal(aExpectedValues.updateCount, updateCount,
|
||||
Assert.equal(aExpectedValues.updateCount, updates.length,
|
||||
"the update count" + MSG_SHOULD_EQUAL);
|
||||
}
|
||||
resolve({request, updates, updateCount});
|
||||
resolve({request, updates});
|
||||
},
|
||||
onError: (request, update) => {
|
||||
Assert.ok(!aSuccess, "the update check should error");
|
||||
|
@ -3457,8 +3457,8 @@ function waitForUpdateCheck(aSuccess, aExpectedValues = {}) {
|
|||
* @return A promise which will resolve the first time the update download
|
||||
* onStopRequest occurs and returns the arguments from onStopRequest.
|
||||
*/
|
||||
function waitForUpdateDownload(aUpdates, aUpdateCount, aExpectedStatus) {
|
||||
let bestUpdate = gAUS.selectUpdate(aUpdates, aUpdateCount);
|
||||
function waitForUpdateDownload(aUpdates, aExpectedStatus) {
|
||||
let bestUpdate = gAUS.selectUpdate(aUpdates);
|
||||
let state = gAUS.downloadUpdate(bestUpdate, false);
|
||||
if (state == STATE_NONE || state == STATE_FAILED) {
|
||||
do_throw("nsIApplicationUpdateService:downloadUpdate returned " + state);
|
||||
|
|
|
@ -17,8 +17,7 @@ async function run_test() {
|
|||
let updates = getRemoteUpdateString({}, patches);
|
||||
gResponseBody = getRemoteUpdatesXMLString(updates);
|
||||
await waitForUpdateCheck(true, {updateCount: 1}).then(async (aArgs) => {
|
||||
await waitForUpdateDownload(aArgs.updates, aArgs.updateCount,
|
||||
Cr.NS_ERROR_NET_RESET);
|
||||
await waitForUpdateDownload(aArgs.updates, Cr.NS_ERROR_NET_RESET);
|
||||
});
|
||||
stop_httpserver(doTestFinish);
|
||||
}
|
||||
|
|
|
@ -15,8 +15,7 @@ async function run_test() {
|
|||
let updates = getRemoteUpdateString({}, patches);
|
||||
gResponseBody = getRemoteUpdatesXMLString(updates);
|
||||
await waitForUpdateCheck(true, {updateCount: 1}).then(async (aArgs) => {
|
||||
await waitForUpdateDownload(aArgs.updates, aArgs.updateCount,
|
||||
Cr.NS_OK);
|
||||
await waitForUpdateDownload(aArgs.updates, Cr.NS_OK);
|
||||
});
|
||||
stop_httpserver(doTestFinish);
|
||||
}
|
||||
|
|
|
@ -20,8 +20,7 @@ async function run_test() {
|
|||
let updates = getRemoteUpdateString({}, patches);
|
||||
gResponseBody = getRemoteUpdatesXMLString(updates);
|
||||
await waitForUpdateCheck(true, {updateCount: 1}).then(async (aArgs) => {
|
||||
await waitForUpdateDownload(aArgs.updates, aArgs.updateCount,
|
||||
Cr.NS_OK);
|
||||
await waitForUpdateDownload(aArgs.updates, Cr.NS_OK);
|
||||
});
|
||||
stop_httpserver(doTestFinish);
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ async function run_test() {
|
|||
// bug 470244 and until this is fixed this will not test the value for
|
||||
// detailsURL when it isn't specified in the update xml.
|
||||
|
||||
let bestUpdate = gAUS.selectUpdate(aArgs.updates, aArgs.updateCount).
|
||||
let bestUpdate = gAUS.selectUpdate(aArgs.updates).
|
||||
QueryInterface(Ci.nsIWritablePropertyBag);
|
||||
Assert.equal(bestUpdate.type, "minor",
|
||||
"the update type attribute" + MSG_SHOULD_EQUAL);
|
||||
|
@ -159,7 +159,7 @@ async function run_test() {
|
|||
updates = getRemoteUpdateString({}, patches);
|
||||
gResponseBody = getRemoteUpdatesXMLString(updates);
|
||||
await waitForUpdateCheck(true).then((aArgs) => {
|
||||
Assert.equal(aArgs.updateCount, 0,
|
||||
Assert.equal(aArgs.updates.length, 0,
|
||||
"the update count" + MSG_SHOULD_EQUAL);
|
||||
});
|
||||
|
||||
|
@ -191,7 +191,7 @@ async function run_test() {
|
|||
updates += getRemoteUpdateString(updateProps, patches);
|
||||
gResponseBody = getRemoteUpdatesXMLString(updates);
|
||||
await waitForUpdateCheck(true, {updateCount: 2}).then((aArgs) => {
|
||||
let bestUpdate = gAUS.selectUpdate(aArgs.updates, aArgs.updateCount);
|
||||
let bestUpdate = gAUS.selectUpdate(aArgs.updates);
|
||||
Assert.ok(!bestUpdate,
|
||||
"there shouldn't be an update available");
|
||||
});
|
||||
|
@ -205,7 +205,7 @@ async function run_test() {
|
|||
updates = getRemoteUpdateString(updateProps, patches);
|
||||
gResponseBody = getRemoteUpdatesXMLString(updates);
|
||||
await waitForUpdateCheck(true, {updateCount: 1}).then((aArgs) => {
|
||||
let bestUpdate = gAUS.selectUpdate(aArgs.updates, aArgs.updateCount);
|
||||
let bestUpdate = gAUS.selectUpdate(aArgs.updates);
|
||||
Assert.ok(!!bestUpdate,
|
||||
"there should be one update available");
|
||||
Assert.equal(bestUpdate.appVersion, "1.0",
|
||||
|
|
Загрузка…
Ссылка в новой задаче