mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 14:25:44 +00:00
33f0551ea5
- Bug 1172382 - Enable AccessibleCaret on B2G. r=roc (f5c58c2798) - remove duplicated (8823cc4a43) - Bug 1219310 - part 1 - ask the prefs file for its size directly; r=njn (93073cbc5e) - Bug 1219310 - part 2 - keep track of how much pref file we have read; r=njn (6a2a10a8b1) - Bug 1213123 - Make Preferences::SetString accept char16ptr_t instead of char16_t*. r=froydnj (a895a36861) - Bug 1216901 - Make the FasterMake backend reticulate splines when moz.build or jar.mn files are modified. r=mshal (ed4ec93b18) - Bug 1219122 - Move webapprt.ini definition to moz.build. - Add corresponding webpprt files. (da6bc91b5c) - Bug 1219126 - Move greprefs.js definition in moz.build. r=mshal (52f404c935) - code style (1b1e543834) - Bug 1162690 - Remove malformed uri warning in nsURLParser::ParseURL r=mcmanus (8534fcebb7) - Bug 1163028 - URL: stop escaping [ and ] in path r=mcmanus (f2f3deec40) - Bug 1163030 - URL: stop escaping ` in query r=mcmanus (17d6c07640) - Bug 1191423 - Disallow illegal characters in cookies set via HTTP. r=jduell (b1786d140f) - Bug 1210235 - Skip package verification if pref out or no signature. The package would be treated unsigned. r=valentin (63870dd7ef) - Bug 1216062 - Notify OnStartSignedPackagedRequest with package identifier. r=valentin. (81a14af3db) - Bug 1214079 - Doom the package cache if the signature verification failed. r=valentin (83824c2d5d) - Bug 1178448 - Use imported CA in developer mode. r=keeler,valentin (b9cf64b477) - Bug 1216469 - Bypass verification for signed packages from trust origins. r=valentin (a36d0a6d2f) - Bug 1218284 - Match signed packages' with trust origin without suffix. r=valentin (45529dc7df) - Bug 412457 - should unescape hostname first, then perform IDNA r=mcmanus (23ebe47574) - Bug 1217316 - Remove for-each from netwerk/. r=jduell (8d0ca69e9e) - Bug 1208847 - Add telemetry to measure how often secure cookies are set from non-secure origins r=mcmanus (57ecf3651d) - Bug 1165267 - Part 1: Replace appId and inBrowser by originAttributes v2. r=honzab (7710301407) - Bug 1165267 - Fix downgrading issue by restoring appId and inBrowserElement columns v3. r=honzab (3e8b8e4dfb) - Bug 1221049 - Use originAttributes from TabContext. r=kanru (5eaebe3b28) - Bug 1197944 - Change pref so that the http auth dialog is presented for sub resources as well. r=jduell (e3a7e2a1a7) - Bug 1202421 - Rename the network.auth.allow-subresource-auth pref. r=michal (87e29e1fdf) - Bug 1213577 - Use OriginAttributes in nsHttpAuthManager, r=mcmanus (33d0a25ac4) - Bug 961049 - Part 1: Remove unused members and methods; r=baku (0f3e6de06b)
119 lines
4.4 KiB
JavaScript
119 lines
4.4 KiB
JavaScript
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
const Cc = Components.classes;
|
|
const Ci = Components.interfaces;
|
|
const Cu = Components.utils;
|
|
|
|
const UNKNOWN_FAIL = ["geolocation", "desktop-notification"];
|
|
|
|
Cu.import("resource://gre/modules/Services.jsm");
|
|
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
|
Cu.import("resource://webapprt/modules/WebappRT.jsm");
|
|
|
|
function ContentPermission() {}
|
|
|
|
ContentPermission.prototype = {
|
|
classID: Components.ID("{07ef5b2e-88fb-47bd-8cec-d3b0bef11ac4}"),
|
|
QueryInterface: XPCOMUtils.generateQI([Ci.nsIContentPermissionPrompt]),
|
|
|
|
_getChromeWindow: function(aWindow) {
|
|
return aWindow
|
|
.QueryInterface(Ci.nsIInterfaceRequestor)
|
|
.getInterface(Ci.nsIWebNavigation)
|
|
.QueryInterface(Ci.nsIDocShellTreeItem)
|
|
.rootTreeItem
|
|
.QueryInterface(Ci.nsIInterfaceRequestor)
|
|
.getInterface(Ci.nsIDOMWindow)
|
|
.QueryInterface(Ci.nsIDOMChromeWindow);
|
|
},
|
|
|
|
prompt: function(request) {
|
|
// Only allow exactly one permission request here.
|
|
let types = request.types.QueryInterface(Ci.nsIArray);
|
|
if (types.length != 1) {
|
|
request.cancel();
|
|
return;
|
|
}
|
|
let perm = types.queryElementAt(0, Ci.nsIContentPermissionType);
|
|
|
|
// Reuse any remembered permission preferences
|
|
let result =
|
|
Services.perms.testExactPermissionFromPrincipal(request.principal,
|
|
perm.type);
|
|
|
|
// We used to use the name "geo" for the geolocation permission, now we're
|
|
// using "geolocation". We need to check both to support existing
|
|
// installations.
|
|
if ((result == Ci.nsIPermissionManager.UNKNOWN_ACTION ||
|
|
result == Ci.nsIPermissionManager.PROMPT_ACTION) &&
|
|
perm.type == "geolocation") {
|
|
let geoResult = Services.perms.testExactPermission(request.principal.URI,
|
|
"geo");
|
|
// We override the result only if the "geo" permission was allowed or
|
|
// denied.
|
|
if (geoResult == Ci.nsIPermissionManager.ALLOW_ACTION ||
|
|
geoResult == Ci.nsIPermissionManager.DENY_ACTION) {
|
|
result = geoResult;
|
|
}
|
|
}
|
|
|
|
if (result == Ci.nsIPermissionManager.ALLOW_ACTION) {
|
|
request.allow();
|
|
return;
|
|
} else if (result == Ci.nsIPermissionManager.DENY_ACTION ||
|
|
(result == Ci.nsIPermissionManager.UNKNOWN_ACTION &&
|
|
UNKNOWN_FAIL.indexOf(perm.type) >= 0)) {
|
|
request.cancel();
|
|
return;
|
|
}
|
|
|
|
// Display a prompt at the top level
|
|
let {name} = WebappRT.localeManifest;
|
|
let requestingWindow = request.window.top;
|
|
let chromeWin = this._getChromeWindow(requestingWindow);
|
|
let bundle = Services.strings.createBundle("chrome://webapprt/locale/webapp.properties");
|
|
|
|
// Construct a prompt with share/don't and remember checkbox
|
|
let remember = {value: false};
|
|
let choice = Services.prompt.confirmEx(
|
|
chromeWin,
|
|
bundle.formatStringFromName(perm.type + ".title", [name], 1),
|
|
bundle.GetStringFromName(perm.type + ".description"),
|
|
// Set both buttons to strings with the cancel button being default
|
|
Ci.nsIPromptService.BUTTON_POS_1_DEFAULT |
|
|
Ci.nsIPromptService.BUTTON_TITLE_IS_STRING * Ci.nsIPromptService.BUTTON_POS_0 |
|
|
Ci.nsIPromptService.BUTTON_TITLE_IS_STRING * Ci.nsIPromptService.BUTTON_POS_1,
|
|
bundle.GetStringFromName(perm.type + ".allow"),
|
|
bundle.GetStringFromName(perm.type + ".deny"),
|
|
null,
|
|
bundle.GetStringFromName(perm.type + ".remember"),
|
|
remember);
|
|
|
|
let action = Ci.nsIPermissionManager.ALLOW_ACTION;
|
|
if (choice != 0) {
|
|
action = Ci.nsIPermissionManager.DENY_ACTION;
|
|
}
|
|
|
|
if (remember.value) {
|
|
// Persist the choice if the user wants to remember
|
|
Services.perms.addFromPrincipal(request.principal, perm.type, action);
|
|
} else {
|
|
// Otherwise allow the permission for the current session
|
|
Services.perms.addFromPrincipal(request.principal, perm.type, action,
|
|
Ci.nsIPermissionManager.EXPIRE_SESSION);
|
|
}
|
|
|
|
// Trigger the selected choice
|
|
if (choice == 0) {
|
|
request.allow();
|
|
}
|
|
else {
|
|
request.cancel();
|
|
}
|
|
}
|
|
};
|
|
|
|
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([ContentPermission]);
|