Commit faec8509 authored by Ruben Rodriguez's avatar Ruben Rodriguez

Abrowser: new privacy settings feature

parent c041447d
......@@ -16,14 +16,5 @@
<DT><H3 ADD_DATE="1245542278" LAST_MODIFIED="1245543070" PERSONAL_TOOLBAR_FOLDER="true">@bookmarks_toolbarfolder@</H3>
<DD>@bookmarks_toolbarfolder_description@
<DL><p>
<HR>
<DT><A HREF="http://trisquel.info/" ADD_DATE="1245542718" LAST_MODIFIED="1245542736" ICON_URI="http://trisquel.info/sites/default/themes/trisquel3/favicon.ico" ICON="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAACRklEQVQ4jY2SXU/SYRiHL9xwUzd7s80AzRmzmiKhgCKof0X4C4FHYZtOV2nMWZvTtFyNyQwrX1gwshTzDQQN8f0gD9w6ydo6aJ201Rfoc3Sgs+wg+Z3e9/Xcv117IOWUS1F7NJSNVYMrI3UOoGAgF/PCDg0LccyLK4jRPfTeouNLao+G+rkXWCLzCLNDXBssOJoJs0Po/Q5oy0LVW0jNq3s0LEaAtIMFY7AZMfEDMZLAshDFvvYT++p3TAEXALWhYQrdpwAJ5d5OFB1KbMmP5LrOA21ZWJf3qRipo/hRPjq/GfWgBnFlF/vqPuphDTp/FaZgD8ZAE9qRdozBZqyJHXBngrxVgTXynoJbp9E976ZitA7jxGO0z4w4Nj4gxt9x+aGM4p58Sr0l6HxV2FfjCNNPDurnt5zBEtumqEt+ZNcwOoDsdh7O9U2cW2s0rixhmRvFEglyfWMXcWkeefu5PwKNk/exRKeonrxBTagDw3gLeq8W59Yaju09HOtfsCW+IsY+0TDjO/RxLBLKPSoMAZFSbwkA9bMTODd/IYSfUuK+dCQxtbilNC5/RozGkblzqPT3YXjpQe/TpsZnu85iT37DFL6DKehGNVgIrgzqpsYo61Wm0iATcXkf4XUX1YG7qB5cAdKoCd1EmO5MrYX5rR9rLInMnYNmxEZxtxIh3I8p1HISKgHSyGuSYY0lMUdnqA25EML9iJEE8lYFB1/4v0IlQDoXrl7EONZL/ZsAleN9ZAtKIP0k+O9HpMhbFeh92sPL0n/h3yJfoqCu2Os+AAAAAElFTkSuQmCC">Trisquel GNU/Linux</A>
<DT><A HREF="http://trisquel.info/wiki/" ADD_DATE="1245542718" LAST_MODIFIED="1245542736" ICON_URI="http://trisquel.info/sites/default/themes/trisquel3/favicon.ico" ICON="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAACRklEQVQ4jY2SXU/SYRiHL9xwUzd7s80AzRmzmiKhgCKof0X4C4FHYZtOV2nMWZvTtFyNyQwrX1gwshTzDQQN8f0gD9w6ydo6aJ201Rfoc3Sgs+wg+Z3e9/Xcv117IOWUS1F7NJSNVYMrI3UOoGAgF/PCDg0LccyLK4jRPfTeouNLao+G+rkXWCLzCLNDXBssOJoJs0Po/Q5oy0LVW0jNq3s0LEaAtIMFY7AZMfEDMZLAshDFvvYT++p3TAEXALWhYQrdpwAJ5d5OFB1KbMmP5LrOA21ZWJf3qRipo/hRPjq/GfWgBnFlF/vqPuphDTp/FaZgD8ZAE9qRdozBZqyJHXBngrxVgTXynoJbp9E976ZitA7jxGO0z4w4Nj4gxt9x+aGM4p58Sr0l6HxV2FfjCNNPDurnt5zBEtumqEt+ZNcwOoDsdh7O9U2cW2s0rixhmRvFEglyfWMXcWkeefu5PwKNk/exRKeonrxBTagDw3gLeq8W59Yaju09HOtfsCW+IsY+0TDjO/RxLBLKPSoMAZFSbwkA9bMTODd/IYSfUuK+dCQxtbilNC5/RozGkblzqPT3YXjpQe/TpsZnu85iT37DFL6DKehGNVgIrgzqpsYo61Wm0iATcXkf4XUX1YG7qB5cAdKoCd1EmO5MrYX5rR9rLInMnYNmxEZxtxIh3I8p1HISKgHSyGuSYY0lMUdnqA25EML9iJEE8lYFB1/4v0IlQDoXrl7EONZL/ZsAleN9ZAtKIP0k+O9HpMhbFeh92sPL0n/h3yJfoqCu2Os+AAAAAElFTkSuQmCC">Wiki</A>
<DT><A HREF="http://trisquel.info/donate" ADD_DATE="1245542718" LAST_MODIFIED="1245542736" ICON_URI="http://trisquel.info/sites/default/themes/trisquel3/favicon.ico" ICON="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAACRklEQVQ4jY2SXU/SYRiHL9xwUzd7s80AzRmzmiKhgCKof0X4C4FHYZtOV2nMWZvTtFyNyQwrX1gwshTzDQQN8f0gD9w6ydo6aJ201Rfoc3Sgs+wg+Z3e9/Xcv117IOWUS1F7NJSNVYMrI3UOoGAgF/PCDg0LccyLK4jRPfTeouNLao+G+rkXWCLzCLNDXBssOJoJs0Po/Q5oy0LVW0jNq3s0LEaAtIMFY7AZMfEDMZLAshDFvvYT++p3TAEXALWhYQrdpwAJ5d5OFB1KbMmP5LrOA21ZWJf3qRipo/hRPjq/GfWgBnFlF/vqPuphDTp/FaZgD8ZAE9qRdozBZqyJHXBngrxVgTXynoJbp9E976ZitA7jxGO0z4w4Nj4gxt9x+aGM4p58Sr0l6HxV2FfjCNNPDurnt5zBEtumqEt+ZNcwOoDsdh7O9U2cW2s0rixhmRvFEglyfWMXcWkeefu5PwKNk/exRKeonrxBTagDw3gLeq8W59Yaju09HOtfsCW+IsY+0TDjO/RxLBLKPSoMAZFSbwkA9bMTODd/IYSfUuK+dCQxtbilNC5/RozGkblzqPT3YXjpQe/TpsZnu85iT37DFL6DKehGNVgIrgzqpsYo61Wm0iATcXkf4XUX1YG7qB5cAdKoCd1EmO5MrYX5rR9rLInMnYNmxEZxtxIh3I8p1HISKgHSyGuSYY0lMUdnqA25EML9iJEE8lYFB1/4v0IlQDoXrl7EONZL/ZsAleN9ZAtKIP0k+O9HpMhbFeh92sPL0n/h3yJfoqCu2Os+AAAAAElFTkSuQmCC">Donate</A>
<DT><A HREF="http://store.trisquel.info/" ADD_DATE="1245542718" LAST_MODIFIED="1245542736" ICON_URI="http://store.trisquel.info/favicon.ico" ICON="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAACRklEQVQ4jY2SXU/SYRiHL9xwUzd7s80AzRmzmiKhgCKof0X4C4FHYZtOV2nMWZvTtFyNyQwrX1gwshTzDQQN8f0gD9w6ydo6aJ201Rfoc3Sgs+wg+Z3e9/Xcv117IOWUS1F7NJSNVYMrI3UOoGAgF/PCDg0LccyLK4jRPfTeouNLao+G+rkXWCLzCLNDXBssOJoJs0Po/Q5oy0LVW0jNq3s0LEaAtIMFY7AZMfEDMZLAshDFvvYT++p3TAEXALWhYQrdpwAJ5d5OFB1KbMmP5LrOA21ZWJf3qRipo/hRPjq/GfWgBnFlF/vqPuphDTp/FaZgD8ZAE9qRdozBZqyJHXBngrxVgTXynoJbp9E976ZitA7jxGO0z4w4Nj4gxt9x+aGM4p58Sr0l6HxV2FfjCNNPDurnt5zBEtumqEt+ZNcwOoDsdh7O9U2cW2s0rixhmRvFEglyfWMXcWkeefu5PwKNk/exRKeonrxBTagDw3gLeq8W59Yaju09HOtfsCW+IsY+0TDjO/RxLBLKPSoMAZFSbwkA9bMTODd/IYSfUuK+dCQxtbilNC5/RozGkblzqPT3YXjpQe/TpsZnu85iT37DFL6DKehGNVgIrgzqpsYo61Wm0iATcXkf4XUX1YG7qB5cAdKoCd1EmO5MrYX5rR9rLInMnYNmxEZxtxIh3I8p1HISKgHSyGuSYY0lMUdnqA25EML9iJEE8lYFB1/4v0IlQDoXrl7EONZL/ZsAleN9ZAtKIP0k+O9HpMhbFeh92sPL0n/h3yJfoqCu2Os+AAAAAElFTkSuQmCC">Store</A>
<HR>
<DT><A HREF="http://www.gnu.org/" ADD_DATE="1245542746" LAST_MODIFIED="1245542763" ICON_URI="http://www.gnu.org/graphics/gnu-head-mini.png" ICON="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgBAMAAACBVGfHAAAAGFBMVEVFRUV+fn6mpqa/v7/Ozs7Y2Njg4OD8/Pwuhn+TAAAAAWJLR0QAiAUdSAAAAAlwSFlzAAALEQAACxEBf2RfkQAAAAd0SU1FB9MBDhQ6Gd8s57cAAAEkSURBVHicXdFNc4JADAbgoP0Bi4d6dcGBMzp2z2rrnjulcsavnKuQ9+83K37vDAN5yIZsILws0uv3i7ugLTnAwpjBOsTLOE4VmmKQTFYBioGNKkI5drcCReRItmNAyinSCjianJo6A/aGRtRjtPadpB5CRkQRUaYPGbXW4UgKMfXQxDnJPIeJ0qyOrclrLXoqou8+5p7HM9EkT/JtyEsqB2QYnRv7sT2ArRPLf0kWOp1sA3hYPq3Oh/t0EAjjVIG703II9awr3l3BhxAf5foMLaaasPEZqm5A+0RzGCmuIKJbWi284csIJbzykBQ3aIADsL2CFtBWpovhA1Td7Q6NzqZ/B+38APG3HxU+sYO4B9Akt+AnqGbp/gmwTN6eAWt+gcv6B4rivVin0bWbAAAAAElFTkSuQmCC">GNU&#39;s not UNIX!</A>
<DT><A FEEDURL="http://planet.gnu.org/atom.xml" HREF="http://planet.gnu.org/">GNU Planet</A>
<DT><A HREF="http://www.fsf.org/" ADD_DATE="1245542771" LAST_MODIFIED="1245542780" ICON_URI="http://www.fsf.org/favicon.ico" ICON="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAACXBIWXMAAAsTAAALEwEAmpwYAAADG0lEQVQoFQEQA+/8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAD///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAQECAAAAAAAAAAAAAAAAAAAA2qOp7tTXAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAP///wAAAAAAAOCyt7pUXQcSEgcQDwAAAP///wAAAAAAAAD//x9NSDqNhQEBAQQAAAAAAAAAAAAAAAAQJiQGDQ0aPToZPjoAAQEAAAAAAAAAAAABAQEpZV4AAAAAAAAAAAAA////////////////pSIv05KZ////////////////////////////////AAAAAQAAAP///6krNwAAAAAAAPHc3ggSEQcSEQAAAAAAAAAAABY3NEGelQAAAAAAAAEBAQEAAAD///+YARAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGDg1g690CBgYAAAABAQEEAAAAAAAAS7etAAAAAAAAwGVtHklFIlJOAAAAAAAAAAAAAAAA+/X2BwYGAAAAAAAABAAAAAAAAB1IQwAAAAAAAAYNDBAmJB1IQwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAgL//v4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAAAAAAAAAQEB//7/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAECAv/+/gAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD////////////////cqK3qzM////////////////////////////////8AAAABAAAA////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQEBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGuLjDf9F8oBAAAAAElFTkSuQmCC">Free Software Foundation</A>
</DL><p>
</DL><p>
......@@ -13,7 +13,7 @@ diff -ru firefox-58.0+build6.orig/browser/extensions/activity-stream/lib/Activit
- ["RU", "https://vk.com/,https://www.youtube.com/,https://ok.ru/,https://www.avito.ru/,https://www.aliexpress.com/,https://www.wikipedia.org/"],
- ["GB", "https://www.youtube.com/,https://www.facebook.com/,https://www.reddit.com/,https://www.amazon.co.uk/,https://www.bbc.co.uk/,https://www.ebay.co.uk/"],
- ["FR", "https://www.youtube.com/,https://www.facebook.com/,https://www.wikipedia.org/,https://www.amazon.fr/,https://www.leboncoin.fr/,https://twitter.com/"]
+ ["", "https://www.trisquel.info/,https://www.gnu.org/,https://www.fsf.org/,https://libreplanet.org/,https://www.wikipedia.org/,https://www.wikinews.org/"]
+ [""]
]);
const GEO_PREF = "browser.search.region";
const REASON_ADDON_UNINSTALL = 6;
......@@ -73,7 +73,7 @@ diff -ru firefox-58.0+build6.orig/browser/extensions/activity-stream/lib/Activit
["tippyTop.service.endpoint", {
title: "Tippy Top service manifest url",
- value: "https://activity-stream-icons.services.mozilla.com/v1/icons.json.br"
+ value: "https://127.0.0.1"
+ value: ""
}]
]);
......
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* 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/. */
// Based on the original onboarding code with deep changes from Ruben Rodriguez
// Copyright (C) 2018 Ruben Rodriguez <ruben@gnu.org>
/* globals APP_STARTUP, ADDON_INSTALL */
"use strict";
const {utils: Cu, interfaces: Ci} = Components;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyModuleGetters(this, {
Services: "resource://gre/modules/Services.jsm",
AddonManager: "resource://gre/modules/AddonManager.jsm",
});
const {PREF_STRING, PREF_BOOL, PREF_INT} = Ci.nsIPrefBranch;
const BROWSER_READY_NOTIFICATION = "browser-delayed-startup-finished";
const BROWSER_SESSION_STORE_NOTIFICATION = "sessionstore-windows-restored";
let waitingForBrowserReady = true;
let startupData;
/**
* Set pref. Why no `getPrefs` function is due to the privilege level.
* We cannot set prefs inside a framescript but can read.
* For simplicity and efficiency, we still read prefs inside the framescript.
*
* @param {Array} prefs the array of prefs to set.
* The array element carries info to set pref, should contain
* - {String} name the pref name, such as `browser.onboarding.state`
* - {*} value the value to set
**/
function setPrefs(type, name, value) {
switch (type) {
case "boolean":
Services.prefs.setBoolPref(name, value);
break;
case "integer":
Services.prefs.setIntPref(name, value);
break;
case "string":
Services.prefs.setStringPref(name, value);
break;
default:
throw new TypeError(`Unexpected type (${type}) for preference ${name}.`);
}
}
/**
* Listen and process events from content.
*/
function initContentMessageListener() {
Services.mm.addMessageListener("Onboarding:OnContentMessage", msg => {
setPrefs(type, name, value);
});
}
function flip(id){
var addonObj=-1;
AddonManager.getAddonByID(id, function(addon) {
addonObj=addon;
});
var thread = Components.classes["@mozilla.org/thread-manager;1"].getService().currentThread;
while (addonObj == null || addonObj == -1)
thread.processNextEvent(true);
addonObj.userDisabled = addonObj.isActive;
if ( addonObj.operationsRequiringRestart != 0)
Services.mm.broadcastAsyncMessage("Onboarding:needsrestart");
Services.mm.broadcastAsyncMessage("Onboarding:message-from-chrome", {
id : id,
active : addonObj.isActive,
installed : true
});
}
function checkaddon(id){
var addonObj=-1;
AddonManager.getAddonByID(id, function(addon) {
addonObj=addon;
});
var thread = Components.classes["@mozilla.org/thread-manager;1"].getService().currentThread;
while (addonObj == -1)
thread.processNextEvent(true);
if (addonObj != null)
Services.mm.broadcastAsyncMessage("Onboarding:message-from-chrome", {
id : id,
active : addonObj.isActive,
installed : true
});
else
Services.mm.broadcastAsyncMessage("Onboarding:message-from-chrome", {
id : id,
active : false,
installed : false
});
}
function initContentMessageListener() {
Services.mm.addMessageListener("Onboarding:OnContentMessage", msg => {
switch (msg.data.action) {
case "set-prefs":
setPrefs(msg.data.params[0].type, msg.data.params[0].name, msg.data.params[0].value);
if (msg.data.params[0].name == "browser.search.geoip.url")
setPrefs("boolean", "geo.enabled", msg.data.params[0].value != "" );
if (msg.data.params[0].name == "captivedetect.canonicalURL")
setPrefs("boolean", "network.captive-portal-service.enabled", msg.data.params[0].value != "" )
if (msg.data.params[0].name == "browser.safebrowsing.provider.mozilla.updateURL")
setPrefs("boolean", "privacy.trackingprotection.enabled", msg.data.params[0].value != "" )
setPrefs("boolean", "privacy.trackingprotection.pbmode.enabled", msg.data.params[0].value != "" )
break;
case "flip-addon":
flip(msg.data.params[0].name);
break;
case "check-addon":
checkaddon(msg.data.params[0].name);
break;
}
});
}
/**
* onBrowserReady - Continues startup of the add-on after browser is ready.
*/
function onBrowserReady() {
waitingForBrowserReady = false;
Services.mm.loadFrameScript("resource://onboarding/onboarding.js", true);
initContentMessageListener();
}
/**
* observe - nsIObserver callback to handle various browser notifications.
*/
function observe(subject, topic, data) {
switch (topic) {
case BROWSER_READY_NOTIFICATION:
Services.obs.removeObserver(observe, BROWSER_READY_NOTIFICATION);
onBrowserReady();
break;
case BROWSER_SESSION_STORE_NOTIFICATION:
Services.obs.removeObserver(observe, BROWSER_SESSION_STORE_NOTIFICATION);
break;
}
}
function install(aData, aReason) {}
function uninstall(aData, aReason) {}
function startup(aData, aReason) {
// Cache startup data which contains stuff like the version number, etc.
// so we can use it when we init the telemetry
startupData = aData;
// Only start Onboarding when the browser UI is ready
if (Services.startup.startingUp) {
Services.obs.addObserver(observe, BROWSER_READY_NOTIFICATION);
Services.obs.addObserver(observe, BROWSER_SESSION_STORE_NOTIFICATION);
} else {
onBrowserReady();
}
}
function shutdown(aData, aReason) {
startupData = null;
// Stop waiting for browser to be ready
if (waitingForBrowserReady) {
Services.obs.removeObserver(observe, BROWSER_READY_NOTIFICATION);
}
}
/* 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/. */
// Based on the original onboarding code with deep changes from Ruben Rodriguez
// Copyright (C) 2018 Ruben Rodriguez <ruben@gnu.org>
/* eslint-env mozilla/frame-script */
"use strict";
const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
Cu.import("resource://gre/modules/Services.jsm");
const ABOUT_HOME_URL = "about:home";
const ABOUT_NEWTAB_URL = "about:newtab";
/**
* @param {String} action the action to ask the chrome to do
* @param {Array | Object} params the parameters for the action
*/
function sendMessageToChrome(action, params) {
sendAsyncMessage("Onboarding:OnContentMessage", {
action, params
});
}
/**
* The script won't be initialized if we turned off onboarding by
* setting "browser.onboarding.enabled" to false.
*/
class Onboarding {
constructor(contentWindow) {
this.init(contentWindow);
this.keylist = {
"javascript.enabled": {
type: "boolean",
name: "javascript.enabled",
label: "Disable JavaScript",
description: "Disabling Javascript greatly improves privacy, security and <a href=\"https://www.gnu.org/philosophy/javascript-trap.html\">freedom</a>, but it will break many sites.",
defaultvalue: true,
onvalue: false,
offvalue: true,
},
"browser.display.use_document_fonts": {
type: "integer",
name: "browser.display.use_document_fonts",
label: "Do not load custom fonts",
description: "Custom fonts can be used for <a href=\"https://en.wikipedia.org/wiki/Device_fingerprint\">fingerprinting</a>. Disabling them improves privacy but may make some sites look wrong.",
defaultvalue: 1,
onvalue: 0,
offvalue: 1,
},
"browser.safebrowsing.provider.mozilla.updateURL": {
type: "string",
name: "browser.safebrowsing.provider.mozilla.updateURL",
label: "Tracking protection",
description: "Tracking is the collection of your browsing data across multiple websites. Enabling this feature improves privacy, but will regullarly connect to the Internet to fetch updates to the filters.",
defaultvalue: "",
onvalue: "https://shavar.services.mozilla.com/downloads?client=SAFEBROWSING_ID&appver=%MAJOR_VERSION%&pver=2.2",
offvalue: "",
},
"extensions.update.enabled": {
type: "boolean",
name: "extensions.update.enabled",
label: "Automatically update extensions",
description: "Enabling automated updates is good for security, but would start Internet connections in the background.",
defaultvalue: false,
onvalue: true,
offvalue: false,
},
"network.http.referer.spoofSource": {
type: "boolean",
name: "network.http.referer.spoofSource",
label: "Spoof Referers",
description: "<a href=\"https://en.wikipedia.org/wiki/HTTP_referer\">Referers</a> tell sites what link brought you there. This feature greatly improves your privacy, but it may break functionality on some sites.",
defaultvalue: true,
onvalue: true,
offvalue: false,
},
"captivedetect.canonicalURL": {
type: "string",
name: "captivedetect.canonicalURL",
label: "Detect captive portal",
description: "<a href=\"https://en.wikipedia.org/wiki/Captive_portal\">Captive portals</a> are the sites that control access to public wireless networks in hotels, airports, cafes, etc. The detection service is useful if you connect to such netwoks, but it will start connections automatically.",
defaultvalue: "",
onvalue: "http://detectportal.firefox.com/success.txt",
offvalue: "",
},
"browser.search.geoip.url": {
type: "string",
name: "browser.search.geoip.url",
label: "Enable Geolocation",
description: "This is commonly used for maps, weather sites, and some stores. It is better to keep it off unless you really need it.",
defaultvalue: "",
onvalue: "https://location.services.mozilla.com/v1/country?key=%MOZILLA_API_KEY%",
offvalue: ""
},
"webgl.disabled": {
type: "boolean",
name: "webgl.disabled",
label: "Enable WebGL",
description: "Needed to visualize 3D graphics, but it may expose you to security threats. Enable it only if you really use it.",
defaultvalue: true,
onvalue: false,
offvalue: true
}
}
}
async init(contentWindow) {
this._window = contentWindow;
// Destroy on unloading. This is to ensure we remove all the stuff we left.
// No any leak out there.
this._window.addEventListener("unload", () => this.destroy());
this.uiInitialized = false;
this._window.requestIdleCallback(() => this._initUI());
}
getPref(type, key, def){
switch (type){
case "integer":
return Services.prefs.getIntPref(key, def);
break;
case "string":
return Services.prefs.getStringPref(key, def);
break;
case "boolean":
return Services.prefs.getBoolPref(key, def);
break;
}
}
_callback(id, val){
this._window.document.getElementById(id).checked= (val==this.keylist[id].onvalue);
}
newcheckbox(kind, type, name, label, description, defaultvalue, onvalue, offvalue){
let content = this._window.document.createElement("div");
content.style="border-top: 1px solid #DDDDDD; padding-top:10px";
if (kind == "addon")
sendMessageToChrome("check-addon", [{
name: name,
}]);
else
Services.prefs.addObserver(name, () => {this._callback(name, this.getPref(type, name, defaultvalue));});
content.appendChild(this._window.document.createElement("input"));
content.appendChild(this._window.document.createElement("label"));
content.appendChild(this._window.document.createElement("p"));
content.children[0].id=name;
content.children[0].name=name;
content.children[0].className=kind;
content.children[0].type="checkbox";
content.children[0].style="position:relative; top:2px;";
content.children[0].checked=this.getPref(type, name, defaultvalue)==onvalue;
content.children[0].addEventListener("click", this);
content.children[0].addEventListener("keypress", this);
content.children[1].for=name;
content.children[1].innerHTML=label;
content.children[1].style="font-size:15px";
if (description != ""){
content.children[2].innerHTML=description;
content.children[2].style="padding-left:35px; font-size: small; color:#999; margin-top:5px";
}
return content;
}
_initUI() {
if (this.uiInitialized) {
return;
}
this.uiInitialized = true;
let { body } = this._window.document;
let main = this._window.document.getElementsByTagName("main")[0];
let settingsblock = this._window.document.createElement("div");
settingsblock.style=`border:1px solid #D7D7DB;
border-radius:3px;
margin-bottom:40px;
padding:0 15px 10px 15px;
color:#4A4A4F;
`;
let title = this._window.document.createElement("div");
title.innerHTML=`<h2 style="margin:10px 0 5px; font-size:20px">Privacy settings</h2>
<p style="font-size:14px">These options allow you to tune important aspects of the browser's behavior so you can choose the balance between practicality and privacy that fits your needs. Changes to these settings apply to all existing tabs and windows (but you may need to reload them for the changes to show on them).</p>
`;
main.insertBefore(settingsblock, main.childNodes[0]);
settingsblock.appendChild(title);
for ( var key in this.keylist){
key = this.keylist[key];
settingsblock.appendChild(this.newcheckbox("key", key.type, key.name, key.label, key.description, key.defaultvalue, key.onvalue, key.offvalue));
}
settingsblock.appendChild(this.newcheckbox("addon", null, "uBlock0@raymondhill.net", "uBlock Origin", "Block ads and other intrusing trackers."));
settingsblock.appendChild(this.newcheckbox("addon", null, "jid1-KtlZuoiikVfFew@jetpack", "GNU LibreJs", "Block nonfree <a href=\"https://www.gnu.org/software/librejs/\">JavaScript</a>."));
}
_clearPrefObserver() {
for ( var key in this.keylist){
key = this.keylist[key];
Services.prefs.removeObserver(key.name, () => {this._callbacktest(key.name, this.getPref(key.type, key.name, key.defaultvalue));});
}
}
handleClick(target) {
switch (target.className){
case "addon":
sendMessageToChrome("flip-addon", [{
name: target.name
}]);
return;
break;
case "key":
let value
if (target.checked)
value = this.keylist[target.name].onvalue
else
value = this.keylist[target.name].offvalue
if (target.name == "captivedetect.canonicalURL" && value != "")
this._window.alert("You need to restart the browser to apply this change.\n\nWhen this feature is enabled the browser will automatically\ntry to connect to detectportal.firefox.com at the beginning of each browsing session.");
sendMessageToChrome("set-prefs", [{
type: this.keylist[target.name].type,
name: target.name,
value: value
}]);
return;
break
}
}
/**
* Wrap keyboard focus within the dialog.
* When moving forward, focus on the first element when the current focused
* element is the last one.
* When moving backward, focus on the last element when the current focused
* element is the first one.
* Do nothing if focus is moving in the middle of the list of dialog's focusable
* elements.
*
* @param {DOMNode} current currently focused element
* @param {Boolean} back direction
* @return {DOMNode} newly focused element if any
*/
wrapMoveFocus(current, back) {
let elms = [...this._dialog.querySelectorAll(
`button, input[type="checkbox"], input[type="email"], [tabindex="0"]`)];
let next;
if (back) {
if (elms.indexOf(current) === 0) {
next = elms[elms.length - 1];
next.focus();
}
} else if (elms.indexOf(current) === elms.length - 1) {
next = elms[0];
next.focus();
}
return next;
}
handleKeypress(event) {
let { target, key, shiftKey } = event;
if ([" ", "Enter"].includes(key)) {
this.handleClick(target);
event.preventDefault();
}
return;
}
handleEvent(evt) {
switch (evt.type) {
case "keypress":
this.handleKeypress(evt);
break;
case "click":
this.handleClick(evt.target);
break;
default:
break;
}
}
destroy() {
if (!this.uiInitialized) {
return;
}
this.uiInitialized = false;
this._clearPrefObserver();
}
}
addEventListener("load", function onLoad(evt) {
if (!content || evt.target != content.document) {
return;
}
var window = evt.target.defaultView;
// Set the checked value of addons
function handleMessageFromChrome(message) {
if (! window) return;
var payload = message.data;
var cb = window.document.getElementById(payload.id);
if (cb == null) return;
cb.checked=payload.active;
cb.parentNode.hidden = ! payload.installed;
}
function needsrestart(){
window.alert("This change will be applied when you restart the browser");
}
addMessageListener("Onboarding:message-from-chrome", handleMessageFromChrome);
addMessageListener("Onboarding:needsrestart", needsrestart);
let location = window.location.href;
if (location == ABOUT_NEWTAB_URL || location == ABOUT_HOME_URL) {
// We just want to run tests as quickly as possible
// so in the automation test, we don't do `requestIdleCallback`.
if (Cu.isInAutomation) {
new Onboarding(window);
return;
}
window.requestIdleCallback(() => {
new Onboarding(window);
});
}
}, true);
......@@ -2,7 +2,6 @@
// Release notes and vendor URLs
pref("app.releaseNotesURL", "https://trisquel.info/en/wiki/abrowser-help");
pref("app.vendorURL", "https://trisquel.info/en/wiki/abrowser-help");
pref("privacy.trackingprotection.introURL", "https://trisquel.info/en/wiki/abrowser-help");
// PFS url
pref("pfs.datasource.url", "https://trisquel.info/sites/pfs.php?mime=%PLUGIN_MIMETYPE%");
......@@ -37,8 +36,8 @@ pref("nglayout.initialpaint.delay", 0);
// Disable third party cookies
pref("network.cookie.cookieBehavior", 1);
// Extensions can be updated
pref("extensions.update.enabled", true);
// Extensions cannot be updated without permission
pref("extensions.update.enabled", false);
// Use LANG environment variable to choose locale
pref("intl.locale.matchOS", true);
// Disable default browser checking.
......@@ -52,9 +51,9 @@ pref ("distribution.id", "trisquel");
pref ("distribution.version", "1.0");
// Set useragent to Firefox compatible
pref("general.useragent.compatMode.firefox",true);
pref("general.useragent.compatMode.abrowser",true);
// Spoof the useragent to a generic one
//pref("general.useragent.override", "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:24.0) Gecko/20100101 Firefox/24.0");
//pref("general.useragent.override", "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:24.0) Gecko/20100101 Firefox/58.0");
// Startup pages
......@@ -98,6 +97,7 @@ pref("privacy.donottrackheader.enabled", true);
pref("privacy.donottrackheader.value", 1);
pref("dom.ipc.plugins.flash.subprocess.crashreporter.enabled", false);
pref("browser.safebrowsing.enabled", false);
pref("browser.safebrowsing.downloads.remote.enabled", false);
pref("browser.safebrowsing.malware.enabled", false);
pref("services.sync.privacyURL", "https://trisquel.info/en/legal");
pref("social.enabled", false);
......@@ -125,6 +125,27 @@ pref("browser.newtabpage.directory.ping", "");
pref("browser.newtabpage.introShown", true);
// Disable home snippets
pref("browser.aboutHomeSnippets.updateUrl", "");
// Always ask before restoring the browsing session
pref("browser.sessionstore.max_resumed_crashes", 0);
// Disable tracking protection by default, as it makes automated connections to fetch lists
pref("browser.safebrowsing.provider.mozilla.updateURL", "");
pref("privacy.trackingprotection.enabled", false);
pref("privacy.trackingprotection.pbmode.enabled", false);
pref("privacy.trackingprotection.introURL", "https://www.mozilla.org/%LOCALE%/firefox/%VERSION%/tracking-protection/start/");
// Disable geolocation
pref("geo.enabled", false);
pref("browser.search.geoip.url", "");
// Disable captive portal detection
pref("captivedetect.canonicalURL", "");
pref("network.captive-portal-service.enabled", false);
// Disable shield/heartbeat
pref("extensions.shield-recipe-client.enabled", false);
// Canvas fingerprint protection
pref("privacy.resistFingerprinting", true);
// Webgl can be used for fingerprinting
pref("webgl.disabled", true);"
// Don't reveal your internal IP when WebRTC is enabled
pref("media.peerconnection.ice.no_host", true);
// Services
pref("gecko.handlerService.schemes.mailto.0.name", "");
......@@ -159,7 +180,7 @@ pref("extensions.blocklist.enabled", false);