Issue with chrome.declarativeNetRequest Not Blocking Requests Over Time

184 views
Skip to first unread message

Tom Benattar

unread,
Nov 15, 2023, 5:33:17 AM11/15/23
to Chromium Extensions, ste...@getmailtracker.com
Hi Chrome Developer Community,

I'm working on an email tracking extension for Gmail, utilizing the chrome.declarativeNetRequest API. Our extension aims to block certain network requests when users open emails, ensuring these opens aren't counted by our tracking system.

We employ both Dynamic and Static Rules for this purpose. The Static Rules are a fallback to handle scenarios where the JavaScript might not be loaded.

However, we've encountered a recurring issue reported by several users. After Chrome has been open for an extended period, it appears that our blocking rules stop functioning, and the requests that should be blocked are getting sent.

Here are some specific details:
  • Rule Example: { id: 2, priority: 1, action: { type: "block" }, condition: { urlFilter: "*pixel*user=" + user.id + "&end=1*", resourceTypes: ["image"] } }
  • Issue Observation: The rule works as expected initially but fails after Chrome has been active for a long time.
  • Configuration: We're using a mix of Dynamic and Static Rules, with the latter as a backup.
I'm looking for insights or suggestions on the following:
  1. Are there known issues with chrome.declarativeNetRequest in relation to browser uptime?
  2. Could this be related to rule limits, caching, or service worker interactions?
  3. Any best practices or troubleshooting steps recommended for such a scenario?

Any assistance or guidance would be greatly appreciated.

Thanks in advance!

Tom 

Oliver Dunk

unread,
Nov 15, 2023, 5:37:27 AM11/15/23
to Tom Benattar, Chromium Extensions, ste...@getmailtracker.com
Hi Tom,

Thanks for sharing this. I'll try to answer each of your questions:
  1. I'm not aware of any. That's not to say they don't exist of course, but it would be new to the team as far as I know :)
  2. I don't believe DNR has much of a link to the service worker part of the code, so I would be surprised if there was a link.
  3. That's a tough one! Steps to reproduce are always the most useful thing. I would definitely check the registered rules with the API to make sure they are still registered and not lost. You could also file a bug and the engineering team may be able to make some more suggestions.
Hope this helps.
Oliver Dunk | DevRel, Chrome Extensions | https://developer.chrome.com/ | London, GB


--
You received this message because you are subscribed to the Google Groups "Chromium Extensions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-extens...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-extensions/23a5098b-c429-485f-80fb-f2e968538829n%40chromium.org.

Tom Benattar

unread,
Nov 15, 2023, 5:44:41 AM11/15/23
to Chromium Extensions, Oliver Dunk, Chromium Extensions, ste...@getmailtracker.com, Tom Benattar
Thank you so much for your prompt reply Oliver! I'll reach out the engineering team. 
Reply all
Reply to author
Forward
0 new messages