зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1340078 Show the correct permissions list in webextensions notifications r=rhelmer
MozReview-Commit-ID: 5YiYG6k5MJj --HG-- extra : rebase_source : 4e0e7162deb85f0b0bc038fdd619db7138116c53
This commit is contained in:
Родитель
1e00d1c3cf
Коммит
062cdfe8f7
|
@ -1,7 +1,7 @@
|
|||
const {AddonManagerPrivate} = Cu.import("resource://gre/modules/AddonManager.jsm", {});
|
||||
|
||||
const URL_BASE = "https://example.com/browser/browser/base/content/test/general";
|
||||
const ID = "update@tests.mozilla.org";
|
||||
const ID = "update2@tests.mozilla.org";
|
||||
const ID_ICON = "update_icon@tests.mozilla.org";
|
||||
const ID_PERMS = "update_perms@tests.mozilla.org";
|
||||
const ID_LEGACY = "legacy_update@tests.mozilla.org";
|
||||
|
@ -154,9 +154,17 @@ function* backgroundUpdateTest(url, id, checkIconFn) {
|
|||
ok(!win.gViewController.isLoading, "about:addons view is fully loaded");
|
||||
is(win.gViewController.currentViewId, VIEW, "about:addons is at extensions list");
|
||||
|
||||
// Wait for the permission prompt, check the contents, then cancel the update
|
||||
// Wait for the permission prompt, check the contents
|
||||
let panel = yield popupPromise;
|
||||
checkIconFn(panel.getAttribute("icon"));
|
||||
|
||||
// The original extension has 1 promptable permission and the new one
|
||||
// has 2 (history and <all_urls>) plus 1 non-promptable permission (cookies).
|
||||
// So we should only see the 1 new promptable permission in the notification.
|
||||
let list = document.getElementById("addon-webext-perm-list");
|
||||
is(list.childElementCount, 1, "Permissions list contains 1 entry");
|
||||
|
||||
// Cancel the update.
|
||||
panel.secondaryButton.click();
|
||||
|
||||
addon = yield AddonManager.getAddonByID(id);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
const {AddonManagerPrivate} = Cu.import("resource://gre/modules/AddonManager.jsm", {});
|
||||
|
||||
const URL_BASE = "https://example.com/browser/browser/base/content/test/general";
|
||||
const ID = "update@tests.mozilla.org";
|
||||
const ID = "update2@tests.mozilla.org";
|
||||
const ID_LEGACY = "legacy_update@tests.mozilla.org";
|
||||
|
||||
registerCleanupFunction(async function() {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"addons": {
|
||||
"update@tests.mozilla.org": {
|
||||
"update2@tests.mozilla.org": {
|
||||
"updates": [
|
||||
{
|
||||
"version": "2.0",
|
||||
|
@ -14,7 +14,7 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
"update_icon@tests.mozilla.org": {
|
||||
"update_icon2@tests.mozilla.org": {
|
||||
"updates": [
|
||||
{
|
||||
"version": "2.0",
|
||||
|
|
Двоичные данные
browser/base/content/test/general/browser_webext_update1.xpi
Двоичные данные
browser/base/content/test/general/browser_webext_update1.xpi
Двоичный файл не отображается.
Двоичные данные
browser/base/content/test/general/browser_webext_update2.xpi
Двоичные данные
browser/base/content/test/general/browser_webext_update2.xpi
Двоичный файл не отображается.
Двоичный файл не отображается.
Двоичный файл не отображается.
|
@ -120,22 +120,14 @@ this.ExtensionsUI = {
|
|||
progressNotification.remove();
|
||||
}
|
||||
|
||||
let reply = answer => {
|
||||
let strings = this._buildStrings(info);
|
||||
this.showPermissionsPrompt(target, strings, info.icon).then(answer => {
|
||||
if (answer) {
|
||||
info.resolve();
|
||||
} else {
|
||||
info.reject();
|
||||
}
|
||||
};
|
||||
|
||||
let perms = info.addon.userPermissions;
|
||||
if (!perms) {
|
||||
reply(true);
|
||||
} else {
|
||||
info.permissions = perms;
|
||||
let strings = this._buildStrings(info);
|
||||
this.showPermissionsPrompt(target, strings, info.icon).then(reply);
|
||||
}
|
||||
});
|
||||
} else if (topic == "webextension-update-permissions") {
|
||||
let info = subject.wrappedJSObject;
|
||||
info.type = "update";
|
||||
|
|
|
@ -2852,6 +2852,7 @@ var AddonManagerInternal = {
|
|||
info: Object.assign({resolve, reject}, info),
|
||||
}
|
||||
};
|
||||
subject.wrappedJSObject.info.permissions = info.addon.userPermissions;
|
||||
Services.obs.notifyObservers(subject, "webextension-permission-prompt", null);
|
||||
} else if (requireConfirm) {
|
||||
// The methods below all want to call the install() or cancel()
|
||||
|
|
Загрузка…
Ссылка в новой задаче