Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • Synzvato/decentraleyes
  • gkrishnaks/decentraleyes
  • ExE-Boss/decentraleyes
  • whtsky/decentraleyes
  • grtgarrett/decentraleyes
  • An_dz/decentraleyes
  • Alaska/decentraleyes
  • finn/decentraleyes
  • klippy/decentraleyes
9 results
Show changes
Commits on Source (18)
locale
data
preferences
webextension
{
"env": {
"es6": true
},
"globals": {
"exports": true,
"module": true,
"require": true,
"Services": true
},
"extends": [
"eslint:recommended",
"plugin:no-unsanitized/DOM"
],
"overrides": {
"files": [
"test/*"
],
"rules": {
"brace-style": "off",
"function-paren-newline": "off",
"max-len": "off"
}
},
"plugins": [
"no-unsanitized"
],
"rules": {
"array-bracket-newline": "error",
"array-bracket-spacing": "error",
"arrow-body-style": "error",
"arrow-parens": "error",
"arrow-spacing": "error",
"block-spacing": "error",
"brace-style": "error",
"camelcase": "error",
"comma-spacing": "error",
"comma-style": "error",
"computed-property-spacing": "error",
"consistent-this": "error",
"curly": "error",
"eol-last": "error",
"eqeqeq": "error",
"func-call-spacing": "error",
"function-paren-newline": "error",
"generator-star-spacing": "error",
"indent": [
"error",
4
],
"key-spacing": "error",
"keyword-spacing": "error",
"linebreak-style": [
"error",
"unix"
],
"new-parens": "error",
"no-array-constructor": "error",
"no-bitwise": "error",
"no-confusing-arrow": "error",
"no-continue": "error",
"no-duplicate-imports": "error",
"no-eval": "error",
"no-extend-native": "error",
"no-implicit-coercion": "error",
"no-implied-eval": "error",
"no-invalid-this": "error",
"no-iterator": "error",
"no-label-var": "error",
"no-labels": "error",
"no-lone-blocks": "error",
"no-loop-func": "error",
"no-multi-spaces": "error",
"no-multi-str": "error",
"no-multiple-empty-lines": [
"error", {
"max": 1,
"maxEOF": 1,
"maxBOF": 0
}
],
"max-len": [
"error", {
"code": 120
}
],
"no-negated-condition": "error",
"no-new": "error",
"no-new-func": "error",
"no-new-object": "error",
"no-new-wrappers": "error",
"no-octal-escape": "error",
"no-proto": "error",
"no-return-assign": "error",
"no-return-await": "error",
"no-script-url": "error",
"no-self-compare": "error",
"no-sequences": "error",
"no-shadow-restricted-names": "error",
"no-tabs": "error",
"no-ternary": "error",
"no-throw-literal": "error",
"no-trailing-spaces": "error",
"no-undef-init": "error",
"no-unmodified-loop-condition": "error",
"no-unused-expressions": "error",
"no-useless-call": "error",
"no-useless-concat": "error",
"no-useless-constructor": "error",
"no-useless-rename": "error",
"no-useless-return": "error",
"no-void": "error",
"no-warning-comments": "warn",
"no-whitespace-before-property": "error",
"no-with": "error",
"object-curly-spacing": "error",
"object-shorthand": [
"error",
"consistent-as-needed"
],
"operator-assignment": "error",
"operator-linebreak": "error",
"prefer-numeric-literals": "error",
"prefer-promise-reject-errors": "error",
"quote-props": "error",
"prefer-rest-params": "error",
"prefer-spread": "error",
"prefer-template": "error",
"quotes": [
"error",
"single"
],
"rest-spread-spacing": "error",
"require-await": "error",
"semi": "error",
"semi-spacing": "error",
"semi-style": "error",
"space-before-blocks": "error",
"space-before-function-paren": "error",
"space-in-parens": "error",
"space-infix-ops": "error",
"space-unary-ops": "error",
"strict": [
"error",
"global"
],
"switch-colon-spacing": "error",
"symbol-description": "error",
"template-curly-spacing": "error",
"template-tag-spacing": "error",
"unicode-bom": "error",
"vars-on-top": "error",
"wrap-regex": "error",
"yield-star-spacing": "error",
"yoda": "error"
}
}
Decentraleyes
=============
A [web browser extension](https://decentraleyes.org) that emulates Content Delivery Networks locally by intercepting requests, finding the required resource and injecting it into the environment. This all happens instantaneously, automatically, and no prior configuration is required. Feel free to use this [testing utility](https://decentraleyes.org/test) to see if it's properly installed, enabled, and correctly configured.
A [web browser extension](https://decentraleyes.org) that emulates Content Delivery Networks to improve your online privacy. It intercepts traffic, finds supported resources locally, and injects them into the environment. All of this happens automatically, so no prior configuration is required. Feel free to use the following [testing utility](https://decentraleyes.org/test) to find out if you are properly protected.
> **Note:** Decentraleyes is no silver bullet, but it does prevent a lot of websites from making you send these kinds of requests. Ultimately, you can make Decentraleyes block requests for any missing CDN resources, too.
## Roadmap
Now that there's a solid, Mozilla approved, foundation, it's time to move forward. Mobility, extensibility (through support for community-powered resource packages), and usability, will be the main points of attention during this phase.
#### Essential Next Steps
* Start work on a resource bundle standard, to allow users to create and import custom resources. With support for these bundles in place, Decentraleyes will still work out of the box, but can be extended if needed.
* To keep this add-on from turning into bloatware, it's important to find out which versions of which libraries are most commonly used on websites, so that less popular resources can be removed from the default bundle.
#### Planned Features
* Advanced policy management for users who block requests for missing resources.
* Smarter resource version interpretation for handling dynamic notations.
* A minimalistic and non-essential graphical user interface.
* Support for custom, importable, library repositories.
> **Note:** These long-term goals are subjective to change, and can be discussed. That is, as long as the suggestions do not conflict with the ultimate goal of realizing a free and open standard for exchanging web resource bundles.
## Submitting Translations
Do you master a non-supported language? Please help out by translating this add-on on [Crowdin](https://crowdin.com/project/decentraleyes).
## Contributing Code
Suggestions in the form of **Issues** and contributions in the form of **Pull Requests** are highly welcome. You can also use the contact details and PGP key on the add-on [download page](https://addons.mozilla.org/firefox/addon/decentraleyes) to get in touch.
Suggestions in the form of **Issues**, and contributions in the form of **Pull Requests**, are highly welcome. You can also use the public contact details and PGP key on the extension's [contact page](https://decentraleyes.org/contact) to get in touch.
#### Prerequisites
* Jetpack Manager [jpm](https://developer.mozilla.org/Add-ons/SDK/Tools/jpm#Installation) (a Node-based replacement for cfx).
* Firefox version 38 or later. *If you need to work with earlier versions of Firefox, you'll need to use the old cfx tool. See instructions for [getting started with cfx](https://developer.mozilla.org/Add-ons/SDK/Tutorials/Getting_started).
* [Jetpack Manager](https://developer.mozilla.org/Add-ons/SDK/Tools/jpm#Installation) ```v1.3.1``` *(or higher)*.
* Mozilla Firefox 38 *(or higher)*.
> **Note:** If you want to contribute to the Firefox Quantum extension, please check out the ```master``` branch. If you are looking for the Chromium-compatible codebase, please see the ```experimental``` branch.
#### Build Instructions (Unix)
#### Building the Code (*nix)
git clone https://github.com/Synzvato/decentraleyes
git clone https://github.com/Synzvato/decentraleyes --branch legacy
cd decentraleyes
jpm xpi
> **Important:** All commits since 26 October 2016 are signed with GPG. It's likely best to ignore unsigned commits, unless you really know what you're doing. Please send an email if you have any questions or security concerns.
## Submitting Translations
Do you master a non-supported language? Please help out by translating this add-on on [Crowdin](https://crowdin.com/project/decentraleyes).
## License
[MPL-2.0](https://www.mozilla.org/MPL/2.0).
......@@ -17,7 +17,7 @@
* Imports
*/
var { Cc, Ci } = require('chrome');
var {Cc, Ci} = require('chrome');
var self = require('sdk/self');
//noinspection JSUnresolvedFunction
......@@ -34,7 +34,7 @@ var files = require('./files');
* Constants
*/
const DELIVERY_NOTICE = '/**\n * Local delivery by Decentraleyes (' + self.version + ').\n */\n\n';
const DELIVERY_NOTICE = `/**\n * Local delivery by Decentraleyes (${self.version}).\n */\n\n`;
/**
* Variables
......@@ -46,7 +46,7 @@ var resourceData = self.data;
* Public Methods
*/
function getRedirectionURI(targetPath, characterSet, type) {
function getRedirectionURI (targetPath, characterSet, type) {
var data, dataURI, redirectionURI;
......@@ -67,9 +67,7 @@ exports.getRedirectionURI = getRedirectionURI;
* Private Methods
*/
function _loadResource(targetPath) {
var resource;
function _loadResource (targetPath) {
// Find the result inside a static path index.
if (!files[targetPath]) {
......@@ -77,24 +75,24 @@ function _loadResource(targetPath) {
}
// Attempt to load resource contents.
return resource = resourceData.load(targetPath);
return resourceData.load(targetPath);
}
function _buildDataURI(type, characterSet, data) {
function _buildDataURI (type, characterSet, data) {
var addNotice, dataURI;
//noinspection JSUnresolvedVariable
addNotice = require('sdk/simple-prefs').prefs.addNotice;
dataURI = 'data:' + type + ';charset=' + characterSet + ',';
dataURI = `data:${type};charset=${characterSet},`;
// Remove the syntax invalidation character.
data = data.substring(1);
if (!addNotice) {
dataURI = dataURI + encodeURIComponent(data);
if (addNotice) {
dataURI += encodeURIComponent(DELIVERY_NOTICE + data);
} else {
dataURI = dataURI + encodeURIComponent(DELIVERY_NOTICE + data);
dataURI += encodeURIComponent(data);
}
return dataURI;
......
......@@ -17,9 +17,11 @@
* Imports
*/
var { Class } = require('sdk/core/heritage');
var { Unknown } = require('sdk/platform/xpcom');
var { Cc, Ci, Cr } = require('chrome');
var {Class} = require('sdk/core/heritage');
var {Unknown} = require('sdk/platform/xpcom');
var {Cc, Ci, Cr} = require('chrome');
var main = require('./main');
/**
* Gets and sets add-on specific preferences.
......@@ -53,15 +55,15 @@ var storage = simpleStorage.storage;
var Interceptor = new Class({
extends: Unknown,
interfaces: ['nsIObserver'],
topic: 'http-on-modify-request',
'extends': Unknown,
'interfaces': ['nsIObserver'],
'topic': 'http-on-modify-request',
register: function () {
'register': function () {
observerService.addObserver(this, this.topic, false);
},
unregister: function () {
'unregister': function () {
observerService.removeObserver(this, this.topic);
},
......@@ -69,9 +71,9 @@ var Interceptor = new Class({
* Called whenever an HTTP request is made.
* @param httpChannel
*/
observe: function (httpChannel) {
'observe': function (httpChannel) {
var validCandidate, target, characterSet, redirectionURI;
var validCandidate, target, characterSet, redirectionURI, initiatorDomain;
// Enable runtime discovery.
httpChannel.QueryInterface(Ci.nsIHttpChannel);
......@@ -83,8 +85,10 @@ var Interceptor = new Class({
return;
}
// Remove referer header from request.
// Remove sensitive headers from the request.
httpChannel.setRequestHeader('Referer', null, false);
httpChannel.setRequestHeader('Origin', null, false);
httpChannel.setRequestHeader('Cookie', null, false);
// Convert the original request URI to a local target.
target = requestAnalyzer.getLocalTarget(httpChannel.URI.host, httpChannel.URI.path);
......@@ -103,11 +107,12 @@ var Interceptor = new Class({
}
// Fix for reported edge-case issues with specific websites.
var initiatorDomain =
httpChannel.loadInfo && httpChannel.loadInfo.loadingDocument && httpChannel.loadInfo.loadingDocument.domain ||
initiatorDomain =
httpChannel.loadInfo && httpChannel.loadInfo.loadingDocument &&
httpChannel.loadInfo.loadingDocument.domain ||
httpChannel.referrer && httpChannel.referrer.host;
if (storage.taintedDomains[initiatorDomain] || /yandex\./.test(initiatorDomain)) {
if (storage.taintedDomains[initiatorDomain] || (/yandex\./).test(initiatorDomain)) {
return this.handleMissingCandidate(httpChannel);
}
......@@ -116,13 +121,14 @@ var Interceptor = new Class({
//noinspection JSUnresolvedVariable
preferences.amountInjected++;
main.broadcastInjection();
},
/**
* Called when a valid candidate cannot be injected.
* @param httpChannel
*/
handleMissingCandidate: function (httpChannel) {
'handleMissingCandidate': function (httpChannel) {
//noinspection JSUnresolvedVariable
if (preferences.blockMissing) {
......
......@@ -17,9 +17,9 @@
* Imports
*/
var { Class } = require('sdk/core/heritage');
var { Unknown, Factory } = require('sdk/platform/xpcom');
var { Cc, Ci, Cu } = require('chrome');
var {Class} = require('sdk/core/heritage');
var {Unknown, Factory} = require('sdk/platform/xpcom');
var {Cc, Ci, Cu} = require('chrome');
var xpcom = require('sdk/platform/xpcom');
......@@ -52,13 +52,14 @@ const REQUEST_ACCEPTATION = Ci.nsIContentPolicy.ACCEPT;
* Variables
*/
var storage = simpleStorage.storage;
var LoadWatcher, storage, undetectableTaintedDomains, factory, unload;
storage = simpleStorage.storage;
/**
* Tainted domains that are not automatically detectable.
* @var {object} undetectableTaintedDomains
*/
var undetectableTaintedDomains = {
undetectableTaintedDomains = {
'identi.ca': true,
'minigames.mail.ru': true,
......@@ -73,7 +74,7 @@ var undetectableTaintedDomains = {
Object.extend = function (destination, source) {
for (var property in source) {
for (let property in source) {
if (source.hasOwnProperty(property)) {
destination[property] = source[property];
......@@ -90,23 +91,35 @@ storage.taintedDomains = Object.extend(storage.taintedDomains, undetectableTaint
* Load Watcher Class
*/
var LoadWatcher = new Class({
LoadWatcher = new Class({
extends: Unknown,
interfaces: ['nsIContentPolicy'],
get wrappedJSObject() {
return this
'extends': Unknown,
'interfaces': ['nsIContentPolicy'],
// eslint-disable-next-line quote-props
get wrappedJSObject () {
return this;
},
register: function () {
'register': function () {
categoryManager.deleteCategoryEntry('content-policy', CONTRACT_ID, false);
categoryManager.addCategoryEntry('content-policy', CONTRACT_ID, CONTRACT_ID, false, true);
},
shouldLoad: function (contentType, contentLocation, requestOrigin, node) {
'shouldLoad': function (contentType, contentLocation, requestOrigin, node) {
let contentHost;
try {
contentHost = contentLocation.host;
} catch (exception) {
// Accept the resource load request.
return REQUEST_ACCEPTATION;
}
if (contentType == SCRIPT_CONTENT_TYPE && mappings[contentLocation.host]) {
if (contentType === SCRIPT_CONTENT_TYPE && mappings[contentHost]) {
if (node instanceof SCRIPT_ELEMENT) {
......@@ -127,22 +140,22 @@ var LoadWatcher = new Class({
* Load Watcher Factory
*/
var factory = Factory({
factory = Factory({
contract: CONTRACT_ID,
Component: LoadWatcher,
unregister: false
'contract': CONTRACT_ID,
'Component': LoadWatcher,
'unregister': false
});
/**
* Unregister
*/
var unload = require('sdk/system/unload');
unload = require('sdk/system/unload');
unload.when(function () {
function trueUnregister() {
function trueUnregister () {
categoryManager.deleteCategoryEntry('content-policy', CONTRACT_ID, false);
......
......@@ -17,15 +17,23 @@
* Imports
*/
var preferences = require('sdk/simple-prefs');
var webextension = null;
var self = require('sdk/self');
var tabs = require('sdk/tabs');
var Interceptor = require('./interceptor');
var LoadWatcher = require('./load-watcher');
var preferences = require('sdk/simple-prefs').prefs;
var self = require('sdk/self');
var tabs = require("sdk/tabs");
/**
* Variables
*/
var webextensionPort = null;
/**
* Main
* Initializations
*/
var interceptor = new Interceptor();
......@@ -36,6 +44,10 @@ var featurelessVersions = {
'1.3.7': true
};
/**
* Main
*/
// Executed as soon as the add-on is loaded.
exports.main = function (options) {
......@@ -43,15 +55,77 @@ exports.main = function (options) {
interceptor.register();
loadWatcher.register();
if (preferences.showReleaseNotes) {
// Display the release notes if desired.
if (preferences.prefs.showReleaseNotes) {
if (options.loadReason === 'install' || (options.loadReason === 'upgrade' && !featurelessVersions[self.version])) {
let loadReason = options.loadReason;
if (preferences['sdk.baseURI']) {
tabs.open(preferences['sdk.baseURI'] + 'static/release-notes.html');
if (loadReason === 'install' || (loadReason === 'upgrade' && !featurelessVersions[self.version])) {
if (preferences.prefs['sdk.baseURI']) {
tabs.open(`${preferences.prefs['sdk.baseURI']}static/release-notes.html`);
}
}
}
try {
webextension = require('sdk/webextension');
} catch (exception) {
return;
}
// Initialize the embedded WebExtension.
webextension.startup().then(({browser}) => {
browser.runtime.onConnect.addListener((port) => {
if (port.name === 'webextension') {
webextensionPort = port;
preferences.on('', function (preferenceName) {
let content = null;
if (preferenceName === 'amountInjected') {
return;
}
if (preferenceName === 'domainWhitelist') {
let domainWhitelist = preferences.prefs['domainWhitelist'];
content = {
'whitelistedDomains': _parseDomainWhitelist(domainWhitelist)
};
} else {
content = {
[preferenceName]: preferences.prefs[preferenceName]
};
}
port.postMessage({
'subject': 'update-preferences',
'content': content
});
});
let domainWhitelist = preferences.prefs['domainWhitelist'];
port.postMessage({
'subject': 'migrate-preferences',
'content': {
'amountInjected': preferences.prefs['amountInjected'],
'blockMissing': preferences.prefs['blockMissing'],
'whitelistedDomains': _parseDomainWhitelist(domainWhitelist),
'showReleaseNotes': preferences.prefs['showReleaseNotes']
}
});
}
});
});
};
// Executed as soon as the add-on is unloaded.
......@@ -60,3 +134,40 @@ exports.onUnload = function () {
// Clean up add-on state.
interceptor.unregister();
};
// Sends injection updates to the WebExtension.
exports.broadcastInjection = function () {
if (webextensionPort !== null) {
webextensionPort.postMessage({
'subject': 'register-injection'
});
}
};
/**
* Private Methods
*/
function _parseDomainWhitelist (value) {
let whitelistedDomains = {};
value.split(';').forEach(function (domain) {
whitelistedDomains[_normalizeDomain(domain)] = true;
});
return whitelistedDomains;
}
function _normalizeDomain (domain) {
domain = domain.toLowerCase().trim();
if (domain.startsWith('www.')) {
domain = domain.slice(4);
}
return domain;
}
......@@ -41,105 +41,48 @@ var mappings = {
'swfobject/{version}/swfobject.': resources.swfobject,
'webfont/{version}/webfont.': resources.webfont,
// Common Shorthand Notations [Deprecated]
// Basic Shorthand Notations [Deprecated]
'dojo/1/dojo/dojo.': {
path: 'resources/dojo/1.6.1/dojo/dojo.js.dec',
type: 'application/javascript'
'path': 'resources/dojo/1.6.1/dojo/dojo.js.dec',
'type': 'application/javascript'
},
'jquery/1/jquery.': {
path: 'resources/jquery/1.11.1/jquery.min.js.dec',
type: 'application/javascript'
},
'jquery/1.2/jquery.min.js': {
path: 'resources/jquery/1.2.6/jquery.min.js.dec',
type: 'application/javascript'
},
'jquery/1.2/jquery.js': {
path: 'resources/jquery/1.2.6/jquery.min.js.dec',
type: 'application/javascript'
},
'jquery/1.3/jquery.min.js': {
path: 'resources/jquery/1.3.2/jquery.min.js.dec',
type: 'application/javascript'
},
'jquery/1.3/jquery.js': {
path: 'resources/jquery/1.3.2/jquery.min.js.dec',
type: 'application/javascript'
},
'jquery/1.4/jquery.min.js': {
path: 'resources/jquery/1.4.4/jquery.min.js.dec',
type: 'application/javascript'
},
'jquery/1.4/jquery.js': {
path: 'resources/jquery/1.4.4/jquery.min.js.dec',
type: 'application/javascript'
},
'jquery/1.5/jquery.min.js': {
path: 'resources/jquery/1.5.2/jquery.min.js.dec',
type: 'application/javascript'
},
'jquery/1.5/jquery.js': {
path: 'resources/jquery/1.5.2/jquery.min.js.dec',
type: 'application/javascript'
},
'jquery/1.6/jquery.min.js': {
path: 'resources/jquery/1.6.4/jquery.min.js.dec',
type: 'application/javascript'
},
'jquery/1.6/jquery.js': {
path: 'resources/jquery/1.6.4/jquery.min.js.dec',
type: 'application/javascript'
},
'jquery/1.7/jquery.min.js': {
path: 'resources/jquery/1.7.2/jquery.min.js.dec',
type: 'application/javascript'
},
'jquery/1.7/jquery.js': {
path: 'resources/jquery/1.7.2/jquery.min.js.dec',
type: 'application/javascript'
},
'jquery/1.8/jquery.min.js': {
path: 'resources/jquery/1.8.3/jquery.min.js.dec',
type: 'application/javascript'
},
'jquery/1.8/jquery.js': {
path: 'resources/jquery/1.8.3/jquery.min.js.dec',
type: 'application/javascript'
'path': 'resources/jquery/1.11.1/jquery.min.js.dec',
'type': 'application/javascript'
},
'jqueryui/1/jquery-ui.js': {
path: 'resources/jqueryui/1.10.4/jquery-ui.min.js.dec',
type: 'application/javascript'
'path': 'resources/jqueryui/1.10.4/jquery-ui.min.js.dec',
'type': 'application/javascript'
},
'jqueryui/1/jquery-ui.min.js': {
path: 'resources/jqueryui/1.10.4/jquery-ui.min.js.dec',
type: 'application/javascript'
'path': 'resources/jqueryui/1.10.4/jquery-ui.min.js.dec',
'type': 'application/javascript'
},
'mootools/1/mootools-yui-compressed.': {
path: 'resources/mootools/1.1.2/mootools-yui-compressed.js.dec',
type: 'application/javascript'
'path': 'resources/mootools/1.1.2/mootools-yui-compressed.js.dec',
'type': 'application/javascript'
},
'prototype/1/prototype.': {
path: 'resources/prototype/1.7.1.0/prototype.js.dec',
type: 'application/javascript'
'path': 'resources/prototype/1.7.1.0/prototype.js.dec',
'type': 'application/javascript'
},
'scriptaculous/1/scriptaculous.': {
path: 'resources/scriptaculous/1.9.0/scriptaculous.js.dec',
type: 'application/javascript'
'path': 'resources/scriptaculous/1.9.0/scriptaculous.js.dec',
'type': 'application/javascript'
},
'swfobject/2/swfobject.': {
path: 'resources/swfobject/2.2/swfobject.js.dec',
type: 'application/javascript'
'path': 'resources/swfobject/2.2/swfobject.js.dec',
'type': 'application/javascript'
},
'webfont/1/webfont.': {
path: 'resources/webfont/1.5.18/webfont.js.dec',
type: 'application/javascript'
'path': 'resources/webfont/1.5.18/webfont.js.dec',
'type': 'application/javascript'
}
}
},
// Microsoft Ajax CDN
'ajax.aspnetcdn.com': {
'/ajax/': {
'jQuery/jquery-{version}.': resources.jQuery,
'jquery/jquery-{version}.': resources.jQuery,
'modernizr/modernizr-{version}.': resources.modernizr
}
......@@ -147,7 +90,6 @@ var mappings = {
// Microsoft Ajax CDN [Deprecated]
'ajax.microsoft.com': {
'/ajax/': {
'jQuery/jquery-{version}.': resources.jQuery,
'jquery/jquery-{version}.': resources.jQuery,
'modernizr/modernizr-{version}.': resources.modernizr
}
......@@ -180,54 +122,14 @@ var mappings = {
'ui/{version}/jquery-ui.js': resources.jQueryUI,
'ui/{version}/jquery-ui.min.js': resources.jQueryUI,
// Common Shorthand Notations [Deprecated]
// Basic Shorthand Notations [Deprecated]
'jquery-latest.': {
path: 'resources/jquery/1.11.1/jquery.min.js.dec',
type: 'application/javascript'
'path': 'resources/jquery/1.11.1/jquery.min.js.dec',
'type': 'application/javascript'
},
'jquery.': {
path: 'resources/jquery/1.11.1/jquery.min.js.dec',
type: 'application/javascript'
},
'jquery-1.3.min.js': {
path: 'resources/jquery/1.3.0/jquery.min.js.dec',
type: 'application/javascript'
},
'jquery-1.3.js': {
path: 'resources/jquery/1.3.0/jquery.min.js.dec',
type: 'application/javascript'
},
'jquery-1.4.min.js': {
path: 'resources/jquery/1.4.0/jquery.min.js.dec',
type: 'application/javascript'
},
'jquery-1.4.js': {
path: 'resources/jquery/1.4.0/jquery.min.js.dec',
type: 'application/javascript'
},
'jquery-1.5.min.js': {
path: 'resources/jquery/1.5.0/jquery.min.js.dec',
type: 'application/javascript'
},
'jquery-1.5.js': {
path: 'resources/jquery/1.5.0/jquery.min.js.dec',
type: 'application/javascript'
},
'jquery-1.6.min.js': {
path: 'resources/jquery/1.6.0/jquery.min.js.dec',
type: 'application/javascript'
},
'jquery-1.6.js': {
path: 'resources/jquery/1.6.0/jquery.min.js.dec',
type: 'application/javascript'
},
'jquery-1.7.min.js': {
path: 'resources/jquery/1.7.0/jquery.min.js.dec',
type: 'application/javascript'
},
'jquery-1.7.js': {
path: 'resources/jquery/1.7.0/jquery.min.js.dec',
type: 'application/javascript'
'path': 'resources/jquery/1.11.1/jquery.min.js.dec',
'type': 'application/javascript'
}
}
},
......@@ -342,6 +244,14 @@ var mappings = {
}
};
// Geekzu Public Service [Mirror]
mappings['sdn.geekzu.org'] = {
'/ajax/ajax/libs/': mappings['ajax.googleapis.com']['/ajax/libs/']
};
// USTC Linux User Group [Mirror]
mappings['ajax.proxy.ustclug.org'] = mappings['ajax.googleapis.com'];
/**
* Exports
*/
......
......@@ -23,6 +23,12 @@
*/
var mappings = require('./mappings');
/**
* Resource version shorthands.
* @var {object} shorthands
*/
var shorthands = require('./shorthands');
/**
* Gets and sets add-on specific preferences.
* @var {object} simplePreferences
......@@ -65,21 +71,26 @@ simplePreferences.on('domainWhitelist', _applyWhitelistPreference);
exports.isValidCandidate = function (httpChannel) {
var initiatorDomain;
// See if the request is targeted at a Content Delivery Network.
if (mappings[httpChannel.URI.host] === undefined) {
return false;
}
// Attempt to determine the domain of the request initiator.
var initiatorDomain =
initiatorDomain =
httpChannel.loadInfo && httpChannel.loadInfo.loadingDocument && httpChannel.loadInfo.loadingDocument.domain ||
httpChannel.referrer && httpChannel.referrer.host;
// If the request initiator could be determined and is whitelisted.
if (initiatorDomain && whitelistedDomains[_normalizeDomain(initiatorDomain)]) {
// Remove referer header from request.
// Remove sensitive headers from the request.
httpChannel.setRequestHeader('Referer', null, false);
httpChannel.setRequestHeader('Origin', null, false);
httpChannel.setRequestHeader('Cookie', null, false);
return false;
}
......@@ -107,14 +118,14 @@ exports.getLocalTarget = function (channelHost, channelPath) {
}
// Return either the local target's path or false.
return _findLocalTarget(resourceMappings, basePath, channelPath);
return _findLocalTarget(resourceMappings, basePath, channelHost, channelPath);
};
/**
* Private Methods
*/
function _matchBasePath(hostMappings, channelPath) {
function _matchBasePath (hostMappings, channelPath) {
for (let basePath of Object.keys(hostMappings)) {
......@@ -126,7 +137,7 @@ function _matchBasePath(hostMappings, channelPath) {
return false;
}
function _findLocalTarget(resourceMappings, basePath, channelPath) {
function _findLocalTarget (resourceMappings, basePath, channelHost, channelPath) {
var resourcePath, versionNumber, resourcePattern;
......@@ -140,8 +151,8 @@ function _findLocalTarget(resourceMappings, basePath, channelPath) {
// Prepare and return a local target.
return {
path: resourceMappings[resourcePath].path,
type: resourceMappings[resourcePath].type
'path': resourceMappings[resourcePath].path,
'type': resourceMappings[resourcePath].type
};
}
......@@ -150,10 +161,26 @@ function _findLocalTarget(resourceMappings, basePath, channelPath) {
if (resourcePattern.startsWith(resourceMold)) {
let targetPath, targetType, hostShorthands;
targetPath = resourceMappings[resourceMold].path;
targetPath = targetPath.replace(VERSION_PLACEHOLDER, versionNumber);
targetType = resourceMappings[resourceMold].type;
hostShorthands = shorthands[channelHost];
if (hostShorthands && hostShorthands[targetPath]) {
let shorthand = hostShorthands[targetPath];
targetPath = shorthand.path;
targetType = shorthand.type;
}
// Prepare and return a local target.
return {
path: resourceMappings[resourceMold].path.replace(VERSION_PLACEHOLDER, versionNumber),
type: resourceMappings[resourceMold].type
'path': targetPath,
'type': targetType
};
}
}
......@@ -161,7 +188,7 @@ function _findLocalTarget(resourceMappings, basePath, channelPath) {
return false;
}
function _normalizeDomain(domain) {
function _normalizeDomain (domain) {
domain = domain.toLowerCase().trim();
......@@ -172,7 +199,7 @@ function _normalizeDomain(domain) {
return domain;
}
function _applyWhitelistPreference() {
function _applyWhitelistPreference () {
whitelistedDomains = {};
......
......@@ -20,74 +20,74 @@
var resources = {
// AngularJS
angular: {
path: 'resources/angularjs/{version}/angular.min.js.dec',
type: 'application/javascript'
'angular': {
'path': 'resources/angularjs/{version}/angular.min.js.dec',
'type': 'application/javascript'
},
// Backbone.js
backbone: {
path: 'resources/backbone.js/{version}/backbone-min.js.dec',
type: 'application/javascript'
'backbone': {
'path': 'resources/backbone.js/{version}/backbone-min.js.dec',
'type': 'application/javascript'
},
// Dojo
dojo: {
path: 'resources/dojo/{version}/dojo/dojo.js.dec',
type: 'application/javascript'
'dojo': {
'path': 'resources/dojo/{version}/dojo/dojo.js.dec',
'type': 'application/javascript'
},
// Ember.js
ember: {
path: 'resources/ember.js/{version}/ember.min.js.dec',
type: 'application/javascript'
'ember': {
'path': 'resources/ember.js/{version}/ember.min.js.dec',
'type': 'application/javascript'
},
// Ext Core
extCore: {
path: 'resources/ext-core/{version}/ext-core.js.dec',
type: 'application/javascript'
'extCore': {
'path': 'resources/ext-core/{version}/ext-core.js.dec',
'type': 'application/javascript'
},
// jQuery
jQuery: {
path: 'resources/jquery/{version}/jquery.min.js.dec',
type: 'application/javascript'
'jQuery': {
'path': 'resources/jquery/{version}/jquery.min.js.dec',
'type': 'application/javascript'
},
// jQuery UI
jQueryUI: {
path: 'resources/jqueryui/{version}/jquery-ui.min.js.dec',
type: 'application/javascript'
'jQueryUI': {
'path': 'resources/jqueryui/{version}/jquery-ui.min.js.dec',
'type': 'application/javascript'
},
// Modernizr
modernizr: {
path: 'resources/modernizr/{version}/modernizr.min.js.dec',
type: 'application/javascript'
'modernizr': {
'path': 'resources/modernizr/{version}/modernizr.min.js.dec',
'type': 'application/javascript'
},
// MooTools
mootools: {
path: 'resources/mootools/{version}/mootools-yui-compressed.js.dec',
type: 'application/javascript'
'mootools': {
'path': 'resources/mootools/{version}/mootools-yui-compressed.js.dec',
'type': 'application/javascript'
},
// Prototype
prototypeJS: {
path: 'resources/prototype/{version}/prototype.js.dec',
type: 'application/javascript'
'prototypeJS': {
'path': 'resources/prototype/{version}/prototype.js.dec',
'type': 'application/javascript'
},
// Scriptaculous
scriptaculous: {
path: 'resources/scriptaculous/{version}/scriptaculous.js.dec',
type: 'application/javascript'
'scriptaculous': {
'path': 'resources/scriptaculous/{version}/scriptaculous.js.dec',
'type': 'application/javascript'
},
// SWFObject
swfobject: {
path: 'resources/swfobject/{version}/swfobject.js.dec',
type: 'application/javascript'
'swfobject': {
'path': 'resources/swfobject/{version}/swfobject.js.dec',
'type': 'application/javascript'
},
// Underscore.js
underscore: {
path: 'resources/underscore.js/{version}/underscore-min.js.dec',
type: 'application/javascript'
'underscore': {
'path': 'resources/underscore.js/{version}/underscore-min.js.dec',
'type': 'application/javascript'
},
// Web Font Loader
webfont: {
path: 'resources/webfont/{version}/webfont.js.dec',
type: 'application/javascript'
'webfont': {
'path': 'resources/webfont/{version}/webfont.js.dec',
'type': 'application/javascript'
}
};
......
/**
* Shorthands
* Belongs to Decentraleyes.
*
* @author Thomas Rientjes
* @since 2018-06-02
* @license MPL 2.0
*
* 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/.
*/
'use strict';
/**
* Shorthands
*/
var shorthands = {
// Google Hosted Libraries [Deprecated]
'ajax.googleapis.com': {
'resources/jquery/1.8/jquery.min.js.dec': {
'path': 'resources/jquery/1.8.3/jquery.min.js.dec',
'version': '1.8.3'
},
'resources/jquery/1.7/jquery.min.js.dec': {
'path': 'resources/jquery/1.7.2/jquery.min.js.dec',
'version': '1.7.2'
},
'resources/jquery/1.6/jquery.min.js.dec': {
'path': 'resources/jquery/1.6.4/jquery.min.js.dec',
'version': '1.6.4'
},
'resources/jquery/1.5/jquery.min.js.dec': {
'path': 'resources/jquery/1.5.2/jquery.min.js.dec',
'version': '1.5.2'
},
'resources/jquery/1.4/jquery.min.js.dec': {
'path': 'resources/jquery/1.4.4/jquery.min.js.dec',
'version': '1.4.4'
},
'resources/jquery/1.3/jquery.min.js.dec': {
'path': 'resources/jquery/1.3.2/jquery.min.js.dec',
'version': '1.3.2'
},
'resources/jquery/1.2/jquery.min.js.dec': {
'path': 'resources/jquery/1.2.6/jquery.min.js.dec',
'version': '1.2.6'
}
},
// jQuery CDN [Deprecated]
'code.jquery.com': {
'resources/jquery/1.7/jquery.min.js.dec': {
'path': 'resources/jquery/1.7.0/jquery.min.js.dec',
'version': '1.7.0'
},
'resources/jquery/1.6/jquery.min.js.dec': {
'path': 'resources/jquery/1.6.0/jquery.min.js.dec',
'version': '1.6.0'
},
'resources/jquery/1.5/jquery.min.js.dec': {
'path': 'resources/jquery/1.5.0/jquery.min.js.dec',
'version': '1.5.0'
},
'resources/jquery/1.4/jquery.min.js.dec': {
'path': 'resources/jquery/1.4.0/jquery.min.js.dec',
'version': '1.4.0'
},
'resources/jquery/1.3/jquery.min.js.dec': {
'path': 'resources/jquery/1.3.0/jquery.min.js.dec',
'version': '1.3.0'
}
}
};
// Geekzu Public Service [Mirror]
shorthands['sdn.geekzu.org'] = shorthands['ajax.googleapis.com'];
// USTC Linux User Group [Mirror]
shorthands['ajax.proxy.ustclug.org'] = shorthands['ajax.googleapis.com'];
/**
* Exports
*/
module.exports = shorthands;
......@@ -3,11 +3,12 @@
"author": "Thomas Rientjes",
"license": "MPL-2.0",
"title": "Decentraleyes",
"version": "1.3.8",
"version": "1.3.10",
"main": "lib/main.js",
"homepage": "https://addons.mozilla.org/firefox/addon/decentraleyes",
"name": "decentraleyes",
"id": "jid1-BoFifL9Vbdl2zQ@jetpack",
"hasEmbeddedWebExtension": true,
"permissions": {
"multiprocess": true
},
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="71.949539mm"
height="72.011383mm"
viewBox="0 0 254.93931 255.15844"
id="svg4398"
version="1.1"
inkscape:version="0.91 r"
sodipodi:docname="logo.svg">
<defs
id="defs4400" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="0.35"
inkscape:cx="-258.95892"
inkscape:cy="-146.70649"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0"
inkscape:window-width="1680"
inkscape:window-height="973"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1" />
<metadata
id="metadata4403">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Laag 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-126.81606,-130.49727)">
<path
sodipodi:nodetypes="ssssssssssssssssssss"
inkscape:connector-curvature="0"
id="path4367-8"
d="m 245.28566,385.4935 c -1.155,-0.13972 -4.395,-0.53641 -7.2,-0.88151 -45.42,-5.58812 -85.0709,-36.18847 -102.1831,-78.8592 -6.3622,-15.8648 -9.0865,-30.16611 -9.0865,-47.70001 0,-35.89696 13.6558,-67.60728 39.9284,-92.71842 17.0912,-16.33567 38.7083,-27.64584 61.7412,-32.30337 16.7067,-3.37829 34.8933,-3.37829 51.6,0 41.3507,8.36157 76.8014,37.96866 92.5831,77.32178 6.3623,15.8648 9.0866,30.16612 9.0866,47.70001 0,17.5339 -2.7243,31.83521 -9.0866,47.70001 -6.0425,15.06754 -14.4277,28.08462 -25.6647,39.84127 -20.588,21.5403 -45.1364,34.33474 -74.4184,38.78637 -5.9247,0.90071 -23.2249,1.60607 -27.3,1.11307 z m 17.6857,-53.06751 c 45.3037,-5.1897 75.6169,-49.07321 64.43,-93.27321 -9.0595,-35.79399 -43.254,-59.73888 -80.1657,-56.13635 -18.159,1.77231 -33.6382,9.0219 -46.3013,21.68499 -15.9043,15.90429 -23.8313,37.80979 -21.6756,59.89801 1.8202,18.64919 9.095,33.85844 22.5088,47.05837 15.872,15.61881 38.6583,23.35086 61.2038,20.76819 z"
style="fill:#69ab90" />
<path
sodipodi:nodetypes="csscssscssccssssssssssss"
inkscape:connector-curvature="0"
id="path4365-3"
d="m 244.08566,343.24287 c -19.8325,-2.76339 -36.9253,-11.17984 -50.4668,-24.84967 -12.1714,-12.28673 -19.6945,-26.27696 -23.4133,-43.54041 -1.9429,-9.01918 -1.9477,-24.56717 -0.01,-33.53235 7.4726,-34.57995 32.7782,-59.88556 67.3581,-67.35817 8.9652,-1.93735 24.5132,-1.93255 33.5324,0.0103 34.4652,7.42443 59.8726,32.85642 67.2826,67.34783 1.9242,8.95661 1.9194,24.52204 -0.01,33.53235 -2.5902,12.09416 -6.332,20.97932 -13.0785,31.05622 -12.4216,18.55349 -31.699,31.47412 -53.8938,36.12229 -6.8627,1.43722 -21.1347,2.07061 -27.3,1.21157 z m 26.4,-11.68384 c 14.5651,-3.28527 26.4945,-9.90141 37.2468,-20.65735 14.7131,-14.71817 22.1494,-32.56191 22.1494,-53.1489 0,-20.53675 -7.476,-38.47761 -22.1473,-53.1489 -14.7557,-14.75566 -32.5941,-22.14727 -53.4489,-22.14727 -15.5114,0 -29.4518,4.23481 -42.8277,13.01025 -5.4935,3.60404 -16.1541,14.26466 -19.7582,19.75814 -8.7115,13.27858 -13.0102,27.33021 -13.0102,42.52778 0,15.27041 4.227,29.14829 12.9053,42.37003 3.736,5.69189 14.327,16.28353 20.017,20.01827 8.7585,5.74873 19.4469,10.12598 29.1738,11.94763 6.4179,1.20193 23.3628,0.89973 29.7,-0.52968 z"
style="fill:#4a856d" />
<path
inkscape:connector-curvature="0"
id="path4502-8"
d="m 254.22586,182.23229 c -15.5114,0 -29.4503,4.23432 -42.8262,13.00976 -5.4935,3.60404 -16.1556,14.26628 -19.7597,19.75977 -8.7115,13.27858 -13.0098,27.32978 -13.0098,42.52734 0,15.27041 4.228,29.1474 12.9063,42.36914 3.736,5.69189 14.3256,16.28479 20.0156,20.01953 8.7585,5.74873 19.4469,10.12562 29.1738,11.94727 6.4179,1.20193 23.364,0.90011 29.7012,-0.5293 14.5651,-3.28527 26.4938,-9.90226 37.2461,-20.6582 14.7131,-14.71817 22.1504,-32.56145 22.1504,-53.14844 0,-20.53674 -7.4772,-38.47714 -22.1485,-53.14844 -14.7557,-14.75566 -32.5944,-22.14843 -53.4492,-22.14843 z"
style="opacity:1;fill:#d9ccb5;fill-opacity:1" />
<path
style="fill:#2a4c3d"
d="m 253.32756,308.56958 c -0.7291,-0.10994 -2.0081,-1.01076 -2.842,-2.00183 -1.487,-1.7672 -1.5162,-1.98991 -1.5162,-11.5511 l 0,-9.74916 -4.1304,-0.40699 c -5.0661,-0.4992 -12.7546,-2.30014 -18.1929,-4.26146 -2.2409,-0.80819 -4.294,-1.46942 -4.5623,-1.46942 -0.2682,0 -0.6564,0.84243 -0.8623,1.87207 -0.6968,3.48392 -4.226,9.7116 -7.2712,12.8307 -3.802,3.89418 -8.4051,6.27484 -12.9251,6.68471 -3.2341,0.29326 -3.5551,0.20092 -5.2728,-1.51669 -2.5896,-2.58958 -2.5847,-5.96539 0.012,-8.15026 1.0771,-0.90628 2.5789,-1.549 3.6197,-1.549 4.8004,0 9.3774,-5.21572 11.2352,-12.80312 0.3947,-1.61191 0.5018,-3.11345 0.2378,-3.33674 -0.2637,-0.2233 -2.2975,-1.67814 -4.5193,-3.23299 -2.2218,-1.55483 -5.7893,-4.5009 -7.9278,-6.5468 -3.5468,-3.39318 -3.8881,-3.93496 -3.8881,-6.16993 0,-3.27415 2.217,-5.60492 5.3315,-5.60492 1.8175,0 3.0132,0.69549 7.2478,4.21598 11.6253,9.66472 22.2411,14.79377 35.3384,17.07396 8.3007,1.44513 22.1289,0.91372 30.0404,-1.15442 11.1729,-2.92067 21.5705,-8.5272 30.5771,-16.48755 4.3014,-3.80174 6.5623,-4.53347 9.368,-3.03191 1.7447,0.93375 3.0959,3.97813 2.6554,5.98335 -0.445,2.02633 -5.5547,7.15181 -11.0967,11.13099 -2.1216,1.52335 -4.0845,2.97485 -4.3619,3.22555 -0.6373,0.5759 0.5815,6.69113 1.9709,9.88821 1.6465,3.78878 4.5666,6.75181 7.1053,7.20973 5.6962,1.02741 7.9829,4.37102 5.8329,8.52872 -2.5386,4.90902 -11.0252,3.6402 -17.4215,-2.60463 -3.4724,-3.39012 -7.1798,-10.11267 -7.8445,-14.22454 -0.2007,-1.24135 -0.5648,-2.38056 -0.8092,-2.53161 -0.2445,-0.15104 -2.1425,0.41541 -4.2181,1.25878 -4.9736,2.02096 -14.3283,4.30786 -19.6416,4.80168 l -4.2584,0.39577 0,9.74056 c 0,9.50554 -0.036,9.78324 -1.4892,11.51041 -1.513,1.79797 -3.1312,2.39416 -5.5208,2.0339 z"
id="path4536"
inkscape:connector-curvature="0" />
<path
style="fill:#e1eee9;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 254.83556,140.64076 c -31.7387,-0.18974 -61.6179,11.99292 -84.3437,34.71875 -19.2305,19.23054 -30.7902,43.12871 -33.9512,70.19142 -1.3361,11.43953 -1.0183,16.42791 1.2832,20.15039 2.2945,3.71129 6.8295,6.27929 11.0898,6.27929 1.9686,0 3.8657,-0.52302 6.0723,-1.67578 2.3104,-1.20696 3.7038,-2.4749 4.9727,-4.52734 1.5844,-2.56277 1.8128,-3.59151 2.2695,-10.17383 0.9548,-13.76166 3.2241,-23.42756 7.9863,-34.02344 4.8964,-10.8945 10.57,-19.12664 18.9707,-27.52735 13.6023,-13.60222 30.1696,-22.21598 49.4278,-25.69727 6.8294,-1.23454 21.9644,-1.36292 29.8183,-0.25195 6.8652,0.97111 8.9703,0.67909 12.6582,-1.76367 5.1358,-3.40177 7.2074,-10.40147 4.6934,-15.85938 -2.6833,-5.82531 -6.3128,-7.71715 -17.2461,-8.99609 -4.5945,-0.53745 -9.1671,-0.81664 -13.7012,-0.84375 z m 97.3086,65.95313 c -7.2562,-0.0333 -13.2012,5.7786 -13.2012,12.90235 0,9.86673 9.6961,16.1965 18.4707,12.05859 3.5411,-1.66991 5.2779,-3.41593 6.6407,-6.67773 3.5811,-8.57084 -2.7182,-18.241 -11.9102,-18.28321 z m -13.2519,100.31836 c -3.6071,0.0573 -6.491,1.78845 -9.7852,5.61915 -8.142,9.46815 -10.1011,11.56562 -14.125,15.11718 -12.131,10.70715 -27.7116,18.23441 -44.5684,21.53125 -8.2715,1.61775 -25.5315,1.44981 -33.9003,-0.33008 -17.6062,-3.7445 -31.6977,-10.96635 -45.17,-23.14843 -6.9218,-6.25889 -9.1571,-7.51953 -13.33,-7.51953 -7.2826,0 -12.856,5.65134 -12.8868,13.06836 -0.023,5.60561 1.5592,8.00611 10.5684,16.02734 17.6591,15.72241 41.3698,26.30955 65.0195,29.03125 6.5438,0.75309 19.554,0.76976 26.2735,0.0352 21.3817,-2.33763 42.0386,-10.55235 59.1679,-23.5293 5.7153,-4.32992 17.4933,-15.95194 21.5508,-21.26563 4.9434,-6.47366 6.0115,-10.10564 4.5449,-15.46679 -0.9767,-3.57003 -5.5201,-7.73635 -9.4687,-8.6836 -1.4052,-0.3371 -2.6883,-0.50541 -3.8906,-0.48633 z"
id="path4557-9"
inkscape:connector-curvature="0" />
<path
style="fill:#ffffff;fill-opacity:1"
d="m 349.19286,302.00389 c -0.3807,-1.92589 -1.1877,-5.81051 -1.7931,-8.63249 -0.6055,-2.822 -0.9964,-5.23726 -0.8688,-5.36731 0.1275,-0.13004 1.0963,0.0708 2.1528,0.44623 2.3769,0.84471 2.5416,0.61955 3.8259,-5.22844 1.1941,-5.43611 2.5992,-7.42233 5.2511,-7.42233 4.0179,0 4.8567,3.49994 2.7212,11.35587 -0.6532,2.40314 -1.1876,4.48237 -1.1876,4.6205 0,0.13813 0.8686,0.56812 1.9301,0.95554 l 1.93,0.70436 -2.6725,2.45042 c -1.4697,1.34773 -4.4553,4.06338 -6.6344,6.03481 l -3.9622,3.58446 -0.6925,-3.50162 z m 7.6678,-36.42262 c -1.3075,-1.07937 -1.4012,-1.66991 -1.8424,-11.61651 -0.5284,-11.90635 -0.2036,-13.2788 3.1413,-13.2788 4.3811,0 5.1405,1.91127 5.6874,14.31444 l 0.3778,8.56307 -1.5475,1.5775 c -1.8251,1.86061 -3.9053,2.01808 -5.8166,0.4403 z m -22.197,-68.26345 c -1.6409,-1.87622 -4.7873,-5.40364 -6.9919,-7.83869 -4.4035,-4.86374 -5.0634,-7.04746 -2.8206,-9.33381 2.9462,-3.00374 5.9731,-1.15075 13.7679,8.42834 5.1777,6.36311 5.7965,8.41643 3.2668,10.83913 -2.2725,2.17651 -3.8995,1.7046 -7.2222,-2.09497 z m -24.0651,-22.6563 c -1.4699,-1.01539 -3.9345,-2.51343 -5.477,-3.32898 l -2.8046,-1.48281 -0.9428,1.85854 -0.9427,1.85853 -1.6168,-2.31075 c -4.1925,-5.99176 -8.4181,-12.30592 -8.2721,-12.36083 0.67,-0.25201 16.8456,-1.55024 17.0448,-1.36799 0.1401,0.12828 -0.1642,1.12916 -0.6766,2.22416 l -0.9311,1.9909 3.0518,1.63467 c 1.6784,0.89907 4.3879,2.66513 6.0209,3.92459 2.4695,1.90441 2.9996,2.65699 3.1495,4.47038 0.1462,1.76666 -0.1227,2.42342 -1.4161,3.4607 -2.1206,1.70046 -3.0192,1.61752 -6.1872,-0.57111 z"
id="path4676"
inkscape:connector-curvature="0" />
<svg width="71.95mm" height="72.011mm" version="1.1" viewBox="0 0 254.94 255.16" xmlns="http://www.w3.org/2000/svg">
<g transform="translate(-126.82 -130.5)">
<g transform="matrix(.8841 0 0 .88486 709.88 194.18)">
<circle cx="-515.32" cy="72.214" r="144.18" fill="#69ab90"/>
<circle cx="-515.13" cy="72.402" r="96.804" fill="#4a856d"/>
<circle cx="-515.32" cy="72.214" r="85.491" fill="#d9ccb5"/>
<path d="m-514.62-60.244c-35.857-0.21436-69.613 13.549-95.287 39.223-21.726 21.726-34.785 48.725-38.356 79.299-1.5095 12.924-1.1505 18.559 1.4496 22.765 2.5923 4.1928 7.7157 7.094 12.529 7.094 2.224 0 4.3673-0.59088 6.8602-1.8932 2.6102-1.3636 4.1843-2.796 5.6179-5.1148 1.79-2.8953 2.048-4.0575 2.5639-11.494 1.0787-15.547 3.6425-26.467 9.0225-38.438 5.5317-12.308 11.942-21.608 21.432-31.099 15.367-15.367 34.084-25.098 55.841-29.031 7.7155-1.3947 24.814-1.5398 33.687-0.28464 7.756 1.0971 10.134 0.7672 14.301-1.9925 5.8022-3.8431 8.1425-11.751 5.3024-17.917-3.0315-6.5811-7.1319-8.7184-19.484-10.163-5.1906-0.60718-10.356-0.9226-15.479-0.95322zm109.93 74.51c-8.1977-0.03762-14.914 6.5284-14.914 14.576 0 11.147 10.954 18.298 20.867 13.623 4.0006-1.8866 5.9627-3.8591 7.5023-7.5442 4.0457-9.6829-3.0709-20.608-13.456-20.655zm-14.971 113.33c-4.0751 0.0647-7.3332 2.0205-11.055 6.3482-9.1984 10.697-11.412 13.066-15.958 17.079-13.705 12.096-31.307 20.6-50.351 24.325-9.3447 1.8276-28.844 1.6379-38.299-0.3729-19.891-4.2303-35.81-12.389-51.031-26.152-7.8199-7.071-10.345-8.4952-15.06-8.4952-8.2275 0-14.524 6.3846-14.559 14.764-0.026 6.3329 1.7615 9.0449 11.94 18.107 19.95 17.762 46.738 29.723 73.456 32.798 7.3929 0.8508 22.091 0.86962 29.682 0.0398 24.156-2.6409 47.493-11.922 66.845-26.582 6.4568-4.8917 19.763-18.022 24.347-24.025 5.5848-7.3136 6.7915-11.417 5.1346-17.474-1.1034-4.0332-6.2363-8.7401-10.697-9.8103-1.5875-0.38083-3.0371-0.57098-4.3954-0.54943z" fill="#e1eee9" fill-rule="evenodd"/>
<g fill="#fff">
<path d="m-398.82 91.611c-2.2815-0.10063-3.476 1.6445-4.709 6.2656-0.72585 2.3218-0.8127 3.4136-1.5879 5.7129l-1.1328 3.4004-2.2207-0.7832-2.2207-0.78125 0.48242 3.1484c1.2524 8.1662 2.7305 16.622 2.8926 16.553 1.7355-1.3997 8.0109-6.6523 15.238-12.561 0 0-1.199-0.43109-2.5371-0.91406l-2.3144-0.90039 1.2168-3.7168c0.66905-2.0444 1.5029-5.601 1.8535-7.9043 0.10026-0.65807 0.14896-1.1589 0.19727-1.6621 0.13779-3.332-0.88319-4.7139-3.3906-5.5059-0.6561-0.20727-1.2411-0.32834-1.7676-0.35157z"/>
<path d="m-444.37-21.129c-1.5821 1.6469-3.6508 1.2077-7.7315-1.2869-2.1272-1.1799-2.9434-1.9104-5.0908-3.04l-3.166-1.68-1.0672 2.099-1.0686 2.0976-1.8229-2.612c-4.7273-6.7756-9.491-13.916-9.326-13.978 2.222-0.18409 10.389-0.7113 19.697-1.4206 0 0-0.57051 1.1392-1.206 2.4121l-1.0542 2.2486 3.4451 1.8511c1.8947 1.0183 4.9521 3.0176 6.795 4.4431 0.52659 0.4072 0.90738 0.73615 1.2895 1.0671 2.3985 2.3169 2.6128 4.0217 1.3441 6.3249-0.33194 0.60269-0.67188 1.0939-1.037 1.474z"/>
<path d="m-432.68-16.955c-0.92625 0.11186-1.7636 0.61843-2.5957 1.4668-2.5338 2.583-1.7893 5.0501 3.1855 10.545 2.4906 2.751 6.0466 6.7358 7.9004 8.8555 3.7538 4.2926 5.5909 4.8261 8.1582 2.3672 2.8579-2.737 2.1581-5.0574-3.6914-12.246-6.6046-8.1165-10.178-11.324-12.957-10.988z"/>
<path d="m-400.77 75.155c-0.1731-2.8106-0.55381-8.1371-0.84577-11.837-0.58317-7.3893 0.33368-9.7981 3.9172-10.296 4.7082-0.65411 6.1374 3.0921 6.5005 17.04 0.24112 9.2648-0.62148 11.529-4.5568 11.95-3.5346 0.37895-4.6643-1.1658-5.0151-6.8574z"/>
</g>
<path d="m-453.01 64.994c-2.1109-0.01867-4.3622 1.2952-7.7031 4.248-10.175 8.9932-21.922 15.327-34.545 18.627-8.938 2.3365-24.56 2.9354-33.938 1.3027-14.797-2.576-26.79-8.3704-39.924-19.289-4.784-3.9773-6.1342-4.7617-8.1875-4.7617-3.5186 0-6.0234 2.6331-6.0234 6.332 0 2.525 0.38568 3.1373 4.3926 6.9707 2.416 2.3114 6.445 5.638 8.9551 7.3945 2.51 1.7566 4.8076 3.4001 5.1055 3.6523 0.2983 0.25226 0.17832 1.9504-0.26758 3.7715-1.4733 6.0171-4.278 10.442-7.6934 12.551-1.1265 0.76846-2.2641 1.2685-3.3203 1.3828-6.5363 0.70717-9.3955 4.3121-7.293 9.1953 1.6698 3.8781 6.6162 4.7935 12.031 2.9883 0.24651-0.0848 0.49286-0.16918 0.73829-0.26368 0.23829-0.0897 0.47741-0.18505 0.71679-0.28515 0.49332-0.20988 0.98411-0.43326 1.4707-0.68164 0.0508-0.0257 0.10153-0.0481 0.15234-0.0742 1.8138-0.94212 3.5716-2.1505 5.2266-3.5957 0.14038-0.12553 0.28085-0.25756 0.42188-0.39063 0.20456-0.18578 0.40438-0.38109 0.60547-0.57422 1.7137-1.7335 3.4328-3.9476 4.8926-6.2402 0.20605-0.3236 0.39292-0.64933 0.58789-0.97461 0.10747-0.18366 0.22362-0.36247 0.32813-0.54688 1.5252-2.6914 2.7177-5.4344 3.1113-7.4023 0.2326-1.1632 0.67161-2.1152 0.97461-2.1152 0.3031-1e-5 2.6227 0.7471 5.1543 1.6602 6.1439 2.2158 14.829 4.2505 20.553 4.8144l4.668 0.45899v11.014c0 10.802 0.033 11.054 1.7129 13.051 0.9421 1.1196 2.3872 2.1375 3.2109 2.2617 2.6996 0.407 4.527-0.26757 6.2363-2.2988 1.6414-1.9513 1.6836-2.265 1.6836-13.004v-11.004l4.8105-0.44727c6.0027-0.55789 16.571-3.1406 22.189-5.4238 2.3449-0.9528 4.4893-1.5925 4.7656-1.4219 0.2761 0.17065 0.68736 1.457 0.91406 2.8594 0.7511 4.6454 4.9402 12.24 8.8633 16.07 7.2261 7.0551 16.814 8.4874 19.682 2.9414 2.429-4.6972-0.15457-8.474-6.5898-9.6348-2.868-0.51734-6.1671-3.8642-8.0273-8.1445-1.5696-3.6119-2.9464-10.521-2.2266-11.172 0.3135-0.28323 2.5308-1.9235 4.9277-3.6445 6.261-4.4955 12.034-10.285 12.537-12.574 0.49754-2.2654-1.0289-5.7049-3-6.7598-0.99058-0.53012-1.9214-0.81378-2.8809-0.82227z" fill="#2a4c3d"/>
</g>
</g>
</svg>
......@@ -111,13 +111,13 @@
<div class="container">
<h1>Decentraleyes <i>v1.3.8</i></h1>
<h1>Decentraleyes <i>v1.3.10</i></h1>
<br><br>
<div class="notice">
<span class="subtle-hint"><span class="topic-label">Project Status:</span> Decentraleyes is currently <a href="https://github.com/Synzvato/decentraleyes/tree/experimental#decentraleyes-experimental" target="_blank">being rewritten</a> from scratch. This means that the next major release will be featuring an all new foundation, and will be less shy about what it does to protect you!</span>
<span class="subtle-hint"><span class="topic-label">Important:</span> This update automatically migrates your existing settings over to the upcoming (completely rewritten) version of Decentraleyes. The next release will be <span class="help-panel" data-title="It will feature an optional graphical user interface.">less shy</span>, and fully ready for future versions of Firefox.</span>
<br><br><hr>
......@@ -127,173 +127,15 @@
<div class="notice">
<span class="subtle-hint"><span class="topic-label">Pro Tip:</span> Would you rather not see this page after installations or updates? You can disable it by navigating to <strong>about:config</strong> (in a new tab), then searching for <strong>BoFifL9V</strong>, and setting <strong>showReleaseNotes</strong> to false.</span>
<span class="subtle-hint"><span class="topic-label">For Firefox Nightly Users:</span> You can start using a beta version of the upcoming release today. Please see <a href="https://github.com/Synzvato/decentraleyes/issues/173#issuecomment-322821857" target="_blank">this announcement</a> for more information on how to get started. Feel free to leave feedback!</span>
<br><br><hr>
</div>
<br>
<div class="notice">
<span class="topic-label">New:</span> <strong>Additional language.</strong> This add-on is now available in <span class="subtle-text"><span class="help-panel" data-title="Thanks to CodeSigils.">Greek</span>.
<br><br><hr>
</div>
<br>
<div class="notice">
<i>Release Notes for version 1.3.6:</i>
<br><br>
<span class="topic-label">New:</span> <strong>Multi-process support.</strong> The add-on now officially supports multi-process tabs. Compatibility was tested with the help of several <span class="help-panel" data-title="Thank you Andreas, Bisaloo, dralley, gitarra, OdinGitDat, and TriMoon.">volunteers</span>. The feature enhances security and performance.
<br><br><hr>
</div>
<br>
<div class="notice">
<i>Release Notes for version 1.3.5:</i>
<br><br>
<span class="topic-label">New:</span> <strong>Additional languages.</strong> Languages <span class="subtle-text"><span class="help-panel" data-title="Thanks to Petercpg.">Chinese <i>(Traditional)</i></span>, <span class="help-panel" data-title="Thanks to Mikini.">Danish</span>, <span class="help-panel" data-title="Thanks to Spagy.">Esperanto</span>, <span class="help-panel" data-title="Thanks to Najoj.">Swedish</span>, and <span class="help-panel" data-title="Thanks to Msva.">Russian</span></span> were added to the list of fourteen initial translations. This brings the total to nineteen.
<br><br>
<span class="topic-label">Enhanced:</span> <strong>Improved CDN-mappings.</strong> The add-on now supports a greater amount of Google Hosted Libraries shorthand mappings. This effectively means that it's now able to detect even more injection opportunities, and can prevent an even higher amount of requests to this particular network.
<br><br><hr>
</div>
<br>
<div class="notice">
<i>Release Notes for version 1.3.0:</i>
<br><br>
<span class="topic-label">New:</span> <strong>Let there be languages.</strong> This version supports locales and features fourteen <a href="https://github.com/Synzvato/decentraleyes/issues/44" target="_blank">initial translations</a>: <span class="subtle-text"> <span class="help-panel" data-title="Thanks to AdmiralAnimE.">Bulgarian</span>, <span class="help-panel" data-title="Thanks to Louy2 and YFdyh000.">Chinese <i>(Simplified)</i></span>, Dutch, English <i>(United Kingdom)</i>, English <i>(United States)</i>, <span class="help-panel" data-title="Thanks to Semired.">Finnish</span>, <span class="help-panel" data-title="Thanks to Simpson, Thuban, and TraderStf."> French</span>, <span class="help-panel" data-title="Thanks to C4R2T3N, Flysch, Sabajo, and Schnaidar.">German</span>, <span class="help-panel" data-title="Thanks to Zmni.">Indonesian</span>, <span class="help-panel" data-title="Thanks to Mtvento.">Italian</span>, <span class="help-panel" data-title="Thanks to Brindflontia.">Japanese</span>, <span class="help-panel" data-title="Thanks to Marekjm.">Polish</span>, <span class="help-panel" data-title="Thanks to SW1FTmeister.">Portuguese <i>(European)</i></span>, and <span class="help-panel" data-title="Thanks to Adri and Ergotronix.">Spanish</span></span>.
<br><br>
<span class="topic-label">New:</span> <strong>Official support for SeaMonkey.</strong> If you use SeaMonkey <i>(a free and open-source internet suite consisting of a web browser, an e-mail client, and a news aggregator)</i>, you might be glad to know that this release is fully compatible with all modern versions of the application.
<br><br>
<span class="topic-label">Enhanced:</span> <strong>A large amount of internal changes for improved performance and stability.</strong> A lot of work has gone into making this version as fast and reliable as possible. As a result, this release proudly brings you an even more optimized, carefree, and stable overall experience.
<br><br><hr><br>
<span class="subtle-hint"><span class="topic-label">Getting started:</span> Decentraleyes works right out of the box and no manual configuration is required! You can check if you're properly protected by using the following <strong><a href="https://decentraleyes.org/test" target="_blank">testing utility</a></strong>.</span>
<br><br>
<span class="subtle-hint">To get a glimpse of what this add-on actually does for you, go to this application's main menu, click <strong>"Add-ons" > "Decentraleyes" > "Preferences"</strong>, scroll down, and familiarize yourself with the local injections counter.</span>
<br><br><hr>
</div>
<br>
<div class="notice">
<i>Detailed v1.3.8 changelog:</i>
<ul>
<li>Applied a minor <span class="help-panel" data-title="Suggested by mu6.">spelling change</span> to the Dutch localization.</li>
<li>Added support for the Greek language.</li>
</ul>
</div>
<br>
<div class="notice">
<i>Detailed v1.3.7 changelog:</i>
<ul>
<li>Fixed issues with localized variants of various Yandex services.</li>
</ul>
</div>
<br>
<div class="notice">
<i>Detailed v1.3.6 changelog:</i>
<ul>
<li>Added support for multi-process tabs, to improve security and overall performance.</li>
<li>Added new jQuery (v1.12.x) scripts to the resource bundle.</li>
<li>Fixed a <span class="help-panel" data-title="Reported by Rob--W."><a href="https://github.com/mozilla/addons-linter/issues/1035#issuecomment-258800562" target="_blank">security issue</a></span> that caused CSPs to be less effective against XSS.</li>
<li>Fixed additional compatibility issues with various Yandex services.</li>
<li>Fixed a <span class="help-panel" data-title="Reported by fireflyy.">grammatical error</span> in the German localization.</li>
</ul>
</div>
<br>
<div class="notice">
<i>Detailed v1.3.5 changelog:</i>
<ul>
<li>Added support for the languages Danish, Esperanto, Swedish, and Russian.</li>
<li>Created additional shorthand mappings to uncover new injection opportunities.</li>
<li>Applied a security update to the embedded local resource audit script.</li>
<li>Fixed reported compatibility issues with various Yandex services.</li>
</ul>
<br>
<i>Detailed v1.3.0 changelog:</i>
<ul>
<li>Decentraleyes now officially supports modern versions of SeaMonkey.</li>
<li>Created mappings for yastatic.net and deprecated its predecessor (yandex.st).</li>
<li>Added test cases, and <span class="help-panel" data-title="With code contributions by Ngksternhagen.">improved existing unit tests</span> and exception handling.</li>
<li>Applied a wide range of performance optimizations and stability improvements.</li>
<li>Added support for localizations and embedded fourteen initial translations.</li>
<li>Implemented a watcher that keeps pages with specific security policies from breaking.</li>
<li><span class="help-panel" data-title="With code contributions by Thegoodthings.">Added a preference</span> to allow users to hide release notes upon install and upgrade.</li>
<li>Optimized mapping expressions to reveal uncommon injection opportunities.</li>
</ul>
<br>
<i>Detailed v1.2.2 changelog:</i>
<ul>
<li>Decentraleyes now supports Fennec (better known as Firefox for mobile).</li>
<li>Experimental support for whitelisting domains from preferences (Add-ons Manager).</li>
<li>Amount of injected resources shown in preferences (Add-ons Manager).</li>
<li>Fixed a rare bug where shorthand mapping notations broke specific websites.</li>
<li>Removed Pale Moon compatibility as it will receive separate, tailored, builds.</li>
<li>Took out rare resources to make room for more common candidates.</li>
<li>Added new AngularJS, Dojo, and <span class="help-panel" data-title="With code contributions by Matthieuy.">jQuery UI</span> scripts to the resource bundle.</li>
</ul>
</div>
<br>
<div class="notice">
<p>
<a href="https://github.com/Synzvato/decentraleyes" target="_blank">GitHub</a> / <a href="https://addons.mozilla.org/en-US/firefox/addon/decentraleyes" target="_blank">Add-on Listing</a> / <a href="https://github.com/Synzvato/decentraleyes/issues/44" target="_blank">Help Translate</a>
<a href="https://github.com/Synzvato/decentraleyes" target="_blank">GitHub</a> / <a href="https://decentraleyes.org" target="_blank">Official Website</a> / <a href="https://github.com/Synzvato/decentraleyes/issues/44" target="_blank">Help Translate</a>
</p>
</div>
......
'use strict';
/**
* Imports
*/
var dataHandler = require("../lib/data-handler");
var dataHandler = require('../lib/data-handler');
/**
* Get Redirection URI Tests
......@@ -31,4 +33,4 @@ exports['test get redirection uri for non-existing file'] = function (assert) {
* Run Tests
*/
require("sdk/test").run(exports);
require('sdk/test').run(exports);
'use strict';
/**
* Imports
*/
var requestAnalyzer = require("../lib/request-analyzer");
var requestAnalyzer = require('../lib/request-analyzer');
/**
* Variables
*/
var localPaths = {
angular: 'resources/angularjs/1.2.19/angular.min.js.dec',
backbone: [
'angular': 'resources/angularjs/1.2.19/angular.min.js.dec',
'backbone': [
'resources/backbone.js/0.9.2/backbone-min.js.dec',
'resources/backbone.js/1.1.2/backbone-min.js.dec'
],
dojo: 'resources/dojo/1.8.3/dojo/dojo.js.dec',
ember: [
'dojo': 'resources/dojo/1.8.3/dojo/dojo.js.dec',
'ember': [
'resources/ember.js/1.1.0/ember.min.js.dec',
'resources/ember.js/2.1.0/ember.min.js.dec'
],
extCore: 'resources/ext-core/3.1.0/ext-core.js.dec',
jQuery: [
'extCore': 'resources/ext-core/3.1.0/ext-core.js.dec',
'jQuery': [
'resources/jquery/1.10.2/jquery.min.js.dec',
'resources/jquery/1.11.1/jquery.min.js.dec'
],
jQueryUI: 'resources/jqueryui/1.10.2/jquery-ui.min.js.dec',
modernizr: 'resources/modernizr/2.6.2/modernizr.min.js.dec',
mootools: 'resources/mootools/1.4.5/mootools-yui-compressed.js.dec',
prototypeJS: 'resources/prototype/1.6.1.0/prototype.js.dec',
scriptaculous: 'resources/scriptaculous/1.9.0/scriptaculous.js.dec',
swfobject: 'resources/swfobject/2.2/swfobject.js.dec',
underscore: [
'jQueryUI': 'resources/jqueryui/1.10.2/jquery-ui.min.js.dec',
'modernizr': 'resources/modernizr/2.6.2/modernizr.min.js.dec',
'mootools': 'resources/mootools/1.4.5/mootools-yui-compressed.js.dec',
'prototypeJS': 'resources/prototype/1.6.1.0/prototype.js.dec',
'scriptaculous': 'resources/scriptaculous/1.9.0/scriptaculous.js.dec',
'swfobject': 'resources/swfobject/2.2/swfobject.js.dec',
'underscore': [
'resources/underscore.js/1.3.3/underscore-min.js.dec',
'resources/underscore.js/1.4.4/underscore-min.js.dec',
'resources/underscore.js/1.6.0/underscore-min.js.dec'
],
webfont: [
'webfont': [
'resources/webfont/1.0.19/webfont.js.dec',
'resources/webfont/1.5.18/webfont.js.dec'
]
......@@ -48,7 +50,7 @@ var localPaths = {
exports['test get request to known cdn'] = function (assert) {
var result = requestAnalyzer.isValidCandidate({
requestMethod: 'GET', URI: { host: 'ajax.googleapis.com' }
'requestMethod': 'GET', 'URI': {'host': 'ajax.googleapis.com'}
});
assert.ok(result, 'Valid candidate was successfully identified.');
......@@ -57,7 +59,7 @@ exports['test get request to known cdn'] = function (assert) {
exports['test post request to known cdn'] = function (assert) {
var result = requestAnalyzer.isValidCandidate({
requestMethod: 'POST', URI: { host: 'ajax.googleapis.com' }
'requestMethod': 'POST', 'URI': {'host': 'ajax.googleapis.com'}
});
assert.equal(result, false, 'Invalid candidate was successfully identified.');
......@@ -66,7 +68,7 @@ exports['test post request to known cdn'] = function (assert) {
exports['test get request to unknown domain'] = function (assert) {
var result = requestAnalyzer.isValidCandidate({
requestMethod: 'GET', URI: { host: 'ajax.example.com' }
'requestMethod': 'GET', 'URI': {'host': 'ajax.example.com'}
});
assert.equal(result, false, 'Invalid candidate was successfully identified.');
......@@ -74,11 +76,14 @@ exports['test get request to unknown domain'] = function (assert) {
exports['test get request from whitelisted domain'] = function (assert) {
require('sdk/simple-prefs').prefs.domainWhitelist = 'example.com';
var result, simplePreferences;
var result = requestAnalyzer.isValidCandidate({
requestMethod: 'GET', URI: { host: 'ajax.googleapis.com' },
referrer: { host: 'example.com' }, setRequestHeader: function () { return false; }
simplePreferences = require('sdk/simple-prefs');
simplePreferences.prefs.domainWhitelist = 'example.com';
result = requestAnalyzer.isValidCandidate({
'requestMethod': 'GET', 'URI': {'host': 'ajax.googleapis.com'},
'referrer': {'host': 'example.com'}, 'setRequestHeader': function () { return false; }
});
assert.equal(result, false, 'Whitelisted request was successfully ignored.');
......@@ -625,4 +630,4 @@ exports['test mootools on upyun library'] = function (assert) {
* Run Tests
*/
require("sdk/test").run(exports);
require('sdk/test').run(exports);
/**
* Embedded WebExtension - Background Script
* Belongs to Decentraleyes.
*
* @author Thomas Rientjes
* @since 2017-08-18
* @license MPL 2.0
*
* 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/.
*/
'use strict';
/**
* Variables
*/
var webextensionPort = {};
var amountInjected = null;
var pendingCount = 0;
/**
* Initializations
*/
webextensionPort = browser.runtime.connect({name: 'webextension'});
/**
* Event Handlers
*/
webextensionPort.onMessage.addListener((message) => {
if (message.subject === 'migrate-preferences') {
browser.storage.local.get(function (items) {
// Covers storage API failures.
if (items === null) {
return;
}
for (let preference of Object.keys(message.content)) {
// Makes sure no existing preferences are overwritten.
if (!items.hasOwnProperty(preference)) {
browser.storage.local.set({
[preference]: message.content[preference]
});
}
}
});
}
if (message.subject === 'register-injection') {
if (amountInjected !== null && !isNaN(amountInjected)) {
++amountInjected;
browser.storage.local.set({amountInjected});
}
++pendingCount;
if (pendingCount > 1) {
return;
}
chrome.storage.local.get({
// The stored amount, or zero.
'amountInjected': 0
}, function (items) {
// Accounts for the fact that the storage API is asynchronous.
amountInjected = (items && items.amountInjected || 0) + pendingCount;
browser.storage.local.set({amountInjected});
});
}
if (message.subject === 'update-preferences') {
chrome.storage.local.set(message.content);
}
});
{
"manifest_version": 2,
"name": "Decentraleyes Module",
"version": "1.3.10",
"author": "Thomas Rientjes",
"background": {
"scripts": [
"background.js"
]
},
"permissions": [
"storage"
]
}