Skip to content

mstriemer/tracking-protection-experiment

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 

WebExtension API for improved tracking protection

The goal of this API is to improve the performance and ease of writing a tracking protection extension. This is accomplished by updating webRequest to support classifying requests which can be used to reduce the number of calls made to webRequest event handlers.

This experiment only implements support for the onBeforeRequest event.

API

webRequest.classifyRequests(name, options)

This function will setup request classification which can be hooked into in event handlers.

  • name: A name for this class of request.
  • options: The options to filter requests on.
    • domains: An array of domains that match this class.
      • defaults to all domains.
    • thirdParty: A boolean representing if this should only match third-party requests.
      • defaults to false.
webRequest.classifyRequests(
    "tracker",
    { domains: ["example.com", "example.org"], thirdParty: true })

Event handler updates

The filters for events are updated to support the classifiedAs filter. The callback will only be triggered when a request matches the class as defined by a call to webRequest.classifyRequests.

webRequest.onBeforeRequest.addListener(
    handleRequest,
    { classifiedAs: "tracker" },
    ["blocking"])

Structure

There are three components to this repository:

  • experiment/ is the experiment code to implement the proposed API,
  • extension/ is a test extension that uses the proposed API, and
  • webRequest-extension/ is a test extension that does not use the proposed API.

Comments

If you have any comments please file an issue.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published