Bug 1450097 - Don't allow legacy add-ons to be installed via policy. r=Felipe

MozReview-Commit-ID: LwR3PXY3RuX

--HG--
extra : rebase_source : 0bfad8f5c6c10f8f455a2111f88a2ac022ad9ae7
This commit is contained in:
Michael Kaply 2018-03-29 18:05:26 -05:00
Родитель fc0c43807a
Коммит 06035d669e
2 изменённых файлов: 26 добавлений и 10 удалений

Просмотреть файл

@ -309,21 +309,37 @@ var Policies = {
}
url = Services.io.newFileURI(xpiFile).spec;
}
AddonManager.getInstallForURL(url, (install) => {
AddonManager.getInstallForURL(url, null, "application/x-xpinstall").then(install => {
if (install.addon && install.addon.appDisabled) {
log.error(`Incompatible add-on - ${location}`);
install.cancel();
return;
}
let listener = {
/* eslint-disable-next-line no-shadow */
onDownloadEnded: (install) => {
if (install.addon && install.addon.appDisabled) {
log.error(`Incompatible add-on - ${location}`);
install.removeListener(listener);
install.cancel();
}
},
onDownloadFailed: () => {
install.removeListener(listener);
log.error(`Download failed - ${location}`);
},
onInstallFailed: () => {
install.removeListener(listener);
log.error(`Installation failed - ${location}`);
},
onInstallEnded: () => {
install.removeListener(listener);
log.debug(`Installation succeeded - ${location}`);
}
};
install.addListener(listener);
install.install();
}, "application/x-xpinstall");
});
}
});
}

16
npm-shrinkwrap.json сгенерированный
Просмотреть файл

@ -988,6 +988,14 @@
"resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz",
"integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw="
},
"string_decoder": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz",
"integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==",
"requires": {
"safe-buffer": "5.1.1"
}
},
"string-width": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz",
@ -997,14 +1005,6 @@
"strip-ansi": "4.0.0"
}
},
"string_decoder": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz",
"integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==",
"requires": {
"safe-buffer": "5.1.1"
}
},
"strip-ansi": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz",