Skip to content

Commit

Permalink
Don't inject fp. detection into first party frames
Browse files Browse the repository at this point in the history
  • Loading branch information
ghostwords committed Apr 9, 2018
1 parent 966647a commit 7f7ff1d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/js/contentscripts/fingerprinting.js
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ function insertFpScript(text, data) {
}

// TODO race condition; fix waiting on https://crbug.com/478183
chrome.runtime.sendMessage({checkEnabled: true},
chrome.runtime.sendMessage({checkEnabledAndThirdParty: true},
function (enabled) {
if (!enabled) {
return;
Expand All @@ -335,7 +335,7 @@ chrome.runtime.sendMessage({checkEnabled: true},
document.addEventListener(event_id, function (e) {
// pass these on to the background page
chrome.runtime.sendMessage({
'fpReport': e.detail
fpReport: e.detail
});
});

Expand Down
15 changes: 9 additions & 6 deletions src/js/webrequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,15 @@ function dispatcher(request, sender, sendResponse) {
window.extractHostFromURL(sender.tab.url)
));

} else if (request.checkEnabledAndThirdParty) {
let tab_host = window.extractHostFromURL(sender.tab.url),
frame_host = window.extractHostFromURL(sender.url);

sendResponse(
badger.isPrivacyBadgerEnabled(tab_host) &&
isThirdPartyDomain(frame_host, tab_host)
);

} else if (request.checkLocation) {
if (!badger.isPrivacyBadgerEnabled(window.extractHostFromURL(sender.tab.url))) {
return sendResponse();
Expand Down Expand Up @@ -688,12 +697,6 @@ function dispatcher(request, sender, sendResponse) {
recordSuperCookie(sender, request.superCookieReport);
}

} else if (request.checkEnabledAndThirdParty) {
let tab_host = window.extractHostFromURL(sender.tab.url),
frame_host = window.extractHostFromURL(sender.url);

sendResponse(badger.isPrivacyBadgerEnabled(tab_host) && isThirdPartyDomain(frame_host, tab_host));

} else if (request.checkSocialWidgetReplacementEnabled) {
sendResponse(badger.isPrivacyBadgerEnabled(window.extractHostFromURL(sender.tab.url)) && badger.isSocialWidgetReplacementEnabled());

Expand Down

0 comments on commit 7f7ff1d

Please sign in to comment.