mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 14:22:01 +00:00
Bug 1134553 - Disable downloads in guest session. r=rnewman
--HG-- extra : rebase_source : 0f6d351e9366329046d5096fe7fcad4b800779b3
This commit is contained in:
parent
627343c909
commit
eb3938e55c
@ -16,6 +16,9 @@ XPCOMUtils.defineLazyModuleGetter(this, "Notifications", "resource://gre/modules
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "OS", "resource://gre/modules/osfile.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "Services", "resource://gre/modules/Services.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "ParentalControls",
|
||||
"@mozilla.org/parental-controls-service;1", "nsIParentalControlsService");
|
||||
|
||||
let Log = Cu.import("resource://gre/modules/AndroidLog.jsm", {}).AndroidLog.i.bind(null, "DownloadNotifications");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "strings",
|
||||
@ -58,6 +61,13 @@ var DownloadNotifications = {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ParentalControls.isAllowed(ParentalControls.DOWNLOAD)) {
|
||||
download.cancel().catch(Cu.reportError);
|
||||
download.removePartialData().catch(Cu.reportError);
|
||||
window.NativeWindow.toast.show(strings.GetStringFromName("downloads.disabledInGuest"), "long");
|
||||
return;
|
||||
}
|
||||
|
||||
let notification = new DownloadNotification(download);
|
||||
notifications.set(download, notification);
|
||||
notification.showOrUpdate();
|
||||
|
Loading…
Reference in New Issue
Block a user