Skip to content

Commit

Permalink
Merge pull request #424 from privacy-tech-lab/issue-418
Browse files Browse the repository at this point in the history
Issue 418
  • Loading branch information
OliverWang13 committed Jun 24, 2023
2 parents fbd7155 + 1cc23e1 commit d3f8987
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/background/protection/protection.js
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ function onMessageHandlerSynchronous(message, sender, sendResponse) {
sendResponse(response);
});
}
return true;
//return true;
}

/**
Expand Down
14 changes: 11 additions & 3 deletions src/content-scripts/injection/gpc-dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,25 @@ content script (registered from the extension service worker) for full DOM acces
function setDomSignal() {
try {
var GPCVal = true;
const GPCDomVal = `Object.defineProperty(Navigator.prototype, "globalPrivacyControl", {
var DNTVal = true;
const GPCDomVal = `Object.defineProperties(Navigator.prototype,
{ "globalPrivacyControl": {
get: () => ${GPCVal},
configurable: true,
enumerable: true
});
document.currentScript.parentElement.removeChild(document.currentScript);
},
"doNotTrack": {
get: () => ${DNTVal},
configurable: true,
enumerable: true
}});
document.currentScript.parentElement.removeChild(document.currentScript);
`;

const GPCDomElem = document.createElement("script");
GPCDomElem.innerHTML = GPCDomVal;
document.documentElement.prepend(GPCDomElem);

} catch (e) {
console.error(`Failed to set DOM signal: ${e}`);
}
Expand Down

0 comments on commit d3f8987

Please sign in to comment.