Files
firefox/toolkit/mozapps/update/tests/browser/browser_updatesPartialPatchWithBadPartialSize.js
T
Doug Thayer 89a15e6773 Bug 1359733 - (pt. 2) Refactor gMenuButtonUpdateBadge r=rstrong
Since we now have a store of notifications that is global across
all windows, it no longer makes sense to consume the API from
within browser.js. This patch moves the browser.js logic out into
a jsm file that is wired up through nsBrowserGlue, such that it
will be lazily instantiated on the first update event it would
receive[1].

We decided to move this into toolkit, as this piece of the
system is fairly generic and shouldn't differ between
applications.

[1]: There is a change to nsBrowserGlue to use "global[module]"
instead of this[module]. This mirrors the code for all the other
types of notifications, and I suspect it was just a latent bug,
since the original diff that includes this line makes no use of
it.

MozReview-Commit-ID: 8EQdM9BOpgl
2017-05-19 08:56:22 -07:00

34 lines
1.1 KiB
JavaScript

add_task(async function testPartialPatchWithBadPartialSize() {
SpecialPowers.pushPrefEnv({set: [[PREF_APP_UPDATE_DOWNLOADPROMPTMAXATTEMPTS, 2]]});
let updateParams = "partialPatchOnly=1&invalidPartialSize=1";
await runUpdateTest(updateParams, 1, [
{
// if we fail maxBackgroundErrors download attempts, then we want to
// first show the user an update available prompt.
notificationId: "update-available",
button: "button"
},
{
notificationId: "update-available",
button: "button"
},
{
// if we have only an invalid patch, then something's wrong and we don't
// have an automatic way to fix it, so show the manual update
// doorhanger.
notificationId: "update-manual",
button: "button",
beforeClick() {
checkWhatsNewLink("update-manual-whats-new");
},
async cleanup() {
await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
is(gBrowser.selectedBrowser.currentURI.spec,
URL_MANUAL_UPDATE, "Landed on manual update page.")
gBrowser.removeTab(gBrowser.selectedTab);
}
},
]);
});