Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: lib/prefs.js

Issue 29713631: Issue 5760 - Use relative require paths (Closed)
Patch Set: Created March 3, 2018, 4:09 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: lib/prefs.js
===================================================================
--- a/lib/prefs.js
+++ b/lib/prefs.js
@@ -14,17 +14,17 @@
* You should have received a copy of the GNU General Public License
* along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
*/
/** @module prefs */
"use strict";
-const {EventEmitter} = require("events");
+const {EventEmitter} = require("../adblockpluscore/lib/events");
const keyPrefix = "pref:";
let eventEmitter = new EventEmitter();
let overrides = Object.create(null);
/** @lends module:prefs.Prefs */
let defaults = Object.create(null);
@@ -260,17 +260,17 @@
}
function savePref(pref)
{
ext.storage.set(prefToKey(pref), overrides[pref]);
}
let customSave = new Map();
-if (require("info").platform == "gecko")
+if (require("../buildtools/info").platform == "gecko")
{
// Saving one storage value causes all others to be saved as well on Gecko.
// Make sure that updating ad counter doesn't cause the filters data to be
// saved frequently as a side-effect.
const MIN_UPDATE_INTERVAL = 60 * 1000;
let lastUpdate = -MIN_UPDATE_INTERVAL;
let updateScheduled = false;
customSave.set("blocked_total", pref =>
@@ -335,17 +335,18 @@
overrides[keyToPref(key)] = items[key];
resolve();
});
});
let managedLoaded = new Promise(resolve =>
{
- if (require("info").platform == "chromium" && "managed" in browser.storage)
+ if (require("../buildtools/info").platform == "chromium" &&
+ "managed" in browser.storage)
kzar 2018/03/19 21:50:08 Please fix the whitespace here, `"managed"` should
Jon Sonesen 2018/03/20 23:25:18 Acknowledged. Since rebase this require is not nee
{
browser.storage.managed.get(null, items =>
{
// Opera doesn't support browser.storage.managed, but instead simply
// removing the API, Opera sets browser.runtime.lastError when using it.
// So we have to retrieve that error, to prevent it from showing up
// in the console.
browser.runtime.lastError;

Powered by Google App Engine
This is Rietveld