зеркало из 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 : 2389d354029bd0143a3d12e94e6fa4d113229e0b extra : source : 0aa8bb2a9ae0ef4d9f88e97c14ab7ee380eb7e4c
This commit is contained in:
Родитель
52d2723710
Коммит
893f67d3ca
|
@ -1,8 +1,8 @@
|
||||||
const {AddonManagerPrivate} = Cu.import("resource://gre/modules/AddonManager.jsm", {});
|
const {AddonManagerPrivate} = Cu.import("resource://gre/modules/AddonManager.jsm", {});
|
||||||
|
|
||||||
const URL_BASE = "https://example.com/browser/browser/base/content/test/general";
|
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_ICON = "update_icon2@tests.mozilla.org";
|
||||||
const ID_PERMS = "update_perms@tests.mozilla.org";
|
const ID_PERMS = "update_perms@tests.mozilla.org";
|
||||||
const ID_LEGACY = "legacy_update@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");
|
ok(!win.gViewController.isLoading, "about:addons view is fully loaded");
|
||||||
is(win.gViewController.currentViewId, VIEW, "about:addons is at extensions list");
|
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;
|
let panel = yield popupPromise;
|
||||||
checkIconFn(panel.getAttribute("icon"));
|
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();
|
panel.secondaryButton.click();
|
||||||
|
|
||||||
addon = yield AddonManager.getAddonByID(id);
|
addon = yield AddonManager.getAddonByID(id);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
const {AddonManagerPrivate} = Cu.import("resource://gre/modules/AddonManager.jsm", {});
|
const {AddonManagerPrivate} = Cu.import("resource://gre/modules/AddonManager.jsm", {});
|
||||||
|
|
||||||
const URL_BASE = "https://example.com/browser/browser/base/content/test/general";
|
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";
|
const ID_LEGACY = "legacy_update@tests.mozilla.org";
|
||||||
|
|
||||||
registerCleanupFunction(async function() {
|
registerCleanupFunction(async function() {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"addons": {
|
"addons": {
|
||||||
"update@tests.mozilla.org": {
|
"update2@tests.mozilla.org": {
|
||||||
"updates": [
|
"updates": [
|
||||||
{
|
{
|
||||||
"version": "2.0",
|
"version": "2.0",
|
||||||
|
@ -14,7 +14,7 @@
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"update_icon@tests.mozilla.org": {
|
"update_icon2@tests.mozilla.org": {
|
||||||
"updates": [
|
"updates": [
|
||||||
{
|
{
|
||||||
"version": "2.0",
|
"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();
|
progressNotification.remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
let reply = answer => {
|
let strings = this._buildStrings(info);
|
||||||
|
this.showPermissionsPrompt(target, strings, info.icon).then(answer => {
|
||||||
if (answer) {
|
if (answer) {
|
||||||
info.resolve();
|
info.resolve();
|
||||||
} else {
|
} else {
|
||||||
info.reject();
|
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") {
|
} else if (topic == "webextension-update-permissions") {
|
||||||
let info = subject.wrappedJSObject;
|
let info = subject.wrappedJSObject;
|
||||||
info.type = "update";
|
info.type = "update";
|
||||||
|
|
|
@ -2852,6 +2852,7 @@ var AddonManagerInternal = {
|
||||||
info: Object.assign({resolve, reject}, info),
|
info: Object.assign({resolve, reject}, info),
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
subject.wrappedJSObject.info.permissions = info.addon.userPermissions;
|
||||||
Services.obs.notifyObservers(subject, "webextension-permission-prompt", null);
|
Services.obs.notifyObservers(subject, "webextension-permission-prompt", null);
|
||||||
} else if (requireConfirm) {
|
} else if (requireConfirm) {
|
||||||
// The methods below all want to call the install() or cancel()
|
// The methods below all want to call the install() or cancel()
|
||||||
|
|
|
@ -666,6 +666,7 @@
|
||||||
info: {
|
info: {
|
||||||
addon: info.addon,
|
addon: info.addon,
|
||||||
icon: info.addon.iconURL,
|
icon: info.addon.iconURL,
|
||||||
|
permissions: info.addon.userPermissions,
|
||||||
resolve,
|
resolve,
|
||||||
reject,
|
reject,
|
||||||
},
|
},
|
||||||
|
|
Загрузка…
Ссылка в новой задаче