summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhackademix2019-11-07 15:14:34 +0100
committerhackademix2019-11-07 15:14:34 +0100
commit2b7cc563dd441c08b202b3fbb6d04f577e428de3 (patch)
treea4224c448586eb054d4c7fb439dca892f3347a3d
parent035b4f28275e671a61c3f922cce0d783a9079098 (diff)
downloadnoscript-2b7cc563dd441c08b202b3fbb6d04f577e428de3.tar.gz
noscript-2b7cc563dd441c08b202b3fbb6d04f577e428de3.tar.xz
noscript-2b7cc563dd441c08b202b3fbb6d04f577e428de3.zip
Fixed onionSecure setting persistence issue (Tor ticket #32362).
-rw-r--r--src/bg/main.js2
-rw-r--r--src/test/Policy_test.js7
2 files changed, 7 insertions, 2 deletions
diff --git a/src/bg/main.js b/src/bg/main.js
index 165260c..6e2cdf9 100644
--- a/src/bg/main.js
+++ b/src/bg/main.js
@@ -34,6 +34,8 @@
await ns.savePolicy();
}
+ Sites.onionSecure = ns.local.isTorBrowser;
+
await RequestGuard.start();
await XSS.start(); // we must start it anyway to initialize sub-objects
if (!ns.sync.xss) {
diff --git a/src/test/Policy_test.js b/src/test/Policy_test.js
index a0f92f3..f12183e 100644
--- a/src/test/Policy_test.js
+++ b/src/test/Policy_test.js
@@ -13,7 +13,9 @@
let p2 = new Policy(p1.dry());
debug("p1", JSON.stringify(p1.dry()));
debug("p2", JSON.stringify(p2.dry()));
-
+ let onionSecureCurrent = Sites.onionSecure;
+ Sites.onionSecure = true;
+ p1.set("http://some.onion", p1.TRUSTED);
for(let t of [
() => p2.can("https://noscript.net"),
() => !p2.can("http://noscript.net"),
@@ -29,7 +31,8 @@
() => !p1.can("https://192.168.69.1"),
() => !p1.can("https://10.0.0.1"),
() => p1.can("http://192.168.1.2"),
+ () => p1.can("http://some.onion")
]) Test.run(t);
-
+ Sites.onionSecure = onionSecureCurrent;
Test.report();
}