Bug 1134553 - Disable downloads in guest session. r=rnewman

--HG--
extra : rebase_source : 0f6d351e9366329046d5096fe7fcad4b800779b3
This commit is contained in:
Margaret Leibovic 2015-03-12 11:26:12 -07:00
parent 627343c909
commit eb3938e55c

View File

@ -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();