From 4b38034536c5bb28a5978dc4071597fe425fb4bc Mon Sep 17 00:00:00 2001 From: FelisCatus Date: Sat, 15 Apr 2017 20:15:54 -0400 Subject: [PATCH] Disable PAC support for webext and remove unsafe-eval. --- .../omega_webext_proxy_script.js | 28 ------------------- .../overlay/manifest.json | 2 -- 2 files changed, 30 deletions(-) diff --git a/omega-target-chromium-extension/omega_webext_proxy_script.js b/omega-target-chromium-extension/omega_webext_proxy_script.js index fc2d36c..3b36a9e 100644 --- a/omega-target-chromium-extension/omega_webext_proxy_script.js +++ b/omega-target-chromium-extension/omega_webext_proxy_script.js @@ -27,8 +27,6 @@ FindProxyForURL = (function () { if (!matchResult) { if (profile.profileType === 'DirectProfile') { return 'DIRECT'; - } else if (profile.pacScript) { - return runPacProfile(profile.pacScript); } else { warn('Warning: Unsupported profile: ' + profile.profileType); return fallbackResult; @@ -59,32 +57,6 @@ FindProxyForURL = (function () { 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) { // We don't have console here and alert is not implemented. // Throwing and messaging seems to be the only ways to communicate. diff --git a/omega-target-chromium-extension/overlay/manifest.json b/omega-target-chromium-extension/overlay/manifest.json index 8544e7e..2b0fa51 100644 --- a/omega-target-chromium-extension/overlay/manifest.json +++ b/omega-target-chromium-extension/overlay/manifest.json @@ -43,8 +43,6 @@ "ftp://*/*", "" ], - "content_security_policy": - "script-src 'self' 'unsafe-eval'; object-src 'self';", "commands": { "_execute_browser_action": { "suggested_key": {