Bug 1352152 Fix several issues with optional webextension permissions r=kmag

1. Use the right strings in permission dialogs
2. Don't show permissions dialogs for non-promptable permissions
3. Enable dialogs by default

MozReview-Commit-ID: JJdxxcP7IeU

--HG--
extra : rebase_source : b5525cbae3822f3e2727788fd63580e6d5bd8293
This commit is contained in:
Andrew Swan 2017-04-10 19:12:23 -07:00
Родитель dbf506b14a
Коммит a02a18c1e5
3 изменённых файлов: 22 добавлений и 0 удалений

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

@ -39,6 +39,7 @@ pref("extensions.checkCompatibility.temporaryThemeOverride_minAppVersion", "29.0
pref("xpinstall.customConfirmationUI", true);
pref("extensions.webextPermissionPrompts", true);
pref("extensions.webextOptionalPermissionPrompts", true);
// Preferences for AMO integration
pref("extensions.getAddons.cache.enabled", true);

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

@ -211,6 +211,13 @@ this.ExtensionsUI = {
addon: {name},
permissions,
});
// If we don't have any promptable permissions, just proceed
if (strings.msgs.length == 0) {
resolve();
return;
}
resolve(this.showPermissionsPrompt(browser, strings, icon));
}
},
@ -334,6 +341,13 @@ this.ExtensionsUI = {
result.text = bundle.formatStringFromName("webextPerms.updateText", [addonName], 1);
result.acceptText = bundle.GetStringFromName("webextPerms.updateAccept.label");
result.acceptKey = bundle.GetStringFromName("webextPerms.updateAccept.accessKey");
} else if (info.type == "optional") {
result.header = bundle.formatStringFromName("webextPerms.optionalPermsHeader", [addonName], 1);
result.text = "";
result.listIntro = bundle.GetStringFromName("webextPerms.optionalPermsListIntro");
result.acceptText = bundle.GetStringFromName("webextPerms.optionalPermsAllow.label");
result.acceptKey = bundle.GetStringFromName("webextPerms.optionalPermsAllow.accessKey");
result.cancelText = bundle.GetStringFromName("webextPerms.optionalPermsDeny.label");
}
return result;

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

@ -154,6 +154,13 @@ function makeTest(manifestPermissions, optionalPermissions, checkFetch = true) {
};
}
add_task(function setup() {
// Don't bother with prompts in this test.
return SpecialPowers.pushPrefEnv({
set: [["extensions.webextOptionalPermissionPrompts", false]],
});
});
const ORIGIN = "*://example.com/";
add_task(makeTest([], {
permissions: ["cookies"],