mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 23:31:56 +00:00
Bug 1392176 Implement prompts for browser.permissions.request() on Android r=kmag,sebastian
MozReview-Commit-ID: Dufy1pRFtgK --HG-- extra : rebase_source : a50bf649d5c2d8ffc0ad143ea7041f34ca28af07
This commit is contained in:
parent
4cef34995e
commit
74fb7fe693
@ -235,6 +235,7 @@ pref("extensions.compatability.locales.buildid", "0");
|
||||
pref("extensions.installDistroAddons", false);
|
||||
|
||||
pref("extensions.webextPermissionPrompts", true);
|
||||
pref("extensions.webextOptionalPermissionPrompts", true);
|
||||
|
||||
// Add-on content security policies.
|
||||
pref("extensions.webextensions.base-content-security-policy", "script-src 'self' https://* moz-extension: blob: filesystem: 'unsafe-eval' 'unsafe-inline'; object-src 'self' https://* moz-extension: blob: filesystem:;");
|
||||
|
@ -10,7 +10,7 @@ var ExtensionPermissions = {
|
||||
// Prepare the strings needed for a permission notification.
|
||||
_prepareStrings(info) {
|
||||
let appName = Strings.brand.GetStringFromName("brandShortName");
|
||||
let info2 = Object.assign({appName, addonName: info.addon.name}, info);
|
||||
let info2 = Object.assign({appName}, info);
|
||||
let strings = ExtensionData.formatPermissionStrings(info2, Strings.browser);
|
||||
|
||||
// We dump the main body of the dialog into a big android
|
||||
@ -43,8 +43,8 @@ var ExtensionPermissions = {
|
||||
switch (topic) {
|
||||
case "webextension-permission-prompt": {
|
||||
let {target, info} = subject.wrappedJSObject;
|
||||
|
||||
let details = this._prepareStrings(info);
|
||||
let stringInfo = Object.assign({addonName: info.addon.name}, info);
|
||||
let details = this._prepareStrings(stringInfo);
|
||||
details.icon = this._prepareIcon(info.icon);
|
||||
details.type = "Extension:PermissionPrompt";
|
||||
let accepted = await EventDispatcher.instance.sendRequestForResult(details);
|
||||
@ -62,6 +62,7 @@ var ExtensionPermissions = {
|
||||
let {addon, resolve, reject} = info;
|
||||
let stringInfo = Object.assign({
|
||||
type: "update",
|
||||
addonName: addon.name,
|
||||
}, info);
|
||||
|
||||
let details = this._prepareStrings(stringInfo);
|
||||
@ -87,10 +88,30 @@ var ExtensionPermissions = {
|
||||
}
|
||||
break;
|
||||
|
||||
case "webextension-optional-permission-prompt":
|
||||
// To be implemented in bug 1392176, just auto-approve until then
|
||||
subject.wrappedJSObject.resolve(true);
|
||||
break;
|
||||
case "webextension-optional-permission-prompt": {
|
||||
let info = subject.wrappedJSObject;
|
||||
let {name, resolve} = info;
|
||||
let stringInfo = Object.assign({
|
||||
type: "optional",
|
||||
addonName: name,
|
||||
}, info);
|
||||
|
||||
let details = this._prepareStrings(stringInfo);
|
||||
|
||||
// If there are no promptable permissions, just apply the update
|
||||
if (details.message.length == 0) {
|
||||
resolve(true);
|
||||
return;
|
||||
}
|
||||
|
||||
// Store all the details about the update until the user chooses to
|
||||
// look at update, at which point we will pick up in this.applyUpdate()
|
||||
details.icon = this._prepareIcon(info.icon || "dummy.svg");
|
||||
|
||||
details.type = "Extension:PermissionPrompt";
|
||||
let accepted = await EventDispatcher.instance.sendRequestForResult(details);
|
||||
resolve(accepted);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -6,8 +6,6 @@ XPCOMUtils.defineLazyServiceGetter(this, "aboutNewTabService",
|
||||
"@mozilla.org/browser/aboutnewtab-service;1",
|
||||
"nsIAboutNewTabService");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "MatchPattern",
|
||||
"resource://gre/modules/MatchPattern.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "PrivateBrowsingUtils",
|
||||
"resource://gre/modules/PrivateBrowsingUtils.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "PromiseUtils",
|
||||
|
@ -130,6 +130,14 @@ webextPerms.updateText=%S has been updated. You must approve new permissions bef
|
||||
|
||||
webextPerms.updateAccept.label=Update
|
||||
|
||||
# LOCALIZATION NOTE (webextPerms.optionalPermsHeader)
|
||||
# %S is replaced with the localized name of the extension requesting new
|
||||
# permissions.
|
||||
webextPerms.optionalPermsHeader=%S requests additional permissions.
|
||||
webextPerms.optionalPermsListIntro=It wants to:
|
||||
webextPerms.optionalPermsAllow.label=Allow
|
||||
webextPerms.optionalPermsDeny.label=Deny
|
||||
|
||||
webextPerms.description.bookmarks=Read and modify bookmarks
|
||||
webextPerms.description.browserSettings=Read and modify browser settings
|
||||
webextPerms.description.browsingData=Clear recent browsing history, cookies, and related data
|
||||
|
Loading…
Reference in New Issue
Block a user