WhoTargetsMe / Who-Targets-Me

A browser extension that uncovers which advertisers on social media are targeting which demographics
https://whotargets.me
MIT License
87 stars 16 forks source link

Migrating Chrome Extension to Manifest V3 #100

Closed DanazSdiq closed 1 year ago

DanazSdiq commented 1 year ago

Related Ticket/PR

Changes

This PR migrates the Chrome extension to manifest V3. Most likely, we have to maintain different listeners for Chrome and Firefox versions of the extension because service workers are still not implemented in Firefox. To minimize the hassle of handling these discrepancies, I have extracted these handlers into reusable pieces of code that can be injected to Firefox's event listeners with little to no changes (those changes are yet to be made).

The most important change when migrating to manifest V3 is introducing daemon/initOverload.js script. In basic terms, daemon/initOverload is where we have access to both chrome.runtime and window. This allows us to communicate to and from the worker to the outside of the worker, which is where we essentially handle ads.

Requirements Before Merging

DanazSdiq commented 1 year ago

I realized that I have not taken the backward compatibility of userData.isNotifiedUser into account. I changed the value of that attribute from string to boolean. Let's not merge this until I investigate that a bit further