set up chromium polyfill

This commit is contained in:
idk
2019-06-29 00:32:03 -04:00
parent 8a5883ba65
commit 1b7c8fc520
3 changed files with 44 additions and 28 deletions

View File

@ -25,7 +25,7 @@ uninstall:
clobber:
rm -f ../i2psetproxy.js.zip ../i2p_proxy*.xpi
VERSION=1.28
VERSION=1.28-sp
xpi:
mv ~/Downloads/i2p_proxy-$(VERSION)-an+fx.xpi ../i2psetproxy.js@eyedeekay.github.io.xpi
@ -56,3 +56,8 @@ release:
upload:
gothub upload -u eyedeekay -r i2psetproxy.js -t $(VERSION) -n "i2psetproxy.js@eyedeekay.github.io.xpi" -f "../i2psetproxy.js@eyedeekay.github.io.xpi"
lib: libpolyfill
libpolyfill:
wget -O chromium/browser-polyfill.min.js https://unpkg.com/webextension-polyfill/dist/browser-polyfill.min.js

View File

@ -34,7 +34,7 @@
"page": "options/options.html"
},
"background": {
"scripts": ["background.js", "proxy.js", "info.js", "privacy.js" ]
"scripts": ["chromium/browser-polyfill.min.js", "background.js", "proxy.js", "info.js", "privacy.js" ]
},
"default_locale": "en"
}

View File

@ -21,29 +21,33 @@ function disableHyperlinkAuditing() {
// This enables first-party isolation
function enableFirstPartyIsolation() {
var setting = browser.privacy.websites.firstPartyIsolate.set({
value: true
});
console.log("Enabling first party isolation/val=", {
value: true
})
setting.then(onSet);
if (!getChrome()) {
var setting = browser.privacy.websites.firstPartyIsolate.set({
value: true
});
console.log("Enabling first party isolation/val=", {
value: true
})
setting.then(onSet);
}
}
// This rejects tracking cookies and third-party cookies but it
// LEAVES "Persistent" Cookies unmodified in favor of an option in the content
// interface for now
function disableEvilCookies() {
var getting = browser.privacy.websites.cookieConfig.get({});
getting.then((got) => {
var setting = browser.privacy.websites.cookieConfig.set(
{value: {behavior: "reject_third_party",
nonPersistentCookies: got.value.nonPersistentCookies}}
);
console.log("Setting cookie behavior/val=", {value: {behavior: "reject_third_party",
nonPersistentCookies: got.value.nonPersistentCookies}})
setting.then(onSet);
});
if (!getChrome()) {
var getting = browser.privacy.websites.cookieConfig.get({});
getting.then((got) => {
var setting = browser.privacy.websites.cookieConfig.set(
{value: {behavior: "reject_third_party",
nonPersistentCookies: got.value.nonPersistentCookies}}
);
console.log("Setting cookie behavior/val=", {value: {behavior: "reject_third_party",
nonPersistentCookies: got.value.nonPersistentCookies}})
setting.then(onSet);
});
}
}
// Make sure that they're gone
@ -81,13 +85,15 @@ function enableResistFingerprinting() {
// This is essentially a blocklist of clearnet web-sites known to do bad tracking
function enableTrackingProtection() {
var setting = browser.privacy.websites.trackingProtectionMode.set({
value: "always"
});
console.log("Enabling tracking protection/val=", {
value: "always"
})
setting.then(onSet);
if (!getChrome()) {
var setting = browser.privacy.websites.trackingProtectionMode.set({
value: "always"
});
console.log("Enabling tracking protection/val=", {
value: "always"
})
setting.then(onSet);
}
}
// This disables protected content, which is a form of digital restrictions
@ -120,14 +126,18 @@ function setAllPrivacy() {
setAllPrivacy()
function ResetPeerConnection(){
browser.privacy.network.peerConnectionEnabled.set({value: false});
if (!getChrome()) {
browser.privacy.network.peerConnectionEnabled.set({value: false});
}
browser.privacy.network.networkPredictionEnabled.set({value: false});
browser.privacy.network.webRTCIPHandlingPolicy.set({value: "disable_non_proxied_udp"});
console.log("Re-disabled WebRTC")
}
function EnablePeerConnection(){
browser.privacy.network.peerConnectionEnabled.set({value: true});
if (!getChrome()) {
browser.privacy.network.peerConnectionEnabled.set({value: true});
}
browser.privacy.network.networkPredictionEnabled.set({value: false});
browser.privacy.network.webRTCIPHandlingPolicy.set({value: "disable_non_proxied_udp"});
console.log("Enabled WebRTC")
@ -211,4 +221,5 @@ function forgetBrowsingData(storedSettings) {
setAllPrivacy()
ResetPeerConnection()
}