Bug 1335008 - Part 1 - Move PrivacyLevel.jsm to toolkit. r?mikedeboer
... so we can use it on Android, too. Also fix ESLint errors that are appearing at the new file location.
MozReview-Commit-ID: 3A3aoHm00RJ
--- a/browser/components/sessionstore/PrivacyFilter.jsm
+++ b/browser/components/sessionstore/PrivacyFilter.jsm
@@ -6,17 +6,17 @@
this.EXPORTED_SYMBOLS = ["PrivacyFilter"];
const Cu = Components.utils;
Cu.import("resource://gre/modules/XPCOMUtils.jsm", this);
XPCOMUtils.defineLazyModuleGetter(this, "PrivacyLevel",
- "resource:///modules/sessionstore/PrivacyLevel.jsm");
+ "resource://gre/modules/sessionstore/PrivacyLevel.jsm");
/**
* A module that provides methods to filter various kinds of data collected
* from a tab by the current privacy level as set by the user.
*/
this.PrivacyFilter = Object.freeze({
/**
* Filters the given (serialized) session storage |data| according to the
--- a/browser/components/sessionstore/SessionCookies.jsm
+++ b/browser/components/sessionstore/SessionCookies.jsm
@@ -10,17 +10,17 @@ const Cu = Components.utils;
const Ci = Components.interfaces;
Cu.import("resource://gre/modules/Services.jsm", this);
Cu.import("resource://gre/modules/XPCOMUtils.jsm", this);
XPCOMUtils.defineLazyModuleGetter(this, "Utils",
"resource://gre/modules/sessionstore/Utils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "PrivacyLevel",
- "resource:///modules/sessionstore/PrivacyLevel.jsm");
+ "resource://gre/modules/sessionstore/PrivacyLevel.jsm");
// MAX_EXPIRY should be 2^63-1, but JavaScript can't handle that precision.
const MAX_EXPIRY = Math.pow(2, 62);
/**
* The external API implemented by the SessionCookies module.
*/
this.SessionCookies = Object.freeze({
--- a/browser/components/sessionstore/moz.build
+++ b/browser/components/sessionstore/moz.build
@@ -24,17 +24,16 @@ EXTRA_COMPONENTS += [
EXTRA_JS_MODULES.sessionstore = [
'ContentRestore.jsm',
'DocShellCapabilities.jsm',
'FrameTree.jsm',
'GlobalState.jsm',
'PageStyle.jsm',
'PrivacyFilter.jsm',
- 'PrivacyLevel.jsm',
'RecentlyClosedTabsAndWindowsMenuUtils.jsm',
'RunState.jsm',
'SessionCookies.jsm',
'SessionFile.jsm',
'SessionHistory.jsm',
'SessionMigration.jsm',
'SessionSaver.jsm',
'SessionStorage.jsm',
--- a/toolkit/modules/moz.build
+++ b/toolkit/modules/moz.build
@@ -96,17 +96,20 @@ EXTRA_JS_MODULES += [
'Timer.jsm',
'Troubleshoot.jsm',
'UpdateUtils.jsm',
'WebChannel.jsm',
'WindowDraggingUtils.jsm',
'ZipUtils.jsm',
]
EXTRA_JS_MODULES.third_party.jsesc += ['third_party/jsesc/jsesc.js']
-EXTRA_JS_MODULES.sessionstore += ['sessionstore/Utils.jsm']
+EXTRA_JS_MODULES.sessionstore += [
+ 'sessionstore/PrivacyLevel.jsm',
+ 'sessionstore/Utils.jsm',
+]
DEFINES['INSTALL_COMPACT_THEMES'] = 1
if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('windows', 'cocoa'):
DEFINES['CAN_DRAW_IN_TITLEBAR'] = 1
if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('windows', 'gtk2', 'gtk3'):
DEFINES['MENUBAR_CAN_AUTOHIDE'] = 1
rename from browser/components/sessionstore/PrivacyLevel.jsm
rename to toolkit/modules/sessionstore/PrivacyLevel.jsm
--- a/browser/components/sessionstore/PrivacyLevel.jsm
+++ b/toolkit/modules/sessionstore/PrivacyLevel.jsm
@@ -29,29 +29,29 @@ const PRIVACY_FULL = 2;
var PrivacyLevel = Object.freeze({
/**
* Returns whether the current privacy level allows saving data for the given
* |url|.
*
* @param url The URL we want to save data for.
* @return bool
*/
- check: function (url) {
+ check(url) {
return PrivacyLevel.canSave({ isHttps: url.startsWith("https:") });
},
/**
* Checks whether we're allowed to save data for a specific site.
*
* @param {isHttps: boolean}
* An object that must have one property: 'isHttps'.
* 'isHttps' tells whether the site us secure communication (HTTPS).
* @return {bool} Whether we can save data for the specified site.
*/
- canSave: function ({isHttps}) {
+ canSave({isHttps}) {
let level = Services.prefs.getIntPref(PREF);
// Never save any data when full privacy is requested.
if (level == PRIVACY_FULL) {
return false;
}
// Don't save data for encrypted sites when requested.