Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Firefox MV3 Migration #462

Merged
merged 17 commits into from
May 22, 2024
Prev Previous commit
Next Next commit
Fixed bleedover bug for chrome (Issue #350)
  • Loading branch information
OliverWang13 committed May 11, 2024
commit 2611993c2d1ff2611da1d1b325af6543a8de13e7
24 changes: 13 additions & 11 deletions src/background/protection/protection.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ async function sendData(){
let currentDomain = await getCurrentParsedDomain();
// console.log("activeTabID: ",activeTabID);
// console.log("DP3P: ", domPrev3rdParties);
// console.log("tabs: ", tabs);
console.log("tabs: ", tabs);
// console.log("activeTabID: ", activeTabID);
// console.log("test test1: ", tabs[activeTabID]);
// console.log("test test2: ", tabs[activeTabID]["REQUEST_DOMAINS"]);
Expand Down Expand Up @@ -186,28 +186,30 @@ async function updateDomainlist(details) {
let parsedDomain = parsedUrl.domain;
let currDomainValue = await storage.get(stores.domainlist, parsedDomain);

console.log("origin url: ", details.documentUrl);
console.log("origin url: ", details.tabId);

let origin_url = new URL(details.documentUrl);
let parsed_origin = psl.parse(origin_url.hostname);
let parsedOrigin = parsed_origin.domain;
// let origin_url = new URL(details.originUrl);
// let parsed_origin = psl.parse(origin_url.hostname);
// let parsedOrigin = parsed_origin.domain;

let id = details.tabId;

if (currDomainValue === undefined) {
await storage.set(stores.domainlist, null, parsedDomain); // Sets to storage async
}

//let currentDomain = await getCurrentParsedDomain();
let currentDomain = await getCurrentParsedDomain();


//get the current parsed domain--this is used to store 3rd parties (using globalParsedDomain variable)
if (!(activeTabID in domPrev3rdParties)){
domPrev3rdParties[activeTabID] = {};
if (!(id in domPrev3rdParties)){
domPrev3rdParties[id] = {};
}
if (!(parsedOrigin in domPrev3rdParties[activeTabID]) ){
domPrev3rdParties[activeTabID][parsedOrigin] = {};
if (!(currentDomain in domPrev3rdParties[activeTabID]) ){
domPrev3rdParties[id][currentDomain] = {};
}
//as they come in, add the parsedDomain to the object with null value (just a placeholder)
domPrev3rdParties[activeTabID][parsedOrigin][parsedDomain] = null;
domPrev3rdParties[id][currentDomain][parsedDomain] = null;


}
Expand Down