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

Tests for implementation on manifest v3 #2189

Open
mneunomne opened this issue Oct 16, 2022 · 9 comments
Open

Tests for implementation on manifest v3 #2189

mneunomne opened this issue Oct 16, 2022 · 9 comments
Assignees

Comments

@mneunomne
Copy link
Collaborator

mneunomne commented Oct 16, 2022

Tests for implementation on manifest v3.

Some things we need to understand before attempting an implementation of "AdNauseam Lite":

  1. Is it possible to implement ad-collection on UBOLite?
  2. Is it possible to implement ad-clicking on UBOLite?
  3. If we implement our own service worker for it, would it cause major performance issues as stated here Chrome extension manifest v3 proposal uBlockOrigin/uBlock-issues#338 (comment)
  4. Would the current interface be possible (or even make sense) for the v3, if not, should we make a specific "lite" design?
  5. What is the impact of the change of source filters to AdNauseam, do we need to make a specific "lite" adnauseam-filters?

We should somehow attempt to test these things on the UBOLite build, even though it is rather at an early stage at the moment.


Links:

@mneunomne
Copy link
Collaborator Author

mneunomne commented Oct 17, 2022

Timeline

https://developer.chrome.com/docs/extensions/mv3/mv2-sunset/

January 2023 Manifest V3 will become a prerequisite for the Featured badge. Enterprise policy can let Manifest V2 extensions run on Chrome deployments within an organization.Staring in Chrome 112, Chrome may run experiments to turn off support for Manifest V2 extensions in Canary, Dev, and Beta channels.
June 2023 All existing Manifest V2 items with visibility set to Public at that time will have their visibility changed to Unlisted. Starting in June in Chrome 115, Chrome may run experiments to turn off support for Manifest V2 extensions in all channels, including stable channel.

AdNauseam timeline

The fact that AdNauseam is not on chrome store gives us more time than uBlock Origin for sure, but still means that we should have a ready stable solution as soon as possible after June 2023.

@mneunomne mneunomne self-assigned this Oct 17, 2022
@mneunomne
Copy link
Collaborator Author

It seems that we would have to implement ad-detection around this function (among others)

https://github.com/gorhill/uBlock/blob/c7715d56bde427063bde6d916ba45a1a41e88751/platform/mv3/extension/js/scripting/css-generic.js#L128-L165

const uBOL_processNodes = ( ) => {
    const t0 = Date.now();
    const hashes = [];
    const nodes = [];
    const deadline = t0 + maxSurveyTimeSlice;
    for (;;) {
        pendingNodes.next(nodes);
        if ( nodes.length === 0 ) { break; }
        for ( const node of nodes ) {
            uBOL_idFromNode(node, hashes);
            uBOL_classesFromNode(node, hashes);
        }
        nodes.length = 0;
        if ( performance.now() >= deadline ) { break; }
    }
    for ( const hash of hashes ) {
        const selectorList = genericSelectorMap.get(hash);
        if ( selectorList === undefined ) { continue; }
        styleSheetSelectors.push(selectorList);
        genericSelectorMap.delete(hash);
    }
    surveyCount += 1;
    if ( styleSheetSelectors.length === 0 ) {
        surveyMissCount += 1;
        if (
            surveyCount >= 100 &&
            (surveyMissCount / surveyCount) >= stopAllRatio
        ) {
            stopAll(`too many misses in surveyor (${surveyMissCount}/${surveyCount})`);
        }
        return;
    }
    if ( styleSheetTimer !== undefined ) { return; }
    styleSheetTimer = self.requestAnimationFrame(( ) => {
        styleSheetTimer = undefined;
        uBOL_injectStyleSheet();
    });
};

@mneunomne
Copy link
Collaborator Author

Popup

Screenshot 2022-10-17 at 12 01 29

The popup menu in theory could simply be substituted by ours again, and have the button to the "UBOLite Menu" like we have now with uBlock Origin

@mneunomne
Copy link
Collaborator Author

mneunomne commented Oct 17, 2022

Dashboard

Not sure yet how much will uBlock still change their dashboard options, currently it looks like this:

Screenshot 2022-10-17 at 12 02 34

It seems that we have to take a similar approach of avoiding to create a service worker from scratch to manage all our options current options.

@mneunomne
Copy link
Collaborator Author

AdVault

https://developer.chrome.com/docs/extensions/mv3/migrating_to_service_workers/#state

It seems that on v3 there is no persistent state for the Service Workers (read above).

The stored data would need to be stored in using the Chrome Storage API, e.g.:

// background.js
chrome.runtime.onMessage.addListener(({ type, name }) => {
  if (type === "set-name") {
    chrome.storage.local.set({ name });
  }
});

chrome.action.onClicked.addListener((tab) => {
  chrome.storage.local.get(["name"], ({ name }) => {
    chrome.tabs.sendMessage(tab.id, { name });
  });
});
[#](https://developer.chrome.com/docs/extensions/mv3/migrating_to_service_workers/#alarms)

@dhowe dhowe changed the title Tests for implementation on manifest v3. Tests for implementation on manifest v3 Oct 17, 2022
@dhowe
Copy link
Owner

dhowe commented Oct 17, 2022

My feeling is that if it is easy to do, then we can consider the changes listed above. But I don't think we have the bandwidth for major changes, especially as we are not in the Chrome store anyhow. Not to mention the maintenance resources to support multiple versions (lite and regular). AdNauseam will work, as is, until at least June 2023, when Google may or may not start disabling MV2 extensions. Between then and now it might be a better use of our time to focus on support for other chromium-based browsers

@mneunomne
Copy link
Collaborator Author

Brave

It seems that Brave intends to support v2 manifest version, and perhaps even have their own web extension store seprate from Chrome:

brave/brave-browser#20059 (comment)

Yes - manifest v2 extensions will be supported by Brave 👍 We'll be taking steps as V2 is sunset by Chromium team (https://developer.chrome.com/docs/extensions/mv3/mv2-sunset/)

During the deprecation period, we can keep this functionality via patch (since it's there for Enterprise). After V2 is pulled from store, we'll need to stand up our own extension store for manifest v2

@Coolguy3289
Copy link

Just discovered this, think it's a great project! I'm also curious now that we're at the end of June 2023 if there's been any progress or updates on the status of moving to mv3? Based on the reading I've done it seems like it will create a lot of limitations/reworking of the extension, but was just wondering if any work has been done to prep for this change as of yet?

@dtantono
Copy link

I understand that new Adnauseam Lite will be developed and it is quite different from the original one. Will this addon appear on chrome store?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants