зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1740634: Add install_domain failure panel text r=rpl,agi,geckoview-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D131028
This commit is contained in:
Родитель
297d70924e
Коммит
4b5bda15cb
|
@ -227,13 +227,14 @@ addonInstalled=%S has been installed successfully.
|
|||
# #1 number of add-ons
|
||||
addonsGenericInstalled=#1 add-on has been installed successfully.;#1 add-ons have been installed successfully.
|
||||
|
||||
# LOCALIZATION NOTE (addonInstallError-1, addonInstallError-2, addonInstallError-3, addonInstallError-4, addonInstallError-5, addonLocalInstallError-1, addonLocalInstallError-2, addonLocalInstallError-3, addonLocalInstallError-4, addonLocalInstallError-5):
|
||||
# LOCALIZATION NOTE (addonInstallError-1, addonInstallError-2, addonInstallError-3, addonInstallError-4, addonInstallError-5, addonInstallError-8, addonLocalInstallError-1, addonLocalInstallError-2, addonLocalInstallError-3, addonLocalInstallError-4, addonLocalInstallError-5):
|
||||
# %1$S is the application name, %2$S is the add-on name
|
||||
addonInstallError-1=The add-on could not be downloaded because of a connection failure.
|
||||
addonInstallError-2=The add-on could not be installed because it does not match the add-on %1$S expected.
|
||||
addonInstallError-3=The add-on downloaded from this site could not be installed because it appears to be corrupt.
|
||||
addonInstallError-4=%2$S could not be installed because %1$S cannot modify the needed file.
|
||||
addonInstallError-5=%1$S has prevented this site from installing an unverified add-on.
|
||||
addonInstallError-8=The add-on %2$S can not be installed from this location.
|
||||
addonLocalInstallError-1=This add-on could not be installed because of a filesystem error.
|
||||
addonLocalInstallError-2=This add-on could not be installed because it does not match the add-on %1$S expected.
|
||||
addonLocalInstallError-3=This add-on could not be installed because it appears to be corrupt.
|
||||
|
|
|
@ -1906,6 +1906,7 @@ package org.mozilla.geckoview {
|
|||
field public static final int ERROR_FILE_ACCESS = -4;
|
||||
field public static final int ERROR_INCORRECT_HASH = -2;
|
||||
field public static final int ERROR_INCORRECT_ID = -7;
|
||||
field public static final int ERROR_INVALID_DOMAIN = -8;
|
||||
field public static final int ERROR_NETWORK_FAILURE = -1;
|
||||
field public static final int ERROR_POSTPONED = -101;
|
||||
field public static final int ERROR_SIGNEDSTATE_REQUIRED = -5;
|
||||
|
|
|
@ -1525,6 +1525,8 @@ public class WebExtension {
|
|||
public static final int ERROR_UNEXPECTED_ADDON_TYPE = -6;
|
||||
/** The extension did not have the expected ID. */
|
||||
public static final int ERROR_INCORRECT_ID = -7;
|
||||
/** The extension did not have the expected ID. */
|
||||
public static final int ERROR_INVALID_DOMAIN = -8;
|
||||
/** The extension install was canceled. */
|
||||
public static final int ERROR_USER_CANCELED = -100;
|
||||
/** The extension install was postponed until restart. */
|
||||
|
@ -1569,6 +1571,7 @@ public class WebExtension {
|
|||
ErrorCodes.ERROR_SIGNEDSTATE_REQUIRED,
|
||||
ErrorCodes.ERROR_UNEXPECTED_ADDON_TYPE,
|
||||
ErrorCodes.ERROR_INCORRECT_ID,
|
||||
ErrorCodes.ERROR_INVALID_DOMAIN,
|
||||
ErrorCodes.ERROR_USER_CANCELED,
|
||||
ErrorCodes.ERROR_POSTPONED,
|
||||
})
|
||||
|
|
|
@ -20,9 +20,12 @@ exclude: true
|
|||
- Added [`GeckoResult.finally_`][96.2] to unconditionally run an action after
|
||||
the GeckoResult has been completed.
|
||||
([bug 1736433]({{bugzilla}}1736433)).
|
||||
- Added [`ERROR_INVALID_DOMAIN`][96.2] to WebExtension.InstallException.ErrorCodes.
|
||||
([bug 1740634]({{bugzilla}}1740634)).
|
||||
|
||||
[96.1]: {{javadoc_uri}}/Autocomplete.StorageDelegate.html#onLoginFetch--
|
||||
[96.2]: {{javadoc_uri}}/GeckoResult.html#finally_-java.lang.Runnable-
|
||||
[96.2]: {{javadoc_uri}}/WebExtension.InstallException.ErrorCodes.html#ERROR_INVALID_DOMAIN-
|
||||
|
||||
## v95
|
||||
- Added [`GeckoSession.ContentDelegate.onPointerIconChange()`][95.1] to notify
|
||||
|
@ -1083,4 +1086,4 @@ to allow adding gecko profiler markers.
|
|||
[65.24]: {{javadoc_uri}}/CrashReporter.html#sendCrashReport-android.content.Context-android.os.Bundle-java.lang.String-
|
||||
[65.25]: {{javadoc_uri}}/GeckoResult.html
|
||||
|
||||
[api-version]: 4ba61871ce8c1d29e46ae9e2a43605b609578d5f
|
||||
[api-version]: 542e06f5afa27cc2f7590971d6d3e2ac696af29e
|
||||
|
|
|
@ -3111,7 +3111,7 @@ var AddonManagerInternal = {
|
|||
*
|
||||
* @param {browser} browser browser user is installing from
|
||||
* @param {nsIURI} url URI for the principal of the installing source
|
||||
* @param {AddonInstall} install
|
||||
* @param {AddonInstallWrapper} install
|
||||
* @param {Object} info information such as addon wrapper
|
||||
* @param {AddonWrapper} info.addon
|
||||
* @param {string} source simplified string describing source of install and is
|
||||
|
@ -3134,7 +3134,7 @@ var AddonManagerInternal = {
|
|||
source: install.sourceURI,
|
||||
})
|
||||
) {
|
||||
install.cancel();
|
||||
install.error = AddonManager.ERROR_INVALID_DOMAIN;
|
||||
return Promise.reject();
|
||||
}
|
||||
|
||||
|
@ -3804,6 +3804,8 @@ var AddonManager = {
|
|||
// Constants representing different types of errors while downloading an
|
||||
// add-on.
|
||||
// These will show up as AddonManager.ERROR_* (eg, ERROR_NETWORK_FAILURE)
|
||||
// The _errors codes are translated to text for a panel in browser-addons.js.
|
||||
// The text is located in browser.properties.
|
||||
_errors: new Map([
|
||||
// The download failed due to network problems.
|
||||
["ERROR_NETWORK_FAILURE", -1],
|
||||
|
@ -3816,9 +3818,13 @@ var AddonManager = {
|
|||
// The add-on must be signed and isn't.
|
||||
["ERROR_SIGNEDSTATE_REQUIRED", -5],
|
||||
// The downloaded add-on had a different type than expected.
|
||||
// TODO Bug 1740792
|
||||
["ERROR_UNEXPECTED_ADDON_TYPE", -6],
|
||||
// The addon did not have the expected ID
|
||||
// TODO Bug 1740792
|
||||
["ERROR_INCORRECT_ID", -7],
|
||||
// The addon install_origins does not list the 3rd party domain.
|
||||
["ERROR_INVALID_DOMAIN", -8],
|
||||
]),
|
||||
// The update check timed out
|
||||
ERROR_TIMEOUT: -1,
|
||||
|
|
|
@ -1642,10 +1642,21 @@ class AddonInstall {
|
|||
try {
|
||||
await this.promptHandler(info);
|
||||
} catch (err) {
|
||||
logger.info(`Install of ${this.addon.id} cancelled by user`);
|
||||
this.state = AddonManager.STATE_CANCELLED;
|
||||
this._cleanup();
|
||||
this._callInstallListeners("onInstallCancelled");
|
||||
if (this.error < 0) {
|
||||
logger.info(`Install of ${this.addon.id} failed ${this.error}`);
|
||||
this.state = AddonManager.STATE_INSTALL_FAILED;
|
||||
this._cleanup();
|
||||
// In some cases onOperationCancelled is called during failures
|
||||
// to install/uninstall/enable/disable addons. We may need to
|
||||
// do that here in the future.
|
||||
this._callInstallListeners("onInstallFailed");
|
||||
this.removeTemporaryFile();
|
||||
} else {
|
||||
logger.info(`Install of ${this.addon.id} cancelled by user`);
|
||||
this.state = AddonManager.STATE_CANCELLED;
|
||||
this._cleanup();
|
||||
this._callInstallListeners("onInstallCancelled");
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -2648,6 +2659,14 @@ AddonInstallWrapper.prototype = {
|
|||
return AppConstants.DEBUG ? installFor(this) : undefined;
|
||||
},
|
||||
|
||||
get error() {
|
||||
return installFor(this).error;
|
||||
},
|
||||
|
||||
set error(err) {
|
||||
installFor(this).error = err;
|
||||
},
|
||||
|
||||
get type() {
|
||||
return installFor(this).type;
|
||||
},
|
||||
|
@ -2732,7 +2751,6 @@ AddonInstallWrapper.prototype = {
|
|||
"releaseNotesURI",
|
||||
"file",
|
||||
"state",
|
||||
"error",
|
||||
"progress",
|
||||
"maxProgress",
|
||||
].forEach(function(aProp) {
|
||||
|
|
|
@ -129,7 +129,12 @@ function promiseCompleteWebInstall(
|
|||
expectPrompts = true
|
||||
) {
|
||||
let listener;
|
||||
return new Promise(resolve => {
|
||||
return new Promise(_resolve => {
|
||||
let resolve = () => {
|
||||
install.removeListener(listener);
|
||||
_resolve();
|
||||
};
|
||||
|
||||
listener = {
|
||||
onDownloadFailed: resolve,
|
||||
onDownloadCancelled: resolve,
|
||||
|
@ -172,9 +177,6 @@ function promiseCompleteWebInstall(
|
|||
triggeringPrincipal,
|
||||
install
|
||||
);
|
||||
}).then(() => {
|
||||
install.removeListener(listener);
|
||||
return install;
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -191,6 +193,9 @@ async function testAddonInstall(test) {
|
|||
expectState,
|
||||
`${name} ${install.addon.id} install was completed`
|
||||
);
|
||||
// Wait the extension startup to ensure manifest.json has been read,
|
||||
// otherwise we get NS_ERROR_FILE_NOT_FOUND log spam.
|
||||
await WebExtensionPolicy.getByID(install.addon.id)?.readyPromise;
|
||||
await install.addon.uninstall();
|
||||
} else {
|
||||
equal(
|
||||
|
@ -229,13 +234,13 @@ const TESTS = [
|
|||
name: "Install valid xpi location from invalid website",
|
||||
xpiUrl: "http://example.com/addons/origins.xpi",
|
||||
installPrincipal: PRINCIPAL_ORG,
|
||||
expectState: AddonManager.STATE_CANCELLED,
|
||||
expectState: AddonManager.STATE_INSTALL_FAILED,
|
||||
},
|
||||
{
|
||||
name: "Install invalid xpi location from valid website",
|
||||
xpiUrl: "http://example.org/addons/origins.xpi",
|
||||
installPrincipal: PRINCIPAL_COM,
|
||||
expectState: AddonManager.STATE_CANCELLED,
|
||||
expectState: AddonManager.STATE_INSTALL_FAILED,
|
||||
},
|
||||
{
|
||||
name: "Install MV3 with install_origins",
|
||||
|
@ -253,7 +258,7 @@ const TESTS = [
|
|||
name: "Install MV3 without install_origins",
|
||||
xpiUrl: "http://example.com/addons/v3_no_origins.xpi",
|
||||
installPrincipal: PRINCIPAL_COM,
|
||||
expectState: AddonManager.STATE_CANCELLED,
|
||||
expectState: AddonManager.STATE_INSTALL_FAILED,
|
||||
},
|
||||
{
|
||||
// An installing principal with install permission is
|
||||
|
@ -285,13 +290,13 @@ const TESTS = [
|
|||
name: "Install from site with empty install_origins",
|
||||
xpiUrl: "http://example.com/addons/empty_origins.xpi",
|
||||
installPrincipal: PRINCIPAL_COM,
|
||||
expectState: AddonManager.STATE_CANCELLED,
|
||||
expectState: AddonManager.STATE_INSTALL_FAILED,
|
||||
},
|
||||
{
|
||||
name: "Install from site with empty install_origins",
|
||||
xpiUrl: "http://example.com/addons/empty_origins.xpi",
|
||||
installPrincipal: PRINCIPAL_ORG,
|
||||
expectState: AddonManager.STATE_CANCELLED,
|
||||
expectState: AddonManager.STATE_INSTALL_FAILED,
|
||||
},
|
||||
{
|
||||
name: "Install with empty install_origins from AMO",
|
||||
|
|
|
@ -22,6 +22,7 @@ support-files =
|
|||
startsoftwareupdate.html
|
||||
triggerredirect.html
|
||||
unsigned.xpi
|
||||
webmidi_permission.xpi
|
||||
../xpcshell/data/signing_checks/privileged.xpi
|
||||
|
||||
[browser_amosigned_trigger.js]
|
||||
|
|
|
@ -431,6 +431,42 @@ var TESTS = [
|
|||
await BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
},
|
||||
|
||||
async function test_blockedInstallDomain() {
|
||||
SpecialPowers.pushPrefEnv({
|
||||
set: [
|
||||
["extensions.postDownloadThirdPartyPrompt", true],
|
||||
["extensions.install_origins.enabled", true],
|
||||
],
|
||||
});
|
||||
// The addon has an unknown property that will be supported in later patches (D131317).
|
||||
ExtensionTestUtils.failOnSchemaWarnings(false);
|
||||
|
||||
let progressPromise = waitForProgressNotification();
|
||||
let notificationPromise = waitForNotification("addon-install-failed");
|
||||
let triggers = encodeURIComponent(
|
||||
JSON.stringify({
|
||||
XPI: TESTROOT2 + "webmidi_permission.xpi",
|
||||
})
|
||||
);
|
||||
BrowserTestUtils.openNewForegroundTab(
|
||||
gBrowser,
|
||||
TESTROOT + "installtrigger.html?" + triggers
|
||||
);
|
||||
await progressPromise;
|
||||
let panel = await notificationPromise;
|
||||
|
||||
let notification = panel.childNodes[0];
|
||||
is(
|
||||
notification.getAttribute("label"),
|
||||
"The add-on WebMIDI test addon can not be installed from this location.",
|
||||
"Should have seen the right message"
|
||||
);
|
||||
|
||||
await removeTabAndWaitForNotificationClose();
|
||||
ExtensionTestUtils.failOnSchemaWarnings(true);
|
||||
await SpecialPowers.popPrefEnv();
|
||||
},
|
||||
|
||||
async function test_blockedPostDownload() {
|
||||
SpecialPowers.pushPrefEnv({
|
||||
set: [["extensions.postDownloadThirdPartyPrompt", true]],
|
||||
|
|
Двоичный файл не отображается.
Загрузка…
Ссылка в новой задаче