mirror of
https://github.com/zero-peak/ZeroOmega.git
synced 2025-02-02 02:58:13 -05:00
Disable PAC support for webext and remove unsafe-eval.
This commit is contained in:
parent
4dca36a45f
commit
4b38034536
@ -27,8 +27,6 @@ FindProxyForURL = (function () {
|
|||||||
if (!matchResult) {
|
if (!matchResult) {
|
||||||
if (profile.profileType === 'DirectProfile') {
|
if (profile.profileType === 'DirectProfile') {
|
||||||
return 'DIRECT';
|
return 'DIRECT';
|
||||||
} else if (profile.pacScript) {
|
|
||||||
return runPacProfile(profile.pacScript);
|
|
||||||
} else {
|
} else {
|
||||||
warn('Warning: Unsupported profile: ' + profile.profileType);
|
warn('Warning: Unsupported profile: ' + profile.profileType);
|
||||||
return fallbackResult;
|
return fallbackResult;
|
||||||
@ -59,32 +57,6 @@ FindProxyForURL = (function () {
|
|||||||
return fallbackResult;
|
return fallbackResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
function runPacProfile(profile) {
|
|
||||||
var cached = pacCache[profile.name];
|
|
||||||
if (!cached || cached.revision !== profile.revision) {
|
|
||||||
// https://github.com/FelisCatus/SwitchyOmega/issues/390
|
|
||||||
var body = ';\n' + profile.pacScript + '\n\n/* End of PAC */;'
|
|
||||||
body += 'return FindProxyForURL';
|
|
||||||
var func = new Function(body).call(this);
|
|
||||||
|
|
||||||
if (typeof func !== 'function') {
|
|
||||||
warn('Warning: Cannot compile pacScript: ' + profile.name);
|
|
||||||
func = function() { return fallbackResult; };
|
|
||||||
}
|
|
||||||
cached = {func: func, revision: profile.revision}
|
|
||||||
pacCache[cacheKey] = cached;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
// Moz: Most scripts probably won't run without global PAC functions.
|
|
||||||
// Example: dnsDomainIs, shExpMatch, isInNet.
|
|
||||||
// https://bugzilla.mozilla.org/show_bug.cgi?id=1353510
|
|
||||||
return cached.func.call(this);
|
|
||||||
} catch (ex) {
|
|
||||||
warn('Warning: Error occured in pacScript: ' + profile.name, ex);
|
|
||||||
return fallbackResult;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function warn(message, error) {
|
function warn(message, error) {
|
||||||
// We don't have console here and alert is not implemented.
|
// We don't have console here and alert is not implemented.
|
||||||
// Throwing and messaging seems to be the only ways to communicate.
|
// Throwing and messaging seems to be the only ways to communicate.
|
||||||
|
@ -43,8 +43,6 @@
|
|||||||
"ftp://*/*",
|
"ftp://*/*",
|
||||||
"<all_urls>"
|
"<all_urls>"
|
||||||
],
|
],
|
||||||
"content_security_policy":
|
|
||||||
"script-src 'self' 'unsafe-eval'; object-src 'self';",
|
|
||||||
"commands": {
|
"commands": {
|
||||||
"_execute_browser_action": {
|
"_execute_browser_action": {
|
||||||
"suggested_key": {
|
"suggested_key": {
|
||||||
|
Loading…
Reference in New Issue
Block a user