Skip to content
This repository has been archived by the owner on Nov 15, 2017. It is now read-only.

Commit

Permalink
lots of changes: preparing for 0.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
gorhill committed Nov 6, 2013
1 parent cd76a3b commit bb1b185
Show file tree
Hide file tree
Showing 30 changed files with 1,601 additions and 899 deletions.
4 changes: 4 additions & 0 deletions assets/httpsb-blacklist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@
# For those domain names which are not found in other blacklists

2mdn.net # "2mdn.net is a domain used by Doubleclick which is an advertising company..."
adextent.com # "We are an advertising technology company - we build technologies that improve ads performance"
adgear.com # "AdGear is an online advertising technologies company based in Montreal, Canada"
adnxs.com # "Adnxs.com is run by AppNexus, a company that provides technology, data and analytics to help companies buy and sell online display advertising" (Ref.: http://www.theguardian.com/technology/2012/apr/23/adnxs-tracking-trackers-cookies-web-monitoring)
adobetag.com # "Adobe Announces Adobe Tag Manager for the Online Marketing Suite"
aimatch.com # "Ad Server, SAS® Intelligent Advertising for Publishers"
axf8.net # https://www.eff.org/deeplinks/2013/06/third-party-resources-nsa-leaks
betrad.com # "Evidon: Home | Online Marketing Intelligence, Web Analytics, Privacy" (which also publishes "Ghostery" add-on..)
bizographics.com # "Business Audience Marketing"
bkrtx.com

Expand All @@ -23,9 +25,11 @@ krxd.net # https://www.eff.org/deeplinks/2013/06/third-party-resource
lijit.com # "We provide online advertising services, audience analytics"
llnwd.net # http://en.wikipedia.org/wiki/Limelight_Networks
lduhtrp.net
mathtag.com # "domain used by MediaMath to place cookies, on behalf of its customers, on the computers of visitors to our selected customer's websites and who may view our customer's display advertisements"
moatads.com # https://www.eff.org/deeplinks/2013/06/third-party-resources-nsa-leaks
mookie1.com # "Specializing in online digital advertising, search marketing"
msads.net # Sounds like ads, and no home web page...
omtrdc.net # Redirect to Omniture
outbrain.com # https://www.eff.org/deeplinks/2013/06/third-party-resources-nsa-leaks
parsely.com # http://en.wikipedia.org/wiki/Parse.ly
peer39.net # https://www.eff.org/deeplinks/2013/06/third-party-resources-nsa-leaks
Expand Down
5 changes: 4 additions & 1 deletion background.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@
<body>
<script src="lib/uri.min.js"></script>

<script src="js/types.js"></script>
<script src="js/async.js"></script>
<script src="js/lists.js"></script>
<script src="js/background.js"></script>
<script src="js/httpsb.js"></script>
<script src="js/reqstats.js"></script>
<script src="js/cacher.js"></script>
<script src="js/cookies.js"></script>
<script src="js/inject.js"></script>
<script src="js/lists.js"></script>
<script src="js/profiler.js"></script>
<script src="js/storage.js"></script>
<script src="js/tab.js"></script>
Expand Down
10 changes: 8 additions & 2 deletions css/fonts.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@font-face {
font-family: 'httpsb';
font-style: normal;
font-weight: 400;
font-weight: normal;
src: local('httpsb'), url(fonts/Roboto_Condensed/RobotoCondensed-Regular.ttf) format('truetype');
}
@font-face {
Expand All @@ -13,7 +13,7 @@
@font-face {
font-family: 'httpsb';
font-style: italic;
font-weight: 400;
font-weight: normal;
src: local('httpsb'), url(fonts/Roboto_Condensed/RobotoCondensed-Light.ttf) format('truetype');
}
@font-face {
Expand All @@ -22,4 +22,10 @@
font-weight: bold;
src: local('httpsb'), url(fonts/Roboto_Condensed/RobotoCondensed-BoldItalic.ttf) format('truetype');
}
@font-face {
font-family: 'httpsb';
font-style: normal;
font-weight: 100;
src: local('httpsb'), url(fonts/Roboto_Condensed/RobotoCondensed-Light.ttf) format('truetype');
}

Binary file added img/add-page-permissions.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified img/dialog-information.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/remove-page-permissions.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified img/system-run-symbolic.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified img/view-refresh-symbolic.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 8 additions & 1 deletion js/async.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,10 @@ function updateBadgeCallback(pageUrl) {
return;
}
var pageStats = pageStatsFromTabId(tabId);

// If turned off, used special key in order to warn user
var count = pageStats ? pageStats.requestCount : 0;
var countStr = count.toString();
var countStr = count.toFixed(0);
if ( count >= 1000 ) {
if ( count < 10000 ) {
countStr = countStr.slice(0,1) + '.' + countStr.slice(1,-2) + 'K';
Expand All @@ -120,6 +122,7 @@ function updateBadgeCallback(pageUrl) {
countStr = countStr.slice(0,-6) + 'M';
}
}

chrome.browserAction.setBadgeText({ tabId: tabId, text: countStr });
chrome.browserAction.setBadgeBackgroundColor({ tabId: tabId, color: '#000' });
}
Expand Down Expand Up @@ -181,6 +184,10 @@ function onMessageHandler(request, sender, callback) {
startWebRequestHandler(request.from);
break;

case 'gotoURL':
chrome.tabs.update(request.tabId, { url: request.url });
break;

case 'gotoExtensionUrl':
chrome.tabs.create({'url': chrome.extension.getURL(request.url)});
break;
Expand Down
76 changes: 12 additions & 64 deletions js/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ var HTTPSB = {
strictBlocking: false
},

// memo:
// unicode for hourglass: &#x231B;

runtimeId: 1,

inlineFieldSeparator: '#',
Expand All @@ -59,32 +56,26 @@ var HTTPSB = {

// tabs are used to redirect stats collection to a specific url stats
// structure.
pageUrlToTabId: {},
tabIdToPageUrl: {},
pageUrlToTabId: { },
tabIdToPageUrl: { },

// map["{type}/{domain}"]true
// effective lists
whitelist: { },
blacklist: { '*/*': true },
graylist: { },
// user lists
whitelistUser: {},
blacklistUser: {},
graylistUser: {}, // this will override preset blacklists
// whitelist: new PermissionList(),
// blacklist: new PermissionList(['*|*']),
// graylist: new PermissionList(), // only purpose is to override preset blacklists

// domain => PermissionLists
temporaryScopes: null,
permanentScopes: null,

// Current entries from remote blacklists
blacklistReadonly: {},
// Current entries from remote blacklists --
// just hostnames, '*/' is implied, this saves significantly on memory.
blacklistReadonly: { },

// https://github.com/gorhill/httpswitchboard/issues/19
excludeRegex: /^https?:\/\/chrome\.google\.com\/(extensions|webstore)/,

// constants
GRAY: 0,
DISALLOWED_DIRECT: 1,
ALLOWED_DIRECT: 2,
DISALLOWED_INDIRECT: 3,
ALLOWED_INDIRECT: 4,

// various stats
requestStats: new WebRequestStats(),
cookieRemovedCounter: 0,
Expand All @@ -103,46 +94,3 @@ var HTTPSB = {

/******************************************************************************/

function _WebRequestStats() {
this.all =
this.main_frame =
this.sub_frame =
this.script =
this.image =
this.object =
this.xmlhttprequest =
this.other =
this.cookie = 0;
}

_WebRequestStats.prototype.reset = function() {
this.all =
this.main_frame =
this.sub_frame =
this.script =
this.image =
this.object =
this.xmlhttprequest =
this.other =
this.cookie = 0;
};

function WebRequestStats() {
this.allowed = new _WebRequestStats();
this.blocked = new _WebRequestStats();
}

WebRequestStats.prototype.record = function(type, blocked) {
if ( blocked ) {
this.blocked[type] += 1;
this.blocked.all += 1;
} else {
this.allowed[type] += 1;
this.allowed.all += 1;
}
};

WebRequestStats.prototype.reset = function() {
this.blocked.reset();
this.allowed.reset();
};
Loading

0 comments on commit bb1b185

Please sign in to comment.